Ejemplo n.º 1
0
 def __setVehicleData(self, vehicleDescr = None):
     if vehicleDescr is not None:
         vehicleType = vehicleDescr.type
         self.compactDescr = vehicleType.compactDescr
         tags = vehicleType.tags
         self.classTag = _getClassTag(tags)
         self.isObserver = _isObserver(tags)
         self.shortName = vehicleType.shortUserString
         self.name = Vehicle.getUserName(vehicleType=vehicleType, textPrefix=True)
         self.shortNameWithPrefix = Vehicle.getShortUserName(vehicleType=vehicleType, textPrefix=True)
         self.guiName = getShortUserName(vehicleType)
         self.nationID = vehicleType.id[0]
         self.level = vehicleType.level
         vName = vehicleType.name
         self.iconPath = settings.makeContourIconSFPath(vName)
         if not fo_precache.add(settings.makeContourIconResPath(vName)):
             self.iconPath = settings.UNKNOWN_CONTOUR_ICON_SF_PATH
     else:
         self.compactDescr = 0
         self.classTag = None
         self.isObserver = False
         self.shortName = settings.UNKNOWN_VEHICLE_NAME
         self.name = settings.UNKNOWN_VEHICLE_NAME
         self.guiName = settings.UNKNOWN_VEHICLE_NAME
         self.shortNameWithPrefix = settings.UNKNOWN_VEHICLE_NAME
         self.nationID = nations.NONE_INDEX
         self.level = settings.UNKNOWN_VEHICLE_LEVEL
         self.iconPath = settings.UNKNOWN_CONTOUR_ICON_SF_PATH
         self.shortNameWithPrefix = settings.UNKNOWN_VEHICLE_NAME
     return
Ejemplo n.º 2
0
def packTankman(tankman, isCountPermanentSkills=True):
    def vehicleIcon(vDescr, subtype=""):
        return _ICONS_MASK % {"type": "vehicle", "subtype": subtype, "unicName": vDescr.name.replace(":", "-")}

    nativeVehicleData = {
        "typeCompDescr": tankman.vehicleNativeDescr.type.compactDescr,
        "userName": Vehicle.getShortUserName(tankman.vehicleNativeDescr.type),
        "icon": vehicleIcon(tankman.vehicleNativeDescr),
        "iconContour": vehicleIcon(tankman.vehicleNativeDescr, "contour/"),
    }
    currentVehicleData = None
    if tankman.isInTank:
        currentVehicleData = {
            "inventoryID": tankman.vehicleInvID,
            "typeCompDescr": tankman.vehicleDescr.type.compactDescr,
            "userName": Vehicle.getShortUserName(tankman.vehicleDescr.type),
            "icon": vehicleIcon(tankman.vehicleDescr),
            "iconContour": vehicleIcon(tankman.vehicleDescr, "contour/"),
        }
    skills = []
    tManFreeSkillsNum = tankman.descriptor.freeSkillsNumber
    startSkillNumber = 0 if isCountPermanentSkills else tManFreeSkillsNum
    tManSkills = tankman.skills
    for i in range(startSkillNumber, len(tManSkills)):
        skills.append(packTankmanSkill(tManSkills[i], isPermanent=True if i < tManFreeSkillsNum else False))

    return {
        "strCD": cPickle.dumps(tankman.strCD),
        "inventoryID": tankman.invID,
        "nationID": tankman.nationID,
        "firstUserName": tankman.firstUserName,
        "lastUserName": tankman.lastUserName,
        "roleName": tankman.descriptor.role,
        "rankUserName": tankman.rankUserName,
        "roleUserName": tankman.roleUserName,
        "skills": skills,
        "efficiencyRoleLevel": tankman.efficiencyRoleLevel,
        "realRoleLevel": tankman.realRoleLevel,
        "roleLevel": tankman.roleLevel,
        "icon": {
            "big": Tankman.getBigIconPath(tankman.nationID, tankman.descriptor.iconID),
            "small": Tankman.getSmallIconPath(tankman.nationID, tankman.descriptor.iconID),
            "barracks": Tankman.getBarracksIconPath(tankman.nationID, tankman.descriptor.iconID),
        },
        "iconRole": {
            "big": Tankman.getRoleBigIconPath(tankman.descriptor.role),
            "medium": Tankman.getRoleMediumIconPath(tankman.descriptor.role),
            "small": Tankman.getRoleSmallIconPath(tankman.descriptor.role),
        },
        "iconRank": {
            "big": Tankman.getRankBigIconPath(tankman.nationID, tankman.descriptor.rankID),
            "small": Tankman.getRankSmallIconPath(tankman.nationID, tankman.descriptor.rankID),
        },
        "isInTank": tankman.isInTank,
        "newSkillsCount": tankman.newSkillCount,
        "nativeVehicle": nativeVehicleData,
        "currentVehicle": currentVehicleData,
    }
Ejemplo n.º 3
0
 def __createSpecialRewardData(self, sourceID, congratsType, vehicle):
     return SpecialRewardData(sourceName=Vehicle.getIconResourceName(
         Vehicle.getNationLessName(vehicle.name)),
                              congratsType=congratsType,
                              congratsSourceId=sourceID,
                              vehicleName=vehicle.userName,
                              vehicleIsElite=vehicle.isElite,
                              vehicleLvl=int2roman(vehicle.level),
                              vehicleType=formatEliteVehicle(
                                  vehicle.isElite, vehicle.type),
                              backToSingleOpening=False,
                              isGuaranteedReward=self.__isGuaranteedReward)
Ejemplo n.º 4
0
    def __populateSeasonsData(self):
        seasons = []
        pqType = self.__navInfo.selectedPQType
        for seasonID, season in _getQuestsCache().getSeasons().iteritems():
            tiles = []
            for tile in sorted(season.getTiles().values(), key=operator.methodcaller('getID')):
                isCompleted, isUnlocked = tile.isAwardAchieved(), tile.isUnlocked()
                iconID = tile.getIconID()
                if isCompleted:
                    bgImgUp = event_items.getTileNormalUpIconPath(iconID)
                    bgImgOver = event_items.getTileNormalOverIconPath(iconID)
                else:
                    bgImgUp = event_items.getTileGrayUpIconPath(iconID)
                    bgImgOver = event_items.getTileGrayOverIconPath(iconID)
                vehicleBonus = tile.getVehicleBonus()
                if vehicleBonus is not None:
                    vehLevelStr = icons.makeImageTag(Vehicle.getLevelSmallIconPath(vehicleBonus.level), 16, 16, -3, 0)
                    vehTypeStr = icons.makeImageTag(Vehicle.getTypeSmallIconPath(vehicleBonus.type), 16, 16, -3, 0)
                    vehicleBonusLabel = i18n.makeString(QUESTS.PERSONAL_SEASONS_TILELABEL, type=vehTypeStr, level=vehLevelStr, name=vehicleBonus.userName)
                else:
                    vehicleBonusLabel = ''
                tokenIcon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_QUESTS_TOKEN16, 16, 16, -3, 0)
                if isUnlocked and not isCompleted and pqType == QUESTS_ALIASES.SEASON_VIEW_TAB_RANDOM:
                    gottenTokensCount, totalTokensCount = tile.getTokensCount()
                    progress = text_styles.standard(i18n.makeString(QUESTS.PERSONAL_SEASONS_TILEPROGRESS, count=text_styles.gold(str(gottenTokensCount)), total=str(totalTokensCount), icon=tokenIcon))
                else:
                    progress = ''
                if tile.isFullCompleted():
                    animation = event_items.getTileAnimationPath(iconID)
                else:
                    animation = None
                if pqType == QUESTS_ALIASES.SEASON_VIEW_TAB_RANDOM:
                    tooltipType = TOOLTIPS_CONSTANTS.PRIVATE_QUESTS_TILE
                else:
                    tooltipType = TOOLTIPS_CONSTANTS.PRIVATE_QUESTS_FALLOUT_TILE
                tiles.append({'id': tile.getID(),
                 'isNew': isUnlocked and quest_settings.isPQTileNew(tile.getID()),
                 'label': text_styles.standard(vehicleBonusLabel),
                 'progress': progress,
                 'isCompleted': isUnlocked and isCompleted,
                 'enabled': isUnlocked,
                 'image': bgImgUp,
                 'imageOver': bgImgOver,
                 'animation': animation,
                 'tooltipType': tooltipType})

            seasons.append({'id': seasonID,
             'title': quests_fmts.getFullSeasonUserName(season),
             'tiles': tiles})

        self.as_setSeasonsDataS({'seasons': seasons})
        return
