Esempio n. 1
0
def getVehicleDesc(compactDescr, isTop):
    vDesc = VehicleDescr(compactDescr=compactDescr)
    if isTop:
        vType = vDesc.type
        turrent = vType.turrets[-1][-1]
        gun = turrent['guns'][-1]

        gunID = makeIntCompactDescrByID('vehicleGun', gun.id[0], gun.id[1])
        turretID = makeIntCompactDescrByID('vehicleTurret', turrent.id[0],
                                           turrent.id[1])
        engineID = makeIntCompactDescrByID('vehicleEngine',
                                           vType.engines[-1].id[0],
                                           vType.engines[-1].id[1])
        radioID = makeIntCompactDescrByID('vehicleRadio',
                                          vType.radios[-1].id[0],
                                          vType.radios[-1].id[1])
        chassisID = makeIntCompactDescrByID('vehicleChassis',
                                            vType.chassis[-1].id[0],
                                            vType.chassis[-1].id[1])

        vDesc.installComponent(chassisID)
        vDesc.installComponent(engineID)
        vDesc.installTurret(turretID, gunID)
        vDesc.installComponent(radioID)
    return vDesc
def getStyleProgressionOutfit(outfit, toLevel=0, season=None):
    styleProgression = outfit.style.styleProgressions
    allLevels = styleProgression.keys()
    if not season:
        season = _currentMapSeason()
    style = outfit.style
    if toLevel == 0 and style.isProgressionRewindEnabled:
        _logger.info(
            'Get style progression level for the rewind style with id=%d',
            style.id)
        toLevel = getCurrentLevelForRewindStyle(outfit)
    if allLevels and toLevel not in allLevels:
        _logger.error(
            'Get style progression outfit: incorrect level given: %d', toLevel)
        toLevel = 1
    resOutfit = outfit.copy()
    for levelId, outfitConfig in styleProgression.iteritems():
        if 'additionalOutfit' not in outfitConfig.keys():
            continue
        if levelId != toLevel:
            additionalOutfit = outfitConfig['additionalOutfit'].get(season)
            if additionalOutfit:
                tmpOutfitCompDescr = additionalOutfit.makeCompDescr()
                tmpOutfit = Outfit(strCompactDescr=tmpOutfitCompDescr,
                                   vehicleCD=outfit.vehicleCD)
                resOutfit = resOutfit.discard(tmpOutfit)

    levelAdditionalOutfit = styleProgression.get(toLevel, {}).get(
        'additionalOutfit', {}).get(season)
    compDescr = None
    if levelAdditionalOutfit:
        compDescr = levelAdditionalOutfit.makeCompDescr()
    tmpOutfit = Outfit(strCompactDescr=compDescr, vehicleCD=outfit.vehicleCD)
    tmpDiff = resOutfit.diff(tmpOutfit).copy()
    resOutfit = resOutfit.adjust(tmpDiff)
    baseOutfit = outfit.style.outfits.get(season)
    if baseOutfit:
        baseOutfit = Outfit(strCompactDescr=baseOutfit.makeCompDescr(),
                            vehicleCD=outfit.vehicleCD)
        resOutfit = baseOutfit.adjust(resOutfit)
    resOutfit.setProgressionLevel(toLevel)
    if levelAdditionalOutfit:
        if levelAdditionalOutfit.attachments:
            attachmentSlot = resOutfit.misc.slotFor(GUI_ITEM_TYPE.ATTACHMENT)
            for attachment in levelAdditionalOutfit.attachments:
                intCD = makeIntCompactDescrByID('customizationItem',
                                                CustomizationType.ATTACHMENT,
                                                attachment.id)
                attachmentSlot.append(intCD, attachment)

        if levelAdditionalOutfit.sequences:
            sequenceSlot = resOutfit.misc.slotFor(GUI_ITEM_TYPE.SEQUENCE)
            for seq in levelAdditionalOutfit.sequences:
                intCD = makeIntCompactDescrByID('customizationItem',
                                                CustomizationType.SEQUENCE,
                                                seq.id)
                sequenceSlot.append(intCD, seq)

    return resOutfit
Esempio n. 3
0
def __readBonus_customizations(bonus, _name, section, eventType):
    lst = []
    for subsection in section.values():
        custData = {
            'value': subsection.readInt('value', 0),
            'custType': subsection.readString('custType', ''),
            'id': subsection.readInt('id', -1)
        }
        if subsection.has_key('boundVehicle'):
            custData['vehTypeCompDescr'] = vehicles.makeIntCompactDescrByID(
                'vehicle',
                *vehicles.g_list.getIDsByName(
                    subsection.readString('boundVehicle', '')))
        elif subsection.has_key('boundToCurrentVehicle'):
            if eventType in EVENT_TYPE.LIKE_TOKEN_QUESTS:
                raise SoftException(
                    "Unsupported tag 'boundToCurrentVehicle' in 'like token' quests"
                )
            custData['boundToCurrentVehicle'] = True
        if subsection.has_key('customCompensation'):
            __readBonus_customCompensation(custData, None,
                                           subsection['customCompensation'])
        isValid, item = validateCustomizationItem(custData)
        if not isValid:
            raise SoftException(item)
        lst.append(custData)

    bonus['customizations'] = lst
    return
Esempio n. 4
0
def _buildCache():
    vehiclesByLevel = {}
    vehicles8p = set()
    beastVehicles = set()
    sinaiVehicles = set()
    pattonVehicles = set()
    vehiclesInTreesByNation = {}
    vehiclesInTrees = set()
    unlocksSources = vehicles.getUnlocksSources()
    for nationIdx in xrange(len(nations.NAMES)):
        nationList = vehicles.g_list.getList(nationIdx)
        vehiclesInNationTrees = set()
        for vehDescr in nationList.itervalues():
            vehiclesByLevel.setdefault(vehDescr['level'], set()).add(vehDescr['compactDescr'])
            if 'beast' in vehDescr['tags']:
                beastVehicles.add(vehDescr['compactDescr'])
            if 'sinai' in vehDescr['tags']:
                sinaiVehicles.add(vehDescr['compactDescr'])
            if len(unlocksSources.get(vehDescr['compactDescr'], set())) > 0 or len(vehicles.g_cache.vehicle(nationIdx, vehDescr['id']).unlocksDescrs) > 0:
                vehiclesInNationTrees.add(vehDescr['compactDescr'])
            if 'patton' in vehDescr['tags']:
                pattonVehicles.add(vehDescr['compactDescr'])

        vehiclesInTrees.update(vehiclesInNationTrees)
        vehiclesInTreesByNation[nationIdx] = vehiclesInNationTrees

    vehicles8p = vehiclesByLevel[8] | vehiclesByLevel[9] | vehiclesByLevel[10]
    return {'vehiclesByLevel': vehiclesByLevel,
     'vehicles8+': vehicles8p,
     'beastVehicles': beastVehicles,
     'sinaiVehicles': sinaiVehicles,
     'pattonVehicles': pattonVehicles,
     'mausTypeCompDescr': vehicles.makeIntCompactDescrByID('vehicle', *vehicles.g_list.getIDsByName('germany:Maus')),
     'vehiclesInTreesByNation': vehiclesInTreesByNation,
     'vehiclesInTrees': vehiclesInTrees}
