Example #1
0
def _readItems(groupName, cache, itemCls, xmlCtx, section, storage):
    reader = LegacyCamouflageReader(
    ) if itemCls == cc.CamouflageItem else PaintXmlReader()
    groupsDict = cache.priceGroups
    itemToGroup = cache.itemToPriceGroup
    group = cc.ItemGroup(itemCls)
    itemPrototype = itemCls()
    itemPrototype.season = SeasonType.ALL
    itemPrototype.priceGroup = 'custom'
    itemPrototype.historical = False
    itemPrototype.i18n = shared_components.I18nExposedComponent(groupName, '')
    group.itemPrototype = itemPrototype
    j = 0
    if section.has_key('camouflages'):
        section = section['camouflages']
    for i_name, i_section in section.items():
        iCtx = (xmlCtx, '{0} {1}'.format(i_name, j))
        j += 1
        item = itemCls(group)
        reader._readFromXml(item, iCtx, i_section)
        if itemCls == cc.CamouflageItem:
            item.invisibilityFactor = 0
            item.i18n = shared_components.I18nExposedComponent(i_name, '')
        item.id = max(20000, *storage) + 1
        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 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 = i_section.readBool('notInShop', True)
            iv._copyPriceForItem(groupsDict[priceGroupId].compactDescr,
                                 item.compactDescr, itemNotInShop)
        else:
            ix.raiseWrongXml(iCtx, 'priceGroup',
                             'no price for item %s' % item.id)
 def _readClientOnlyFromXml(self, target, xmlCtx, section, cache=None):
     if IS_EDITOR:
         target.i18n = I18nExposedComponentMeta(
             section.readString('name'), section.readString('userString'),
             section.readString('description'),
             section.readString('longDescriptionSpecial'))
     else:
         target.i18n = shared_components.I18nExposedComponent(
             section.readString('userString'),
             section.readString('description'),
             section.readString('longDescriptionSpecial'))
Example #3
0
 def _readClientOnlyFromXml(self, target, xmlCtx, section):
     target.i18n = shared_components.I18nExposedComponent(
         section.readString('userString'),
         section.readString('description'))