def _addMapsTrainingBattleType(items): items.append( _MapsTrainingItem(backport.text(_R_BATTLE_TYPES.mapsTraining()), PREBATTLE_ACTION_NAME.MAPS_TRAINING, 8, SELECTOR_BATTLE_TYPES.MAPS_TRAINING))
def _successHandler(self, code, ctx=None): return makeI18nSuccess(sysMsgKey=backport.text( R.strings.system_messages.nation_change.success()), veh_name=self._cvh.userName)
def buildTitle(ctx): title = backport.text(R.strings.ingame_help.detailsHelp.default.title()) vehName = ctx.get('vehName') if vehName is not None: title = vehName return title
def _updateBattleRoyaleSlotInfo(player, vehicle): return _updateSpecialBattleSlotInfo( player, vehicle, backport.text(R.strings.messenger.dialogs.simpleSquad.battleRoyale. VehicleRestriction()))
def updateTankmen(self, diff=None): Waiting.show('updateTankmen') if g_currentVehicle.isPresent(): vehicle = g_currentVehicle.item allTankmen = self.itemsCache.items.getTankmen() commander_bonus = vehicle.bonuses['commander'] roles = [] lessMastered = 0 tankmenDescrs = dict(vehicle.crew) skillsConfig = getSkillsConfig() for slotIdx, tman in vehicle.crew: if slotIdx > 0 and tman is not None and ( tankmenDescrs[lessMastered] is None or compareMastery(tankmenDescrs[lessMastered].descriptor, tman.descriptor) > 0): lessMastered = slotIdx role = vehicle.descriptor.type.crewRoles[slotIdx][0] roles.append({ 'tankmanID': tman.invID if tman is not None else None, 'roleType': role, 'role': convert(skillsConfig.getSkill(role).userString), 'roleIcon': Tankman.getRoleBigIconPath(role), 'nationID': vehicle.nationID, 'typeID': vehicle.innationID, 'slot': slotIdx, 'vehicleType': vehicle.shortUserName, 'tankType': vehicle.type, 'vehicleElite': vehicle.isPremium or vehicle.isPremiumIGR, 'roles': list(vehicle.descriptor.type.crewRoles[slotIdx]) }) tankmenData = [] for tankman in allTankmen.itervalues(): if tankman.isInTank and tankman.vehicleInvID != vehicle.invID: continue tankmanVehicle = self.itemsCache.items.getItemByCD( tankman.vehicleNativeDescr.type.compactDescr) bonus_role_level = commander_bonus if tankman.descriptor.role != 'commander' else 0.0 skills_count = skillsConfig.getNumberOfActiveSkills() skillsList = [] for skill in tankman.skills: skillsList.append({ 'tankmanID': tankman.invID, 'id': str(tankman.skills.index(skill)), 'name': skill.userName, 'desc': skill.description, 'icon': skill.icon, 'level': skill.level, 'active': skill.isEnable and skill.isActive }) newSkillsCount, lastNewSkillLvl = tankman.newSkillCount if newSkillsCount > 0: skillsList.append({ 'buy': True, 'buyCount': newSkillsCount - 1, 'tankmanID': tankman.invID, 'level': lastNewSkillLvl }) tankmanData = { 'fullName': tankman.fullUserName, 'lastName': tankman.lastUserName or tankman.firstUserName, 'rank': tankman.rankUserName, 'specializationLevel': tankman.realRoleLevel[0], 'role': tankman.roleUserName, 'vehicleType': tankmanVehicle.shortUserName, 'iconFile': tankman.icon, 'rankIconFile': tankman.iconRank, 'roleIconFile': Tankman.getRoleBigIconPath(tankman.descriptor.role), 'contourIconFile': tankmanVehicle.iconContour, 'tankmanID': tankman.invID, 'nationID': tankman.nationID, 'typeID': tankmanVehicle.innationID, 'inTank': tankman.isInTank, 'roleType': tankman.descriptor.role, 'tankType': tankmanVehicle.type, 'efficiencyLevel': tankman.efficiencyRoleLevel, 'bonus': bonus_role_level, 'lastSkillLevel': tankman.descriptor.lastSkillLevel, 'isLessMastered': vehicle.crewIndices.get(tankman.invID) == lessMastered and vehicle.isXPToTman, 'compact': tankman.strCD, 'availableSkillsCount': skills_count, 'skills': skillsList } self.__updateTankmanDataByCrewSkin(tankman, tankmanData) tankmenData.append(tankmanData) self.as_tankmenResponseS({ 'showRecruit': self._showRecruit, 'roles': roles, 'tankmen': tankmenData }) dogName = '' if 'dog' in self.itemsCache.items.getItemByCD( g_currentVehicle.item.intCD).tags: dogName = backport.text( R.strings.menu.hangar.crew.rody.dog.dyn( vehicle.nationName).name()) self.as_dogResponseS(dogName) tooltipId = TOOLTIPS.HANGAR_CREW_RUDY_DOG + vehicle.nationName self.as_setDogTooltipS(tooltipId) Waiting.hide('updateTankmen') return
def showWaiting(self, messageID, softStart=False): self.as_showWaitingS(backport.text(messageID), softStart)
def _populate(self): super(RankedBattlesRewardsLeaguesView, self)._populate() data = self.__getLeaguesData() descr = backport.text(R.strings.ranked_battles.rewardsView.tabs.leagues.description()) self.as_setRewardsS({'leagues': data, 'description': descr})
def _addMapboxSquadType(items): items.append( _MapboxSquadItem( text_styles.middleTitle( backport.text(_R_BATTLE_TYPES.mapboxSquad())), PREBATTLE_ACTION_NAME.MAPBOX_SQUAD, 2))
def getFightButtonLabel(self, state, playerInfo): return backport.text(_R_HEADER_BUTTONS.battle())
def _addSimpleSquadType(items): items.append( _SimpleSquadItem( text_styles.middleTitle( backport.text(_R_BATTLE_TYPES.simpleSquad())), PREBATTLE_ACTION_NAME.SQUAD, 0))
def _addEventSquadType(items): items.append( _EventSquadItem( text_styles.middleTitle(backport.text( _R_BATTLE_TYPES.eventSquad())), PREBATTLE_ACTION_NAME.EVENT_SQUAD, 2))
def _addSandboxType(items): items.append( _SandboxItem(backport.text(_R_BATTLE_TYPES.battleTeaching()), PREBATTLE_ACTION_NAME.SANDBOX, 10))
def _addTutorialBattleType(items, isInRoaming): items.append( (_DisabledSelectorItem if isInRoaming else _BattleTutorialItem)( backport.text(_R_BATTLE_TYPES.battleTutorial()), PREBATTLE_ACTION_NAME.BATTLE_TUTORIAL, 9))
def _addSpecialBattleType(items): items.append( _SpecBattleItem(backport.text(_R_BATTLE_TYPES.spec()), PREBATTLE_ACTION_NAME.SPEC_BATTLES_LIST, 6))
def __setupView(self): self.as_setupS([ [ _BET.ARMOR, backport.text(R.strings.ingame_gui.efficiencyRibbons.armor()) ], [ _BET.DEFENCE, backport.text(R.strings.ingame_gui.efficiencyRibbons.defence()) ], [ _BET.DAMAGE, backport.text(R.strings.ingame_gui.efficiencyRibbons.damage()) ], [ _BET.ASSIST_SPOT, backport.text( R.strings.ingame_gui.efficiencyRibbons.assistSpot()) ], [ _BET.ASSIST_TRACK, backport.text( R.strings.ingame_gui.efficiencyRibbons.assistTrack()) ], [ _BET.BURN, backport.text(R.strings.ingame_gui.efficiencyRibbons.burn()) ], [ _BET.CAPTURE, backport.text(R.strings.ingame_gui.efficiencyRibbons.capture()) ], [ _BET.DESTRUCTION, backport.text(R.strings.ingame_gui.efficiencyRibbons.kill()) ], [ _BET.DETECTION, backport.text(R.strings.ingame_gui.efficiencyRibbons.spotted()) ], [ _BET.RAM, backport.text(R.strings.ingame_gui.efficiencyRibbons.ram()) ], [ _BET.CRITS, backport.text(R.strings.ingame_gui.efficiencyRibbons.crits()) ], [ _BET.WORLD_COLLISION, backport.text( R.strings.ingame_gui.efficiencyRibbons.worldCollision()) ], [ _BET.RECEIVED_CRITS, backport.text( R.strings.ingame_gui.efficiencyRibbons.receivedCrits()) ], [ _BET.RECEIVED_DAMAGE, backport.text( R.strings.ingame_gui.efficiencyRibbons.receivedDamage()) ], [ _BET.RECEIVED_BURN, backport.text( R.strings.ingame_gui.efficiencyRibbons.receivedBurn()) ], [ _BET.RECEIVED_RAM, backport.text( R.strings.ingame_gui.efficiencyRibbons.receivedRam()) ], [ _BET.RECEIVED_WORLD_COLLISION, backport.text(R.strings.ingame_gui.efficiencyRibbons. receivedWorldCollision()) ], [ _BET.STUN, backport.text(R.strings.ingame_gui.efficiencyRibbons.stun()) ], [ _BET.ASSIST_STUN, backport.text( R.strings.ingame_gui.efficiencyRibbons.assistStun()) ], [ _BET.VEHICLE_RECOVERY, backport.text( R.strings.ingame_gui.efficiencyRibbons.vehicleRecovery()) ], [ _BET.ENEMY_SECTOR_CAPTURED, backport.text(R.strings.ingame_gui.efficiencyRibbons. enemySectorCaptured()) ], [ _BET.DESTRUCTIBLE_DAMAGED, backport.text(R.strings.ingame_gui.efficiencyRibbons. destructibleDamaged()) ], [ _BET.DESTRUCTIBLE_DESTROYED, backport.text(R.strings.ingame_gui.efficiencyRibbons. destructibleDestroyed()) ], [ _BET.DESTRUCTIBLES_DEFENDED, backport.text(R.strings.ingame_gui.efficiencyRibbons. destructiblesDefended()) ], [ _BET.DEFENDER_BONUS, backport.text( R.strings.ingame_gui.efficiencyRibbons.defenderBonus()) ], [ _BET.BASE_CAPTURE_BLOCKED, backport.text(R.strings.ingame_gui.efficiencyRibbons.defence()) ], [ _BET.ASSIST_BY_ABILITY, backport.text( R.strings.ingame_gui.efficiencyRibbons.assistByAbility()) ], [ _BET.DEATH_ZONE, backport.text( R.strings.ingame_gui.efficiencyRibbons.deathZone()) ], [ _BET.BERSERKER, backport.text( R.strings.ingame_gui.efficiencyRibbons.berserker()) ], [ _BET.SPAWNED_BOT_DMG, backport.text( R.strings.ingame_gui.efficiencyRibbons.spawnedBotDmg()) ], [ _BET.RECEIVED_DMG_BY_SPAWNED_BOT, backport.text(R.strings.ingame_gui.efficiencyRibbons. receivedDmgBySpawnedBot()) ], [ _BET.DAMAGE_BY_MINEFIELD, backport.text( R.strings.ingame_gui.efficiencyRibbons.damageByMinefield()) ], [ _BET.RECEIVED_BY_MINEFIELD, backport.text(R.strings.ingame_gui.efficiencyRibbons. receivedByMinefield()) ], [ _BET.RECEIVED_BY_SMOKE, backport.text( R.strings.ingame_gui.efficiencyRibbons.receivedBySmoke()) ] ], self.__isExtendedAnim, self.__enabled, self.__isWithRibbonName, self.__isWithVehName, [ backport.text(R.strings.ingame_gui. efficiencyRibbons.bonusRibbon()) ])
def getFormattedLabel(self): title = super(_EpicTrainingItem, self).getFormattedLabel() descr = text_styles.main( backport.text(R.strings.menu.headerButtons.battle.types. epicTraining.descr())) return '{}\n{}'.format(title, descr)
def _formatCounter(counter): return backport.text(R.strings.ingame_gui.countRibbons.multiSeparator(), multiplier=counter)
def __setBaseState(self): self.bonusIcon = self.__getAddXPBonusIcon(self.__xpFactor) self.description = text_styles.highlightText(backport.text(R.strings.battle_results.common.premiumBonus.description()))
def setTotalCount(self, vehicles, teams): isSquad = ARENA_BONUS_TYPE_CAPS.checkAny(getArena().bonusType, ARENA_BONUS_TYPE_CAPS.SQUADS) countText = str(vehicles) if isSquad: countText = ' '.join((countText, self.__ADDITIONAL_FRAG_TEMPLATE.format(backport.text(R.strings.battle_royale.fragPanel.squadsCount(), squadsCount=str(teams))))) self.as_setLeftFieldS(countText)
def __setAppliedState(self): self.xpValue = '' self.statusBonusLabel = '{}{}'.format(makeImageTag(source=backport.image(R.images.gui.maps.icons.library.ConfirmIcon_1())), text_styles.bonusAppliedText(backport.text(R.strings.battle_results.common.premiumBonus.appliedBonus())))
def _populate(self): super(BrowserPageComponent, self)._populate() self.as_setWaitingMessageS(backport.text(R.strings.waiting.browser.init())) self.as_setAllowWaitingS(True, True)
def __setExcludedState(self): self.xpValue = '' self.statusBonusLabel = '{}{}'.format(makeImageTag(source=backport.image(R.images.gui.maps.icons.library.attentionIconFilled()), vSpace=-3), text_styles.neutral(backport.text(R.strings.battle_results.common.premiumBonus.expiredBattleResult())))
def _getAlertLabel(cls, periodInfo, serverShortName): params = cls._getAlertLabelParams(periodInfo) params['serverName'] = serverShortName return backport.text( cls._RES_ROOT.dyn(periodInfo.periodType.value, cls._RES_ROOT.undefined)(), **params)
def __setLostBattleState(self): self.xpValue = '' self.bonusIcon = self.__getAddXPBonusIcon(premacc_helpers.BattleResultsBonusConstants.LOST_BATTLE_BACKGROUND_MULTIPLIER) self.statusBonusLabel = '{}{}'.format(makeImageTag(source=backport.image(R.images.gui.maps.icons.library.attentionIconFilled()), vSpace=-3), text_styles.neutral(backport.text(R.strings.battle_results.common.premiumBonus.rule())))
def _errorHandler(self, code, errStr='', ctx=None): return makeI18nError( sysMsgKey=backport.text( R.strings.system_messages.nation_change.dyn(errStr)()), defaultSysMsgKey=backport.text( R.strings.system_messages.nation_change.error()))
def __getBonusLeftStr(self, applyAdditionalXPCount): return text_styles.main(backport.text(R.strings.battle_results.common.premiumBonus.bonusLeft(), count=text_styles.stats(applyAdditionalXPCount)))
def _buildBattleRoyalePages(mapGeometryName): pages = [] mapResourceName = 'c_' + replaceHyphenToUnderscore(mapGeometryName) imagePath = R.images.gui.maps.icons.battleHelp.battleRoyale.dyn( mapResourceName) if not imagePath.isValid(): raise SoftException( 'No icons found for map {}'.format(mapGeometryName)) _addPage( pages, backport.text( R.strings.ingame_help.detailsHelp.battleRoyale.radar.title()), backport.text(R.strings.ingame_help.detailsHelp.battleRoyale.radar. description()), [], backport.image(imagePath.br_radar())) _addPage( pages, backport.text( R.strings.ingame_help.detailsHelp.battleRoyale.zone.title()), backport.text( R.strings.ingame_help.detailsHelp.battleRoyale.zone.description()), [], backport.image(imagePath.br_zone())) _addPage( pages, backport.text(R.strings.ingame_help.detailsHelp.battleRoyale. sectorVision.title()), backport.text(R.strings.ingame_help.detailsHelp.battleRoyale. sectorVision.description()), [], backport.image(imagePath.br_sector())) _addPage( pages, backport.text( R.strings.ingame_help.detailsHelp.battleRoyale.airDrop.title()), backport.text(R.strings.ingame_help.detailsHelp.battleRoyale. airDrop.description()), [], backport.image(imagePath.br_airdrop())) _addPage( pages, backport.text( R.strings.ingame_help.detailsHelp.battleRoyale.upgrade.title()), backport.text(R.strings.ingame_help.detailsHelp.battleRoyale.upgrade. description()), [], backport.image(imagePath.br_tree())) _addPage( pages, backport.text(R.strings.ingame_help.detailsHelp.battleRoyale. uniqueAbilities.title()), backport.text(R.strings.ingame_help.detailsHelp.battleRoyale. uniqueAbilities.description()), [], backport.image(imagePath.br_unique_abilities())) return pages
def getSkillUserName(self, skillName): return backport.text( R.strings.item_types.tankman.skills.brotherhood_offspring( )) if skillName == 'brotherhood' else tankmen.getSkillsConfig( ).getSkill(skillName).userString
def __setBlockedByVehicle(self): self.xpValue = '' self.statusBonusLabel = text_styles.neutral( backport.text(R.strings.battle_results.common.premiumBonus. tankStateChanged())) self.statusBonusTooltip = TOOLTIPS.BATTLERESULTS_PREMIUMBONUS_TANKSTATECHANGED
def _addMapboxBattleType(items): items.append( _MapboxItem(backport.text(_R_BATTLE_TYPES.mapbox()), PREBATTLE_ACTION_NAME.MAPBOX, 2, SELECTOR_BATTLE_TYPES.MAPBOX))