def __getInitialData(self):
     money = g_itemsCache.items.stats.money
     shop = g_itemsCache.items.shop
     upgradeParams = shop.tankmanCost
     defUpgradeParams = shop.defaults.tankmanCost
     schoolUpgradePrice = round(upgradeParams[1]['credits'])
     schoolUpgradeDefPrice = round(defUpgradeParams[1]['credits'])
     schoolUpgradeAction = None
     if schoolUpgradePrice != schoolUpgradeDefPrice:
         schoolUpgradeAction = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'creditsTankmanCost', True, Money(credits=schoolUpgradePrice), Money(credits=schoolUpgradeDefPrice))
     academyUpgradePrice = round(upgradeParams[2]['gold'])
     academyUpgradeDefPrice = round(defUpgradeParams[2]['gold'])
     academyUpgradeAction = None
     if academyUpgradePrice != academyUpgradeDefPrice:
         academyUpgradeAction = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'goldTankmanCost', True, Money(gold=academyUpgradePrice), Money(gold=academyUpgradeDefPrice))
     data = {'credits': money.credits,
      'gold': money.gold,
      'schoolUpgradePrice': schoolUpgradePrice,
      'schoolUpgradeActionPriceData': schoolUpgradeAction,
      'academyUpgradePrice': academyUpgradePrice,
      'academyUpgradeActionPriceData': academyUpgradeAction,
      'data': self._initData,
      'menuEnabled': self._menuEnabled}
     self.flashObject.as_initData(data)
     return
Example #2
0
 def __getInitialData(self):
     money = self.itemsCache.items.stats.money
     shop = self.itemsCache.items.shop
     upgradeParams = shop.tankmanCost
     defUpgradeParams = shop.defaults.tankmanCost
     schoolUpgradePrice = round(upgradeParams[1]['credits'])
     schoolUpgradeDefPrice = round(defUpgradeParams[1]['credits'])
     schoolUpgradeAction = None
     if schoolUpgradePrice != schoolUpgradeDefPrice:
         schoolUpgradeAction = packActionTooltipData(
             ACTION_TOOLTIPS_TYPE.ECONOMICS, 'creditsTankmanCost', True,
             Money(credits=schoolUpgradePrice),
             Money(credits=schoolUpgradeDefPrice))
     academyUpgradePrice = round(upgradeParams[2]['gold'])
     academyUpgradeDefPrice = round(defUpgradeParams[2]['gold'])
     academyUpgradeAction = None
     if academyUpgradePrice != academyUpgradeDefPrice:
         academyUpgradeAction = packActionTooltipData(
             ACTION_TOOLTIPS_TYPE.ECONOMICS, 'goldTankmanCost', True,
             Money(gold=academyUpgradePrice),
             Money(gold=academyUpgradeDefPrice))
     data = {
         Currency.CREDITS: money.getSignValue(Currency.CREDITS),
         Currency.GOLD: money.getSignValue(Currency.GOLD),
         'schoolUpgradePrice': schoolUpgradePrice,
         'schoolUpgradeActionPriceData': schoolUpgradeAction,
         'academyUpgradePrice': academyUpgradePrice,
         'academyUpgradeActionPriceData': academyUpgradeAction,
         'data': self._initData,
         'menuEnabled': self._menuEnabled
     }
     self.as_initDataS(data)
     self.as_setRecruitButtonsEnableStateS(
         *self.__getRetrainButtonsEnableFlags())
     return
Example #3
0
 def __getInitialData(self):
     money = g_itemsCache.items.stats.money
     shop = g_itemsCache.items.shop
     upgradeParams = shop.tankmanCost
     defUpgradeParams = shop.defaults.tankmanCost
     schoolUpgradePrice = round(upgradeParams[1]['credits'])
     schoolUpgradeDefPrice = round(defUpgradeParams[1]['credits'])
     schoolUpgradeAction = None
     if schoolUpgradePrice != schoolUpgradeDefPrice:
         schoolUpgradeAction = packActionTooltipData(
             ACTION_TOOLTIPS_TYPE.ECONOMICS, 'creditsTankmanCost', True,
             Money(credits=schoolUpgradePrice),
             Money(credits=schoolUpgradeDefPrice))
     academyUpgradePrice = round(upgradeParams[2]['gold'])
     academyUpgradeDefPrice = round(defUpgradeParams[2]['gold'])
     academyUpgradeAction = None
     if academyUpgradePrice != academyUpgradeDefPrice:
         academyUpgradeAction = packActionTooltipData(
             ACTION_TOOLTIPS_TYPE.ECONOMICS, 'goldTankmanCost', True,
             Money(gold=academyUpgradePrice),
             Money(gold=academyUpgradeDefPrice))
     data = {
         'credits': money.credits,
         'gold': money.gold,
         'schoolUpgradePrice': schoolUpgradePrice,
         'schoolUpgradeActionPriceData': schoolUpgradeAction,
         'academyUpgradePrice': academyUpgradePrice,
         'academyUpgradeActionPriceData': academyUpgradeAction,
         'data': self._initData,
         'menuEnabled': self._menuEnabled
     }
     self.flashObject.as_initData(data)
     return
    def _getByuContentData(self, vehicle, stats, isTradeIn):
        shop = self.itemsCache.items.shop
        shopDefaults = shop.defaults
        tankMenCount = len(vehicle.crew)
        vehiclePricesActionData = self._getItemPriceActionData(vehicle)
        ammoPrice = ITEM_PRICE_EMPTY
        for shell in vehicle.gun.defaultAmmo:
            ammoPrice += shell.buyPrices.itemPrice * shell.defaultCount

        ammoActionPriceData = None
        if ammoPrice.isActionPrice():
            ammoActionPriceData = packActionTooltipData(ACTION_TOOLTIPS_TYPE.AMMO, str(vehicle.intCD), True, ammoPrice.price, ammoPrice.defPrice)
        slotPrice = shop.getVehicleSlotsPrice(stats.vehicleSlots)
        slotDefaultPrice = shopDefaults.getVehicleSlotsPrice(stats.vehicleSlots)
        slotActionPriceData = None
        if slotPrice != slotDefaultPrice:
            slotActionPriceData = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'slotsPrices', True, Money(gold=slotPrice), Money(gold=slotDefaultPrice))
        tankmenTotalLabel = i18n.makeString(DIALOGS.BUYVEHICLEWINDOW_TANKMENTOTALLABEL, count=str(tankMenCount))
        studyData = []
        for index, (tCost, defTCost, typeID) in enumerate(zip(shop.tankmanCostWithGoodyDiscount, shopDefaults.tankmanCost, ('free', 'school', 'academy'))):
            if tCost['isPremium']:
                currency = Currency.GOLD
            else:
                currency = Currency.CREDITS
            price = tCost[currency] * tankMenCount
            defPrice = defTCost[currency] * tankMenCount
            totalPrice = Money.makeFrom(currency, price)
            totalDefPrice = Money.makeFrom(currency, defPrice)
            if typeID == 'free':
                formatedPrice = i18n.makeString(MENU.TANKMANTRAININGWINDOW_FREE_PRICE)
            else:
                formatedPrice = moneyWithIcon(totalPrice, currType=currency)
            studyPriceActionData = None
            if price != defPrice:
                studyPriceActionData = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, '%sTankmanCost' % currency, True, totalPrice, totalDefPrice)
            studyData.insert(0, {'id': typeID,
             'price': price,
             'crewType': index,
             'actionPrice': studyPriceActionData,
             'label': '%d%% - %s' % (tCost['roleLevel'], formatedPrice)})

        initData = {'tankmenTotalLabel': tankmenTotalLabel,
         'vehiclePrices': self._getVehiclePrice(vehicle).toMoneyTuple(),
         'vehiclePricesActionData': vehiclePricesActionData,
         'isRentable': vehicle.isRentable,
         'rentDataDD': self._getRentData(vehicle, vehiclePricesActionData),
         'ammoPrice': ammoPrice.price.getSignValue(Currency.CREDITS),
         'ammoActionPriceData': ammoActionPriceData,
         'slotPrice': slotPrice,
         'slotActionPriceData': slotActionPriceData,
         'isStudyDisabled': vehicle.hasCrew,
         'isNoAmmo': not vehicle.hasShells,
         'studyData': studyData,
         'nation': self.nationID}
        initData.update(self._getContentFields(vehicle))
        if isTradeIn:
            initData.update(self.__getTradeInContentFields(vehicle))
        return initData