Esempio n. 5
0
 def getItem(self, itemTypeID, nationID, innationID):
     typeCompDescr = vehicles.makeIntCompactDescrByID(
         GUI_ITEM_TYPE_NAMES[itemTypeID], nationID, innationID)
     return self.__makeVehicle(
         typeCompDescr
     ) if itemTypeID == GUI_ITEM_TYPE.VEHICLE else self.__makeSimpleItem(
         typeCompDescr)
Esempio n. 6
0
def buildCache():
    vehiclesByLevel = {}
    vehiclesByTag = {'beast': set(),
     'sinai': set(),
     'patton': set()}
    vehiclesInTreeByNation = {}
    vehiclesInTree = set()
    nationsWithVehiclesInTree = []
    unlocksSources = vehicles.getUnlocksSources()
    for nationIdx in xrange(len(nations.NAMES)):
        nationList = vehicles.g_list.getList(nationIdx)
        vehiclesInNationTree = set()
        for vehDescr in nationList.itervalues():
            vehiclesByLevel.setdefault(vehDescr['level'], set()).add(vehDescr['compactDescr'])
            for tag in ('beast', 'sinai', 'patton'):
                if tag in vehDescr['tags']:
                    vehiclesByTag[tag].add(vehDescr['compactDescr'])

            if len(unlocksSources.get(vehDescr['compactDescr'], set())) > 0 or len(vehicles.g_cache.vehicle(nationIdx, vehDescr['id']).unlocksDescrs) > 0:
                vehiclesInNationTree.add(vehDescr['compactDescr'])

        vehiclesInTree.update(vehiclesInNationTree)
        vehiclesInTreeByNation[nationIdx] = vehiclesInNationTree
        if bool(vehiclesInNationTree):
            nationsWithVehiclesInTree.append(nationIdx)

    vehicles8p = vehiclesByLevel[8] | vehiclesByLevel[9] | vehiclesByLevel[10]
    _g_cache.update({'vehiclesByLevel': vehiclesByLevel,
     'vehicles8+': vehicles8p,
     'vehiclesByTag': vehiclesByTag,
     'mausTypeCompDescr': vehicles.makeIntCompactDescrByID('vehicle', *vehicles.g_list.getIDsByName('germany:Maus')),
     'vehiclesInTreesByNation': vehiclesInTreeByNation,
     'vehiclesInTrees': vehiclesInTree,
     'nationsWithVehiclesInTree': nationsWithVehiclesInTree})
Esempio n. 7
0
def __readBonus_vehicle(bonus, _name, section):
    vehCompDescr = None
    if section.has_key('vehCompDescr'):
        vehCompDescr = section['vehCompDescr'].asString.decode('base64')
        vehTypeCompDescr = vehicles.VehicleDescr(vehCompDescr).type.compactDescr
    else:
        nationID, innationID = vehicles.g_list.getIDsByName(section.asString)
        vehTypeCompDescr = vehicles.makeIntCompactDescrByID('vehicle', nationID, innationID)
    extra = {}
    if section.has_key('tankmen'):
        __readBonus_tankmen(extra, vehTypeCompDescr, section['tankmen'])
    else:
        if section.has_key('noCrew'):
            extra['noCrew'] = True
        if section.has_key('crewLvl'):
            extra['crewLvl'] = section['crewLvl'].asInt
        if section.has_key('crewFreeXP'):
            extra['crewFreeXP'] = section['crewFreeXP'].asInt
    if section.has_key('rent'):
        __readBonus_rent(extra, None, section['rent'])
    if section.has_key('customCompensation'):
        credits = section['customCompensation'].readInt('credits', 0)
        gold = section['customCompensation'].readInt('gold', 0)
        extra['customCompensation'] = (credits, gold)
    bonus.setdefault('vehicles', {})[vehCompDescr if vehCompDescr else vehTypeCompDescr] = extra
    return
 def __updateStyleAppliedCount(self, styleId, vehicleIntCD, count):
     if styleId == 0:
         return None
     else:
         styleIntCD = vehicles.makeIntCompactDescrByID('customizationItem', CustomizationType.STYLE, styleId)
         self.__inventory.updateC11nItemAppliedCount(styleIntCD, vehicleIntCD, count)
         return styleIntCD
 def tradeInVehicle(self, vehInvID, nationIdx, innationIdx, buyShells,
                    recruitCrew, tmanCostTypeIdx, callback):
     if self.__ignore:
         if callback is not None:
             callback(AccountCommands.RES_NON_PLAYER, {})
         return
     else:
         typeCompDescr = vehicles.makeIntCompactDescrByID(
             'vehicle', nationIdx, innationIdx)
         flags = BUY_VEHICLE_FLAG.NONE
         if buyShells:
             flags |= BUY_VEHICLE_FLAG.SHELLS
         if recruitCrew:
             flags |= BUY_VEHICLE_FLAG.CREW
         if callback is not None:
             proxy = lambda requestID, resultID, errorStr, ext={}: callback(
                 resultID)
         else:
             proxy = None
         arr = [
             self.__getCacheRevision(), vehInvID, typeCompDescr, flags,
             tmanCostTypeIdx
         ]
         self.__account._doCmdIntArr(AccountCommands.CMD_VEHICLE_TRADE_IN,
                                     arr, proxy)
         return
    def __init__(self,
                 strCompactDescr=None,
                 component=None,
                 vehicleCD='',
                 vehicleType=None):
        super(Outfit, self).__init__(strCompactDescr)
        self._containers = {}
        self._vehicleCD = vehicleCD
        if strCompactDescr is not None and component is not None:
            raise SoftException(
                "'strCompactDescr' and 'component' arguments are mutually exclusive!"
            )
        if strCompactDescr:
            component = parseOutfitDescr(strCompactDescr)
        elif component is None:
            component = CustomizationOutfit()
        self._id = component.styleId
        if self._id:
            intCD = makeIntCompactDescrByID('customizationItem',
                                            CustomizationType.STYLE, self._id)
            self._styleDescr = getItemByCompactDescr(intCD)
        else:
            self._styleDescr = None
        self._construct(vehicleType=vehicleType)
        for container in self._containers.itervalues():
            container.unpack(component)

        self.__itemsCounter = None
        self.invalidate()
        return
    def __getNodeByName(self, nodeName, nationID, order=0):
        nodes = self.__nodes[nationID]
        if nodes is None:
            nodes = self.__nodes[nationID] = {}
        if nodeName in nodes:
            node = nodes[nodeName]
            if order:
                node.order = order
            return node
        else:
            isFound = True
            isAnnouncement = False
            if nodeName in self.__announcements:
                isAnnouncement = True
                vehicleTypeID = self.__getNextTypeID(nationID)
            else:
                _, vehicleTypeID = vehicles.g_list.getIDsByName('{0:>s}:{1:>s}'.format(nations.NAMES[nationID], nodeName))
            try:
                nodeCD = vehicles.makeIntCompactDescrByID(_VEHICLE_TYPE_NAME, nationID, vehicleTypeID)
            except AssertionError:
                nodeCD = 0
                isFound = False

            if isAnnouncement:
                self.__announcementCDToName[nodeCD] = nodeName
            node = BaseNode(nodeName, nationID, vehicleTypeID, nodeCD, isFound=isFound, isAnnouncement=isAnnouncement, order=order)
            nodes[nodeName] = node
            return node