Ejemplo n.º 5
0
    def __populateSeasonsData(self):
        seasons = []
        pqType = self.__navInfo.selectedPQType
        for seasonID, season in _getQuestsCache().getSeasons().iteritems():
            tiles = []
            for tile in sorted(season.getTiles().values(), key=operator.methodcaller('getID')):
                isCompleted, isUnlocked = tile.isAwardAchieved(), tile.isUnlocked()
                iconID = tile.getIconID()
                if isCompleted:
                    bgImgUp = event_items.getTileNormalUpIconPath(iconID)
                    bgImgOver = event_items.getTileNormalOverIconPath(iconID)
                else:
                    bgImgUp = event_items.getTileGrayUpIconPath(iconID)
                    bgImgOver = event_items.getTileGrayOverIconPath(iconID)
                vehicleBonus = tile.getVehicleBonus()
                if vehicleBonus is not None:
                    vehLevelStr = icons.makeImageTag(Vehicle.getLevelSmallIconPath(vehicleBonus.level), 16, 16, -3, 0)
                    vehTypeStr = icons.makeImageTag(Vehicle.getTypeSmallIconPath(vehicleBonus.type), 16, 16, -3, 0)
                    vehicleBonusLabel = i18n.makeString(QUESTS.PERSONAL_SEASONS_TILELABEL, type=vehTypeStr, level=vehLevelStr, name=vehicleBonus.userName)
                else:
                    vehicleBonusLabel = ''
                tokenIcon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_QUESTS_TOKEN16, 16, 16, -3, 0)
                if isUnlocked and not isCompleted and pqType == QUESTS_ALIASES.SEASON_VIEW_TAB_RANDOM:
                    gottenTokensCount, totalTokensCount = tile.getTokensCount()
                    progress = text_styles.standard(i18n.makeString(QUESTS.PERSONAL_SEASONS_TILEPROGRESS, count=text_styles.gold(str(gottenTokensCount)), total=str(totalTokensCount), icon=tokenIcon))
                else:
                    progress = ''
                if tile.isFullCompleted():
                    animation = event_items.getTileAnimationPath(iconID)
                else:
                    animation = None
                if pqType == QUESTS_ALIASES.SEASON_VIEW_TAB_RANDOM:
                    tooltipType = TOOLTIPS_CONSTANTS.PRIVATE_QUESTS_TILE
                else:
                    tooltipType = TOOLTIPS_CONSTANTS.PRIVATE_QUESTS_FALLOUT_TILE
                tiles.append({'id': tile.getID(),
                 'isNew': isUnlocked and quest_settings.isPQTileNew(tile.getID()),
                 'label': text_styles.standard(vehicleBonusLabel),
                 'progress': progress,
                 'isCompleted': isUnlocked and isCompleted,
                 'enabled': isUnlocked,
                 'image': bgImgUp,
                 'imageOver': bgImgOver,
                 'animation': animation,
                 'tooltipType': tooltipType})

            seasons.append({'id': seasonID,
             'title': quests_fmts.getFullSeasonUserName(season),
             'tiles': tiles})

        self.as_setSeasonsDataS({'seasons': seasons})
        return
Ejemplo n.º 6
0
def packTankman(tankman, isCountPermanentSkills = True):

    def vehicleIcon(vDescr, subtype = ''):
        return _ICONS_MASK % {'type': 'vehicle',
         'subtype': subtype,
         'unicName': vDescr.name.replace(':', '-')}

    nativeVehicleData = {'typeCompDescr': tankman.vehicleNativeDescr.type.compactDescr,
     'userName': Vehicle.getShortUserName(tankman.vehicleNativeDescr.type),
     'icon': vehicleIcon(tankman.vehicleNativeDescr),
     'iconContour': vehicleIcon(tankman.vehicleNativeDescr, 'contour/')}
    currentVehicleData = None
    if tankman.isInTank:
        currentVehicleData = {'inventoryID': tankman.vehicleInvID,
         'typeCompDescr': tankman.vehicleDescr.type.compactDescr,
         'userName': Vehicle.getShortUserName(tankman.vehicleDescr.type),
         'icon': vehicleIcon(tankman.vehicleDescr),
         'iconContour': vehicleIcon(tankman.vehicleDescr, 'contour/')}
    skills = []
    tManFreeSkillsNum = tankman.descriptor.freeSkillsNumber
    startSkillNumber = 0 if isCountPermanentSkills else tManFreeSkillsNum
    tManSkills = tankman.skills
    for i in range(startSkillNumber, len(tManSkills)):
        skills.append(packTankmanSkill(tManSkills[i], isPermanent=True if i < tManFreeSkillsNum else False))

    return {'strCD': cPickle.dumps(tankman.strCD),
     'inventoryID': tankman.invID,
     'nationID': tankman.nationID,
     'firstUserName': tankman.firstUserName,
     'lastUserName': tankman.lastUserName,
     'roleName': tankman.descriptor.role,
     'rankUserName': tankman.rankUserName,
     'roleUserName': tankman.roleUserName,
     'skills': skills,
     'efficiencyRoleLevel': tankman.efficiencyRoleLevel,
     'realRoleLevel': tankman.realRoleLevel,
     'roleLevel': tankman.roleLevel,
     'icon': {'big': Tankman.getBigIconPath(tankman.nationID, tankman.descriptor.iconID),
              'small': Tankman.getSmallIconPath(tankman.nationID, tankman.descriptor.iconID),
              'barracks': Tankman.getBarracksIconPath(tankman.nationID, tankman.descriptor.iconID)},
     'iconRole': {'big': Tankman.getRoleBigIconPath(tankman.descriptor.role),
                  'medium': Tankman.getRoleMediumIconPath(tankman.descriptor.role),
                  'small': Tankman.getRoleSmallIconPath(tankman.descriptor.role)},
     'iconRank': {'big': Tankman.getRankBigIconPath(tankman.nationID, tankman.descriptor.rankID),
                  'small': Tankman.getRankSmallIconPath(tankman.nationID, tankman.descriptor.rankID)},
     'isInTank': tankman.isInTank,
     'newSkillsCount': tankman.newSkillCount,
     'nativeVehicle': nativeVehicleData,
     'currentVehicle': currentVehicleData}
