hilfe befehle.

This commit is contained in:
Olli Graf
2022-05-18 13:45:17 +02:00
parent e671a22fa2
commit 0651532a56
8 changed files with 88 additions and 35 deletions

View File

@@ -5,12 +5,20 @@ import logging
class WorldParser():
def isBlank(self,str):
lenstr = len(str.strip())
logging.debug(f'isBlank(): {lenstr}')
if str == None or lenstr == 0:
return True
return False
def __init__(self,world):
self.neuerRaum = None
self.world = world
self.textCount = 0
def parseWorld(self,filename):
tree = ET.parse(filename)
root = tree.getroot()
@@ -91,6 +99,7 @@ class WorldParser():
imobil = item.attrib['imobil']
visible = item.attrib['visible']
adjektiv = item.attrib['adjektiv']
display = item.attrib['display']
raum = self.world.sucheRaum(raumid)
if raum is not None:
gegenstand.raum = raum.id
@@ -101,6 +110,12 @@ class WorldParser():
logging.error(f'Kein Raum für {gegenstand.name}')
gegenstand.adjektiv = adjektiv
logging.debug(f'display={display}, isBlank={self.isBlank(display)}')
if not self.isBlank(display):
gegenstand.display = display
else:
gegenstand.display = None
gegenstand.imobil = imobil.lower() in ['true','True','1']
logging.debug('itemid= ' + id + ',visible= ' + visible)
gegenstand.sichtbar = visible.lower() not in ['false','False','0']