def interceptVehicleBuy(nationIdx, innationIdx, *args, **kwargs):
    origVehicleBuy(nationIdx, innationIdx, *args, **kwargs)
    itemCD = vehicles.makeIntCompactDescrByID('vehicle', nationIdx,
                                              innationIdx)
    researchVehicle(
        itemCD, 0,
        lambda: BigWorld.callback(3, lambda: mountTopModules(itemCD)))
Esempio n. 13
0
    def __init__(self, strCompactDescr=None, component=None, vehicleCD='', vehicleType=None):
        super(Outfit, self).__init__(strCompactDescr)
        self._containers = {}
        self._vehicleCD = vehicleCD
        if strCompactDescr is not None and component is not None:
            raise SoftException("'strCompactDescr' and 'component' arguments are mutually exclusive!")
        if strCompactDescr:
            component = parseOutfitDescr(strCompactDescr)
        elif component is None:
            component = CustomizationOutfit()
        self._id = component.styleId
        self.__styleProgressionLevel = component.styleProgressionLevel
        self.__styleSerialNumber = component.serial_number
        self._styleDescr = None
        if self._id:
            intCD = makeIntCompactDescrByID('customizationItem', CustomizationType.STYLE, self._id)
            if not IS_EDITOR:
                self._styleDescr = getItemByCompactDescr(intCD)
            else:
                from items.vehicles import g_cache
                if g_cache.customization20(createNew=False):
                    self._styleDescr = getItemByCompactDescr(intCD)
        self._construct(vehicleType=vehicleType)
        for container in self._containers.itervalues():
            container.unpack(component)

        self.__itemsCounter = None
        self.invalidate()
        return
Esempio n. 14
0
 def _readBasicConfig(self, xmlCtx, section):
     self.name = section.name
     self.id = (nations.NONE_INDEX,
                _xml.readInt(xmlCtx, section, 'id', 0, 65535))
     self.compactDescr = vehicles.makeIntCompactDescrByID(
         self.itemTypeName, *self.id)
     if not section.has_key('tags'):
         self.tags = frozenset()
     else:
         self.tags = _readTags(xmlCtx, section, 'tags', self.itemTypeName)
     if IS_CLIENT or IS_WEB:
         self.i18n = shared_components.I18nComponent(
             section.readString('userString'),
             section.readString('description'))
         self.icon = _xml.readIcon(xmlCtx, section, 'icon')
     if IS_CELLAPP or not section.has_key('vehicleFilter'):
         self.__vehicleFilter = None
     else:
         self.__vehicleFilter = _VehicleFilter((xmlCtx, 'vehicleFilter'),
                                               section['vehicleFilter'])
     if not section.has_key('incompatibleTags'):
         self.__artefactFilter = None
     else:
         self.__artefactFilter = _ArtefactFilter(
             (xmlCtx, 'incompatibleTags'), section['incompatibleTags'],
             self.itemTypeName)
     self.removable = section.readBool('removable', False)
     return
Esempio n. 15
0
    def formatValue(self):
        groups = {}
        for tmanInfo in self.getTankmenData():
            roleLevel = calculateRoleLevel(tmanInfo.roleLevel,
                                           tmanInfo.freeXP,
                                           typeID=(tmanInfo.nationID,
                                                   tmanInfo.vehicleTypeID))
            if tmanInfo.vehicleTypeID not in groups:
                vehIntCD = vehicles.makeIntCompactDescrByID(
                    'vehicle', tmanInfo.nationID, tmanInfo.vehicleTypeID)
                groups[tmanInfo.vehicleTypeID] = {
                    'vehName':
                    g_itemsCache.items.getItemByCD(vehIntCD).shortUserName,
                    'skills': len(tmanInfo.skills),
                    'roleLevel': roleLevel
                }
            else:
                group = groups[tmanInfo.vehicleTypeID]
                group['skills'] += len(tmanInfo.skills)
                group['roleLevel'] = min(group['roleLevel'], roleLevel)

        result = []
        for group in groups.itervalues():
            if group['skills']:
                labelI18nKey = '#quests:bonuses/item/tankmen/with_skills'
            else:
                labelI18nKey = '#quests:bonuses/item/tankmen/no_skills'
            result.append(i18n.makeString(labelI18nKey, **group))

        return ' '.join(result)
Esempio n. 16
0
    def __init__(self,
                 strCompactDescr=None,
                 isEnabled=False,
                 isInstalled=False,
                 proxy=None):
        super(Outfit, self).__init__(strCompactDescr)
        self._containers = {}
        if strCompactDescr:
            component = parseCompDescr(strCompactDescr)
        else:
            component = CustomizationOutfit()
        self._id = component.styleId
        if self._id:
            intCD = makeIntCompactDescrByID('customizationItem',
                                            CustomizationType.STYLE, self._id)
            self._styleDescr = getItemByCompactDescr(intCD)
        else:
            self._styleDescr = None
        self._isEnabled = isEnabled
        self._isInstalled = isInstalled
        for container in scaffold():
            container.unpack(component, proxy)
            self._containers[container.getAreaID()] = container

        self.invalidate()
        return
