Logen Kain
ea0c475074
Change tradeable items from dict to list; give tradehubs proper inventory; Make inventory adding dumber
25 lines
726 B
Python
25 lines
726 B
Python
from obj.item import Item
|
|
from obj.inventorySlot import InventorySlot
|
|
|
|
class Inventory:
|
|
'Object to hold items and quantity'
|
|
|
|
def __init__(self):
|
|
#TODO Make limited slots
|
|
# __init__(self, numberOfSlots)
|
|
self.items = []
|
|
|
|
def addItem(self, item, quantity):
|
|
self.items.append(InventorySlot(item, quantity))
|
|
|
|
def printInventory(self):
|
|
print("Items: ")
|
|
print(f"{'Name' : <15}{'- - - - - | - - - - -' : ^10}{'Quantity' : >8}")
|
|
print()
|
|
for slot in self.items:
|
|
print(f"{slot.getName() : <15}{'* * * * * | * * * * *' : ^10}{str(slot.getQuantity()) : >5}")
|
|
print()
|
|
|
|
def getInventory(self):
|
|
return self.items
|