mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-04 00:38:11 +00:00
Require shops to use names instead of ids
This commit is contained in:
@@ -18,15 +18,16 @@ def create_shop(hash)
|
||||
end
|
||||
|
||||
npcs, name = hash[:npcs], hash[:name]
|
||||
npcs = [npcs] unless npcs.is_a?(Array)
|
||||
currency = hash[:currency] || DEFAULT_CURRENCY
|
||||
|
||||
options = hash[:npc_options] || [1]
|
||||
buys = hash[:buys] || :own
|
||||
|
||||
items = hash.delete(:items).collect { |data| ShopItem.new(*data) }
|
||||
items = hash.delete(:items).collect { |data| ShopItem.new(lookup_item(data[0]), data[1]) }
|
||||
shop = Shop.new(name, items, currency, options, buys)
|
||||
|
||||
npcs.each { |npc| SHOPS[npc] = shop }
|
||||
npcs.map { |name| lookup_npc(name) }.each { |npc| SHOPS[npc] = shop }
|
||||
end
|
||||
|
||||
private
|
||||
@@ -297,4 +298,4 @@ def buy(shop, player, message, currency)
|
||||
end
|
||||
|
||||
# Declares the open_shop attribute, which contains the id of the currently open shop.
|
||||
declare_attribute(:open_shop, -1)
|
||||
declare_attribute(:open_shop, -1)
|
||||
|
||||
Reference in New Issue
Block a user