def __getProjectionDecalTextures(item, component, vehDesc):
    texture = item.texture
    glossTexture = item.glossTexture
    if IS_EDITOR:
        return (texture, glossTexture)
    else:
        if item.isProgressive():
            progressionLevel = component.progressionLevel
            if progressionLevel == 0:
                itemsCache = dependency.instance(IItemsCache)
                inventory = itemsCache.items.inventory
                intCD = makeIntCompactDescrByID(
                    'customizationItem', CustomizationType.PROJECTION_DECAL,
                    item.id)
                progressData = inventory.getC11nProgressionData(
                    intCD, vehDesc.type.compactDescr)
                if progressData is not None:
                    progressionLevel = progressData.currentLevel
            if progressionLevel:
                texture = Customization.getTextureByProgressionLevel(
                    texture, progressionLevel)
                if glossTexture:
                    glossTexture = Customization.getTextureByProgressionLevel(
                        glossTexture, progressionLevel)
            else:
                return (None, None)
        return (texture, glossTexture)
Esempio n. 18
0
def __readBonus_vehicle(bonus, _name, section):
    vehCompDescr = None
    if section.has_key('vehCompDescr'):
        vehCompDescr = section['vehCompDescr'].asString.decode('base64')
        vehTypeCompDescr = vehicles.VehicleDescr(vehCompDescr).type.compactDescr
    else:
        nationID, innationID = vehicles.g_list.getIDsByName(section.asString)
        vehTypeCompDescr = vehicles.makeIntCompactDescrByID('vehicle', nationID, innationID)
    extra = {}
    if section.has_key('tankmen'):
        __readBonus_tankmen(extra, vehTypeCompDescr, section['tankmen'])
    else:
        if section.has_key('noCrew'):
            extra['noCrew'] = True
        if section.has_key('crewLvl'):
            extra['crewLvl'] = section['crewLvl'].asInt
        if section.has_key('crewFreeXP'):
            extra['crewFreeXP'] = section['crewFreeXP'].asInt
    if section.has_key('rent'):
        __readBonus_rent(extra, None, section['rent'])
    if section.has_key('customCompensation'):
        credits = section['customCompensation'].readInt('credits', 0)
        gold = section['customCompensation'].readInt('gold', 0)
        extra['customCompensation'] = (credits, gold)
    bonus.setdefault('vehicles', {})[vehCompDescr if vehCompDescr else vehTypeCompDescr] = extra
    return
def __readBonus_customizations(bonus, _name, section):
    lst = []
    for subsection in section.values():
        custData = {
            'value': subsection.readInt('value', 0),
            'custType': subsection.readString('custType', ''),
            'id': subsection.readInt('id', -1)
        }
        if subsection.has_key('boundVehicle'):
            custData['vehTypeCompDescr'] = vehicles.makeIntCompactDescrByID(
                'vehicle',
                *vehicles.g_list.getIDsByName(
                    subsection.readString('boundVehicle', '')))
        elif subsection.has_key('boundToCurrentVehicle'):
            custData['boundToCurrentVehicle'] = True
        if subsection.has_key('customCompensation'):
            credits = subsection['customCompensation'].readInt('credits', 0)
            gold = subsection['customCompensation'].readInt('gold', 0)
            custData['customCompensation'] = (credits, gold)
        isValid, item = validateCustomizationItem(custData)
        if not isValid:
            raise SoftException(item)
        lst.append(custData)

    bonus['customizations'] = lst
Esempio n. 20
0
 def __readBasicConfig(self, xmlCtx, section):
     self.itemTypeName = 'equipment'
     self.name = section.name
     self.id = (nations.NONE_INDEX,
                _xml.readInt(xmlCtx, section, 'id', 0, 65535))
     self.compactDescr = vehicles.makeIntCompactDescrByID(
         'equipment', *self.id)
     if not section.has_key('tags'):
         self.tags = frozenset()
     else:
         self.tags = _readTags(xmlCtx, section, 'tags', 'equipment')
     if IS_CLIENT or IS_WEB:
         self.userString = i18n.makeString(section.readString('userString'))
         self.description = i18n.makeString(
             section.readString('description'))
         self.icon = _xml.readIcon(xmlCtx, section, 'icon')
     if IS_CELLAPP or not section.has_key('vehicleFilter'):
         self.__vehicleFilter = None
     else:
         self.__vehicleFilter = _VehicleFilter((xmlCtx, 'vehicleFilter'),
                                               section['vehicleFilter'])
     if not section.has_key('incompatibleTags'):
         self.__equipmentFilter = None
     else:
         self.__equipmentFilter = _EquipmentFilter(
             (xmlCtx, 'incompatibleTags'), section['incompatibleTags'])
     return
Esempio n. 21
0
 def buyTankman(self, nationIdx, innationIdx, role, tmanCostTypeIdx, callback):
     vehTypeCompDescr = vehicles.makeIntCompactDescrByID('vehicle', nationIdx, innationIdx)
     roleIdx = tankmen.SKILL_INDICES[role]
     if callback is not None:
         proxy = lambda requestID, resultID, errorStr, ext = {}: callback(resultID, ext.get('tmanInvID', None), ext.get('tmanCompDescr', None))
     else:
         proxy = None
     self.__account._doCmdInt4(AccountCommands.CMD_BUY_TMAN, self.__getCacheRevision(), vehTypeCompDescr, roleIdx, tmanCostTypeIdx, proxy)
Esempio n. 22
0
 def buyTankman(self, nationIdx, innationIdx, role, tmanCostTypeIdx, callback):
     vehTypeCompDescr = vehicles.makeIntCompactDescrByID('vehicle', nationIdx, innationIdx)
     roleIdx = tankmen.SKILL_INDICES[role]
     if callback is not None:
         proxy = lambda requestID, resultID, errorStr, ext = {}: callback(resultID, ext.get('tmanInvID', None), ext.get('tmanCompDescr', None))
     else:
         proxy = None
     self.__account._doCmdInt4(AccountCommands.CMD_BUY_TMAN, self.__getCacheRevision(), vehTypeCompDescr, roleIdx, tmanCostTypeIdx, proxy)
 def setOptionalDevice(self, deviceID, isOn):
     intCD = vehicles.makeIntCompactDescrByID('optionalDevice', nations.NONE_INDEX, deviceID)
     if deviceID in self.__optionalDevices:
         self.__optionalDevices[deviceID] = isOn
         self.onOptionalDeviceUpdated(intCD, isOn)
     else:
         self.__optionalDevices[deviceID] = isOn
         self.onOptionalDeviceAdded(intCD, self.getDescriptor(deviceID), isOn)
