Module: Inventory

Defined in:
lib/Olib/character/inventory.rb

Class Method Summary collapse

Class Method Details

.[](query) ⇒ Object


10
11
12
13
14
# File 'lib/Olib/character/inventory.rb', line 10

def Inventory.[](query)
  GameObj.inv.select { |item|
    item.name == query || item.id == query
  }
end

.containersObject


2
3
4
# File 'lib/Olib/character/inventory.rb', line 2

def Inventory.containers
  GameObj.containers
end

.itemsObject


16
17
18
19
20
# File 'lib/Olib/character/inventory.rb', line 16

def Inventory.items
  containers.map do |id, contents|
    contents.map(&:to_item)
  end.flatten
end

.to_sObject


6
7
8
# File 'lib/Olib/character/inventory.rb', line 6

def Inventory.to_s
  Inventory.items.map(&:to_s)
end