Ejemplo n.º 1
0
    def __getPurchaseItemVO(self, items):
        purchaseItems = []
        for item in items:
            if item['currencyIcon'] == RES_ICONS.MAPS_ICONS_LIBRARY_CREDITSICON_2:
                price = text_styles.credits(item['price'])
            else:
                price = text_styles.gold(item['price'])
            data = {
                'name': text_styles.main(item['name']),
                'idx': item['idx'],
                'type': item['type'],
                'isTitle': False,
                'currencyIcon': item['currencyIcon'],
                'itemID': item['itemID'],
                'price': price,
                'removeItemIcon': RES_ICONS.MAPS_ICONS_LIBRARY_CROSS
            }
            if shared.isSale(item['type'], item['duration']):
                isGold = item[
                    'currencyIcon'] != RES_ICONS.MAPS_ICONS_LIBRARY_CREDITSICON_2
                data['salePrice'] = shared.getSalePriceString(
                    isGold, item['price'])
            purchaseItems.append(data)

        return {
            'title':
            text_styles.highTitle(
                _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATIONPURCHASESPOPOVER_TITLE,
                    count=len(purchaseItems))),
            'popoverRenderers':
            purchaseItems
        }
Ejemplo n.º 2
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
Ejemplo n.º 3
0
 def __setList(self, cartItems):
     self._list = []
     for item in cartItems:
         if item['currencyIcon'] == RES_ICONS.MAPS_ICONS_LIBRARY_CREDITSICON_2:
             priceFormatter = text_styles.credits
         else:
             priceFormatter = text_styles.gold
         dpItem = {'id': item['itemID'],
          'slotIdx': item['idx'],
          'selected': True,
          'cType': item['type'],
          'itemName': item['name'],
          'imgBonus': item['bonusIcon'],
          'imgCurrency': item['currencyIcon'],
          'lblPrice': priceFormatter(item['price']),
          'price': item['price'],
          'lblBonus': text_styles.stats('+{0}%{1}'.format(item['bonusValue'], item['isConditional']))}
         if isSale(item['type'], item['duration']):
             isGold = item['currencyIcon'] != RES_ICONS.MAPS_ICONS_LIBRARY_CREDITSICON_2
             dpItem['salePrice'] = getSalePriceString(isGold, item['price'])
         self._list.append(dpItem)
    def __getPurchaseItemVO(self, items):
        purchaseItems = []
        for item in items:
            if item['currencyIcon'] == RES_ICONS.MAPS_ICONS_LIBRARY_CREDITSICON_2:
                price = text_styles.credits(item['price'])
            else:
                price = text_styles.gold(item['price'])
            data = {'name': text_styles.main(item['name']),
             'idx': item['idx'],
             'type': item['type'],
             'isTitle': False,
             'currencyIcon': item['currencyIcon'],
             'itemID': item['itemID'],
             'price': price,
             'removeItemIcon': RES_ICONS.MAPS_ICONS_LIBRARY_CROSS}
            if shared.isSale(item['type'], item['duration']):
                isGold = item['currencyIcon'] != RES_ICONS.MAPS_ICONS_LIBRARY_CREDITSICON_2
                data['salePrice'] = shared.getSalePriceString(isGold, item['price'])
            purchaseItems.append(data)

        return {'title': text_styles.highTitle(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATIONPURCHASESPOPOVER_TITLE, count=len(purchaseItems))),
         'popoverRenderers': purchaseItems}
Ejemplo n.º 5
0
 def __getSalePrice(self, item, duration):
     price = None
     if isSale(item['type'], duration):
         isGold = duration == DURATION.PERMANENT
         price = getSalePriceString(isGold, item['object'].getPrice(duration))
     return price
Ejemplo n.º 6
0
 def __getSalePrice(self, item, duration):
     if item['object'].isSale(duration):
         return getSalePriceString(item['type'], item['object'], duration)
     else:
         return None
         return None
 def __getSalePrice(self, item, duration):
     if item['object'].isSale(duration):
         return getSalePriceString(item['type'], item['object'], duration)
     else:
         return None
         return None
Ejemplo n.º 8
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