diff --git a/ActionModul.py b/ActionModul.py index e36fee0..0774312 100644 --- a/ActionModul.py +++ b/ActionModul.py @@ -49,10 +49,10 @@ class ActionModul: item.zustand = item.OFFEN seil = self.world.findItemById(self.world.ITEM_SEIL) seil.sichtbar = True - self.world.aktuellerRaum.gegenstaende[seil.id] = seil + self.world.aktuellerRaum.items[seil.id] = seil schwert = self.world.findItemById(self.world.ITEM_SCHWERT) schwert.sichtbar = True - self.world.aktuellerRaum.gegenstaende[schwert.id] = schwert + self.world.aktuellerRaum.items[schwert.id] = schwert self.setFehler('Truhe ist jetzt offen') else: self.setFehler('Die Truhe ist verschlossen und dir fehlt der passende Schlüssel.') @@ -143,7 +143,7 @@ class ActionModul: item = self.world.findItemImInventarOderAktuellerRaum(parsedCommand.gegenstand) if item != None: - if item.id == self.world.RAUM_SCHLAFZIMMER: + if item.id == self.world.ITEM_PFLANZE: glas = self.world.findRaumItemById(self.world.ITEM_GLAS) logging.debug(f'mache Gegenstand {glas.name} sichtbar') glas.sichtbar = True diff --git a/TestModule.py b/TestModule.py index 6bc920b..ee5ff73 100644 --- a/TestModule.py +++ b/TestModule.py @@ -40,6 +40,7 @@ class TestModule: pcmd = self.world.parseInput('nimm Schlüssel') self.actionmodul.nimm(pcmd) pcmd = self.world.parseInput('öffne Truhe') + self.actionmodul.oeffne(pcmd) diff --git a/World.py b/World.py index 9be0525..c1b6a08 100644 --- a/World.py +++ b/World.py @@ -92,9 +92,10 @@ class World: def findItemById(self,id): for itemkey in self.gegenstaende: item = self.gegenstaende[itemkey] - logging.debug(f'findItemById(): Item= {item}') - logging.debug(f'findItemById(): Itemtype= {type(item)}') + + logging.debug(f'itemkey: {itemkey} item.id= {item.id} - {id}') if item.id == id: + logging.debug(f'findItemBy(): return {item.name}') return item return None diff --git a/WorldParser.py b/WorldParser.py index be89d2f..3aae074 100644 --- a/WorldParser.py +++ b/WorldParser.py @@ -94,21 +94,22 @@ class WorldParser(): raum = self.world.sucheRaum(raumid) if raum is not None: gegenstand.raum = raum.id - gegenstand.adjektiv = adjektiv - gegenstand.imobil = imobil.lower() in ['true','True','1'] - logging.debug('itemid= ' + id + ',visible= ' + visible) - gegenstand.sichtbar = visible.lower() not in ['false','False','0'] - #logging.debug('Gegenstand ' + gegenstand.name + ' ist sichtbar: ' + str(gegenstand.sichtbar)) - gegenstand.pickupmsg = msgid -# logging.debug('Item ' + gegenstand.name + ' - Pickup: ' + gegenstand.pickupmsg) - raum.items[id] = gegenstand - self.world.gegenstaende[id] = gegenstand else: - if raum != '-1': + if raumid != '-1': logging.error(f'Kann Raum für Gegenstand {gegenstand.name} nicht finden') logging.error(f'Kein Raum für {gegenstand.name}') + gegenstand.adjektiv = adjektiv + gegenstand.imobil = imobil.lower() in ['true','True','1'] + logging.debug('itemid= ' + id + ',visible= ' + visible) + gegenstand.sichtbar = visible.lower() not in ['false','False','0'] + #logging.debug('Gegenstand ' + gegenstand.name + ' ist sichtbar: ' + str(gegenstand.sichtbar)) + gegenstand.pickupmsg = msgid +# logging.debug('Item ' + gegenstand.name + ' - Pickup: ' + gegenstand.pickupmsg) + + self.world.gegenstaende[id] = gegenstand + # Personen for item in root.findall('personen/person'): name = item.attrib['name']