Example #1
0
    def _packAlreadyHaveBlock(self, data):
        subBlocks = [
            formatters.packTextBlockData(text=text_styles.middleTitle(
                _ms('#vehicle_customization:customization/tooltip/alreadyHave/title'
                    )),
                                         padding={'bottom': 6})
        ]
        padding = {'left': 10}
        for buyItem in data['buyItems']:
            buyItemDesc = text_styles.main(buyItem['desc'])
            if buyItem['type'] == BUY_ITEM_TYPE.ALREADY_HAVE_IGR:
                subBlocks.append(
                    formatters.packTextParameterBlockData(
                        name=buyItemDesc,
                        value=icons.premiumIgrSmall(),
                        padding=padding))
            else:
                subBlocks.append(
                    formatters.packTextParameterBlockData(name=buyItemDesc,
                                                          value='',
                                                          padding=padding))

        return formatters.packBuildUpBlockData(
            subBlocks, 0, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LINKAGE,
            {'left': 3})
Example #2
0
 def getStringStatus(self, vState):
     if vState == Vehicle.VEHICLE_STATE.IN_PREMIUM_IGR_ONLY:
         icon = icons.premiumIgrSmall()
         return i18n.makeString('#menu:tankCarousel/vehicleStates/%s' %
                                vState,
                                icon=icon)
     return i18n.makeString('#menu:tankCarousel/vehicleStates/%s' % vState)
Example #3
0
 def getStringStatus(self, vState, ignoreGroupState = False):
     statusStr = ''
     if vState == Vehicle.VEHICLE_STATE.IN_PREMIUM_IGR_ONLY:
         icon = icons.premiumIgrSmall()
         statusStr = i18n.makeString('#menu:tankCarousel/vehicleStates/%s' % vState, icon=icon)
     elif vState not in Vehicle.GROUP_STATES or not ignoreGroupState:
         statusStr = i18n.makeString('#menu:tankCarousel/vehicleStates/%s' % vState)
     return statusStr
Example #4
0
 def getStringStatus(self, vState):
     statusStr = ''
     groupNotReadyStatuses = [Vehicle.VEHICLE_STATE.FALLOUT_BROKEN, Vehicle.VEHICLE_STATE.FALLOUT_MIN]
     if vState == Vehicle.VEHICLE_STATE.IN_PREMIUM_IGR_ONLY:
         icon = icons.premiumIgrSmall()
         statusStr = i18n.makeString('#menu:tankCarousel/vehicleStates/%s' % vState, icon=icon)
     elif vState not in groupNotReadyStatuses:
         statusStr = i18n.makeString('#menu:tankCarousel/vehicleStates/%s' % vState)
     return statusStr
Example #5
0
def _getStatusString(vState):
    if vState == Vehicle.VEHICLE_STATE.IN_PREMIUM_IGR_ONLY:
        status = i18n.makeString(
            '#menu:tankCarousel/vehicleStates/{}'.format(vState),
            icon=icons.premiumIgrSmall())
    elif vState not in (Vehicle.VEHICLE_STATE.FALLOUT_BROKEN,
                        Vehicle.VEHICLE_STATE.FALLOUT_MIN):
        status = i18n.makeString(
            '#menu:tankCarousel/vehicleStates/{}'.format(vState))
    else:
        status = ''
    return status
Example #6
0
def getComplexStatusWULF(statusKey, **kwargs):
    header, text = (None, None)
    if statusKey:
        headerKey = statusKey.dyn('header')
        textKey = statusKey.dyn('text')
        if headerKey.exists():
            header = backport.text(headerKey(), **kwargs)
        if textKey.exists():
            text = backport.text(textKey(), **kwargs)
        if headerKey is R.strings.tooltips.vehicleStatus.inPremiumIgrOnly.header:
            header = backport.text(headerKey(), icon=icons.premiumIgrSmall())
    return (header, text)
def _getStatusString(vState):
    if vState == Vehicle.VEHICLE_STATE.IN_PREMIUM_IGR_ONLY:
        status = i18n.makeString(
            '#menu:tankCarousel/vehicleStates/{}'.format(vState),
            icon=icons.premiumIgrSmall())
    elif vState not in (Vehicle.VEHICLE_STATE.FALLOUT_BROKEN,
                        Vehicle.VEHICLE_STATE.FALLOUT_MIN):
        status = i18n.makeString(
            '#menu:tankCarousel/vehicleStates/{}'.format(vState))
    else:
        status = ''
    return status
Example #8
0
    def _packWayToBuyBlock(self, item):
        subBlocks = [
            formatters.packTextBlockData(
                text=text_styles.middleTitle(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_WAYTOBUY_TITLE)),
                padding={"bottom": 6},
            )
        ]
        padding = {"left": 0}
        for buyItem in item["buyItems"]:
            buyItemDesc = text_styles.main(buyItem["desc"])
            if buyItem["type"] == BUY_ITEM_TYPE.WAYS_TO_BUY_FOREVER:
                if buyItem["isSale"]:
                    subBlocks.append(
                        formatters.packSaleTextParameterBlockData(
                            name=buyItemDesc, saleData={"newPrice": (0, buyItem["value"])}, padding=padding
                        )
                    )
                else:
                    price = text_styles.concatStylesWithSpace(
                        text_styles.gold(BigWorld.wg_getIntegralFormat(long(buyItem["value"]))), icons.gold()
                    )
                    subBlocks.append(
                        formatters.packTextParameterBlockData(name=buyItemDesc, value=price, valueWidth=70)
                    )
            elif buyItem["type"] == BUY_ITEM_TYPE.WAYS_TO_BUY_TEMP:
                if buyItem["isSale"]:
                    subBlocks.append(
                        formatters.packSaleTextParameterBlockData(
                            name=buyItemDesc, saleData={"newPrice": (buyItem["value"], 0)}, padding=padding
                        )
                    )
                else:
                    price = text_styles.concatStylesWithSpace(
                        text_styles.credits(BigWorld.wg_getIntegralFormat(long(buyItem["value"]))), icons.credits()
                    )
                    subBlocks.append(
                        formatters.packTextParameterBlockData(name=buyItemDesc, value=price, valueWidth=70)
                    )
            elif buyItem["type"] == BUY_ITEM_TYPE.WAYS_TO_BUY_IGR:
                subBlocks.append(
                    formatters.packTextParameterBlockData(
                        name=buyItemDesc, value=icons.premiumIgrSmall(), padding=padding
                    )
                )
            elif buyItem["type"] == BUY_ITEM_TYPE.WAYS_TO_BUY_MISSION:
                subBlocks.append(
                    formatters.packTextParameterBlockData(name=buyItemDesc, value=icons.quest(), padding=padding)
                )

        return formatters.packBuildUpBlockData(
            subBlocks, 0, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LINKAGE, {"left": 3}
        )
