def _getVO(self, offer):
     gifts = backport.text(R.strings.storage.offers.giftAmount(),
                           clicks=text_styles.neutral(offer.clicksCount),
                           gifts=text_styles.neutral(
                               offer.availableGiftsCount))
     date = backport.getShortDateFormat(offer.expiration)
     time = backport.getShortTimeFormat(offer.expiration)
     expiration = backport.text(R.strings.storage.offers.expiration(),
                                date=text_styles.neutral(date),
                                time=text_styles.neutral(time))
     description = '\n'.join([gifts, expiration])
     localization = ResMgr.openSection(
         self._offersProvider.getCdnResourcePath(offer.cdnLocFilePath,
                                                 relative=False))
     title = localization.readString('name') if localization else ''
     vo = createStorageDefVO(offer.id,
                             title,
                             description,
                             0,
                             None,
                             self._offersProvider.getCdnResourcePath(
                                 offer.cdnLogoPath, relative=False),
                             'altimage',
                             contextMenuId=None)
     return vo
    def __onUpdateBoosters(self, *args):
        self.__updateActiveBoostersCount()
        criteria = REQ_CRITERIA.BOOSTER.IN_ACCOUNT | REQ_CRITERIA.BOOSTER.ENABLED
        boosters = self.goodiesCache.getBoosters(criteria=criteria).values()
        if boosters:
            dataProviderValues = []
            for booster in sorted(boosters, cmp=self.__sort):
                mainText = text_styles.main(
                    booster.getBonusDescription(
                        valueFormatter=text_styles.neutral))
                romanLvl = self._QUALITY_TO_LEVEL.get(booster.quality)
                vo = createStorageDefVO(
                    booster.boosterID,
                    mainText,
                    mainText,
                    booster.count,
                    getItemPricesVO(booster.getSellPrice())[0],
                    booster.getShopIcon(STORE_CONSTANTS.ICON_SIZE_SMALL),
                    booster.getShopIcon(),
                    'altimage',
                    enabled=booster.isReadyToActivate,
                    level=int2roman(romanLvl) if romanLvl is not None else '')
                dataProviderValues.append(vo)

            self._dataProvider.buildList(*dataProviderValues)
        else:
            self.as_showDummyScreenS(True)
        return
Exemple #3
0
 def __createVO(self, item):
     priceVO = getItemPricesVO(item.getSellPrice())[0]
     nationFlagIcon = RES_SHOP.getNationFlagIcon(nations.NAMES[
         item.nationID]) if item.nationID != nations.NONE_INDEX else ''
     return createStorageDefVO(
         item.intCD,
         getStorageItemName(item),
         getStorageItemDescr(item),
         item.inventoryCount,
         priceVO,
         getStorageItemIcon(item, STORE_CONSTANTS.ICON_SIZE_SMALL),
         'altimage',
         itemType=item.getOverlayType(),
         nationFlagIcon=nationFlagIcon,
         contextMenuId=CONTEXT_MENU_HANDLER_TYPE.STORAGE_FOR_SELL_ITEM)
 def __createVO(self, item):
     priceVO = getItemPricesVO(item.getSellPrice())[0]
     nationFlagIcon = RES_SHOP.getNationFlagIcon(nations.NAMES[
         item.nationID]) if item.nationID != nations.NONE_INDEX else ''
     return createStorageDefVO(item.intCD,
                               getStorageModuleName(item),
                               getStorageItemDescr(item),
                               item.inventoryCount,
                               priceVO,
                               getStorageItemIcon(
                                   item, STORE_CONSTANTS.ICON_SIZE_SMALL),
                               getStorageItemIcon(item),
                               'altimage',
                               itemType=getBoosterType(item),
                               nationFlagIcon=nationFlagIcon)
Exemple #5
0
 def _getVO(self, item):
     priceVO = getItemPricesVO(item.getSellPrice())[0]
     itemNationID = self._getItemNationID(item)
     nationFlagIcon = RES_SHOP.getNationFlagIcon(
         nations.NAMES[itemNationID]
     ) if itemNationID != nations.NONE_INDEX else ''
     vo = storage_helpers.createStorageDefVO(
         item.intCD,
         storage_helpers.getStorageModuleName(item),
         storage_helpers.getStorageItemDescr(item),
         item.inventoryCount,
         priceVO,
         storage_helpers.getStorageItemIcon(item, SC.ICON_SIZE_SMALL),
         storage_helpers.getStorageItemIcon(item),
         'altimage',
         itemType=getBoosterType(item),
         nationFlagIcon=nationFlagIcon,
         enabled=item.itemTypeID != GUI_ITEM_TYPE.BATTLE_BOOSTER)
     return vo
Exemple #6
0
 def _buildVehicle(self, item):
     name = _getVehicleName(vehicle=item)
     description = _getVehicleDescription(vehicle=item)
     stateIcon, stateText = _getVehicleInfo(vehicle=item)
     vo = createStorageDefVO(
         item.intCD,
         name,
         description,
         item.inventoryCount,
         getItemPricesVO(item.getSellPrice())[0],
         item.getShopIcon(STORE_CONSTANTS.ICON_SIZE_SMALL),
         item.getShopIcon(),
         RES_SHOP.getVehicleIcon(STORE_CONSTANTS.ICON_SIZE_SMALL,
                                 'empty_tank'),
         itemType=getBoosterType(item),
         nationFlagIcon=RES_SHOP.getNationFlagIcon(
             nations.NAMES[item.nationID]),
         infoImgSrc=stateIcon,
         infoText=stateText)
     return vo
