def _createVehicleVO(rawItem, itemsCache): intCD = int(rawItem.id) vehicle = itemsCache.items.getItemByCD(intCD) if vehicle is not None: icon = func_utils.makeFlashPath(vehicle.getShopIcon(STORE_CONSTANTS.ICON_SIZE_SMALL)) cd = vehicle.intCD label = vehicle.shortUserName nation = vehicle.nationID level = RES_ICONS.getLevelIcon(vehicle.level) tankType = Vehicle.getTypeSmallIconPath(vehicle.type, vehicle.isElite) else: icon = rawItem.iconSource cd = 0 label = '' nation = nations.NONE_INDEX level = '' tankType = '' return {'icon': icon, 'iconAlt': RES_ICONS.MAPS_ICONS_LIBRARY_VEHICLE_DEFAULT, 'intCD': cd, 'label': label, 'nation': nation, 'hasCompensation': getCompensateItemsCount(rawItem, itemsCache) > 0, 'level': level, 'tankType': tankType}
def __getCompensationData(self, itemsPack): compensationMoney = MONEY_UNDEFINED if itemsPack is not None: for item in collapseItemsPack(itemsPack): compensateItemsCount = getCompensateItemsCount(item, self.__itemsCache) if compensateItemsCount > 0: for compensation in item.compensation: if compensation.type == CompensationType.MONEY: compensationMoney += Money(**compensation.value) * compensateItemsCount if compensationMoney.isDefined(): currency = compensationMoney.getCurrency() val = compensationMoney.get(currency) if val is not None: return self.__packCompensation(val, currency) return
def _createVehicleVO(rawItem, itemsCache): vehicle = itemsCache.items.getStockVehicle(rawItem.id, useInventory=True) if vehicle is not None: icon = vehicle.getShopIcon(STORE_CONSTANTS.ICON_SIZE_SMALL) cd = vehicle.intCD label = vehicle.shortUserName nation = vehicle.nationID else: icon = rawItem.iconSource cd = 0 label = '' nation = nations.NONE_INDEX return { 'icon': icon, 'iconAlt': RES_ICONS.MAPS_ICONS_LIBRARY_VEHICLE_DEFAULT, 'intCD': cd, 'label': label, 'nation': nation, 'hasCompensation': getCompensateItemsCount(rawItem, itemsCache) > 0, 'level': RES_ICONS.getLevelIcon(vehicle.level), 'tankType': Vehicle.getTypeSmallIconPath(vehicle.type, vehicle.isElite) }