def _getUnlockDiscountBlock(percentValue, xpValue, title, showPlus=False):
     if percentValue == 100:
         discountPadding = 8 if showPlus else 19
     elif percentValue < 10:
         discountPadding = 30 if showPlus else 41
     else:
         discountPadding = 19 if showPlus else 30
     percentStr = ''.join(('+' if showPlus else '', str(percentValue), '%'))
     discountValueStr = text_styles.concatStylesToSingleLine(
         text_styles.bonusLocalText(percentStr),
         text_styles.main(
             i18n.makeString(TOOLTIPS.VEHICLE_TEXTDELIMITER_OR).join(
                 ('  ', ' '))), icons.xpCost(),
         text_styles.expText(backport.getIntegralFormat(xpValue)))
     blockPadding = -discountPadding - (0 if showPlus else -10)
     imgPadding = -79 - (3 if percentValue < 10 else 0)
     return formatters.packImageTextBlockData(
         title=text_styles.main(title),
         desc=discountValueStr,
         img=backport.image(R.images.gui.maps.icons.blueprints.
                            blueprintScreen.discountShine()),
         txtGap=-6,
         imgPadding=formatters.packPadding(top=0, right=imgPadding),
         txtPadding=formatters.packPadding(left=discountPadding),
         padding=formatters.packPadding(top=4, left=blockPadding,
                                        bottom=-6),
         blockWidth=300)
 def __packFragmentsInfoBlock(self):
     countBlock = formatters.packImageTextBlockData(
         title=text_styles.main(
             TOOLTIPS.BLUEPRINT_VEHICLEBLUEPRINTTOOLTIP_FRAGMENTSACQUIRED),
         desc=text_styles.concatStylesWithSpace(
             text_styles.bonusLocalText(
                 str(self.__blueprintData.filledCount)),
             text_styles.main(' '.join(
                 ('/', str(self.__blueprintData.totalCount))))),
         img=RES_ICONS.MAPS_ICONS_BLUEPRINTS_FRAGMENT_MEDIUM_VEHICLE,
         txtPadding=formatters.packPadding(left=11),
         txtGap=-6,
         padding=formatters.packPadding(top=4))
     transitionBlock = formatters.packImageBlockData(
         img=RES_ICONS.MAPS_ICONS_BLUEPRINTS_TOOLTIP_POINTER,
         align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
         padding=formatters.packPadding(top=-3, left=24, right=24))
     if self.__blueprintData.filledCount != self.__blueprintData.totalCount:
         discountBlock = self.__packDiscountBlock()
     else:
         discountBlock = self.__packFreeUnlockBlock()
     return formatters.packBuildUpBlockData(
         blocks=[countBlock, transitionBlock, discountBlock],
         linkage=BLOCKS_TOOLTIP_TYPES.
         TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE,
         layout=BLOCKS_TOOLTIP_TYPES.LAYOUT_HORIZONTAL,
         padding=formatters.packPadding(bottom=-10),
         blockWidth=390)
def buildCustomizationItemDataVO(item,
                                 count,
                                 plainView=False,
                                 showDetailItems=True,
                                 forceLocked=False,
                                 showUnsupportedAlert=False,
                                 isCurrentlyApplied=False,
                                 addExtraName=True,
                                 isAlreadyUsed=False,
                                 isDarked=False,
                                 noPrice=False):
    isSpecial = item.isVehicleBound and (
        item.buyCount > 0
        or item.inventoryCount > 0) or item.isLimited and item.buyCount > 0
    hasBonus = item.bonus is not None and not plainView
    locked = (not item.isUnlocked or forceLocked) and not plainView
    if plainView or item.isHidden or noPrice:
        buyPrice = ITEM_PRICE_EMPTY
    else:
        buyPrice = item.getBuyPrice()
    isNonHistoric = not item.isHistorical()
    if addExtraName and item.itemTypeID in (GUI_ITEM_TYPE.MODIFICATION,
                                            GUI_ITEM_TYPE.STYLE):
        extraNames = (text_styles.bonusLocalText(item.userName),
                      text_styles.highTitle(item.userName))
    else:
        extraNames = None
    rentalInfoText = ''
    if item.isRentable and count <= 0:
        rentalInfoText = text_styles.main(
            _ms(VEHICLE_CUSTOMIZATION.CAROUSEL_RENTALBATTLES,
                battlesNum=item.rentCount))
    return CustomizationCarouselRendererVO(
        item.intCD,
        item.itemTypeID,
        item.isWide(),
        item.icon,
        hasBonus,
        locked,
        buyPrice,
        count,
        item.isRentable,
        showDetailItems,
        isNonHistoric,
        isSpecial,
        isDarked,
        isAlreadyUsed,
        showUnsupportedAlert,
        extraNames=extraNames,
        showRareIcon=item.isRare(),
        isEquipped=isCurrentlyApplied,
        rentalInfoText=rentalInfoText).asDict()