Example #5
0
    def __setData(self, *args):
        items = g_itemsCache.items
        tankman = items.getTankman(self.tmanInvID)
        if tankman is None:
            self.onWindowClose()
            return
        else:
            dropSkillsCost = []
            for k in sorted(items.shop.dropSkillsCost.keys()):
                skillCost = items.shop.dropSkillsCost[k]
                defaultSkillCots = items.shop.defaults.dropSkillsCost[k]
                price = Money(**skillCost)
                defaultPrice = Money(**defaultSkillCots)
                action = None
                if price != defaultPrice:
                    key = '{}DropSkillsCost'.format(price.getCurrency(byWeight=True))
                    action = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, key, True, price, defaultPrice)
                skillCost['action'] = action
                dropSkillsCost.append(skillCost)

            skills_count = list(tankmen.ACTIVE_SKILLS)
            availableSkillsCount = len(skills_count) - len(tankman.skills)
            hasNewSkills = tankman.roleLevel == tankmen.MAX_SKILL_LEVEL and availableSkillsCount and (tankman.descriptor.lastSkillLevel == tankmen.MAX_SKILL_LEVEL or not len(tankman.skills))
            self.as_setDataS({'money': items.stats.money,
             'tankman': packTankman(tankman, isCountPermanentSkills=False),
             'dropSkillsCost': dropSkillsCost,
             'hasNewSkills': hasNewSkills,
             'newSkills': tankman.newSkillCount,
             'defaultSavingMode': 0,
             'texts': self.__getTexts()})
            return
    def calcValueRequest(self, toLevel):
        items = g_itemsCache.items
        tankman = items.getTankman(self.__tankManId)
        tankmanDescriptor = tankman.descriptor
        if toLevel == tankmanDescriptor.lastSkillLevel:
            self.__selectedXpForConvert = 0
            self.as_setCalcValueResponseS(0, None)
            return
        else:
            toLevel = int(toLevel)
            if toLevel > MAX_SKILL_LEVEL:
                toLevel = MAX_SKILL_LEVEL
            needXp = self.__getCurrentTankmanLevelCost(tankman)
            for level in range(int(tankmanDescriptor.lastSkillLevel + 1), toLevel, 1):
                needXp += self.__calcLevelUpCost(tankman, level, tankmanDescriptor.lastSkillNumber - tankmanDescriptor.freeSkillsNumber)

            rate = items.shop.freeXPToTManXPRate
            roundedNeedXp = self.__roundByModulo(needXp, rate)
            xpWithDiscount = roundedNeedXp / rate
            self.__selectedXpForConvert = max(1, xpWithDiscount)
            defaultRate = items.shop.defaults.freeXPToTManXPRate
            if defaultRate and defaultRate != 0:
                defaultRoundedNeedXp = self.__roundByModulo(needXp, defaultRate)
                defaultXpWithDiscount = defaultRoundedNeedXp / defaultRate
                defaultXpForConvert = max(1, defaultXpWithDiscount)
            else:
                defaultXpForConvert = self.__selectedXpForConvert
            actionPriceData = None
            if self.__selectedXpForConvert != defaultXpForConvert:
                actionPriceData = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'freeXPToTManXPRate', True, Money(gold=self.__selectedXpForConvert), Money(gold=defaultXpForConvert))
            self.as_setCalcValueResponseS(self.__selectedXpForConvert, actionPriceData)
            return
 def getCommonData(self, callback):
     items = self.itemsCache.items
     tankman = items.getTankman(self.tmanInvID)
     changeRoleCost = items.shop.changeRoleCost
     defaultChangeRoleCost = items.shop.defaults.changeRoleCost
     if changeRoleCost != defaultChangeRoleCost and not self.bootcamp.isInBootcamp():
         discount = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'changeRoleCost', True, Money(gold=changeRoleCost), Money(gold=defaultChangeRoleCost))
     else:
         discount = None
     rate = items.shop.freeXPToTManXPRate
     if rate:
         toNextPrcLeft = roundByModulo(tankman.getNextLevelXpCost(), rate)
         enoughFreeXPForTeaching = items.stats.freeXP - max(1, toNextPrcLeft / rate) >= 0
     else:
         enoughFreeXPForTeaching = False
     nativeVehicle = items.getItemByCD(tankman.vehicleNativeDescr.type.compactDescr)
     currentVehicle = None
     if tankman.isInTank:
         currentVehicle = items.getItemByCD(tankman.vehicleDescr.type.compactDescr)
     isLocked, reason = self.__getTankmanLockMessage(currentVehicle)
     td = tankman.descriptor
     changeRoleEnabled = tankmen.tankmenGroupCanChangeRole(td.nationID, td.gid, td.isPremium)
     if changeRoleEnabled:
         tooltipChangeRole = makeTooltip(TOOLTIPS.CREW_ROLECHANGE_HEADER, TOOLTIPS.CREW_ROLECHANGE_TEXT)
     else:
         roleStr = i18n.makeString(TOOLTIPS.crewRole(td.role))
         tooltipChangeRole = makeTooltip(TOOLTIPS.CREW_ROLECHANGEFORBID_HEADER, i18n.makeString(TOOLTIPS.CREW_ROLECHANGEFORBID_TEXT, role=roleStr))
     showDocumentTab = not td.getRestrictions().isPassportReplacementForbidden()
     bonuses = tankman.realRoleLevel[1]
     modifiers = []
     if bonuses[0]:
         modifiers.append({'id': 'fromCommander',
          'val': bonuses[0]})
     if bonuses[1]:
         modifiers.append({'id': 'fromSkills',
          'val': bonuses[1]})
     if bonuses[2] or bonuses[3]:
         modifiers.append({'id': 'fromEquipment',
          'val': bonuses[2] + bonuses[3]})
     if bonuses[4]:
         modifiers.append({'id': 'penalty',
          'val': bonuses[4]})
     tankmanData = packTankman(tankman)
     repackTankmanWithSkinData(tankman, tankmanData)
     callback({'tankman': tankmanData,
      'currentVehicle': packVehicle(currentVehicle) if currentVehicle is not None else None,
      'nativeVehicle': packVehicle(nativeVehicle),
      'isOpsLocked': isLocked,
      'lockMessage': reason,
      'modifiers': modifiers,
      'enoughFreeXPForTeaching': enoughFreeXPForTeaching,
      'tabsData': self.getTabsButtons(showDocumentTab),
      'tooltipDismiss': TOOLTIPS.BARRACKS_TANKMEN_DISMISS,
      'tooltipUnload': TOOLTIPS.BARRACKS_TANKMEN_UNLOAD,
      'dismissEnabled': True,
      'unloadEnabled': True,
      'changeRoleEnabled': changeRoleEnabled,
      'tooltipChangeRole': tooltipChangeRole,
      'actionChangeRole': discount})
     return
 def _buildSupplyItems(self):
     self._supplyItems = []
     items = self._itemsCache.items
     slots = items.stats.vehicleSlots
     vehicles = len(items.getVehicles(REQ_CRITERIA.INVENTORY))
     slotPrice = items.shop.getVehicleSlotsPrice(slots)
     defaultSlotPrice = items.shop.defaults.getVehicleSlotsPrice(slots)
     if slotPrice != defaultSlotPrice:
         sale = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'slotsPrices', True, Money(gold=slotPrice), Money(gold=defaultSlotPrice))
     else:
         sale = None
     self._emptySlotsCount = slots - vehicles
     smallBuySlotString, buySlotString = _getStatusStrings('buySlot')
     smallBuyTankString, buyTankString = _getStatusStrings('buyTank')
     smallEmptySlotsString, emptySlotsString = _getStatusStrings('buyTankEmptyCount', style=text_styles.main, ctx={'count': self._emptySlotsCount})
     self._supplyItems.append({'buyTank': True,
      'smallInfoText': text_styles.concatStylesToMultiLine(smallBuyTankString, smallEmptySlotsString),
      'infoText': text_styles.concatStylesToMultiLine(buyTankString, emptySlotsString),
      'icon': RES_ICONS.MAPS_ICONS_LIBRARY_TANKITEM_BUY_TANK})
     buySlotVO = {'buySlot': True,
      'slotPrice': slotPrice,
      'icon': RES_ICONS.MAPS_ICONS_LIBRARY_TANKITEM_BUY_SLOT,
      'infoText': buySlotString,
      'smallInfoText': smallBuySlotString,
      'hasSale': sale is not None}
     if sale is not None:
         buySlotVO.update({'slotPriceActionData': sale})
     self._supplyItems.append(buySlotVO)
     return
Example #9
0
    def calcValueRequest(self, toLevel):
        items = g_itemsCache.items
        tankman = items.getTankman(self.__tankManId)
        tankmanDescriptor = tankman.descriptor
        if toLevel == tankmanDescriptor.lastSkillLevel:
            self.__selectedXpForConvert = 0
            self.as_setCalcValueResponseS(0, None)
            return
        else:
            toLevel = int(toLevel)
            if toLevel > MAX_SKILL_LEVEL:
                toLevel = MAX_SKILL_LEVEL
            needXp = self.__getCurrentTankmanLevelCost(tankman)
            for level in range(int(tankmanDescriptor.lastSkillLevel + 1), toLevel, 1):
                needXp += self.__calcLevelUpCost(tankman, level, tankmanDescriptor.lastSkillNumber - tankmanDescriptor.freeSkillsNumber)

            rate = items.shop.freeXPToTManXPRate
            roundedNeedXp = self.__roundByModulo(needXp, rate)
            xpWithDiscount = roundedNeedXp / rate
            self.__selectedXpForConvert = max(1, xpWithDiscount)
            defaultRate = items.shop.defaults.freeXPToTManXPRate
            if defaultRate and defaultRate != 0:
                defaultRoundedNeedXp = self.__roundByModulo(needXp, defaultRate)
                defaultXpWithDiscount = defaultRoundedNeedXp / defaultRate
                defaultXpForConvert = max(1, defaultXpWithDiscount)
            else:
                defaultXpForConvert = self.__selectedXpForConvert
            actionPriceData = None
            if self.__selectedXpForConvert != defaultXpForConvert:
                actionPriceData = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'freeXPToTManXPRate', True, Money(gold=self.__selectedXpForConvert), Money(gold=defaultXpForConvert))
            self.as_setCalcValueResponseS(self.__selectedXpForConvert, actionPriceData)
            return
 def getActionVO(self):
     buyPrice = self.__booster.buyPrice
     defaultPrice = self.__booster.defaultPrice
     if buyPrice != defaultPrice:
         return packActionTooltipData(ACTION_TOOLTIPS_TYPE.BOOSTER, str(self.__booster.boosterID), True, buyPrice, defaultPrice)
     else:
         return None
