Class: Wowr::Classes::ItemTooltip
Overview
Provides detailed item information Note that the item-tooltip.xml just returns an empty document when the item can’t be found.
Instance Attribute Summary collapse
-
#allowable_classes ⇒ Object
readonly
:id, :name, :icon,.
-
#armor ⇒ Object
readonly
:id, :name, :icon,.
-
#bonding ⇒ Object
readonly
:id, :name, :icon,.
-
#bonuses ⇒ Object
readonly
:id, :name, :icon,.
-
#class_id ⇒ Object
readonly
:id, :name, :icon,.
-
#desc ⇒ Object
(also: #description)
readonly
:id, :name, :icon,.
-
#durability ⇒ Object
readonly
:id, :name, :icon,.
-
#gem_properties ⇒ Object
readonly
:id, :name, :icon,.
-
#item_source ⇒ Object
readonly
:id, :name, :icon,.
-
#max_count ⇒ Object
readonly
:id, :name, :icon,.
-
#overall_quality_id ⇒ Object
readonly
:id, :name, :icon,.
-
#required_level ⇒ Object
readonly
:id, :name, :icon,.
-
#resistances ⇒ Object
readonly
:id, :name, :icon,.
-
#socket_match_enchant ⇒ Object
readonly
:id, :name, :icon,.
-
#sockets ⇒ Object
readonly
:id, :name, :icon,.
Attributes inherited from Item
Instance Method Summary collapse
-
#initialize(elem, api = nil) ⇒ ItemTooltip
constructor
A new instance of ItemTooltip.
Methods inherited from Item
Constructor Details
#initialize(elem, api = nil) ⇒ ItemTooltip
Returns a new instance of ItemTooltip.
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
# File 'lib/wowr/item.rb', line 206 def initialize(elem, api = nil) super(elem, api) @id = (elem%'id').html.to_i @name = (elem%'name').html @icon_base = (elem%'icon').html @desc = (elem%'desc').html if (elem%'desc') @overall_quality_id = (elem%'overallQualityId').html.to_i @bonding = (elem%'bonding').html.to_i @stackable = (elem%'stackable').html.to_i if (elem%'stackable') @max_count = (elem%'maxCount').html.to_i if (elem%'maxCount') @class_id = (elem%'classId').html.to_i @required_level = (elem%'requiredLevel').html.to_i if (elem%'requiredLevel') @equipData = ItemEquipData.new(elem%'equipData') # TODO: This appears to be a plain string at the moment #<gemProperties>+26 Healing +9 Spell Damage and 2% Reduced Threat</gemProperties> @gem_properties = (elem%'gemProperties').html if (elem%'gemProperties') # not all items have damage data @damage = ItemDamageData.new(elem%'damageData') if !(elem%'damageData').html.empty? # TODO: Test socket data with a variety of items # TODO: replace with socket Class? if (elem%'socketData') @sockets = [] (elem%'socketData'/:socket).each do |socket| @sockets << socket[:color] end @socket_match_enchant = (elem%'socketData'%'socketMatchEnchant') end # When there is no data, stats are not present in @bonuses # TODO: When there is no stats at all, @bonuses shouldn't be set @bonuses = {} bonus_stats = { :strength => :bonusStrength, :agility => :bonusAgility, :stamina => :bonusStamina, :intellect => :bonusIntellect, :spirit => :bonusSpirit } bonus_stats.each do |stat, xml_elem| @bonuses[stat] = test_stat(elem/xml_elem) if test_stat(elem/xml_elem) end # Resistances @resistances = {} resist_stats = { :arcane => :arcaneResist, :fire => :fireResist, :frost => :frostResist, :holy => :holyResist, :nature => :natureResist, :shadow => :shadowResist } resist_stats.each do |stat, xml_elem| @resistances[stat] = test_stat(elem/xml_elem) if test_stat(elem/xml_elem) end if (elem%'allowableClasses') @allowable_classes = [] (elem%'allowableClasses'/:class).each do |klass| @allowable_classes << klass.html end end # NOTE not representing armor bonus @armor = (elem%'armor').html.to_i if (elem%'armor') # NOTE not representing max @durability = (elem%'durability')[:current].to_i if (elem%'durability') if (elem%'spellData') @spells = [] (elem%'spellData'/:spell).each do |spell| @spells << ItemSpell.new(spell) end end @setData = ItemSetData.new(elem%'setData') if (elem%'setData') # @item_sources = [] # (elem/:itemSource).each do |source| # @item_sources << ItemSource.new(source) # end @item_source = ItemSource.new(elem%'itemSource') if (elem%'itemSource') # TODO: More than once source? end |
Instance Attribute Details
#allowable_classes ⇒ Object (readonly)
:id, :name, :icon,
196 197 198 |
# File 'lib/wowr/item.rb', line 196 def allowable_classes @allowable_classes end |
#armor ⇒ Object (readonly)
:id, :name, :icon,
196 197 198 |
# File 'lib/wowr/item.rb', line 196 def armor @armor end |
#bonding ⇒ Object (readonly)
:id, :name, :icon,
196 197 198 |
# File 'lib/wowr/item.rb', line 196 def bonding @bonding end |
#bonuses ⇒ Object (readonly)
:id, :name, :icon,
196 197 198 |
# File 'lib/wowr/item.rb', line 196 def bonuses @bonuses end |
#class_id ⇒ Object (readonly)
:id, :name, :icon,
196 197 198 |
# File 'lib/wowr/item.rb', line 196 def class_id @class_id end |
#desc ⇒ Object (readonly) Also known as: description
:id, :name, :icon,
196 197 198 |
# File 'lib/wowr/item.rb', line 196 def desc @desc end |
#durability ⇒ Object (readonly)
:id, :name, :icon,
196 197 198 |
# File 'lib/wowr/item.rb', line 196 def durability @durability end |
#gem_properties ⇒ Object (readonly)
:id, :name, :icon,
196 197 198 |
# File 'lib/wowr/item.rb', line 196 def gem_properties @gem_properties end |
#item_source ⇒ Object (readonly)
:id, :name, :icon,
196 197 198 |
# File 'lib/wowr/item.rb', line 196 def item_source @item_source end |
#max_count ⇒ Object (readonly)
:id, :name, :icon,
196 197 198 |
# File 'lib/wowr/item.rb', line 196 def max_count @max_count end |
#overall_quality_id ⇒ Object (readonly)
:id, :name, :icon,
196 197 198 |
# File 'lib/wowr/item.rb', line 196 def overall_quality_id @overall_quality_id end |
#required_level ⇒ Object (readonly)
:id, :name, :icon,
196 197 198 |
# File 'lib/wowr/item.rb', line 196 def required_level @required_level end |
#resistances ⇒ Object (readonly)
:id, :name, :icon,
196 197 198 |
# File 'lib/wowr/item.rb', line 196 def resistances @resistances end |
#socket_match_enchant ⇒ Object (readonly)
:id, :name, :icon,
196 197 198 |
# File 'lib/wowr/item.rb', line 196 def socket_match_enchant @socket_match_enchant end |
#sockets ⇒ Object (readonly)
:id, :name, :icon,
196 197 198 |
# File 'lib/wowr/item.rb', line 196 def sockets @sockets end |