Ejemplo n.º 7
0
 def __setVehicleData(self, vehicleDescr=None, maxHealth=None):
     if vehicleDescr is not None:
         vehicleType = vehicleDescr.type
         self.compactDescr = vehicleType.compactDescr
         self.strCompactDescr = vehicleDescr.makeCompactDescr()
         tags = vehicleType.tags
         self.tags = tags
         self.classTag = Vehicle.getVehicleClassTag(tags)
         self.isObserver = isObserver(tags)
         self.isPremiumIGR = isPremiumIGR(tags)
         self.turretYawLimits = vehicle_getter.getYawLimits(vehicleDescr)
         self.isDualGunVehicle = vehicleDescr.isDualgunVehicle
         self.chassisType = vehicleDescr.chassis.chassisType
         self.shortName = vehicleType.shortUserString
         self.name = Vehicle.getUserName(vehicleType=vehicleType,
                                         textPrefix=True)
         self.shortNameWithPrefix = Vehicle.getShortUserName(
             vehicleType=vehicleType, textPrefix=True)
         self.guiName = Vehicle.getShortUserName(vehicleType)
         self.nationID = vehicleType.id[0]
         self.level = vehicleType.level
         self.maxHealth = maxHealth
         self.isOnlyForBattleRoyaleBattles = isBattleRoyaleTank(tags)
         vName = vehicleType.name
         self.iconName = settings.makeVehicleIconName(vName)
         self.iconPath = settings.makeContourIconSFPath(vName)
     else:
         vehicleName = i18n.makeString(settings.UNKNOWN_VEHICLE_NAME)
         self.tags = frozenset()
         self.compactDescr = 0
         self.strCompactDescr = ''
         self.classTag = None
         self.isObserver = False
         self.isPremiumIGR = False
         self.turretYawLimits = None
         self.shortName = vehicleName
         self.isDualGunVehicle = False
         self.chassisType = 0
         self.name = vehicleName
         self.guiName = vehicleName
         self.shortNameWithPrefix = vehicleName
         self.nationID = nations.NONE_INDEX
         self.level = settings.UNKNOWN_VEHICLE_LEVEL
         self.iconName = settings.UNKNOWN_CONTOUR_ICON_NAME
         self.iconPath = settings.UNKNOWN_CONTOUR_ICON_SF_PATH
         self.shortNameWithPrefix = vehicleName
         self.maxHealth = None
         self.isOnlyForBattleRoyaleBattles = False
     return
Ejemplo n.º 8
0
def showMarathonReward(vehicleCD, videoShownKey):
    from gui.impl.lobby.marathon.marathon_reward_view import MarathonRewardViewWindow
    uiLoader = dependency.instance(IGuiLoader)
    itemsCache = dependency.instance(IItemsCache)
    vehicle = itemsCache.items.getItemByCD(vehicleCD)
    if vehicle is not None:
        vehicleType = formatEliteVehicle(vehicle.isElite, vehicle.type)
        congratsSourceId = str(vehicle.intCD)
        sourceName = Vehicle.getIconResourceName(getVehicleStrID(vehicle.name))
        if sourceName and congratsSourceId is not None:
            specialRewardData = SpecialRewardData(
                sourceName=sourceName,
                congratsSourceId=congratsSourceId,
                vehicleName=vehicle.userName,
                vehicleIsElite=vehicle.isElite,
                vehicleLvl=int2roman(vehicle.level),
                vehicleType=vehicleType,
                goToVehicleBtn=vehicle.isInInventory,
                videoShownKey=videoShownKey)
            viewID = R.views.lobby.marathon.marathon_reward_view.MarathonRewardView(
            )
            if uiLoader.windowsManager.findViews(loadedViewPredicate(viewID)):
                return
            window = MarathonRewardViewWindow(specialRewardData)
            window.load()
    return
Ejemplo n.º 9
0
 def _initialize(self):
     super(_HangarVehicleInfoIntroView, self)._initialize()
     with self.getViewModel().transaction() as viewModel:
         viewModel.setVehicleTag(
             Vehicle.getIconResourceName(self.__vehicle.name))
         viewModel.setIsFirstView(self.__firstView)
         viewModel.onSubmitBtnClick += self.__onSubmitClicked
Ejemplo n.º 10
0
 def startBattle(self):
     if not config.data['enabled']: return
     self.player = BigWorld.player()
     del self.points[:]
     InputHandler.g_instance.onKeyDown += self.injectButton
     InputHandler.g_instance.onKeyUp += self.injectButton
     vehicle = self.player.arena.vehicles[self.player.playerVehicleID]
     if config.data['showOnlyLightTanks'] and Vehicle.getVehicleClassTag(
             self.player.getVehicleDescriptor(
             ).type.tags) != VEHICLE_CLASS_NAME.LIGHT_TANK:
         return
     self.height = float((vehicle['vehicleType'].hull.turretPositions[0] +
                          vehicle['vehicleType'].turret.gunPosition +
                          vehicle['vehicleType'].chassis.hullPosition).y)
     # 0 ctf, 1 domination, 2 assault
     # noinspection PyProtectedMember
     gameplayID = self.player.arena.arenaType._ArenaType__gameplayCfg[
         'gameplayID']
     if self.mapSelected and self.mapSelected in mapsData.data and len(
             mapsData.data[self.mapSelected]) > 2:
         teamBase = self.player.guiSessionProvider.getArenaDP(
         ).getNumberOfTeam()
         teamBase -= 1
         if gameplayID < len(mapsData.data[self.mapSelected]) and len(
                 mapsData.data[self.mapSelected][gameplayID]) > 1:
             for position in mapsData.data[
                     self.mapSelected][gameplayID][teamBase]:
                 self.points.append(self.createModel(
                     Math.Vector3(position)))
     if len(self.points):
         self.battleStarted = True
     self.status = config.data['showOnStartBattle']
     self.setVisible(self.status)
     self.checkBattleStarted()
Ejemplo n.º 11
0
 def injectButton(self, event):
     if not config.data['enabled']: return
     if inject.g_appLoader().getDefBattleApp():
         if g_gui.get_key(config.data['buttonShow']) and event.isKeyDown(
         ) and self.battleStarted:
             if config.data[
                     'showOnlyLightTanks'] and Vehicle.getVehicleClassTag(
                         self.player.getVehicleDescriptor(
                         ).type.tags) != VEHICLE_CLASS_NAME.LIGHT_TANK:
                 return
             self.status = not self.status
             message = config.i18n[
                 'UI_message_on'] if self.status else config.i18n[
                     'UI_message_off']
             color = '#84DE40' if self.status else '#FFA500'
             inject.message(message, color)
             self.setVisible(self.status)
         if g_gui.get_key(
                 config.buttons['buttonMark']) and event.isKeyDown():
             if self.player:
                 teamBase = self.player.guiSessionProvider.getArenaDP(
                 ).getNumberOfTeam()
                 teamBase -= 1
                 position = self.player.getOwnVehiclePosition()
                 message = 'map: %s, base: %s, pos: %s' % (
                     self.mapSelected, teamBase, position)
                 # noinspection PyProtectedMember
                 gameplayID = self.player.arena.arenaType._ArenaType__gameplayCfg[
                     'gameplayID']
                 print '"%s": [%s]([%s], [%s])' % (
                     self.mapSelected, gameplayID, position
                     if not teamBase else '', position if teamBase else '')
                 inject.message(message)
                 self.createModel(position)
