def load(self):
     xmlCtx = ResMgr.openSection(self.XML_PATH)
     if xmlCtx is None:
         _xml.raiseWrongXml(None, self.XML_PATH, 'can not open or read')
     self.__readXML(xmlCtx)
     _xml.clearCaches()
     ResMgr.purge(self.XML_PATH, True)
     return
 def parse(chapter):
     filePath = chapter.getFilePath()
     section = ResMgr.openSection(filePath)
     if section is None:
         _xml.raiseWrongXml(None, filePath, 'can not open or read')
     xmlCtx = (None, filePath)
     flags = []
     BootcampParser._parseEntities(xmlCtx, section, flags, chapter)
     _xml.clearCaches()
     return
Example #3
0
 def parse(self, filePath):
     descriptor = DescriptorData()
     section = ResMgr.openSection(filePath)
     if section is None:
         _xml.raiseWrongXml(None, filePath, 'can not open or read')
     xmlCtx = (None, filePath)
     descriptor.setGuiFilePath(_xml.readString(xmlCtx, section, 'gui'))
     descriptor.setInitialChapterID(_xml.readString(xmlCtx, section, 'initial-chapter'))
     self.__parseChapterSummaries(xmlCtx, section, descriptor)
     _xml.clearCaches()
     return descriptor
Example #4
0
    def parse(self):
        section = ResMgr.openSection(BONUSES_REFS_FILE_PATH)
        if section is None:
            _xml.raiseWrongXml(None, BONUSES_REFS_FILE_PATH, 'can not open or read')
        xmlCtx = (None, BONUSES_REFS_FILE_PATH)
        result = {}
        for _, subSec in _xml.getChildren(xmlCtx, section, 'bonuses'):
            bonusID = sub_parsers.parseID(xmlCtx, subSec, 'Specify a bonus ID')
            bonus = sub_parsers.parseBonus(xmlCtx, subSec)
            result[bonusID] = bonus

        _xml.clearCaches()
        return result
Example #5
0
    def parse(filePath, excludedHints):
        hints = HintsData()
        section = ResMgr.openSection(filePath)
        if section is None:
            _xml.raiseWrongXml(None, filePath, 'can not open or read')
        xmlCtx = (None, filePath)
        hints.setGuiFilePath(_xml.readString(xmlCtx, section, 'gui'))
        for _, subSec in _xml.getChildren(xmlCtx, section, 'hints'):
            hint = sub_parsers.parseHint(xmlCtx, subSec)
            if hint['hintID'] not in excludedHints:
                hints.addHint(hint)

        _xml.clearCaches()
        return hints
Example #6
0
    def parse(self, chapter, varIDs=None, flags=None):
        if varIDs is None:
            varIDs = []
        if flags is None:
            flags = []
        section = ResMgr.openSection(GLOBAL_REFS_FILE_PATH)
        if section is None:
            _xml.raiseWrongXml(None, GLOBAL_REFS_FILE_PATH, 'can not open or read')
        xmlCtx = (None, GLOBAL_REFS_FILE_PATH)
        if varIDs:
            for _, subSec in _xml.getChildren(xmlCtx, section, 'vars'):
                varID = sub_parsers.parseID(xmlCtx, subSec, 'Specify a var ID')
                if varID in varIDs:
                    chapter.addVarSet(sub_parsers.parseVarSet(xmlCtx, subSec, flags))

        _xml.clearCaches()
        return
    def load(self, isReload=False):
        if self.__loaded and not isReload:
            return False
        LOG_DEBUG('Tech tree data is being loaded')
        self._clear()
        try:
            try:
                shared = self.__readShared(clearCache=isReload)
                for nation in self.__availableNations:
                    info = self.__readNation(shared, nation, clearCache=isReload)
                    self.__displayInfo[nations.INDICES[nation]] = info

            except _ConfigError as error:
                LOG_ERROR(error)

        finally:
            self.__makeAbsoluteCoordinates()
            self.__loaded = True

        _xml.clearCaches()
        return True
Example #8
0
 def parse(self, chapter, afterBattle=False, initial=False):
     filePath = chapter.getFilePath(afterBattle=afterBattle)
     section = ResMgr.openSection(filePath)
     if section is None:
         _xml.raiseWrongXml(None, filePath, 'can not open or read')
     xmlCtx = (None, filePath)
     chapter.clear()
     flags = []
     itemFlags = []
     if 'initial-scene' in section.keys():
         chapter.setInitialSceneID(_xml.readString(xmlCtx, section, 'initial-scene'))
     if 'default-scene' in section.keys():
         chapter.setDefaultSceneID(_xml.readString(xmlCtx, section, 'default-scene'))
     self._parseEntities(xmlCtx, section, flags, chapter)
     self._parseTriggers(xmlCtx, section, flags, chapter)
     self._parseVars(xmlCtx, section, flags, chapter)
     self._parseScenes(xmlCtx, section, chapter, flags, itemFlags, afterBattle, initial)
     self._parseGlobalRuntimeEffects(xmlCtx, section, flags, chapter)
     flags = [ flag for flag in flags if flag not in itemFlags ]
     chapter.setFlags(flags)
     chapter.setValid(True)
     _xml.clearCaches()
     return chapter
def clearXMLCache():
    _xml.clearCaches()