mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 16:49:11 +00:00
29 lines
662 B
Ruby
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
|