Ejemplo n.º 12
0
    def autoUse(self, state, value):
        if not config.data['autoRepair']: return
        if self.ctrl is None:
            return
        # status = '%s' % [key for key, ids in VEHICLE_VIEW_STATE.__dict__.iteritems() if ids == state][0]
        time = random.uniform(config.data['timerMin'], config.data['timerMax'])
        if config.data['extinguishFire'] and state == VEHICLE_VIEW_STATE.FIRE:
            BigWorld.callback(time, partial(self.useItem, 'extinguisher'))
            time += 0.1

        if state == VEHICLE_VIEW_STATE.DEVICES:
            deviceName, deviceState, actualState = value
            if deviceState in DEVICE_STATE_AS_DAMAGE:
                if deviceName in COMPLEX_ITEM:
                    itemName = COMPLEX_ITEM[deviceName]
                else:
                    itemName = deviceName
                equipmentTag = 'medkit' if deviceName in TANKMEN_ROLES_ORDER_DICT['enum'] else 'repairkit'
                specific = config.data['repairPriority'][Vehicle.getVehicleClassTag(BigWorld.player().vehicleTypeDescriptor.type.tags)][equipmentTag]
                if itemName in specific:
                    if config.data['healCrew'] and equipmentTag == 'medkit':
                        BigWorld.callback(time, partial(self.useItem, 'medkit', deviceName))
                    if config.data['repairDevices'] and equipmentTag == 'repairkit':
                        BigWorld.callback(time, partial(self.useItem, 'repairkit', deviceName))
                        time += 0.1

        if config.data['removeStun'] and state == VEHICLE_VIEW_STATE.STUN:
            BigWorld.callback(time, partial(self.useItem, 'medkit'))
def _createVehicleVO(rawItem, itemsCache):
    intCD = int(rawItem.id)
    vehicle = itemsCache.items.getItemByCD(intCD)
    if vehicle is not None:
        icon = func_utils.makeFlashPath(vehicle.getShopIcon(STORE_CONSTANTS.ICON_SIZE_SMALL))
        cd = vehicle.intCD
        label = vehicle.shortUserName
        nation = vehicle.nationID
        level = RES_ICONS.getLevelIcon(vehicle.level)
        tankType = Vehicle.getTypeSmallIconPath(vehicle.type, vehicle.isElite)
    else:
        icon = rawItem.iconSource
        cd = 0
        label = ''
        nation = nations.NONE_INDEX
        level = ''
        tankType = ''
    return {'icon': icon,
     'iconAlt': RES_ICONS.MAPS_ICONS_LIBRARY_VEHICLE_DEFAULT,
     'intCD': cd,
     'label': label,
     'nation': nation,
     'hasCompensation': getCompensateItemsCount(rawItem, itemsCache) > 0,
     'level': level,
     'tankType': tankType}
Ejemplo n.º 14
0
def formatVehicleNameWithTypeIcon(vehicle, path):
    icon = icons.makeImageTag(
        Vehicle.getTypeSmallIconPath(vehicle.type, vehicle.isPremium))
    level = int2roman(vehicle.level)
    key = 'vehicle_prem' if vehicle.isPremium else 'vehicle'
    return makeHtmlString(
        path, key, {'msg': '{} {}{}'.format(level, icon, vehicle.userName)})
 def getSmallChainIcon(self, chainID):
     classifier = self.getChainClassifier(chainID).classificationAttr
     if self.__branch == PM_BRANCH.REGULAR:
         return Vehicle.getTypeSmallIconPath(classifier, False)
     return RES_ICONS.getAlliance17x19Icon(
         classifier
     ) if self.__branch == PM_BRANCH.PERSONAL_MISSION_2 else ''
 def getChainIcon(self, chainID):
     classifier = self.getChainClassifier(chainID).classificationAttr
     if self.__branch == PM_BRANCH.REGULAR:
         return Vehicle.getTypeBigIconPath(classifier)
     if self.__branch == PM_BRANCH.PERSONAL_MISSION_2:
         allianceId = nations.ALLIANCE_IDS[classifier]
         return RES_ICONS.getAllianceIcon(allianceId)
Ejemplo n.º 17
0
    def __getSlotsData(self, vehsList):
        result = []
        for v in vehsList:
            nationID, _ = v.type.id
            result.append({
                'vehicleID':
                v.intCD,
                'vehicleName':
                self.__getVehicleName(v),
                'flagIcon':
                _FLAG_ICON_TEMPLATE % nations.NAMES[nationID],
                'vehicleIcon':
                getIconPath(v.type.name),
                'vehicleType':
                _VEHICLE_TYPE_TEMPLATE %
                Vehicle.getVehicleClassTag(v.type.tags),
                'isElite':
                False,
                'isPremium':
                isPremium(v.type.tags),
                'vehicleLevel':
                _VEHICLE_LEVEL_TEMPLATE % v.type.level
            })

        return result
Ejemplo n.º 18
0
 def startBattle(self):
     InputHandler.g_instance.onKeyDown += self.injectButton
     # InputHandler.g_instance.onKeyUp += self.injectButton
     if config.data['enabled']:
         self.player = BigWorld.player()
         self.modelSplashVisible = config.data['showSplashOnDefault']
         self.modelDotVisible = config.data['showDotOnDefault']
         self.scaleSplash = None
         self.modelSplash = StaticObjectMarker3D(
             {'path': config.data['modelPathSplash']}, (0, 0, 0))
         self.modelDot = StaticObjectMarker3D(
             {'path': config.data['modelPathDot']}, (0, 0, 0))
         self.modelDot._StaticObjectMarker3D__model.scale = (0.1, 0.1, 0.1)
         if Vehicle.getVehicleClassTag(self.player.vehicleTypeDescriptor.
                                       type.tags) == VEHICLE_CLASS_NAME.SPG:
             self.modelDot._StaticObjectMarker3D__model.scale = (0.5, 0.5,
                                                                 0.5)
         self.modelSplash._StaticObjectMarker3D__model.visible = False
         self.modelDot._StaticObjectMarker3D__model.visible = False
         self.modelSplashCircle = BigWorld.PyTerrainSelectedArea()
         self.modelSplashCircle.setup(
             'content/Interface/CheckPoint/CheckPoint_yellow_black.model',
             Math.Vector2(2.0, 2.0), 0.5, 4294967295L)
         self.modelSplash._StaticObjectMarker3D__model.root.attach(
             self.modelSplashCircle)
         self.modelSplashCircle.enableAccurateCollision(False)
Ejemplo n.º 19
0
 def _showOwnDeathInfo(self):
     if self._deathAlreadySet:
         self.as_showDeadReasonS()
     else:
         deathInfo = self.getDeathInfo()
         if deathInfo:
             killerVehID = deathInfo['killerVehicle']
             battleCtx = self.sessionProvider.getCtx()
             if killerVehID and not battleCtx.isCurrentPlayer(killerVehID) and battleCtx.getArenaDP().getVehicleInfo(killerVehID).vehicleType.compactDescr:
                 showVehicle = True
                 vInfoVO = battleCtx.getArenaDP().getVehicleInfo(killerVehID)
                 vTypeInfoVO = vInfoVO.vehicleType
                 vehLvl = int2roman(vTypeInfoVO.level)
                 vehImg = _VEHICLE_SMALL_ICON_RES_PATH.format(vTypeInfoVO.iconName)
                 vehClass = Vehicle.getTypeBigIconPath(vTypeInfoVO.classTag, False)
                 vehName = vTypeInfoVO.shortNameWithPrefix
             else:
                 showVehicle = False
                 vehLvl = vehImg = vehClass = vehName = None
             reason = self.__makeReasonInfo(deathInfo)
             self.as_setDeadReasonInfoS(reason, showVehicle, vehLvl, vehImg, vehClass, vehName)
             self._deathAlreadySet = True
         else:
             self.as_setDeadReasonInfoS('', False, None, None, None, None)
     return
Ejemplo n.º 20
0
 def _update(self):
     if self.__vID is not None:
         vehicle = BigWorld.entity(self.__vID)
         if vehicle is not None:
             playerName = g_sessionProvider.getCtx().getFullPlayerName(vID=self.__vID, showVehShortName=False)
             type = Vehicle.getUserName(vehicleType=vehicle.typeDescriptor.type, textPrefix=True)
             healthPercent = math.ceil(100.0 * max(0, vehicle.health) / vehicle.typeDescriptor.maxHealth)
             self.__setText(playerName, type, healthPercent)