Example #9
0
    def __setCarouselData(self, blData):
        itemVOs = []
        selectedIndex = -1
        for item in blData['items']:
            element = item['element']
            isInQuest = checkInQuest(element, self.__controller.filter.purchaseType)
            if item['installedInCurrentSlot']:
                label = text_styles.main(VEHICLE_CUSTOMIZATION.CAROUSEL_ITEMLABEL_APPLIED)
            elif element.isInDossier:
                label = text_styles.main(VEHICLE_CUSTOMIZATION.CAROUSEL_ITEMLABEL_PURCHASED)
            elif element.getIgrType() != IGR_TYPE.NONE:
                if element.getIgrType() == self.igrCtrl.getRoomType():
                    label = text_styles.main(VEHICLE_CUSTOMIZATION.CAROUSEL_ITEMLABEL_PURCHASED)
                else:
                    label = icons.premiumIgrSmall()
            elif isInQuest:
                label = icons.quest()
            else:
                if item['duration'] == DURATION.PERMANENT:
                    priceFormatter = text_styles.gold
                    priceIcon = icons.gold()
                else:
                    priceFormatter = text_styles.credits
                    priceIcon = icons.credits()
                label = priceFormatter('{0}{1}'.format(element.getPrice(item['duration']), priceIcon))
            data = {'id': element.getID(),
             'icon': element.getTexturePath(),
             'label': label,
             'selected': item['appliedToCurrentSlot'] or item['installedInCurrentSlot'] and not blData['hasAppliedItem'],
             'goToTaskBtnVisible': isInQuest,
             'goToTaskBtnText': _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_ITEMCAROUSEL_RENDERER_GOTOTASK),
             'newElementIndicatorVisible': item['isNewElement']}
            if element.qualifier.getValue() > 0:
                data['bonusType'] = element.qualifier.getIcon16x16()
                data['bonusPower'] = text_styles.stats('+{0}%{1}'.format(element.qualifier.getValue(), '*' if element.qualifier.getDescription() is not None else ''))
            if data['selected']:
                selectedIndex = blData['items'].index(item)
            if element.isOnSale(item['duration']) and not element.isInDossier and not item['installedInCurrentSlot'] and not isInQuest:
                data['salePrice'] = getSalePriceString(self.__controller.slots.currentType, element, item['duration'])
            itemVOs.append(data)

        carouselLength = len(itemVOs)
        self.as_setCarouselDataS({'rendererList': itemVOs,
         'rendererWidth': blData['rendererWidth'],
         'filterCounter': '{0}{1}'.format(text_styles.stats(carouselLength) if carouselLength > 0 else text_styles.error(carouselLength), text_styles.main(_ms(VEHICLE_CUSTOMIZATION.CAROUSEL_FILTER_COUNTER, all=blData['unfilteredLength']))),
         'messageVisible': carouselLength == 0,
         'counterVisible': True,
         'goToIndex': blData['goToIndex'],
         'selectedIndex': selectedIndex})
        return
Example #10
0
def _getStatusString(vState, vStateLvl):
    if vState == Vehicle.VEHICLE_STATE.IN_PREMIUM_IGR_ONLY:
        status = i18n.makeString(
            '#menu:tankCarousel/vehicleStates/{}'.format(vState),
            icon=icons.premiumIgrSmall())
    else:
        status = i18n.makeString(
            '#menu:tankCarousel/vehicleStates/{}'.format(vState))
    if not status:
        return status
    elif vStateLvl == Vehicle.VEHICLE_STATE_LEVEL.CRITICAL:
        return text_styles.vehicleStatusCriticalText(status)
    else:
        return text_styles.vehicleStatusInfoText(status)
 def _getVehicleDataVO(self, vehicle):
     rentInfoText = RentLeftFormatter(
         vehicle.rentInfo, vehicle.isPremiumIGR).getRentLeftStr()
     vState, vStateLvl = vehicle.getState()
     smallStatus, largeStatus = _getStatusStrings(
         vState,
         vStateLvl,
         substitute=rentInfoText,
         ctx={'icon': icons.premiumIgrSmall()})
     if vehicle.dailyXPFactor > 1:
         bonusImage = getButtonsAssetPath('bonus_x{}'.format(
             vehicle.dailyXPFactor))
     else:
         bonusImage = ''
     label = vehicle.shortUserName if vehicle.isPremiumIGR else vehicle.userName
     labelStyle = text_styles.premiumVehicleName if vehicle.isPremium else text_styles.vehicleName
     return {
         'id':
         vehicle.invID,
         'infoText':
         largeStatus,
         'smallInfoText':
         smallStatus,
         'clanLock':
         vehicle.clanLock,
         'lockBackground':
         vStateLvl == Vehicle.VEHICLE_STATE_LEVEL.CRITICAL,
         'icon':
         vehicle.icon,
         'iconSmall':
         vehicle.iconSmall,
         'label':
         labelStyle(label),
         'level':
         vehicle.level,
         'premium':
         vehicle.isPremium,
         'favorite':
         vehicle.isFavorite,
         'nation':
         vehicle.nationID,
         'xpImgSource':
         bonusImage,
         'tankType':
         '{}_elite'.format(vehicle.type)
         if vehicle.isElite else vehicle.type,
         'rentLeft':
         rentInfoText
     }
Example #12
0
    def __setCarouselData(self, blData):
        itemVOs = []
        selectedIndex = -1
        for item in blData['items']:
            element = item['element']
            isInQuest = checkInQuest(element, self.__controller.filter.purchaseType)
            if item['installedInCurrentSlot']:
                label = text_styles.main(VEHICLE_CUSTOMIZATION.CAROUSEL_ITEMLABEL_APPLIED)
            elif element.isInDossier:
                label = text_styles.main(VEHICLE_CUSTOMIZATION.CAROUSEL_ITEMLABEL_PURCHASED)
            elif element.getIgrType() != IGR_TYPE.NONE:
                if element.getIgrType() == getIGRCtrl().getRoomType():
                    label = text_styles.main(VEHICLE_CUSTOMIZATION.CAROUSEL_ITEMLABEL_PURCHASED)
                else:
                    label = icons.premiumIgrSmall()
            elif isInQuest:
                label = icons.quest()
            else:
                if item['duration'] == DURATION.PERMANENT:
                    priceFormatter = text_styles.gold
                    priceIcon = icons.gold()
                else:
                    priceFormatter = text_styles.credits
                    priceIcon = icons.credits()
                label = priceFormatter('{0}{1}'.format(element.getPrice(item['duration']), priceIcon))
            data = {'id': element.getID(),
             'icon': element.getTexturePath(),
             'bonusType': element.qualifier.getIcon16x16(),
             'bonusPower': text_styles.stats('+{0}%{1}'.format(element.qualifier.getValue(), '*' if element.qualifier.getDescription() is not None else '')),
             'label': label,
             'selected': item['appliedToCurrentSlot'] or item['installedInCurrentSlot'] and not blData['hasAppliedItem'],
             'goToTaskBtnVisible': isInQuest,
             'goToTaskBtnText': _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_ITEMCAROUSEL_RENDERER_GOTOTASK),
             'newElementIndicatorVisible': item['isNewElement']}
            if data['selected']:
                selectedIndex = blData['items'].index(item)
            if element.isOnSale(item['duration']) and not element.isInDossier and not item['installedInCurrentSlot'] and not isInQuest:
                data['salePrice'] = getSalePriceString(self.__controller.slots.currentType, element, item['duration'])
            itemVOs.append(data)

        carouselLength = len(itemVOs)
        self.as_setCarouselDataS({'rendererList': itemVOs,
         'rendererWidth': blData['rendererWidth'],
         'filterCounter': '{0}{1}'.format(text_styles.stats(carouselLength) if carouselLength > 0 else text_styles.error(carouselLength), text_styles.main(_ms(VEHICLE_CUSTOMIZATION.CAROUSEL_FILTER_COUNTER, all=blData['unfilteredLength']))),
         'messageVisible': carouselLength == 0,
         'counterVisible': True,
         'goToIndex': blData['goToIndex'],
         'selectedIndex': selectedIndex})
        return
Example #13
0
    def __setCarouselData(self, blData):
        itemVOs = []
        for item in blData['items']:
            enable = True
            if item['installedInSlot']:
                label = text_styles.main(CUSTOMIZATION.CAROUSEL_ITEMLABEL_APPLIED)
            elif item['isInDossier']:
                label = text_styles.main(CUSTOMIZATION.CAROUSEL_ITEMLABEL_PURCHASED)
            elif item['object'].getIgrType() != IGR_TYPE.NONE:
                if item['object'].getIgrType() == getIGRCtrl().getRoomType():
                    label = text_styles.main(CUSTOMIZATION.CAROUSEL_ITEMLABEL_PURCHASED)
                else:
                    label = icons.premiumIgrSmall()
                    enable = False
            else:
                if item['priceIsGold']:
                    priceFormatter = text_styles.gold
                    priceIcon = icons.gold()
                else:
                    priceFormatter = text_styles.credits
                    priceIcon = icons.credits()
                label = priceFormatter('{0}{1}'.format(item['price'], priceIcon))
            data = {'id': item['id'],
             'icon': item['object'].getTexturePath(),
             'bonusType': item['object'].qualifier.getIcon16x16(),
             'bonusPower': text_styles.stats('+{0}%{1}'.format(item['object'].qualifier.getValue(), '*' if item['object'].qualifier.getDescription() is not None else '')),
             'label': label,
             'installed': item['appliedToCurrentSlot'],
             'btnSelect': self.__getLabelOfSelectBtn(item),
             'btnShoot': VEHICLE_CUSTOMIZATION.CUSTOMIZATIONITEMCAROUSEL_RENDERER_SHOOT,
             'btnTooltip': item['buttonTooltip'],
             'btnSelectEnable': enable,
             'doubleclickEnable': enable,
             'btnShootEnable': True}
            cType = g_customizationController.carousel.currentType
            if isSale(cType, item['duration']) and not item['isInDossier'] and not item['installedInSlot']:
                isGold = item['priceIsGold']
                data['salePrice'] = getSalePriceString(isGold, item['price'])
            itemVOs.append(data)

        carouselLength = len(itemVOs)
        self.as_setCarouselDataS({'rendererList': itemVOs,
         'rendererWidth': blData['rendererWidth'],
         'filterCounter': '{0}{1}'.format(text_styles.stats(carouselLength) if carouselLength > 0 else text_styles.error(carouselLength), text_styles.main(_ms(VEHICLE_CUSTOMIZATION.CAROUSEL_FILTER_COUNTER, all=blData['unfilteredLength']))),
         'messageVisible': carouselLength == 0,
         'counterVisible': True,
         'goToIndex': blData['goToIndex'],
         'selectedIndex': blData['selectedIndex']})
        return
