From 183fe11075f3f151204f0f96b9a9f49aded5b4ef Mon Sep 17 00:00:00 2001 From: Olli Graf Date: Thu, 30 Jun 2022 14:54:40 +0200 Subject: [PATCH] letzte Hilfeseiten. --- ActionModul.py | 9 +++++---- HilfeModul.py | 22 +++++++++++++++++++--- World.py | 13 +++++++++++-- ascii/hilfe/cmd-16.txt | 9 +++++++++ ascii/hilfe/cmd-24.txt | 10 ++++++++++ ascii/hilfe/cmd-25.txt | 10 ++++++++++ ascii/hilfe/cmd-26.txt | 9 +++++++++ ascii/hilfe/cmd-27.txt | 9 +++++++++ ascii/hilfe/cmd-28.txt | 9 +++++++++ ascii/hilfe/cmd-29.txt | 9 +++++++++ ascii/hilfe/cmd-30.txt | 9 +++++++++ ascii/hilfe/cmd-31.txt | 9 +++++++++ ascii/hilfe/cmd-32.txt | 9 +++++++++ world.xml | 7 +++++++ 14 files changed, 134 insertions(+), 9 deletions(-) create mode 100644 ascii/hilfe/cmd-16.txt create mode 100644 ascii/hilfe/cmd-24.txt create mode 100644 ascii/hilfe/cmd-25.txt create mode 100644 ascii/hilfe/cmd-26.txt create mode 100644 ascii/hilfe/cmd-27.txt create mode 100644 ascii/hilfe/cmd-28.txt create mode 100644 ascii/hilfe/cmd-29.txt create mode 100644 ascii/hilfe/cmd-30.txt create mode 100644 ascii/hilfe/cmd-31.txt create mode 100644 ascii/hilfe/cmd-32.txt diff --git a/ActionModul.py b/ActionModul.py index 3a49a4f..955dc8b 100644 --- a/ActionModul.py +++ b/ActionModul.py @@ -156,6 +156,9 @@ class ActionModul(ActionBasics): else: self.setFehler('Nichts passiert.') + def about(self): + self.world.printAbout() + def baueBruecke(self): @@ -506,6 +509,8 @@ class ActionModul(ActionBasics): self.wechsleRaum(imwasser) else: self.setFehler('Das Wasser ist viel zu tief, du würdest ertrinken.') + else: + self.setFehler('Hieh-Hüpf') def sprich(self,parsedCommand): @@ -665,10 +670,6 @@ class ActionModul(ActionBasics): def runter(self): self.geheNach(self.world.RUNTER) - def about(self): - print("Tomb Version " + self.world.VERSION) - self.world.waitForCR - def raumaction(self): raumid = self.world.aktuellerRaum.id diff --git a/HilfeModul.py b/HilfeModul.py index 45876c7..6d29451 100644 --- a/HilfeModul.py +++ b/HilfeModul.py @@ -1,5 +1,6 @@ import logging import FileReader +from os.path import exists class HilfeModul(): @@ -12,8 +13,9 @@ class HilfeModul(): self.world = world - def readTxt(self, datei): + self.check() + def readTxt(self, datei): logging.debug(f'öffne Hilfedatei {datei}') reader = FileReader.FileReader(datei) @@ -23,6 +25,18 @@ class HilfeModul(): return lines + def check(self): + + for id in self.world.befehle: + befehl = self.world.befehle[id] + + helptxt = self.baueHilfedatei(befehl.key) + + logging.debug(f'suche Hilfedatei {helptxt}') + if not exists(helptxt): + logging.warn(f'Hilfedatei {helptxt} existiert nicht') + + def hilfe(self, command): generalHelp = True if not self.isBlank(command): @@ -42,6 +56,8 @@ class HilfeModul(): else: self.world.printText('hilfe') + def baueHilfedatei(self, key): + return f'ascii/hilfe/cmd-{key}.txt' def findHilfetext(self, command): logging.debug(f'suche Hilfetext zu {command}') @@ -52,10 +68,10 @@ class HilfeModul(): logging.debug(f'cmdid= {cmdid}') -# logging.debug(f'vergleiche {befehl.name.lower()} mit {command.lower()}') + logging.debug(f'vergleiche {befehl.name.lower()} mit {command.lower()}') if befehl.name.lower() == command.lower(): logging.debug(f'gefundener Befehl: {befehl.name}') - return f'ascii/hilfe/cmd-{befehl.key}.txt' + return self.baueHilfedatei(befehl.key) return None \ No newline at end of file diff --git a/World.py b/World.py index 52870b5..0b9f5dc 100644 --- a/World.py +++ b/World.py @@ -15,6 +15,13 @@ class World: def clearScreen(self): self.stdscr.clear() + def printAbout(self): + s = self.stdscr + + self.clearScreen() + s.addstr(1,0,'Das Grab des Azteken', curses.color_pair(2)) + s.addstr(2,0,f'Version {self.VERSION}') + self.waitForCR() def printText(self,textid): self.clearScreen() self.stdscr.addstr(1,0,self.texte[textid].name) @@ -267,7 +274,7 @@ class World: return person return None - + def findPersonImAktuellenRaumById(self, personid): raum = self.aktuellerRaum @@ -400,7 +407,9 @@ class World: self.WEST = '3' self.RAUF = '4' self.RUNTER = '5' - self.VERSION = '0.5' + + self.VERSION = '0.91' + self.ITEM_TISCH = '1' self.ITEM_LEITER = '2' self.ITEM_TRUHE = '3' diff --git a/ascii/hilfe/cmd-16.txt b/ascii/hilfe/cmd-16.txt new file mode 100644 index 0000000..43fde58 --- /dev/null +++ b/ascii/hilfe/cmd-16.txt @@ -0,0 +1,9 @@ +Hilfeseite + +Befehl: drücke +Parameter: Gegenstand +siehe auch: + + +Drückt auf einen Gegenstand imInventar oder aktuellen Raum. + diff --git a/ascii/hilfe/cmd-24.txt b/ascii/hilfe/cmd-24.txt new file mode 100644 index 0000000..663d5b7 --- /dev/null +++ b/ascii/hilfe/cmd-24.txt @@ -0,0 +1,10 @@ +Hilfeseite + +Befehl: schlage, boxe +Parameter: Genstand +siehe auch: + + +Schlägt auf einen Gegenstand im aktuellen Raum. +Achte darauf, wen oder was du schlägst! + diff --git a/ascii/hilfe/cmd-25.txt b/ascii/hilfe/cmd-25.txt new file mode 100644 index 0000000..ee02a7f --- /dev/null +++ b/ascii/hilfe/cmd-25.txt @@ -0,0 +1,10 @@ +Hilfeseite + +Befehl: sprich +Parameter: Person +siehe auch: + + +Spricht eine Person im aktuellen Raum an. Dadurch könntest du an spielentscheidende +Informationen kommen. + diff --git a/ascii/hilfe/cmd-26.txt b/ascii/hilfe/cmd-26.txt new file mode 100644 index 0000000..b707ad6 --- /dev/null +++ b/ascii/hilfe/cmd-26.txt @@ -0,0 +1,9 @@ +Hilfeseite + +Befehl: leere +Parameter: Gegenstand +siehe auch: + + +Leert einen Gegenstand im Inventar bzw. schüttet seinen Inhalt aus. + diff --git a/ascii/hilfe/cmd-27.txt b/ascii/hilfe/cmd-27.txt new file mode 100644 index 0000000..5772152 --- /dev/null +++ b/ascii/hilfe/cmd-27.txt @@ -0,0 +1,9 @@ +Hilfeseite + +Befehl: fülle, fuelle +Parameter: Gegenstand +siehe auch: + + +Füllt einen Gegenstand im Inventar. Das einzufüllende Material muss im aktuellen Raum vorhanden sein. + diff --git a/ascii/hilfe/cmd-28.txt b/ascii/hilfe/cmd-28.txt new file mode 100644 index 0000000..04c16e7 --- /dev/null +++ b/ascii/hilfe/cmd-28.txt @@ -0,0 +1,9 @@ +Hilfeseite + +Befehl: wirf +Parameter: Gegenstand +siehe auch: + + +Wirft einen Gegenstand im Inventar. + diff --git a/ascii/hilfe/cmd-29.txt b/ascii/hilfe/cmd-29.txt new file mode 100644 index 0000000..7a8c896 --- /dev/null +++ b/ascii/hilfe/cmd-29.txt @@ -0,0 +1,9 @@ +Hilfeseite + +Befehl: gib +Parameter: Gegenstand +siehe auch: + + +Gibt einen Gegenstand aus dem Inventar an eine Person im aktuellen Raum. + diff --git a/ascii/hilfe/cmd-30.txt b/ascii/hilfe/cmd-30.txt new file mode 100644 index 0000000..a019087 --- /dev/null +++ b/ascii/hilfe/cmd-30.txt @@ -0,0 +1,9 @@ +Hilfeseite + +Befehl: entzünde +Parameter: Gegenstand +siehe auch: + + +Entzündet einenbrennbaren Gegestand aus dem Inventar. Feuer bedeutet Licht. + diff --git a/ascii/hilfe/cmd-31.txt b/ascii/hilfe/cmd-31.txt new file mode 100644 index 0000000..9890dc1 --- /dev/null +++ b/ascii/hilfe/cmd-31.txt @@ -0,0 +1,9 @@ +Hilfeseite + +Befehl: lösche +Parameter: Gegenstand +siehe auch: entzünde + + +Löscht einen brennden Gegenstand im Inventar. + diff --git a/ascii/hilfe/cmd-32.txt b/ascii/hilfe/cmd-32.txt new file mode 100644 index 0000000..37ab2d8 --- /dev/null +++ b/ascii/hilfe/cmd-32.txt @@ -0,0 +1,9 @@ +Hilfeseite + +Befehl: spring +Parameter: -keiner- +siehe auch: + + +Springt in die Höhe oder über etwas rüber oder in etwas hinein. + diff --git a/world.xml b/world.xml index 3b5267f..0bb71f3 100644 --- a/world.xml +++ b/world.xml @@ -392,6 +392,7 @@ Du stehst in der Küche. In der Ecke steht ein Kühlschrank. + @@ -569,6 +570,12 @@ Du stehst in der Küche. In der Ecke steht ein Kühlschrank. Im Licht der Fackel erkennst du, dass das Loch sorgfältig gegraben und mit Schiffsplanken abgestützt wurde. + + Eine praktisch eingerichtete Küche. An der Wand hängt eine Uhr, ein Kühlschrank steht gegenüber der Tür. + + + Muuuh. + Der Zwerg klappert vor Kälte mit den Zähnen und kann nicht sprechen.