Ejemplo n.º 21
0
def _getVehicleWeakZonesImage(vehicle):
    vehicleName = Vehicle.getIconResourceName(vehicle.name)
    dynResource = R.images.gui.maps.icons.battleRoyale.weakZones.dyn(
        vehicleName)
    if not dynResource.exists():
        _logger.error("Couldn't find weak zones image source for vehicle: %s",
                      vehicleName)
        return ''
    return backport.image(dynResource())
Ejemplo n.º 22
0
 def __packVehicleAward(self, vehicle):
     return {'type': QUESTS_SEASON_AWARDS_TYPES.VEHICLE,
      'iconPath': vehicle.iconUnique,
      'levelIconPath': Vehicle.getLevelBigIconPath(vehicle.level),
      'vehicleType': vehicle.type,
      'name': self.app.utilsManager.textManager.getText(TextType.MIDDLE_TITLE, vehicle.shortUserName),
      'buttonText': _ms(QUESTS.SEASONAWARDSWINDOW_VEHICLEAWARD_BUTTONABOUT_TEXT),
      'buttonTooltipId': TOOLTIPS.TOOLTIPS.QUESTS_VEHICLESEASONAWARD_ABOUTBTN,
      'vehicleId': vehicle.intCD,
      'nation': vehicle.nationName}
Ejemplo n.º 23
0
def formatVehicleNationAndTypeIcon(vehicle, path):
    iconType = icons.makeImageTag(
        Vehicle.getTypeSmallIconPath(vehicle.type, vehicle.isPremium))
    iconNation = icons.makeImageTag(RES_ICONS.getFilterNation(
        vehicle.nationName),
                                    width=26,
                                    height=16)
    level = int2roman(vehicle.level)
    return makeHtmlString(
        path, 'vehicle', {'msg': '{}{}{}'.format(iconNation, iconType, level)})
Ejemplo n.º 24
0
 def __packVehicleAward(self, vehicle):
     return {'type': QUESTS_SEASON_AWARDS_TYPES.VEHICLE,
      'iconPath': vehicle.iconUnique,
      'levelIconPath': Vehicle.getLevelBigIconPath(vehicle.level),
      'vehicleType': vehicle.type,
      'name': text_styles.middleTitle(vehicle.shortUserName),
      'buttonText': _ms(QUESTS.SEASONAWARDSWINDOW_VEHICLEAWARD_BUTTONABOUT_TEXT),
      'buttonTooltipId': TOOLTIPS.TOOLTIPS.QUESTS_VEHICLESEASONAWARD_ABOUTBTN,
      'vehicleId': vehicle.intCD,
      'nation': vehicle.nationName}
Ejemplo n.º 25
0
 def _update(self):
     if self.__vID is not None:
         vehicle = BigWorld.entity(self.__vID)
         if vehicle is not None:
             playerName = g_sessionProvider.getCtx().getFullPlayerName(
                 vID=self.__vID, showVehShortName=False)
             type = Vehicle.getUserName(
                 vehicleType=vehicle.typeDescriptor.type, textPrefix=True)
             healthPercent = math.ceil(100.0 * max(0, vehicle.health) /
                                       vehicle.typeDescriptor.maxHealth)
             self.__setText(playerName, type, healthPercent)
Ejemplo n.º 26
0
 def __createVO(self, vehicle=None):
     vehiclesAvailable = bool(self.__tradeIn.getTradeOffVehicles())
     vo = {'showTradeOff': vehicle is None,
      'available': vehiclesAvailable}
     if vehicle is not None:
         vo.update({'vehicleNationFlag': RES_ICONS.getTradeInNationFlag(vehicle.nationName),
          'vehicleType': Vehicle.getTypeSmallIconPath(vehicle.type, vehicle.isElite),
          'vehicleLevel': RES_ICONS.getLevelIcon(vehicle.level),
          'vehicleIcon': getSmallIconPath(vehicle.name),
          'vehicleTitle': vehicle.shortUserName})
     return vo
Ejemplo n.º 27
0
 def __setVehicleData(self, vehicleDescr=None):
     if vehicleDescr is not None:
         vehicleType = vehicleDescr.type
         self.compactDescr = vehicleType.compactDescr
         tags = vehicleType.tags
         self.classTag = getClassTag(tags)
         self.isObserver = isObserver(tags)
         self.isPremiumIGR = isPremiumIGR(tags)
         self.turretYawLimits = vehicle_getter.getYawLimits(vehicleDescr)
         self.shortName = vehicleType.shortUserString
         self.name = Vehicle.getUserName(vehicleType=vehicleType,
                                         textPrefix=True)
         self.shortNameWithPrefix = Vehicle.getShortUserName(
             vehicleType=vehicleType, textPrefix=True)
         self.guiName = getShortUserName(vehicleType)
         self.nationID = vehicleType.id[0]
         self.level = vehicleType.level
         self.maxHealth = vehicleDescr.maxHealth
         vName = vehicleType.name
         self.iconName = settings.makeVehicleIconName(vName)
         self.iconPath = settings.makeContourIconSFPath(vName)
         if not settings.addContourIconToCache(vName):
             self.iconName = settings.UNKNOWN_CONTOUR_ICON_NAME
             self.iconPath = settings.UNKNOWN_CONTOUR_ICON_SF_PATH
     else:
         self.compactDescr = 0
         self.classTag = None
         self.isObserver = False
         self.isPremiumIGR = False
         self.turretYawLimits = None
         self.shortName = settings.UNKNOWN_VEHICLE_NAME
         self.name = settings.UNKNOWN_VEHICLE_NAME
         self.guiName = settings.UNKNOWN_VEHICLE_NAME
         self.shortNameWithPrefix = settings.UNKNOWN_VEHICLE_NAME
         self.nationID = nations.NONE_INDEX
         self.level = settings.UNKNOWN_VEHICLE_LEVEL
         self.iconName = settings.UNKNOWN_CONTOUR_ICON_NAME
         self.iconPath = settings.UNKNOWN_CONTOUR_ICON_SF_PATH
         self.shortNameWithPrefix = settings.UNKNOWN_VEHICLE_NAME
         self.maxHealth = None
     return
Ejemplo n.º 28
0
 def __setVehicleData(self, vehicleDescr = None):
     if vehicleDescr is not None:
         vehicleType = vehicleDescr.type
         self.compactDescr = vehicleType.compactDescr
         tags = vehicleType.tags
         self.classTag = getClassTag(tags)
         self.isObserver = isObserver(tags)
         self.isPremiumIGR = isPremiumIGR(tags)
         self.turretYawLimits = vehicle_getter.getYawLimits(vehicleDescr)
         self.shortName = vehicleType.shortUserString
         self.name = Vehicle.getUserName(vehicleType=vehicleType, textPrefix=True)
         self.shortNameWithPrefix = Vehicle.getShortUserName(vehicleType=vehicleType, textPrefix=True)
         self.guiName = getShortUserName(vehicleType)
         self.nationID = vehicleType.id[0]
         self.level = vehicleType.level
         self.maxHealth = vehicleDescr.maxHealth
         vName = vehicleType.name
         self.iconName = settings.makeVehicleIconName(vName)
         self.iconPath = settings.makeContourIconSFPath(vName)
         if not settings.addContourIconToCache(vName):
             self.iconName = settings.UNKNOWN_CONTOUR_ICON_NAME
             self.iconPath = settings.UNKNOWN_CONTOUR_ICON_SF_PATH
     else:
         self.compactDescr = 0
         self.classTag = None
         self.isObserver = False
         self.isPremiumIGR = False
         self.turretYawLimits = None
         self.shortName = settings.UNKNOWN_VEHICLE_NAME
         self.name = settings.UNKNOWN_VEHICLE_NAME
         self.guiName = settings.UNKNOWN_VEHICLE_NAME
         self.shortNameWithPrefix = settings.UNKNOWN_VEHICLE_NAME
         self.nationID = nations.NONE_INDEX
         self.level = settings.UNKNOWN_VEHICLE_LEVEL
         self.iconName = settings.UNKNOWN_CONTOUR_ICON_NAME
         self.iconPath = settings.UNKNOWN_CONTOUR_ICON_SF_PATH
         self.shortNameWithPrefix = settings.UNKNOWN_VEHICLE_NAME
         self.maxHealth = None
     return