Example #11
0
 def __getActionVO(booster):
     if booster.buyPrice != booster.defaultPrice:
         return packActionTooltipData(
             ACTION_TOOLTIPS_TYPE.BOOSTER, str(booster.boosterID), True, booster.buyPrice, booster.defaultPrice
         )
     else:
         return None
 def _buildSupplyItems(self):
     self._supplyItems = []
     items = self._itemsCache.items
     slots = items.stats.vehicleSlots
     vehicles = len(items.getVehicles(REQ_CRITERIA.INVENTORY))
     slotPrice = items.shop.getVehicleSlotsPrice(slots)
     defaultSlotPrice = items.shop.defaults.getVehicleSlotsPrice(slots)
     if slotPrice != defaultSlotPrice:
         sale = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'slotsPrices', True, Money(gold=slotPrice), Money(gold=defaultSlotPrice))
     else:
         sale = None
     self._emptySlotsCount = slots - vehicles
     self._supplyItems.append({'buyTank': True,
      'additionalText': i18n.makeString('#menu:tankCarousel/vehicleStates/buyTankEmptyCount', count=self._emptySlotsCount),
      'showInfoText': True,
      'infoText': _getStatusString('buyTank', Vehicle.VEHICLE_STATE_LEVEL.INFO),
      'icon': RES_ICONS.MAPS_ICONS_LIBRARY_TANKITEM_BUY_TANK})
     buySlotVO = {'buySlot': True,
      'slotPrice': slotPrice,
      'icon': RES_ICONS.MAPS_ICONS_LIBRARY_TANKITEM_BUY_SLOT,
      'showInfoText': True,
      'infoText': _getStatusString('buySlot', Vehicle.VEHICLE_STATE_LEVEL.INFO),
      'hasSale': sale is not None}
     if sale is not None:
         buySlotVO.update({'slotPriceActionData': sale})
     self._supplyItems.append(buySlotVO)
     return
Example #13
0
 def __init__(self, vehicle, item, slotIdx, install = True, isUseGold = False, conflictedEqs = None):
     """
     Ctor.
     
     @param vehicle: vehicle
     @param item: module to install
     @param slotIdx: vehicle equipment slot index to install
     @param install: flag to designated process
     @param conflictedEqs: conflicted items
     """
     super(OptDeviceInstaller, self).__init__(vehicle, item, (GUI_ITEM_TYPE.OPTIONALDEVICE,), slotIdx, install, conflictedEqs)
     self.cost = g_itemsCache.items.shop.paidRemovalCost
     defaultCost = g_itemsCache.items.shop.defaults.paidRemovalCost
     action = None
     if self.cost != defaultCost:
         action = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'paidRemovalCost', True, Money(gold=self.cost), Money(gold=defaultCost))
     addPlugins = []
     if install:
         addPlugins += (plugins.MessageConfirmator('installConfirmationNotRemovable', ctx={'name': item.userName}, isEnabled=not item.isRemovable),)
     else:
         addPlugins += (plugins.DemountDeviceConfirmator('removeConfirmationNotRemovableGold', ctx={'name': item.userName,
           'price': self.cost,
           'action': action}, isEnabled=not item.isRemovable and isUseGold), plugins.DestroyDeviceConfirmator('removeConfirmationNotRemovable', itemName=item.userName, isEnabled=not item.isRemovable and not isUseGold))
     self.addPlugins(addPlugins)
     self.useGold = isUseGold
     return
Example #14
0
 def getDocumentsData(self, callback):
     items = g_itemsCache.items
     tankman = items.getTankman(self.tmanInvID)
     config = tankmen.getNationConfig(tankman.nationID)
     if tankman.descriptor.isFemale:
         shopPrice = items.shop.passportFemaleChangeCost
         defaultPrice = items.shop.defaults.passportFemaleChangeCost
     else:
         shopPrice = items.shop.passportChangeCost
         defaultPrice = items.shop.defaults.passportChangeCost
     action = None
     if shopPrice != defaultPrice:
         action = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS,
                                        'passportChangeCost', True,
                                        Money(gold=shopPrice),
                                        Money(gold=defaultPrice))
     callback({
         'money':
         items.stats.money,
         'passportChangeCost':
         shopPrice,
         'action':
         action,
         'firstnames':
         self.__getDocGroupValues(tankman, config, 'firstNames'),
         'lastnames':
         self.__getDocGroupValues(tankman, config, 'lastNames'),
         'icons':
         self.__getDocGroupValues(tankman,
                                  config,
                                  'icons',
                                  sortNeeded=False)
     })
     return
 def getActionVO(self):
     buyPrice = self.__booster.buyPrice
     defaultPrice = self.__booster.defaultPrice
     if buyPrice != defaultPrice:
         return packActionTooltipData(ACTION_TOOLTIPS_TYPE.BOOSTER, str(self.__booster.boosterID), True, buyPrice, defaultPrice)
     else:
         return None
 def _buildSupplyItems(self):
     self._supplyItems = []
     items = self._itemsCache.items
     slots = items.stats.vehicleSlots
     vehicles = self.getTotalVehiclesCount()
     slotPrice = items.shop.getVehicleSlotsPrice(slots)
     defaultSlotPrice = items.shop.defaults.getVehicleSlotsPrice(slots)
     if slotPrice != defaultSlotPrice:
         discount = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'slotsPrices', True, Money(gold=slotPrice), Money(gold=defaultSlotPrice))
     else:
         discount = None
     self._emptySlotsCount = slots - vehicles
     smallBuySlotString, buySlotString = getStatusStrings('buySlot')
     smallBuyTankString, buyTankString = getStatusStrings('buyTank')
     smallEmptySlotsString, emptySlotsString = getStatusStrings('buyTankEmptyCount', style=text_styles.main, ctx={'count': self._emptySlotsCount})
     self._supplyItems.append({'buyTank': True,
      'smallInfoText': text_styles.concatStylesToMultiLine(smallBuyTankString, smallEmptySlotsString),
      'infoText': text_styles.concatStylesToMultiLine(buyTankString, emptySlotsString),
      'icon': RES_ICONS.MAPS_ICONS_LIBRARY_TANKITEM_BUY_TANK,
      'tooltip': TOOLTIPS.TANKS_CAROUSEL_BUY_VEHICLE})
     buySlotVO = {'buySlot': True,
      'slotPrice': slotPrice,
      'icon': RES_ICONS.MAPS_ICONS_LIBRARY_TANKITEM_BUY_SLOT,
      'infoText': buySlotString,
      'smallInfoText': smallBuySlotString,
      'hasSale': discount is not None,
      'tooltip': TOOLTIPS.TANKS_CAROUSEL_BUY_SLOT}
     if discount is not None:
         buySlotVO.update({'slotPriceActionData': discount})
     self._supplyItems.append(buySlotVO)
     return
Example #17
0
 def __getActionVO(booster):
     itemPrice = booster.buyPrices.itemPrice
     if itemPrice.isActionPrice():
         return packActionTooltipData(ACTION_TOOLTIPS_TYPE.BOOSTER,
                                      str(booster.boosterID), True,
                                      itemPrice.price, itemPrice.defPrice)
     else:
         return None
 def getActionVO(self):
     if self.__boosterBuyPricesSum.isActionPrice():
         return packActionTooltipData(ACTION_TOOLTIPS_TYPE.BOOSTER,
                                      str(self.__booster.boosterID), True,
                                      self.__boosterBuyPricesSum.price,
                                      self.__boosterBuyPricesSum.defPrice)
     else:
         return None
Example #19
0
 def __getActionVO(booster):
     if booster.buyPrice != booster.defaultPrice:
         return packActionTooltipData(ACTION_TOOLTIPS_TYPE.BOOSTER,
                                      str(booster.boosterID), True,
                                      booster.buyPrice,
                                      booster.defaultPrice)
     else:
         return None
Example #20
0
 def __getAction(self, cost, defaultCost, period):
     if cost != defaultCost:
         return packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS,
                                      'premiumPacket%dCost' % period, True,
                                      Money(gold=cost),
                                      Money(gold=defaultCost))
     else:
         return None
Example #21
0
 def __init__(self,
              vehicle,
              item,
              slotIdx,
              install=True,
              isUseMoney=False,
              conflictedEqs=None,
              skipConfirm=False):
     """
     Ctor.
     
     @param vehicle: vehicle
     @param item: module to install
     @param slotIdx: vehicle equipment slot index to install
     @param install: true if device is being installed, false if being demounted
     @param isUseMoney: if False - it means the user selected 'destroy' device, otherwise - de-install for money
     @param conflictedEqs: conflicted items
     """
     super(OptDeviceInstaller,
           self).__init__(vehicle,
                          item, (GUI_ITEM_TYPE.OPTIONALDEVICE, ),
                          slotIdx,
                          install,
                          conflictedEqs,
                          skipConfirm=skipConfirm)
     self.removalPrice = item.getRemovalPrice(self.itemsCache.items)
     action = None
     if self.removalPrice.isActionPrice():
         action = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS,
                                        'paidRemovalCost', True,
                                        self.removalPrice.price,
                                        self.removalPrice.defPrice)
     addPlugins = []
     if install:
         addPlugins += (plugins.MessageConfirmator(
             'installConfirmationNotRemovable_%s' %
             self.removalPrice.price.getCurrency(),
             ctx={'name': item.userName},
             isEnabled=not item.isRemovable and not skipConfirm), )
     else:
         addPlugins += (plugins.DemountDeviceConfirmator(
             'removeConfirmationNotRemovableMoney',
             ctx={
                 'name': item.userName,
                 'price': self.removalPrice,
                 'action': action,
                 'item': item
             },
             isEnabled=not item.isRemovable and isUseMoney
             and not skipConfirm),
                        plugins.DestroyDeviceConfirmator(
                            'removeConfirmationNotRemovable',
                            itemName=item.userName,
                            isEnabled=not item.isRemovable
                            and not isUseMoney and not skipConfirm))
     self.addPlugins(addPlugins)
     self.useMoney = isUseMoney
     return
