class RuneRb::Item::ItemDefinition
Constants
- BOOL_PROPERTIES
- PROPERTIES
prices, basevalue
Attributes
id[R]
properties[R]
Public Class Methods
for_id(id)
click to toggle source
# File app/model/item.rb, line 59 def ItemDefinition.for_id(id) if @@definitions[id] == nil @@definitions[id] = ItemDefinition.new(id) end @@definitions[id] end
load()
click to toggle source
# File app/model/item.rb, line 67 def ItemDefinition.load @@db = SQLite3::Database.new('./data/items.db', :readonly => true) end
new(id)
click to toggle source
# File app/model/item.rb, line 33 def initialize(id) @id = id @properties = lambda do |key| if PROPERTIES.include?(key) val = @@db.get_first_value("select #{key} from items where id = #{@id}") BOOL_PROPERTIES.include?(key) ? val == 1 : val else nil end end end
Public Instance Methods
highalc()
click to toggle source
# File app/model/item.rb, line 51 def highalc (0.6 * basevalue).to_i end
lowalc()
click to toggle source
# File app/model/item.rb, line 55 def lowalc (0.4 * basevalue).to_i end