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
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
def _buildVehicle(self, vehicle): vehicleVO = super(_MissionsCarouselDataProvider, self)._buildVehicle(vehicle) vehicleVO.update(isUseRightBtn=False) xpFactor = self._itemsCache.items.shop.dailyXPFactor if vehicle.isInInventory and vehicle.activeInNationGroup: for condition in self.__extraConditions: isOk, reason = condition.isAvailableReason(vehicle) if not isOk: smallStatus, largeStatus = getStatusStrings(reason, ctx={'factor': xpFactor}) vehicleVO.update(smallInfoText=smallStatus, infoText=largeStatus, lockBackground=True, clickEnabled=False, infoImgSrc='', isCritInfo=False) break else: self.__suitableVehiclesIDs.append(vehicle.intCD) return vehicleVO
def _buildVehicleBranch(self): self._verifySlotNotifier() self._startSlotNotifier() self._vehicleBranch = [] freeSlotsCount = len( self._nyController.getVehicleBranch().getFreeVehicleSlots()) tankTreeAvailable = self._nyController.getVehicleBranch( ).hasAvailableSlots() smallNyTankString, nyTankString = getStatusStrings( 'nyTank', style=text_styles.nyVehicleSmallTitle, styleLarge=text_styles.nyVehicleTitle) if freeSlotsCount == 0 and tankTreeAvailable: smallNyStatusSlotsString, nyStatusSlotsString = getStatusStrings( 'nyTankSlotsFull', style=text_styles.nyVehicleSmallMain, styleLarge=text_styles.nyVehicleMain) else: smallNyStatusSlotsString, nyStatusSlotsString = getStatusStrings( 'nyTankEmptyCount', style=text_styles.nyVehicleSmallMain, styleLarge=text_styles.nyVehicleMain, ctx={'count': freeSlotsCount}) infoText = text_styles.concatStylesToMultiLine(nyTankString, nyStatusSlotsString) self._vehicleBranch.append({ 'nySlot': True, 'smallInfoText': text_styles.concatStylesToMultiLine(smallNyTankString, smallNyStatusSlotsString), 'infoText': infoText, 'infoHoverText': infoText, 'icon': backport.image( R.images.gui.maps.icons.newYear.tank_slots.carousel.ny_slot()), 'iconSmall': backport.image(R.images.gui.maps.icons.newYear.tank_slots.carousel. ny_slot_small()), 'tooltip': makeTooltip( header=backport.text( R.strings.tooltips.tankCarusel.newYearSlot.header()), body=backport.text( R.strings.tooltips.tankCarusel.newYearSlot.body())), 'nyBlinkEnabled': freeSlotsCount > 0, 'showBubble': hasNewVehicleLevel(), 'iconHover': backport.image(R.images.gui.maps.icons.newYear.tank_slots.carousel. ny_slot_hover()), 'iconHoverSmall': backport.image(R.images.gui.maps.icons.newYear.tank_slots.carousel. ny_slot_small_hover()), 'additionalImgSrc': '', 'clickEnabled': True })