Example #14
0
 def getStringStatus(self, vState):
     statusStr = ''
     groupNotReadyStatuses = [
         Vehicle.VEHICLE_STATE.FALLOUT_BROKEN,
         Vehicle.VEHICLE_STATE.FALLOUT_MIN
     ]
     if vState == Vehicle.VEHICLE_STATE.IN_PREMIUM_IGR_ONLY:
         icon = icons.premiumIgrSmall()
         statusStr = i18n.makeString('#menu:tankCarousel/vehicleStates/%s' %
                                     vState,
                                     icon=icon)
     elif vState not in groupNotReadyStatuses:
         statusStr = i18n.makeString('#menu:tankCarousel/vehicleStates/%s' %
                                     vState)
     return statusStr
Example #15
0
def _getPurchaseTypeVO():
    result = []
    for purchaseType, label in zip(PURCHASE_TYPE.ALL, _PURCHASE_TYPE_LABELS):
        purchaseVO = {'label': label, 'enabled': True}
        if purchaseType == PURCHASE_TYPE.IGR:
            if not GUI_SETTINGS.igrEnabled:
                continue
            purchaseVO['enabled'] = getIGRCtrl().getRoomType(
            ) == IGR_TYPE.PREMIUM
            purchaseVO['tooltipDisabled'] = makeTooltip(
                _ms(VEHICLE_CUSTOMIZATION.FILTER_TOOLTIP_IGR_DISABLED_HEADER),
                _ms(VEHICLE_CUSTOMIZATION.FILTER_TOOLTIP_IGR_DISABLED_BODY,
                    icon=_ms(icons.premiumIgrSmall())))
        result.append(purchaseVO)

    return result
    def __init__(self, ctx=None):
        super(FilterPopover, self).__init__()
        self.__filter = g_customizationController.carousel.filter
        self.__tooltipsMap = {
            QUALIFIER_TYPE.ALL:
            self.__createTooltip(
                VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_ENTIRECREW),
            QUALIFIER_TYPE.COMMANDER:
            self.__createTooltip(
                VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_COMMANDER),
            QUALIFIER_TYPE.GUNNER:
            self.__createTooltip(
                VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_AIMER),
            QUALIFIER_TYPE.DRIVER:
            self.__createTooltip(
                VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_DRIVER),
            QUALIFIER_TYPE.RADIOMAN:
            self.__createTooltip(
                VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_RADIOMAN),
            QUALIFIER_TYPE.LOADER:
            self.__createTooltip(
                VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_LOADER)
        }
        self.__enableGroupsFilter = True
        self.__filterTypeGroup = self.__filter.currentGroup
        self.__groupsMap = [[
            ('all_groups', CUSTOMIZATION.FILTER_POPOVER_GROUPS_ALL)
        ], [('all_groups', CUSTOMIZATION.FILTER_POPOVER_GROUPS_ALL)],
                            [('all_groups',
                              CUSTOMIZATION.FILTER_POPOVER_GROUPS_ALL)]]
        for cType in (CUSTOMIZATION_TYPE.CAMOUFLAGE, CUSTOMIZATION_TYPE.EMBLEM,
                      CUSTOMIZATION_TYPE.INSCRIPTION):
            for groupName, userName in self.__filter.availableGroupNames[
                    cType]:
                if groupName != 'group5' and groupName != 'IGR':
                    self.__groupsMap[cType].append((groupName, userName))

        self.__purchaseTypeMap = {
            PURCHASE_TYPE.PURCHASE: CUSTOMIZATION.FILTER_POPOVER_WAYSTOBUY_BUY,
            PURCHASE_TYPE.QUEST:
            CUSTOMIZATION.FILTER_POPOVER_WAYSTOBUY_MISSIONS,
            PURCHASE_TYPE.ACTION: CUSTOMIZATION.FILTER_POPOVER_WAYSTOBUY_EVENT,
            PURCHASE_TYPE.IGR: icons.premiumIgrSmall()
        }
        self.__purchaseTypeList = [PURCHASE_TYPE.PURCHASE, PURCHASE_TYPE.QUEST]
        if GUI_SETTINGS.igrEnabled:
            self.__purchaseTypeList.append(PURCHASE_TYPE.IGR)
    def __getPurchaseTypeVO(self):
        result = []
        for purchaseType in self.__purchaseTypeList:
            purchaseVO = {
                'label': self.__purchaseTypeMap[purchaseType],
                'enabled': True
            }
            if purchaseType == PURCHASE_TYPE.IGR:
                purchaseVO['enabled'] = getIGRCtrl().getRoomType(
                ) == IGR_TYPE.PREMIUM
                purchaseVO['tooltipDisabled'] = makeTooltip(
                    _ms(CUSTOMIZATION.FILTER_TOOLTIP_IGR_DISABLED_HEADER),
                    _ms(CUSTOMIZATION.FILTER_TOOLTIP_IGR_DISABLED_BODY,
                        icon=_ms(icons.premiumIgrSmall())))
            result.append(purchaseVO)

        return result
Example #18
0
    def _packSuitableBlock(self):
        blocks = []
        for node in self._item.descriptor.filter.include:
            conditions = []
            separator = ''.join(['  ', icons.makeImageTag(RES_ICONS.MAPS_ICONS_CUSTOMIZATION_TOOLTIP_SEPARATOR, 3, 21, -6), '  '])
            if node.levels:
                conditions.append(text_styles.main(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_SUITABLE_TIER))
                for level in node.levels:
                    conditions.append(text_styles.stats(int2roman(level)))
                    conditions.append(text_styles.stats(', '))

                conditions = conditions[:-1]
                conditions.append(separator)
            if node.nations:
                for nation in node.nations:
                    name = nations.NAMES[nation]
                    conditions.append(icons.makeImageTag(getNationsFilterAssetPath(name), 26, 16, -4))
                    conditions.append('  ')

                conditions = conditions[:-1]
                conditions.append(separator)
            if node.tags:
                for vehType in VEHICLE_TYPES_ORDER:
                    if vehType in node.tags:
                        conditions.append(icons.makeImageTag(RES_ICONS.getFilterVehicleType(vehType), 27, 17, -4))

                if VEHICLE_CLASS_TAGS & node.tags:
                    conditions.append(separator)
                if VEHICLE_TAGS.PREMIUM in node.tags:
                    conditions.append(icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_PREM_SMALL_ICON, 20, 17, -4))
                    conditions.append(separator)
                if VEHICLE_TAGS.PREMIUM_IGR in node.tags:
                    conditions.append(icons.premiumIgrSmall())
                    conditions.append(separator)
            if not conditions:
                continue
            icn = text_styles.concatStylesToSingleLine(*conditions[:-1])
            blocks.append(formatters.packTextBlockData(text=icn, padding={'top': -2}))
            blocks.append(formatters.packTextBlockData(text=text_styles.neutral(VEHICLE_CUSTOMIZATION.FILTER_OR), padding={'top': -4}))

        if not blocks:
            return None
        else:
            blocks.insert(0, formatters.packTitleDescBlock(title=text_styles.middleTitle(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_SUITABLE_TITLE)))
            return formatters.packBuildUpBlockData(blocks=blocks[:-1], padding={'top': -3})
