class Rsrb::Item::ItemDefinition
Constants
- BOOL_PROPERTIES
- PROPERTIES
prices, basevalue
Attributes
id[R]
properties[R]
Public Class Methods
for_id(id)
click to toggle source
# File lib/rsrb/model/item.rb, line 107 def ItemDefinition.for_id(id) if @@definitions[id] == nil @@definitions[id] = ItemDefinition.new(id) end @@definitions[id] end
load()
click to toggle source
# File lib/rsrb/model/item.rb, line 115 def ItemDefinition.load @@db = SQLite3::Database.new('assets/items.db', readonly: true) rescue StandardError => e WORLD.err 'An error occurred while loading item definitions!', e end
new(id)
click to toggle source
# File lib/rsrb/model/item.rb, line 81 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 lib/rsrb/model/item.rb, line 99 def highalc (0.6 * basevalue).to_i end
lowalc()
click to toggle source
# File lib/rsrb/model/item.rb, line 103 def lowalc (0.4 * basevalue).to_i end