space-game-proto/obj/tradeHub.py

23 lines
632 B
Python
Raw Normal View History

from obj.inventory import Inventory
2021-05-11 10:34:56 -04:00
class TradeHub:
'Contains items to sell'
def __init__(self, name):
self.name = name
self.items = Inventory()
2021-05-11 10:34:56 -04:00
def addItems(self, items):
for item in items:
self.items.addItem(item, 100)
2021-05-11 10:34:56 -04:00
def getItems(self):
2021-05-11 18:35:04 -04:00
return self.items.getInventory()
2021-05-11 10:34:56 -04:00
def printItems(self):
print(f"{'Name' : <15}{'- - - - - | - - - - -' : ^10}{'Cost' : >6}")
print()
for slot in self.items.getInventory():
print(f"{slot.getName() : <15}{'* * * * * | * * * * *' : ^10}{str(slot.getPrice()) : >5}")
2021-05-11 10:34:56 -04:00
print()