Example #22
0
    def _generateOptions(self, ctx=None):
        item = self.itemsCache.items.getItemByCD(self._intCD)
        buyPriceVO = getItemPricesVO(item.getBuyPrice())
        sellPriceVO = getItemPricesVO(item.getSellPrice())
        inventoryCount = self._c11nView.getItemInventoryCount(item)
        availableForSale = inventoryCount > 0 and item.getSellPrice(
        ) != ITEM_PRICE_EMPTY and not item.isRentable and not item.isHidden
        style = self._c11nView.getModifiedStyle()
        removeFromTankEnabled = style.intCD == item.intCD if style is not None else False
        for outfit in (self._c11nView.getModifiedOutfit(season)
                       for season in SeasonType.COMMON_SEASONS):
            if outfit.has(item):
                removeFromTankEnabled = True
                break

        accountMoney = self.itemsCache.items.stats.money
        availableForPurchase = not item.isHidden and not item.getBuyPrice(
        ) == ITEM_PRICE_EMPTY and item.getBuyPrice().price <= accountMoney
        showAlert = len(sellPriceVO[0]) > 1
        tooltipVO = None
        if showAlert:
            tooltipVO = packActionTooltipData(
                ACTION_TOOLTIPS_TYPE.ITEM, str(item.intCD), False,
                item.sellPrices.getSum().price,
                item.sellPrices.getSum().defPrice)
            price = sellPriceVO[0]['price']
            sellPriceVO[0] = {}
            sellPriceVO[0]['price'] = price
        return [
            self._makeItem(
                CustomizationOptions.BUY,
                MENU.cst_item_ctx_menu(CustomizationOptions.BUY), {
                    'data': {
                        'price': first(buyPriceVO)
                    } if availableForPurchase else None,
                    'enabled': availableForPurchase
                }, None, 'CurrencyContextMenuItem'),
            self._makeSeparator(),
            self._makeItem(
                CustomizationOptions.SELL,
                MENU.cst_item_ctx_menu(CustomizationOptions.SELL), {
                    'data': {
                        'price': first(sellPriceVO)
                    } if availableForSale else None,
                    'enabled': availableForSale,
                    'showAlert': showAlert,
                    'tooltipVO': tooltipVO
                }, None, 'CurrencyContextMenuItem'),
            self._makeSeparator(),
            self._makeItem(
                CustomizationOptions.REMOVE_FROM_TANK,
                MENU.cst_item_ctx_menu(CustomizationOptions.REMOVE_FROM_TANK),
                {'enabled': removeFromTankEnabled})
        ]
Example #23
0
 def __init__(self, optDevice, vehicle=None):
     super(_OptionalDeviceData,
           self).__init__(optDevice, FITTING_TYPES.OPTIONAL_DEVICE)
     self._flashData['isRemovable'] = optDevice.isRemovable
     removalPrice = optDevice.getRemovalPrice(self.__itemsCache.items)
     if removalPrice.isActionPrice():
         self._flashData['removeActionPrice'] = packActionTooltipData(
             ACTION_TOOLTIPS_TYPE.ECONOMICS, 'paidRemovalCost', True,
             removalPrice.price, removalPrice.defPrice)
     self._itemRemovalPrice = _VSDMoney(removalPrice.price)
     if isDemountKitApplicableTo(optDevice):
         self._itemRemovalPrice += _DEMOUNT_KIT_ONE
     self._flashData['removePrice'] = self._itemRemovalPrice.toDict()
Example #24
0
def _packBuyBerthsSlot():
    berths = g_itemsCache.items.stats.tankmenBerthsCount
    berthPrice, berthCount = g_itemsCache.items.shop.getTankmanBerthPrice(berths)
    defaultBerthPrice, _ = g_itemsCache.items.shop.defaults.getTankmanBerthPrice(berths)
    gold = g_itemsCache.items.stats.money.gold
    action = None
    if berthPrice != defaultBerthPrice:
        action = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'berthsPrices', True, berthPrice, defaultBerthPrice)
    enoughGold = berthPrice.gold <= gold
    return {'buy': True,
     'price': BigWorld.wg_getGoldFormat(berthPrice.gold),
     'enoughGold': enoughGold,
     'actionPriceData': action,
     'count': berthCount}
Example #25
0
 def __init__(self,
              vehicle,
              item,
              slotIdx,
              install=True,
              isUseGold=False,
              conflictedEqs=None):
     """
     Ctor.
     
     @param vehicle: vehicle
     @param item: module to install
     @param slotIdx: vehicle equipment slot index to install
     @param install: flag to designated process
     @param conflictedEqs: conflicted items
     """
     super(OptDeviceInstaller,
           self).__init__(vehicle, item, (GUI_ITEM_TYPE.OPTIONALDEVICE, ),
                          slotIdx, install, conflictedEqs)
     self.cost = g_itemsCache.items.shop.paidRemovalCost
     defaultCost = g_itemsCache.items.shop.defaults.paidRemovalCost
     action = None
     if self.cost != defaultCost:
         action = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS,
                                        'paidRemovalCost', True,
                                        Money(gold=self.cost),
                                        Money(gold=defaultCost))
     addPlugins = []
     if install:
         addPlugins += (plugins.MessageConfirmator(
             'installConfirmationNotRemovable',
             ctx={'name': item.userName},
             isEnabled=not item.isRemovable), )
     else:
         addPlugins += (plugins.DemountDeviceConfirmator(
             'removeConfirmationNotRemovableGold',
             ctx={
                 'name': item.userName,
                 'price': self.cost,
                 'action': action
             },
             isEnabled=not item.isRemovable and isUseGold),
                        plugins.DestroyDeviceConfirmator(
                            'removeConfirmationNotRemovable',
                            itemName=item.userName,
                            isEnabled=not item.isRemovable
                            and not isUseGold))
     self.addPlugins(addPlugins)
     self.useGold = isUseGold
     return
Example #26
0
def _packBuyBerthsSlot():
    berths = g_itemsCache.items.stats.tankmenBerthsCount
    berthPrice, berthCount = g_itemsCache.items.shop.getTankmanBerthPrice(berths)
    defaultBerthPrice, _ = g_itemsCache.items.shop.defaults.getTankmanBerthPrice(berths)
    gold = g_itemsCache.items.stats.money.gold
    action = None
    if berthPrice != defaultBerthPrice:
        action = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'berthsPrices', True, berthPrice, defaultBerthPrice)
    enoughGold = berthPrice.gold <= gold
    return {'buy': True,
     'price': BigWorld.wg_getGoldFormat(berthPrice.gold),
     'enoughGold': enoughGold,
     'actionPriceData': action,
     'count': berthCount}
 def __init__(self,
              vehicle,
              item,
              slotIdx,
              install=True,
              isUseMoney=False,
              conflictedEqs=None,
              skipConfirm=False):
     super(OptDeviceInstaller,
           self).__init__(vehicle,
                          item, (GUI_ITEM_TYPE.OPTIONALDEVICE, ),
                          slotIdx,
                          install,
                          conflictedEqs,
                          skipConfirm=skipConfirm)
     self.removalPrice = item.getRemovalPrice(self.itemsCache.items)
     action = None
     if self.removalPrice.isActionPrice():
         action = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS,
                                        'paidRemovalCost', True,
                                        self.removalPrice.price,
                                        self.removalPrice.defPrice)
     addPlugins = []
     if install:
         addPlugins += (plugins.MessageConfirmator(
             'installConfirmationNotRemovable_%s' %
             self.removalPrice.price.getCurrency(),
             ctx={'name': item.userName},
             isEnabled=not item.isRemovable and not skipConfirm), )
     else:
         addPlugins += (plugins.DemountDeviceConfirmator(
             'removeConfirmationNotRemovableMoney',
             ctx={
                 'name': item.userName,
                 'price': self.removalPrice,
                 'action': action,
                 'item': item
             },
             isEnabled=not item.isRemovable and isUseMoney
             and not skipConfirm),
                        plugins.DestroyDeviceConfirmator(
                            'removeConfirmationNotRemovable',
                            itemName=item.userName,
                            isEnabled=not item.isRemovable
                            and not isUseMoney and not skipConfirm))
     self.addPlugins(addPlugins)
     self.useMoney = isUseMoney
     return
Example #28
0
 def _buildSupplyItems(self):
     self._supplyItems = []
     items = self._itemsCache.items
     slots = items.stats.vehicleSlots
     vehicles = len(items.getVehicles(REQ_CRITERIA.INVENTORY))
     slotPrice = items.shop.getVehicleSlotsPrice(slots)
     defaultSlotPrice = items.shop.defaults.getVehicleSlotsPrice(slots)
     if slotPrice != defaultSlotPrice:
         sale = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS,
                                      'slotsPrices', True,
                                      Money(gold=slotPrice),
                                      Money(gold=defaultSlotPrice))
     else:
         sale = None
     self._emptySlotsCount = slots - vehicles
     self._supplyItems.append({
         'buyTank':
         True,
         'additionalText':
         i18n.makeString(
             '#menu:tankCarousel/vehicleStates/buyTankEmptyCount',
             count=self._emptySlotsCount),
         'showInfoText':
         True,
         'infoText':
         _getStatusString('buyTank', Vehicle.VEHICLE_STATE_LEVEL.INFO),
         'icon':
         RES_ICONS.MAPS_ICONS_LIBRARY_TANKITEM_BUY_TANK
     })
     buySlotVO = {
         'buySlot':
         True,
         'slotPrice':
         slotPrice,
         'icon':
         RES_ICONS.MAPS_ICONS_LIBRARY_TANKITEM_BUY_SLOT,
         'showInfoText':
         True,
         'infoText':
         _getStatusString('buySlot', Vehicle.VEHICLE_STATE_LEVEL.INFO),
         'hasSale':
         sale is not None
     }
     if sale is not None:
         buySlotVO.update({'slotPriceActionData': sale})
     self._supplyItems.append(buySlotVO)
     return
