Пример #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
        }
Пример #2
0
    def __notObtained(self):
        """Check if item is obtainable from quests or from the shop.
        
        Returns:
            A tuple (buyItems, wasBough, status) where:
            buyItems - a list of different ways this item can be bought;
            wasBought - specifies if item is already bought;
            status - one of the STATUS constants
        """
        buyItems = []
        if self.__isInQuest():
            status = STATUS.DO_MISSION
            incompleteQuestItems = g_customizationController.dataAggregator.associatedQuests
            questName = incompleteQuestItems[self._itemType][self._item.getID()].name
            buyItems.append({'type': BUY_ITEM_TYPE.WAYS_TO_BUY_MISSION,
             'desc': _ms('#vehicle_customization:customization/tooltip/taskDescription', name=questName)})
        else:
            status = STATUS.AVAILABLE_FOR_BUY
            for duration in DURATION.ALL:
                if duration == DURATION.PERMANENT:
                    buyString = 'forever'
                    wayToBuy = BUY_ITEM_TYPE.WAYS_TO_BUY_FOREVER
                else:
                    buyString = 'temp'
                    wayToBuy = BUY_ITEM_TYPE.WAYS_TO_BUY_TEMP
                buyItems.append({'value': self._item.getPrice(duration),
                 'type': wayToBuy,
                 'isSale': shared.isSale(self._itemType, duration),
                 'desc': _ms('#vehicle_customization:customization/tooltip/wayToBuy/{0}'.format(buyString), days=duration)})

        return (buyItems, False, status)
Пример #3
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
Пример #4
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}
Пример #6
0
 def __isSale(self, wayToBuy):
     if wayToBuy == BUY_ITEM_TYPE.WAYS_TO_BUY_FOREVER:
         days = 0
     else:
         days = 30
     return shared.isSale(self.__cItemType, days)
Пример #7
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