Files
apollo/game/data/plugins/shops/shop.rb
KeepBotting 739c331860 Housekeeping
2019-03-26 14:05:40 -04:00

29 lines
662 B
Ruby

require 'java'
java_import 'org.apollo.game.model.inv.Inventory'
# A shop containing items that can be sold.
class Shop
attr_reader :buys, :currency, :items, :inventory, :name, :npc_options
def initialize(name, items, currency, options, buys)
@name = name
@items = items
@currency = currency
@buys = buys
@npc_options = options
@inventory = Inventory.new(DEFAULT_CAPACITY, Inventory::StackMode::STACK_ALWAYS)
items.each { |item| @inventory.add(item.id, item.amount) }
end
end
private
# The `Currency` used by default.
DEFAULT_CURRENCY = Currency.new(995, 'coins')
# The default capacity of a shop.
DEFAULT_CAPACITY = 30