class Olib::Shop::Playershop
Public Class Methods
balance()
click to toggle source
# File lib/Olib/shops.rb, line 122 def Playershop.balance balance = 0 Olib.wrap_stream('shop withdraw') { |line| next if line =~ /^Usage: SHOP WITHDRAW <amount>/ raise Olib::Errors::Prempt if line =~ /^You must be in your shop to do that.$/ if line =~ /Your shop's bank account is currently ([\d]+)/ balance = $1.to_i raise Olib::Errors::Prempt end } return balance end
containers()
click to toggle source
# File lib/Olib/shops.rb, line 116 def Playershop.containers Shop.containers.reject { |container| @@noncontainers.include? container.noun } end
items()
click to toggle source
# File lib/Olib/shops.rb, line 162 def Playershop.items Playershop.containers.map { |container| container.contents }.flatten end
sign()
click to toggle source
# File lib/Olib/shops.rb, line 156 def Playershop.sign Shop.containers.select { |container| container.noun == 'sign' }[0] end
where(conditions)
click to toggle source
# File lib/Olib/shops.rb, line 137 def Playershop.where(conditions) Playershop.items.select { |item| !conditions.keys.map { |key| if conditions[key].class == Array item.props[key].class == Array && !conditions[key].map { |ele| item.props[key].include? ele }.include?(false) else item.props[key] == conditions[key] end }.include?(false) } end