Example #1
0
 def _parseChapter(self, bonuses, descriptor, subSection, xmlCtx):
     sharedTriggers = subSection.readString('shared-triggers')
     sharedEntities = subSection.readString('shared-entities')
     sharedVars = subSection.readString('shared-vars')
     questConditions = readQuestConditions(subSection)
     image = subSection.readString('image')
     unlockChapter = subSection.readString('unlock-chapter')
     progressSec = _xml.getSubsection(xmlCtx, subSection, 'progress-condition')
     progressCondition = ProgressCondition(progressSec.readString('progressID'), sub_parsers.readValues(progressSec))
     isHidden = subSection.readBool('isHidden')
     descriptor.addChapter(QuestChapter(questConditions, image, unlockChapter, progressCondition, sharedTriggers, sharedEntities, sharedVars, isHidden, *self._getCommonChapterValues(bonuses, subSection, xmlCtx)))
Example #2
0
 def _parseChapter(self, bonuses, descriptor, subSection, xmlCtx):
     sharedTriggers = subSection.readString('shared-triggers')
     sharedEntities = subSection.readString('shared-entities')
     sharedVars = subSection.readString('shared-vars')
     questConditions = readQuestConditions(subSection)
     image = subSection.readString('image')
     unlockChapter = subSection.readString('unlock-chapter')
     progressSec = _xml.getSubsection(xmlCtx, subSection, 'progress-condition')
     progressCondition = ProgressCondition(progressSec.readString('progressID'), sub_parsers.readValues(progressSec))
     isHidden = subSection.readBool('isHidden')
     descriptor.addChapter(QuestChapter(questConditions, image, unlockChapter, progressCondition, sharedTriggers, sharedEntities, sharedVars, isHidden, *self._getCommonChapterValues(bonuses, subSection, xmlCtx)))
Example #3
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')
            result[bonusID] = Bonus(subSec.readInt('id', -1),
                                    subSec.readString('message'),
                                    sub_parsers.readValues(subSec))

        return result
Example #4
0
 def _parseBonus(self, xmlCtx, section, bonuses):
     tags = section.keys()
     if 'bonus' in tags:
         subSection = section['bonus']
         return Bonus(subSection.readInt('id', -1),
                      subSection.readString('message'),
                      sub_parsers.readValues(subSection))
     if 'bonus-ref' in tags:
         bonusID = sub_parsers.parseID(xmlCtx, section['bonus-ref'],
                                       'Specify a bonus ID')
         if bonusID in bonuses:
             return bonuses[bonusID]
         _xml.raiseWrongXml(
             xmlCtx, section.name,
             'Bonus reference {0} is not found'.format(bonusID))
     else:
         _xml.raiseWrongXml(xmlCtx, section.name, 'Bonuses is not found')
Example #5
0
 def _parseBonus(self, xmlCtx, section, bonuses):
     tags = section.keys()
     if 'bonus' in tags:
         subSection = section['bonus']
         return Bonus(subSection.readInt('id', -1), subSection.readString('message'), sub_parsers.readValues(subSection))
     if 'bonus-ref' in tags:
         bonusID = sub_parsers.parseID(xmlCtx, section['bonus-ref'], 'Specify a bonus ID')
         if bonusID in bonuses:
             return bonuses[bonusID]
         _xml.raiseWrongXml(xmlCtx, section.name, 'Bonus reference {0} is not found'.format(bonusID))
     else:
         _xml.raiseWrongXml(xmlCtx, section.name, 'Bonuses is not found')
Example #6
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')
            result[bonusID] = Bonus(subSec.readInt('id', -1), subSec.readString('message'), sub_parsers.readValues(subSec))

        return result