Exemple #7
0
 def _getVO(self, item, vehicleCD=None):
     priceVO = getItemPricesVO(item.getSellPrice())[0]
     title = item.userName
     tooltipKey = TOOLTIPS.getItemBoxTooltip(item.itemTypeName)
     if tooltipKey:
         title = _ms(tooltipKey, group=item.userType, value=item.userName)
     if item.itemTypeID == GUI_ITEM_TYPE.PROJECTION_DECAL:
         formfactor = item.formfactor
     else:
         formfactor = ''
     icon = item.icon
     levelIcon = ''
     customizationSuitableText = backport.text(
         R.strings.storage.customizationSuitable.label())
     if vehicleCD is None:
         if not item.descriptor.filter or not item.descriptor.filter.include:
             customizationSuitableText = backport.text(
                 R.strings.storage.customizationSuitableForAll.label())
         else:
             customizationSuitableText += getSuitableText(item)
         count = item.inventoryCount
         vehicle = None
     else:
         vehicle = self._itemsCache.items.getItemByCD(vehicleCD)
         customizationSuitableText += vehicle.shortUserName
         count = item.boundInventoryCount(vehicleCD)
     if item.isProgressive:
         level = item.getProgressionLevel(vehicle)
         if level > 0:
             if item.itemTypeID == GUI_ITEM_TYPE.STYLE:
                 levelIconPath = R.images.gui.maps.icons.customization.progression_styles.icons
             else:
                 levelIconPath = R.images.gui.maps.icons.customization.progression_icons
             levelIcon = backport.image(
                 levelIconPath.dyn('level_{}'.format(level))())
             if item.itemTypeID == GUI_ITEM_TYPE.PROJECTION_DECAL:
                 icon = item.previewIconUrlByProgressionLevel(level)
             else:
                 icon = item.iconUrlByProgressionLevel(level)
     isAvailableForSell = isCustomizationAvailableForSell(item, vehicleCD)
     isPreviewAvailable = item.itemTypeID == GUI_ITEM_TYPE.STYLE
     vo = createStorageDefVO(itemID=item.intCD,
                             title=title,
                             description=customizationSuitableText,
                             count=count,
                             price=priceVO if isAvailableForSell else None,
                             image=icon,
                             imageAlt='altimage',
                             contextMenuId=CONTEXT_MENU_HANDLER_TYPE.
                             STORAGE_CUSTOMZIZATION_ITEM,
                             enabled=isAvailableForSell)
     vo.update({
         'previewAvailable':
         isPreviewAvailable,
         'previewTooltip':
         backport.text(R.strings.storage.stylePreview.tooltip()),
         'progressiveLevelIcon':
         levelIcon,
         'formfactor':
         formfactor,
         'vehicleCD':
         vehicleCD,
         'isWideImage':
         item.isWide(),
         'isRentable':
         item.isRentable
     })
     return vo
Exemple #8
0
    def __onUpdateBoosters(self, *args):
        activeBoostersCount = len(
            self._goodiesCache.getBoosters(
                criteria=REQ_CRITERIA.BOOSTER.ACTIVE).values())
        totalBoostersCount = len(
            self._goodiesCache.getBoosters(
                criteria=REQ_CRITERIA.BOOSTER.IN_ACCOUNT).values())
        filteredBoostersCount = 0
        criteria = REQ_CRITERIA.BOOSTER.IN_ACCOUNT | REQ_CRITERIA.BOOSTER.ENABLED
        criteria |= getCriteriaFromFilterMask(self.__filterMask)
        boosters = self._goodiesCache.getBoosters(criteria=criteria).values()
        dataProviderValues = []
        showDummyScreen = False
        filterWarningVO = None
        if boosters:
            for booster in sorted(boosters, cmp=self.__sort):
                influence = backport.text(
                    R.strings.menu.booster.influence.dyn(
                        booster.boosterGuiType)())
                limitResource = R.strings.menu.booster.limit.dyn(
                    booster.boosterGuiType)
                if limitResource:
                    additionalInfo = text_styles.alert(
                        backport.text(limitResource()))
                else:
                    additionalInfo = ''
                vo = createStorageDefVO(
                    booster.boosterID,
                    text_styles.hightlight(
                        _ms(MENU.BOOSTER_DESCRIPTION_EFFECTVALUETIME,
                            effectValue=booster.getFormattedValue(),
                            effectTime=booster.getEffectTimeStr(
                                hoursOnly=True))),
                    text_styles.main(influence),
                    booster.count,
                    getItemPricesVO(booster.getSellPrice())[0],
                    func_utils.makeFlashPath(
                        booster.getShopIcon(STORE_CONSTANTS.ICON_SIZE_SMALL)),
                    func_utils.makeFlashPath(booster.getShopIcon()),
                    'altimage',
                    enabled=booster.isReadyToActivate,
                    available=booster.isAvailable,
                    active=booster.state,
                    contextMenuId=CONTEXT_MENU_HANDLER_TYPE.
                    STORAGE_PERSONAL_RESERVE_ITEM,
                    additionalInfo=additionalInfo)
                dataProviderValues.append(vo)
                filteredBoostersCount += 1

        elif totalBoostersCount == 0:
            showDummyScreen = True
        else:
            filterWarningVO = self._makeFilterWarningVO(
                STORAGE.FILTER_WARNINGMESSAGE,
                STORAGE.FILTER_NORESULTSBTN_LABEL,
                TOOLTIPS.STORAGE_FILTER_NORESULTSBTN)
        self._dataProvider.buildList(dataProviderValues)
        self.__updateFilterCounter(filteredBoostersCount, totalBoostersCount)
        self.__updateActiveBoostersCounter(activeBoostersCount,
                                           totalBoostersCount)
        self.as_showFilterWarningS(filterWarningVO)
        self.as_showDummyScreenS(showDummyScreen)
        return