Ejemplo n.º 29
0
    def __updateSideBar(self):
        chains = []
        currChainID = self.getChainID()
        currentOperation = self.getOperation()
        currentVehicleType = currentOperation.getChainVehicleClass(currChainID)
        for vehicleType in VEHICLE_TYPES_ORDER:
            chainID, quests = currentOperation.getChainByVehicleType(
                vehicleType)
            chainState = self.__getChainState(quests)
            progress = self.__getProgress(quests)
            if chainState.isCompleted:
                currentProgress = text_styles.bonusAppliedText(
                    progress['value'])
            else:
                currentProgress = text_styles.stats(progress['value'])
            if currentVehicleType == vehicleType:
                label = text_styles.tutorial(
                    PERSONAL_MISSIONS.chainNameByVehicleType(
                        currentVehicleType))
            elif chainState.questInProgress is not None:
                label = text_styles.main(
                    chainState.questInProgress.getShortUserName())
            elif chainState.isFullCompleted:
                label = text_styles.bonusAppliedText(
                    PERSONAL_MISSIONS.SIDEBAR_FULLCOMPLETED)
            elif chainState.isCompleted:
                label = text_styles.bonusAppliedText(
                    PERSONAL_MISSIONS.SIDEBAR_COMPLETED)
            else:
                label = text_styles.main(PERSONAL_MISSIONS.SIDEBAR_NOTSELECTED)
            progressText = text_styles.main(' / ').join(
                (currentProgress, text_styles.main(progress['maxValue'])))
            chains.append({
                'chainID':
                chainID,
                'progressText':
                progressText,
                'label':
                label,
                'tankIcon':
                Vehicle.getTypeBigIconPath(vehicleType, False),
                'progress':
                progress
            })

        self.as_updateBranchesDataS({'chains': chains})
        self.as_setSelectedBranchIndexS(currChainID)
        return
 def repair(self, equipmentTag):
     specific = config.data['repairPriority'][Vehicle.getVehicleClassTag(
         BigWorld.player().vehicleTypeDescriptor.type.tags)][equipmentTag]
     if config.data['useGoldKits'] and self.items[equipmentTag][3]:
         equipment = self.items[equipmentTag][3]
         if equipment is not None:
             # noinspection PyUnresolvedReferences
             devices = [
                 name for name, state in equipment.getEntitiesIterator()
                 if state and state != DEVICE_STATE_NORMAL
             ]
             result = []
             for device in specific:
                 if device in COMPLEX_ITEM:
                     itemName = COMPLEX_ITEM[device]
                 else:
                     itemName = device
                 if itemName in devices:
                     result.append(device)
             if len(result) > 1:
                 self.useItemGold(equipmentTag)
             elif result:
                 self.useItem(equipmentTag, result[0])
     elif self.items[equipmentTag][2]:
         equipment = self.items[equipmentTag][2]
         if equipment is not None:
             # noinspection PyUnresolvedReferences
             devices = [
                 name for name, state in equipment.getEntitiesIterator()
                 if state and state != DEVICE_STATE_NORMAL
             ]
             result = []
             for device in specific:
                 if device in COMPLEX_ITEM:
                     itemName = COMPLEX_ITEM[device]
                 else:
                     itemName = device
                 if itemName in devices:
                     result.append(device)
             if len(result) > 1:
                 self.useItemGold(equipmentTag)
             elif result:
                 self.useItem(equipmentTag, result[0])
Ejemplo n.º 31
0
 def startBattle(self):
     InputHandler.g_instance.onKeyDown += self.injectButton
     # InputHandler.g_instance.onKeyUp += self.injectButton
     if config.data['enabled']:
         self.player = BigWorld.player()
         self.modelSplashVisible = config.data['showSplashOnDefault']
         self.modelDotVisible = config.data['showDotOnDefault']
         self.scaleSplash = None
         self.modelSplash = StaticObjectMarker3D(
             {'path': config.data['modelPathSplash']}, (0, 0, 0))
         self.modelDot = StaticObjectMarker3D(
             {'path': config.data['modelPathDot']}, (0, 0, 0))
         self.modelDot._StaticObjectMarker3D__model.scale = (0.1, 0.1, 0.1)
         if Vehicle.getVehicleClassTag(self.player.vehicleTypeDescriptor.
                                       type.tags) == VEHICLE_CLASS_NAME.SPG:
             self.modelDot._StaticObjectMarker3D__model.scale = (0.5, 0.5,
                                                                 0.5)
         self.modelSplash._StaticObjectMarker3D__model.visible = False
         self.modelDot._StaticObjectMarker3D__model.visible = False
Ejemplo n.º 32
0
 def __packVehicleAward(self, vehicle):
     return {
         'type':
         QUESTS_SEASON_AWARDS_TYPES.VEHICLE,
         'iconPath':
         vehicle.iconUnique,
         'levelIconPath':
         Vehicle.getLevelBigIconPath(vehicle.level),
         'vehicleType':
         vehicle.type,
         'name':
         text_styles.middleTitle(vehicle.shortUserName),
         'buttonText':
         _ms(QUESTS.SEASONAWARDSWINDOW_VEHICLEAWARD_BUTTONABOUT_TEXT),
         'buttonTooltipId':
         TOOLTIPS.TOOLTIPS.QUESTS_VEHICLESEASONAWARD_ABOUTBTN,
         'vehicleId':
         vehicle.intCD,
         'nation':
         vehicle.nationName
     }
def _createVehicleVO(rawItem, itemsCache):
    vehicle = itemsCache.items.getStockVehicle(rawItem.id, useInventory=True)
    if vehicle is not None:
        icon = vehicle.getShopIcon(STORE_CONSTANTS.ICON_SIZE_SMALL)
        cd = vehicle.intCD
        label = vehicle.shortUserName
        nation = vehicle.nationID
    else:
        icon = rawItem.iconSource
        cd = 0
        label = ''
        nation = nations.NONE_INDEX
    return {
        'icon': icon,
        'iconAlt': RES_ICONS.MAPS_ICONS_LIBRARY_VEHICLE_DEFAULT,
        'intCD': cd,
        'label': label,
        'nation': nation,
        'hasCompensation': getCompensateItemsCount(rawItem, itemsCache) > 0,
        'level': RES_ICONS.getLevelIcon(vehicle.level),
        'tankType': Vehicle.getTypeSmallIconPath(vehicle.type, vehicle.isElite)
    }