def __getFixedProjectionDecalParams(slotParams):
    intCD = makeIntCompactDescrByID('customizationItem', CustomizationType.PROJECTION_DECAL, slotParams.itemId)
    item = getItemByCompactDescr(intCD)
    tintColor = __getProjectionDecalTintColor()
    mirroredHorizontally = slotParams.options & Options.MIRRORED_HORIZONTALLY
    mirroredVertically = slotParams.options & Options.MIRRORED_VERTICALLY
    params = ProjectionDecalGenericParams(tintColor=tintColor, position=Math.Vector3(slotParams.position), rotation=Math.Vector3(slotParams.rotation), scale=Math.Vector3(slotParams.scale), decalMap=item.texture, glossDecalMap=item.glossTexture, applyAreas=slotParams.showOn, clipAngle=slotParams.clipAngle, mirroredHorizontally=mirroredHorizontally, mirroredVertically=mirroredVertically, doubleSided=slotParams.doubleSided, scaleBySlotSize=True)
    return params
Esempio n. 25
0
    def _response(self, resID, invData, callback):
        self.__vehsCDsByID = {}
        if invData is not None:
            for invID, vCompDescr in invData[GUI_ITEM_TYPE.VEHICLE]['compDescr'].iteritems():
                self.__vehsCDsByID[invID] = vehicles.makeIntCompactDescrByID('vehicle', *vehicles.parseVehicleCompactDescr(vCompDescr))

        self.__vehsIDsByCD = dict(((v, k) for k, v in self.__vehsCDsByID.iteritems()))
        super(InventoryRequester, self)._response(resID, invData, callback)
Esempio n. 26
0
 def setSelectedVehicle(self, vehicleName):
     if vehicleName:
         nationID, vehID = vehicles.g_list.getIDsByName(vehicleName)
         self.__vehCompDescr = vehicles.makeIntCompactDescrByID(
             'vehicle', nationID, vehID)
     else:
         self.__vehCompDescr = self._UNDEFINED_VALUE
     self.updateSelectedVehicle()
     self.onUpdated()
Esempio n. 27
0
 def isHistorical(self):
     """ Check if all outfit items are historical.
     """
     if self._id:
         intCD = makeIntCompactDescrByID('customizationItem',
                                         CustomizationType.STYLE, self._id)
         style = self.itemsFactory.createCustomization(intCD)
         return style.isHistorical()
     return all((item.isHistorical() for item in self.items()))
Esempio n. 28
0
 def getItemByID(self, itemTypeID, itemID):
     """ Get an item by it's type and id.
     
     :param itemTypeID: type of item (one of GUI_ITEM_TYPE).
     :param itemID: id of item.
     :return: instance of Customization.
     """
     intCD = makeIntCompactDescrByID('customizationItem', C11N_ITEM_TYPE_MAP.get(itemTypeID), itemID)
     return self.itemsCache.items.getItemByCD(intCD)
def getCurrentLevelForRewindStyle(outfit):
    itemsCache = dependency.instance(IItemsCache)
    inventory = itemsCache.items.inventory
    intCD = makeIntCompactDescrByID('customizationItem',
                                    CustomizationType.STYLE, outfit.style.id)
    vehDesc = g_currentVehicle.item.descriptor
    progressData = inventory.getC11nProgressionData(intCD,
                                                    vehDesc.type.compactDescr)
    return progressData.currentLevel if progressData is not None else 1
Esempio n. 30
0
 def buyTokenTankman(self, nationIdx, innationIdx, role, tokenName, callback):
     vehTypeCompDescr = vehicles.makeIntCompactDescrByID('vehicle', nationIdx, innationIdx)
     roleIdx = tankmen.SKILL_INDICES[role]
     if callback is not None:
         proxy = lambda requestID, resultID, errorStr, ext={}: callback(resultID, ext.get('tmanInvID', None), ext.get('tmanCompDescr', None))
     else:
         proxy = None
     self.__account._doCmdInt2Str(AccountCommands.CMD_TMAN_RECRUIT, vehTypeCompDescr, roleIdx, tokenName, proxy)
     return
Esempio n. 31
0
    def make(cls, gun):
        clip = _ClipBurstSettings(*gun["clip"])
        burst = _ClipBurstSettings(*gun["burst"])
        shots = {}
        for shotIdx, shotDescr in enumerate(gun["shots"]):
            nationID, itemID = shotDescr["shell"]["id"]
            intCD = vehicles.makeIntCompactDescrByID("shell", nationID, itemID)
            shots[intCD] = (shotIdx, shotDescr["piercingPower"][0])

        return cls.__new__(cls, clip, burst, shots)
Esempio n. 32
0
    def make(cls, gun):
        clip = _ClipBurstSettings(*gun['clip'])
        burst = _ClipBurstSettings(*gun['burst'])
        shots = {}
        for shotIdx, shotDescr in enumerate(gun['shots']):
            nationID, itemID = shotDescr['shell']['id']
            intCD = vehicles.makeIntCompactDescrByID('shell', nationID, itemID)
            shots[intCD] = (shotIdx, shotDescr['piercingPower'][0])

        return cls.__new__(cls, clip, burst, shots)
Esempio n. 33
0
 def setOptionalDevice(self, deviceID, isOn):
     intCD = vehicles.makeIntCompactDescrByID('optionalDevice',
                                              nations.NONE_INDEX, deviceID)
     if deviceID in self.__optionalDevices:
         self.__optionalDevices[deviceID] = isOn
         self.onOptionalDeviceUpdated(intCD, isOn)
     else:
         self.__optionalDevices[deviceID] = isOn
         self.onOptionalDeviceAdded(intCD, self.getDescriptor(deviceID),
                                    isOn)
