From dfd52b4a53722311979744502a83a6732620c2c1 Mon Sep 17 00:00:00 2001 From: Major- Date: Sun, 30 Aug 2015 23:26:52 +0100 Subject: [PATCH] Add support for the same shop to belong to multiple npcs. --- data/plugins/shops/shops.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/data/plugins/shops/shops.rb b/data/plugins/shops/shops.rb index 9f5f9cb8..edc15593 100644 --- a/data/plugins/shops/shops.rb +++ b/data/plugins/shops/shops.rb @@ -13,11 +13,11 @@ SHOPS = {} # Creates the Shop from the specified Hash. def create_shop(hash) - unless hash.has_keys?(:items, :name, :npc_id) - fail 'Shop name, npc, and items must be specified to create a shop.' + unless hash.has_keys?(:items, :name, :npcs) + fail 'Shop name, npcs, and items must be specified to create a shop.' end - npc_id, name = hash[:npc_id], hash[:name] + npcs, name = hash[:npcs], hash[:name] currency = hash[:currency] || DEFAULT_CURRENCY options = hash[:npc_options] || [1] @@ -26,7 +26,7 @@ def create_shop(hash) items = hash.delete(:items).collect { |data| ShopItem.new(*data) } shop = Shop.new(name, items, currency, options, buys) - SHOPS[npc_id] = shop + npcs.each { |npc| SHOPS[npc] = shop } end private