Пример #4
0
    def _populate(self):
        super(RankedBattlesStageCompleteView, self)._populate()
        if self.__season is not None:
            cycle = self.__season.getAllCycles()[self._quest.getCycleID()]
            rank = self.rankedController.getRank(self._quest.getRank())
            try:
                proxy_currency_count = first(
                    self._quest.getBonuses(Currency.CRYSTAL)).getValue()
            except AttributeError:
                proxy_currency_count = 0

            self.as_setDataS({
                'rank': {
                    'imageSrc': rank.getIcon('small'),
                    'smallImageSrc': None,
                    'isEnabled': True,
                    'isMaster': False,
                    'rankID': str(rank.getID())
                },
                'boxImage':
                rank.getBoxIcon(),
                'bestRankTitle':
                RANKED_BATTLES.SEASONCOMPLETE_BESTRANK,
                'proxyCurrency':
                text_styles.highTitle(
                    i18n.makeString(
                        RANKED_BATTLES.SEASONCOMPLETE_PROXYCURRENCY,
                        value=text_styles.superPromoTitle(
                            proxy_currency_count))),
                'scoresTitle':
                text_styles.highlightText(
                    i18n.makeString(RANKED_BATTLES.SEASONCOMPLETE_SCORESEARNED,
                                    scores=text_styles.bonusLocalText(
                                        cycle.points))),
                'congratulationTitle':
                i18n.makeString(RANKED_BATTLES.SEASONCOMPLETE_STAGECOMPLETE,
                                stage=cycle.ordinalNumber),
                'nextButtonLabel':
                RANKED_BATTLES.AWARDS_YES,
                'bgSource':
                RES_ICONS.MAPS_ICONS_RANKEDBATTLES_BG_RANK_BLUR
            })
            self.as_setRewardsDataS({
                'ribbonType': 'ribbon2',
                'rendererLinkage': 'RibbonAwardAnimUI',
                'gap': 20,
                'rendererWidth': 80,
                'rendererHeight': 80,
                'awards': self._packAwards()
            })
        return
