Sha256: 8bc869a98608d2e553f6dd9d67ee178b697d0539425341ba6753b6660f85f6ff
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
items = [ { 'id' => 'hp', 'name' => 'Healing Potion', 'quantity' => -1, 'consumable' => GameMachine::MessageLib::Consumable.new.set_type('health').set_size('small') }, { 'id' => 'sw', 'name' => 'Sword', 'quantity' => 100, 'weapon' => GameMachine::MessageLib::Weapon.new.set_attack(5).set_delay(3), 'cost' => GameMachine::MessageLib::Cost.new.set_amount(5).set_currency('gold') }, { 'id' => 'helm', 'name' => 'Helm', 'quantity' => 1000 }, { 'id' => 'shoes', 'name' => 'Shoes', 'quantity' => -1 }, { 'id' => 'gold', 'name' => 'Gold', 'quantity' => -1 } ] items.each do |item| player_item = GameMachine::MessageLib::PlayerItem.new player_item.set_id(item['id']) player_item.set_name(item['name']) player_item.set_quantity(item['quantity']) ['consumable','weapon','cost'].each do |component| if item[component] player_item.send("set_#{component}".to_sym,item[component]) end end unless player_item.db_save('global') puts player_item.dbErrors.inspect end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
game_machine-1.0.4 | games/tutorial/seed.rb |
game_machine-1.0.2 | games/tutorial/seed.rb |