Ejemplo n.º 34
0
 def __showOwnDeathInfo(self):
     if self.__deathAlreadySet:
         self.as_showDeadReasonS()
     else:
         deathInfo = self.getDeathInfo()
         if deathInfo:
             reason = self.__makeReasonInfo(deathInfo)
             killerVehID = deathInfo['killerVehicle']
             battleCtx = g_sessionProvider.getCtx()
             if killerVehID and not battleCtx.isCurrentPlayer(killerVehID) and battleCtx.getArenaDP().getVehicleInfo(killerVehID).vehicleType.compactDescr:
                 showVehicle = True
                 vTypeInfoVO = battleCtx.getArenaDP().getVehicleInfo(killerVehID).vehicleType
                 vehLvl = int2roman(vTypeInfoVO.level)
                 vehImg = _VEHICLE_SMALL_ICON_RES_PATH.format(vTypeInfoVO.iconName)
                 vehClass = Vehicle.getTypeBigIconPath(vTypeInfoVO.classTag, False)
                 vehName = vTypeInfoVO.shortNameWithPrefix
             else:
                 showVehicle = False
                 vehLvl = vehImg = vehClass = vehName = None
             self.as_setDeadReasonInfoS(reason, showVehicle, vehLvl, vehImg, vehClass, vehName)
             self.__deathAlreadySet = True
         else:
             self.as_setDeadReasonInfoS('', False, None, None, None, None)
     return
Ejemplo n.º 35
0
 def __makeQuestDetailsInfo(self, questID):
     quest = events_helpers.getPotapovQuestsCache().getQuests()[questID]
     questInfoData = events_helpers.getEventInfoData(quest)
     self._navInfo.selectPotapovQuest(self.__tile.getID(), questID)
     vehMinLevel, vehClasses = quest.getVehMinLevel(
     ), quest.getVehicleClasses()
     if vehMinLevel > 1:
         reqsHeader = text_styles.middleTitle(
             _ms(QUESTS.QUESTTASKDETAILSVIEW_REQUIREMENTS))
         if quest.getQuestBranch() == PQ_BRANCH.REGULAR:
             reqs = _ms(QUESTS.QUESTTASKDETAILSVIEW_REQUIREMENTS_TEXT,
                        level=int2roman(vehMinLevel),
                        vehType=', '.join([
                            Vehicle.getTypeShortUserName(vc)
                            for vc in vehClasses
                        ]))
         elif vehMinLevel < 10:
             reqs = _ms(QUESTS.QUESTTASKDETAILSVIEW_REQUIREMENTS_MORE8LVL)
         else:
             reqs = _ms(QUESTS.QUESTTASKDETAILSVIEW_REQUIREMENTS_ONLY10LVL)
     else:
         reqsHeader = reqs = ''
     condition = makeHtmlString(
         'html_templates:lobby/quests/potapov',
         'questDetails',
         ctx={
             'mainCondHeader':
             text_styles.middleTitle(
                 _ms(QUESTS.QUESTTASKDETAILSVIEW_MAINCONDITIONS)),
             'mainCond':
             quest.getUserMainCondition(),
             'addCondHeader':
             text_styles.middleTitle(
                 _ms(QUESTS.QUESTTASKDETAILSVIEW_ADDITIONALCONDITIONS)),
             'addCond':
             quest.getUserAddCondition(),
             'requirementsHeader':
             reqsHeader,
             'requirements':
             reqs,
             'adviseHeader':
             text_styles.middleTitle(
                 _ms(QUESTS.QUESTTASKDETAILSVIEW_DESCRIPTION)),
             'advise':
             quest.getUserAdvice(),
             'descr':
             quest.getUserDescription()
         })
     if not quest.isUnlocked():
         btnInfo = _makeSelectBtn(
             QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_BEGIN,
             enabled=False,
             descr=text_styles.error(icons.notAvailableRed() + ' ' +
                                     _ms(self._lockedMessageStrKey)))
     elif quest.needToGetReward():
         btnInfo = _makeSelectBtn(
             QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_TAKEAWARD,
             TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_RECEIVETHEAWARD,
             _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_TAKEAWARD))
     elif quest.isInProgress():
         btnInfo = _makeRefuseBtn(
             QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_CANCEL,
             TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_ABORT,
             _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_INPROGRESS))
     elif quest.isFullCompleted():
         btnInfo = _makeNoBtn(
             text_styles.success(icons.checkmark() + _ms(
                 QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_EXCELLENTDONE))
         )
     elif quest.isMainCompleted():
         btnInfo = _makeSelectBtn(
             QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_REPEAT,
             TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_REPEAT,
             text_styles.success(
                 icons.checkmark() +
                 _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_DONE)))
     else:
         btnInfo = _makeSelectBtn(
             QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_BEGIN,
             TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_PERFORM,
             _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_AVAILABLE))
     mainAwards, addAwards = questInfoData._getBonuses(
         events_helpers.getPotapovQuestsCache().getQuests().values())
     result = {
         'taskID': questID,
         'headerText': text_styles.highTitle(quest.getUserName()),
         'conditionsText': condition,
         'mainAwards': mainAwards,
         'addAwards': addAwards
     }
     result.update(btnInfo._asdict())
     return result
Ejemplo n.º 36
0
 def getOrderByClass(self):
     return Vehicle.getOrderByVehicleClass(Vehicle.getVehicleClassTag(self.vehicle.descriptor.type.tags))
Ejemplo n.º 37
0
    def __populateSeasonsData(self):
        _getText = self.app.utilsManager.textManager.getText
        pqSettings = quest_settings.get()
        seasons = []
        for seasonID, season in g_eventsCache.potapov.getSeasons().iteritems():
            tiles = []
            for tile in sorted(season.getTiles().values(), key=operator.methodcaller('getID')):
                isCompleted, isUnlocked = tile.isAwardAchieved(), tile.isUnlocked()
                iconID = tile.getIconID()
                if isCompleted:
                    bgImgUp, bgImgOver = event_items.getTileNormalUpIconPath(iconID), event_items.getTileNormalOverIconPath(iconID)
                else:
                    bgImgUp, bgImgOver = event_items.getTileGrayUpIconPath(iconID), event_items.getTileGrayOverIconPath(iconID)
                vehicleBonus = tile.getVehicleBonus()
                if vehicleBonus is not None:
                    vehLevelStr = self.app.utilsManager.getHtmlIconText(ImageUrlProperties(Vehicle.getLevelSmallIconPath(vehicleBonus.level), 16, 16, -3, 0))
                    vehTypeStr = self.app.utilsManager.getHtmlIconText(ImageUrlProperties(Vehicle.getTypeSmallIconPath(vehicleBonus.type), 16, 16, -3, 0))
                    vehicleBonusLabel = i18n.makeString(QUESTS.PERSONAL_SEASONS_TILELABEL, type=vehTypeStr, level=vehLevelStr, name=vehicleBonus.userName)
                else:
                    vehicleBonusLabel = ''
                tokenIcon = self.app.utilsManager.getHtmlIconText(ImageUrlProperties(RES_ICONS.MAPS_ICONS_QUESTS_TOKEN16, 16, 16, -3, 0))
                if isUnlocked and not isCompleted:
                    gottenTokensCount, totalTokensCount = tile.getTokensCount()
                    progress = _getText(TextType.STANDARD_TEXT, i18n.makeString(QUESTS.PERSONAL_SEASONS_TILEPROGRESS, count=_getText(TextType.GOLD_TEXT, str(gottenTokensCount)), total=str(totalTokensCount), icon=tokenIcon))
                else:
                    progress = ''
                if tile.isFullCompleted():
                    animation = event_items.getTileAnimationPath(iconID)
                else:
                    animation = None
                tiles.append({'id': tile.getID(),
                 'isNew': isUnlocked and quest_settings.isPQTileNew(tile.getID(), pqSettings),
                 'label': _getText(TextType.STANDARD_TEXT, vehicleBonusLabel),
                 'progress': progress,
                 'isCompleted': isUnlocked and isCompleted,
                 'enabled': isUnlocked,
                 'image': bgImgUp,
                 'imageOver': bgImgOver,
                 'animation': animation})

            seasons.append({'id': seasonID,
             'title': quests_fmts.getFullSeasonUserName(season),
             'tiles': tiles})

        self.as_setSeasonsDataS(seasons)
        return
