def _readVehicleFilterPattern(xmlCtx, section): res = {} for sname, section in section.items(): ctx = (xmlCtx, sname) if sname == 'nations': names = section.asString res['nations'] = [] for name in names.split(): id = nations.INDICES.get(name) if id is None: _xml.raiseWrongXml(xmlCtx, 'nations', "unknown nation '%s'" % name) res['nations'].append(id) elif sname in _vehicleFilterItemTypes: sname = intern(sname) res[sname] = {} if section.has_key('tags'): tags = _readTags(ctx, section, 'tags', _vehicleFilterItemTypes[sname]) res[sname]['tags'] = tags minLevel = section.readInt('minLevel', 1) if not 1 <= minLevel <= 10: _xml.raiseWrongSection(ctx, 'minLevel') if minLevel != 1: res[sname]['minLevel'] = minLevel maxLevel = section.readInt('maxLevel', 10) if not 1 <= maxLevel <= 10: _xml.raiseWrongSection(ctx, 'maxLevel') if maxLevel != 10: res[sname]['maxLevel'] = maxLevel else: _xml.raiseWrongXml(ctx, '', 'unknown section name') return res
def _readConfig(self, xmlCtx, section): self.delay = _xml.readPositiveFloat(xmlCtx, section, 'delay') self.modelName = _xml.readString(xmlCtx, section, 'modelName') self.soundEvent = _xml.readString(xmlCtx, section, 'soundEvent') self.speed = _xml.readInt(xmlCtx, section, 'speed') self.heights = _xml.readTupleOfPositiveInts(xmlCtx, section, 'heights', 2) self.areaLength = _xml.readPositiveFloat(xmlCtx, section, 'areaLength') self.areaWidth = _xml.readPositiveFloat(xmlCtx, section, 'areaWidth') self.antepositions = _xml.readTupleOfFloats(xmlCtx, section, 'antepositions') self.lateropositions = _xml.readTupleOfFloats(xmlCtx, section, 'lateropositions') self.bombingMask = tuple((bool(v) for v in _xml.readTupleOfInts(xmlCtx, section, 'bombingMask'))) if not len(self.antepositions) == len(self.lateropositions) == len(self.bombingMask): _xml.raiseWrongSection(xmlCtx, 'bombers number mismatch') self.waveFraction = _xml.readPositiveFloat(xmlCtx, section, 'waveFraction') self.bombsNumber = _xml.readNonNegativeInt(xmlCtx, section, 'bombsNumber') self.shellCompactDescr = _xml.readInt(xmlCtx, section, 'shellCompactDescr') self.tracerKind = _xml.readInt(xmlCtx, section, 'tracerKind') self.piercingPower = _xml.readTupleOfPositiveInts(xmlCtx, section, 'piercingPower', 2) self.gravity = _xml.readPositiveFloat(xmlCtx, section, 'gravity') self.areaVisual = _xml.readStringOrNone(xmlCtx, section, 'areaVisual') self.areaColor = _xml.readIntOrNone(xmlCtx, section, 'areaColor') self.areaMarker = _xml.readStringOrNone(xmlCtx, section, 'areaMarker') self.reusable = _xml.readBool(xmlCtx, section, 'reusable') self.cooldownTime = _xml.readNonNegativeFloat(xmlCtx, section, 'cooldownTime') if self.reusable else 0.0 self.deployTime = _xml.readNonNegativeFloat(xmlCtx, section, 'deployTime')
def _readQueueDialogSection(xmlCtx, section, _, dialogID, dialogType, content): content['avgTimeTextFormat'] = translation(_xml.readString(xmlCtx, section, 'avg-time-text')) subSec = _xml.getSubsection(xmlCtx, section, 'player-time-text') content['playerTimeTextStart'] = translation(_xml.readString(xmlCtx, subSec, 'start')) content['playerTimeTextEnd'] = translation(_xml.readString(xmlCtx, subSec, 'end')) pointcuts = [] for _, subSec in _xml.getChildren(xmlCtx, section, 'time-pointcuts'): value = subSec.asFloat if value > 0: pointcuts.append(subSec.asInt) if len(pointcuts) < 2: _xml.raiseWrongSection(xmlCtx, 'time-pointcuts: should be the minimum and maximum value') content['timePointcuts'] = sorted(pointcuts) return chapter.PopUp(dialogID, dialogType, content, _xml.readString(xmlCtx, section, 'var-ref'))
def readCamouflage(xmlCtx, section, sectionName, default=None): tilingKey = sectionName + '/tiling' if default is None or section.has_key(tilingKey): tiling = _xml.readTupleOfFloats(xmlCtx, section, tilingKey, 4) if tiling[0] <= 0 or tiling[1] <= 0: if default is None: _xml.raiseWrongSection(xmlCtx, tilingKey) else: tiling = default[0] else: tiling = default[0] maskKey = sectionName + '/exclusionMask' mask = section.readString(maskKey) if not mask and default is not None: mask = default[1] return shared_components.Camouflage(tiling, mask)
def readFlagEnum(xmlCtx, section, subsectionName, enumClass, defaultValue=None): result = 0 if not section.has_key(subsectionName) and defaultValue is not None: return defaultValue else: for value in ix.readNonEmptyString(xmlCtx, section, subsectionName).split(): valueInt = getattr(enumClass, value, None) if valueInt is None: ix.raiseWrongSection(xmlCtx, subsectionName) result |= valueInt return result
def _readIDs(xmlCtx, subsections, accumulator, parser): res = set() for sname, subsection in subsections: try: id = int(sname[1:]) except Exception: id = -1 if sname[0] != '_' or not 0 <= id <= 65535: _xml.raiseWrongSection(xmlCtx, sname) if id in accumulator: _xml.raiseWrongXml(xmlCtx, sname, 'ID is not unique') accumulator[id] = parser((xmlCtx, sname), subsection) res.add(id) if not res: _xml.raiseWrongXml(xmlCtx, '', 'is empty') return res
def _readItems(cache, itemCls, xmlCtx, section, itemSectionName, storage): reader = __xmlReaders[itemCls] groupsDict = cache.priceGroups itemToGroup = cache.itemToPriceGroup for i, (gname, gsection) in enumerate(section.items()): if gname != 'itemGroup' and 'xmlns:' not in gname: ix.raiseWrongSection(xmlCtx, gname) if gname != 'itemGroup': continue group = cc.ItemGroup(itemCls) gCtx = (xmlCtx, 'itemGroup {0}'.format(i)) itemPrototype = itemCls() reader._readFromXml(itemPrototype, gCtx, gsection) group.itemPrototype = itemPrototype j = 0 for iname, isection in gsection.items(): if iname != itemSectionName: continue iCtx = (gCtx, '{0} {1}'.format(iname, j)) j += 1 item = itemCls(group) reader._readFromXml(item, iCtx, isection) if item.compactDescr in itemToGroup: ix.raiseWrongXml( iCtx, 'id', 'duplicate item. id: %s found in group %s' % (item.id, itemToGroup[item.compactDescr])) storage[item.id] = item if isection.has_key('price'): iv._readPriceForItem(iCtx, isection, item.compactDescr) if item.priceGroup: if item.priceGroup not in cache.priceGroupNames: ix.raiseWrongXml( iCtx, 'priceGroup', 'unknown price group %s for item %s' % (item.priceGroup, item.id)) priceGroupId = cache.priceGroupNames[item.priceGroup] item.priceGroupTags = groupsDict[priceGroupId].tags itemToGroup[ item.compactDescr] = groupsDict[priceGroupId].compactDescr itemNotInShop = isection.readBool('notInShop', False) iv._copyPriceForItem(groupsDict[priceGroupId].compactDescr, item.compactDescr, itemNotInShop) ix.raiseWrongXml(iCtx, 'priceGroup', 'no price for item %s' % item.id)
def _readProjectionDecalSlot(ctx, subsection, slotType): descr = shared_components.ProjectionDecalSlotDescription( slotType=slotType, slotId=_xml.readInt(ctx, subsection, 'slotId'), anchorPosition=_xml.readVector3OrNone(ctx, subsection, 'anchorPosition'), anchorDirection=_xml.readVector3OrNone(ctx, subsection, 'anchorDirection'), position=_xml.readVector3OrNone(ctx, subsection, 'position'), rotation=_xml.readVector3OrNone(ctx, subsection, 'rotation'), scale=_xml.readVector3OrNone(ctx, subsection, 'scale'), scaleFactors=_xml.readVector3( ctx, subsection, 'scaleFactors', c11n_constants.DEFAULT_DECAL_SCALE_FACTORS), doubleSided=_xml.readBool(ctx, subsection, 'doubleSided', False), canBeMirroredVertically=_xml.readBool(ctx, subsection, 'verticalMirror', False), showOn=_xml.readIntOrNone(ctx, subsection, 'showOn'), tags=readOrderedTagsOrEmpty(ctx, subsection, _customizationSlotTagsValidator), clipAngle=_xml.readFloat(ctx, subsection, 'clipAngle', c11n_constants.DEFAULT_DECAL_CLIP_ANGLE)) _verifySlotId(ctx, slotType, descr.slotId) if descr.showOn is not None: availableShowOnRegions = c11n_constants.ApplyArea.HULL | c11n_constants.ApplyArea.TURRET | c11n_constants.ApplyArea.GUN if descr.showOn | availableShowOnRegions != availableShowOnRegions: _xml.raiseWrongSection(ctx, 'showOn') if subsection.has_key('attachedPart'): attachedPartsData = _xml.readString(ctx, subsection, 'attachedPart') descr.attachedParts = defaultdict(set) for partData in attachedPartsData.split(): pType, pName = partData.split(':') if pType != 'hull': descr.attachedParts[pType].add(pName) if subsection.has_key('compatibleModels'): descr.compatibleModels = _xml.readTupleOfStrings( ctx, subsection, 'compatibleModels') if subsection.has_key('itemId'): descr.itemId = _xml.readInt(ctx, subsection, 'itemId') if subsection.has_key('options'): descr.options = _xml.readNonNegativeInt(ctx, subsection, 'options') return descr
def readDeviceHealthParams(xmlCtx, section, subsectionName='', withHysteresis=True): if subsectionName: section = _xml.getSubsection(xmlCtx, section, subsectionName) xmlCtx = (xmlCtx, subsectionName) component = shared_components.DeviceHealth(_xml.readInt(xmlCtx, section, 'maxHealth', 1), _xml.readNonNegativeFloat(xmlCtx, section, 'repairCost'), _xml.readInt(xmlCtx, section, 'maxRegenHealth', 0)) if component.maxRegenHealth > component.maxHealth: _xml.raiseWrongSection(xmlCtx, 'maxRegenHealth') if not IS_CLIENT and not IS_BOT: component.healthRegenPerSec = _xml.readNonNegativeFloat(xmlCtx, section, 'healthRegenPerSec') component.healthBurnPerSec = _xml.readNonNegativeFloat(xmlCtx, section, 'healthBurnPerSec') if section.has_key('chanceToHit'): component.chanceToHit = _xml.readFraction(xmlCtx, section, 'chanceToHit') else: component.chanceToHit = None if withHysteresis: hysteresisHealth = _xml.readInt(xmlCtx, section, 'hysteresisHealth', 0) if hysteresisHealth > component.maxRegenHealth: _xml.raiseWrongSection(xmlCtx, 'hysteresisHealth') component.hysteresisHealth = hysteresisHealth return component
def _readQueueDialogSection(xmlCtx, section, _, dialogID, dialogType, content): content['avgTimeTextFormat'] = translation( _xml.readString(xmlCtx, section, 'avg-time-text')) subSec = _xml.getSubsection(xmlCtx, section, 'player-time-text') content['playerTimeTextStart'] = translation( _xml.readString(xmlCtx, subSec, 'start')) content['playerTimeTextEnd'] = translation( _xml.readString(xmlCtx, subSec, 'end')) pointcuts = [] for _, subSec in _xml.getChildren(xmlCtx, section, 'time-pointcuts'): value = subSec.asFloat if value > 0: pointcuts.append(subSec.asInt) if len(pointcuts) < 2: _xml.raiseWrongSection( xmlCtx, 'time-pointcuts: should be the minimum and maximum value') content['timePointcuts'] = sorted(pointcuts) return chapter.PopUp(dialogID, dialogType, content, _xml.readString(xmlCtx, section, 'var-ref'))
def _readIDs(xmlCtx, subsections, accumulator, parser=None): res = set() for sname, subsection in subsections: try: contentID = int(sname[1:]) except ValueError: contentID = -1 if sname[0] != '_' or not 0 <= contentID <= 65535: _xml.raiseWrongSection(xmlCtx, sname) if contentID in accumulator: _xml.raiseWrongXml(xmlCtx, sname, 'ID is not unique') if parser is not None: accumulator[contentID] = parser((xmlCtx, sname), subsection) else: accumulator[contentID] = component_constants.EMPTY_STRING res.add(contentID) if not res: _xml.raiseWrongXml(xmlCtx, '', 'is empty') return res
def readDeviceHealthParams(xmlCtx, section, subsectionName='', withHysteresis=True): """Reads health parameter for each device. :param xmlCtx: tuple(root ctx or None, path to section). :param section: instance of DataSection. :param subsectionName: string containing name of desired section or empty string if desired section is already exist. :param withHysteresis: if value equals True than read section 'hysteresisHealth', otherwise - do nothing. :return: instance of DeviceHealth. """ if subsectionName: section = _xml.getSubsection(xmlCtx, section, subsectionName) xmlCtx = (xmlCtx, subsectionName) component = shared_components.DeviceHealth( _xml.readInt(xmlCtx, section, 'maxHealth', 1), _xml.readNonNegativeFloat(xmlCtx, section, 'repairCost'), _xml.readInt(xmlCtx, section, 'maxRegenHealth', 0)) if component.maxRegenHealth > component.maxHealth: _xml.raiseWrongSection(xmlCtx, 'maxRegenHealth') if not IS_CLIENT and not IS_BOT: component.healthRegenPerSec = _xml.readNonNegativeFloat( xmlCtx, section, 'healthRegenPerSec') component.healthBurnPerSec = _xml.readNonNegativeFloat( xmlCtx, section, 'healthBurnPerSec') if section.has_key('chanceToHit'): component.chanceToHit = _xml.readFraction(xmlCtx, section, 'chanceToHit') else: component.chanceToHit = None if withHysteresis: hysteresisHealth = _xml.readInt(xmlCtx, section, 'hysteresisHealth', 0) if hysteresisHealth > component.maxRegenHealth: _xml.raiseWrongSection(xmlCtx, 'hysteresisHealth') component.hysteresisHealth = hysteresisHealth return component
def _readConfig(self, xmlCtx, section): self.delay = _xml.readPositiveFloat(xmlCtx, section, 'delay') self.modelName = _xml.readString(xmlCtx, section, 'modelName') if IS_CLIENT: self.soundEvent = _xml.readString(xmlCtx, section, 'wwsoundEvent') self.speed = _xml.readInt(xmlCtx, section, 'speed') self.heights = _xml.readTupleOfPositiveInts(xmlCtx, section, 'heights', 2) self.areaLength = _xml.readPositiveFloat(xmlCtx, section, 'areaLength') self.areaWidth = _xml.readPositiveFloat(xmlCtx, section, 'areaWidth') self.antepositions = _xml.readTupleOfFloats(xmlCtx, section, 'antepositions') self.lateropositions = _xml.readTupleOfFloats(xmlCtx, section, 'lateropositions') self.bombingMask = tuple( (bool(v) for v in _xml.readTupleOfInts(xmlCtx, section, 'bombingMask'))) if not len(self.antepositions) == len(self.lateropositions) == len( self.bombingMask): _xml.raiseWrongSection(xmlCtx, 'bombers number mismatch') self.waveFraction = _xml.readPositiveFloat(xmlCtx, section, 'waveFraction') self.bombsNumber = _xml.readNonNegativeInt(xmlCtx, section, 'bombsNumber') self.shellCompactDescr = _xml.readInt(xmlCtx, section, 'shellCompactDescr') self.tracerKind = _xml.readInt(xmlCtx, section, 'tracerKind') self.piercingPower = _xml.readTupleOfPositiveInts( xmlCtx, section, 'piercingPower', 2) self.gravity = _xml.readPositiveFloat(xmlCtx, section, 'gravity') self.areaVisual = _xml.readStringOrNone(xmlCtx, section, 'areaVisual') self.areaColor = _xml.readIntOrNone(xmlCtx, section, 'areaColor') self.areaMarker = _xml.readStringOrNone(xmlCtx, section, 'areaMarker') self.reusable = _xml.readBool(xmlCtx, section, 'reusable') self.cooldownTime = _xml.readNonNegativeFloat( xmlCtx, section, 'cooldownTime') if self.reusable else 0.0 self.deployTime = _xml.readNonNegativeFloat(xmlCtx, section, 'deployTime')
def _readSlotsAnchor(ctx, subsection, slotType): applyTo = _xml.readIntOrNone(ctx, subsection, 'applyTo') if applyTo is not None: if applyTo not in c11n_constants.ApplyArea.RANGE: _xml.raiseWrongSection(ctx, 'applyTo') showOn = _xml.readIntOrNone(ctx, subsection, 'showOn') if showOn is not None: availableShowOnRegions = c11n_constants.ApplyArea.HULL | c11n_constants.ApplyArea.TURRET | c11n_constants.ApplyArea.GUN if showOn | availableShowOnRegions != availableShowOnRegions: _xml.raiseWrongSection(ctx, 'showOn') descr = shared_components.SlotsAnchor( type=slotType, anchorPosition=_xml.readVector3(ctx, subsection, 'anchorPosition'), anchorDirection=_xml.readVector3(ctx, subsection, 'anchorDirection'), applyTo=applyTo, slotId=_xml.readInt(ctx, subsection, 'slotId'), position=_xml.readVector3OrNone(ctx, subsection, 'position'), rotation=_xml.readVector3OrNone(ctx, subsection, 'rotation'), scale=_xml.readVector3OrNone(ctx, subsection, 'scale'), scaleFactors=_xml.readVector3OrNone(ctx, subsection, 'scaleFactors'), doubleSided=_xml.readBool(ctx, subsection, 'doubleSided', False), showOn=showOn) return descr
def readCamouflage(xmlCtx, section, sectionName, default = None): """Reads camouflage configuration of vehicle's item on client-side only. :param xmlCtx: tuple(root ctx or None, path to section). :param section: instance of DataSection. :param sectionName: string containing name of section. :param default: None or instance of Camouflage that is used as default. :return: instance of shared_components.Camouflage. """ tilingKey = sectionName + '/tiling' if default is None or section.has_key(tilingKey): tiling = _xml.readTupleOfFloats(xmlCtx, section, tilingKey, 4) if tiling[0] <= 0 or tiling[1] <= 0: if default is None: _xml.raiseWrongSection(xmlCtx, tilingKey) else: tiling = default[0] else: tiling = default[0] maskKey = sectionName + '/exclusionMask' mask = section.readString(maskKey) if not mask and default is not None: mask = default[1] return shared_components.Camouflage(tiling, mask)
def _readProgression(cache, xmlCtx, section, progression): for gname, gsection in section.items(): if gname != 'progress': ix.raiseWrongSection(xmlCtx, gname) itemId, progress = __readProgress((xmlCtx, 'progress'), gsection) if progress.priceGroup: if progress.priceGroup not in cache.priceGroupNames: ix.raiseWrongXml( xmlCtx, 'priceGroup', 'unknown price group %s for item %s' % (progress.priceGroup, itemId)) priceGroupId = cache.priceGroupNames[progress.priceGroup] pgDescr = cache.priceGroups[priceGroupId].compactDescr for num, level in progress.levels.iteritems(): if 'price' not in level and progress.defaultLvl != num: priceInfo = iv.getPriceForItemDescr(pgDescr) if priceInfo: level.update({ 'price': priceInfo[0], 'notInShop': priceInfo[1] }) progression[itemId] = progress
def _readItems(cache, itemCls, xmlCtx, section, itemSectionName, storage, progression): reader = __xmlReaders[itemCls] groupsDict = cache.priceGroups itemToGroup = cache.itemToPriceGroup for i, (gname, gsection) in enumerate(section.items()): if gname != 'itemGroup' and 'xmlns:' not in gname: ix.raiseWrongSection(xmlCtx, gname) if gname != 'itemGroup': continue group = cc.ItemGroup(itemCls) gCtx = (xmlCtx, 'itemGroup {0}'.format(i)) itemPrototype = itemCls() sharedProps = set() with storeChangedProperties(itemPrototype, sharedProps): reader._readFromXml(itemPrototype, gCtx, gsection, cache) group.itemPrototype = itemPrototype groupItems = [] if gsection.has_key('name'): group.name = gsection.readString('name') j = 0 for iname, isection in gsection.items(): if iname != itemSectionName: continue iCtx = (gCtx, '{0} {1}'.format(iname, j)) j += 1 item = itemCls(group) overrideProps = set() with storeChangedProperties(item, overrideProps): reader._readFromXml(item, iCtx, isection, cache) if IS_EDITOR: item.editorData.sharedPropertiesInfo = EditorSharedPropertiesInfo( ) item.editorData.sharedPropertiesInfo.markAsOverride( *overrideProps) groupItems.append(item) if item.compactDescr in itemToGroup: ix.raiseWrongXml( iCtx, 'id', 'duplicate item. id: %s found in group %s' % (item.id, itemToGroup[item.compactDescr])) storage[item.id] = item item.progression = progression.get(item.id, None) if item.progression is not None: cache.customizationWithProgression[item.compactDescr] = item if isection.has_key('price'): iv._readPriceForItem(iCtx, isection, item.compactDescr) if item.priceGroup: if item.priceGroup not in cache.priceGroupNames: ix.raiseWrongXml( iCtx, 'priceGroup', 'unknown price group %s for item %s' % (item.priceGroup, item.id)) priceGroupId = cache.priceGroupNames[item.priceGroup] item.priceGroupTags = groupsDict[priceGroupId].tags itemToGroup[ item.compactDescr] = groupsDict[priceGroupId].compactDescr itemNotInShop = isection.readBool('notInShop', False) iv._copyPriceForItem(groupsDict[priceGroupId].compactDescr, item.compactDescr, itemNotInShop) ix.raiseWrongXml(iCtx, 'priceGroup', 'no price for item %s' % item.id) if IS_EDITOR: if len(groupItems) > 1 and len(sharedProps) > 0: for item in groupItems: for p in sharedProps: if not item.editorData.sharedPropertiesInfo.isOverriden( p): item.editorData.sharedPropertiesInfo.markAsShared( p) _addEmptyItem(itemCls, storage) return
def _readItems(cache, itemCls, xmlCtx, section, itemSectionName, storage, progression): reader = __xmlReaders[itemCls] priceGroupsDict = cache.priceGroups itemToPriceGroup = cache.itemToPriceGroup if IS_EDITOR: itemType = CUSTOMIZATION_CLASSES[itemCls] cache.editorData.groups[itemType] = [] sourceFiles = set() for i, (gname, gsection) in enumerate(section.items()): if gname != 'itemGroup' and 'xmlns:' not in gname: ix.raiseWrongSection(xmlCtx, gname) if gname != 'itemGroup': continue group = cc.ItemGroup(itemCls) gCtx = (xmlCtx, 'itemGroup {0}'.format(i)) itemPrototype = itemCls() sharedProps = set() with storeChangedProperties(itemPrototype, sharedProps): reader._readFromXml(itemPrototype, gCtx, gsection, cache) group.itemPrototype = itemPrototype groupItems = [] if gsection.has_key('name'): group.name = gsection.readString('name') j = 0 for iname, isection in gsection.items(): if iname != itemSectionName: continue iCtx = (gCtx, '{0} {1}'.format(iname, j)) j += 1 item = itemCls(group) overrideProps = set() with storeChangedProperties(item, overrideProps): reader._readFromXml(item, iCtx, isection, cache) if IS_EDITOR: item.editorData.sharedPropertiesInfo.markAsOverride( *overrideProps) groupItems.append(item) if item.compactDescr in itemToPriceGroup: ix.raiseWrongXml( iCtx, 'id', 'duplicate item. id: %s found in group %s' % (item.id, itemToPriceGroup[item.compactDescr])) storage[item.id] = item item.progression = progression.get(item.id, None) if item.progression is not None: cache.customizationWithProgression[item.compactDescr] = item iv._readPriceForProgressionLvl(item.compactDescr, item.progression.levels) for arenaTypeID, items in cache.itemGroupByProgressionBonusType.iteritems( ): if arenaTypeID in item.progression.bonusTypes: items.append(item) if isection.has_key('price'): iv._readPriceForItem(iCtx, isection, item.compactDescr) if item.priceGroup: if item.priceGroup not in cache.priceGroupNames: ix.raiseWrongXml( iCtx, 'priceGroup', 'unknown price group %s for item %s' % (item.priceGroup, item.id)) priceGroupId = cache.priceGroupNames[item.priceGroup] item.priceGroupTags = priceGroupsDict[priceGroupId].tags itemToPriceGroup[item.compactDescr] = priceGroupsDict[ priceGroupId].compactDescr itemNotInShop = isection.readBool('notInShop', False) iv._copyPriceForItem( priceGroupsDict[priceGroupId].compactDescr, item.compactDescr, itemNotInShop) ix.raiseWrongXml(iCtx, 'priceGroup', 'no price for item %s' % item.id) if IS_EDITOR: refs = gsection.references if len(refs) == 1: group.editorData.sourceXml = refs[0] sourceFiles.add(refs[0]) itemPrototype.edIsPrototype = True group.editorData.itemRefs = [ UnintrusiveWeakRef(item) for item in groupItems ] cache.editorData.groups[itemType].append(group) if IS_EDITOR: cache.editorData.sourceFiles[itemType] = list(sourceFiles) _addEmptyItem(itemCls, storage, itemSectionName) return
def _readProgression(xmlCtx, section, progression): for gname, gsection in section.items(): if gname != 'progress': ix.raiseWrongSection(xmlCtx, gname) itemId, progress = __readProgress((xmlCtx, 'progress'), gsection) progression[itemId] = progress