def _packBuyBerthsSlot(itemsCache=None):
    berths = itemsCache.items.stats.tankmenBerthsCount
    berthPrice, berthCount = itemsCache.items.shop.getTankmanBerthPrice(berths)
    defaultBerthPrice, _ = itemsCache.items.shop.defaults.getTankmanBerthPrice(
        berths)
    action = None
    if berthPrice != defaultBerthPrice:
        action = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS,
                                       'berthsPrices', True, berthPrice,
                                       defaultBerthPrice)
    return {
        'buy': True,
        'price':
        backport.getGoldFormat(berthPrice.getSignValue(Currency.GOLD)),
        'actionPriceData': action,
        'count': berthCount
    }
Example #30
0
 def __checkMoney(self):
     changeRoleCost = self.itemsCache.items.shop.changeRoleCost
     defaultChangeRoleCost = self.itemsCache.items.shop.defaults.changeRoleCost
     if changeRoleCost != defaultChangeRoleCost:
         discount = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS,
                                          'changeRoleCost', True,
                                          Money(gold=changeRoleCost),
                                          Money(gold=defaultChangeRoleCost))
     else:
         discount = None
     formattedPrice = backport.getIntegralFormat(changeRoleCost)
     actualGold = self.itemsCache.items.stats.gold
     enoughGold = actualGold - changeRoleCost >= 0
     style = text_styles.gold if enoughGold else text_styles.error
     self.as_setPriceS(priceString='{}{}'.format(style(formattedPrice),
                                                 icons.gold()),
                       actionChangeRole=discount)
     return
    def getTankmanCostWithDefaults(self):
        from gui.shared.tooltips import ACTION_TOOLTIPS_TYPE
        from gui.shared.tooltips.formatters import packActionTooltipData
        shopPrices = self.tankmanCost
        defaultPrices = self.defaults.tankmanCost
        action = []
        tmanCost = []
        for idx, price in enumerate(shopPrices):
            data = price.copy()
            shopPrice = Money(**price)
            defaultPrice = Money(**defaultPrices[idx])
            actionData = None
            if shopPrice != defaultPrice:
                key = '{}TankmanCost'.format(shopPrice.getCurrency(byWeight=True))
                actionData = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, key, True, shopPrice, defaultPrice)
            tmanCost.append(data)
            action.append(actionData)

        return (tmanCost, action)
Example #32
0
    def __getBtnDataPack(self):
        priceVO = []
        enabled = True
        action = None
        tooltip = ''
        for curr in self.__packPrice.getSetCurrencies():
            priceVO.append(curr)
            priceVO.append(self.__packPrice.getSignValue(curr))

        if self._disableBuyButton:
            tooltip = _buildBuyButtonTooltip('endTime')
            enabled = False
        if self.__oldPrice.isDefined():
            action = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'itemsPack', True, self.__packPrice, self.__oldPrice)
        if self.__packItems:
            buttonLabel = VEHICLE_PREVIEW.BUYINGPANEL_BUYBTN_LABEL_BUYITEMPACK
        else:
            buttonLabel = VEHICLE_PREVIEW.BUYINGPANEL_BUYBTN_LABEL_BUY
        return _ButtonState(enabled, priceVO, buttonLabel, action, tooltip, self.__packTitle)
Example #33
0
 def getDocumentsData(self, callback):
     items = self.itemsCache.items
     tankman = items.getTankman(self.tmanInvID)
     config = tankmen.getNationConfig(tankman.nationID)
     if tankman.descriptor.isFemale:
         shopPrice = items.shop.passportFemaleChangeCost
         defaultPrice = items.shop.defaults.passportFemaleChangeCost
     else:
         shopPrice = items.shop.passportChangeCost
         defaultPrice = items.shop.defaults.passportChangeCost
     currentGold = self.itemsCache.items.stats.gold
     enableSubmitButton = shopPrice <= currentGold or isIngameShopEnabled()
     action = None
     if shopPrice != defaultPrice:
         action = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS,
                                        'passportChangeCost', True,
                                        Money(gold=shopPrice),
                                        Money(gold=defaultPrice))
     callback({
         'money':
         items.stats.money.toMoneyTuple(),
         'passportChangeCost':
         shopPrice,
         'action':
         action,
         'firstnames':
         self.__getDocGroupValues(tankman, config,
                                  operator.attrgetter('firstNamesList'),
                                  config.getFirstName),
         'lastnames':
         self.__getDocGroupValues(tankman, config,
                                  operator.attrgetter('lastNamesList'),
                                  config.getLastName),
         'icons':
         self.__getDocGroupValues(tankman,
                                  config,
                                  operator.attrgetter('iconsList'),
                                  config.getIcon,
                                  sortNeeded=False),
         'enableSubmitButton':
         enableSubmitButton
     })
     return
Example #34
0
 def getDocumentsData(self, callback):
     items = g_itemsCache.items
     tankman = items.getTankman(self.tmanInvID)
     config = tankmen.getNationConfig(tankman.nationID)
     if tankman.descriptor.isFemale:
         shopPrice = items.shop.passportFemaleChangeCost
         defaultPrice = items.shop.defaults.passportFemaleChangeCost
     else:
         shopPrice = items.shop.passportChangeCost
         defaultPrice = items.shop.defaults.passportChangeCost
     action = None
     if shopPrice != defaultPrice:
         action = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'passportChangeCost', True, Money(gold=shopPrice), Money(gold=defaultPrice))
     callback({'money': items.stats.money,
      'passportChangeCost': shopPrice,
      'action': action,
      'firstnames': self.__getDocGroupValues(tankman, config, 'firstNames'),
      'lastnames': self.__getDocGroupValues(tankman, config, 'lastNames'),
      'icons': self.__getDocGroupValues(tankman, config, 'icons', sortNeeded=False)})
     return
 def __checkMoney(self):
     changeRoleCost = self.itemsCache.items.shop.changeRoleCost
     defaultChangeRoleCost = self.itemsCache.items.shop.defaults.changeRoleCost
     if changeRoleCost != defaultChangeRoleCost:
         discount = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS,
                                          'changeRoleCost', True,
                                          Money(gold=changeRoleCost),
                                          Money(gold=defaultChangeRoleCost))
     else:
         discount = None
     formattedPrice = BigWorld.wg_getIntegralFormat(changeRoleCost)
     actualGold = self.itemsCache.items.stats.gold
     enoughGold = actualGold - changeRoleCost >= 0
     if enoughGold:
         priceString = text_styles.gold(formattedPrice)
     else:
         priceString = text_styles.error(formattedPrice)
     priceString += icons.gold()
     self.as_setPriceS(priceString, enoughGold, discount)
     return
def _packBuyBerthsSlot(itemsCache=None):
    berths = itemsCache.items.stats.tankmenBerthsCount
    berthPrice, berthCount = itemsCache.items.shop.getTankmanBerthPrice(berths)
    defaultBerthPrice, _ = itemsCache.items.shop.defaults.getTankmanBerthPrice(
        berths)
    gold = itemsCache.items.stats.money.gold
    action = None
    if berthPrice != defaultBerthPrice:
        action = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS,
                                       'berthsPrices', True, berthPrice,
                                       defaultBerthPrice)
    enoughGold = berthPrice.gold <= gold
    return {
        'buy': True,
        'price':
        BigWorld.wg_getGoldFormat(berthPrice.getSignValue(Currency.GOLD)),
        'enoughGold': enoughGold or isIngameShopEnabled(),
        'actionPriceData': action,
        'count': berthCount
    }