Ejemplo n.º 38
0
def _formatVehicleNameWithTypeIcon(vehicle):
    icon = icons.makeImageTag(
        Vehicle.getTypeSmallIconPath(vehicle.type, vehicle.isElite))
    level = int2roman(vehicle.level)
    return text_styles.statInfo('{} {}{}'.format(level, icon,
                                                 vehicle.userName))
Ejemplo n.º 39
0
 def __makeQuestDetailsInfo(self, questID):
     _getText = self.app.utilsManager.textManager.getText
     quest = g_eventsCache.potapov.getQuests()[questID]
     questInfoData = events_helpers.getEventInfoData(quest)
     self._navInfo.selectPotapovQuest(self.__tile.getID(), questID)
     vehMinLevel, vehClasses = quest.getVehMinLevel(), quest.getVehicleClasses()
     if vehMinLevel > 1:
         reqsHeader = _getText(TEXT_MANAGER_STYLES.MIDDLE_TITLE, _ms(QUESTS.QUESTTASKDETAILSVIEW_REQUIREMENTS))
         reqs = _ms('#quests:QuestTaskDetailsView/requirements/text', level=int2roman(vehMinLevel), vehType=', '.join([ Vehicle.getTypeShortUserName(vc) for vc in vehClasses ]))
     else:
         reqsHeader = reqs = ''
     condition = makeHtmlString('html_templates:lobby/quests/potapov', 'questDetails', ctx={'mainCondHeader': _getText(TEXT_MANAGER_STYLES.MIDDLE_TITLE, _ms(QUESTS.QUESTTASKDETAILSVIEW_MAINCONDITIONS)),
      'mainCond': quest.getUserMainCondition(),
      'addCondHeader': _getText(TEXT_MANAGER_STYLES.MIDDLE_TITLE, _ms(QUESTS.QUESTTASKDETAILSVIEW_ADDITIONALCONDITIONS)),
      'addCond': quest.getUserAddCondition(),
      'requirementsHeader': reqsHeader,
      'requirements': reqs,
      'adviseHeader': _getText(TEXT_MANAGER_STYLES.MIDDLE_TITLE, _ms(QUESTS.QUESTTASKDETAILSVIEW_DESCRIPTION)),
      'advise': quest.getUserAdvice(),
      'descr': quest.getUserDescription()})
     if not quest.isUnlocked():
         btnInfo = _makeSelectBtn(QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_BEGIN, enabled=False, descr=text_styles.error(icons.notAvailableRed() + ' ' + _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_DOPREVTASKS)))
     elif quest.needToGetReward():
         btnInfo = _makeSelectBtn(QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_TAKEAWARD, TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_RECEIVETHEAWARD, _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_TAKEAWARD))
     elif quest.isInProgress():
         btnInfo = _makeRefuseBtn(QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_CANCEL, TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_ABORT, _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_INPROGRESS))
     elif quest.isFullCompleted():
         btnInfo = _makeNoBtn(text_styles.success(icons.checkmark() + _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_EXCELLENTDONE)))
     elif quest.isMainCompleted():
         btnInfo = _makeSelectBtn(QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_REPEAT, TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_REPEAT, text_styles.success(icons.checkmark() + _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_DONE)))
     else:
         btnInfo = _makeSelectBtn(QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_BEGIN, TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_PERFORM, _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_AVAILABLE))
     mainAwards, addAwards = questInfoData._getBonuses(g_eventsCache.potapov.getQuests().values())
     result = {'taskID': questID,
      'headerText': _getText(TEXT_MANAGER_STYLES.HIGH_TITLE, quest.getUserName()),
      'conditionsText': condition,
      'mainAwards': mainAwards,
      'addAwards': addAwards}
     result.update(btnInfo._asdict())
     return result
Ejemplo n.º 40
0
def packTankman(tankman, isCountPermanentSkills=True):
    def vehicleIcon(vDescr, subtype=''):
        return _ICONS_MASK % {
            'type': 'vehicle',
            'subtype': subtype,
            'unicName': vDescr.name.replace(':', '-')
        }

    nativeVehicleData = {
        'typeCompDescr': tankman.vehicleNativeDescr.type.compactDescr,
        'userName': Vehicle.getShortUserName(tankman.vehicleNativeDescr.type),
        'icon': vehicleIcon(tankman.vehicleNativeDescr),
        'iconContour': vehicleIcon(tankman.vehicleNativeDescr, 'contour/')
    }
    currentVehicleData = None
    if tankman.isInTank:
        currentVehicleData = {
            'inventoryID': tankman.vehicleInvID,
            'typeCompDescr': tankman.vehicleDescr.type.compactDescr,
            'userName': Vehicle.getShortUserName(tankman.vehicleDescr.type),
            'icon': vehicleIcon(tankman.vehicleDescr),
            'iconContour': vehicleIcon(tankman.vehicleDescr, 'contour/')
        }
    skills = []
    tManFreeSkillsNum = tankman.descriptor.freeSkillsNumber
    startSkillNumber = 0 if isCountPermanentSkills else tManFreeSkillsNum
    tManSkills = tankman.skills
    for i in range(startSkillNumber, len(tManSkills)):
        skills.append(
            packTankmanSkill(
                tManSkills[i],
                isPermanent=True if i < tManFreeSkillsNum else False))

    return {
        'strCD': cPickle.dumps(tankman.strCD),
        'inventoryID': tankman.invID,
        'nationID': tankman.nationID,
        'firstUserName': tankman.firstUserName,
        'lastUserName': tankman.lastUserName,
        'roleName': tankman.descriptor.role,
        'rankUserName': tankman.rankUserName,
        'roleUserName': tankman.roleUserName,
        'skills': skills,
        'efficiencyRoleLevel': tankman.efficiencyRoleLevel,
        'realRoleLevel': tankman.realRoleLevel,
        'roleLevel': tankman.roleLevel,
        'icon': {
            'big':
            Tankman.getBigIconPath(tankman.nationID,
                                   tankman.descriptor.iconID),
            'small':
            Tankman.getSmallIconPath(tankman.nationID,
                                     tankman.descriptor.iconID),
            'barracks':
            Tankman.getBarracksIconPath(tankman.nationID,
                                        tankman.descriptor.iconID)
        },
        'iconRole': {
            'big': Tankman.getRoleBigIconPath(tankman.descriptor.role),
            'medium': Tankman.getRoleMediumIconPath(tankman.descriptor.role),
            'small': Tankman.getRoleSmallIconPath(tankman.descriptor.role)
        },
        'iconRank': {
            'big':
            Tankman.getRankBigIconPath(tankman.nationID,
                                       tankman.descriptor.rankID),
            'small':
            Tankman.getRankSmallIconPath(tankman.nationID,
                                         tankman.descriptor.rankID)
        },
        'isInTank': tankman.isInTank,
        'newSkillsCount': tankman.newSkillCount,
        'nativeVehicle': nativeVehicleData,
        'currentVehicle': currentVehicleData
    }
Ejemplo n.º 41
0
def formatEliteVehicle(isElite, typeName):
    ubFormattedTypeName = Vehicle.getIconResourceName(typeName)
    return '{}_elite'.format(
        ubFormattedTypeName) if isElite else ubFormattedTypeName