def buildCustomizationItemDataVO(item, count=None, isApplied=False, isDarked=False, isUsedUp=False, autoRentEnabled=False, vehicle=None, progressionLevel=None, icon=None, showDetailItems=True, plainView=False, showEditableHint=False, showEditBtnHint=False):
    if plainView:
        hasBonus = False
        locked = False
        buyPrice = ITEM_PRICE_EMPTY
    else:
        hasBonus = item.bonus is not None
        locked = isUsedUp or not item.isUnlocked
        buyPrice = ITEM_PRICE_EMPTY if item.isHidden or item.buyCount <= 0 else item.getBuyPrice()
    if item.itemTypeID == GUI_ITEM_TYPE.PROJECTION_DECAL:
        formFactor = PROJECTION_DECAL_FORM_TO_UI_ID[item.formfactor]
        formIconSource = PROJECTION_DECAL_IMAGE_FORM_TAG[item.formfactor]
        scale = _PROJECTION_DECAL_FORM_TO_IMAGE_SCALE[item.formfactor]
    else:
        formFactor = -1
        formIconSource = ''
        scale = _DEFAULT_IMAGE_SCALE
    if item.isRentable and count <= 0:
        rentalInfoText = R.strings.vehicle_customization.carousel.rentalBattles()
        rentalInfoText = text_styles.main(backport.text(rentalInfoText, battlesNum=item.rentCount))
    else:
        rentalInfoText = ''
    if item.itemTypeID in (GUI_ITEM_TYPE.MODIFICATION, GUI_ITEM_TYPE.STYLE):
        extraNames = (text_styles.bonusLocalText(item.userName), text_styles.highTitle(item.userName))
    else:
        extraNames = None
    if isUsedUp:
        lockText = backport.text(R.strings.vehicle_customization.customization.limited.onOther())
    else:
        lockText = backport.text(R.strings.vehicle_customization.customization.UnsupportedForm())
    showAlert = __isNeedToShowAlert(item)
    imageCached = item.itemTypeID is not GUI_ITEM_TYPE.PROJECTION_DECAL
    editBtnEnabled, editableIcon = __getEditableBlockData(item, vehicle)
    showEditableHint = showEditableHint and bool(editableIcon) and editBtnEnabled
    showEditBtnHint = showEditBtnHint and editBtnEnabled
    isSpecial = __isItemSpecial(item)
    if vehicle is not None:
        progressionLevel = progressionLevel or item.getLatestOpenedProgressionLevel(vehicle)
        noveltyCounter = item.getNoveltyCounter(vehicle)
    else:
        progressionLevel = progressionLevel or -1
        noveltyCounter = 0
    icon = icon or __getIcon(item, progressionLevel)
    iconAlpha = _ICON_ALPHA_BY_GUI_ITEM_TYPE.get(item.itemTypeID, 1)
    return CustomizationCarouselRendererVO(item=item, icon=icon, hasBonus=hasBonus, locked=locked, buyPrice=buyPrice, quantity=count, showDetailItems=showDetailItems, isSpecial=isSpecial, isDarked=isDarked, isAlreadyUsed=isUsedUp, showAlert=showAlert, extraNames=extraNames, isEquipped=isApplied, rentalInfoText=rentalInfoText, imageCached=imageCached, autoRentEnabled=autoRentEnabled, noveltyCounter=noveltyCounter, formIconSource=formIconSource, defaultIconAlpha=iconAlpha, lockText=lockText, formFactor=formFactor, progressionLevel=progressionLevel, editableIcon=editableIcon, editBtnEnabled=editBtnEnabled, showEditableHint=showEditableHint, showEditBtnHint=showEditBtnHint, imageScale=scale).asDict()
Пример #6
0
def buildCustomizationItemDataVO(item,
                                 count,
                                 plainView=False,
                                 showDetailItems=True,
                                 forceLocked=False,
                                 showUnsupportedAlert=False,
                                 isCurrentlyApplied=False):
    """ Build a CustomizationCarouselRendererVO out of the given item.
    """
    hasBonus = item.bonus is not None and not plainView
    locked = (not item.isUnlocked or forceLocked) and not plainView
    if plainView or item.isHidden:
        buyPrice = ITEM_PRICE_EMPTY
    else:
        buyPrice = item.getBuyPrice()
    isNonHistoric = not item.isHistorical()
    if item.itemTypeID in (GUI_ITEM_TYPE.MODIFICATION, GUI_ITEM_TYPE.STYLE):
        titleStyle = text_styles.boosterText if item.itemTypeID == GUI_ITEM_TYPE.STYLE and item.isRentable else text_styles.counter
        extraTitle = titleStyle(toUpper(item.userType))
        extraName = text_styles.bonusLocalText(item.userName)
    else:
        extraTitle = extraName = ''
    if item.itemTypeID == GUI_ITEM_TYPE.STYLE:
        extraIcon = RES_ICONS.MAPS_ICONS_QUESTS_BONUSES_BIG_STYLE
    else:
        extraIcon = ''
    isEquipped = isCurrentlyApplied
    return CustomizationCarouselRendererVO(item.intCD,
                                           item.itemTypeID,
                                           item.isWide(),
                                           item.icon,
                                           hasBonus,
                                           locked,
                                           buyPrice,
                                           count,
                                           item.isRentable,
                                           showDetailItems,
                                           isNonHistoric,
                                           showUnsupportedAlert,
                                           extraTitle=extraTitle,
                                           extraName=extraName,
                                           extraIcon=extraIcon,
                                           showRareIcon=item.isRare(),
                                           isEquipped=isEquipped).asDict()