Esempio n. 34
0
    def make(cls, gun):
        clip = _ClipBurstSettings(*gun['clip'])
        burst = _ClipBurstSettings(*gun['burst'])
        shots = {}
        for shotIdx, shotDescr in enumerate(gun['shots']):
            nationID, itemID = shotDescr['shell']['id']
            intCD = vehicles.makeIntCompactDescrByID('shell', nationID, itemID)
            shots[intCD] = (shotIdx, shotDescr['piercingPower'][0])

        return cls.__new__(cls, clip, burst, shots)
def __createSequenceItem(sequenceId, guiItemsFactory=None):
    try:
        intCD = makeIntCompactDescrByID('customizationItem',
                                        CustomizationType.SEQUENCE, sequenceId)
        sequenceItem = guiItemsFactory.createCustomization(intCD)
    except KeyError:
        _logger.error('Could not find sequence item with id=%d', sequenceId)
        return None

    return sequenceItem
def __createSequenceItem(sequenceId, guiItemsFactory=None):
    try:
        from gui.customization.shared import C11N_ITEM_TYPE_MAP
        intCD = makeIntCompactDescrByID('customizationItem', C11N_ITEM_TYPE_MAP.get(GUI_ITEM_TYPE.SEQUENCE), sequenceId)
        sequenceItem = guiItemsFactory.createCustomization(intCD)
    except KeyError:
        _logger.error('Could not find sequence item with id=%d', sequenceId)
        return None

    return sequenceItem
Esempio n. 37
0
 def _makeResultItem(self, vehName):
     try:
         if ':' in vehName:
             vehIDs = vehicles.g_list.getIDsByName(vehName)
         else:
             vehIDs = vehicles.g_list.getIDsByVehName(vehName)
         vehTypeCompDescr = vehicles.makeIntCompactDescrByID(_VEH_TYPE_NAME, *vehIDs)
         return g_itemsCache.items.getItemByCD(vehTypeCompDescr)
     except Exception:
         LOG_ERROR('There is error while getting vehicle item', vehName)
         LOG_CURRENT_EXCEPTION()
Esempio n. 38
0
 def addExperience(self, vehTypeName, xp, callback = None):
     if self.__ignore:
         if callback is not None:
             callback(AccountCommands.RES_NON_PLAYER)
         return
     vehTypeCompDescr = vehicles.makeIntCompactDescrByID('vehicle', *vehicles.g_list.getIDsByName(vehTypeName))
     if callback is not None:
         proxy = lambda requestID, resultID, errorStr, ext = {}: callback(resultID)
     else:
         proxy = None
     self.__account._doCmdInt3(AccountCommands.CMD_ADD_XP, vehTypeCompDescr, xp, 0, proxy)
Esempio n. 39
0
def __readBonus_customizations(bonus, _name, section):
    lst = []
    for subsection in section.values():
        custData = {
            "isPermanent": subsection.readBool("isPermanent", False),
            "value": subsection.readInt("value", 0),
            "custType": subsection.readString("custType", ""),
            "id": (subsection.readInt("nationID", -1), subsection.readInt("innationID", -1)),
        }
        if subsection.has_key("boundVehicle"):
            custData["vehTypeCompDescr"] = vehicles.makeIntCompactDescrByID(
                "vehicle", *vehicles.g_list.getIDsByName(subsection.readString("boundVehicle", ""))
            )
        elif subsection.has_key("boundToCurrentVehicle"):
            custData["boundToCurrentVehicle"] = True
        if custData["custType"] == "emblems":
            custData["id"] = custData["id"][1]
        isValid, reason = validateCustomizationItem(custData)
        if not isValid:
            raise Exception, reason
        if "boundToCurrentVehicle" in custData:
            customization = vehicles.g_cache.customization
            if custData["custType"] == "camouflages":
                nationID, innationID = custData["id"]
                descr = customization(nationID)["camouflages"][innationID]
                if descr["allow"] or descr["deny"]:
                    raise Exception, "Unsupported camouflage because allow and deny tags %s, %s, %s" % (
                        custData,
                        descr["allow"],
                        descr["deny"],
                    )
            elif custData["custType"] == "inscriptions":
                nationID, innationID = custData["id"]
                groupName = customization(nationID)["inscriptions"][innationID][0]
                allow, deny = customization(nationID)["inscriptionGroups"][groupName][3:5]
                if allow or deny:
                    raise Exception, "Unsupported inscription because allow and deny tags %s, %s, %s" % (
                        custData,
                        allow,
                        deny,
                    )
            elif custData["custType"] == "emblems":
                innationID = custData["id"]
                groups, emblems, _ = vehicles.g_cache.playerEmblems()
                allow, deny = groups[emblems[innationID][0]][4:6]
                if allow or deny:
                    raise Exception, "Unsupported inscription because allow and deny tags %s, %s, %s" % (
                        custData,
                        allow,
                        deny,
                    )
        lst.append(custData)

    bonus["customizations"] = lst
Esempio n. 40
0
    def make(cls, gun):
        clip = _ClipBurstSettings(*gun["clip"])
        burst = _ClipBurstSettings(*gun["burst"])
        shots = {}
        reloadEffect = None
        reloadEffectDesc = gun.get("reloadEffect", None)
        if reloadEffectDesc is not None:
            reloadEffect = reloadEffectDesc.create()
        for shotIdx, shotDescr in enumerate(gun["shots"]):
            nationID, itemID = shotDescr["shell"]["id"]
            intCD = vehicles.makeIntCompactDescrByID("shell", nationID, itemID)
            shots[intCD] = (shotIdx, shotDescr["piercingPower"][0])

        return cls.__new__(cls, clip, burst, shots, reloadEffect)
Esempio n. 41
0
 def getItem(self, itemTypeID, nationID, innationID):
     """
     Returns item from inventory by given criteria or
     from shop.
     
     @param itemTypeID: item type index from common.items.ITEM_TYPE_NAMES
     @param nationID: nation index from nations.NAMES
     @param innationID: item index within its nation
     @return: gui item
     """
     typeCompDescr = vehicles.makeIntCompactDescrByID(GUI_ITEM_TYPE_NAMES[itemTypeID], nationID, innationID)
     if itemTypeID == GUI_ITEM_TYPE.VEHICLE:
         return self.__makeVehicle(typeCompDescr)
     return self.__makeSimpleItem(typeCompDescr)
