def _readTankmenGroup(xmlCtx, groupName, subsection, firstNames, lastNames, icons):
    if IS_CLIENT or IS_WEB or IS_BOT:
        parseName = _parseName
        parseIcon = _parseIcon
    else:
        parseName = parseIcon = None
    return tankmen_components.NationGroup(_xml.readNonNegativeInt(xmlCtx, subsection, 'groupID'), groupName, 'female' == _xml.readNonEmptyString(xmlCtx, subsection, 'sex'), subsection.readBool('notInShop', False), _readIDs((xmlCtx, 'firstNames'), _xml.getChildren(xmlCtx, subsection, 'firstNames'), firstNames, parseName), _readIDs((xmlCtx, 'lastNames'), _xml.getChildren(xmlCtx, subsection, 'lastNames'), lastNames, parseName), _readIDs((xmlCtx, 'icons'), _xml.getChildren(xmlCtx, subsection, 'icons'), icons, parseIcon), _xml.readNonNegativeFloat(xmlCtx, subsection, 'weight'), _readGroupTags((xmlCtx, 'tags'), subsection, 'tags'), _readGroupRoles((xmlCtx, 'roles'), subsection, 'roles'))
Ejemplo n.º 2
0
def _readProjectionDecalSlot(ctx, subsection, slotType):
    descr = shared_components.ProjectionDecalSlotDescription(
        slotType=slotType,
        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.readVector3(
            ctx, subsection, 'scaleFactors',
            c11n_constants.DEFAULT_DECAL_SCALE_FACTORS),
        doubleSided=_xml.readBool(ctx, subsection, 'doubleSided', False),
        hiddenForUser=_xml.readBool(ctx, subsection, 'hiddenForUser', 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),
        anchorShift=_xml.readFloat(ctx, subsection, 'anchorShift',
                                   c11n_constants.DEFAULT_DECAL_ANCHOR_SHIFT))
    _verifySlotId(ctx, slotType, descr.slotId)
    _verifyMatchingSlotSettings(ctx, descr)
    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('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
Ejemplo n.º 3
0
 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')
Ejemplo n.º 4
0
 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')
Ejemplo n.º 5
0
 def _readConfig(self, xmlCtx, section):
     self.delay = _xml.readPositiveFloat(xmlCtx, section, 'delay')
     self.duration = _xml.readPositiveFloat(xmlCtx, section, 'duration')
     self.shotsNumber = _xml.readNonNegativeInt(xmlCtx, section, 'shotsNumber')
     self.areaRadius = _xml.readPositiveFloat(xmlCtx, section, 'areaRadius')
     self.shellCompactDescr = _xml.readInt(xmlCtx, section, 'shellCompactDescr')
     self.piercingPower = _xml.readTupleOfPositiveInts(xmlCtx, section, 'piercingPower', 2)
     self.areaVisual = _xml.readStringOrNone(xmlCtx, section, 'areaVisual')
     self.areaColor = _xml.readIntOrNone(xmlCtx, section, 'areaColor')
     self.areaMarker = _xml.readStringOrNone(xmlCtx, section, 'areaMarker')
     self.areaLength = self.areaWidth = self.areaRadius * 2
     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')
Ejemplo n.º 6
0
 def _readConfig(self, xmlCtx, section):
     self.delay = _xml.readPositiveFloat(xmlCtx, section, 'delay')
     self.duration = _xml.readPositiveFloat(xmlCtx, section, 'duration')
     self.shotsNumber = _xml.readNonNegativeInt(xmlCtx, section, 'shotsNumber')
     self.areaRadius = _xml.readPositiveFloat(xmlCtx, section, 'areaRadius')
     self.shellCompactDescr = _xml.readInt(xmlCtx, section, 'shellCompactDescr')
     self.piercingPower = _xml.readTupleOfPositiveInts(xmlCtx, section, 'piercingPower', 2)
     self.areaVisual = _xml.readStringOrNone(xmlCtx, section, 'areaVisual')
     self.areaColor = _xml.readIntOrNone(xmlCtx, section, 'areaColor')
     self.areaMarker = _xml.readStringOrNone(xmlCtx, section, 'areaMarker')
     self.areaLength = self.areaWidth = self.areaRadius * 2
     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 _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 readSplineConfig(xmlCtx, section, cache):
    if not section.has_key('splineDesc'):
        return
    else:
        splineSegmentModelSets = {
            'default':
            chassis_components.SplineSegmentModelSet(
                left=_xml.readNonEmptyString(xmlCtx, section,
                                             'splineDesc/segmentModelLeft'),
                right=_xml.readNonEmptyString(xmlCtx, section,
                                              'splineDesc/segmentModelRight'),
                secondLeft=_xml.readStringOrNone(
                    xmlCtx, section, 'splineDesc/segment2ModelLeft') or '',
                secondRight=_xml.readStringOrNone(
                    xmlCtx, section, 'splineDesc/segment2ModelRight') or '')
        }
        modelSetsSection = section['splineDesc/modelSets']
        if modelSetsSection:
            for sname, subSection in modelSetsSection.items():
                splineSegmentModelSets[
                    sname] = chassis_components.SplineSegmentModelSet(
                        left=_xml.readNonEmptyString(xmlCtx, subSection,
                                                     'segmentModelLeft'),
                        right=_xml.readNonEmptyString(xmlCtx, subSection,
                                                      'segmentModelRight'),
                        secondLeft=_xml.readStringOrNone(
                            xmlCtx, subSection, 'segment2ModelLeft') or '',
                        secondRight=_xml.readStringOrNone(
                            xmlCtx, subSection, 'segment2ModelRight') or '')

        leftDescs = []
        rightDescs = []
        multipleTracks = section['splineDesc/multipleTracks']
        if multipleTracks is not None:
            for node in multipleTracks.items():
                desc = _xml.readNonEmptyString(xmlCtx, node[1], 'desc')
                pairIdx = _xml.readNonNegativeInt(xmlCtx, node[1],
                                                  'trackPairIdx')
                length = _xml.readFloat(xmlCtx, node[1], 'segmentLength')
                offset = _xml.readFloat(xmlCtx, node[1], 'segmentOffset', 0)
                offset2 = _xml.readFloat(xmlCtx, node[1], 'segment2Offset', 0)
                descList = [desc, pairIdx, length, offset, offset2]
                if node[0] == 'left':
                    leftDescs.append(descList)
                if node[0] == 'right':
                    rightDescs.append(descList)

        else:
            length = _xml.readFloat(xmlCtx, section,
                                    'splineDesc/segmentLength')
            offset = _xml.readFloat(xmlCtx, section,
                                    'splineDesc/segmentOffset', 0)
            offset2 = _xml.readFloat(xmlCtx, section,
                                     'splineDesc/segment2Offset', 0)
            leftTuple = [
                _xml.readStringOrNone(xmlCtx, section, 'splineDesc/left'), 0,
                length, offset, offset2
            ]
            rightTuple = [
                _xml.readStringOrNone(xmlCtx, section, 'splineDesc/right'), 0,
                length, offset, offset2
            ]
            leftDescs.append(leftTuple)
            rightDescs.append(rightTuple)
        return chassis_components.SplineConfig(
            segmentModelSets=splineSegmentModelSets,
            leftDesc=leftDescs,
            rightDesc=rightDescs,
            lodDist=shared_readers.readLodDist(xmlCtx, section,
                                               'splineDesc/lodDist', cache),
            atlasUTiles=section.readInt('splineDesc/atlas/UTiles', 1),
            atlasVTiles=section.readInt('splineDesc/atlas/VTiles', 1))