Example #19
0
def _getInitialVO(filters, hasRentedVehicles):
    dataVO = {'nationTypeId': _SECTIONS.NATION,
     'vehicleTypeId': _SECTIONS.VEHICLE_TYPE,
     'specialTypesLeftId': _SECTIONS.SPECIAL_LEFT,
     'specialTypesRightId': _SECTIONS.SPECIAL_RIGHT,
     'levelTypesId': _SECTIONS.LEVELS,
     'rentVehicleId': _SECTIONS.RENT_VEHICLE,
     'titleLabel': text_styles.highTitle('#tank_carousel_filter:filter/popover/title'),
     'nationLabel': text_styles.standard('#tank_carousel_filter:filter/popover/label/nation'),
     'vehicleTypeLabel': text_styles.standard('#tank_carousel_filter:filter/popover/label/vehicle'),
     'vehicleLevelLabel': text_styles.standard('#tank_carousel_filter:filter/popover/label/vehicleLevel'),
     'vehicleEliteTypeLabel': text_styles.standard('#tank_carousel_filter:filter/popover/label/vehicleEliteType'),
     'btnDefaultTooltip': makeTooltip('#tank_carousel_filter:filter/popover/tooltip/defaultBtn/header', '#tank_carousel_filter:filter/popover/tooltip/defaultBtn/body'),
     'btnDefaultLabel': _ms('#tank_carousel_filter:filter/popover/label/defaultBtn'),
     'specialTypeLeft': [{'label': text_styles.standard('#tank_carousel_filter:filter/popover/checkBox/Premium'),
                          'tooltip': makeTooltip('#tank_carousel_filter:filter/popover/tooltip/premium/header', '#tank_carousel_filter:filter/popover/tooltip/premium/body'),
                          'selected': filters['premium']}],
     'specialTypeRight': [{'label': text_styles.standard('#tank_carousel_filter:filter/popover/checkBox/Elite'),
                           'tooltip': makeTooltip('#tank_carousel_filter:filter/popover/tooltip/elite/header', '#tank_carousel_filter:filter/popover/tooltip/elite/body'),
                           'selected': filters['elite']}],
     'nationsType': [],
     'vehicleType': [],
     'levelsType': [],
     'hasRentedVehicles': hasRentedVehicles,
     'rentCheckBox': {'label': text_styles.standard('#tank_carousel_filter:filter/popover/label/vehicleLease'),
                      'selected': filters['hideRented'],
                      'enabled': not filters['igr'] if constants.IS_KOREA else True}}
    if constants.IS_KOREA:
        dataVO['specialTypeLeft'].append({'label': icons.premiumIgrSmall(),
         'selected': filters['igr']})
    for nation in GUI_NATIONS:
        dataVO['nationsType'].append({'value': getNationsFilterAssetPath(nation),
         'tooltip': makeTooltip(_ms('#nations:%s' % nation), _ms('#tank_carousel_filter:filter/popover/tooltip/nation/body')),
         'selected': filters[nation]})

    for level in VEHICLE_LEVELS:
        dataVO['levelsType'].append({'value': getLevelsAssetPath(level),
         'selected': filters['level_%d' % level]})

    for vehicleType in VEHICLE_TYPES_ORDER:
        dataVO['vehicleType'].append({'value': getVehicleTypeAssetPath(vehicleType),
         'tooltip': makeTooltip(_ms('#menu:carousel_tank_filter/%s' % vehicleType), _ms('#tank_carousel_filter:filter/popover/tooltip/vehicleType/body')),
         'selected': filters[vehicleType]})

    return dataVO
Example #20
0
    def __init__(self, ctx = None):
        super(FilterPopover, self).__init__()
        self.__filter = g_customizationController.carousel.filter
        self.__tooltipsMap = {QUALIFIER_TYPE.ALL: self.__createTooltip(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_ENTIRECREW),
         QUALIFIER_TYPE.COMMANDER: self.__createTooltip(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_COMMANDER),
         QUALIFIER_TYPE.GUNNER: self.__createTooltip(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_AIMER),
         QUALIFIER_TYPE.DRIVER: self.__createTooltip(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_DRIVER),
         QUALIFIER_TYPE.RADIOMAN: self.__createTooltip(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_RADIOMAN),
         QUALIFIER_TYPE.LOADER: self.__createTooltip(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_LOADER)}
        self.__groupsMap = [[('all_groups', CUSTOMIZATION.FILTER_POPOVER_GROUPS_ALL)], [('all_groups', CUSTOMIZATION.FILTER_POPOVER_GROUPS_ALL)], [('all_groups', CUSTOMIZATION.FILTER_POPOVER_GROUPS_ALL)]]
        for cType in (CUSTOMIZATION_TYPE.CAMOUFLAGE, CUSTOMIZATION_TYPE.EMBLEM, CUSTOMIZATION_TYPE.INSCRIPTION):
            for groupName, userName in self.__filter.availableGroupNames[cType]:
                self.__groupsMap[cType].append((groupName, userName))

        self.__purchaseTypeMap = {PURCHASE_TYPE.PURCHASE: CUSTOMIZATION.FILTER_POPOVER_WAYSTOBUY_BUY,
         PURCHASE_TYPE.QUEST: CUSTOMIZATION.FILTER_POPOVER_WAYSTOBUY_MISSIONS,
         PURCHASE_TYPE.ACTION: CUSTOMIZATION.FILTER_POPOVER_WAYSTOBUY_EVENT,
         PURCHASE_TYPE.IGR: icons.premiumIgrSmall()}
Example #21
0
def getComplexStatus(statusKey):
    try:
        if not statusKey:
            return (None, None)
        headerKey = statusKey + '/header'
        textKey = statusKey + '/text'
        header = makeString(headerKey)
        text = makeString(textKey)
        if headerKey == TOOLTIPS.VEHICLESTATUS_INPREMIUMIGRONLY_HEADER:
            icon = icons.premiumIgrSmall()
            header = makeString(headerKey, icon=icon)
        if header == headerKey.split(':', 1)[1]:
            header = None
        if text == textKey.split(':', 1)[1]:
            text = None
        return (header, text)
    except Exception:
        LOG_CURRENT_EXCEPTION()
        return (None, None)
Example #22
0
def getComplexStatus(statusKey):
    try:
        if not statusKey:
            return (None, None)
        headerKey = statusKey + '/header'
        textKey = statusKey + '/text'
        header = makeString(headerKey)
        text = makeString(textKey)
        if headerKey == TOOLTIPS.VEHICLESTATUS_INPREMIUMIGRONLY_HEADER:
            icon = icons.premiumIgrSmall()
            header = makeString(headerKey, icon=icon)
        if header == headerKey.split(':', 1)[1]:
            header = None
        if text == textKey.split(':', 1)[1]:
            text = None
        return (header, text)
    except Exception:
        LOG_CURRENT_EXCEPTION()
        return (None, None)
Example #23
0
 def __packSpecialTypeBlock(self):
     string = ''
     addComma = lambda str: ('{0}, '.format(str) if str else str)
     if self._specials['premium']:
         string += _ms(TANK_CAROUSEL_FILTER.INFOTIP_ONLY_PREMIUM)
     if self._specials['elite']:
         string = addComma(string)
         string += _ms(TANK_CAROUSEL_FILTER.INFOTIP_ONLY_ELITE)
     if self._specials['favorite']:
         string = addComma(string)
         string += _ms(TANK_CAROUSEL_FILTER.INFOTIP_ONLY_FAVORITE)
     if self._specials['bonus']:
         icon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_MULTYXP)
         xpRate = text_styles.stats('x{0}'.format(self.itemsCache.items.shop.dailyXPFactor))
         string = addComma(string)
         string += '{0}{1}'.format(icon, xpRate)
     if self._specials['igr']:
         string = addComma(string)
         string += icons.premiumIgrSmall()
     return formatters.packTextBlockData(text=text_styles.main(string), padding=formatters.packPadding(top=-5, bottom=5, left=15))