Esempio n. 42
0
    def make(cls, gun):
        clip = _ClipBurstSettings(*gun['clip'])
        burst = _ClipBurstSettings(*gun['burst'])
        shots = {}
        reloadEffect = None
        reloadEffectDesc = gun.get('reloadEffect', None)
        if reloadEffectDesc is not None:
            reloadEffect = reloadEffectDesc.create()
        for shotIdx, shotDescr in enumerate(gun['shots']):
            nationID, itemID = shotDescr['shell']['id']
            intCD = vehicles.makeIntCompactDescrByID('shell', nationID, itemID)
            shots[intCD] = (shotIdx, shotDescr['piercingPower'][0])

        return cls.__new__(cls, clip, burst, shots, reloadEffect)
Esempio n. 43
0
 def __readBasicConfig(self, xmlCtx, section):
     self.itemTypeName = 'optionalDevice'
     self.name = section.name
     self.id = (nations.NONE_INDEX, _xml.readInt(xmlCtx, section, 'id', 0, 65535))
     self.compactDescr = vehicles.makeIntCompactDescrByID('optionalDevice', *self.id)
     if IS_CLIENT or IS_WEB:
         self.userString = i18n.makeString(section.readString('userString'))
         self.description = i18n.makeString(section.readString('description'))
         self.icon = _xml.readIcon(xmlCtx, section, 'icon')
     if IS_CELLAPP or not section.has_key('vehicleFilter'):
         self.__filter = None
     else:
         self.__filter = _VehicleFilter((xmlCtx, 'vehicleFilter'), section['vehicleFilter'])
     self.removable = section.readBool('removable', False)
Esempio n. 44
0
    def setInvVehicles(self, data):
        vCDs = data.get(INV_ITEM_VCDESC_KEY, {})
        vTypeName = ITEM_TYPE_NAMES[_VEHICLE]
        result = set()
        for invID, vStrCD in vCDs.iteritems():
            if vStrCD is None or not len(vStrCD):
                vIntCD = self._data.removeInvItem(invID=invID)
            else:
                vType = vehicles.getVehicleType(vStrCD)
                vIntCD = vehicles.makeIntCompactDescrByID(vTypeName, vType.id[0], vType.id[1])
                self._data.setInvItem(vIntCD, custom_items._makeInventoryVehicle(invID, vStrCD, data))
            if vIntCD > 0:
                result.add(vIntCD)

        return (result, False)
Esempio n. 45
0
 def __readBonus_vehicle(self, eventType, bonus, _name, section, gFinishTime):
     (nationID, innationID,) = vehicles.g_list.getIDsByName(section.asString)
     vehTypeCompDescr = vehicles.makeIntCompactDescrByID('vehicle', nationID, innationID)
     extra = {}
     if section.has_key('tankmen'):
         self.__readBonus_tankmen(eventType, extra, vehTypeCompDescr, section['tankmen'], gFinishTime)
     elif section.has_key('noCrew'):
         extra['noCrew'] = True
     if section.has_key('crewLvl'):
         extra['crewLvl'] = section['crewLvl'].asInt
     if section.has_key('crewFreeXP'):
         extra['crewFreeXP'] = section['crewFreeXP'].asInt
     if section.has_key('rent'):
         self.__readBonus_rent(extra, None, section['rent'], gFinishTime)
     bonus.setdefault('vehicles', {})[vehTypeCompDescr] = extra
Esempio n. 46
0
 def buyVehicle(self, nationIdx, innationIdx, buyShells, recruitCrew, tmanCostTypeIdx, rentPeriod, callback):
     if self.__ignore:
         if callback is not None:
             callback(AccountCommands.RES_NON_PLAYER, {})
         return
     typeCompDescr = vehicles.makeIntCompactDescrByID("vehicle", nationIdx, innationIdx)
     flags = BUY_VEHICLE_FLAG.NONE
     if buyShells:
         flags |= BUY_VEHICLE_FLAG.SHELLS
     if recruitCrew:
         flags |= BUY_VEHICLE_FLAG.CREW
     if callback is not None:
         proxy = lambda requestID, resultID, errorStr, ext={}: callback(resultID)
     else:
         proxy = None
     arr = [self.__getCacheRevision(), typeCompDescr, flags, tmanCostTypeIdx, rentPeriod]
     self.__account._doCmdIntArr(AccountCommands.CMD_BUY_VEHICLE, arr, proxy)
Esempio n. 47
0
def __readBonus_vehicle(bonus, _name, section):
    nationID, innationID = vehicles.g_list.getIDsByName(section.asString)
    vehTypeCompDescr = vehicles.makeIntCompactDescrByID("vehicle", nationID, innationID)
    extra = {}
    if section.has_key("tankmen"):
        __readBonus_tankmen(extra, vehTypeCompDescr, section["tankmen"])
    else:
        if section.has_key("noCrew"):
            extra["noCrew"] = True
        if section.has_key("crewLvl"):
            extra["crewLvl"] = section["crewLvl"].asInt
        if section.has_key("crewFreeXP"):
            extra["crewFreeXP"] = section["crewFreeXP"].asInt
    if section.has_key("rent"):
        __readBonus_rent(extra, None, section["rent"])
    if section.has_key("customCompensation"):
        credits = section["customCompensation"].readInt("credits", 0)
        gold = section["customCompensation"].readInt("gold", 0)
        extra["customCompensation"] = (credits, gold)
    bonus.setdefault("vehicles", {})[vehTypeCompDescr] = extra
    return
Esempio n. 48
0
 def __readBasicConfig(self, xmlCtx, section):
     self.itemTypeName = 'equipment'
     self.name = section.name
     self.id = (nations.NONE_INDEX, _xml.readInt(xmlCtx, section, 'id', 0, 65535))
     self.compactDescr = vehicles.makeIntCompactDescrByID('equipment', *self.id)
     if not section.has_key('tags'):
         self.tags = frozenset()
     else:
         self.tags = _readTags(xmlCtx, section, 'tags', 'equipment')
     if IS_CLIENT or IS_WEB:
         self.userString = i18n.makeString(section.readString('userString'))
         self.description = i18n.makeString(section.readString('description'))
         self.icon = _xml.readIcon(xmlCtx, section, 'icon')
     if IS_CELLAPP or not section.has_key('vehicleFilter'):
         self.__vehicleFilter = None
     else:
         self.__vehicleFilter = _VehicleFilter((xmlCtx, 'vehicleFilter'), section['vehicleFilter'])
     if not section.has_key('incompatibleTags'):
         self.__equipmentFilter = None
     else:
         self.__equipmentFilter = _EquipmentFilter((xmlCtx, 'incompatibleTags'), section['incompatibleTags'])
