]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
[plugin] wow removed, uses broken api.
authorMatthias H <apoc@sixserv.org>
Fri, 21 Feb 2014 00:03:14 +0000 (01:03 +0100)
committerMatthias H <apoc@sixserv.org>
Fri, 21 Feb 2014 00:03:14 +0000 (01:03 +0100)
The xml is no longer available. Could be fixed using this:
http://us.battle.net/api/wow/realm/status?realm=Hyjal

data/rbot/plugins/wow.rb [deleted file]

diff --git a/data/rbot/plugins/wow.rb b/data/rbot/plugins/wow.rb
deleted file mode 100644 (file)
index 8701c76..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-#-- vim:sw=2:et
-#++
-#
-# :title: World of Warcraft Realm Status plugin for rbot
-#
-# Author:: MrChucho (mrchucho@mrchucho.net)
-# Copyright:: (C) 2006 Ralph M. Churchill
-#
-# Requires:: insatiable appetite for World of Warcraft
-
-require 'rexml/document'
-
-class Realm
-    attr_accessor :name,:status,:type,:pop
-    def initialize(name,status,type,pop)
-        self.name = pretty_realm(name)
-        self.status = pretty_status(status)
-        self.type = pretty_type(type)
-        self.pop = pretty_pop(pop)
-    end
-    def to_s
-        "#{name} (#{type}) Status: #{status} Population: #{pop}"
-    end
-    # just a longer, tabluar format
-    # might be good if displaying multiple realms
-    def _to_s
-        sprintf("%-8s %-20s %-8s %-9s\n%-11s %-22s %-8s %-9s",
-            "Status","Realm","Type","Population",
-            status,name,type,pop)
-    end
-private
-    def pretty_status(status)
-        case status
-        when 1
-            "\ 33Up\ 3"
-        when 2
-            "\ 35Down\ 3"
-        end
-    end
-    def pretty_pop(pop)
-        case pop
-        when 1
-            "\ 33Low\ 3"
-        when 2
-            "\ 37Medium\ 3"
-        when 3
-            "\ 34High\ 3"
-        when 4
-            "\ 35Max(Queued)\ 3"
-        end
-    end
-    def pretty_realm(realm)
-        "\ 2#{realm}\ 2"
-    end
-    def pretty_type(type)
-        case type
-        when 0
-            'RP-PVP'
-        when 1
-            'Normal'
-        when 2
-            'PVP'
-        when 3
-            'RP'
-        end
-    end
-end
-
-class RealmPlugin < Plugin
-    USAGE="realm <realm> => determine the status of a Warcraft realm"
-    def initialize
-        super
-        class << @registry
-            def store(val)
-                val
-            end
-            def restore(val)
-                val
-            end
-        end
-    end
-    def help(plugin,topic="")
-        USAGE
-    end
-    def usage(m,params={})
-        m.reply USAGE
-    end
-    def get_realm_status(realm_name)
-        begin
-          xmldoc = @bot.httputil.get("http://www.worldofwarcraft.com/realmstatus/status.xml", :cache => false)
-          raise "unable to retrieve realm status" unless xmldoc
-          realm_list = (REXML::Document.new xmldoc).root
-          realm_data = realm_list.get_elements("//r[@n=\"#{realm_name}\"]").first
-          if realm_data and realm_data.attributes.any? then
-            realm = Realm.new(
-              realm_data.attributes['n'],
-              realm_data.attributes['s'].to_i,
-              realm_data.attributes['t'].to_i,
-              realm_data.attributes['l'].to_i)
-            realm.to_s
-          else
-            "realm #{realm_name} not found."
-          end
-        rescue => err
-          "error retrieving realm status: #{err}"
-        end
-    end
-    def realm(m,params)
-      if params[:realm_name] and params[:realm_name].any?
-        realm_name = params[:realm_name].collect{|tok|
-          tok.capitalize
-        }.join(' ')
-        @registry[m.sourcenick] = realm_name
-        m.reply get_realm_status(realm_name)
-      else
-        if @registry.has_key?(m.sourcenick)
-          realm_name = @registry[m.sourcenick]
-          m.reply get_realm_status(realm_name)
-        else
-          m.reply "I don't know which realm you want.\n#{USAGE}"
-        end
-      end
-    end
-end
-plugin = RealmPlugin.new
-plugin.map 'realm *realm_name',
-  :defaults => {:realm_name => false}, :thread => true