Example #24
0
 def __packSpecialTypeBlock(self):
     string = ''
     addComma = lambda str: ('{0}, '.format(str) if str else str)
     if self._specials['premium']:
         string += _ms(TANK_CAROUSEL_FILTER.INFOTIP_ONLY_PREMIUM)
     if self._specials['elite']:
         string = addComma(string)
         string += _ms(TANK_CAROUSEL_FILTER.INFOTIP_ONLY_ELITE)
     if self._specials['favorite']:
         string = addComma(string)
         string += _ms(TANK_CAROUSEL_FILTER.INFOTIP_ONLY_FAVORITE)
     if self._specials['bonus']:
         icon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_MULTYXP)
         xpRate = text_styles.stats('x{0}'.format(g_itemsCache.items.shop.dailyXPFactor))
         string = addComma(string)
         string += '{0}{1}'.format(icon, xpRate)
     if self._specials['igr']:
         string = addComma(string)
         string += icons.premiumIgrSmall()
     return formatters.packTextBlockData(text=text_styles.main(string), padding=formatters.packPadding(top=-5, bottom=5, left=15))
Example #25
0
    def _packAlreadyHaveBlock(self, item):
        subBlocks = [
            formatters.packTextBlockData(
                text=text_styles.middleTitle(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_ALREADYHAVE_TITLE)),
                padding={"bottom": 6},
            )
        ]
        padding = {"left": 10}
        for buyItem in item["buyItems"]:
            buyItemDesc = text_styles.main(buyItem["desc"])
            if buyItem["type"] == BUY_ITEM_TYPE.ALREADY_HAVE_IGR:
                subBlocks.append(
                    formatters.packTextParameterBlockData(
                        name=buyItemDesc, value=icons.premiumIgrSmall(), padding=padding
                    )
                )
            else:
                subBlocks.append(formatters.packTextParameterBlockData(name=buyItemDesc, value="", padding=padding))

        return formatters.packBuildUpBlockData(
            subBlocks, 0, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LINKAGE, {"left": 3}
        )
def getSuitableText(item, currentVehicle=None, formatVehicle=True):
    conditions = []
    for node in item.descriptor.filter.include:
        separator = ' '.join(['  ', icons.makeImageTag(RES_ICONS.MAPS_ICONS_CUSTOMIZATION_TOOLTIP_SEPARATOR, 3, 21, -6), '  '])
        if node.nations:
            sortedNations = sorted(node.nations, key=GUI_NATIONS_ORDER_INDICES.get)
            for nation in sortedNations:
                name = nations.NAMES[nation]
                conditions.append(icons.makeImageTag(getNationsFilterAssetPath(name), 26, 16, -4))
                conditions.append('  ')

            conditions = conditions[:-1]
            conditions.append(' ')
        if node.tags:
            for vehType in VEHICLE_TYPES_ORDER:
                if vehType in node.tags:
                    conditions.append(icons.makeImageTag(RES_ICONS.getFilterVehicleType(vehType), 27, 17, -4))

            if VEHICLE_CLASS_TAGS & node.tags:
                conditions.append(separator)
            if VEHICLE_TAGS.PREMIUM in node.tags:
                conditions.append(icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_PREM_SMALL_ICON, 20, 17, -4))
            if VEHICLE_TAGS.PREMIUM_IGR in node.tags:
                conditions.append(icons.premiumIgrSmall())
                conditions.append(separator)
        if node.levels:
            for level in node.levels:
                conditions.append(text_styles.stats(int2roman(level)))
                conditions.append(text_styles.stats(', '))

            conditions = conditions[:-1]
            conditions.append(separator)
        if node.vehicles:
            vehicleName = makeVehiclesShortNamesString(set(node.vehicles), currentVehicle, flat=True)
            conditions.append(text_styles.main(vehicleName) if formatVehicle else vehicleName)
            conditions.append(separator)

    return text_styles.concatStylesToSingleLine(*conditions[:-1])
Example #27
0
    def _packWayToBuyBlock(self, data):
        subBlocks = [formatters.packTextBlockData(text=text_styles.middleTitle(_ms('#vehicle_customization:customization/tooltip/wayToBuy/title')), padding={'bottom': 6})]
        for buyItem in data['buyItems']:
            buyItemDesc = text_styles.main(buyItem['desc'])
            if buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_MISSION:
                subBlocks.append(formatters.packImageTextBlockData(desc=buyItemDesc, img=RES_ICONS.MAPS_ICONS_LIBRARY_QUEST_ICON, imgPadding={'left': 53,
                 'top': 3}, txtGap=-4, txtOffset=73))
            elif buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_FOREVER:
                if buyItem['isSale']:
                    subBlocks.append(formatters.packSaleTextParameterBlockData(name=buyItemDesc, saleData={'newPrice': (0, buyItem['value'])}, padding={'left': 0}))
                else:
                    price = text_styles.concatStylesWithSpace(text_styles.gold(BigWorld.wg_getIntegralFormat(long(buyItem['value']))), icons.gold())
                    subBlocks.append(formatters.packTextParameterBlockData(name=buyItemDesc, value=price, valueWidth=70))
            elif buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_TEMP:
                if buyItem['isSale']:
                    subBlocks.append(formatters.packSaleTextParameterBlockData(name=buyItemDesc, saleData={'newPrice': (buyItem['value'], 0)}, padding={'left': 0}))
                else:
                    price = text_styles.concatStylesWithSpace(text_styles.credits(BigWorld.wg_getIntegralFormat(long(buyItem['value']))), icons.credits())
                    subBlocks.append(formatters.packTextParameterBlockData(name=buyItemDesc, value=price, valueWidth=70))
            elif buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_IGR:
                subBlocks.append(formatters.packTextParameterBlockData(name=buyItemDesc, value=icons.premiumIgrSmall(), padding={'left': 0}))

        return formatters.packBuildUpBlockData(subBlocks, 0, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LINKAGE, {'left': 3})
Example #28
0
from gui.Scaleform.daapi.view.meta.CustomizationFiltersPopoverMeta import CustomizationFiltersPopoverMeta
from gui.Scaleform.locale.VEHICLE_CUSTOMIZATION import VEHICLE_CUSTOMIZATION
from gui.customization import g_customizationController
from gui.customization.shared import CUSTOMIZATION_TYPE, getBonusIcon16x16, FILTER_TYPE, QUALIFIER_TYPE_INDEX, PURCHASE_TYPE, DEFAULT_GROUP_VALUE, EMBLEM_IGR_GROUP_NAME, OTHER_GROUP_NAME
from gui.shared.formatters import text_styles, icons
from gui.shared.utils.functions import makeTooltip
from helpers import dependency
from helpers.i18n import makeString as _ms
from skeletons.gui.game_control import IIGRController
_BONUS_TOOLTIPS = (VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_ENTIRECREW,
 VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_COMMANDER,
 VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_AIMER,
 VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_DRIVER,
 VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_RADIOMAN,
 VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_LOADER)
_PURCHASE_TYPE_LABELS = (VEHICLE_CUSTOMIZATION.FILTER_POPOVER_WAYSTOBUY_BUY, VEHICLE_CUSTOMIZATION.FILTER_POPOVER_WAYSTOBUY_MISSIONS, icons.premiumIgrSmall())
GROUP_NAMES_FILTER_ORDER = (DEFAULT_GROUP_VALUE,
 'group9',
 'group1',
 'group2',
 'group4')
GROUP_NAMES_FILTER_ORDER_INDICES = dict(((n, i) for i, n in enumerate(GROUP_NAMES_FILTER_ORDER)))
UNKNOWN_GROUP_NAMES_FILTER_ORDER = 100
OTHER_GROUP_NAMES_FILTER_ORDER = 101

def _getPurchaseTypeVO():
    result = []
    igrCtrl = dependency.instance(IIGRController)
    for purchaseType, label in zip(PURCHASE_TYPE.ALL, _PURCHASE_TYPE_LABELS):
        purchaseVO = {'label': label,
         'enabled': True}