Example #37
0
    def __setData(self, *args):
        items = self.itemsCache.items
        tankman = items.getTankman(self.tmanInvID)
        if tankman is None:
            self.onWindowClose()
            return
        else:
            dropSkillsCost = []
            for k in sorted(items.shop.dropSkillsCost.keys()):
                skillCost = items.shop.dropSkillsCost[k]
                defaultSkillCots = items.shop.defaults.dropSkillsCost[k]
                price = Money(**skillCost)
                defaultPrice = Money(**defaultSkillCots)
                action = None
                if price != defaultPrice:
                    key = '{}DropSkillsCost'.format(
                        price.getCurrency(byWeight=True))
                    action = packActionTooltipData(
                        ACTION_TOOLTIPS_TYPE.ECONOMICS, key, True, price,
                        defaultPrice)
                skillCost['action'] = action
                dropSkillsCost.append(skillCost)

            skills_count = tankmen.getSkillsConfig().getNumberOfActiveSkills()
            lenSkills = len(tankman.skills)
            availableSkillsCount = skills_count - lenSkills
            hasNewSkills = tankman.roleLevel == tankmen.MAX_SKILL_LEVEL and availableSkillsCount and (
                tankman.descriptor.lastSkillLevel == tankmen.MAX_SKILL_LEVEL
                or not lenSkills)
            tankmanData = packTankman(tankman, isCountPermanentSkills=False)
            repackTankmanWithSkinData(tankman, tankmanData)
            self.as_setDataS({
                'tankman': tankmanData,
                'dropSkillsCost': dropSkillsCost,
                'hasNewSkills': hasNewSkills,
                'newSkills': tankman.newSkillCount,
                'defaultSavingMode': 0,
                'texts': self.__getTexts()
            })
            self.as_updateRetrainButtonsDataS(packDropSkill(tankman))
            return
 def _buildSupplyItems(self):
     self._supplyItems = []
     items = self._itemsCache.items
     inventory = self._itemsCache.items.inventory
     slots = items.stats.vehicleSlots
     slotPrice = items.shop.getVehicleSlotsPrice(slots)
     defaultSlotPrice = items.shop.defaults.getVehicleSlotsPrice(slots)
     self._emptySlotsCount = inventory.getFreeSlots(slots)
     criteria = REQ_CRITERIA.IN_CD_LIST(items.recycleBin.getVehiclesIntCDs()) | REQ_CRITERIA.VEHICLE.IS_RESTORE_POSSIBLE
     self._restorableVehiclesCount = len(items.getVehicles(criteria))
     if slotPrice != defaultSlotPrice:
         discount = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'slotsPrices', True, Money(gold=slotPrice), Money(gold=defaultSlotPrice))
     else:
         discount = None
     smallBuySlotString, buySlotString = getStatusStrings('buySlot')
     smallBuyTankString, buyTankString = getStatusStrings('buyTank')
     smallRestoreTankString, restoreTankString = getStatusStrings('restoreTank')
     smallRestoreTankCountString, restoreTankCountString = getStatusStrings('restoreTankCount', style=text_styles.main, ctx={'count': self._restorableVehiclesCount})
     smallEmptySlotsString, emptySlotsString = getStatusStrings('buyTankEmptyCount', style=text_styles.main, ctx={'count': self._emptySlotsCount})
     self._supplyItems.append({'buyTank': True,
      'smallInfoText': text_styles.concatStylesToMultiLine(smallBuyTankString, smallEmptySlotsString),
      'infoText': text_styles.concatStylesToMultiLine(buyTankString, emptySlotsString),
      'icon': RES_ICONS.MAPS_ICONS_LIBRARY_TANKITEM_BUY_TANK,
      'tooltip': TOOLTIPS.TANKS_CAROUSEL_BUY_VEHICLE_NEW})
     self._supplyItems.append({'restoreTank': True,
      'smallInfoText': text_styles.concatStylesToMultiLine(smallRestoreTankString, smallRestoreTankCountString),
      'infoText': text_styles.concatStylesToMultiLine(restoreTankString, restoreTankCountString),
      'icon': RES_ICONS.MAPS_ICONS_LIBRARY_TANKITEM_BUY_TANK,
      'tooltip': TOOLTIPS.TANKS_CAROUSEL_RESTORE_VEHICLE})
     buySlotVO = {'buySlot': True,
      'slotPrice': slotPrice,
      'icon': RES_ICONS.MAPS_ICONS_LIBRARY_TANKITEM_BUY_SLOT,
      'infoText': buySlotString,
      'smallInfoText': smallBuySlotString,
      'hasSale': discount is not None,
      'tooltip': TOOLTIPS.TANKS_CAROUSEL_BUY_SLOT}
     if discount is not None:
         buySlotVO.update({'slotPriceActionData': discount})
     self._supplyItems.append(buySlotVO)
     return
Example #39
0
    def getTankmanCostWithDefaults(self):
        """
        @return: tankman studying cost
                        tmanCost, action -  ( tmanCostType, ), ( actionData, ) where
                        tmanCostType = {
                                        'roleLevel' : minimal role level after operation,
                                        'credits' : cost in credits,
                                        'defCredits' : cost in credits,
                                        'gold' : default cost in gold,
                                        'defGold' : default cost in gold,
                                        'baseRoleLoss' : float in [0, 1], fraction of role to drop,
                                        'classChangeRoleLoss' : float in [0, 1], fraction of role to drop
                                        additionally if
                                                classes of self.vehicleTypeID and newVehicleTypeID are different,
                                        'isPremium' : tankman becomes premium,
                                        }.
                                List is sorted by role level.
                        actionData = Action data for each level of retraining
        """
        from gui.shared.tooltips import ACTION_TOOLTIPS_TYPE
        from gui.shared.tooltips.formatters import packActionTooltipData
        shopPrices = self.tankmanCost
        defaultPrices = self.defaults.tankmanCost
        action = []
        tmanCost = []
        for idx, price in enumerate(shopPrices):
            data = price.copy()
            shopPrice = Money(**price)
            defaultPrice = Money(**defaultPrices[idx])
            actionData = None
            if shopPrice != defaultPrice:
                key = '{}TankmanCost'.format(
                    shopPrice.getCurrency(byWeight=True))
                actionData = packActionTooltipData(
                    ACTION_TOOLTIPS_TYPE.ECONOMICS, key, True, shopPrice,
                    defaultPrice)
            tmanCost.append(data)
            action.append(actionData)

        return (tmanCost, action)
Example #40
0
    def getTankmanCostWithDefaults(self):
        """
        @return: tankman studying cost
                        tmanCost, action -  ( tmanCostType, ), ( actionData, ) where
                        tmanCostType = {
                                        'roleLevel' : minimal role level after operation,
                                        'credits' : cost in credits,
                                        'defCredits' : cost in credits,
                                        'gold' : default cost in gold,
                                        'defGold' : default cost in gold,
                                        'baseRoleLoss' : float in [0, 1], fraction of role to drop,
                                        'classChangeRoleLoss' : float in [0, 1], fraction of role to drop
                                        additionally if
                                                classes of self.vehicleTypeID and newVehicleTypeID are different,
                                        'isPremium' : tankman becomes premium,
                                        }.
                                List is sorted by role level.
                        actionData = Action data for each level of retraining
        """
        from gui.shared.tooltips import ACTION_TOOLTIPS_TYPE
        from gui.shared.tooltips.formatters import packActionTooltipData
        shopPrices = self.tankmanCost
        defaultPrices = self.defaults.tankmanCost
        action = []
        tmanCost = []
        for idx, price in enumerate(shopPrices):
            data = price.copy()
            shopPrice = Money(**price)
            defaultPrice = Money(**defaultPrices[idx])
            actionData = None
            if shopPrice != defaultPrice:
                key = '{}TankmanCost'.format(shopPrice.getCurrency(byWeight=True))
                actionData = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, key, True, shopPrice, defaultPrice)
            tmanCost.append(data)
            action.append(actionData)

        return (tmanCost, action)
Example #41
0
 def __getAction(self, cost, defaultCost, period):
     if cost != defaultCost:
         return packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'premiumPacket%dCost' % period, True, Money(gold=cost), Money(gold=defaultCost))
     else:
         return None
 def getActionVO(self, module):
     price = self.getActualPrice(module)
     defaultPrice = self.getDefaultPrice(module)
     return packActionTooltipData(ACTION_TOOLTIPS_TYPE.ITEM, str(module.intCD), False, price, defaultPrice)
Example #43
0
    def _initData(self, *args):
        stats = g_itemsCache.items.stats
        self.as_setGoldS(stats.gold)
        self.as_setCreditsS(stats.credits)
        windowExpanded = AccountSettings.getSettings(VEHICLE_BUY_WINDOW_SETTINGS)
        vehicle = g_itemsCache.items.getItem(GUI_ITEM_TYPE.VEHICLE, self.nationID, self.inNationID)
        if vehicle is None:
            LOG_ERROR("Vehicle Item mustn't be None!", 'NationID:', self.nationID, 'InNationID:', self.inNationID)
        elif vehicle.isInInventory and not vehicle.isRented:
            self.onWindowClose()
        else:
            shop = g_itemsCache.items.shop
            shopDefaults = shop.defaults
            tankMenCount = len(vehicle.crew)
            tankMenStudyPrice = shop.tankmanCostWithGoodyDiscount
            totalTankMenStudePrice = tankMenCount * Money(credits=tankMenStudyPrice[1]['credits'], gold=tankMenStudyPrice[2]['gold'])
            defTankMenStudyPrice = shopDefaults.tankmanCost
            defTotalTankMenStudePrice = tankMenCount * Money(credits=defTankMenStudyPrice[1]['credits'], gold=defTankMenStudyPrice[2]['gold'])
            studyPriceCreditsActionData = None
            if totalTankMenStudePrice != defTotalTankMenStudePrice:
                studyPriceCreditsActionData = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'creditsTankmanCost', True, totalTankMenStudePrice, defTotalTankMenStudePrice)
            studyPriceGoldActionData = None
            if totalTankMenStudePrice != defTotalTankMenStudePrice:
                studyPriceGoldActionData = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'goldTankmanCost', True, totalTankMenStudePrice, defTotalTankMenStudePrice)
            vehiclePricesActionData = None
            if vehicle.buyPrice != vehicle.defaultPrice:
                vehiclePricesActionData = packItemActionTooltipData(vehicle)
            ammoPrice = ZERO_MONEY
            defAmmoPrice = ZERO_MONEY
            for shell in vehicle.gun.defaultAmmo:
                ammoPrice += shell.buyPrice * shell.defaultCount
                defAmmoPrice += shell.defaultPrice * shell.defaultCount

            ammoActionPriceData = None
            if ammoPrice != defAmmoPrice:
                ammoActionPriceData = packActionTooltipData(ACTION_TOOLTIPS_TYPE.AMMO, str(vehicle.intCD), True, ammoPrice, defAmmoPrice)
            slotPrice = shop.getVehicleSlotsPrice(stats.vehicleSlots)
            slotDefaultPrice = shopDefaults.getVehicleSlotsPrice(stats.vehicleSlots)
            slotActionPriceData = None
            if slotPrice != slotDefaultPrice:
                slotActionPriceData = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'slotsPrices', True, Money(gold=slotPrice), Money(gold=slotDefaultPrice))
            tankmenLabel = i18n.makeString(DIALOGS.BUYVEHICLEDIALOG_TANKMENLABEL, count=text_styles.titleFont(i18n.makeString(DIALOGS.BUYVEHICLEDIALOG_TANKMEN) + ' ' + str(tankMenCount)))
            initData = {'expanded': windowExpanded,
             'name': vehicle.userName,
             'shortName': vehicle.shortUserName,
             'longName': vehicle.longUserName,
             'description': vehicle.fullDescription,
             'type': vehicle.type,
             'icon': vehicle.icon,
             'nation': self.nationID,
             'level': vehicle.level,
             'isElite': vehicle.isElite,
             'tankmenLabel': tankmenLabel,
             'studyPriceCredits': totalTankMenStudePrice.credits,
             'studyPriceCreditsActionData': studyPriceCreditsActionData,
             'studyPriceGold': totalTankMenStudePrice.gold,
             'studyPriceGoldActionData': studyPriceGoldActionData,
             'vehiclePrices': vehicle.buyPrice,
             'vehiclePricesActionData': vehiclePricesActionData,
             'ammoPrice': ammoPrice.credits,
             'ammoActionPriceData': ammoActionPriceData,
             'slotPrice': slotPrice,
             'slotActionPriceData': slotActionPriceData,
             'isRentable': vehicle.isRentable,
             'isStudyDisabled': vehicle.hasCrew,
             'isNoAmmo': not vehicle.hasShells,
             'rentDataDD': self._getRentData(vehicle, vehiclePricesActionData)}
            self.as_setInitDataS(initData)
        return
