Class: Wowr::Classes::ItemInfo
Overview
uses item-info.xml
Instance Attribute Summary collapse
-
#cost ⇒ Object
readonly
Returns the value of attribute cost.
-
#created_by ⇒ Object
readonly
Returns the value of attribute created_by.
-
#disenchant_items ⇒ Object
(also: #disenchants)
readonly
Returns the value of attribute disenchant_items.
-
#disenchant_skill_rank ⇒ Object
readonly
Returns the value of attribute disenchant_skill_rank.
-
#drop_creatures ⇒ Object
readonly
Returns the value of attribute drop_creatures.
-
#level ⇒ Object
readonly
Returns the value of attribute level.
-
#objective_of_quests ⇒ Object
readonly
Returns the value of attribute objective_of_quests.
-
#plans_for ⇒ Object
readonly
Returns the value of attribute plans_for.
-
#quality ⇒ Object
readonly
Returns the value of attribute quality.
-
#reward_from_quests ⇒ Object
readonly
Returns the value of attribute reward_from_quests.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#vendors ⇒ Object
readonly
Returns the value of attribute vendors.
Attributes inherited from Item
Instance Method Summary collapse
-
#initialize(elem, api = nil) ⇒ ItemInfo
constructor
A new instance of ItemInfo.
Methods inherited from Item
Constructor Details
#initialize(elem, api = nil) ⇒ ItemInfo
Returns a new instance of ItemInfo.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/wowr/item.rb', line 89 def initialize(elem, api = nil) super(elem, api) @level = elem[:level].to_i @quality = elem[:quality].to_i @type = elem[:type] # Cost can be in gold, or tokens @cost = ItemCost.new(elem%'cost') if (elem%'cost') # is costs really an array? #@costs = [] #(elem/:cost).each do |cost| # @costs << ItemCost.new(cost) #end etc = [ ['disenchantLoot', '@disenchant_items', 'item', DisenchantItem, true], ['objectiveOfQuests', '@objective_of_quests', 'quest', ItemQuest, false], ['rewardFromQuests', '@reward_from_quests', 'quest', ItemQuest, false], ['vendors', '@vendors', 'creature', ItemVendor, false], ['dropCreatures', '@drop_creatures', 'creature', ItemDropCreature, false], ['plansFor', '@plans_for', 'spell', ItemPlansFor, true], ['createdBy', '@created_by', 'spell', ItemCreatedBy, true], ] etc.each do |b| ele = b[0] var = b[1] list = b[2] my_class = b[3] requires_api = b[4] if elem%ele tmp_arr = [] (elem%ele/list).each do |x| if requires_api tmp_arr << my_class.new(x, api) else tmp_arr << my_class.new(x) end end self.instance_variable_set(var, tmp_arr) end end if (elem%'disenchantLoot') @disenchant_skill_rank = (elem%'disenchantLoot')[:requiredSkillRank].to_i # @disenchant_items = [] # (elem%'disenchantLoot'/:item).each do |item| # @disenchant_items << DisenchantItem.new(item) # end end # if (elem%'objectiveOfQuests') # @objective_of_quests = [] # (elem%'objectiveOfQuests'/:quest).each do |quest| # @objective_of_quests << ItemQuest.new(quest) # end # end # # if (elem%'rewardFromQuests') # @reward_from_quests = [] # (elem%'rewardFromQuests'/:quest).each do |quest| # @reward_from_quests << ItemQuest.new(quest) # end # end # # if (elem%'vendors') # @vendors = [] # (elem%'vendors'/:creature).each do |vendor| # @vendors << ItemVendor.new(vendor) # end # end # # if (elem%'dropCreatures') # @drop_creatures = [] # (elem%'dropCreatures'/:creature).each do |creature| # @drop_creatures << ItemDropCreature.new(creature) # end # end # # if (elem%'plansFor') # @plans_for = [] # (elem%'plansFor'/:spell).each do |plan| # @plans_for << ItemPlansFor.new(plan) # end # end # # if (elem%'createdBy') # @created_by = [] # (elem%'createdBy'/:spell).each do |c| # @created_by << ItemCreatedBy.new(c) # end # end end |
Instance Attribute Details
#cost ⇒ Object (readonly)
Returns the value of attribute cost.
80 81 82 |
# File 'lib/wowr/item.rb', line 80 def cost @cost end |
#created_by ⇒ Object (readonly)
Returns the value of attribute created_by.
80 81 82 |
# File 'lib/wowr/item.rb', line 80 def created_by @created_by end |
#disenchant_items ⇒ Object (readonly) Also known as: disenchants
Returns the value of attribute disenchant_items.
80 81 82 |
# File 'lib/wowr/item.rb', line 80 def disenchant_items @disenchant_items end |
#disenchant_skill_rank ⇒ Object (readonly)
Returns the value of attribute disenchant_skill_rank.
80 81 82 |
# File 'lib/wowr/item.rb', line 80 def disenchant_skill_rank @disenchant_skill_rank end |
#drop_creatures ⇒ Object (readonly)
Returns the value of attribute drop_creatures.
80 81 82 |
# File 'lib/wowr/item.rb', line 80 def drop_creatures @drop_creatures end |
#level ⇒ Object (readonly)
Returns the value of attribute level.
80 81 82 |
# File 'lib/wowr/item.rb', line 80 def level @level end |
#objective_of_quests ⇒ Object (readonly)
Returns the value of attribute objective_of_quests.
80 81 82 |
# File 'lib/wowr/item.rb', line 80 def objective_of_quests @objective_of_quests end |
#plans_for ⇒ Object (readonly)
Returns the value of attribute plans_for.
80 81 82 |
# File 'lib/wowr/item.rb', line 80 def plans_for @plans_for end |
#quality ⇒ Object (readonly)
Returns the value of attribute quality.
80 81 82 |
# File 'lib/wowr/item.rb', line 80 def quality @quality end |
#reward_from_quests ⇒ Object (readonly)
Returns the value of attribute reward_from_quests.
80 81 82 |
# File 'lib/wowr/item.rb', line 80 def reward_from_quests @reward_from_quests end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
80 81 82 |
# File 'lib/wowr/item.rb', line 80 def type @type end |
#vendors ⇒ Object (readonly)
Returns the value of attribute vendors.
80 81 82 |
# File 'lib/wowr/item.rb', line 80 def vendors @vendors end |