space-game-proto/obj/tradeHub.py
Logen Kain ea0c475074 Refactor; start buy menu
Change tradeable items from dict to list;
give tradehubs proper inventory;
Make inventory adding dumber
2021-05-11 16:29:45 -04:00

23 lines
617 B
Python

from obj.inventory import Inventory
class TradeHub:
'Contains items to sell'
def __init__(self, name):
self.name = name
self.items = Inventory()
def addItems(self, items):
for item in items:
self.items.addItem(item, 100)
def getItems(self):
return self.items
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}")
print()