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) self.height - menuy), menuwidth)
class InventoryDisplay(MenuDisplay): class PlayerInventoryDisplay(MenuDisplay):
message: str message = _("== INVENTORY ==")
def update_pad(self) -> None: def update_pad(self) -> None:
self.addstr(self.pad, 0, (self.width - len(self.message)) // 2, self.addstr(self.pad, 0, (self.width - len(self.message)) // 2,
@ -130,9 +130,23 @@ class InventoryDisplay(MenuDisplay):
return 2 + super().trueheight return 2 + super().trueheight
class PlayerInventoryDisplay(InventoryDisplay): class StoreInventoryDisplay(MenuDisplay):
message = _("== INVENTORY ==")
class StoreInventoryDisplay(InventoryDisplay):
message = _("== STALL ==") 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

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: squirrelbattle 3.14.1\n" "Project-Id-Version: squirrelbattle 3.14.1\n"
"Report-Msgid-Bugs-To: squirrel-battle@crans.org\n" "Report-Msgid-Bugs-To: squirrel-battle@crans.org\n"
"POT-Creation-Date: 2020-12-09 15:40+0100\n" "POT-Creation-Date: 2020-12-11 18:06+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,11 +17,11 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: squirrelbattle/display/menudisplay.py:134 #: squirrelbattle/display/menudisplay.py:113
msgid "== INVENTORY ==" msgid "== INVENTORY =="
msgstr "== BESTAND ==" msgstr "== BESTAND =="
#: squirrelbattle/display/menudisplay.py:138 #: squirrelbattle/display/menudisplay.py:134
msgid "== STALL ==" msgid "== STALL =="
msgstr "== STAND ==" msgstr "== STAND =="
@ -29,36 +29,40 @@ msgstr "== STAND =="
msgid "Inventory:" msgid "Inventory:"
msgstr "Bestand:" msgstr "Bestand:"
#: squirrelbattle/display/statsdisplay.py:50 #: squirrelbattle/display/statsdisplay.py:53
msgid "YOU ARE DEAD" msgid "YOU ARE DEAD"
msgstr "SIE WURDEN GESTORBEN" msgstr "SIE WURDEN GESTORBEN"
#. TODO #. TODO
#: squirrelbattle/entities/friendly.py:44 #: squirrelbattle/entities/friendly.py:33
msgid "I don't sell any squirrel" msgid "I don't sell any squirrel"
msgstr "Ich verkaufe keinen Eichhörnchen." msgstr "Ich verkaufe keinen Eichhörnchen."
#: squirrelbattle/entities/friendly.py:59 #: squirrelbattle/entities/friendly.py:46
msgid "Flower power!!" msgid "Flower power!!"
msgstr "Blumenmacht!!" msgstr "Blumenmacht!!"
#: squirrelbattle/entities/friendly.py:59 #: squirrelbattle/entities/friendly.py:46
msgid "The sun is warm today" msgid "The sun is warm today"
msgstr "Die Sonne ist warm heute" msgstr "Die Sonne ist warm heute"
#. The bomb is exploding. #. The bomb is exploding.
#. Each entity that is close to the bomb takes damages. #. Each entity that is close to the bomb takes damages.
#. The player earn XP if the entity was killed. #. The player earn XP if the entity was killed.
#: squirrelbattle/entities/items.py:132 #: squirrelbattle/entities/items.py:151
msgid "Bomb is exploding." msgid "Bomb is exploding."
msgstr "Die Bombe explodiert." msgstr "Die Bombe explodiert."
#: squirrelbattle/entities/items.py:204 #: squirrelbattle/entities/items.py:224
#, python-brace-format #, python-brace-format
msgid "{player} exchanged its body with {entity}." msgid "{player} exchanged its body with {entity}."
msgstr "{player} täuscht seinem Körper mit {entity} aus." msgstr "{player} täuscht seinem Körper mit {entity} aus."
#: squirrelbattle/game.py:241 #: squirrelbattle/game.py:199 squirrelbattle/tests/game_test.py:537
msgid "You do not have enough money"
msgstr ""
#: squirrelbattle/game.py:243
msgid "" msgid ""
"Some keys are missing in your save file.\n" "Some keys are missing in your save file.\n"
"Your save seems to be corrupt. It got deleted." "Your save seems to be corrupt. It got deleted."
@ -66,7 +70,7 @@ msgstr ""
"In Ihrer Speicherdatei fehlen einige Schlüssel.\n" "In Ihrer Speicherdatei fehlen einige Schlüssel.\n"
"Ihre Speicherung scheint korrupt zu sein. Es wird gelöscht." "Ihre Speicherung scheint korrupt zu sein. Es wird gelöscht."
#: squirrelbattle/game.py:249 #: squirrelbattle/game.py:251
msgid "" msgid ""
"No player was found on this map!\n" "No player was found on this map!\n"
"Maybe you died?" "Maybe you died?"
@ -74,7 +78,7 @@ msgstr ""
"Auf dieser Karte wurde kein Spieler gefunden!\n" "Auf dieser Karte wurde kein Spieler gefunden!\n"
"Vielleicht sind Sie gestorben?" "Vielleicht sind Sie gestorben?"
#: squirrelbattle/game.py:269 #: squirrelbattle/game.py:271
msgid "" msgid ""
"The JSON file is not correct.\n" "The JSON file is not correct.\n"
"Your save seems corrupted. It got deleted." "Your save seems corrupted. It got deleted."
@ -82,17 +86,17 @@ msgstr ""
"Die JSON-Datei ist nicht korrekt.\n" "Die JSON-Datei ist nicht korrekt.\n"
"Ihre Speicherung scheint korrumpiert. Sie wurde gelöscht." "Ihre Speicherung scheint korrumpiert. Sie wurde gelöscht."
#: squirrelbattle/interfaces.py:428 #: squirrelbattle/interfaces.py:429
#, python-brace-format #, python-brace-format
msgid "{name} hits {opponent}." msgid "{name} hits {opponent}."
msgstr "{name} schlägt {opponent}." msgstr "{name} schlägt {opponent}."
#: squirrelbattle/interfaces.py:440 #: squirrelbattle/interfaces.py:441
#, python-brace-format #, python-brace-format
msgid "{name} takes {amount} damage." msgid "{name} takes {amount} damage."
msgstr "{name} nimmt {amount} Schadenspunkte." msgstr "{name} nimmt {amount} Schadenspunkte."
#: squirrelbattle/interfaces.py:442 #: squirrelbattle/interfaces.py:443
#, python-brace-format #, python-brace-format
msgid "{name} dies." msgid "{name} dies."
msgstr "{name} stirbt." msgstr "{name} stirbt."
@ -222,3 +226,7 @@ msgstr "Bombe"
#: squirrelbattle/tests/translations_test.py:68 #: squirrelbattle/tests/translations_test.py:68
msgid "heart" msgid "heart"
msgstr "Herz" msgstr "Herz"
#: squirrelbattle/tests/translations_test.py:69
msgid "sword"
msgstr "schwert"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: squirrelbattle 3.14.1\n" "Project-Id-Version: squirrelbattle 3.14.1\n"
"Report-Msgid-Bugs-To: squirrel-battle@crans.org\n" "Report-Msgid-Bugs-To: squirrel-battle@crans.org\n"
"POT-Creation-Date: 2020-12-09 15:40+0100\n" "POT-Creation-Date: 2020-12-11 18:06+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,11 +17,11 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: squirrelbattle/display/menudisplay.py:134 #: squirrelbattle/display/menudisplay.py:113
msgid "== INVENTORY ==" msgid "== INVENTORY =="
msgstr "== INVENTAIRE ==" msgstr "== INVENTAIRE =="
#: squirrelbattle/display/menudisplay.py:138 #: squirrelbattle/display/menudisplay.py:134
msgid "== STALL ==" msgid "== STALL =="
msgstr "== STAND ==" msgstr "== STAND =="
@ -29,36 +29,40 @@ msgstr "== STAND =="
msgid "Inventory:" msgid "Inventory:"
msgstr "Inventaire :" msgstr "Inventaire :"
#: squirrelbattle/display/statsdisplay.py:50 #: squirrelbattle/display/statsdisplay.py:53
msgid "YOU ARE DEAD" msgid "YOU ARE DEAD"
msgstr "VOUS ÊTES MORT" msgstr "VOUS ÊTES MORT"
#. TODO #. TODO
#: squirrelbattle/entities/friendly.py:44 #: squirrelbattle/entities/friendly.py:33
msgid "I don't sell any squirrel" msgid "I don't sell any squirrel"
msgstr "Je ne vends pas d'écureuil" msgstr "Je ne vends pas d'écureuil"
#: squirrelbattle/entities/friendly.py:59 #: squirrelbattle/entities/friendly.py:46
msgid "Flower power!!" msgid "Flower power!!"
msgstr "Pouvoir des fleurs !" msgstr "Pouvoir des fleurs !"
#: squirrelbattle/entities/friendly.py:59 #: squirrelbattle/entities/friendly.py:46
msgid "The sun is warm today" msgid "The sun is warm today"
msgstr "Le soleil est chaud aujourd'hui" msgstr "Le soleil est chaud aujourd'hui"
#. The bomb is exploding. #. The bomb is exploding.
#. Each entity that is close to the bomb takes damages. #. Each entity that is close to the bomb takes damages.
#. The player earn XP if the entity was killed. #. The player earn XP if the entity was killed.
#: squirrelbattle/entities/items.py:132 #: squirrelbattle/entities/items.py:151
msgid "Bomb is exploding." msgid "Bomb is exploding."
msgstr "La bombe explose." msgstr "La bombe explose."
#: squirrelbattle/entities/items.py:204 #: squirrelbattle/entities/items.py:224
#, python-brace-format #, python-brace-format
msgid "{player} exchanged its body with {entity}." msgid "{player} exchanged its body with {entity}."
msgstr "{player} a échangé son corps avec {entity}." msgstr "{player} a échangé son corps avec {entity}."
#: squirrelbattle/game.py:241 #: squirrelbattle/game.py:199 squirrelbattle/tests/game_test.py:537
msgid "You do not have enough money"
msgstr ""
#: squirrelbattle/game.py:243
msgid "" msgid ""
"Some keys are missing in your save file.\n" "Some keys are missing in your save file.\n"
"Your save seems to be corrupt. It got deleted." "Your save seems to be corrupt. It got deleted."
@ -66,7 +70,7 @@ msgstr ""
"Certaines clés de votre ficher de sauvegarde sont manquantes.\n" "Certaines clés de votre ficher de sauvegarde sont manquantes.\n"
"Votre sauvegarde semble corrompue. Elle a été supprimée." "Votre sauvegarde semble corrompue. Elle a été supprimée."
#: squirrelbattle/game.py:249 #: squirrelbattle/game.py:251
msgid "" msgid ""
"No player was found on this map!\n" "No player was found on this map!\n"
"Maybe you died?" "Maybe you died?"
@ -74,7 +78,7 @@ msgstr ""
"Aucun joueur n'a été trouvé sur la carte !\n" "Aucun joueur n'a été trouvé sur la carte !\n"
"Peut-être êtes-vous mort ?" "Peut-être êtes-vous mort ?"
#: squirrelbattle/game.py:269 #: squirrelbattle/game.py:271
msgid "" msgid ""
"The JSON file is not correct.\n" "The JSON file is not correct.\n"
"Your save seems corrupted. It got deleted." "Your save seems corrupted. It got deleted."
@ -82,17 +86,17 @@ msgstr ""
"Le fichier JSON de sauvegarde est incorrect.\n" "Le fichier JSON de sauvegarde est incorrect.\n"
"Votre sauvegarde semble corrompue. Elle a été supprimée." "Votre sauvegarde semble corrompue. Elle a été supprimée."
#: squirrelbattle/interfaces.py:428 #: squirrelbattle/interfaces.py:429
#, python-brace-format #, python-brace-format
msgid "{name} hits {opponent}." msgid "{name} hits {opponent}."
msgstr "{name} frappe {opponent}." msgstr "{name} frappe {opponent}."
#: squirrelbattle/interfaces.py:440 #: squirrelbattle/interfaces.py:441
#, python-brace-format #, python-brace-format
msgid "{name} takes {amount} damage." msgid "{name} takes {amount} damage."
msgstr "{name} prend {amount} points de dégât." msgstr "{name} prend {amount} points de dégât."
#: squirrelbattle/interfaces.py:442 #: squirrelbattle/interfaces.py:443
#, python-brace-format #, python-brace-format
msgid "{name} dies." msgid "{name} dies."
msgstr "{name} meurt." msgstr "{name} meurt."
@ -222,3 +226,7 @@ msgstr "bombe"
#: squirrelbattle/tests/translations_test.py:68 #: squirrelbattle/tests/translations_test.py:68
msgid "heart" msgid "heart"
msgstr "cœur" msgstr "cœur"
#: squirrelbattle/tests/translations_test.py:69
msgid "sword"
msgstr "épée"

View File

@ -66,3 +66,4 @@ class TestTranslations(unittest.TestCase):
self.assertEqual(_("body snatch potion"), "potion d'arrachage de corps") self.assertEqual(_("body snatch potion"), "potion d'arrachage de corps")
self.assertEqual(_("bomb"), "bombe") self.assertEqual(_("bomb"), "bombe")
self.assertEqual(_("heart"), "cœur") self.assertEqual(_("heart"), "cœur")
self.assertEqual(_("sword"), "épée")