Mark equipped items and allow unequipping

This commit is contained in:
Nicolas Margulies 2021-01-10 22:26:43 +01:00
parent 88471f4361
commit 519504fc32
2 changed files with 4 additions and 2 deletions

View File

@ -176,7 +176,8 @@ class PlayerInventoryDisplay(MenuDisplay):
selection = f"[{rep}]" if i == self.menu.position \
and self.selected else f" {rep} "
self.addstr(self.pad, i + 1, 0, selection
+ " " + item.translated_name.capitalize()
+ " " + ("[E]" if item.equipped else "")
+ item.translated_name.capitalize()
+ (f" ({item.description})" if item.description else "")
+ (": " + str(item.price) + " Hazels"
if self.store_mode else ""))

View File

@ -309,7 +309,8 @@ class Game:
if key == KeyValues.USE:
self.inventory_menu.validate().use()
elif key == KeyValues.EQUIP:
self.inventory_menu.validate().equip()
item = self.inventory_menu.validate()
item.unequip() if item.equipped else item.equip()
elif key == KeyValues.DROP:
self.inventory_menu.validate().drop()