def _buildSupplyItems(self): self._supplyItems = [] items = self._itemsCache.items slots = items.stats.vehicleSlots vehicles = self.getTotalVehiclesCount() slotPrice = items.shop.getVehicleSlotsPrice(slots) defaultSlotPrice = items.shop.defaults.getVehicleSlotsPrice(slots) if slotPrice != defaultSlotPrice: discount = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'slotsPrices', True, Money(gold=slotPrice), Money(gold=defaultSlotPrice)) else: discount = None self._emptySlotsCount = slots - vehicles smallBuySlotString, buySlotString = getStatusStrings('buySlot') smallBuyTankString, buyTankString = getStatusStrings('buyTank') smallEmptySlotsString, emptySlotsString = getStatusStrings('buyTankEmptyCount', style=text_styles.main, ctx={'count': self._emptySlotsCount}) self._supplyItems.append({'buyTank': True, 'smallInfoText': text_styles.concatStylesToMultiLine(smallBuyTankString, smallEmptySlotsString), 'infoText': text_styles.concatStylesToMultiLine(buyTankString, emptySlotsString), 'icon': RES_ICONS.MAPS_ICONS_LIBRARY_TANKITEM_BUY_TANK, 'tooltip': TOOLTIPS.TANKS_CAROUSEL_BUY_VEHICLE}) buySlotVO = {'buySlot': True, 'slotPrice': slotPrice, 'icon': RES_ICONS.MAPS_ICONS_LIBRARY_TANKITEM_BUY_SLOT, 'infoText': buySlotString, 'smallInfoText': smallBuySlotString, 'hasSale': discount is not None, 'tooltip': TOOLTIPS.TANKS_CAROUSEL_BUY_SLOT} if discount is not None: buySlotVO.update({'slotPriceActionData': discount}) self._supplyItems.append(buySlotVO) return
def _makeLockBlock(self): clanLockTime = self.vehicle.clanLock if clanLockTime and clanLockTime <= time_utils.getCurrentTimestamp(): LOG_DEBUG("clan lock time is less than current time: %s" % clanLockTime) clanLockTime = None isDisabledInRoaming = self.vehicle.isDisabledInRoaming if clanLockTime or isDisabledInRoaming: headerLock = text_styles.concatStylesToMultiLine(text_styles.warning(_ms(TOOLTIPS.TANKCARUSEL_LOCK_HEADER))) if isDisabledInRoaming: textLock = text_styles.main(_ms(TOOLTIPS.TANKCARUSEL_LOCK_ROAMING)) else: time = time_utils.getDateTimeFormat(clanLockTime) timeStr = text_styles.main(text_styles.concatStylesWithSpace(_ms(TOOLTIPS.TANKCARUSEL_LOCK_TO), time)) textLock = text_styles.concatStylesToMultiLine( timeStr, text_styles.main(_ms(TOOLTIPS.TANKCARUSEL_LOCK_CLAN)) ) lockHeaderBlock = formatters.packTextBlockData( headerLock, padding=formatters.packPadding(left=77 + self.leftPadding, top=5) ) lockTextBlock = formatters.packTextBlockData( textLock, padding=formatters.packPadding(left=77 + self.leftPadding) ) return formatters.packBuildUpBlockData( [lockHeaderBlock, lockTextBlock], stretchBg=False, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LOCK_BG_LINKAGE, padding=formatters.packPadding(left=-17, top=20, bottom=0), ) else: return return
def _buildSupplyItems(self): self._supplyItems = [] items = self._itemsCache.items slots = items.stats.vehicleSlots vehicles = len(items.getVehicles(REQ_CRITERIA.INVENTORY)) slotPrice = items.shop.getVehicleSlotsPrice(slots) defaultSlotPrice = items.shop.defaults.getVehicleSlotsPrice(slots) if slotPrice != defaultSlotPrice: sale = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'slotsPrices', True, Money(gold=slotPrice), Money(gold=defaultSlotPrice)) else: sale = None self._emptySlotsCount = slots - vehicles smallBuySlotString, buySlotString = _getStatusStrings('buySlot') smallBuyTankString, buyTankString = _getStatusStrings('buyTank') smallEmptySlotsString, emptySlotsString = _getStatusStrings('buyTankEmptyCount', style=text_styles.main, ctx={'count': self._emptySlotsCount}) self._supplyItems.append({'buyTank': True, 'smallInfoText': text_styles.concatStylesToMultiLine(smallBuyTankString, smallEmptySlotsString), 'infoText': text_styles.concatStylesToMultiLine(buyTankString, emptySlotsString), 'icon': RES_ICONS.MAPS_ICONS_LIBRARY_TANKITEM_BUY_TANK}) buySlotVO = {'buySlot': True, 'slotPrice': slotPrice, 'icon': RES_ICONS.MAPS_ICONS_LIBRARY_TANKITEM_BUY_SLOT, 'infoText': buySlotString, 'smallInfoText': smallBuySlotString, 'hasSale': sale is not None} if sale is not None: buySlotVO.update({'slotPriceActionData': sale}) self._supplyItems.append(buySlotVO) return
def _makeRequestTooltip(self, status, date, user=None): if status == CLAN_INVITE_STATES.ACCEPTED: return text_styles.concatStylesToMultiLine( text_styles.standard( _ms(CLANS.CLANINVITESWINDOW_TOOLTIPS_INVITE_INVITEACCEPTED) ), text_styles.main(date), text_styles.main(''), text_styles.standard( _ms(CLANS.CLANINVITESWINDOW_TOOLTIPS_INVITE_BYUSER)), text_styles.stats(user)) if status == CLAN_INVITE_STATES.DECLINED or status == CLAN_INVITE_STATES.DECLINED_RESENT: return text_styles.concatStylesToMultiLine( text_styles.standard( _ms(CLANS.CLANINVITESWINDOW_TOOLTIPS_INVITE_INVITEDECLINED) ), text_styles.main(date), text_styles.main(''), text_styles.standard( _ms(CLANS.CLANINVITESWINDOW_TOOLTIPS_INVITE_BYUSER)), text_styles.stats(user)) if status == CLAN_INVITE_STATES.ACTIVE or status == CLAN_INVITE_STATES.EXPIRED or status == CLAN_INVITE_STATES.EXPIRED_RESENT: return text_styles.concatStylesToMultiLine( text_styles.standard( _ms(CLANS.CLANINVITESWINDOW_TOOLTIPS_INVITE_INVITESENT)), text_styles.main(date), text_styles.main(''), text_styles.standard( _ms(CLANS.CLANINVITESWINDOW_TOOLTIPS_INVITE_SENDER)), text_styles.stats(user))
def _makeRequestTooltip(self, status, date, user = None): if status == CLAN_INVITE_STATES.ACCEPTED: return text_styles.concatStylesToMultiLine(text_styles.standard(_ms(CLANS.CLANINVITESWINDOW_TOOLTIPS_INVITE_INVITEACCEPTED)), text_styles.main(date), text_styles.main(''), text_styles.standard(_ms(CLANS.CLANINVITESWINDOW_TOOLTIPS_INVITE_BYUSER)), text_styles.stats(user)) if status == CLAN_INVITE_STATES.DECLINED or status == CLAN_INVITE_STATES.DECLINED_RESENT: return text_styles.concatStylesToMultiLine(text_styles.standard(_ms(CLANS.CLANINVITESWINDOW_TOOLTIPS_INVITE_INVITEDECLINED)), text_styles.main(date), text_styles.main(''), text_styles.standard(_ms(CLANS.CLANINVITESWINDOW_TOOLTIPS_INVITE_BYUSER)), text_styles.stats(user)) if status == CLAN_INVITE_STATES.ACTIVE or status == CLAN_INVITE_STATES.EXPIRED or status == CLAN_INVITE_STATES.EXPIRED_RESENT: return text_styles.concatStylesToMultiLine(text_styles.standard(_ms(CLANS.CLANINVITESWINDOW_TOOLTIPS_INVITE_INVITESENT)), text_styles.main(date), text_styles.main(''), text_styles.standard(_ms(CLANS.CLANINVITESWINDOW_TOOLTIPS_INVITE_SENDER)), text_styles.stats(user))
def __getMultiselectionStatus(self): config = self._falloutCtrl.getConfig() battleType = self._falloutCtrl.getBattleType() messageTemplate = '#fallout:multiselectionSlot/{}'.format(battleType) if not config.hasRequiredVehicles(): return (False, text_styles.critical(i18n.makeString('{}/topTierVehicleRequired'.format(messageTemplate), level=toRomanRangeString(config.allowedLevels, step=1), requiredLevel=int2roman(config.vehicleLevelRequired)))) if self._falloutCtrl.getSelectedVehicles(): return (True, text_styles.concatStylesToMultiLine(text_styles.middleTitle(i18n.makeString('#fallout:multiselectionSlot/selectionStatus')), text_styles.main(i18n.makeString('#fallout:multiselectionSlot/selectionRequirements', level=toRomanRangeString(config.allowedLevels, step=1))))) if config.getAllowedVehicles(): return (False, text_styles.concatStylesToMultiLine(text_styles.highTitle(i18n.makeString('{}/descriptionTitle'.format(messageTemplate), topLevel=int2roman(max(config.allowedLevels)))), text_styles.main(i18n.makeString('{}/message'.format(messageTemplate), level=toRomanRangeString(config.allowedLevels, step=1))))) return (False, '')
def _update(self): if g_currentPreviewVehicle.isPresent(): item = g_currentPreviewVehicle.item if item.buyPrices.itemPrice.defPrice.get(Currency.GOLD): maxDescriptionLength = _MAX_LENGTH_FULL_DESCRIPTION_WITH_KPI bonuses = [{ 'icon': RES_SHOP.MAPS_SHOP_KPI_STAR_ICON_BENEFITS, 'title': text_styles.concatStylesToMultiLine( text_styles.highTitle( VEHICLE_PREVIEW.INFOPANEL_PREMIUM_FREEEXPMULTIPLIER ), text_styles.main( VEHICLE_PREVIEW.INFOPANEL_PREMIUM_FREEEXPTEXT)) }, { 'icon': RES_SHOP.MAPS_SHOP_KPI_CROW_BENEFITS, 'title': text_styles.concatStylesToMultiLine( text_styles.highTitle( VEHICLE_PREVIEW.INFOPANEL_PREMIUM_CREWTRANSFERTITLE ), text_styles.main(VEHICLE_PREVIEW. INFOPANEL_PREMIUM_CREWTRANSFERTEXT)) }] if not item.isSpecial: bonuses.insert( 1, { 'icon': RES_SHOP.MAPS_SHOP_KPI_MONEY_BENEFITS, 'title': text_styles.concatStylesToMultiLine( text_styles.highTitle( VEHICLE_PREVIEW. INFOPANEL_PREMIUM_CREDITSMULTIPLIER), text_styles.main( VEHICLE_PREVIEW. INFOPANEL_PREMIUM_CREDITSTEXT)) }) else: maxDescriptionLength = _MAX_LENGTH_FULL_DESCRIPTION_NO_KPI bonuses = None description = item.fullDescription.decode('utf-8') hasTooltip = len(description) > maxDescriptionLength if hasTooltip: description = description[:maxDescriptionLength - 3] + '...' self.as_setDataS(text_styles.main(description), hasTooltip, bonuses) return
def _update(self): if g_currentPreviewVehicle.isPresent(): item = g_currentPreviewVehicle.item isPremium = item.isPremium and (not item.isHidden or item.isRentable or item.isRestorePossible()) if isPremium or self.__isHeroTank: maxDescriptionLength = _MAX_LENGTH_FULL_DESCRIPTION_WITH_KPI bonuses = [{ 'icon': RES_SHOP.MAPS_SHOP_KPI_STAR_ICON_BENEFITS, 'title': text_styles.concatStylesToMultiLine( text_styles.highTitle( VEHICLE_PREVIEW.INFOPANEL_PREMIUM_FREEEXPMULTIPLIER ), text_styles.main( VEHICLE_PREVIEW.INFOPANEL_PREMIUM_FREEEXPTEXT)) }, { 'icon': RES_SHOP.MAPS_SHOP_KPI_MONEY_BENEFITS, 'title': text_styles.concatStylesToMultiLine( text_styles.highTitle( VEHICLE_PREVIEW.INFOPANEL_PREMIUM_CREDITSMULTIPLIER ), text_styles.main( VEHICLE_PREVIEW.INFOPANEL_PREMIUM_CREDITSTEXT)) }, { 'icon': RES_SHOP.MAPS_SHOP_KPI_CROW_BENEFITS, 'title': text_styles.concatStylesToMultiLine( text_styles.highTitle( VEHICLE_PREVIEW.INFOPANEL_PREMIUM_CREWTRANSFERTITLE ), text_styles.main(VEHICLE_PREVIEW. INFOPANEL_PREMIUM_CREWTRANSFERTEXT)) }] else: maxDescriptionLength = _MAX_LENGTH_FULL_DESCRIPTION_NO_KPI bonuses = None description = item.fullDescription.decode('utf-8') hasTooltip = len(description) > maxDescriptionLength if hasTooltip: description = description[:maxDescriptionLength - 3] + '...' self.as_setDataS(text_styles.main(description), hasTooltip, bonuses) return
def update(self, *args): self._personalQuestID = None if self._currentVehicle.isPresent(): vehicle = self._currentVehicle.item from gui.shared.formatters import text_styles from gui.Scaleform.locale.MENU import MENU from bootcamp.Bootcamp import g_bootcamp headerVO = { 'tankType': '{}_elite'.format(vehicle.type) if vehicle.isElite else vehicle.type, 'tankInfo': text_styles.concatStylesToMultiLine( text_styles.promoSubTitle(vehicle.shortUserName), text_styles.stats(MENU.levels_roman(vehicle.level))), 'isPremIGR': vehicle.isPremiumIGR, 'isVisible': True } headerVO.update(self.getFakeQuestData()) headerVO.update(self.getFakeQuestData()) else: headerVO = {'isVisible': False} self.as_setDataS(headerVO) return
def _makePriceBlock(self, price, currencySetting, neededValue = None, oldPrice = None, percent = 0): needFormatted = '' oldPriceText = '' hasAction = percent != 0 settings = getCurrencySetting(currencySetting) if settings is None: return else: valueFormatted = settings.textStyle(_int(price)) icon = settings.icon if neededValue is not None: needFormatted = settings.textStyle(_int(neededValue)) if hasAction: oldPriceText = text_styles.concatStylesToSingleLine(icon, settings.textStyle(_int(oldPrice))) neededText = '' if neededValue is not None: neededText = text_styles.concatStylesToSingleLine(text_styles.main('('), text_styles.error(TOOLTIPS.VEHICLE_GRAPH_BODY_NOTENOUGH), ' ', needFormatted, ' ', icon, text_styles.main(')')) text = text_styles.concatStylesWithSpace(text_styles.main(settings.text), neededText) if hasAction: actionText = text_styles.main(_ms(TOOLTIPS.VEHICLE_ACTION_PRC, actionPrc=text_styles.stats(str(percent) + '%'), oldPrice=oldPriceText)) text = text_styles.concatStylesToMultiLine(text, actionText) if settings.frame == ICON_TEXT_FRAMES.GOLD: newPrice = (0, price) else: newPrice = (price, 0) return formatters.packSaleTextParameterBlockData(name=text, saleData={'newPrice': newPrice, 'valuePadding': -8}, actionStyle='alignTop', padding=formatters.packPadding(left=92)) return formatters.packTextParameterWithIconBlockData(name=text, value=valueFormatted, icon=settings.frame, valueWidth=self._valueWidth, padding=formatters.packPadding(left=-5)) return
def __buildActionsSection(self, inviteStatus): acceptButtonEnabled = False declineButtonEnabled = False acceptButtonVisible = False declineButtonVisible = False acceptButtonTooltip = None clanHasFreeSpaces = True clanAcceptJoinRequests = True if inviteStatus == CLAN_INVITE_STATES.ACTIVE: declineButtonVisible = True acceptButtonVisible = True declineButtonEnabled = self.isActionsAllowed() if not clanAcceptJoinRequests: acceptButtonTooltip = CLANS.CLANINVITESWINDOW_HEADER_TOOLTIPS_RECRUITEMENTSTOPPED elif not clanHasFreeSpaces: acceptButtonTooltip = CLANS.CLANINVITESWINDOW_TOOLTIPS_TABLE_CANTSENDINVITE_BODY else: accProfile = self.clansCtrl.getAccountProfile() if accProfile.isInClanEnterCooldown(): acceptButtonTooltip = _ms(text_styles.concatStylesToMultiLine(text_styles.standard(_ms(CLANS.CLANPERSONALINVITESWINDOW_TOOLTIPS_TABLE_CANTACCEPTREQUESTDUETOCD_BODY)), text_styles.main(formatters.formatShortDateShortTimeString(accProfile.getClanCooldownTill())))) else: acceptButtonEnabled = self.isActionsAllowed() return {'acceptButtonEnabled': acceptButtonEnabled, 'declineButtonEnabled': declineButtonEnabled, 'acceptButtonVisible': acceptButtonVisible, 'declineButtonVisible': declineButtonVisible, 'acceptButtonTooltip': self._makeTooltip(body=_ms(acceptButtonTooltip))}
def makeStatusLabel(self): isWin = self._reusable.getPersonalTeam( ) == self._reusable.common.winnerTeam rankState = self.getRankChangeStatus() rankInfo = self._reusable.personal.getRankInfo() shieldState = rankInfo.shieldState resultLabel = backport.text(self._STATUS_LABEL_MAP[rankState]) resultSubLabel = '' if rankState in (_RCS.LEAGUE_EARNED, _RCS.DIVISION_EARNED, _RCS.QUAL_EARNED, _RCS.QUAL_UNBURN_EARNED): return '' if rankState == _RCS.NOTHING_CHANGED and isWin: resultLabel = backport.text( R.strings.ranked_battles.battleresult.status.stageNotEarned()) if shieldState == RANKEDBATTLES_ALIASES.SHIELD_LOSE: resultLabel = backport.text( R.strings.ranked_battles.battleresult.status.shieldLose()) resultSubLabel = backport.text( R.strings.ranked_battles.battleresult.status.shieldWarning()) if shieldState == RANKEDBATTLES_ALIASES.SHIELD_LOSE_STEP: resultSubLabel = backport.text( R.strings.ranked_battles.battleresult.status.shieldCount(), count=text_styles.highTitle(rankInfo.shieldHP)) if shieldState in RANKEDBATTLES_ALIASES.SHIELD_RENEW_STATES: resultSubLabel = backport.text( R.strings.ranked_battles.battleresult.status.shieldRenew()) return text_styles.concatStylesToMultiLine( text_styles.heroTitle(resultLabel), text_styles.promoSubTitle(resultSubLabel))
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 _makePriceBlock(self, price, text, currencyType, neededValue = None, oldPrice = None, percent = 0): needFormatted = '' oldPriceText = '' hasAction = percent != 0 if currencyType == ICON_TEXT_FRAMES.CREDITS: valueFormatted = text_styles.credits(_int(price)) icon = icons.credits() if neededValue is not None: needFormatted = text_styles.credits(_int(neededValue)) if hasAction: oldPriceText = text_styles.concatStylesToSingleLine(icons.credits(), text_styles.credits(_int(oldPrice))) elif currencyType == ICON_TEXT_FRAMES.GOLD: valueFormatted = text_styles.gold(_int(price)) icon = icons.gold() if neededValue is not None: needFormatted = text_styles.gold(_int(neededValue)) if hasAction: oldPriceText = text_styles.concatStylesToSingleLine(icons.gold(), text_styles.gold(_int(oldPrice))) elif currencyType == ICON_TEXT_FRAMES.XP: valueFormatted = text_styles.expText(_int(price)) icon = icons.xp() if neededValue is not None: needFormatted = text_styles.expText(_int(neededValue)) else: LOG_ERROR('Unsupported currency type "' + currencyType + '"!') return neededText = '' if neededValue is not None: neededText = text_styles.concatStylesToSingleLine(text_styles.main('( '), text_styles.error(TOOLTIPS.VEHICLE_GRAPH_BODY_NOTENOUGH), ' ', needFormatted, ' ', icon, text_styles.main(' )')) text = text_styles.concatStylesWithSpace(text_styles.main(text), neededText) if hasAction: actionText = text_styles.main(_ms(TOOLTIPS.VEHICLE_ACTION_PRC, actionPrc=text_styles.stats(str(percent) + '%'), oldPrice=oldPriceText)) text = text_styles.concatStylesToMultiLine(text, actionText) return formatters.packTextParameterWithIconBlockData(name=text, value=valueFormatted, icon=currencyType, valueWidth=self._valueWidth, padding=formatters.packPadding(left=self.leftPadding, right=20))
def _getRestoreBannerStr(param): return text_styles.concatStylesToMultiLine( text_styles.mainBig( backport.text(R.strings.menu.research.restore.commmonInfo())), text_styles.mainBig( backport.text(R.strings.menu.research.restore.dueDate(), date=param)))
def __packDailyCount(self, dailyCount, income): dailyTitle = backport.text(R.strings.tooltips.battleTypes.ranked.bonusBattle.daily.title()) dailyBody = text_styles.standard(backport.text(R.strings.tooltips.battleTypes.ranked.bonusBattle.daily.bodyOther())) if income > 0: incomeStr = backport.text(R.strings.tooltips.battleTypes.ranked.bonusBattle.daily.bodyIncome(), income=income) dailyBody = text_styles.concatStylesToMultiLine(text_styles.standard(incomeStr), dailyBody) return formatters.packBuildUpBlockData([formatters.packTitleDescParameterWithIconBlockData(title=text_styles.concatStylesToMultiLine(text_styles.middleTitle(dailyTitle), dailyBody), value=text_styles.promoSubTitle(dailyCount), padding=formatters.packPadding(top=-11, left=48, bottom=-5), titlePadding=formatters.packPadding(top=9, left=34))], linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE)
def update(self, *args): self._personalQuestID = None if self._currentVehicle.isPresent(): vehicle = self._currentVehicle.item if self._questController.isNewbiePlayer(): tutorialChapters = self._getTutorialChapters() else: tutorialChapters = None headerVO = { 'tankType': '{}_elite'.format(vehicle.type) if vehicle.isElite else vehicle.type, 'tankInfo': text_styles.concatStylesToMultiLine( text_styles.promoSubTitle(vehicle.shortUserName), text_styles.stats(MENU.levels_roman(vehicle.level))), 'isPremIGR': vehicle.isPremiumIGR, 'isVisible': True, 'isBeginner': bool(tutorialChapters) } if tutorialChapters: headerVO.update(self.__getBeginnerQuestsVO(tutorialChapters)) else: headerVO.update(self.__getBattleQuestsVO(vehicle)) headerVO.update(self.__getPersonalQuestsVO(vehicle)) else: headerVO = {'isVisible': False} self.as_setDataS(headerVO) return
def conclusion(self, group, event, requirements, passed, total): """ Format the requirement header. """ if group.isAvailable(): icon = '' style = text_styles.standard header = '#quests:missionDetails/requirements/header/available' else: icon = (icons.makeImageTag( RES_ICONS.MAPS_ICONS_LIBRARY_MARKER_BLOCKED, width=14, height=14, vSpace=-1, hSpace=-2), ) style = text_styles.error header = '#quests:missionDetails/requirements/header/unavailable' result = [] for condition in group.getSortedItems(): fmt = self.getConditionFormatter(condition.getName()) if fmt: branch = fmt.format(condition, event, self._styler) result.extend(branch) result = (branch.get('text') for branch in result) reason = text_styles.concatStylesToMultiLine(*result) return text_styles.concatStylesWithSpace(icon, style(header), reason)
def __getHeaderData(self): vehicle = g_currentPreviewVehicle.item return { 'tankType': '{}_elite'.format(vehicle.type) if vehicle.isElite else vehicle.type, 'tankInfo': text_styles.concatStylesToMultiLine( text_styles.promoSubTitle(vehicle.userName), text_styles.stats(MENU.levels_roman(vehicle.level))), 'closeBtnLabel': VEHICLE_PREVIEW.HEADER_CLOSEBTN_LABEL, 'backBtnLabel': VEHICLE_PREVIEW.HEADER_BACKBTN_LABEL, 'backBtnDescrLabel': self.__getBackBtnLabel(), 'titleText': text_styles.promoTitle(VEHICLE_PREVIEW.HERO_HEADER_TITLE) if self.__isHeroTank else text_styles.promoTitle( VEHICLE_PREVIEW.HEADER_TITLE), 'isPremiumIGR': vehicle.isPremiumIGR, 'showCloseBtn': self._showHeaderCloseBtn }
def __makeBoosterData(self): booster = self.meta.getBooster() if booster is not None: action = self.meta.getActionVO() price = self.meta.getPrice() self.as_setDataS({ 'id': self.meta.getBoosterID(), 'price': price, 'actionPriceData': action, 'name': booster.userName, 'description': text_styles.concatStylesToMultiLine( booster.description, booster.getExpiryDateStr()), 'currency': self.meta.getCurrency(), 'defaultValue': DEFAULT_VALUE, 'maxAvailableCount': self.meta.getMaxAvailableItemsCount(), 'isActionNow': price.isAllSet(), 'boosterData': self.__makeBoosterVO(booster), 'linkage': CONFIRM_DIALOG_ALIASES.BOOSTER_ICON }) else: LOG_ERROR("Couldn't find booster with given ID:", self.meta.getBoosterID()) self.onWindowClose() return
def __packTitle(self): name = text_styles.highTitle( _ms(TOOLTIPS.BATTLETYPES_RANKED_RANK_NAME, rank=self.item.getUserName())) shieldMaxHp = 0 if self.__shieldStatus is not None: _, _, shieldMaxHp, _, _ = self.__shieldStatus if shieldMaxHp > 0: comment = text_styles.standard( _ms(TOOLTIPS.BATTLETYPES_RANKED_HAVESHIELD, hp=text_styles.stats(shieldMaxHp))) elif self.item.canBeLost(): comment = text_styles.concatStylesWithSpace( icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICON, vSpace=-3), text_styles.neutral( TOOLTIPS.BATTLETYPES_RANKED_RANK_CANBELOST)) else: comment = text_styles.concatStylesWithSpace( icons.makeImageTag( RES_ICONS.MAPS_ICONS_LIBRARY_CYBERSPORT_LOCKICON, width=9, height=13, vSpace=-2), text_styles.main(TOOLTIPS.BATTLETYPES_RANKED_RANK_CANTBELOST)) return formatters.packTextBlockData( text_styles.concatStylesToMultiLine(name, comment))
def _getActionBannerStr(paramDiscount, paramDate=''): discountStr = text_styles.grandTitle(''.join( ('-', str(paramDiscount), '%'))) return discountStr if not paramDate else text_styles.concatStylesToMultiLine( text_styles.mainBig( backport.text(R.strings.menu.barracks.notRecruitedActivateBefore(), date=paramDate)), discountStr)
def update(self, *args): self._personalQuestID = None key = getBootcampInternalHideElementName(self.__componentKey) visibleSettings = self.bootcampCtrl.getLobbySettings() headerVisible = key in visibleSettings and not visibleSettings[key] if headerVisible and self._currentVehicle.isPresent(): vehicle = self._currentVehicle.item headerVO = { 'tankType': '{}_elite'.format(vehicle.type) if vehicle.isElite else vehicle.type, 'tankInfo': text_styles.concatStylesToMultiLine( text_styles.promoSubTitle(vehicle.shortUserName), text_styles.stats(MENU.levels_roman(vehicle.level))), 'isPremIGR': vehicle.isPremiumIGR, 'isVisible': headerVisible, 'isVehicle': True } headerVO.update(self.getFakeQuestData()) headerVO.update(self.getFakeQuestData()) else: headerVO = {'isVisible': False} headerVO.update({ 'isNYEnabled': False, 'isNyActive': False, 'isVisible': True }) self.as_setDataS(headerVO) return
def __notifyParentControlChanged(self, timeLimit): msgList = [backport.text(R.strings.system_messages.gameSessionControl.parentControl.settingsChanged())] if timeLimit: msgList.append(backport.text(R.strings.system_messages.gameSessionControl.parentControl.timeLimit(), timeLimit=backport.getDateTimeFormat(timeLimit))) else: msgList.append(backport.text(R.strings.system_messages.gameSessionControl.parentControl.noTimeLimit())) messageText = text_styles.concatStylesToMultiLine(*msgList) SystemMessages.pushMessage(messageText, SM_TYPE.Warning, NotificationPriorityLevel.HIGH)
def __getHeaderData(self): vehicle = g_currentPreviewVehicle.item return {'tankType': '{}_elite'.format(vehicle.type) if vehicle.isElite else vehicle.type, 'tankInfo': text_styles.concatStylesToMultiLine(text_styles.promoSubTitle(vehicle.shortUserName), text_styles.stats(MENU.levels_roman(vehicle.level))), 'closeBtnLabel': VEHICLE_PREVIEW.HEADER_CLOSEBTN_LABEL, 'backBtnLabel': VEHICLE_PREVIEW.HEADER_BACKBTN_LABEL, 'backBtnDescrLabel': self.__getBackBtnLabel(), 'titleText': text_styles.promoTitle(VEHICLE_PREVIEW.HEADER_TITLE), 'isPremiumIGR': vehicle.isPremiumIGR}
def getTitleBlock(self): tankInfo = '' tankType = '' if g_currentVehicle.isPresent(): item = g_currentVehicle.item tankInfo = text_styles.concatStylesToMultiLine(text_styles.promoSubTitle(item.userName), text_styles.stats(MENU.levels_roman(item.level))) tankType = '../maps/icons/vehicleTypes/big/%s.png' % item.type return {'title': self.getTitle(), 'tankType': tankType, 'tankInfo': tankInfo}
def __packTitle(self): divisionUserName = self.item.getDivisionUserName() if self.item.isQualification(): text = text_styles.highTitle(divisionUserName) else: divisionName = text_styles.main(divisionUserName) name = text_styles.highTitle( backport.text( R.strings.tooltips.battleTypes.ranked.rank.name(), rank=self.item.getUserName())) text = text_styles.concatStylesToMultiLine(name, divisionName) return formatters.packTextBlockData(text)
def _makeHeaderVO(self): if self.app.tutorialManager.hangarHeaderEnabled and self._currentVehicle.isPresent(): vehicle = self._currentVehicle.item headerVO = {'tankType': '{}_elite'.format(vehicle.type) if vehicle.isElite else vehicle.type, 'tankInfo': text_styles.concatStylesToMultiLine(text_styles.promoSubTitle(vehicle.shortUserName), text_styles.stats(MENU.levels_roman(vehicle.level))), 'isPremIGR': vehicle.isPremiumIGR, 'isVisible': True, 'isBeginner': False} self._addQuestsToHeaderVO(headerVO, vehicle) else: headerVO = {'isVisible': False} return headerVO
def _getDescriptionBlock(self): return (formatters.packBuildUpBlockData([ formatters.packTextParameterWithIconBlockData( text_styles.concatStylesToMultiLine( text_styles.middleTitle( TOOLTIPS.PERSONALMISSIONS_FREESHEET_USED_HEADER), text_styles.main( TOOLTIPS.PERSONALMISSIONS_FREESHEET_USED_TEXT)), '', ICON_TEXT_FRAMES.LOCK, padding=formatters.packPadding(left=-60, bottom=-2)) ]), )
def _buildSupplyItems(self): self._supplyItems = [] items = self._itemsCache.items inventory = self._itemsCache.items.inventory slots = items.stats.vehicleSlots slotPrice = items.shop.getVehicleSlotsPrice(slots) defaultSlotPrice = items.shop.defaults.getVehicleSlotsPrice(slots) self._emptySlotsCount = inventory.getFreeSlots(slots) criteria = REQ_CRITERIA.IN_CD_LIST(items.recycleBin.getVehiclesIntCDs()) | REQ_CRITERIA.VEHICLE.IS_RESTORE_POSSIBLE self._restorableVehiclesCount = len(items.getVehicles(criteria)) if slotPrice != defaultSlotPrice: discount = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'slotsPrices', True, Money(gold=slotPrice), Money(gold=defaultSlotPrice)) else: discount = None smallBuySlotString, buySlotString = getStatusStrings('buySlot') smallBuyTankString, buyTankString = getStatusStrings('buyTank') smallRestoreTankString, restoreTankString = getStatusStrings('restoreTank') smallRestoreTankCountString, restoreTankCountString = getStatusStrings('restoreTankCount', style=text_styles.main, ctx={'count': self._restorableVehiclesCount}) smallEmptySlotsString, emptySlotsString = getStatusStrings('buyTankEmptyCount', style=text_styles.main, ctx={'count': self._emptySlotsCount}) self._supplyItems.append({'buyTank': True, 'smallInfoText': text_styles.concatStylesToMultiLine(smallBuyTankString, smallEmptySlotsString), 'infoText': text_styles.concatStylesToMultiLine(buyTankString, emptySlotsString), 'icon': RES_ICONS.MAPS_ICONS_LIBRARY_TANKITEM_BUY_TANK, 'tooltip': TOOLTIPS.TANKS_CAROUSEL_BUY_VEHICLE_NEW}) self._supplyItems.append({'restoreTank': True, 'smallInfoText': text_styles.concatStylesToMultiLine(smallRestoreTankString, smallRestoreTankCountString), 'infoText': text_styles.concatStylesToMultiLine(restoreTankString, restoreTankCountString), 'icon': RES_ICONS.MAPS_ICONS_LIBRARY_TANKITEM_BUY_TANK, 'tooltip': TOOLTIPS.TANKS_CAROUSEL_RESTORE_VEHICLE}) buySlotVO = {'buySlot': True, 'slotPrice': slotPrice, 'icon': RES_ICONS.MAPS_ICONS_LIBRARY_TANKITEM_BUY_SLOT, 'infoText': buySlotString, 'smallInfoText': smallBuySlotString, 'hasSale': discount is not None, 'tooltip': TOOLTIPS.TANKS_CAROUSEL_BUY_SLOT} if discount is not None: buySlotVO.update({'slotPriceActionData': discount}) self._supplyItems.append(buySlotVO) return
def _packProgressBlock(self): blocks = [] unlockedLevel = self._item.getLatestOpenedProgressionLevel( self.__vehicle) if self._showOnlyProgressBlock: level = self._progressionLevel else: level = unlockedLevel + 1 if level > self._item.getMaxProgressionLevel(): return None else: if level == 1: titleDesc = backport.text( R.strings.vehicle_customization.customization.infotype. progression.achievementConditionFirstItem()) else: titleDesc = backport.text( R.strings.vehicle_customization.customization.infotype. progression.achievementCondition(), level=int2roman(level)) blocks.append( formatters.packTextBlockData( text=text_styles.middleTitle(titleDesc))) conditions = self._item.progressionConditions.get(level, []) if not conditions: return None if unlockedLevel > 0: showCurrentProgress = level == unlockedLevel + 1 else: showCurrentProgress = level == 1 desc = text_styles.concatStylesToMultiLine( '', self.__packProgressDescriptionText( conditions[0], showCurrentProgress=showCurrentProgress)) if not self._showOnlyProgressBlock: blocks.append( formatters.packImageTextBlockData( padding=formatters.packPadding(top=10, bottom=-10), img=self._item.iconByProgressionLevel(level), desc=desc, descPadding=formatters.packPadding(left=15), linkage=BLOCKS_TOOLTIP_TYPES. TOOLTIP_IMAGE_TEXT_BLOCK_PROGRESSIVE_LINKAGE)) else: blocks.append( formatters.packTextBlockData( padding=formatters.packPadding(top=-19), text=desc)) return formatters.packBuildUpBlockData( blocks, linkage=BLOCKS_TOOLTIP_TYPES. TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE)
def __getCrewData(self): tankmenGoingToBuffer, deletedTankmen = self.__restore.getTankmenDeletedBySelling( *self.__nationGroupVehicles) deletedCount = len(deletedTankmen) if deletedCount > 0: deletedStr = formatDeletedTankmanStr(deletedTankmen[0]) maxCount = self.__restore.getMaxTankmenBufferLength() currCount = len(self.__restore.getDismissedTankmen()) header = backport.text(R.strings.tooltips.vehicleSellDialog.crew. alertIcon.recovery.header()) if deletedCount == 1: crewTooltip = text_styles.concatStylesToMultiLine( text_styles.middleTitle(header), text_styles.main( backport.text( R.strings.tooltips.vehicleSellDialog.crew. alertIcon.recovery.body(), maxVal=maxCount, curVal=currCount, sourceName=tankmenGoingToBuffer[-1].fullUserName, targetInfo=deletedStr))) else: crewTooltip = text_styles.concatStylesToMultiLine( text_styles.middleTitle(header), text_styles.main( backport.text(R.strings.tooltips.dismissTankmanDialog. bufferIsFullMultiple.body(), deletedStr=deletedStr, extraCount=deletedCount - 1, maxCount=maxCount, currCount=currCount))) else: crewTooltip = None if self.__vehicle.isCrewLocked: hasCrew = False else: hasCrew = any([veh.hasCrew for veh in self.__nationGroupVehicles]) return (hasCrew, crewTooltip)
def _formatBenefits(benefitData): formattedBenefits = [] for i, (icon, title, body) in enumerate(benefitData, 1): if i > _BENEFIT_ITEMS_LIMIT: break formattedBenefits.append({ 'iconSrc': icon, 'labelStr': text_styles.concatStylesToMultiLine(text_styles.highTitle(title), text_styles.main(body)) }) return formattedBenefits
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 update(self, *args): self._personalQuestID = None if self._currentVehicle.isPresent(): vehicle = self._currentVehicle.item headerVO = {'tankType': '{}_elite'.format(vehicle.type) if vehicle.isElite else vehicle.type, 'tankInfo': text_styles.concatStylesToMultiLine(text_styles.promoSubTitle(vehicle.shortUserName), text_styles.stats(MENU.levels_roman(vehicle.level))), 'isPremIGR': vehicle.isPremiumIGR, 'isVisible': True} headerVO.update(self.__getBattleQuestsVO(vehicle)) headerVO.update(self.__getPersonalQuestsVO(vehicle)) else: headerVO = {'isVisible': False} self.as_setDataS(headerVO) return
def _makeLockBlock(self): clanLockTime = self.vehicle.clanLock if clanLockTime and clanLockTime <= time_utils.getCurrentTimestamp(): LOG_DEBUG('clan lock time is less than current time: %s' % clanLockTime) clanLockTime = None isDisabledInRoaming = self.vehicle.isDisabledInRoaming if clanLockTime or isDisabledInRoaming: headerLock = text_styles.concatStylesToMultiLine( text_styles.warning(_ms(TOOLTIPS.TANKCARUSEL_LOCK_HEADER))) if isDisabledInRoaming: textLock = text_styles.main( _ms(TOOLTIPS.TANKCARUSEL_LOCK_ROAMING)) else: time = time_utils.getDateTimeFormat(clanLockTime) timeStr = text_styles.main( text_styles.concatStylesWithSpace( _ms(TOOLTIPS.TANKCARUSEL_LOCK_TO), time)) textLock = text_styles.concatStylesToMultiLine( timeStr, text_styles.main(_ms(TOOLTIPS.TANKCARUSEL_LOCK_CLAN))) lockHeaderBlock = formatters.packTextBlockData( headerLock, padding=formatters.packPadding(left=77 + self.leftPadding, top=5)) lockTextBlock = formatters.packTextBlockData( textLock, padding=formatters.packPadding(left=77 + self.leftPadding)) return formatters.packBuildUpBlockData( [lockHeaderBlock, lockTextBlock], stretchBg=False, linkage=BLOCKS_TOOLTIP_TYPES. TOOLTIP_BUILDUP_BLOCK_LOCK_BG_LINKAGE, padding=formatters.packPadding(left=-17, top=20, bottom=0)) else: return return
def _packBlocks(self, *args, **kwargs): eventID = args[0] quest = events_helpers.getPersonalMissionsCache().getQuests()[int( eventID)] description = '\n\n'.join( [quest.getUserDescription(), quest.getUserAdvice()]) blocks = [ formatters.packTextBlockData( text_styles.concatStylesToMultiLine( text_styles.highTitle( PERSONAL_MISSIONS.DETAILEDVIEW_INFOPANEL_HEADER), text_styles.main(description))) ] return blocks
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 __populateSlotsData(self): selectedQuests = _getQuestsCache().getSelectedQuests().values() freeSlotsCount = _getQuestsProgress().getPotapovQuestsFreeSlots() slotIdx, slots = 0, [] for slotIdx, quest in enumerate(selectedQuests): tile = _getQuestsCache().getTiles()[quest.getTileID()] slots.append((tile.getChainSortKey(quest.getChainID()), self.__packQuestSlot(quest))) slots = map(lambda (_, slot): slot, _sortWithQuestType(slots, operator.itemgetter(0))) nextSlotIdx = slotIdx + 1 for slotIdx in xrange(nextSlotIdx, nextSlotIdx + freeSlotsCount): slots.append(self.__packQuestSlot()) self.as_setSlotsDataS({'questSlots': slots, 'hasActiveQuests': len(selectedQuests) > 0, 'noActiveQuestsText': text_styles.concatStylesToMultiLine((TEXT_MANAGER_STYLES.MIDDLE_TITLE, QUESTS.PERSONAL_SEASONS_SLOTS_NOACTIVESLOTS_HEADER), (TEXT_MANAGER_STYLES.STANDARD_TEXT, QUESTS.PERSONAL_SEASONS_SLOTS_NOACTIVESLOTS_BODY))})
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 __makeBoosterData(self): booster = self.meta.getBooster() if booster is not None: action = self.meta.getActionVO() price = self.meta.getPrice() self.as_setDataS({'id': self.meta.getBoosterID(), 'price': price, 'actionPriceData': action, 'name': booster.userName, 'description': text_styles.concatStylesToMultiLine(booster.description, booster.getExpiryDateStr()), 'currency': self.meta.getCurrency(), 'defaultValue': DEFAULT_VALUE, 'maxAvailableCount': self.meta.getMaxAvailableItemsCount(), 'isActionNow': price.isAllSet(), 'boosterData': self.__makeBoosterVO(booster), 'linkage': CONFIRM_DIALOG_ALIASES.BOOSTER_ICON}) else: LOG_ERROR("Couldn't find booster with given ID:", self.meta.getBoosterID()) self.onWindowClose() return
def construct(self): block = [] if self.vehicle.isElite: vehicleType = TOOLTIPS.tankcaruseltooltip_vehicletype_elite(self.vehicle.type) bgLinkage = BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_ELITE_VEHICLE_FAVORITE_BG_LINKAGE if self.vehicle.isFavorite else 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_FAVORITE_BG_LINKAGE if self.vehicle.isFavorite else 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') imgOffset = 4 textOffset = 82 if self.vehicle.type == 'heavyTank': imgOffset = 11 textOffset = 99 iconBlock = formatters.packImageTextBlockData(title=nameStr, desc=text_styles.concatStylesToMultiLine(typeStr, levelStr), img=icon, imgPadding={'left': imgOffset, 'top': -15}, txtGap=-2, txtOffset=textOffset, padding=formatters.packPadding(top=15, bottom=-15)) block.append(formatters.packBuildUpBlockData([iconBlock], stretchBg=False, linkage=bgLinkage, padding=formatters.packPadding(left=-19 + self.leftPadding, top=-1))) return block
def _populate(self): super(VehicleSellDialog, self)._populate() g_clientUpdateManager.addCallbacks({'stats.gold': self.onSetGoldHndlr}) g_itemsCache.onSyncCompleted += self.__shopResyncHandler items = g_itemsCache.items vehicle = items.getVehicle(self.vehInvID) sellPrice = vehicle.sellPrice sellForGold = sellPrice.gold > 0 priceTextColor = CURRENCIES_CONSTANTS.GOLD_COLOR if sellForGold else CURRENCIES_CONSTANTS.CREDITS_COLOR priceTextValue = _ms(DIALOGS.VEHICLESELLDIALOG_PRICE_SIGN_ADD) + _ms(BigWorld.wg_getIntegralFormat(sellPrice.gold if sellForGold else sellPrice.credits)) currencyIcon = CURRENCIES_CONSTANTS.GOLD if sellForGold else CURRENCIES_CONSTANTS.CREDITS invVehs = items.getVehicles(REQ_CRITERIA.INVENTORY) if vehicle.isPremium or vehicle.level >= 3: self.as_visibleControlBlockS(True) self.__initCtrlQuestion() else: self.as_visibleControlBlockS(False) modules = items.getItems(criteria=REQ_CRITERIA.VEHICLE.SUITABLE([vehicle]) | REQ_CRITERIA.INVENTORY).values() shells = items.getItems(criteria=REQ_CRITERIA.VEHICLE.SUITABLE([vehicle], [GUI_ITEM_TYPE.SHELL]) | REQ_CRITERIA.INVENTORY).values() otherVehsShells = set() for invVeh in invVehs.itervalues(): if invVeh.invID != self.vehInvID: for shot in invVeh.descriptor.gun['shots']: otherVehsShells.add(shot['shell']['compactDescr']) vehicleAction = None if sellPrice != vehicle.defaultSellPrice: vehicleAction = packItemActionTooltipData(vehicle, False) if vehicle.isElite: description = TOOLTIPS.tankcaruseltooltip_vehicletype_elite(vehicle.type) else: description = DIALOGS.vehicleselldialog_vehicletype(vehicle.type) levelStr = text_styles.concatStylesWithSpace(text_styles.stats(int2roman(vehicle.level)), text_styles.main(_ms(DIALOGS.VEHICLESELLDIALOG_VEHICLE_LEVEL))) restoreController = getRestoreController() tankmenGoingToBuffer, deletedTankmen = restoreController.getTankmenDeletedBySelling(vehicle) deletedCount = len(deletedTankmen) if deletedCount > 0: recoveryBufferFull = True deletedStr = formatDeletedTankmanStr(deletedTankmen[0]) maxCount = restoreController.getMaxTankmenBufferLength() currCount = len(restoreController.getDismissedTankmen()) if deletedCount == 1: crewTooltip = text_styles.concatStylesToMultiLine(text_styles.middleTitle(_ms(TOOLTIPS.VEHICLESELLDIALOG_CREW_ALERTICON_RECOVERY_HEADER)), text_styles.main(_ms(TOOLTIPS.VEHICLESELLDIALOG_CREW_ALERTICON_RECOVERY_BODY, maxVal=maxCount, curVal=currCount, sourceName=tankmenGoingToBuffer[-1].fullUserName, targetInfo=deletedStr))) else: crewTooltip = text_styles.concatStylesToMultiLine(text_styles.middleTitle(_ms(TOOLTIPS.VEHICLESELLDIALOG_CREW_ALERTICON_RECOVERY_HEADER)), text_styles.main(_ms(TOOLTIPS.DISMISSTANKMANDIALOG_BUFFERISFULLMULTIPLE_BODY, deletedStr=deletedStr, extraCount=deletedCount - 1, maxCount=maxCount, currCount=currCount))) else: crewTooltip = None recoveryBufferFull = False barracksDropDownData = [{'label': _ms(MENU.BARRACKS_BTNUNLOAD)}, {'label': _ms(MENU.BARRACKS_BTNDISSMISS)}] sellVehicleData = {'intCD': vehicle.intCD, 'userName': vehicle.userName, 'icon': vehicle.icon, 'level': vehicle.level, 'isElite': vehicle.isElite, 'isPremium': vehicle.isPremium, 'type': vehicle.type, 'nationID': vehicle.nationID, 'sellPrice': sellPrice, 'priceTextValue': priceTextValue, 'priceTextColor': priceTextColor, 'currencyIcon': currencyIcon, 'action': vehicleAction, 'hasCrew': vehicle.hasCrew, 'isRented': vehicle.isRented, 'description': description, 'levelStr': levelStr, 'priceLabel': _ms(DIALOGS.VEHICLESELLDIALOG_VEHICLE_EMPTYSELLPRICE), 'crewLabel': _ms(DIALOGS.VEHICLESELLDIALOG_CREW_LABEL), 'crewTooltip': crewTooltip, 'barracksDropDownData': barracksDropDownData, 'crewRecoveryBufferFull': recoveryBufferFull} onVehicleOptionalDevices = [] for o in vehicle.optDevices: if o is not None: action = None if o.sellPrice != o.defaultSellPrice: action = packItemActionTooltipData(o, False) data = {'intCD': o.intCD, 'isRemovable': o.isRemovable, 'userName': o.userName, 'sellPrice': o.sellPrice, 'toInventory': True, 'action': action} onVehicleOptionalDevices.append(data) onVehicleoShells = [] for shell in vehicle.shells: if shell is not None: action = None if shell.sellPrice != shell.defaultSellPrice: action = packItemActionTooltipData(shell, False) data = {'intCD': shell.intCD, 'count': shell.count, 'sellPrice': shell.sellPrice, 'userName': shell.userName, 'kind': shell.type, 'toInventory': shell in otherVehsShells or shell.isPremium, 'action': action} onVehicleoShells.append(data) onVehicleEquipments = [] for equipmnent in vehicle.eqs: if equipmnent is not None: action = None if equipmnent.sellPrice != equipmnent.defaultSellPrice: action = packItemActionTooltipData(equipmnent, False) data = {'intCD': equipmnent.intCD, 'userName': equipmnent.userName, 'sellPrice': equipmnent.sellPrice, 'toInventory': True, 'action': action} onVehicleEquipments.append(data) inInventoryModules = [] for m in modules: inInventoryModules.append({'intCD': m.intCD, 'inventoryCount': m.inventoryCount, 'toInventory': True, 'sellPrice': m.sellPrice}) inInventoryShells = [] for s in shells: action = None if s.sellPrice != s.defaultSellPrice: action = packItemActionTooltipData(s, False) inInventoryShells.append({'intCD': s.intCD, 'count': s.inventoryCount, 'sellPrice': s.sellPrice, 'userName': s.userName, 'kind': s.type, 'toInventory': s in otherVehsShells or s.isPremium, 'action': action}) removePrice = items.shop.paidRemovalCost removePrices = Money(gold=removePrice) defRemovePrice = Money(gold=items.shop.defaults.paidRemovalCost) removeAction = None if removePrices != defRemovePrice: removeAction = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'paidRemovalCost', True, removePrices, defRemovePrice) settings = self.getDialogSettings() isSlidingComponentOpened = settings['isOpened'] self.as_setDataS({'accountGold': items.stats.gold, 'sellVehicleVO': sellVehicleData, 'optionalDevicesOnVehicle': onVehicleOptionalDevices, 'shellsOnVehicle': onVehicleoShells, 'equipmentsOnVehicle': onVehicleEquipments, 'modulesInInventory': inInventoryModules, 'shellsInInventory': inInventoryShells, 'removeActionPrice': removeAction, 'removePrice': removePrice, 'isSlidingComponentOpened': isSlidingComponentOpened}) return
def _packBlocks(self, compensationValue): title = TOOLTIPS.FORTIFICATION_POPOVER_DEFRESPROGRESS_HEADER items = super(FortPopoverDefResTooltipData, self)._packBlocks() items.append(formatters.packTitleDescBlock(text_styles.highTitle(title), desc=text_styles.main(self._descr))) if compensationValue is not None: blocksGap = 12 compensationHeader = text_styles.main(TOOLTIPS.FORTIFICATION_POPOVER_DEFRESPROGRESS_COMPENSATION_HEADER) + text_styles.alert('+' + compensationValue) + icons.nut() compensationBody = text_styles.standard(TOOLTIPS.FORTIFICATION_POPOVER_DEFRESPROGRESS_COMPENSATION_BODY) items.append(formatters.packBuildUpBlockData([formatters.packTextBlockData(text_styles.concatStylesToMultiLine(compensationHeader, compensationBody))], blocksGap, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE)) return items