def getVehicleDataVO(vehicle):
    lowTierMMController = dependency.instance(ILowTierMMController)
    rentInfoText = RentLeftFormatter(vehicle.rentInfo,
                                     vehicle.isPremiumIGR).getRentLeftStr()
    vState, vStateLvl = vehicle.getState()
    if vehicle.isRotationApplied():
        if vState in (Vehicle.VEHICLE_STATE.AMMO_NOT_FULL,
                      Vehicle.VEHICLE_STATE.LOCKED):
            vState = Vehicle.VEHICLE_STATE.ROTATION_GROUP_UNLOCKED
    if not vehicle.activeInNationGroup:
        vState = Vehicle.VEHICLE_STATE.NOT_PRESENT
    customStateExt = ''
    if vState in (Vehicle.VEHICLE_STATE.RENTABLE,
                  Vehicle.VEHICLE_STATE.RENTABLE_AGAIN):
        rentPackagesInfo = vehicle.getRentPackagesInfo
        if rentPackagesInfo.seasonType:
            customStateExt = '/' + SEASON_NAME_BY_TYPE.get(
                rentPackagesInfo.seasonType)
    smallStatus, largeStatus = getStatusStrings(vState + customStateExt,
                                                vStateLvl,
                                                substitute=rentInfoText,
                                                ctx={
                                                    'icon':
                                                    icons.premiumIgrSmall(),
                                                    'battlesLeft':
                                                    getBattlesLeft(vehicle)
                                                })
    smallHoverStatus, largeHoverStatus = smallStatus, largeStatus
    if vState == Vehicle.VEHICLE_STATE.RENTABLE:
        smallHoverStatus, largeHoverStatus = getStatusStrings(
            vState + '/hover',
            vStateLvl,
            substitute=rentInfoText,
            ctx={
                'icon': icons.premiumIgrSmall(),
                'battlesLeft': getBattlesLeft(vehicle)
            })
    if vehicle.dailyXPFactor > 1:
        bonusImage = getButtonsAssetPath('bonus_x{}'.format(
            vehicle.dailyXPFactor))
    else:
        bonusImage = ''
    label = vehicle.shortUserName if vehicle.isPremiumIGR else vehicle.userName
    labelStyle = text_styles.premiumVehicleName if vehicle.isPremium else text_styles.vehicleName
    tankType = '{}_elite'.format(
        vehicle.type) if vehicle.isElite else vehicle.type
    current, maximum = vehicle.getCrystalsEarnedInfo()
    isCrystalsLimitReached = current == maximum
    return {
        'id':
        vehicle.invID,
        'intCD':
        vehicle.intCD,
        'infoText':
        largeStatus,
        'infoHoverText':
        largeHoverStatus,
        'smallInfoText':
        smallStatus,
        'smallInfoHoverText':
        smallHoverStatus,
        'clanLock':
        vehicle.clanLock,
        'lockBackground':
        _isLockedBackground(vState, vStateLvl),
        'icon':
        vehicle.icon,
        'iconAlt':
        getIconPath('noImage'),
        'iconSmall':
        vehicle.iconSmall,
        'iconSmallAlt':
        getSmallIconPath('noImage'),
        'label':
        labelStyle(label),
        'level':
        vehicle.level,
        'premium':
        vehicle.isPremium,
        'favorite':
        vehicle.isFavorite,
        'giveaway':
        vehicle.isLowTierEvent and lowTierMMController.isEnabled(),
        'nation':
        vehicle.nationID,
        'xpImgSource':
        bonusImage,
        'tankType':
        tankType,
        'rentLeft':
        rentInfoText,
        'clickEnabled':
        vehicle.isInInventory and vehicle.activeInNationGroup
        or vehicle.isRentPromotion,
        'alpha':
        1,
        'infoImgSrc':
        getVehicleStateIcon(vState),
        'additionalImgSrc':
        getVehicleStateAddIcon(vState),
        'isCritInfo':
        vStateLvl == Vehicle.VEHICLE_STATE_LEVEL.CRITICAL,
        'isRentPromotion':
        vehicle.isRentPromotion and not vehicle.isRented,
        'isNationChangeAvailable':
        vehicle.hasNationGroup,
        'isEarnCrystals':
        vehicle.isEarnCrystals,
        'isCrystalsLimitReached':
        isCrystalsLimitReached,
        'isUseRightBtn':
        True,
        'tooltip':
        TOOLTIPS_CONSTANTS.CAROUSEL_VEHICLE
    }
Example #30
0
    def __setCarouselData(self, blData):
        itemVOs = []
        for item in blData['items']:
            if item['installedInSlot']:
                label = text_styles.main(
                    CUSTOMIZATION.CAROUSEL_ITEMLABEL_APPLIED)
            elif item['isInDossier']:
                label = text_styles.main(
                    CUSTOMIZATION.CAROUSEL_ITEMLABEL_PURCHASED)
            elif item['object'].getIgrType() != IGR_TYPE.NONE:
                if item['object'].getIgrType() == getIGRCtrl().getRoomType():
                    label = text_styles.main(
                        CUSTOMIZATION.CAROUSEL_ITEMLABEL_PURCHASED)
                else:
                    label = icons.premiumIgrSmall()
            elif item['isInQuests']:
                label = icons.quest()
            else:
                if item['priceIsGold']:
                    priceFormatter = text_styles.gold
                    priceIcon = icons.gold()
                else:
                    priceFormatter = text_styles.credits
                    priceIcon = icons.credits()
                label = priceFormatter('{0}{1}'.format(item['price'],
                                                       priceIcon))
            data = {
                'id':
                item['id'],
                'icon':
                item['object'].getTexturePath(),
                'bonusType':
                item['object'].qualifier.getIcon16x16(),
                'bonusPower':
                text_styles.stats('+{0}%{1}'.format(
                    item['object'].qualifier.getValue(),
                    '*' if item['object'].qualifier.getDescription()
                    is not None else '')),
                'label':
                label,
                'selected':
                item['appliedToCurrentSlot'],
                'goToTaskBtnVisible':
                item['isInQuests'],
                'goToTaskBtnText':
                _ms(VEHICLE_CUSTOMIZATION.
                    CUSTOMIZATION_ITEMCAROUSEL_RENDERER_GOTOTASK),
                'newElementIndicatorVisible':
                False
            }
            cType = g_customizationController.carousel.currentType
            if item['object'].isSale(
                    item['duration']) and not item['isInDossier'] and not item[
                        'installedInSlot'] and not item['isInQuests']:
                data['salePrice'] = getSalePriceString(cType, item['object'],
                                                       item['duration'])
            itemVOs.append(data)

        carouselLength = len(itemVOs)
        self.as_setCarouselDataS({
            'rendererList':
            itemVOs,
            'rendererWidth':
            blData['rendererWidth'],
            'filterCounter':
            '{0}{1}'.format(
                text_styles.stats(carouselLength)
                if carouselLength > 0 else text_styles.error(carouselLength),
                text_styles.main(
                    _ms(VEHICLE_CUSTOMIZATION.CAROUSEL_FILTER_COUNTER,
                        all=blData['unfilteredLength']))),
            'messageVisible':
            carouselLength == 0,
            'counterVisible':
            True,
            'goToIndex':
            blData['goToIndex'],
            'selectedIndex':
            blData['selectedIndex']
        })
        return
Example #31
0
    def _packWayToBuyBlock(self, data):
        subBlocks = [
            formatters.packTextBlockData(text=text_styles.middleTitle(
                _ms('#vehicle_customization:customization/tooltip/wayToBuy/title'
                    )),
                                         padding={'bottom': 6})
        ]
        for buyItem in data['buyItems']:
            buyItemDesc = text_styles.main(buyItem['desc'])
            if buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_MISSION:
                subBlocks.append(
                    formatters.packImageTextBlockData(
                        desc=buyItemDesc,
                        img=RES_ICONS.MAPS_ICONS_LIBRARY_QUEST_ICON,
                        imgPadding={
                            'left': 53,
                            'top': 3
                        },
                        txtGap=-4,
                        txtOffset=73))
            elif buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_FOREVER:
                if buyItem['isSale']:
                    subBlocks.append(
                        formatters.packSaleTextParameterBlockData(
                            name=buyItemDesc,
                            saleData={'newPrice': (0, buyItem['value'])},
                            padding={'left': 0}))
                else:
                    price = text_styles.concatStylesWithSpace(
                        text_styles.gold(
                            BigWorld.wg_getIntegralFormat(
                                long(buyItem['value']))), icons.gold())
                    subBlocks.append(
                        formatters.packTextParameterBlockData(name=buyItemDesc,
                                                              value=price,
                                                              valueWidth=70))
            elif buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_TEMP:
                if buyItem['isSale']:
                    subBlocks.append(
                        formatters.packSaleTextParameterBlockData(
                            name=buyItemDesc,
                            saleData={'newPrice': (buyItem['value'], 0)},
                            padding={'left': 0}))
                else:
                    price = text_styles.concatStylesWithSpace(
                        text_styles.credits(
                            BigWorld.wg_getIntegralFormat(
                                long(buyItem['value']))), icons.credits())
                    subBlocks.append(
                        formatters.packTextParameterBlockData(name=buyItemDesc,
                                                              value=price,
                                                              valueWidth=70))
            elif buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_IGR:
                subBlocks.append(
                    formatters.packTextParameterBlockData(
                        name=buyItemDesc,
                        value=icons.premiumIgrSmall(),
                        padding={'left': 0}))

        return formatters.packBuildUpBlockData(
            subBlocks, 0, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LINKAGE,
            {'left': 3})
