Raumkonstanten.
This commit is contained in:
@@ -82,6 +82,7 @@ class ActionModul:
|
|||||||
schluessel.sichtbar = True
|
schluessel.sichtbar = True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def untersuche(self,parsedCommand):
|
def untersuche(self,parsedCommand):
|
||||||
logging.debug('untersuche() suche nach Gegenstand:' + parsedCommand.gegenstand)
|
logging.debug('untersuche() suche nach Gegenstand:' + parsedCommand.gegenstand)
|
||||||
item = self.world.findItemImInventarOderAktuellerRaum(parsedCommand.gegenstand)
|
item = self.world.findItemImInventarOderAktuellerRaum(parsedCommand.gegenstand)
|
||||||
@@ -95,6 +96,10 @@ class ActionModul:
|
|||||||
# Falltür sichtbar machen
|
# Falltür sichtbar machen
|
||||||
self.world.aktuellerRaum.ausgaenge[self.world.RUNTER] = '5'
|
self.world.aktuellerRaum.ausgaenge[self.world.RUNTER] = '5'
|
||||||
self.setFehler('Im Boden unter dem Bett findest du eine Falltür, die nach unten führt.')
|
self.setFehler('Im Boden unter dem Bett findest du eine Falltür, die nach unten führt.')
|
||||||
|
elif item.id == self.world.ITEM_NACHTSCHRANK:
|
||||||
|
self.setFehler('In der Schublade findest du einen Schlüssel')
|
||||||
|
schluessel = self.world.findRaumItemById(self.world.ITEM_HAUSTUERSCHLUESSEL)
|
||||||
|
#schluessel.sichtbar = True
|
||||||
else:
|
else:
|
||||||
logging.debug('Kein Item gefunden, suche nach Raum')
|
logging.debug('Kein Item gefunden, suche nach Raum')
|
||||||
self.untersucheAktuellenRaum(parsedCommand)
|
self.untersucheAktuellenRaum(parsedCommand)
|
||||||
@@ -103,6 +108,7 @@ class ActionModul:
|
|||||||
item = self.world.findIteminAktuellerRaum(parsedCommand.gegenstand)
|
item = self.world.findIteminAktuellerRaum(parsedCommand.gegenstand)
|
||||||
|
|
||||||
if item != None:
|
if item != None:
|
||||||
|
#alter Code!
|
||||||
if item.id == 8:
|
if item.id == 8:
|
||||||
self.world.stdscr.addstr('Du ziehst den Hebel und es passiert.... nichts!')
|
self.world.stdscr.addstr('Du ziehst den Hebel und es passiert.... nichts!')
|
||||||
else:
|
else:
|
||||||
|
17
World.py
17
World.py
@@ -77,7 +77,7 @@ class World:
|
|||||||
def sucheRaumName(self,name):
|
def sucheRaumName(self,name):
|
||||||
for raumid in self.raumliste:
|
for raumid in self.raumliste:
|
||||||
raum = self.raumliste[raumid]
|
raum = self.raumliste[raumid]
|
||||||
if raum.name == name:
|
if raum.name.lower() == name.lower():
|
||||||
return raum
|
return raum
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ class World:
|
|||||||
logging.debug('raum.id=' + raum.id)
|
logging.debug('raum.id=' + raum.id)
|
||||||
logging.debug('item.raumid=' + item.raumid)
|
logging.debug('item.raumid=' + item.raumid)
|
||||||
logging.debug('findItemInAktuellerRaum() ' + itemname + '-' + item.name)
|
logging.debug('findItemInAktuellerRaum() ' + itemname + '-' + item.name)
|
||||||
if item.raumid == raum.id and item.name == itemname:
|
if item.raumid == raum.id and item.name.lower() == itemname.lower():
|
||||||
return item
|
return item
|
||||||
|
|
||||||
return None
|
return None
|
||||||
@@ -107,6 +107,7 @@ class World:
|
|||||||
|
|
||||||
for itemid in raum.items:
|
for itemid in raum.items:
|
||||||
item = raum.items[itemid]
|
item = raum.items[itemid]
|
||||||
|
logging.debug('findRaumItemById() ' + id + '-' + item.id)
|
||||||
if item.raumid == raum.id and item.id == id:
|
if item.raumid == raum.id and item.id == id:
|
||||||
return item
|
return item
|
||||||
|
|
||||||
@@ -115,7 +116,7 @@ class World:
|
|||||||
def findItemImInventar(self,itemname):
|
def findItemImInventar(self,itemname):
|
||||||
|
|
||||||
for itemid in self.inventar:
|
for itemid in self.inventar:
|
||||||
if self.inventar[itemid].name == itemname:
|
if self.inventar[itemid].name.lower() == itemname.lower():
|
||||||
return self.inventar[itemid]
|
return self.inventar[itemid]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@@ -200,6 +201,16 @@ class World:
|
|||||||
self.ITEM_JACKE = '10'
|
self.ITEM_JACKE = '10'
|
||||||
self.ITEM_SCHWERT = '11'
|
self.ITEM_SCHWERT = '11'
|
||||||
self.ITEM_SEIL = '12'
|
self.ITEM_SEIL = '12'
|
||||||
|
self.ITEM_HAUSTUERSCHLUESSEL = '13'
|
||||||
|
|
||||||
|
# Räume
|
||||||
|
|
||||||
|
self.RAUM_ESSZIMMER = '1'
|
||||||
|
self.RAUM_DACHBODEN = '2'
|
||||||
|
self.RAUM_FLUR = '3'
|
||||||
|
self.RAUM_SCHLAFZIMMER = '4'
|
||||||
|
self.RAUM_KELLER = '5'
|
||||||
|
|
||||||
self.fehler = ''
|
self.fehler = ''
|
||||||
parser = WorldParser.WorldParser(self)
|
parser = WorldParser.WorldParser(self)
|
||||||
parser.parseWorld('world.xml')
|
parser.parseWorld('world.xml')
|
||||||
|
@@ -98,7 +98,7 @@ class WorldParser():
|
|||||||
gegenstand.imobil = imobil.lower() in ['true','True','1']
|
gegenstand.imobil = imobil.lower() in ['true','True','1']
|
||||||
logging.debug('itemid= ' + id + ',visible= ' + visible)
|
logging.debug('itemid= ' + id + ',visible= ' + visible)
|
||||||
gegenstand.sichtbar = visible.lower() not in ['false','False','0']
|
gegenstand.sichtbar = visible.lower() not in ['false','False','0']
|
||||||
logging.debug('Gegenstand ' + gegenstand.name + ' ist sichtbar: ' + str(gegenstand.sichtbar))
|
#logging.debug('Gegenstand ' + gegenstand.name + ' ist sichtbar: ' + str(gegenstand.sichtbar))
|
||||||
gegenstand.pickupmsg = msgid
|
gegenstand.pickupmsg = msgid
|
||||||
print('Item ' + gegenstand.name + ' - Pickup: ' + gegenstand.pickupmsg)
|
print('Item ' + gegenstand.name + ' - Pickup: ' + gegenstand.pickupmsg)
|
||||||
|
|
||||||
|
23
tomb.py
23
tomb.py
@@ -78,10 +78,23 @@ def inputLoop(stdscr):
|
|||||||
stdscr.addstr(11,0,'Was nun? ')
|
stdscr.addstr(11,0,'Was nun? ')
|
||||||
command = stdscr.getstr(11,10,40).decode(encoding="utf-8")
|
command = stdscr.getstr(11,10,40).decode(encoding="utf-8")
|
||||||
command = command.rstrip()
|
command = command.rstrip()
|
||||||
parsedCommand = world.parseInput(command)
|
if command.startswith('debug:'):
|
||||||
commandid = parsedCommand.commandid
|
debugcommand = command.split(':',1)
|
||||||
verarbeiteBefehl(parsedCommand)
|
|
||||||
schrittzaehler = schrittzaehler +1
|
logging.debug(f'debugcommand: {debugcommand}')
|
||||||
actionmodul.raumaction()
|
|
||||||
|
if debugcommand[1] == 'items':
|
||||||
|
logging.debug('liste Items')
|
||||||
|
logging.debug(world.gegenstaende)
|
||||||
|
for item in world.gegenstaende:
|
||||||
|
logging.debug(f'Id:{item.id} - Name:{item.name}')
|
||||||
|
|
||||||
|
|
||||||
|
else:
|
||||||
|
parsedCommand = world.parseInput(command)
|
||||||
|
commandid = parsedCommand.commandid
|
||||||
|
verarbeiteBefehl(parsedCommand)
|
||||||
|
schrittzaehler = schrittzaehler +1
|
||||||
|
actionmodul.raumaction()
|
||||||
|
|
||||||
wrapper(inputLoop)
|
wrapper(inputLoop)
|
||||||
|
@@ -118,7 +118,7 @@
|
|||||||
<item name='Jacke' id='10' raum='5' imobil='false' adjektiv = '0' msgid='1' visible='true' />
|
<item name='Jacke' id='10' raum='5' imobil='false' adjektiv = '0' msgid='1' visible='true' />
|
||||||
<item name='Schwert' id='11' raum='5' imobil='false' adjektiv = '0' msgid='1' visible='false' />
|
<item name='Schwert' id='11' raum='5' imobil='false' adjektiv = '0' msgid='1' visible='false' />
|
||||||
<item name='Seil' id='12' raum='5' imobil='false' adjektiv = '0' msgid='1' visible='false' />
|
<item name='Seil' id='12' raum='5' imobil='false' adjektiv = '0' msgid='1' visible='false' />
|
||||||
<item name='Schlüssel' id='13' raum='5' imobil='false' adjektiv = '0' msgid='1' visible='false' />
|
<item name='Haustürschlüssel' id='13' raum='5' imobil='false' adjektiv = '0' msgid='1' visible='false' />
|
||||||
|
|
||||||
</items>
|
</items>
|
||||||
<personen>
|
<personen>
|
||||||
|
Reference in New Issue
Block a user