Пример #7
0
 def update(self, *args):
     self._personalQuestID = None
     if self._currentVehicle.isPresent():
         vehicle = self._currentVehicle.item
         bonuses = self._newYearController.getBonusesForNation(
             vehicle.nationID)
         bonus = int(bonuses[0] * 100.0) if bonuses else 0
         setting = self._newYearController.getSettingForNation(
             vehicle.nationID)
         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))),
             'bonusName':
             '{} {}'.format(text_styles.credits(NY.HANGAR_BONUSINFO),
                            vehicle.shortUserName),
             'bonusCount':
             text_styles.bonusLocalText('+{}%'.format(bonus)),
             'bonusSetting':
             setting,
             'isPremIGR':
             vehicle.isPremiumIGR,
             'isBeginner':
             False,
             'isVehicle':
             True
         }
         headerVO.update(self.__getBattleQuestsVO(vehicle))
         headerVO.update(self.__getPersonalQuestsVO(vehicle))
         headerVO.update(self.__getElenQuestsVO(vehicle))
     else:
         headerVO = {'isVehicle': False}
     headerVO.update({
         'isNYEnabled': self._newYearController.isAvailable(),
         'isNyActive': self._newYearController.isAvailable(),
         'bonusLevel': self._newYearController.getProgress().level,
         'isVisible': True
     })
     self.as_setDataS(headerVO)
     return
Пример #8
0
 def __getTopBackgroundTooltipWithTextData(self):
     header = text_styles.bonusLocalText(
         backport.text(R.strings.tooltips.eventProgression.header()))
     iconSrc = backport.image(
         R.images.gui.maps.icons.epicBattles.rewardPoints.c_16x16())
     iconCurrency = icons.makeImageTag(source=iconSrc,
                                       width=16,
                                       height=16,
                                       vSpace=-3)
     currency = text_styles.concatStylesWithSpace(
         self.__getCurrencyCurrentStr(), iconCurrency)
     background = R.images.gui.maps.icons.epicBattles.backgrounds.widget_tooltip_background(
     )
     return formatters.packImageTextBlockData(
         title=header,
         txtPadding=formatters.packPadding(top=16, left=20),
         desc=currency,
         descPadding=formatters.packPadding(top=6, left=20),
         txtOffset=1,
         txtGap=-1,
         img=backport.image(background))
Пример #9
0
def buildCustomizationItemDataVO(isBuy,
                                 item,
                                 count,
                                 plainView=False,
                                 showDetailItems=True,
                                 forceLocked=False,
                                 showUnsupportedAlert=False,
                                 isCurrentlyApplied=False,
                                 addExtraName=True,
                                 isAlreadyUsed=False,
                                 isDarked=False,
                                 noPrice=False,
                                 autoRentEnabled=False,
                                 customIcon=None,
                                 vehicle=None):
    isSpecial = item.isVehicleBound and (
        item.buyCount > 0
        or item.inventoryCount > 0) or item.isLimited and item.buyCount > 0
    hasBonus = item.bonus is not None and not plainView
    locked = (not item.isUnlocked or forceLocked) and not plainView
    buyPrice = ITEM_PRICE_EMPTY if isBuy and (
        plainView or item.isHidden or noPrice) else item.getBuyPrice()
    if not isBuy and buyPrice == ITEM_PRICE_EMPTY and count <= 0:
        count = 1
    isNonHistoric = not item.isHistorical()
    isDim = item.isDim()
    if addExtraName and item.itemTypeID in (GUI_ITEM_TYPE.MODIFICATION,
                                            GUI_ITEM_TYPE.STYLE):
        extraNames = (text_styles.bonusLocalText(item.userName),
                      text_styles.highTitle(item.userName))
    else:
        extraNames = None
    imageCached = item.itemTypeID is not GUI_ITEM_TYPE.PROJECTION_DECAL
    rentalInfoText = ''
    if isBuy and item.isRentable and count <= 0:
        rentalInfoText = text_styles.main(
            _ms(CUSTOMIZATION.CAROUSEL_RENTALBATTLES,
                battlesNum=item.rentCount))
    icon = customIcon if customIcon else item.icon
    noveltyCounter = 0 if not vehicle else item.getNoveltyCounter(vehicle)
    formFactor = -1
    formIconSource = ''
    if item.itemTypeID == GUI_ITEM_TYPE.PROJECTION_DECAL:
        formFactor = PROJECTION_DECAL_FORM_TO_UI_ID[item.formfactor]
        formIconSource = PROJECTION_DECAL_IMAGE_FORM_TAG[item.formfactor]
    iconAlpha = _ICON_ALPHA_BY_GUI_ITEM_TYPE.get(item.itemTypeID, 1)
    lockText = CUSTOMIZATION.CUSTOMIZATION_LIMITED_ONOTHER if isAlreadyUsed else CUSTOMIZATION.CUSTOMIZATION_UNSUPPORTEDFORM
    return CustomizationCarouselRendererVO(item.intCD,
                                           item.itemTypeID,
                                           item.isWide(),
                                           icon,
                                           hasBonus,
                                           locked,
                                           buyPrice,
                                           count,
                                           item.isRentable,
                                           showDetailItems,
                                           isNonHistoric,
                                           isSpecial,
                                           isDarked,
                                           isAlreadyUsed,
                                           showUnsupportedAlert,
                                           extraNames=extraNames,
                                           showRareIcon=item.isRare(),
                                           isEquipped=isCurrentlyApplied,
                                           rentalInfoText=rentalInfoText,
                                           imageCached=imageCached,
                                           autoRentEnabled=autoRentEnabled,
                                           isAllSeasons=item.isAllSeason(),
                                           noveltyCounter=noveltyCounter,
                                           formIconSource=formIconSource,
                                           defaultIconAlpha=iconAlpha,
                                           lockText=lockText,
                                           isDim=isDim,
                                           formFactor=formFactor).asDict()