Example #44
0
    def __updateTankmen(self, *args):
        tankmen = g_itemsCache.items.getTankmen().values()
        slots = g_itemsCache.items.stats.tankmenBerthsCount
        berths = g_itemsCache.items.stats.tankmenBerthsCount
        berthPrice = g_itemsCache.items.shop.getTankmanBerthPrice(berths)
        defaultBerthPrice = g_itemsCache.items.shop.defaults.getTankmanBerthPrice(berths)
        tankmenList = list()
        tankmenInBarracks = 0
        action = None
        if berthPrice[0] != defaultBerthPrice[0]:
            action = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'berthsPrices', True, Money(gold=berthPrice[0]), Money(gold=defaultBerthPrice[0]))
        gold = g_itemsCache.items.stats.money.gold
        enoughGold = True
        if berthPrice[0] > gold:
            enoughGold = False
        tankmenList.append({'buy': True,
         'price': BigWorld.wg_getGoldFormat(berthPrice[0]),
         'enoughGold': enoughGold,
         'actionPriceData': action,
         'count': berthPrice[1]})
        for tankman in sorted(tankmen, TankmenComparator(g_itemsCache.items.getVehicle)):
            if not tankman.isInTank:
                tankmenInBarracks += 1
            slot, vehicleID, vehicleInnationID, vehicle = (None, None, None, None)
            if tankman.isInTank:
                vehicle = g_itemsCache.items.getVehicle(tankman.vehicleInvID)
                vehicleID = vehicle.invID
                vehicleInnationID = vehicle.innationID
                if vehicle is None:
                    LOG_ERROR('Cannot find vehicle for tankman: ', tankman, tankman.descriptor.role, tankman.vehicle.name, tankman.firstname, tankman.lastname)
                    continue
                slot = tankman.vehicleSlotIdx
            if self.filter['nation'] != -1 and tankman.nationID != self.filter['nation'] or self.filter['role'] != 'None' and tankman.descriptor.role != self.filter['role'] or self.filter['tankType'] != 'None' and tankman.vehicleNativeType != self.filter['tankType'] or self.filter['location'] == 'tanks' and tankman.isInTank is not True or self.filter['location'] == 'barracks' and tankman.isInTank is True or self.filter['nationID'] is not None and (self.filter['location'] != str(vehicleInnationID) or self.filter['nationID'] != str(tankman.nationID)):
                continue
            isLocked, msg = self.getTankmanLockMessage(vehicle) if tankman.isInTank else (False, '')
            tankmanVehicle = g_itemsCache.items.getItemByCD(tankman.vehicleNativeDescr.type.compactDescr)
            isInCurrentTank = tankmanVehicle.invID == g_currentVehicle.invID if tankman.isInTank and g_currentVehicle.isPresent() else False
            tankmenList.append({'firstname': tankman.firstUserName,
             'lastname': tankman.lastUserName,
             'rank': tankman.rankUserName,
             'specializationLevel': tankman.realRoleLevel[0],
             'role': tankman.roleUserName,
             'vehicleType': tankmanVehicle.shortUserName,
             'iconFile': tankman.icon,
             'rankIconFile': tankman.iconRank,
             'roleIconFile': Tankman.getRoleBigIconPath(tankman.descriptor.role),
             'contourIconFile': tankmanVehicle.iconContour,
             'tankmanID': tankman.invID,
             'nationID': tankman.nationID,
             'typeID': tankmanVehicle.innationID,
             'slot': slot,
             'roleType': tankman.descriptor.role,
             'tankType': tankmanVehicle.type,
             'inTank': tankman.isInTank,
             'inCurrentTank': isInCurrentTank,
             'vehicleID': vehicleID,
             'compact': str(tankman.invID),
             'locked': isLocked,
             'lockMessage': msg,
             'vehicleBroken': vehicle.repairCost > 0 if tankman.isInTank else None,
             'isInSelfVehicleClass': vehicle.type == tankmanVehicle.type if tankman.isInTank else True,
             'isInSelfVehicleType': vehicle.shortUserName == tankmanVehicle.shortUserName if tankman.isInTank else True})

        tankmenInSlots = len(tankmenList) - 1
        if tankmenInBarracks < slots:
            tankmenList.insert(1, {'empty': True,
             'freePlaces': slots - tankmenInBarracks})
        self.as_setTankmenS(len(tankmen), tankmenInSlots, slots, tankmenInBarracks, tankmenList)
        return
