def _getVehStatsByTypes(battlesStats): tDict = battlesStats[0] typesRes = [] for vehType in VEHICLE_TYPES_ORDER: typesRes.append({'xField': i18n.makeString(DIALOGS.vehicleselldialog_vehicletype(vehType)), 'icon': '../maps/icons/filters/tanks/{0}.png'.format(vehType), 'yField': tDict[vehType], 'tooltip': PROFILE.SECTION_STATISTICS_CHART_TYPE_TOOLTIP}) _setChartDataPercentages(typesRes) return typesRes
def _getBattleChartsStatistics(battlesStats, levelDisabledTooltip): outcome = [] tDict = battlesStats[0] typesRes = [] for vehType in VEHICLE_TYPES_ORDER: typesRes.append({ 'xField': i18n.makeString(DIALOGS.vehicleselldialog_vehicletype(vehType)), 'icon': '../maps/icons/filters/tanks/{0}.png'.format(vehType), 'yField': tDict[vehType], 'tooltip': PROFILE.SECTION_STATISTICS_CHART_TYPE_TOOLTIP }) _setChartDataPercentages(typesRes) outcome.append(typesRes) tDict = battlesStats[1] nationRes = [] for guiNationIdx, _ in enumerate(GUI_NATIONS): nationIdx = getNationIndex(guiNationIdx) nationName = nations.NAMES[nationIdx] nationRes.append({ 'xField': i18n.makeString(MENU.nations(nationName)), 'icon': '../maps/icons/filters/nations/{0}.png'.format(nationName), 'yField': tDict[nationIdx], 'tooltip': PROFILE.SECTION_STATISTICS_CHART_NATION_TOOLTIP }) _setChartDataPercentages(nationRes) outcome.append(nationRes) tDict = battlesStats[2] lvlRes = len(tDict) * [None] for level, value in tDict.iteritems(): tooltip = PROFILE.SECTION_STATISTICS_CHART_LEVEL_TOOLTIP if value is None: value = -1 if levelDisabledTooltip is not None: tooltip = levelDisabledTooltip lvlRes[level - 1] = { 'xField': str(level), 'icon': '../maps/icons/levels/tank_level_{0}.png'.format(level), 'yField': value, 'tooltip': tooltip } _setChartDataPercentages(lvlRes) outcome.append(lvlRes) return {'data': outcome}
def _getOptainHeaderData(self, vehicle): from helpers import int2roman levelStr = text_styles.concatStylesWithSpace(text_styles.stats(int2roman(vehicle.level)), text_styles.main(i18n.makeString(DIALOGS.VEHICLESELLDIALOG_VEHICLE_LEVEL))) if vehicle.isElite: description = TOOLTIPS.tankcaruseltooltip_vehicletype_elite(vehicle.type) else: description = DIALOGS.vehicleselldialog_vehicletype(vehicle.type) return {'userName': vehicle.userName, 'levelStr': levelStr, 'description': description, 'intCD': vehicle.intCD, 'icon': vehicle.icon, 'level': vehicle.level, 'isElite': vehicle.isElite, 'isPremium': vehicle.isPremium, 'type': vehicle.type, 'nationID': self.nationID}
def _getBattleChartsStatistics(battlesStats, levelDisabledTooltip): outcome = [] tDict = battlesStats[0] typesRes = [] for vehType in VEHICLE_TYPES_ORDER: typesRes.append({'xField': i18n.makeString(DIALOGS.vehicleselldialog_vehicletype(vehType)), 'icon': '../maps/icons/filters/tanks/{0}.png'.format(vehType), 'yField': tDict[vehType], 'tooltip': PROFILE.SECTION_STATISTICS_CHART_TYPE_TOOLTIP}) _setChartDataPercentages(typesRes) outcome.append(typesRes) tDict = battlesStats[1] nationRes = [] for guiNationIdx, _ in enumerate(GUI_NATIONS): nationIdx = getNationIndex(guiNationIdx) nationName = nations.NAMES[nationIdx] nationRes.append({'xField': i18n.makeString(MENU.nations(nationName)), 'icon': '../maps/icons/filters/nations/{0}.png'.format(nationName), 'yField': tDict[nationIdx], 'tooltip': PROFILE.SECTION_STATISTICS_CHART_NATION_TOOLTIP}) _setChartDataPercentages(nationRes) outcome.append(nationRes) tDict = battlesStats[2] lvlRes = len(tDict) * [None] for level, value in tDict.iteritems(): tooltip = PROFILE.SECTION_STATISTICS_CHART_LEVEL_TOOLTIP if value is None: value = -1 if levelDisabledTooltip != None: tooltip = levelDisabledTooltip lvlRes[level - 1] = {'xField': str(level), 'icon': '../maps/icons/levels/tank_level_{0}.png'.format(level), 'yField': value, 'tooltip': tooltip} _setChartDataPercentages(lvlRes) outcome.append(lvlRes) return {'data': outcome}
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.addCurrencyCallback(Currency.GOLD, self.onSetGoldHndlr) self.itemsCache.onSyncCompleted += self.__shopResyncHandler items = self.itemsCache.items vehicle = items.getVehicle(self.__vehInvID) sellPrice = vehicle.sellPrices.itemPrice.price sellCurrency = sellPrice.getCurrency(byWeight=True) sellForGold = sellCurrency == Currency.GOLD priceTextColor = CURRENCIES_CONSTANTS.GOLD_COLOR if sellForGold else CURRENCIES_CONSTANTS.CREDITS_COLOR priceTextValue = _ms(DIALOGS.VEHICLESELLDIALOG_PRICE_SIGN_ADD) + _ms( BigWorld.wg_getIntegralFormat( sellPrice.getSignValue(sellCurrency))) currencyIcon = CURRENCIES_CONSTANTS.GOLD if sellForGold else CURRENCIES_CONSTANTS.CREDITS invVehs = items.getVehicles(REQ_CRITERIA.INVENTORY) self.checkControlQuestion(self.__checkUsefulTankman) 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.sellPrices.itemPrice.isActionPrice(): 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))) tankmenGoingToBuffer, deletedTankmen = self.restore.getTankmenDeletedBySelling( vehicle) deletedCount = len(deletedTankmen) if deletedCount > 0: deletedStr = formatDeletedTankmanStr(deletedTankmen[0]) maxCount = self.restore.getMaxTankmenBufferLength() currCount = len(self.restore.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 if vehicle.isCrewLocked: hasCrew = False else: hasCrew = vehicle.hasCrew 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.toMoneyTuple(), 'priceTextValue': priceTextValue, 'priceTextColor': priceTextColor, 'currencyIcon': currencyIcon, 'action': vehicleAction, 'hasCrew': hasCrew, 'isRented': vehicle.isRented, 'description': description, 'levelStr': levelStr, 'priceLabel': _ms(DIALOGS.VEHICLESELLDIALOG_VEHICLE_EMPTYSELLPRICE), 'crewLabel': _ms(DIALOGS.VEHICLESELLDIALOG_CREW_LABEL), 'crewTooltip': crewTooltip, 'barracksDropDownData': barracksDropDownData } currentGoldBalance = self.itemsCache.items.stats.money.get( Currency.GOLD, 0) onVehicleOptionalDevices = [] for o in vehicle.optDevices: if o is not None: itemPrice = o.sellPrices.itemPrice action = None if itemPrice.isActionPrice(): action = packItemActionTooltipData(o, False) removalPrice = o.getRemovalPrice(items) removeAction = None if removalPrice.isActionPrice(): removeAction = packActionTooltipData( ACTION_TOOLTIPS_TYPE.ECONOMICS, 'paidRemovalCost', True, removalPrice.price, removalPrice.defPrice) removalPriceInGold = removalPrice.price.get(Currency.GOLD, 0) enoughGold = currentGoldBalance >= removalPriceInGold if enoughGold: currentGoldBalance -= removalPriceInGold data = { 'intCD': o.intCD, 'isRemovable': o.isRemovable, 'userName': o.userName, 'sellPrice': itemPrice.price.toMoneyTuple(), 'toInventory': enoughGold, 'action': action, 'removePrice': removalPrice.price.toMoneyTuple(), 'removeActionPrice': removeAction } onVehicleOptionalDevices.append(data) onVehicleoShells = [] for shell in vehicle.shells: if shell is not None: itemPrice = shell.sellPrices.itemPrice action = None if itemPrice.isActionPrice(): action = packItemActionTooltipData(shell, False) data = { 'intCD': shell.intCD, 'count': shell.count, 'sellPrice': itemPrice.price.toMoneyTuple(), 'userName': shell.userName, 'kind': shell.type, 'toInventory': shell in otherVehsShells or shell.isPremium, 'action': action } onVehicleoShells.append(data) onVehicleEquipments = [] for equipmnent in vehicle.equipment.regularConsumables.getInstalledItems( ): action = None if equipmnent.sellPrices.itemPrice.isActionPrice(): action = packItemActionTooltipData(equipmnent, False) data = { 'intCD': equipmnent.intCD, 'userName': equipmnent.userName, 'sellPrice': equipmnent.sellPrices.itemPrice.price.toMoneyTuple(), 'toInventory': True, 'action': action } onVehicleEquipments.append(data) onVehicleBattleBoosters = [] for booster in vehicle.equipment.battleBoosterConsumables.getInstalledItems( ): data = { 'intCD': booster.intCD, 'userName': booster.userName, 'sellPrice': MONEY_UNDEFINED.toMoneyTuple(), 'onlyToInventory': True } onVehicleBattleBoosters.append(data) inInventoryModules = [] for m in modules: inInventoryModules.append({ 'intCD': m.intCD, 'inventoryCount': m.inventoryCount, 'toInventory': True, 'sellPrice': m.sellPrices.itemPrice.price.toMoneyTuple() }) inInventoryShells = [] for s in shells: action = None itemPrice = s.sellPrices.itemPrice if itemPrice.isActionPrice(): action = packItemActionTooltipData(s, False) inInventoryShells.append({ 'intCD': s.intCD, 'count': s.inventoryCount, 'sellPrice': itemPrice.price.toMoneyTuple(), 'userName': s.userName, 'kind': s.type, 'toInventory': s in otherVehsShells or s.isPremium, 'action': action }) customizationOnVehicle = [] settings = self.getDialogSettings() isSlidingComponentOpened = settings['isOpened'] self.as_setDataS({ 'accountMoney': items.stats.money.toMoneyTuple(), 'sellVehicleVO': sellVehicleData, 'optionalDevicesOnVehicle': onVehicleOptionalDevices, 'shellsOnVehicle': onVehicleoShells, 'equipmentsOnVehicle': onVehicleEquipments, 'modulesInInventory': inInventoryModules, 'shellsInInventory': inInventoryShells, 'isSlidingComponentOpened': isSlidingComponentOpened, 'battleBoostersOnVehicle': onVehicleBattleBoosters, 'customizationOnVehicle': customizationOnVehicle }) 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) 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))) tankmenGoingToBuffer, deletedTankmen = self.restore.getTankmenDeletedBySelling( vehicle) deletedCount = len(deletedTankmen) if deletedCount > 0: recoveryBufferFull = True deletedStr = formatDeletedTankmanStr(deletedTankmen[0]) maxCount = self.restore.getMaxTankmenBufferLength() currCount = len(self.restore.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