From c022293335fe34b1f7369ca201690c54323a505c Mon Sep 17 00:00:00 2001 From: Joe S <31870999+KenwoodFox@users.noreply.github.com> Date: Fri, 26 Feb 2021 22:19:17 -0500 Subject: [PATCH] you can pick up items! --- Adventure Game/adventure_game/GameNavigator.py | 16 ++++++++++++++++ Adventure Game/adventure_game/Handler.py | 2 ++ 2 files changed, 18 insertions(+) diff --git a/Adventure Game/adventure_game/GameNavigator.py b/Adventure Game/adventure_game/GameNavigator.py index ccf3ba0..c1f7734 100644 --- a/Adventure Game/adventure_game/GameNavigator.py +++ b/Adventure Game/adventure_game/GameNavigator.py @@ -36,6 +36,14 @@ class GameNavigator(npyscreen.FormBaseNew): """ 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): top_division_height = 20 inventory_width = 20 @@ -66,6 +74,14 @@ class GameNavigator(npyscreen.FormBaseNew): rely=2, 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, max_width=inventory_width + art_width, max_height=9, diff --git a/Adventure Game/adventure_game/Handler.py b/Adventure Game/adventure_game/Handler.py index 0a91c26..597c8f0 100644 --- a/Adventure Game/adventure_game/Handler.py +++ b/Adventure Game/adventure_game/Handler.py @@ -141,6 +141,8 @@ class Handler(npyscreen.ButtonPress): except KeyError: 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) self.parent.artContent.display()