Example #45
0
    def _populate(self):
        super(VehicleSellDialog, self)._populate()
        g_clientUpdateManager.addCallbacks({'stats.gold': self.onSetGoldHndlr})
        g_itemsCache.onSyncCompleted += self.__shopResyncHandler
        items = g_itemsCache.items
        vehicle = items.getVehicle(self.vehInvID)
        sellPrice = vehicle.sellPrice
        sellForGold = sellPrice.gold > 0
        priceTextColor = CURRENCIES_CONSTANTS.GOLD_COLOR if sellForGold else CURRENCIES_CONSTANTS.CREDITS_COLOR
        priceTextValue = _ms(DIALOGS.VEHICLESELLDIALOG_PRICE_SIGN_ADD) + _ms(BigWorld.wg_getIntegralFormat(sellPrice.gold if sellForGold else sellPrice.credits))
        currencyIcon = CURRENCIES_CONSTANTS.GOLD if sellForGold else CURRENCIES_CONSTANTS.CREDITS
        invVehs = items.getVehicles(REQ_CRITERIA.INVENTORY)
        if vehicle.isPremium or vehicle.level >= 3:
            self.as_visibleControlBlockS(True)
            self.__initCtrlQuestion()
        else:
            self.as_visibleControlBlockS(False)
        modules = items.getItems(criteria=REQ_CRITERIA.VEHICLE.SUITABLE([vehicle]) | REQ_CRITERIA.INVENTORY).values()
        shells = items.getItems(criteria=REQ_CRITERIA.VEHICLE.SUITABLE([vehicle], [GUI_ITEM_TYPE.SHELL]) | REQ_CRITERIA.INVENTORY).values()
        otherVehsShells = set()
        for invVeh in invVehs.itervalues():
            if invVeh.invID != self.vehInvID:
                for shot in invVeh.descriptor.gun['shots']:
                    otherVehsShells.add(shot['shell']['compactDescr'])

        vehicleAction = None
        if sellPrice != vehicle.defaultSellPrice:
            vehicleAction = packItemActionTooltipData(vehicle, False)
        if vehicle.isElite:
            description = TOOLTIPS.tankcaruseltooltip_vehicletype_elite(vehicle.type)
        else:
            description = DIALOGS.vehicleselldialog_vehicletype(vehicle.type)
        levelStr = text_styles.concatStylesWithSpace(text_styles.stats(int2roman(vehicle.level)), text_styles.main(_ms(DIALOGS.VEHICLESELLDIALOG_VEHICLE_LEVEL)))
        restoreController = getRestoreController()
        tankmenGoingToBuffer, deletedTankmen = restoreController.getTankmenDeletedBySelling(vehicle)
        deletedCount = len(deletedTankmen)
        if deletedCount > 0:
            recoveryBufferFull = True
            deletedStr = formatDeletedTankmanStr(deletedTankmen[0])
            maxCount = restoreController.getMaxTankmenBufferLength()
            currCount = len(restoreController.getDismissedTankmen())
            if deletedCount == 1:
                crewTooltip = text_styles.concatStylesToMultiLine(text_styles.middleTitle(_ms(TOOLTIPS.VEHICLESELLDIALOG_CREW_ALERTICON_RECOVERY_HEADER)), text_styles.main(_ms(TOOLTIPS.VEHICLESELLDIALOG_CREW_ALERTICON_RECOVERY_BODY, maxVal=maxCount, curVal=currCount, sourceName=tankmenGoingToBuffer[-1].fullUserName, targetInfo=deletedStr)))
            else:
                crewTooltip = text_styles.concatStylesToMultiLine(text_styles.middleTitle(_ms(TOOLTIPS.VEHICLESELLDIALOG_CREW_ALERTICON_RECOVERY_HEADER)), text_styles.main(_ms(TOOLTIPS.DISMISSTANKMANDIALOG_BUFFERISFULLMULTIPLE_BODY, deletedStr=deletedStr, extraCount=deletedCount - 1, maxCount=maxCount, currCount=currCount)))
        else:
            crewTooltip = None
            recoveryBufferFull = False
        barracksDropDownData = [{'label': _ms(MENU.BARRACKS_BTNUNLOAD)}, {'label': _ms(MENU.BARRACKS_BTNDISSMISS)}]
        sellVehicleData = {'intCD': vehicle.intCD,
         'userName': vehicle.userName,
         'icon': vehicle.icon,
         'level': vehicle.level,
         'isElite': vehicle.isElite,
         'isPremium': vehicle.isPremium,
         'type': vehicle.type,
         'nationID': vehicle.nationID,
         'sellPrice': sellPrice,
         'priceTextValue': priceTextValue,
         'priceTextColor': priceTextColor,
         'currencyIcon': currencyIcon,
         'action': vehicleAction,
         'hasCrew': vehicle.hasCrew,
         'isRented': vehicle.isRented,
         'description': description,
         'levelStr': levelStr,
         'priceLabel': _ms(DIALOGS.VEHICLESELLDIALOG_VEHICLE_EMPTYSELLPRICE),
         'crewLabel': _ms(DIALOGS.VEHICLESELLDIALOG_CREW_LABEL),
         'crewTooltip': crewTooltip,
         'barracksDropDownData': barracksDropDownData,
         'crewRecoveryBufferFull': recoveryBufferFull}
        onVehicleOptionalDevices = []
        for o in vehicle.optDevices:
            if o is not None:
                action = None
                if o.sellPrice != o.defaultSellPrice:
                    action = packItemActionTooltipData(o, False)
                data = {'intCD': o.intCD,
                 'isRemovable': o.isRemovable,
                 'userName': o.userName,
                 'sellPrice': o.sellPrice,
                 'toInventory': True,
                 'action': action}
                onVehicleOptionalDevices.append(data)

        onVehicleoShells = []
        for shell in vehicle.shells:
            if shell is not None:
                action = None
                if shell.sellPrice != shell.defaultSellPrice:
                    action = packItemActionTooltipData(shell, False)
                data = {'intCD': shell.intCD,
                 'count': shell.count,
                 'sellPrice': shell.sellPrice,
                 'userName': shell.userName,
                 'kind': shell.type,
                 'toInventory': shell in otherVehsShells or shell.isPremium,
                 'action': action}
                onVehicleoShells.append(data)

        onVehicleEquipments = []
        for equipmnent in vehicle.eqs:
            if equipmnent is not None:
                action = None
                if equipmnent.sellPrice != equipmnent.defaultSellPrice:
                    action = packItemActionTooltipData(equipmnent, False)
                data = {'intCD': equipmnent.intCD,
                 'userName': equipmnent.userName,
                 'sellPrice': equipmnent.sellPrice,
                 'toInventory': True,
                 'action': action}
                onVehicleEquipments.append(data)

        inInventoryModules = []
        for m in modules:
            inInventoryModules.append({'intCD': m.intCD,
             'inventoryCount': m.inventoryCount,
             'toInventory': True,
             'sellPrice': m.sellPrice})

        inInventoryShells = []
        for s in shells:
            action = None
            if s.sellPrice != s.defaultSellPrice:
                action = packItemActionTooltipData(s, False)
            inInventoryShells.append({'intCD': s.intCD,
             'count': s.inventoryCount,
             'sellPrice': s.sellPrice,
             'userName': s.userName,
             'kind': s.type,
             'toInventory': s in otherVehsShells or s.isPremium,
             'action': action})

        removePrice = items.shop.paidRemovalCost
        removePrices = Money(gold=removePrice)
        defRemovePrice = Money(gold=items.shop.defaults.paidRemovalCost)
        removeAction = None
        if removePrices != defRemovePrice:
            removeAction = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'paidRemovalCost', True, removePrices, defRemovePrice)
        settings = self.getDialogSettings()
        isSlidingComponentOpened = settings['isOpened']
        self.as_setDataS({'accountGold': items.stats.gold,
         'sellVehicleVO': sellVehicleData,
         'optionalDevicesOnVehicle': onVehicleOptionalDevices,
         'shellsOnVehicle': onVehicleoShells,
         'equipmentsOnVehicle': onVehicleEquipments,
         'modulesInInventory': inInventoryModules,
         'shellsInInventory': inInventoryShells,
         'removeActionPrice': removeAction,
         'removePrice': removePrice,
         'isSlidingComponentOpened': isSlidingComponentOpened})
        return
    def _populate(self):
        super(VehicleSellDialog, self)._populate()
        g_clientUpdateManager.addCallbacks({'stats.gold': self.onSetGoldHndlr})
        g_itemsCache.onSyncCompleted += self.__shopResyncHandler
        items = g_itemsCache.items
        vehicle = items.getVehicle(self.vehInvID)
        invVehs = items.getVehicles(REQ_CRITERIA.INVENTORY)
        if vehicle.isPremium or vehicle.level >= 3:
            self.as_visibleControlBlockS(True)
            self.__initCtrlQuestion()
        else:
            self.as_visibleControlBlockS(False)
        modules = items.getItems(criteria=REQ_CRITERIA.VEHICLE.SUITABLE([vehicle]) | REQ_CRITERIA.INVENTORY).values()
        shells = items.getItems(criteria=REQ_CRITERIA.VEHICLE.SUITABLE([vehicle], [GUI_ITEM_TYPE.SHELL]) | REQ_CRITERIA.INVENTORY).values()
        otherVehsShells = set()
        for invVeh in invVehs.itervalues():
            if invVeh.invID != self.vehInvID:
                for shot in invVeh.descriptor.gun['shots']:
                    otherVehsShells.add(shot['shell']['compactDescr'])

        vehicleAction = None
        if vehicle.sellPrice != vehicle.defaultSellPrice:
            vehicleAction = packItemActionTooltipData(vehicle, False)
        vehicleData = {'intCD': vehicle.intCD,
         'userName': vehicle.userName,
         'icon': vehicle.icon,
         'level': vehicle.level,
         'isElite': vehicle.isElite,
         'isPremium': vehicle.isPremium,
         'type': vehicle.type,
         'nationID': vehicle.nationID,
         'sellPrice': vehicle.sellPrice,
         'action': vehicleAction,
         'hasCrew': vehicle.hasCrew,
         'isRented': vehicle.isRented}
        onVehicleOptionalDevices = []
        for o in vehicle.optDevices:
            data = None
            if o is not None:
                action = None
                if o.sellPrice != o.defaultSellPrice:
                    action = packItemActionTooltipData(o, False)
                data = {'intCD': o.intCD,
                 'isRemovable': o.isRemovable,
                 'userName': o.userName,
                 'sellPrice': o.sellPrice,
                 'toInventory': True,
                 'action': action}
                onVehicleOptionalDevices.append(data)

        onVehicleoShells = []
        for s in vehicle.shells:
            data = None
            if s is not None:
                action = None
                if s.sellPrice != s.defaultSellPrice:
                    action = packItemActionTooltipData(s, False)
                data = {'intCD': s.intCD,
                 'count': s.count,
                 'sellPrice': s.sellPrice,
                 'userName': s.userName,
                 'kind': s.type,
                 'toInventory': s in otherVehsShells or s.isPremium,
                 'action': action}
                onVehicleoShells.append(data)

        onVehicleEquipments = []
        for e in vehicle.eqs:
            data = None
            if e is not None:
                action = None
                if e.sellPrice != e.defaultSellPrice:
                    action = packItemActionTooltipData(e, False)
                data = {'intCD': e.intCD,
                 'userName': e.userName,
                 'sellPrice': e.sellPrice,
                 'toInventory': True,
                 'action': action}
                onVehicleEquipments.append(data)

        inInventoryModules = []
        for m in modules:
            inInventoryModules.append({'intCD': m.intCD,
             'inventoryCount': m.inventoryCount,
             'toInventory': True,
             'sellPrice': m.sellPrice})

        inInventoryShells = []
        for s in shells:
            action = None
            if s.sellPrice != s.defaultSellPrice:
                action = packItemActionTooltipData(s, False)
            inInventoryShells.append({'intCD': s.intCD,
             'count': s.inventoryCount,
             'sellPrice': s.sellPrice,
             'userName': s.userName,
             'kind': s.type,
             'toInventory': s in otherVehsShells or s.isPremium,
             'action': action})

        removePrice = items.shop.paidRemovalCost
        removePrices = Money(gold=removePrice)
        defRemovePrice = Money(gold=items.shop.defaults.paidRemovalCost)
        removeAction = None
        if removePrices != defRemovePrice:
            removeAction = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'paidRemovalCost', True, removePrices, defRemovePrice)
        settings = self.getDialogSettings()
        isSlidingComponentOpened = settings['isOpened']
        self.as_setDataS({'accountGold': items.stats.gold,
         'sellVehicleVO': vehicleData,
         'optionalDevicesOnVehicle': onVehicleOptionalDevices,
         'shellsOnVehicle': onVehicleoShells,
         'equipmentsOnVehicle': onVehicleEquipments,
         'modulesInInventory': inInventoryModules,
         'shellsInInventory': inInventoryShells,
         'removeActionPrice': removeAction,
         'removePrice': removePrice,
         'isSlidingComponentOpened': isSlidingComponentOpened})
        return