you can pick up items!

This commit is contained in:
Joe S 2021-02-26 22:19:17 -05:00
parent 66279c3bec
commit c022293335
2 changed files with 18 additions and 0 deletions

View File

@ -36,6 +36,14 @@ class GameNavigator(npyscreen.FormBaseNew):
""" """
self.artBox.footer = location self.artBox.footer = location
def update_inventory(self, items):
res = ''
for element in items:
res = res + str(element) + '\n'
res = res.upper() # Inventory is always uppercase
self.inventoryContent.value = res # Set the logbox to that value
def create(self): def create(self):
top_division_height = 20 top_division_height = 20
inventory_width = 20 inventory_width = 20
@ -66,6 +74,14 @@ class GameNavigator(npyscreen.FormBaseNew):
rely=2, rely=2,
editable=False) editable=False)
self.inventoryContent = self.add(npyscreen.MultiLineEdit,
max_width=inventory_width,
max_height=top_division_height,
relx=2,
rely=3,
value='------------------',
editable=False)
self.logBoxOutline = self.add(npyscreen.BoxBasic, self.logBoxOutline = self.add(npyscreen.BoxBasic,
max_width=inventory_width + art_width, max_width=inventory_width + art_width,
max_height=9, max_height=9,

View File

@ -141,6 +141,8 @@ class Handler(npyscreen.ButtonPress):
except KeyError: except KeyError:
self.parent.update_location('Unknown Location') self.parent.update_location('Unknown Location')
self.parent.update_inventory(player.playerData['player']['inventory'])
# Make sure to re-draw the art box when we're all done (in case we updated it in logic above) # Make sure to re-draw the art box when we're all done (in case we updated it in logic above)
self.parent.artContent.display() self.parent.artContent.display()