def getItemVo(item):
    def getItemNationID(item):
        compatibleNations = []
        if item.itemTypeName == STORE_CONSTANTS.EQUIPMENT:
            item.descriptor.compatibleNations()
        return compatibleNations[0] if len(
            compatibleNations) == 1 else item.nationID

    priceVO = getItemPricesVO(item.getSellPrice())[0]
    itemNationID = getItemNationID(item)
    nationFlagIcon = RES_SHOP.getNationFlagIcon(
        nations.NAMES[itemNationID]
    ) if itemNationID != nations.NONE_INDEX else ''
    serverSettings = dependency.instance(ILobbyContext).getServerSettings()
    upgradable = item.itemTypeID == GUI_ITEM_TYPE.OPTIONALDEVICE and item.isUpgradable and serverSettings.isTrophyDevicesEnabled(
    )
    vo = createStorageDefVO(
        item.intCD,
        getStorageItemName(item),
        getStorageItemDescr(item),
        item.inventoryCount,
        priceVO,
        getStorageItemIcon(item, STORE_CONSTANTS.ICON_SIZE_SMALL),
        'altimage',
        itemType=item.getOverlayType(),
        nationFlagIcon=nationFlagIcon,
        enabled=item.isForSale,
        contextMenuId=_getContextMenuHandlerID(item),
        upgradable=upgradable,
        upgradeButtonTooltip=makeTooltip(body=backport.text(
            R.strings.storage.buttonUpgrade.tooltip.body())),
        extraParams=getItemExtraParams(item),
        specializations=getCategoriesIcons(item)
        if item.itemTypeID == GUI_ITEM_TYPE.OPTIONALDEVICE else ())
    return vo
def getStorageVehicleVo(vehicle):
    name = getVehicleName(vehicle)
    description = _getVehicleDescription(vehicle)
    imageSmall = func_utils.makeFlashPath(
        vehicle.getShopIcon(STORE_CONSTANTS.ICON_SIZE_SMALL))
    stateIcon, stateText = _getVehicleInfo(vehicle)
    if not imageSmall and not stateText:
        stateText = text_styles.vehicleStatusInfoText(
            _ms(STORAGE.INHANGAR_NOIMAGE))
    vo = createStorageDefVO(
        vehicle.intCD,
        name,
        description,
        vehicle.inventoryCount,
        getItemPricesVO(vehicle.getSellPrice())[0],
        imageSmall,
        RES_SHOP.getVehicleIcon(STORE_CONSTANTS.ICON_SIZE_SMALL, 'empty_tank'),
        itemType=vehicle.getHighlightType(),
        nationFlagIcon=RES_SHOP.getNationFlagIcon(
            nations.NAMES[vehicle.nationID]),
        contextMenuId=CONTEXT_MENU_HANDLER_TYPE.STORAGE_VEHICLES_REGULAR_ITEM)
    vo.update({'infoImgSrc': stateIcon, 'infoText': stateText})
    if vehicle.canTradeOff:
        vo.update(
            {'tradeOffPrice': {
                'price': getMoneyVO(vehicle.tradeOffPrice)
            }})
    return vo
예제 #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)
예제 #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
예제 #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
예제 #7
0
 def getOfferNationalFlag(self):
     nation = self.displayedItem.getNation()
     return RES_SHOP.getNationFlagIcon(
         self.displayedItem.getNation()) if nation is not None else None
예제 #8
0
 def getOfferNationalFlag(self):
     return RES_SHOP.getNationFlagIcon(self.displayedItem.nationName)