Пример #10
0
 def _populate(self):
     super(RankedBattlesAwardsView, self)._populate()
     self.rankedController.setAwardWindowShown(self.__rankID)
     rank = self.rankedController.getRank(self.__rankID,
                                          vehicle=self.__vehicle)
     isAccountMastered = self.rankedController.isAccountMastered()
     isCurrentRankMaster = rank.getType() == RANK_TYPES.VEHICLE
     rankVOs = {
         'currentRank': {
             'rankTitle':
             RANKED_BATTLES.AWARDS_GOTRANK,
             'rank': {
                 'imageSrc':
                 rank.getIcon('huge'),
                 'smallImageSrc':
                 None,
                 'isEnabled':
                 True,
                 'isMaster':
                 isCurrentRankMaster,
                 'rankID':
                 str(self.__rankID),
                 'rankCount':
                 'x{}'.format(rank.getSerialID())
                 if isCurrentRankMaster else ''
             },
             'congratulationTitle':
             RANKED_BATTLES.AWARDS_CONGRATULATION,
             'scoresTitle':
             text_styles.highlightText(
                 i18n.makeString(RANKED_BATTLES.AWARDS_NEXTRANKTITLE,
                                 scores=text_styles.promoSubTitle(
                                     rank.getPoints()))),
             'nextButtonLabel':
             RANKED_BATTLES.AWARDS_NEXT
             if isAccountMastered else RANKED_BATTLES.AWARDS_YES,
             'awards':
             rank.getAwardsVOs(iconSize='big')
         }
     }
     if isAccountMastered and self.__showNext:
         nextRankID = self.__rankID + 1
         nextRank = self.rankedController.getRank(nextRankID,
                                                  vehicle=self.__vehicle)
         stagesCount = nextRank.getStepsCountToAchieve()
         rankVOs['nextRank'] = {
             'rank': {
                 'imageSrc': nextRank.getIcon('huge'),
                 'smallImageSrc': None,
                 'isEnabled': True,
                 'isMaster': True,
                 'rankID': str(nextRank.getID()),
                 'rankCount': ''
             },
             'stagesCount':
             stagesCount,
             'congratulationTitle':
             RANKED_BATTLES.AWARDS_CONGRATULATION,
             'scoresTitle':
             text_styles.highlightText(
                 i18n.makeString(
                     RANKED_BATTLES.AWARDS_STAGESTITLE,
                     stage=text_styles.bonusLocalText(stagesCount))),
             'nextButtonLabel':
             RANKED_BATTLES.AWARDS_YES
         }
     self.as_setDataS(rankVOs)
     rankID = 'max' if isCurrentRankMaster else self.__rankID
     SoundGroups.g_instance.playSound2D(
         SOUND.getRankAwardAnimationEvent(rankID))
     return