Пример #1
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}
        )
Пример #2
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
Пример #3
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
Пример #4
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 isSale(cType, item['duration']) and not item['isInDossier'] and not item['installedInSlot'] and not item['isInQuests']:
                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
Пример #5
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