def getVehicleDataVO(vehicle):
    rentInfoText = RentLeftFormatter(vehicle.rentInfo, vehicle.isPremiumIGR).getRentLeftStr()
    vState, vStateLvl = vehicle.getState()
    if vehicle.isRotationApplied():
        if vState in (Vehicle.VEHICLE_STATE.AMMO_NOT_FULL, Vehicle.VEHICLE_STATE.LOCKED):
            vState = Vehicle.VEHICLE_STATE.ROTATION_GROUP_UNLOCKED
    smallStatus, largeStatus = getStatusStrings(vState, vStateLvl, substitute=rentInfoText, ctx={'icon': icons.premiumIgrSmall(),
     'battlesLeft': getBattlesLeft(vehicle)})
    if vehicle.dailyXPFactor > 1:
        bonusImage = getButtonsAssetPath('bonus_x{}'.format(vehicle.dailyXPFactor))
    else:
        bonusImage = ''
    label = vehicle.shortUserName if vehicle.isPremiumIGR else vehicle.userName
    labelStyle = text_styles.premiumVehicleName if vehicle.isPremium else text_styles.vehicleName
    return {'id': vehicle.invID,
     'intCD': vehicle.intCD,
     'infoText': largeStatus,
     'smallInfoText': smallStatus,
     'clanLock': vehicle.clanLock,
     'lockBackground': _isLockedBackground(vState, vStateLvl),
     'icon': vehicle.icon,
     'iconAlt': getIconPath('noImage'),
     'iconSmall': vehicle.iconSmall,
     'iconSmallAlt': getSmallIconPath('noImage'),
     'label': labelStyle(label),
     'level': vehicle.level,
     'premium': vehicle.isPremium,
     'favorite': vehicle.isFavorite,
     'nation': vehicle.nationID,
     'xpImgSource': bonusImage,
     'tankType': '{}_elite'.format(vehicle.type) if vehicle.isElite else vehicle.type,
     'rentLeft': rentInfoText,
     'clickEnabled': vehicle.isInInventory,
     'alpha': 1,
     'infoImgSrc': getVehicleStateIcon(vState),
     'isCritInfo': vStateLvl == Vehicle.VEHICLE_STATE_LEVEL.CRITICAL}
def _getStatusString(vState, vStateLvl):
    if vState == Vehicle.VEHICLE_STATE.IN_PREMIUM_IGR_ONLY:
        status = i18n.makeString('#menu:tankCarousel/vehicleStates/{}'.format(vState), icon=icons.premiumIgrSmall())
    else:
        status = i18n.makeString('#menu:tankCarousel/vehicleStates/{}'.format(vState))
    if not status:
        return status
    elif vStateLvl == Vehicle.VEHICLE_STATE_LEVEL.CRITICAL:
        return text_styles.vehicleStatusCriticalText(status)
    else:
        return text_styles.vehicleStatusInfoText(status)
from gui import GUI_SETTINGS
from gui.game_control import getIGRCtrl
from gui.shared.formatters import text_styles, icons
from gui.shared.utils.functions import makeTooltip
from gui.Scaleform.locale.VEHICLE_CUSTOMIZATION import VEHICLE_CUSTOMIZATION
from gui.Scaleform.daapi.view.meta.CustomizationFiltersPopoverMeta import CustomizationFiltersPopoverMeta
from helpers.i18n import makeString as _ms
from gui.customization import g_customizationController
from gui.customization.shared import CUSTOMIZATION_TYPE, getBonusIcon16x16, FILTER_TYPE, QUALIFIER_TYPE_INDEX, PURCHASE_TYPE, DEFAULT_GROUP_VALUE, EMBLEM_IGR_GROUP_NAME
_BONUS_TOOLTIPS = (VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_ENTIRECREW,
 VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_COMMANDER,
 VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_AIMER,
 VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_DRIVER,
 VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_RADIOMAN,
 VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_LOADER)
_PURCHASE_TYPE_LABELS = (VEHICLE_CUSTOMIZATION.FILTER_POPOVER_WAYSTOBUY_BUY, VEHICLE_CUSTOMIZATION.FILTER_POPOVER_WAYSTOBUY_MISSIONS, icons.premiumIgrSmall())

def _getPurchaseTypeVO():
    result = []
    for purchaseType, label in zip(PURCHASE_TYPE.ALL, _PURCHASE_TYPE_LABELS):
        purchaseVO = {'label': label,
         'enabled': True}
        if purchaseType == PURCHASE_TYPE.IGR:
            if not GUI_SETTINGS.igrEnabled:
                continue
            purchaseVO['enabled'] = getIGRCtrl().getRoomType() == IGR_TYPE.PREMIUM
            purchaseVO['tooltipDisabled'] = makeTooltip(_ms(VEHICLE_CUSTOMIZATION.FILTER_TOOLTIP_IGR_DISABLED_HEADER), _ms(VEHICLE_CUSTOMIZATION.FILTER_TOOLTIP_IGR_DISABLED_BODY, icon=_ms(icons.premiumIgrSmall())))
        result.append(purchaseVO)

    return result
Example #35
0
 def getStringStatus(self, vState):
     if vState == Vehicle.VEHICLE_STATE.IN_PREMIUM_IGR_ONLY:
         icon = icons.premiumIgrSmall()
         return i18n.makeString('#menu:tankCarousel/vehicleStates/%s' % vState, icon=icon)
     return i18n.makeString('#menu:tankCarousel/vehicleStates/%s' % vState)
 def _getVehicleDataVO(self, vehicle):
     rentInfoText = RentLeftFormatter(vehicle.rentInfo, vehicle.isPremiumIGR).getRentLeftStr()
     vState, vStateLvl = vehicle.getState()
     smallStatus, largeStatus = _getStatusStrings(vState, vStateLvl, substitute=rentInfoText, ctx={'icon': icons.premiumIgrSmall()})
     if vehicle.dailyXPFactor > 1:
         bonusImage = getButtonsAssetPath('bonus_x{}'.format(vehicle.dailyXPFactor))
     else:
         bonusImage = ''
     label = vehicle.shortUserName if vehicle.isPremiumIGR else vehicle.userName
     labelStyle = text_styles.premiumVehicleName if vehicle.isPremium else text_styles.vehicleName
     return {'id': vehicle.invID,
      'infoText': largeStatus,
      'smallInfoText': smallStatus,
      'clanLock': vehicle.clanLock,
      'lockBackground': vStateLvl == Vehicle.VEHICLE_STATE_LEVEL.CRITICAL,
      'icon': vehicle.icon,
      'iconSmall': vehicle.iconSmall,
      'label': labelStyle(label),
      'level': vehicle.level,
      'premium': vehicle.isPremium,
      'favorite': vehicle.isFavorite,
      'nation': vehicle.nationID,
      'xpImgSource': bonusImage,
      'tankType': '{}_elite'.format(vehicle.type) if vehicle.isElite else vehicle.type,
      'rentLeft': rentInfoText}
