diff --git a/ActionModul.py b/ActionModul.py
index 88d9c3b..d0d01c4 100644
--- a/ActionModul.py
+++ b/ActionModul.py
@@ -28,10 +28,15 @@ class ActionModul:
item = self.world.findItemImInventar(parsedCommand.gegenstand);
if item != None:
- if self.world.findItemImInventarById(13) != None:
- item.zustand = item.GEOEFFNET
- else:
- self.setFehler('Die Tür ist verschlossen.')
+ if item.id == self.world.ITEM_TRUHE:
+ schluessel = self.world.findItemImInventarById(self.world.ITEM_KLEINER_SCHLUESSEL)
+
+ if schluessel != None:
+ item.zustand = item.OFFEN
+ self.setFehler('Truhe ist jetzt offen')
+ else:
+ self.setFehler('Die Truhe ist verschlossen und du hast keinen Schlüssel.')
+
def verliere(self,parsedCommand):
item = self.world.findItemImInventar(parsedCommand.gegenstand);
diff --git a/ParsedCommand.py b/ParsedCommand.py
index a933d7e..791dbfa 100644
--- a/ParsedCommand.py
+++ b/ParsedCommand.py
@@ -4,6 +4,7 @@ class ParsedCommand:
self.verb = None
self.gegenstand = None
self.gegenstand2 = None
+ self.adjektiv = None
self.objekt = None
self.key = '-1'
diff --git a/World.py b/World.py
index e8b011c..96cd26c 100644
--- a/World.py
+++ b/World.py
@@ -133,9 +133,16 @@ class World:
return id
return None
- def removeSortouts(self,words):
+ def findAdjektiv(self,adjektiv):
+ skip
+ def removeSortouts(self,words,parsedCommand):
w = []
for word in words:
+ if word in self.adjektive:
+ if word == adj.name:
+ parsedCommand.adjektiv = adj
+
+
if word not in self.sortouts:
w.append(word)
return w
@@ -143,8 +150,8 @@ class World:
def parseInput(self,input):
words = input.split(' ')
- words = self.removeSortouts(words)
parsedCommand = ParsedCommand.ParsedCommand()
+ words = self.removeSortouts(words,parsedCommand)
befehlid = self.ermittleBefehlId(words[0])
if befehlid != None:
@@ -165,7 +172,7 @@ class World:
self.personen = {}
self.bewegungen = {}
self.gegenstaende = {}
- self.adjektive = []
+ self.adjektive = {}
self.befehle = {}
self.inventar = {}
self.objekte = {}
@@ -185,7 +192,7 @@ class World:
self.ITEM_LEITER = '2'
self.ITEM_TRUHE = '3'
self.ITEM_PFLANZE = '4'
- self.ITEM_EINGANGSTUER = '5'
+ self.ITEM_HAUSTUER = '5'
self.ITEM_GLAS = '6'
self.ITEM_BETT = '7'
self.ITEM_NACHTSCHRANK = '8'
diff --git a/WorldParser.py b/WorldParser.py
index db23e50..524a67a 100644
--- a/WorldParser.py
+++ b/WorldParser.py
@@ -1,5 +1,5 @@
import xml.etree.ElementTree as ET
-from data.Raum import Raum, Befehl, Gegenstand,Person,TextNode
+from data.Raum import Raum, Befehl, Adjektiv,Gegenstand,Person,TextNode
import io
import logging
@@ -67,8 +67,10 @@ class WorldParser():
name = adj.attrib['name']
id = adj.attrib['id']
key = adj.attrib['key']
+ adjektiv = Adjektiv(name,id,key)
- self.world.adjektive.append(name)
+ self.world.adjektive[id] = adjektiv
+
# Sortouts
for sortout in root.findall('sortouts/sortout'):
name = sortout.attrib['name']
@@ -88,9 +90,11 @@ class WorldParser():
gegenstand = Gegenstand(name,id,raumid)
imobil = item.attrib['imobil']
visible = item.attrib['visible']
+ adjektiv = item.attrib['adjektiv']
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']
diff --git a/data/Raum.py b/data/Raum.py
index 5f82c80..a546996 100644
--- a/data/Raum.py
+++ b/data/Raum.py
@@ -67,13 +67,14 @@ class Gegenstand(SuperNode):
self.zustand = 0
self.sichtbar = True
self.imobil = False
+ self.adjektiv = None
self.GESCHLOSSEN = 0
self.OFFEN = 1
self.zustand = self.GESCHLOSSEN
class Adjektiv(SuperNode):
- def __init__(self,name, id):
- super.__init__(self, name, '')
+ def __init__(self,name, id,key):
+ super().__init__(name, id)
self.key = key
diff --git a/data/__pycache__/Raum.cpython-38.pyc b/data/__pycache__/Raum.cpython-38.pyc
index a9a755a..adc3bb4 100644
Binary files a/data/__pycache__/Raum.cpython-38.pyc and b/data/__pycache__/Raum.cpython-38.pyc differ
diff --git a/world.xml b/world.xml
index 6d1de96..96fcbae 100644
--- a/world.xml
+++ b/world.xml
@@ -106,19 +106,19 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+