The store menu now displays the price of objects, fixes #41

This commit is contained in:
eichhornchen
2020-12-11 18:08:10 +01:00
parent 99352bc1d5
commit e7f24c2371
4 changed files with 68 additions and 37 deletions

View File

@ -109,8 +109,8 @@ class MainMenuDisplay(Display):
self.height - menuy), menuwidth)
class InventoryDisplay(MenuDisplay):
message: str
class PlayerInventoryDisplay(MenuDisplay):
message = _("== INVENTORY ==")
def update_pad(self) -> None:
self.addstr(self.pad, 0, (self.width - len(self.message)) // 2,
@ -130,9 +130,23 @@ class InventoryDisplay(MenuDisplay):
return 2 + super().trueheight
class PlayerInventoryDisplay(InventoryDisplay):
message = _("== INVENTORY ==")
class StoreInventoryDisplay(InventoryDisplay):
class StoreInventoryDisplay(MenuDisplay):
message = _("== STALL ==")
def update_pad(self) -> None:
self.addstr(self.pad, 0, (self.width - len(self.message)) // 2,
self.message, curses.A_BOLD | curses.A_ITALIC)
for i, item in enumerate(self.menu.values):
rep = self.pack[item.name.upper()]
selection = f"[{rep}]" if i == self.menu.position else f" {rep} "
self.addstr(self.pad, 2 + i, 0, selection
+ " " + item.translated_name.capitalize()\
+": "+str(item.price)+" Hazels")
@property
def truewidth(self) -> int:
return max(1, self.height if hasattr(self, "height") else 10)
@property
def trueheight(self) -> int:
return 2 + super().trueheight