def _getPurchaseTypeVO():
    result = []
    for purchaseType, label in zip(PURCHASE_TYPE.ALL, _PURCHASE_TYPE_LABELS):
        purchaseVO = {'label': label,
         'enabled': True}
        if purchaseType == PURCHASE_TYPE.IGR:
            if not GUI_SETTINGS.igrEnabled:
                continue
            purchaseVO['enabled'] = getIGRCtrl().getRoomType() == IGR_TYPE.PREMIUM
            purchaseVO['tooltipDisabled'] = makeTooltip(_ms(VEHICLE_CUSTOMIZATION.FILTER_TOOLTIP_IGR_DISABLED_HEADER), _ms(VEHICLE_CUSTOMIZATION.FILTER_TOOLTIP_IGR_DISABLED_BODY, icon=_ms(icons.premiumIgrSmall())))
        result.append(purchaseVO)

    return result
Example #38
0
    def __getPurchaseTypeVO(self):
        result = []
        for purchaseType in self.__purchaseTypeList:
            purchaseVO = {'label': self.__purchaseTypeMap[purchaseType],
             'enabled': True}
            if purchaseType == PURCHASE_TYPE.IGR:
                purchaseVO['enabled'] = getIGRCtrl().getRoomType() == IGR_TYPE.PREMIUM
                purchaseVO['tooltipDisabled'] = makeTooltip(_ms(CUSTOMIZATION.FILTER_TOOLTIP_IGR_DISABLED_HEADER), _ms(CUSTOMIZATION.FILTER_TOOLTIP_IGR_DISABLED_BODY, icon=_ms(icons.premiumIgrSmall())))
            result.append(purchaseVO)

        return result
Example #39
0
    def _packAlreadyHaveBlock(self, data):
        subBlocks = [formatters.packTextBlockData(text=text_styles.middleTitle(_ms('#vehicle_customization:customization/tooltip/alreadyHave/title')), padding={'bottom': 6})]
        padding = {'left': 10}
        for buyItem in data['buyItems']:
            buyItemDesc = text_styles.main(buyItem['desc'])
            if buyItem['type'] == BUY_ITEM_TYPE.ALREADY_HAVE_IGR:
                subBlocks.append(formatters.packTextParameterBlockData(name=buyItemDesc, value=icons.premiumIgrSmall(), padding=padding))
            else:
                subBlocks.append(formatters.packTextParameterBlockData(name=buyItemDesc, value='', padding=padding))

        return formatters.packBuildUpBlockData(subBlocks, 0, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LINKAGE, {'left': 3})
Example #40
0
def _getInitialVO(filters, hasRentedVehicles):
    dataVO = {
        'nationTypeId':
        _SECTIONS.NATION,
        'vehicleTypeId':
        _SECTIONS.VEHICLE_TYPE,
        'specialTypesLeftId':
        _SECTIONS.SPECIAL_LEFT,
        'specialTypesRightId':
        _SECTIONS.SPECIAL_RIGHT,
        'levelTypesId':
        _SECTIONS.LEVELS,
        'rentVehicleId':
        _SECTIONS.RENT_VEHICLE,
        'titleLabel':
        text_styles.highTitle('#tank_carousel_filter:filter/popover/title'),
        'nationLabel':
        text_styles.standard(
            '#tank_carousel_filter:filter/popover/label/nation'),
        'vehicleTypeLabel':
        text_styles.standard(
            '#tank_carousel_filter:filter/popover/label/vehicle'),
        'vehicleLevelLabel':
        text_styles.standard(
            '#tank_carousel_filter:filter/popover/label/vehicleLevel'),
        'vehicleEliteTypeLabel':
        text_styles.standard(
            '#tank_carousel_filter:filter/popover/label/vehicleEliteType'),
        'btnDefaultTooltip':
        makeTooltip(
            '#tank_carousel_filter:filter/popover/tooltip/defaultBtn/header',
            '#tank_carousel_filter:filter/popover/tooltip/defaultBtn/body'),
        'btnDefaultLabel':
        _ms('#tank_carousel_filter:filter/popover/label/defaultBtn'),
        'specialTypeLeft': [{
            'label':
            text_styles.standard(
                '#tank_carousel_filter:filter/popover/checkBox/Premium'),
            'tooltip':
            makeTooltip(
                '#tank_carousel_filter:filter/popover/tooltip/premium/header',
                '#tank_carousel_filter:filter/popover/tooltip/premium/body'),
            'selected':
            filters['premium']
        }],
        'specialTypeRight': [{
            'label':
            text_styles.standard(
                '#tank_carousel_filter:filter/popover/checkBox/Elite'),
            'tooltip':
            makeTooltip(
                '#tank_carousel_filter:filter/popover/tooltip/elite/header',
                '#tank_carousel_filter:filter/popover/tooltip/elite/body'),
            'selected':
            filters['elite']
        }],
        'nationsType': [],
        'vehicleType': [],
        'levelsType': [],
        'hasRentedVehicles':
        hasRentedVehicles,
        'rentCheckBox': {
            'label':
            text_styles.standard(
                '#tank_carousel_filter:filter/popover/label/vehicleLease'),
            'selected':
            filters['hideRented'],
            'enabled':
            not filters['igr'] if constants.IS_KOREA else True
        }
    }
    if constants.IS_KOREA:
        dataVO['specialTypeLeft'].append({
            'label': icons.premiumIgrSmall(),
            'selected': filters['igr']
        })
    for nation in GUI_NATIONS:
        dataVO['nationsType'].append({
            'value':
            getNationsFilterAssetPath(nation),
            'tooltip':
            makeTooltip(
                _ms('#nations:%s' % nation),
                _ms('#tank_carousel_filter:filter/popover/tooltip/nation/body')
            ),
            'selected':
            filters[nation]
        })

    for level in VEHICLE_LEVELS:
        dataVO['levelsType'].append({
            'value': getLevelsAssetPath(level),
            'selected': filters['level_%d' % level]
        })

    for vehicleType in VEHICLE_TYPES_ORDER:
        dataVO['vehicleType'].append({
            'value':
            getVehicleTypeAssetPath(vehicleType),
            'tooltip':
            makeTooltip(
                _ms('#menu:carousel_tank_filter/%s' % vehicleType),
                _ms('#tank_carousel_filter:filter/popover/tooltip/vehicleType/body'
                    )),
            'selected':
            filters[vehicleType]
        })

    return dataVO
Example #41
0
from gui.Scaleform.locale.VEHICLE_CUSTOMIZATION import VEHICLE_CUSTOMIZATION
from gui.Scaleform.daapi.view.meta.CustomizationFiltersPopoverMeta import CustomizationFiltersPopoverMeta
from helpers.i18n import makeString as _ms
from gui.customization import g_customizationController
from gui.customization.shared import CUSTOMIZATION_TYPE, getBonusIcon16x16, FILTER_TYPE, QUALIFIER_TYPE_INDEX, PURCHASE_TYPE, DEFAULT_GROUP_VALUE, EMBLEM_IGR_GROUP_NAME
_BONUS_TOOLTIPS = (
    VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_ENTIRECREW,
    VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_COMMANDER,
    VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_AIMER,
    VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_DRIVER,
    VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_RADIOMAN,
    VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_BONUS_LOADER)
_PURCHASE_TYPE_LABELS = (
    VEHICLE_CUSTOMIZATION.FILTER_POPOVER_WAYSTOBUY_BUY,
    VEHICLE_CUSTOMIZATION.FILTER_POPOVER_WAYSTOBUY_MISSIONS,
    icons.premiumIgrSmall())


def _getPurchaseTypeVO():
    result = []
    for purchaseType, label in zip(PURCHASE_TYPE.ALL, _PURCHASE_TYPE_LABELS):
        purchaseVO = {'label': label, 'enabled': True}
        if purchaseType == PURCHASE_TYPE.IGR:
            if not GUI_SETTINGS.igrEnabled:
                continue
            purchaseVO['enabled'] = getIGRCtrl().getRoomType(
            ) == IGR_TYPE.PREMIUM
            purchaseVO['tooltipDisabled'] = makeTooltip(
                _ms(VEHICLE_CUSTOMIZATION.FILTER_TOOLTIP_IGR_DISABLED_HEADER),
                _ms(VEHICLE_CUSTOMIZATION.FILTER_TOOLTIP_IGR_DISABLED_BODY,
                    icon=_ms(icons.premiumIgrSmall())))