Class: Wowr::Classes::ItemCost

Inherits:
Object
  • Object
show all
Defined in:
lib/wowr/classes.rb

Overview

Cost can be gold or a set of required tokens See ItemCostToken <cost sellPrice=“280” buyPrice=“5600”></cost> <cost> <token icon=“spell_holy_championsbond” id=“29434” count=“60”></token> </cost>

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(elem) ⇒ ItemCost

Returns a new instance of ItemCost.



1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
# File 'lib/wowr/classes.rb', line 1116

def initialize(elem)
  @buy_price   = elem[:buyPrice].to_i if elem[:buyPrice]
  @sell_price  = elem[:sellPrice].to_i  if elem[:sellPrice]
  
  if (elem%'token')
    @tokens = []
    (elem/:token).each do |token|
      @tokens << ItemCostToken.new(token)
    end
  end
end

Instance Attribute Details

#buy_priceObject (readonly)

Returns the value of attribute buy_price.



1114
1115
1116
# File 'lib/wowr/classes.rb', line 1114

def buy_price
  @buy_price
end

#sell_priceObject (readonly)

Returns the value of attribute sell_price.



1114
1115
1116
# File 'lib/wowr/classes.rb', line 1114

def sell_price
  @sell_price
end

#tokensObject (readonly)

Returns the value of attribute tokens.



1114
1115
1116
# File 'lib/wowr/classes.rb', line 1114

def tokens
  @tokens
end