def __makeClanInfo(self): enemyClanDBID = g_clanCache.clanDBID tID = "clanInfo%d" % enemyClanDBID self.__imageID = yield g_clanCache.getClanEmblemTextureID(enemyClanDBID, True, tID) creationDate = BigWorld.wg_getLongDateFormat( self.fortCtrl.getFort().getFortDossier().getGlobalStats().getCreationTime() ) clanTag = g_clanCache.clanTag clanTagLocal = i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_CLANINFO_CLANTAG, clanTag=clanTag) clanTag = text_styles.highTitle(clanTagLocal) creationDateLocalize = i18n.makeString( FORTIFICATIONS.SETTINGSWINDOW_CLANINFO_CREATIONDATE, creationDate=creationDate ) creationDate = text_styles.neutral(creationDateLocalize) buildingsCount = len(self.fortCtrl.getFort().getBuildingsCompleted()) buildingsCount = text_styles.neutral(buildingsCount) buildingsCountLocalize = i18n.makeString( FORTIFICATIONS.SETTINGSWINDOW_CLANINFO_BUILDINGSCOUNT, buildingsCount=str(buildingsCount) ) buildingsCountLocalize = text_styles.standard(buildingsCountLocalize) FortSettingsClanInfoVO = { "clanTag": clanTag, "clanIcon": self.__imageID, "creationDate": creationDate, "buildingCount": buildingsCountLocalize, } self.as_setFortClanInfoS(FortSettingsClanInfoVO)
def __createTexts(self): self.__textsCreated = True return { 'windowLbl': FORTIFICATIONS.PERIODDEFENCEWINDOW_HEADERLBL, 'headerLbl': text_styles.highTitle(FORTIFICATIONS.PERIODDEFENCEWINDOW_READY), 'peripheryLbl': text_styles.neutral(FORTIFICATIONS.PERIODDEFENCEWINDOW_PERIPHERY), 'peripheryDescr': text_styles.standard( FORTIFICATIONS.PERIODDEFENCEWINDOW_PERIPHERY_DESCRIPTION), 'hourDefenceLbl': text_styles.neutral( FORTIFICATIONS.PERIODDEFENCEWINDOW_HOURDEFENCE), 'hourDefenceDescr': text_styles.standard( FORTIFICATIONS.PERIODDEFENCEWINDOW_HOURDEFENCE_DESCRIPTION), 'holidayLbl': text_styles.neutral(FORTIFICATIONS.PERIODDEFENCEWINDOW_HOLIDAY), 'holidayDescr': text_styles.standard( FORTIFICATIONS.PERIODDEFENCEWINDOW_HOLIDAY_DESCRIPTION), 'acceptBtn': FORTIFICATIONS.PERIODDEFENCEWINDOW_BTN_ACTIVATE, 'cancelBtn': FORTIFICATIONS.PERIODDEFENCEWINDOW_BTN_NOTNOW }
def _getVO(self, offer): gifts = backport.text(R.strings.storage.offers.giftAmount(), clicks=text_styles.neutral(offer.clicksCount), gifts=text_styles.neutral( offer.availableGiftsCount)) date = backport.getShortDateFormat(offer.expiration) time = backport.getShortTimeFormat(offer.expiration) expiration = backport.text(R.strings.storage.offers.expiration(), date=text_styles.neutral(date), time=text_styles.neutral(time)) description = '\n'.join([gifts, expiration]) localization = ResMgr.openSection( self._offersProvider.getCdnResourcePath(offer.cdnLocFilePath, relative=False)) title = localization.readString('name') if localization else '' vo = createStorageDefVO(offer.id, title, description, 0, None, self._offersProvider.getCdnResourcePath( offer.cdnLogoPath, relative=False), 'altimage', contextMenuId=None) return vo
def _buildVehicle(self, vehicle): result = super(MapboxCarouselDataProvider, self)._buildVehicle(vehicle) state, _ = vehicle.getState() if state == Vehicle.VEHICLE_STATE.UNSUITABLE_TO_QUEUE: validationResult = MapboxVehicleValidator.validateForMapbox( vehicle) if validationResult is not None: header, body = ('', '') resPath = R.strings.mapbox.mapboxCarousel.lockedTooltip if validationResult.restriction == PRE_QUEUE_RESTRICTION.LIMIT_LEVEL: levelStr = toRomanRangeString( validationResult.ctx['levels']) levelSubStr = backport.text(resPath.vehLvl.levelSubStr(), levels=levelStr) header = backport.text(resPath.vehLvl.header()) body = backport.text(resPath.vehLvl.body(), levelSubStr=levelSubStr) elif validationResult.restriction == PRE_QUEUE_RESTRICTION.LIMIT_VEHICLE_TYPE: typeSubStr = text_styles.neutral( validationResult.ctx['forbiddenType']) header = backport.text(resPath.vehType.header()) body = backport.text(resPath.vehType.body(), forbiddenType=typeSubStr) elif validationResult.restriction == PRE_QUEUE_RESTRICTION.LIMIT_VEHICLE_CLASS: classSubStr = text_styles.neutral( getTypeUserName(validationResult.ctx['forbiddenClass'], False)) header = backport.text(resPath.vehClass.header()) body = backport.text(resPath.vehClass.body(), forbiddenClass=classSubStr) result['lockedTooltip'] = makeTooltip(header, body) return result
def __makeClanInfo(self): enemyClanDBID = g_clanCache.clanDBID tID = 'clanInfo%d' % enemyClanDBID self.__imageID = yield g_clanCache.getClanEmblemTextureID( enemyClanDBID, True, tID) creationDate = BigWorld.wg_getLongDateFormat(self.fortCtrl.getFort( ).getFortDossier().getGlobalStats().getCreationTime()) clanTag = g_clanCache.clanTag clanTagLocal = i18n.makeString( FORTIFICATIONS.SETTINGSWINDOW_CLANINFO_CLANTAG, clanTag=clanTag) clanTag = text_styles.highTitle(clanTagLocal) creationDateLocalize = i18n.makeString( FORTIFICATIONS.SETTINGSWINDOW_CLANINFO_CREATIONDATE, creationDate=creationDate) creationDate = text_styles.neutral(creationDateLocalize) buildingsCount = len(self.fortCtrl.getFort().getBuildingsCompleted()) buildingsCount = text_styles.neutral(buildingsCount) buildingsCountLocalize = i18n.makeString( FORTIFICATIONS.SETTINGSWINDOW_CLANINFO_BUILDINGSCOUNT, buildingsCount=str(buildingsCount)) buildingsCountLocalize = text_styles.standard(buildingsCountLocalize) FortSettingsClanInfoVO = { 'clanTag': clanTag, 'clanIcon': self.__imageID, 'creationDate': creationDate, 'buildingCount': buildingsCountLocalize } self.as_setFortClanInfoS(FortSettingsClanInfoVO)
def _buildVehicle(self, vehicle): result = super(RankedCarouselDataProvider, self)._buildVehicle(vehicle) result[ 'hasRankedBonus'] = self.__rankedController.hasVehicleRankedBonus( vehicle.intCD) state, _ = vehicle.getState() suitResult = self.__rankedController.isSuitableVehicle(vehicle) if suitResult is not None: header, body = ('', '') resShortCut = R.strings.ranked_battles.rankedBattlesCarousel.lockedTooltip if suitResult.restriction == PRE_QUEUE_RESTRICTION.LIMIT_LEVEL: levelStr = toRomanRangeString(suitResult.ctx['levels']) levelSubStr = backport.text(resShortCut.vehLvl.levelSubStr(), levels=levelStr) header = backport.text(resShortCut.vehLvl.header()) body = backport.text(resShortCut.vehLvl.body(), levelSubStr=levelSubStr) elif suitResult.restriction == PRE_QUEUE_RESTRICTION.LIMIT_VEHICLE_TYPE: typeSubStr = text_styles.neutral( suitResult.ctx['forbiddenType']) header = backport.text(resShortCut.vehType.header()) body = backport.text(resShortCut.vehType.body(), forbiddenType=typeSubStr) elif suitResult.restriction == PRE_QUEUE_RESTRICTION.LIMIT_VEHICLE_CLASS: classSubStr = text_styles.neutral( getTypeUserName(suitResult.ctx['forbiddenClass'], False)) header = backport.text(resShortCut.vehClass.header()) body = backport.text(resShortCut.vehClass.body(), forbiddenClass=classSubStr) if state == Vehicle.VEHICLE_STATE.UNSUITABLE_TO_QUEUE: result['lockedTooltip'] = makeTooltip(header, body) result['clickEnabled'] = True result['hasRankedBonus'] = False return result
def __getMyPosititon(self): event = self._event if event.isFinished() and self.__notFull: return text_styles.neutral(_ms(EVENT_BOARDS.TOP_PARTICIPATION_NOTPARTICIPATED)) if self.__notFull: return text_styles.neutral(_ms(EVENT_BOARDS.TOP_PARTICIPATION_NOTFULL)) return text_styles.neutral(_ms(EVENT_BOARDS.TOP_PARTICIPATION_NOTINTOP)) if self.__notInTop else text_styles.main('{} {}'.format(_ms(EVENT_BOARDS.TOP_POSITION), self._top.getMyPosition()))
def __updateClubData(self): resultVO = _IntroViewVO() club = self.getClub() if self.clubsState.getStateID() == CLIENT_CLUB_STATE.HAS_CLUB and club: profile = self.clubsCtrl.getProfile() limits = self.clubsCtrl.getLimits() resultVO.setClubLabel(club.getUserName()) resultVO.setClubDBbID(club.getClubDbID()) resultVO.setClubLadderChevron(club) resultVO.showAdditionalButton(_ms(CYBERSPORT.WINDOW_INTRO_ADDITIONALBTN_LIST), TOOLTIPS.CYBERSPORT_INTRO_ADDITIONALBTN) resultVO.moveToTheUnitByCreateButton() resultVO.openClubProfileByChevronClick() if club.hasActiveUnit(): unitInfo = club.getUnitInfo() resultVO.showCreateButton(_ms(CYBERSPORT.WINDOW_INTRO_CREATE_BTN_JOINTEAM), TOOLTIPS.CYBERSPORT_INTRO_CREATEBTN_JOINTEAM) if unitInfo.isInBattle(): isInBattleIcon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_SWORDSICON, 16, 16, -3, 0) resultVO.setClubDescription(text_styles.neutral('%s %s' % (isInBattleIcon, _ms(CYBERSPORT.WINDOW_INTRO_TEAM_DESCRIPTION_TEAMINBATTLE)))) else: resultVO.setClubDescription(text_styles.neutral(CYBERSPORT.STATICFORMATIONPROFILEWINDOW_STATUSLBL_CLUBISCALLED)) else: canCreateUnit = limits.canCreateUnit(profile, club) if canCreateUnit.success: resultVO.setClubDescription(text_styles.neutral(CYBERSPORT.WINDOW_INTRO_TEAM_DESCRIPTION_ASSEMBLINGTEAM)) resultVO.showCreateButton(_ms(CYBERSPORT.WINDOW_INTRO_CREATE_BTN_ASSEMBLETEAM), TOOLTIPS.CYBERSPORT_INTRO_CREATEBTN_ASSEMBLETEAM) elif canCreateUnit.reason == CLIENT_CLUB_RESTRICTIONS.NOT_ENOUGH_MEMBERS: if club.getPermissions().isOwner(): resultVO.setClubDescription(text_styles.main(CYBERSPORT.WINDOW_INTRO_TEAM_DESCRIPTION_NOTENOUGHPLAYERS)) resultVO.showCreateButton(_ms(CYBERSPORT.WINDOW_INTRO_CREATE_BTN_ADDPLAYERS), TOOLTIPS.CYBERSPORT_INTRO_CREATEBTN_ADDPLAYERS) else: resultVO.setClubDescription(text_styles.error(CYBERSPORT.WINDOW_INTRO_TEAM_DESCRIPTION_OWNERASSEMBLINGTEAM), isBackVisible=True) resultVO.showCreateButton(_ms('#cybersport:window/intro/create/btn/private/seeStaff'), '#tooltips:cyberSport/intro/createBtn/addPlayers/private') resultVO.needAddPlayers() else: resultVO.setClubDescription(text_styles.error(CYBERSPORT.WINDOW_INTRO_TEAM_DESCRIPTION_NOTENOUGHPERMISSIONS_ASSEMBLINGTEAM), isBackVisible=True) resultVO.showCreateButton(_ms(CYBERSPORT.WINDOW_INTRO_CREATE_BTN_ASSEMBLETEAM), '#tooltips:StaticFormationProfileWindow/actionBtn/notEnoughPermissions', enabled=False) elif self.clubsState.getStateID() == CLIENT_CLUB_STATE.NO_CLUB: resultVO.setNoClubChevron(isApplicationSent=False) resultVO.setClubLabel(_ms(CYBERSPORT.WINDOW_INTRO_TEAM_HEADER_STATICTEAMS)) resultVO.setClubDescription(text_styles.main(CYBERSPORT.WINDOW_INTRO_TEAM_DESCRIPTION_CREATEORFIND)) resultVO.showCreateButton(_ms(CYBERSPORT.WINDOW_INTRO_CREATE_BTN_LOOK), TOOLTIPS.CYBERSPORT_INTRO_CREATEBTN_LOOK) elif self.clubsState.getStateID() == CLIENT_CLUB_STATE.SENT_APP: resultVO.setNoClubChevron(isApplicationSent=True) resultVO.openClubProfileByChevronClick() if club is not None: resultVO.setClubLabel(club.getUserName()) resultVO.setClubLadderChevron(club) resultVO.setClubDescription(text_styles.neutral(CYBERSPORT.WINDOW_INTRO_TEAM_DESCRIPTION_WAITINGFORREQUEST)) resultVO.showCancelButton(_ms(CYBERSPORT.WINDOW_INTRO_CANCEL_BTN_LABEL), TOOLTIPS.CYBERSPORT_INTRO_CANCELBTN) resultVO.showAdditionalButton(_ms(CYBERSPORT.WINDOW_INTRO_ADDITIONALBTN_LIST), TOOLTIPS.CYBERSPORT_INTRO_ADDITIONALBTN) else: resultVO.fillDefault() resultVO.acceptNavigationByChevron(False) isBattlesAvailable, _ = self.clubsCtrl.getAvailabilityCtrl().getStatus() if not isBattlesAvailable: resultVO.setClubDescriptionTooltip(TOOLTIPS_CONSTANTS.LADDER_REGULATIONS) resultVO.setClubDescription('{0}{1}'.format(icons.alert(), text_styles.main(CYBERSPORT.LADDERREGULATIONS_WARNING)), True) self.as_setStaticTeamDataS(resultVO.getData()) return
def _makeServerString(serverInfo, isServerNameShort=False): server = text_styles.neutral( text_styles.concatStylesToSingleLine( serverInfo.getShortName() if isServerNameShort else serverInfo.getName(), ' (', text_styles.neutral(serverInfo.getPingValue()), makePingStatusIcon(serverInfo.getPingStatus()), ')')) return backport.text(R.strings.menu.primeTime.server(), server=server)
def __getStatusData(self, selectedQuest): status = MISSIONS_STATES.IN_PROGRESS icon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_INPROGRESSICON, 16, 16, -2, 8) text = text_styles.neutral(INGAME_GUI.STATISTICS_TAB_QUESTS_STATUS_INPROGRESS) if selectedQuest.isMainCompleted(): text = text_styles.neutral(INGAME_GUI.STATISTICS_TAB_QUESTS_STATUS_INCREASERESULT) statusLabel = text_styles.concatStylesToSingleLine(icon, text) return {'statusLabel': statusLabel, 'status': status}
def getBonusBattlesIncome(resRoot, stepsCount, efficiencyCount, isStepsDaily): forEfficiencyStr = '' if efficiencyCount > 0: forEfficiencyStr = backport.text(resRoot.efficiency(), amount=text_styles.neutral(efficiencyCount)) forStepsStr = '' stepsKey = 'daily' if isStepsDaily else 'persistent' if stepsCount > 0: forStepsStr = backport.text(resRoot.steps.dyn(stepsKey)(), amount=text_styles.neutral(stepsCount)) return text_styles.concatStylesToSingleLine(forEfficiencyStr, forStepsStr) if forEfficiencyStr or forStepsStr else ''
def getBonusLimitTooltip(bonusCount, bonusLimit, isDaily): header = _ms(TOOLTIPS.QUESTS_COMPLETE_PROGRESS_HEADER) if isDaily: key = TOOLTIPS.QUESTS_COMPLETE_PROGRESSDAILY_BODY else: key = TOOLTIPS.QUESTS_COMPLETE_PROGRESS_BODY body = _ms(key, count=text_styles.neutral(bonusCount), totalCount=text_styles.neutral(bonusLimit)) return {'tooltip': makeTooltip(header=header, body=body), 'isSpecial': False, 'specialArgs': []}
def getBuildingTooltipBody(self, hpVal, maxHpValue, defResVal, maxDefResValue): nutIcon = ' ' + icons.nut() labelOne = text_styles.main(i18n.makeString(FORTIFICATIONS.BUILDINGS_BUILDINGTOOLTIP_STRENGTH)) labelTwo = text_styles.main(i18n.makeString(FORTIFICATIONS.BUILDINGS_BUILDINGTOOLTIP_STORE)) fstLine = labelOne + text_styles.neutral(self.__toFormattedStr(hpVal)) + ' / ' + text_styles.standard(self.__toFormattedStr(maxHpValue)) + nutIcon secLine = labelTwo + text_styles.neutral(self.__toFormattedStr(defResVal)) + ' / ' + text_styles.standard(self.__toFormattedStr(maxDefResValue)) + nutIcon toolTipData = fstLine + secLine defResCompensationValue = defResVal - maxDefResValue if defResCompensationValue > 0: toolTipData += text_styles.standard(i18n.makeString(FORTIFICATIONS.BUILDINGS_BUILDINGTOOLTIP_COMPENSATION)) + text_styles.neutral(self.__toFormattedStr(defResCompensationValue)) + nutIcon return toolTipData
def _getStatusBlock(cls, quest): isAvailable, reason = quest.isAvailable() if not isAvailable: if reason == 'noVehicle': key = TOOLTIPS.PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_NOVEHICLE else: key = TOOLTIPS.PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_NOTAVAILABLE text = text_styles.concatStylesWithSpace(icons.markerBlocked(-2), text_styles.error(key)) elif quest.isInProgress(): if quest.isOnPause: text = text_styles.concatStylesWithSpace( icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_ONPAUSE, 16, 16, -3, 8), text_styles.playerOnline( TOOLTIPS. PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_ONPAUSE)) elif quest.areTokensPawned(): label = _ms( TOOLTIPS. PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_SHEETRECOVERYINPROGRESS, icon=missions_helper.getHtmlAwardSheetIcon( quest.getQuestBranch()), count=quest.getPawnCost()) text = text_styles.concatStylesWithSpace( icons.inProgress(-1), text_styles.neutral(label)) else: text = text_styles.concatStylesWithSpace( icons.inProgress(-1), text_styles.neutral( TOOLTIPS. PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_INPROGRESS)) elif quest.isCompleted(): if quest.areTokensPawned(): text = text_styles.concatStylesWithSpace( icons.checkmark(-2), text_styles.bonusAppliedText( TOOLTIPS. PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_DONEFREESHEET), missions_helper.getHtmlAwardSheetIcon( quest.getQuestBranch()), text_styles.stats('x%s' % quest.getPawnCost())) else: text = text_styles.concatStylesWithSpace( icons.checkmark(-2), text_styles.bonusAppliedText( TOOLTIPS.PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_DONE)) else: text = text_styles.main( TOOLTIPS.PERSONALMISSIONS_MAPREGION_FOOTER_TITLE_AVAILABLE) return formatters.packAlignedTextBlockData( text=text, align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER, padding=formatters.packPadding(top=-5, bottom=-5))
def _packBlocks(self, *args, **kwargs): items = super(BattleProgressionTooltipData, self)._packBlocks(*args, **kwargs) titleStr = text_styles.highTitle( backport.text(R.strings.battle_royale.hangarVehicleInfo.tooltips. battleProgression.title())) titleDescrStr = text_styles.neutral( backport.text(R.strings.battle_royale.hangarVehicleInfo.tooltips. battleProgression.titleDescr())) items.append( formatters.packItemTitleDescBlockData(title=titleStr, desc=titleDescrStr, txtGap=5)) highlight1Str = text_styles.neutral( backport.text(R.strings.battle_royale.hangarVehicleInfo.tooltips. battleProgression.noteHighlight1())) highlight2Str = text_styles.neutral( backport.text(R.strings.battle_royale.hangarVehicleInfo.tooltips. battleProgression.noteHighlight2())) noteStr = text_styles.main( backport.text(R.strings.battle_royale.hangarVehicleInfo.tooltips. battleProgression.note(), highlight1=highlight1Str, highlight2=highlight2Str)) noteBlock = formatters.packTextBlockData(text=noteStr) items.append( formatters.packBuildUpBlockData( blocks=[noteBlock], linkage=BLOCKS_TOOLTIP_TYPES. TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE)) tutorialHighlightStr = text_styles.neutral( backport.text(R.strings.battle_royale.hangarVehicleInfo.tooltips. battleProgression.tutorialHighlight())) treeKey = text_styles.alert( getHotKeyString(CommandMapping.CMD_UPGRADE_PANEL_SHOW)) leftModuleKey = text_styles.alert( getHotKeyString(CommandMapping.CMD_CM_VEHICLE_UPGRADE_PANEL_LEFT)) rightModuleKey = text_styles.alert( getHotKeyString(CommandMapping.CMD_CM_VEHICLE_UPGRADE_PANEL_RIGHT)) tutorialStr = text_styles.main( backport.text(R.strings.battle_royale.hangarVehicleInfo.tooltips. battleProgression.tutorial(), treeKey=treeKey, leftModuleKey=leftModuleKey, rightModuleKey=rightModuleKey)) tutorialStr = text_styles.concatStylesWithSpace( tutorialHighlightStr, tutorialStr) items.append(formatters.packTextBlockData(text=tutorialStr)) return items
def __makeVO(self, data): creditsDiff = '+ %s' % BigWorld.wg_getNiceNumberFormat(data.creditsDiff) xpDiff = '+ %s' % BigWorld.wg_getNiceNumberFormat(data.xpDiff) premStr = text_styles.neutral(BATTLE_RESULTS.GETPREMIUMPOPOVER_PREM) awardStr = text_styles.neutral(BATTLE_RESULTS.GETPREMIUMPOPOVER_AWARD) descriptionText = _ms(BATTLE_RESULTS.GETPREMIUMPOPOVER_DESCRIPTIONTEXT, prem=premStr, award=awardStr) result = {'arenaUniqueID': data.arenaUniqueID, 'headerTF': {'htmlText': text_styles.highTitle(BATTLE_RESULTS.GETPREMIUMPOPOVER_HEADERTEXT)}, 'creditsTF': {'htmlText': text_styles.promoTitle(creditsDiff)}, 'creditsIcon': {'source': RES_ICONS.MAPS_ICONS_LIBRARY_CREDITSICONBIG_1}, 'xpTF': {'htmlText': text_styles.promoTitle(xpDiff)}, 'xpIcon': {'source': RES_ICONS.MAPS_ICONS_LIBRARY_XPICONBIG_1}, 'descriptionTF': {'htmlText': text_styles.main(descriptionText)}, 'actionBtn': {'label': BATTLE_RESULTS.GETPREMIUMPOPOVER_ACTIONBTN_LABEL}} return result
def __makePeripheryData(self): fort = self.fortCtrl.getFort() optionsList = g_preDefinedHosts.getSimpleHostsList(g_preDefinedHosts.hostsWithRoaming()) servername = None for key, name, csisStatus, peripheryID in optionsList: if fort.peripheryID == peripheryID: servername = name if servername is None: servername = connectionManager.serverUserName _, inCooldown = fort.getPeripheryProcessing() timestamp, _, _ = fort.events.get(FORT_EVENT_TYPE.PERIPHERY_COOLDOWN, (0, 0, 0)) buttonEnabled = not inCooldown buttonToolTip = self.__makePeripheryBtnToolTip( buttonEnabled, time_utils.getTimeDeltaFromNow(time_utils.makeLocalServerTime(timestamp)) ) descriptionTooltip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_PERIPHERYDESCRIPTION if self._isFortFrozen(): peripheryName = text_styles.standard(str(servername)) else: peripheryName = text_styles.neutral(str(servername)) return { "peripheryTitle": text_styles.main(i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_PEREPHERYTITLE)), "peripheryName": peripheryName, "buttonEnabled": buttonEnabled, "buttonToolTip": buttonToolTip, "descriptionTooltip": descriptionTooltip, }
def __makeDefencePeriodData(self): alertMessage = '' blockBtnEnabled = True fort = self.fortCtrl.getFort() inProcess, inCooldown = fort.getDefenceHourProcessing() if self._isFortFrozen(): conditionPostfix = text_styles.standard(fort.getDefencePeriodStr()) else: conditionPostfix = text_styles.neutral(fort.getDefencePeriodStr()) blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DEFENCEBTNENABLED descriptionTooltip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DEFENCEPERIODDESCRIPTION if inProcess: defenceHourChangeDay, nextDefenceHour, _ = fort.events[FORT_EVENT_TYPE.DEFENCE_HOUR_CHANGE] timestampStart = time_utils.getTimeTodayForUTC(nextDefenceHour) value = '%s - %s' % (BigWorld.wg_getShortTimeFormat(timestampStart), BigWorld.wg_getShortTimeFormat(timestampStart + time_utils.ONE_HOUR)) msgString = i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_INPROGRESS, value=value, date=BigWorld.wg_getShortDateFormat(defenceHourChangeDay)) alertMessage = text_styles.alert(msgString) blockBtnEnabled = False blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DEFENCEBTNDISABLED elif inCooldown: msgString = i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_RECENTLYSCHEDULED) alertMessage = text_styles.alert(msgString) blockBtnEnabled = False blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DEFENCEBTNDISABLED conditionPrefix = text_styles.main(i18n.makeString(FORTIFICATIONS.settingswindow_blockcondition('defencePeriodTime'))) blockDescr = text_styles.standard(i18n.makeString(FORTIFICATIONS.settingswindow_blockdescr('defencePeriodTime'))) if alertMessage: alertMessage = icons.alert() + ' ' + alertMessage return {'blockBtnEnabled': blockBtnEnabled, 'blockDescr': blockDescr, 'blockCondition': conditionPrefix + ' ' + conditionPostfix, 'alertMessage': alertMessage, 'blockBtnToolTip': blockBtnToolTip, 'descriptionTooltip': descriptionTooltip}
def getDescription(self): vehicleNames = [] for vehCD in self.__vehicleDesrs: details = self.__getVehicleDetails(vehCD) vehicleNames.append( i18n.makeString(MENU.AWARDWINDOW_TELECOMAWARD_VEHICLES, **details)) vehicles = '\n'.join(vehicleNames) if self.__hasCrew: if self.__hasBrotherhood: descriptionKey = MENU.AWARDWINDOW_TELECOMAWARD_DESCRIPTION_WITHBROTHERHOOD else: descriptionKey = MENU.AWARDWINDOW_TELECOMAWARD_DESCRIPTION else: descriptionKey = MENU.AWARDWINDOW_TELECOMAWARD_DESCRIPTION_WITHOUTCREW if self.__vehicleDesrs: serverSettings = self.lobbyContext.getServerSettings() vehInvId = self.itemsCache.items.getItemByCD( self.__vehicleDesrs[0]).invID provider = BigWorld.player().inventory.getProviderForVehInvId( vehInvId, serverSettings) tariff = i18n.makeString(MENU.internetProviderTariff(provider)) else: tariff = '' premText = text_styles.neutral( MENU.AWARDWINDOW_TELECOMAWARD_DESCRIPTION_PREM) description = i18n.makeString(descriptionKey, tariff=tariff, vehicles=vehicles, prem=premText) return text_styles.main(description)
def _packSkillInfo(self): return {'upgradeBtnLoc': i18n.makeString(EPIC_BATTLE.METAABILITYSCREEN_UPGRADE_SKILL), 'acquireBtnLoc': i18n.makeString(EPIC_BATTLE.METAABILITYSCREEN_ACQUIRE_SKILL), 'abilityMaxLevelTxtLoc': text_styles.neutral(EPIC_BATTLE.METAABILITYSCREEN_ABILITY_MAX_LEVEL), 'abilityLockedTxtLoc': text_styles.alert(EPIC_BATTLE.METAABILITYSCREEN_ABILITY_LOCKED), 'abilityNotPointsTxtLoc': text_styles.alert(EPIC_BATTLE.METAABILITYSCREEN_ABILITY_NOT_POINTS), 'statsTitleLoc': text_styles.highTitle('{}{}'.format(i18n.makeString(EPIC_BATTLE.ABILITYINFO_PROPERTIES), i18n.makeString(COMMON.COMMON_COLON)))}
def _onRegisterFlashComponent(self, viewPy, alias): if len(self._tankman.skills) < 1: if self._tankman.roleLevel < 100: controlNumber = 0 question = _ms(DIALOGS.DISMISSTANKMAN_MESSAGE) else: controlNumber = self._tankman.roleLevel question = _ms(DIALOGS.PROTECTEDDISMISSTANKMAN_MAINMESSAGE, roleLevel=text_styles.warning( str(controlNumber))) else: lastSkill = self._tankman.skills[-1] if lastSkill.isPerk: skillType = DIALOGS.PROTECTEDDISMISSTANKMAN_ADDITIONALMESSAGE_ISPERK else: skillType = DIALOGS.PROTECTEDDISMISSTANKMAN_ADDITIONALMESSAGE_ISABILLITY question = _ms(DIALOGS.PROTECTEDDISMISSTANKMAN_ADDITIONALMESSAGE, skillType=_ms(skillType), skillName=text_styles.neutral(lastSkill.userName), roleLevel=text_styles.warning(str(lastSkill.level))) controlNumber = lastSkill.level viewPy.setControlNumbers(str(controlNumber)) viewPy.questionBody = text_styles.main(question) viewPy.errorMsg = text_styles.error( DIALOGS.PROTECTEDDISMISSTANKMAN_ERRORMESSAGE)
def __packQuestSlot(self, quest = None): ttHeader, ttBody, ttAttention, ttNote = (None, None, None, None) if quest is not None: tile = _getQuestsCache().getTiles()[quest.getTileID()] season = _getQuestsCache().getSeasons()[tile.getSeasonID()] isInProgress = True ttHeader = quest.getUserName() ttBody = quests_fmts.getFullTileUserName(season, tile) if quest.needToGetReward(): icon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICONFILLED, 16, 16, -3, 0) description = text_styles.neutral(i18n.makeString(QUESTS.PERSONAL_SEASONS_SLOTS_GETAWARD, icon=icon)) ttAttention = i18n.makeString(TOOLTIPS.PRIVATEQUESTS_SLOT_MISSIONCOMPLETE_ATTENTION) else: description = text_styles.standard(quests_fmts.getPQFullDescription(quest)) ttNote = i18n.makeString(TOOLTIPS.PRIVATEQUESTS_SLOT_MISSION_NOTE) title = text_styles.middleTitle(i18n.makeString(QUESTS.PERSONAL_SEASONS_SLOTS_TITLE, questName=quest.getUserName())) else: title, isInProgress = '', False description = text_styles.disabled(i18n.makeString(QUESTS.PERSONAL_SEASONS_SLOTS_NODATA)) ttHeader = i18n.makeString(TOOLTIPS.PRIVATEQUESTS_SLOT_EMPTY_HEADER) ttBody = i18n.makeString(TOOLTIPS.PRIVATEQUESTS_SLOT_EMPTY_BODY) return {'id': quest.getID() if quest else None, 'title': title, 'description': description, 'inProgress': isInProgress, 'completed': quest and quest.needToGetReward(), 'ttHeader': ttHeader, 'ttBody': ttBody, 'ttNote': ttNote, 'ttAttention': ttAttention}
def __getTimeText(self, serverInfo): if serverInfo: timeLeft = serverInfo.getTimeLeft() isAvailable = serverInfo.isAvailable() serverName = serverInfo.getName() else: _, timeLeft, isAvailable = self.__eventProgression.getPrimeTimeStatus( ) serverName = '' currentSeason = self.__eventProgression.getCurrentSeason() if currentSeason and not timeLeft: return _ms(EPIC_BATTLE.PRIMETIME_ENDOFCYCLE, server=serverName) if not timeLeft and not isAvailable and not currentSeason: nextSeason = self.__eventProgression.getNextSeason() if nextSeason: currTime = time_utils.getCurrentLocalServerTimestamp() primeTime = self.__eventProgression.getPrimeTimes().get( serverInfo.getPeripheryID()) startTime = primeTime.getNextPeriodStart( currTime, nextSeason.getEndDate()) if startTime: timeLeft = startTime - currTime else: self.destroy() return '' timeLeftStr = time_utils.getTillTimeString(timeLeft, MENU.TIME_TIMEVALUESHORT) i18nKey = EPIC_BATTLE.PRIMETIME_PRIMEISAVAILABLE if isAvailable else EPIC_BATTLE.PRIMETIME_PRIMEWILLBEAVAILABLE return _ms(i18nKey, server=serverName, time=text_styles.neutral(timeLeftStr))
def __buildProgressData(self): rank = self.rankedController.getCurrentRank() rankID = rank.getID() rankLabel = '' if self.rankedController.isAccountMastered(): blocks = [ self.__packProgressInfo( RES_ICONS.MAPS_ICONS_RANKEDBATTLES_ICON_VICTORY, text_styles.vehicleName( _ms(RANKED_BATTLES. RANKEDBATTLEVIEW_PROGRESSBLOCK_FINALRANK, rank=rankID))), self.__packRank(rank), self.__packProgressInfo( RES_ICONS.MAPS_ICONS_RANKEDBATTLES_ICON_FINAL_CUP_150X100, text_styles.vehicleName( _ms(RANKED_BATTLES. RANKEDBATTLEVIEW_PROGRESSBLOCK_CONTINUE))) ] else: blocks = [ self.__packRank(rank) for rank in self.rankedController.getRanksChain() if rank.getID() != 0 ] if rankID > 0: rankLabel = text_styles.neutral( _ms(RANKED_BATTLES. RANKEDBATTLEVIEW_PROGRESSBLOCK_CURRENTRANK, rank=text_styles.stats(rankID))) return {'blocks': blocks, 'currentRankLabel': rankLabel}
def __getTexts(self): ms = i18n.makeString percentText = text_styles.neutral( ms(MENU.SKILLDROPWINDOW_FREEDROPPERCENT)) freeDropText = text_styles.main( ms(MENU.SKILLDROPWINDOW_FREEDROPLABEL, percent=percentText)) return {'freeDrop': freeDropText}
def _buildTooltip(self, peripheryID): if not self.getTimeLeft(): tooltipStr = text_styles.expText( backport.text(R.strings.epic_battle.primeTime.endOfCycle(), server=self.getName())) else: timeStr = text_styles.neutral( time_formatters.getTillTimeByResource( self.getTimeLeft(), R.strings.menu.Time.timeValueShort)) if self._getIsAvailable(): tooltipStr = text_styles.expText( backport.text( R.strings.epic_battle.primeTime.serverTooltip(), server=self.getName(), time=timeStr)) else: tooltipStr = text_styles.expText( backport.text(R.strings.epic_battle.primeTime. serverUnavailableTooltip(), time=timeStr)) return { 'tooltip': tooltipStr, 'specialArgs': [], 'specialAlias': None, 'isSpecial': None }
def __getAvailabilityStr(self): _, time, _ = self.epicQueueController.getPrimeTimeStatus() timeLeftStr = time_utils.getTillTimeString(time, EPIC_BATTLE.STATUS_TIMELEFT) if not self.epicQueueController.isInPrimeTime(): availablePrimeTime = self.epicQueueController.hasAnySeason( ) and self.epicQueueController.getPrimeTimeStatus()[1] != 0 if availablePrimeTime: return text_styles.main( i18n.makeString(EPIC_BATTLE.TOOLTIP_EPICBATTLE_AVAILABLEIN, time=timeLeftStr)) return None currPerformanceGroup = self.epicQueueController.getPerformanceGroup() if currPerformanceGroup == EPIC_PERF_GROUP.HIGH_RISK: attention = text_styles.error( MENU.HEADERBUTTONS_BATTLE_MENU_ATTENTION_LOWPERFORMANCE) return icons.makeImageTag( RES_ICONS.MAPS_ICONS_LIBRARY_MARKER_BLOCKED, vSpace=-3) + ' ' + attention elif currPerformanceGroup == EPIC_PERF_GROUP.MEDIUM_RISK: attention = text_styles.neutral( MENU.HEADERBUTTONS_BATTLE_MENU_ATTENTION_REDUCEDPERFORMANCE) return icons.makeImageTag( RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICON, vSpace=-3) + ' ' + attention else: return None
def _getCountStr(self, order): count = order.count if count > 0: result = text_styles.neutral(count) else: result = text_styles.standard(count) return result
def __makeData(self): result = {} building = self.fortCtrl.getFort().getBuilding(self.__buildingId) self.__fixedPlayers = building.attachedPlayers self.__oldBuilding = self.getBuildingUIDbyID(self.fortCtrl.getFort().getAssignedBuildingID(BigWorld.player().databaseID)) self.__isAssigned = self.__buildingUId == self.__oldBuilding self.__limitFixedPlayers = building.typeRef.attachedPlayersLimit isVisible = True isEnabled = True btnTooltipData = TOOLTIPS.FORTIFICATION_FIXEDPLAYERS_ASSIGNBTNENABLED if self.__isAssigned: isVisible = False result['playerIsAssigned'] = text_styles.neutral(i18n.makeString(FORTIFICATIONS.FIXEDPLAYERS_HEADER_ISASSIGNED)) if isVisible and len(self.__fixedPlayers) == self.__limitFixedPlayers: isEnabled = False btnTooltipData = TOOLTIPS.FORTIFICATION_FIXEDPLAYERS_ASSIGNBTNDISABLED result['windowTitle'] = i18n.makeString(FORTIFICATIONS.FIXEDPLAYERS_WINDOWTITLE, buildingName=i18n.makeString(FORTIFICATIONS.buildings_buildingname(self.__buildingUId))) result['buildingId'] = self.__buildingId result['buttonLbl'] = i18n.makeString(FORTIFICATIONS.FIXEDPLAYERS_HEADER_BTNLBL) result['isEnableBtn'] = isEnabled result['isVisibleBtn'] = isVisible generalToolTip = TOOLTIPS.FORTIFICATION_FIXEDPLAYERS_GENERALTOOLTIP if len(self.__fixedPlayers) == self.__limitFixedPlayers: generalToolTip = TOOLTIPS.FORTIFICATION_FIXEDPLAYERS_GENERALTOOLTIPMAXLIMIT result['generalTooltipData'] = generalToolTip result['btnTooltipData'] = btnTooltipData result['countLabel'] = self.__playersLabel() result['rosters'] = self.__makeRosters() result['tableHeader'] = self._createTableHeader() self.as_setDataS(result)
def __getTitleDescrTexts(self, currentElement): if self._slotID == GUI_ITEM_TYPE.STYLE: if not currentElement: titleText = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ELEMENTTYPE_ALL else: titleText = currentElement.userName elif self._slotID == GUI_ITEM_TYPE.MODIFICATION: titleText = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ELEMENTTYPE_ALL elif self._slotID == GUI_ITEM_TYPE.INSCRIPTION: titleText = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ELEMENTTYPE_INSCRIPTION elif self._slotID == GUI_ITEM_TYPE.EMBLEM: titleText = VEHICLE_CUSTOMIZATION.PROPERTYSHEET_ELEMENTTYPE_EMBLEM else: titleText = VEHICLE_CUSTOMIZATION.getSheetVehPartName( getCustomizationTankPartName(self._areaID, self._regionID)) if not currentElement: itemTypeID = TABS_ITEM_MAPPING.get(self.__ctx.currentTab) itemTypeName = GUI_ITEM_TYPE_NAMES[itemTypeID] descrText = text_styles.neutral( VEHICLE_CUSTOMIZATION.getSheetEmptyDescription(itemTypeName)) elif self._slotID == GUI_ITEM_TYPE.STYLE: descrText = text_styles.main(currentElement.userType) elif self._slotID == GUI_ITEM_TYPE.CAMOUFLAGE: descrText = text_styles.main(currentElement.userName) else: descrText = text_styles.main( _ms(VEHICLE_CUSTOMIZATION.PROPERTYSHEET_DESCRIPTION, itemType=currentElement.userType, itemName=currentElement.userName)) return (text_styles.highTitle(titleText), descrText)
def _packBlocks(self, role): blocks = [] bodyStr = '%s/%s' % (TOOLTIPS.VEHICLEPREVIEW_CREW, role) crewParams = [ text_styles.neutral(param) for param in _CREW_TOOLTIP_PARAMS[role] ] blocks.append( formatters.packTitleDescBlock( text_styles.highTitle(ITEM_TYPES.tankman_roles(role)), text_styles.main(_ms(bodyStr, *crewParams)))) vehicle = self.context.getVehicle() for idx, tankman in vehicle.crew: if tankman.role == role: otherRoles = list(vehicle.descriptor.type.crewRoles[idx]) otherRoles.remove(tankman.role) if otherRoles: rolesStr = ', '.join([ text_styles.stats(_ms(ITEM_TYPES.tankman_roles(r))) for r in otherRoles ]) blocks.append( formatters.packTextBlockData( text_styles.main( _ms(TOOLTIPS. VEHICLEPREVIEW_CREW_ADDITIONALROLES, roles=rolesStr)))) return blocks
def getAdditionalStatusText(self): if self._isAddReward: return text_styles.success( '#menu:awardWindow/personalMission/sideConditionCompleted') else: return text_styles.neutral( '#menu:awardWindow/personalMission/sideConditionNotCompleted')
def _packProgressStateBlock(self): currentLevel = self._item.getLatestOpenedProgressionLevel( self.__vehicle) if currentLevel == -1 and self._progressionLevel == 1: currentLevel = 0 if self._progressionLevel < 1: return None else: if currentLevel >= self._progressionLevel: desc = text_styles.concatStylesToSingleLine( icons.checkmark(), text_styles.bonusAppliedText( getProgressionItemStatusText(self._progressionLevel))) elif currentLevel + 1 == self._progressionLevel: desc = text_styles.concatStylesToSingleLine( icons.inProgress(), text_styles.neutral( backport.text( R.strings.vehicle_customization.customization. infotype.progression.inProgressState()))) else: desc = text_styles.concatStylesToSingleLine( icons.markerBlocked(), text_styles.error( backport.text( R.strings.vehicle_customization.customization. infotype.progression.notAvailableState.title()))) desc = text_styles.concatStylesToMultiLine( desc, text_styles.main( backport.text( R.strings.vehicle_customization.customization. infotype.progression.notAvailableState.desc()))) return formatters.packAlignedTextBlockData( text=desc, align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER)
def __setCarouselInitData(self): self.as_setCarouselInitS({ 'icoFilter': RES_ICONS.MAPS_ICONS_BUTTONS_FILTER, 'durationType': _getDurationTypeVO(), 'durationSelectIndex': 0, 'onlyPurchased': True, 'icoPurchased': RES_ICONS.MAPS_ICONS_FILTERS_PRESENCE, 'message': '{2}{0}\n{1}'.format( text_styles.neutral( VEHICLE_CUSTOMIZATION.CAROUSEL_MESSAGE_HEADER), text_styles.main( VEHICLE_CUSTOMIZATION.CAROUSEL_MESSAGE_DESCRIPTION), icons.makeImageTag( RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICONFILLED, vSpace=-3)), 'fitterTooltip': makeTooltip( VEHICLE_CUSTOMIZATION.CUSTOMIZATION_CAROUSEL_FILTER_HEADER, VEHICLE_CUSTOMIZATION.CUSTOMIZATION_CAROUSEL_FILTER_BODY), 'chbPurchasedTooltip': makeTooltip( VEHICLE_CUSTOMIZATION. CUSTOMIZATION_CAROUSEL_CHBPURCHASED_HEADER, VEHICLE_CUSTOMIZATION.CUSTOMIZATION_CAROUSEL_CHBPURCHASED_BODY) })
def _getOrConditionBlock(cls, conditions): items = [] conditionsCount = len(conditions) for idx, c in enumerate(conditions, start=1): items.append( formatters.packImageTextBlockData( title=c.title, img=c.icon, txtPadding=formatters.packPadding(left=-21), imgPadding=formatters.packPadding(top=-34), padding=formatters.packPadding(left=30), ignoreImageSize=True)) if idx < conditionsCount: items.append( formatters.packTextBlockData( text=text_styles.neutral( TOOLTIPS.VEHICLE_TEXTDELIMITER_OR), padding=formatters.packPadding(top=-7, bottom=-11, left=99))) return formatters.packBuildUpBlockData( blocks=items, linkage=BLOCKS_TOOLTIP_TYPES. TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE, padding=formatters.packPadding(top=-6, bottom=15), gap=13)
def _packBlocks(self, operationID, vehicleType): pmController = dependency.instance(IEventsCache).personalMissions operation = pmController.getOperations()[operationID] chainID, _ = operation.getChainByVehicleType(vehicleType) finalQuest = operation.getFinalQuests()[chainID] bonus = findFirst(lambda q: q.getName() == 'completionTokens', finalQuest.getBonuses('tokens')) formattedBonus = first(CompletionTokensBonusFormatter().format(bonus)) operationTitle = str(operation.getVehicleBonus().userName).replace( ' ', ' ') if finalQuest.isCompleted(): statusText = self.__getObtainedStatus() elif pmController.mayPawnQuest(finalQuest): statusText = self.__getAvailableStatus(finalQuest.getPawnCost()) else: statusText = self.__getNotObtainedStatus() vehIcon = RES_ICONS.vehicleTypeInactiveOutline(vehicleType) blocks = [ formatters.packImageTextBlockData( title=text_styles.highTitle(formattedBonus.userName), desc=text_styles.standard( _ms(PERSONAL_MISSIONS.OPERATIONTITLE_TITLE, title=operationTitle)), img=formattedBonus.getImage(AWARDS_SIZES.BIG), imgPadding=formatters.packPadding(right=20), txtPadding=formatters.packPadding(top=10)), formatters.packBuildUpBlockData( [ formatters.packImageTextBlockData( title=text_styles.main( _ms(PERSONAL_MISSIONS.TANKMODULETOOLTIPDATA_INFO, vehName=text_styles.neutral(operationTitle))), img=RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICONFILLED, imgPadding=formatters.packPadding( left=8, right=10, top=2)) ], linkage=BLOCKS_TOOLTIP_TYPES. TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE, padding=formatters.packPadding(top=-7, bottom=-3)) ] if not finalQuest.isCompleted(): blocks.append( formatters.packBuildUpBlockData([ formatters.packTextBlockData(text_styles.middleTitle( PERSONAL_MISSIONS.TANKMODULETOOLTIPDATA_HELP_TITLE), padding=formatters. packPadding(bottom=4)), formatters.packImageTextBlockData(title=text_styles.main( _ms(PERSONAL_MISSIONS.TANKMODULETOOLTIPDATA_HELP_BODY, vehType=_ms( PERSONAL_MISSIONS.chainNameByVehicleType( vehicleType)))), img=vehIcon, imgPadding=formatters. packPadding(right=2)) ])) blocks.append( formatters.packAlignedTextBlockData( text=statusText, align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER)) return blocks
def getDescription(self): vehicleNames = [] for vehCD in self.__vehicleDesrs: details = self.__getVehicleDetails(vehCD) vehicleNames.append( backport.text( self.__addProviderToRes( R.strings.menu.awardWindow.telecomAward.vehicles)(), **details)) vehicles = '\n'.join(vehicleNames) if self.__hasCrew: if self.__hasBrotherhood: descriptionRes = R.strings.menu.awardWindow.telecomAward.description.withBrotherhood else: descriptionRes = R.strings.menu.awardWindow.telecomAward.description.full else: descriptionRes = R.strings.menu.awardWindow.telecomAward.description.withoutCrew providerLocRes = R.strings.menu.internet_provider.dyn( self.__getProvider()) premText = text_styles.neutral( backport.text( self.__addProviderToRes( R.strings.menu.awardWindow.telecomAward.description.prem) ())) description = backport.text( self.__addProviderToRes(descriptionRes)(), tariff=backport.text(providerLocRes.tariff()) if providerLocRes else '', vehicles=vehicles, prem=premText) return text_styles.main(description)
def __getClanMemberWelcomeText(self, data): return "".join( ( text_styles.standard(i18n.makeString(FORTIFICATIONS.FORTWELCOMEVIEW_REQUIREMENTCOMMANDER)), text_styles.neutral(data.get("clanCommanderName", "")), ) )
def _getTimeText(self, serverInfo): if serverInfo: timeLeft = serverInfo.getTimeLeft() isAvailable = serverInfo.isAvailable() serverName = serverInfo.getName() else: _, timeLeft, isAvailable = self._getController().getPrimeTimeStatus() serverName = '' currentSeason = self._getController().getCurrentSeason() if currentSeason and not timeLeft: return '' if not timeLeft and not isAvailable and not currentSeason: nextSeason = self._getController().getNextSeason() if nextSeason: currTime = time_utils.getCurrentLocalServerTimestamp() primeTime = self._getController().getPrimeTimes().get(serverInfo.getPeripheryID()) startTime = primeTime.getNextPeriodStart(currTime, nextSeason.getEndDate()) if startTime: timeLeft = startTime - currTime else: self.destroy() return '' timeLeftStr = time_formatters.getTillTimeByResource(timeLeft, R.strings.menu.Time.timeValueShort) if isAvailable: stringR = R.strings.epic_battle.primeTime.primeIsAvailable() else: stringR = R.strings.epic_battle.primeTime.primeWillBeAvailable() return backport.text(stringR, server=serverName, time=text_styles.neutral(timeLeftStr))
def __updateStatus(self): if g_currentPreviewVehicle.isPresent(): if g_currentPreviewVehicle.isModified(): icon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICONFILLED, 16, 16, -3, 0) text = text_styles.neutral('%s %s' % (icon, _ms(VEHICLE_PREVIEW.MODULESPANEL_STATUS_TEXT))) else: text = text_styles.main(VEHICLE_PREVIEW.MODULESPANEL_LABEL) self.as_updateVehicleStatusS(text)
def __setFilterButtonStatus(self, isMax): if isMax: status = i18n.makeString(FORTIFICATIONS.FORTINTELLIGENCE_FORTINTELFILTER_FILTERBUTTONSTATUS_MAX) status = text_styles.disabled(status) else: status = i18n.makeString(FORTIFICATIONS.FORTINTELLIGENCE_FORTINTELFILTER_FILTERBUTTONSTATUS_MIN) status = text_styles.neutral(status) self.as_setFilterButtonStatusS(status, not isMax)
def __updateModulesType(self, modulesType): self.__currentModulesType = modulesType basketVehicle = getVehicleComparisonBasketCtrl().getVehicleAt(self.__vehIndex) if basketVehicle.isInInventory(): btnEnabled = modulesType != MODULES_TYPES.CURRENT else: btnEnabled = modulesType != MODULES_TYPES.BASIC self.as_setStateS(stateText=text_styles.neutral(_ms('#veh_compare:modulesView/moduleSet/{}'.format(modulesType))), stateEnabled=btnEnabled)
def __setCarouselInitData(self): self.as_setCarouselInitS({'icoFilter': RES_ICONS.MAPS_ICONS_BUTTONS_FILTER, 'durationType': _getDurationTypeVO(), 'durationSelectIndex': 0, 'onlyPurchased': True, 'icoPurchased': RES_ICONS.MAPS_ICONS_FILTERS_PRESENCE, 'message': '{2}{0}\n{1}'.format(text_styles.neutral(VEHICLE_CUSTOMIZATION.CAROUSEL_MESSAGE_HEADER), text_styles.main(VEHICLE_CUSTOMIZATION.CAROUSEL_MESSAGE_DESCRIPTION), icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICONFILLED, vSpace=-3)), 'fitterTooltip': makeTooltip(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_CAROUSEL_FILTER_HEADER, VEHICLE_CUSTOMIZATION.CUSTOMIZATION_CAROUSEL_FILTER_BODY), 'chbPurchasedTooltip': makeTooltip(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_CAROUSEL_CHBPURCHASED_HEADER, VEHICLE_CUSTOMIZATION.CUSTOMIZATION_CAROUSEL_CHBPURCHASED_BODY)})
def __setCarouselInitData(self): self.as_setCarouselInitS({'icoFilter': RES_ICONS.MAPS_ICONS_BUTTONS_FILTER, 'durationType': [self.__getDurationTypeVO('{0}{1}'.format(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_ALWAYS), icons.gold()), makeTooltip(_ms(TOOLTIPS.CUSTOMIZATION_CAROUSEL_DURATIONTYPE_HEADER, time=_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_ALWAYS)), _ms(TOOLTIPS.CUSTOMIZATION_CAROUSEL_DURATIONTYPE_BODY, time=_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_LOWERCASE_ALWAYS))), makeTooltip(_ms(TOOLTIPS.CUSTOMIZATION_CAROUSEL_DURATIONTYPE_HEADER, time=_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_ALWAYS)), VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_DISABLED)), self.__getDurationTypeVO('{0}{1}'.format(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_MONTH), icons.credits()), makeTooltip(_ms(TOOLTIPS.CUSTOMIZATION_CAROUSEL_DURATIONTYPE_HEADER, time=_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_MONTH)), _ms(TOOLTIPS.CUSTOMIZATION_CAROUSEL_DURATIONTYPE_BODY, time=_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_LOWERCASE_MONTH))), makeTooltip(_ms(TOOLTIPS.CUSTOMIZATION_CAROUSEL_DURATIONTYPE_HEADER, time=_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_MONTH)), VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_DISABLED)), self.__getDurationTypeVO('{0}{1}'.format(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_WEEK), icons.credits()), makeTooltip(_ms(TOOLTIPS.CUSTOMIZATION_CAROUSEL_DURATIONTYPE_HEADER, time=_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_WEEK)), _ms(TOOLTIPS.CUSTOMIZATION_CAROUSEL_DURATIONTYPE_BODY, time=_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_LOWERCASE_WEEK))), makeTooltip(_ms(TOOLTIPS.CUSTOMIZATION_CAROUSEL_DURATIONTYPE_HEADER, time=_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_WEEK)), VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTER_DURATION_DISABLED))], 'durationSelectIndex': 0, 'onlyPurchased': True, 'icoPurchased': RES_ICONS.MAPS_ICONS_FILTERS_PRESENCE, 'message': '{2}{0}\n{1}'.format(text_styles.neutral(VEHICLE_CUSTOMIZATION.CAROUSEL_MESSAGE_HEADER), text_styles.main(VEHICLE_CUSTOMIZATION.CAROUSEL_MESSAGE_DESCRIPTION), icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICONFILLED, 16, 16, -3, 0)), 'fitterTooltip': makeTooltip(TOOLTIPS.CUSTOMIZATION_CAROUSEL_FILTER_HEADER, TOOLTIPS.CUSTOMIZATION_CAROUSEL_FILTER_BODY), 'chbPurchasedTooltip': makeTooltip(TOOLTIPS.CUSTOMIZATION_CAROUSEL_CHBPURCHASED_HEADER, TOOLTIPS.CUSTOMIZATION_CAROUSEL_CHBPURCHASED_BODY)})
def __packStaffData(self, club, syncUserInfo = False): formatDate = BigWorld.wg_getShortDateFormat members = [] membersDict = club.getMembers() membersCount = len(membersDict) for dbID, member in membersDict.iteritems(): memberType = self.__getFlashMemberType(member) isSelf = dbID == self.__viewerDbID limits = self.clubsState.getLimits() profile = self.clubsCtrl.getProfile() memberStats = member.getTotalDossier().getRated7x7Stats() battlesCount = memberStats.getBattlesCount() rating = self.getUserRating(dbID) damageCoef = memberStats.getDamageEfficiency() or 0 avgDamage = memberStats.getAvgDamage() or 0 avgAssistDamage = memberStats.getDamageAssistedEfficiency() or 0 avgExperience = memberStats.getAvgXP() or 0 armorUsingEfficiency = memberStats.getArmorUsingEfficiency() or 0 joinDate = member.getJoiningTime() removeBtnTooltip = TOOLTIPS.STATICFORMATIONSTAFFVIEW_REMOVEMEMBERBTN if isSelf: removeBtnTooltip = TOOLTIPS.STATICFORMATIONSTAFFVIEW_REMOVEHIMSELFBTN members.append({'memberId': dbID, 'canRemoved': self.__canBeRemoved(profile, club, member, membersCount, limits), 'canPassOwnership': limits.canTransferOwnership(profile, club).success, 'canShowContextMenu': not isSelf, 'removeMemberBtnIcon': RES_ICONS.MAPS_ICONS_LIBRARY_CROSS, 'removeMemberBtnTooltip': removeBtnTooltip, 'appointmentSortValue': memberType, 'appointment': self.__packAppointment(profile, club, member, memberType, limits), 'ratingSortValue': rating, 'rating': text_styles.neutral(shared_fmts.getGlobalRatingFmt(rating)), 'battlesCountSortValue': battlesCount, 'battlesCount': text_styles.main(BigWorld.wg_getIntegralFormat(battlesCount)), 'damageCoefSortValue': damageCoef, 'damageCoef': text_styles.main(BigWorld.wg_getNiceNumberFormat(damageCoef)), 'avrDamageSortValue': avgDamage, 'avrDamage': text_styles.main(BigWorld.wg_getIntegralFormat(avgDamage)), 'avrAssistDamageSortValue': avgAssistDamage, 'avrAssistDamage': text_styles.main(BigWorld.wg_getNiceNumberFormat(avgAssistDamage)), 'avrExperienceSortValue': avgExperience, 'avrExperience': text_styles.main(BigWorld.wg_getIntegralFormat(avgExperience)), 'tauntSortValue': armorUsingEfficiency, 'taunt': text_styles.main(BigWorld.wg_getNiceNumberFormat(armorUsingEfficiency)), 'joinDateSortValue': joinDate, 'joinDate': text_styles.standard(formatDate(joinDate)), 'userDataSortValue': self.getUserFullName(dbID).lower(), 'userData': self.getGuiUserData(dbID), 'clubDbID': self._clubDbID}) members = sorted(members, key=lambda k: k['userDataSortValue'].lower()) if syncUserInfo: self.syncUsersInfo() return {'members': members}
def _getOrderDescription(self, order): if order.isSpecialMission: if order.inCooldown: award = i18n.makeString(FORTIFICATIONS.ORDERS_SPECIALMISSION_AWARD) + ' ' serverData = self.__getFortQuestBonusesStr() serverData += '\n' + i18n.makeString(FORTIFICATIONS.ORDERS_ORDERPOPOVER_SPECIALMISSION_SHORTDESCR) return ''.join((text_styles.neutral(award), text_styles.main(serverData))) else: return text_styles.main(i18n.makeString(FORTIFICATIONS.ORDERS_ORDERPOPOVER_SPECIALMISSION_DESCRIPTION)) else: return order.description
def description(self): from gui.Scaleform.daapi.view.lobby.fortifications.fort_utils.FortViewHelper import FortViewHelper if self.isSpecialMission: awardText = i18n.makeString(FORTIFICATIONS.ORDERS_SPECIALMISSION_POSSIBLEAWARD) + ' ' bonusDescr = i18n.makeString(FORTIFICATIONS.orders_specialmission_possibleaward_description_level(self.level)) return ''.join((text_styles.neutral(awardText), text_styles.main(bonusDescr))) elif self.isConsumable: return fort_formatters.getBonusText('', FortViewHelper.getBuildingUIDbyID(self.buildingID), ctx=dict(self.getParams())) else: effectValueStr = '+' + str(abs(self.effectValue)) return fort_formatters.getBonusText('%s%%' % effectValueStr, FortViewHelper.getBuildingUIDbyID(self.buildingID))
def __makeData(self): data = [] countIteration = 0 for item in TEXTS: if countIteration == 0 and not self.__isDefenceHourEnabled: item = FORTIFICATIONS.FORTINTELLIGENCE_HEADERBLOCKNODEFPERIOD data.extend(self.__getLocalize(item, countIteration)) countIteration += 1 if self.__isDefenceHourEnabled: data.append(text_styles.neutral(self.__getText(FORTIFICATIONS.FORTINTELLIGENCE_ADDITIONALTEXT_COMINGSOON))) self.as_setDataS(data)
def __getQuestStatusData(self, quest): if not quest.isUnlocked(): return (text_styles.standard(_ms(QUESTS.TILECHAINSVIEW_TASKTYPE_UNAVAILABLE_TEXT)), RES_ICONS.MAPS_ICONS_LIBRARY_CYBERSPORT_NOTAVAILABLEICON) if quest.needToGetReward(): return (text_styles.alert(_ms(QUESTS.TILECHAINSVIEW_TASKTYPE_AWARDNOTRECEIVED_TEXT)), RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICON) if quest.isInProgress(): return (text_styles.neutral(_ms(QUESTS.TILECHAINSVIEW_TASKTYPE_INPROGRESS_TEXT)), RES_ICONS.MAPS_ICONS_LIBRARY_INPROGRESSICON) if quest.isFullCompleted(): return (text_styles.statInfo(_ms(QUESTS.TILECHAINSVIEW_TASKTYPE_FULLCOMPLETED_TEXT)), RES_ICONS.MAPS_ICONS_LIBRARY_FORTIFICATION_CHECKMARK) if quest.isMainCompleted(): return (text_styles.statInfo(_ms(QUESTS.TILECHAINSVIEW_TASKTYPE_COMPLETED_TEXT)), RES_ICONS.MAPS_ICONS_LIBRARY_FORTIFICATION_CHECKMARK) return (text_styles.main(''), None)
def getHelpTextAsDicts(arenaType = None, arenaBonusType = None): pointsObjective = hasResourcePoints(arenaType, arenaBonusType) isMultiteam = getIsMultiteam() if pointsObjective: objectiveHead = neutral(FALLOUT.INFOPANEL_RESOURCEPOINTS_HEAD) objectiveDescr = main(FALLOUT.INFOPANEL_RESOURCEPOINTS_DESCR) else: objectiveHead = neutral(FALLOUT.INFOPANEL_GETFLAGS_HEAD) objectiveDescr = main(FALLOUT.INFOPANEL_GETFLAGS_DESCR) secretsWinHead = neutral(FALLOUT.INFOPANEL_SECRETWIN_HEAD) secretsWinDescr = main(FALLOUT.INFOPANEL_SECRETWIN_DESCR) repairHead = neutral(FALLOUT.INFOPANEL_REPAIR_HEAD) repairDescr = main(FALLOUT.INFOPANEL_REPAIR_DESCR) if isMultiteam: garageHead = neutral(FALLOUT.INFOPANEL_GARAGEMULTITEAM_HEAD) garageDescr = main(FALLOUT.INFOPANEL_GARAGEMULTITEAM_DESCR) else: garageHead = neutral(FALLOUT.INFOPANEL_GARAGE_HEAD) garageDescr = main(FALLOUT.INFOPANEL_GARAGE_DESCR) return [{'head': objectiveHead, 'descr': objectiveDescr}, {'head': secretsWinHead, 'descr': secretsWinDescr}, {'head': repairHead, 'descr': repairDescr}, {'head': garageHead, 'descr': garageDescr}]
def __makeVacationData(self): alertMessage = "" blockBtnEnabled = True daysBeforeVacation = -1 fort = self.fortCtrl.getFort() isVacationEnabled = fort.isVacationEnabled() inProcess, inCooldown = fort.getVacationProcessing() _, vacationEnd = fort.getVacationDate() blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNENABLED descriptionTooltip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONDESCRIPTION conditionPostfix = text_styles.standard( i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_VACATIONNOTPLANNED) ) if inProcess or inCooldown: blockBtnEnabled = False if fort.isOnVacation(): blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDISABLED daysBeforeVacation = -1 elif time_utils.getTimeDeltaFromNow(vacationEnd) != 0: blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDISABLED else: cooldownEnd = vacationEnd + g_fortCache.vacationCooldownTime daysBeforeVacation = time_utils.getTimeDeltaFromNow(cooldownEnd) / time_utils.ONE_DAY + 1 if daysBeforeVacation == 0: blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDSBLDLESSADAY daysBeforeVacation = -1 else: blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDISABLEDNOTPLANNED isVacationEnabled = False if isVacationEnabled: vacation = fort.getVacationDateTimeStr() if not self._isFortFrozen(): if not fort.isOnVacation(): conditionPostfix = text_styles.neutral(vacation) else: conditionPostfix = text_styles.success(vacation) else: conditionPostfix = text_styles.standard(vacation) conditionPrefix = text_styles.main(i18n.makeString(FORTIFICATIONS.settingswindow_blockcondition("vacation"))) blockDescr = text_styles.standard(i18n.makeString(FORTIFICATIONS.settingswindow_blockdescr("vacation"))) if alertMessage: alertMessage = icons.alert() + " " + alertMessage return { "blockBtnEnabled": blockBtnEnabled, "blockDescr": blockDescr, "blockCondition": conditionPrefix + " " + conditionPostfix, "alertMessage": alertMessage, "blockBtnToolTip": blockBtnToolTip, "daysBeforeVacation": daysBeforeVacation, "descriptionTooltip": descriptionTooltip, }
def __prepareOrderInfo(self, increment = False, orderCount = 0, orderLevel = 1): result = {} if self.intBuildingID == FORT_BUILDING_TYPE.MILITARY_BASE: if increment: building_bonus = i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_HEADER_LEVELSLBL, buildLevel=fort_formatters.getTextLevel(min(self.__baseBuildingLevel + 1, MAX_FORTIFICATION_LEVEL))) defresDescr = ''.join((text_styles.neutral(building_bonus + ' '), text_styles.main(i18n.makeString(FORTIFICATIONS.BUILDINGS_MODERNIZATIONDESCR_BASE_BUILDING)))) else: building_bonus = i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_HEADER_LEVELSLBL, buildLevel=fort_formatters.getTextLevel(self.__baseBuildingLevel)) defresDescr = ''.join((text_styles.standard(building_bonus + ' '), text_styles.standard(i18n.makeString(FORTIFICATIONS.BUILDINGS_MODERNIZATIONDESCR_BASE_BUILDING)))) else: orderTypeID = self.fortCtrl.getFort().getBuildingOrder(self.intBuildingID) _, _, foundedLevel, orderData = self.fortCtrl.getFort().getOrderData(orderTypeID) if increment: bodyStyle = text_styles.main bonusStyle = text_styles.neutral foundedLevel += 1 _, _, _, orderData = self.fortCtrl.getFort().getOrderData(orderTypeID, foundedLevel) textPadding = ' ' else: bodyStyle = text_styles.standard bonusStyle = text_styles.standard textPadding = '' if orderTypeID == FORT_ORDER_TYPE.SPECIAL_MISSION: awardText = textPadding + i18n.makeString(FORTIFICATIONS.ORDERS_SPECIALMISSION_POSSIBLEAWARD) + ' ' bonusDescr = i18n.makeString(FORTIFICATIONS.orders_specialmission_possibleaward_description_level(foundedLevel)) defresDescr = ''.join((bonusStyle(awardText), bodyStyle(bonusDescr))) elif orderTypeID in FORT_ORDER_TYPE.CONSUMABLES: battleOrder = FortOrder(orderTypeID, level=orderLevel) defresDescr = fort_formatters.getBonusText(textPadding, self.__uid, ctx=dict(battleOrder.getParams()), textsStyle=(bonusStyle, bodyStyle)) else: colorStyle = (bonusStyle, bodyStyle) bonus = str(abs(orderData.effectValue)) defresDescr = fort_formatters.getBonusText('%s+%s%%' % (textPadding, bonus), self.__uid, colorStyle) result['ordersCount'] = orderCount result['description'] = defresDescr result['buildingType'] = self.__uid result['showAlertIcon'] = False isCombatOrderBuilding = self.__uid in [FORTIFICATION_ALIASES.FORT_ARTILLERY_SHOP_BUILDING, FORTIFICATION_ALIASES.FORT_BOMBER_SHOP_BUILDING] result['descriptionLink'] = increment and isCombatOrderBuilding if self.__uid != FORTIFICATION_ALIASES.FORT_BASE_BUILDING: order = self.fortCtrl.getFort().getOrder(self._buildingDescr.typeRef.orderType) result['iconSource'] = order.icon result['iconLevel'] = order.level if not increment else order.level + 1 if increment and self.__uid != FORTIFICATION_ALIASES.FORT_BASE_BUILDING: result['infoIconSource'] = RES_ICONS.MAPS_ICONS_LIBRARY_INFORMATIONICON toolTipData = {} toolTipData['header'] = i18n.makeString(TOOLTIPS.FORTIFICATION_DEFRESICONINFO_HEADER) toolTipData['body'] = i18n.makeString(TOOLTIPS.FORTIFICATION_DEFRESICONINFO_BODY, testData='test py var') result['infoIconToolTipData'] = toolTipData return result
def _packBlocks(self, role): blocks = [] bodyStr = '%s/%s' % (TOOLTIPS.VEHICLEPREVIEW_CREW, role) crewParams = [ text_styles.neutral(param) for param in _CREW_TOOLTIP_PARAMS[role] ] blocks.append(formatters.packTitleDescBlock(text_styles.highTitle(ITEM_TYPES.tankman_roles(role)), text_styles.main(_ms(bodyStr, *crewParams)))) vehicle = self.context.getVehicle() for idx, tankman in vehicle.crew: if tankman.role == role: otherRoles = list(vehicle.descriptor.type.crewRoles[idx]) otherRoles.remove(tankman.role) if otherRoles: rolesStr = ', '.join([ text_styles.stats(_ms(ITEM_TYPES.tankman_roles(r))) for r in otherRoles ]) blocks.append(formatters.packTextBlockData(text_styles.main(_ms(TOOLTIPS.VEHICLEPREVIEW_CREW_ADDITIONALROLES, roles=rolesStr)))) return blocks
def getDescription(self): vehicleNames = [] for vehCD in self.__vehicleDesrs: details = self.__getVehicleDetails(vehCD) vehicleNames.append(i18n.makeString(MENU.AWARDWINDOW_TELECOMAWARD_VEHICLES, **details)) vehicles = '\n'.join(vehicleNames) if self.__hasCrew: if self.__hasBrotherhood: descriptionKey = MENU.AWARDWINDOW_TELECOMAWARD_DESCRIPTION_WITHBROTHERHOOD else: descriptionKey = MENU.AWARDWINDOW_TELECOMAWARD_DESCRIPTION else: descriptionKey = MENU.AWARDWINDOW_TELECOMAWARD_DESCRIPTION_WITHOUTCREW premText = text_styles.neutral(MENU.AWARDWINDOW_TELECOMAWARD_DESCRIPTION_PREM) description = i18n.makeString(descriptionKey, vehicles=vehicles, prem=premText) return text_styles.main(description)
def construct(self): block = [] headerBlocks = [] if self.vehicle.isElite: vehicleType = TOOLTIPS.tankcaruseltooltip_vehicletype_elite(self.vehicle.type) bgLinkage = BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_ELITE_VEHICLE_BG_LINKAGE else: vehicleType = TOOLTIPS.tankcaruseltooltip_vehicletype_normal(self.vehicle.type) bgLinkage = BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_NORMAL_VEHICLE_BG_LINKAGE nameStr = text_styles.highTitle(self.vehicle.userName) typeStr = text_styles.main(vehicleType) levelStr = text_styles.concatStylesWithSpace(text_styles.stats(int2roman(self.vehicle.level)), text_styles.standard(_ms(TOOLTIPS.VEHICLE_LEVEL))) icon = '../maps/icons/vehicleTypes/big/' + self.vehicle.type + ('_elite.png' if self.vehicle.isElite else '.png') headerBlocks.append(formatters.packImageTextBlockData(title=nameStr, desc=text_styles.concatStylesToMultiLine(levelStr + ' ' + typeStr, ''), img=icon, imgPadding=formatters.packPadding(left=10, top=-15), txtGap=-2, txtOffset=99, padding=formatters.packPadding(top=15, bottom=-15 if self.vehicle.isFavorite else -21))) if self.vehicle.isFavorite: headerBlocks.append(formatters.packImageTextBlockData(title=text_styles.neutral(TOOLTIPS.VEHICLE_FAVORITE), img=RES_ICONS.MAPS_ICONS_TOOLTIP_MAIN_TYPE, imgPadding=formatters.packPadding(top=-15), imgAtLeft=False, txtPadding=formatters.packPadding(left=10), txtAlign=BLOCKS_TOOLTIP_TYPES.ALIGN_RIGHT, padding=formatters.packPadding(top=-28, bottom=-27))) block.append(formatters.packBuildUpBlockData(headerBlocks, stretchBg=False, linkage=bgLinkage, padding=formatters.packPadding(left=-self.leftPadding))) return block
def __makeOffDayData(self): alertMessage = "" blockBtnEnabled = True fort = self.fortCtrl.getFort() inProcess, inCooldown = fort.getOffDayProcessing() dayOff = fort.getOffDayStr() if self._isFortFrozen(): conditionPostfix = text_styles.standard(dayOff) else: conditionPostfix = text_styles.neutral(dayOff) blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_WEEKENDBTNENABLED descriptionTooltip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DAYOFFDESCRIPTION if inProcess: offDayChangeDate, nextOffDayUTC, _ = fort.events[FORT_EVENT_TYPE.OFF_DAY_CHANGE] nextOffDayLocal = adjustOffDayToLocal(nextOffDayUTC, self.fortCtrl.getFort().getLocalDefenceHour()[0]) if nextOffDayLocal > NOT_ACTIVATED: value = i18n.makeString(MENU.datetime_weekdays_full(str(nextOffDayLocal + 1))) else: value = i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_NOWEEKEND) msgString = i18n.makeString( FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_INPROGRESS, value=value, date=BigWorld.wg_getLongDateFormat(offDayChangeDate), ) alertMessage = text_styles.alert(msgString) blockBtnEnabled = False blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_WEEKENDBTNDISABLED elif inCooldown: msgString = i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_RECENTLYSCHEDULED) alertMessage = text_styles.alert(msgString) blockBtnEnabled = False blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_WEEKENDBTNDISABLED conditionPrefix = text_styles.main(i18n.makeString(FORTIFICATIONS.settingswindow_blockcondition("weekEnd"))) blockDescr = text_styles.standard(i18n.makeString(FORTIFICATIONS.settingswindow_blockdescr("weekEnd"))) if alertMessage: alertMessage = icons.alert() + " " + alertMessage return { "blockBtnEnabled": blockBtnEnabled, "blockDescr": blockDescr, "blockCondition": conditionPrefix + " " + conditionPostfix, "alertMessage": alertMessage, "blockBtnToolTip": blockBtnToolTip, "descriptionTooltip": descriptionTooltip, }
def _makeVO(self, province): isRobbed = self.__isRobbed(province) result = { "front": "%s %s" % ( self.__getFront(province), text_styles.standard(formatField(province.getFrontLevel, formatter=fort_formatters.getTextLevel)), ), "province": self.__getProvinceName(province), "map": self.__getMap(province), "primeTime": text_styles.main(province.getUserPrimeTime()), "days": text_styles.main(BigWorld.wg_getIntegralFormat(self.__getDays(province))), "isRobbed": isRobbed, } if isRobbed: restoreTime = province.getPillageEndDatetime() result.update( { "robbedTooltip": makeTooltip( None, text_styles.concatStylesToMultiLine( text_styles.main(_ms(CLANS.GLOBALMAPVIEW_TABLE_PROVINCEROBBED_TOOLTIP_NOINCOME)), text_styles.neutral( _ms( CLANS.GLOBALMAPVIEW_TABLE_PROVINCEROBBED_TOOLTIP_RESTORETIME, date=text_styles.main(formatters.formatShortDateShortTimeString(restoreTime)), ) ), ), ) } ) if self.__showTreasuryData: result.update( { "income": text_styles.gold(BigWorld.wg_getIntegralFormat(self.__getIncome(province))), "noIncomeIconVisible": not province.isHqConnected() or isRobbed, "noIncomeTooltip": CLANS.GLOBALMAPVIEW_NOINCOME_TOOLTIP, } ) return result
def __getTexts(self): ms = i18n.makeString percentText = text_styles.neutral(ms(MENU.SKILLDROPWINDOW_FREEDROPPERCENT)) freeDropText = text_styles.main(ms(MENU.SKILLDROPWINDOW_FREEDROPLABEL, percent=percentText)) return {'freeDrop': freeDropText}