Esempio n. 49
0
    def __readBonus_customizations(self, eventType, bonus, _name, section, _gFinishTime):
        lst = []
        for subsection in section.values():
            custData = {'isPermanent': subsection.readBool('isPermanent', False),
             'value': subsection.readInt('value', 0),
             'custType': subsection.readString('custType', ''),
             'id': (subsection.readInt('nationID', -1), subsection.readInt('innationID', -1))}
            if subsection.has_key('boundVehicle'):
                custData['vehTypeCompDescr'] = vehicles.makeIntCompactDescrByID('vehicle', *vehicles.g_list.getIDsByName(subsection.readString('boundVehicle', '')))
            elif subsection.has_key('boundToCurrentVehicle'):
                if eventType in EVENT_TYPE.LIKE_TOKEN_QUESTS:
                    raise Exception, "Unsupported tag 'boundToCurrentVehicle' in 'like token' quests"
                custData['boundToCurrentVehicle'] = True
            if custData['custType'] == 'emblems':
                custData['id'] = custData['id'][1]
            isValid, reason = validateCustomizationItem(custData)
            if not isValid:
                raise Exception, reason
            if 'boundToCurrentVehicle' in custData:
                customization = vehicles.g_cache.customization
                if custData['custType'] == 'camouflages':
                    nationID, innationID = custData['id']
                    descr = customization(nationID)['camouflages'][innationID]
                    if descr['allow'] or descr['deny']:
                        raise Exception, 'Unsupported camouflage because allow and deny tags %s, %s, %s' % (custData, descr['allow'], descr['deny'])
                elif custData['custType'] == 'inscriptions':
                    nationID, innationID = custData['id']
                    groupName = customization(nationID)['inscriptions'][innationID][0]
                    allow, deny = customization(nationID)['inscriptionGroups'][groupName][3:5]
                    if allow or deny:
                        raise Exception, 'Unsupported inscription because allow and deny tags %s, %s, %s' % (custData, allow, deny)
                elif custData['custType'] == 'emblems':
                    innationID = custData['id']
                    groups, emblems, _ = vehicles.g_cache.playerEmblems()
                    allow, deny = groups[emblems[innationID][0]][4:6]
                    if allow or deny:
                        raise Exception, 'Unsupported inscription because allow and deny tags %s, %s, %s' % (custData, allow, deny)
            lst.append(custData)

        bonus['customizations'] = lst
Esempio n. 50
0
    def setInvVehicles(self, data):
        vData = data.get(INV_ITEM_VCDESC_KEY, {})
        currentID = self._data.getNationID()
        rootCD = self._data.getRootCD()
        rootItem = self._data.getInvItem(rootCD)
        inventory = set()
        fullUpdate = False
        if not len(vData):
            invIDs = custom_items._findVehItemsToChange(data)
            mapping = self._data.getInvMapping()
            for invID in invIDs:
                if invID in mapping:
                    vIntCD = mapping[invID]
                    custom_items._changeInventoryVehicle(invID, self._data.getInvItem(vIntCD), data)
                    inventory.add(vIntCD)
                    if vIntCD == rootCD:
                        fullUpdate = True

            return (inventory, fullUpdate)
        else:
            for invID, vStrCD in vData.iteritems():
                if vStrCD is None or not len(vStrCD):
                    vIntCD = self._data.removeInvItem(invID=invID)
                    if vIntCD == rootCD:
                        rootItem = None
                    item = None
                else:
                    vType = vehicles.getVehicleType(vStrCD)
                    nationID, itemID = vType.id
                    if nationID != currentID:
                        continue
                    vIntCD = vehicles.makeIntCompactDescrByID(_VEHICLE_TYPE_NAME, nationID, itemID)
                    item = custom_items._makeInventoryVehicle(invID, vStrCD, data)
                    self._data.setInvItem(vIntCD, item)
                if vIntCD > 0:
                    inventory.add(vIntCD)
                if vIntCD == rootCD:
                    fullUpdate = rootItem is None or item is not None and rootItem.repairCost != item.repairCost

            return (inventory, fullUpdate)
Esempio n. 51
0
    def formatValue(self):
        groups = {}
        for tmanInfo in self.getTankmenData():
            roleLevel = calculateRoleLevel(tmanInfo.roleLevel, tmanInfo.freeXP, typeID=(tmanInfo.nationID, tmanInfo.vehicleTypeID))
            if tmanInfo.vehicleTypeID not in groups:
                vehIntCD = vehicles.makeIntCompactDescrByID('vehicle', tmanInfo.nationID, tmanInfo.vehicleTypeID)
                groups[tmanInfo.vehicleTypeID] = {'vehName': g_itemsCache.items.getItemByCD(vehIntCD).shortUserName,
                 'skills': len(tmanInfo.skills),
                 'roleLevel': roleLevel}
            else:
                group = groups[tmanInfo.vehicleTypeID]
                group['skills'] += len(tmanInfo.skills)
                group['roleLevel'] = min(group['roleLevel'], roleLevel)

        result = []
        for group in groups.itervalues():
            if group['skills']:
                labelI18nKey = '#quests:bonuses/item/tankmen/with_skills'
            else:
                labelI18nKey = '#quests:bonuses/item/tankmen/no_skills'
            result.append(i18n.makeString(labelI18nKey, **group))

        return ' '.join(result)
Esempio n. 52
0
 def __makeIntVehCompactDescr(self, vCompDescr):
     nationID, compTypeID = vehicles.parseVehicleCompactDescr(vCompDescr)
     return vehicles.makeIntCompactDescrByID(self._itemTypeName, nationID, compTypeID)
def _makeIntCD(deviceID):
    return vehicles.makeIntCompactDescrByID('optionalDevice', nations.NONE_INDEX, deviceID)
Esempio n. 54
0
def _readAsEquipmentSection(_, section):
    equipmentName = section.asString
    return vehicles.makeIntCompactDescrByID('equipment', nations.NONE_INDEX, vehicles.g_cache.equipmentIDs()[equipmentName])
Esempio n. 55
0
def _readAsVehItemNameSection(itemName, itemIDsMethod, section):
    nationName, chassisName = section.asString.split(':')
    nationID = nations.INDICES[nationName]
    itemGetter = getattr(vehicles.g_cache, itemIDsMethod)
    return vehicles.makeIntCompactDescrByID(itemName, nationID, itemGetter(nationID)[chassisName])
Esempio n. 56
0
def _readAsVehTypeNameSection(_, section):
    return vehicles.makeIntCompactDescrByID('vehicle', *vehicles.g_list.getIDsByName(section.asString))