Ejemplo n.º 1
0
 def __convertCompensationTooltip(cls, bonusComp, vehicle, tooltipData):
     specialArgs = {
         'labelBefore':
         '',
         'iconAfter':
         backport.image(R.images.gui.maps.icons.quests.bonuses.big.gold()),
         'labelAfter':
         bonusComp.getIconLabel(),
         'bonusName':
         bonusComp.getName()
     }
     uiData = _getVehicleUIData(vehicle)
     formattedTypeName = uiData['vehicleType']
     isElite = vehicle.isElite
     uiData['vehicleType'] = '{}_elite'.format(
         formattedTypeName) if isElite else formattedTypeName
     specialArgs.update(uiData)
     vehicleName = getNationLessName(vehicle.name)
     vehIcon = R.images.gui.maps.shop.vehicles.c_180x135.dyn(vehicleName)()
     if vehIcon < 1:
         vehicleName = vehicleName.replace('-', '_')
         vehIcon = R.images.gui.maps.shop.vehicles.c_180x135.dyn(
             vehicleName)()
     specialArgs['iconBefore'] = backport.image(
         vehIcon) if vehIcon > 0 else ''
     return createTooltipData(tooltip=tooltipData.tooltip,
                              specialAlias=VEH_COMP_R_ID,
                              specialArgs=specialArgs)
Ejemplo n.º 2
0
 def __convertCompensationTooltip(cls, bonusComp, vehicle, tooltipData):
     specialArgs = {
         'iconBefore':
         backport.image(
             R.images.gui.maps.shop.vehicles.c_180x135.dyn(
                 getIconResourceName(getNationLessName(vehicle.name)))()),
         'labelBefore':
         '',
         'iconAfter':
         backport.image(R.images.gui.maps.icons.quests.bonuses.big.gold()),
         'labelAfter':
         bonusComp.getIconLabel(),
         'bonusName':
         bonusComp.getName(),
         'vehicleName':
         vehicle.shortUserName,
         'vehicleType':
         formatEliteVehicle(vehicle.isElite, vehicle.type),
         'isElite':
         vehicle.isElite,
         'vehicleLvl':
         int2roman(vehicle.level)
     }
     return createTooltipData(tooltip=tooltipData.tooltip,
                              specialAlias=VEH_COMP_R_ID,
                              specialArgs=specialArgs)
Ejemplo n.º 3
0
    def __updateTankSlot(self, tankSlotVM, vehicle):
        tankSlotVM.setTankImage(
            R.images.gui.maps.shop.vehicles.c_600x450.dyn(
                getIconResourceName(getNationLessName(vehicle.name)))())
        tankSlotVM.setTankNation(getIconResourceName(vehicle.nationName))
        tankSlotVM.setVehicleIntCD(vehicle.intCD)
        self.__setCrewViewModelData(tankSlotVM, vehicle)
        tankSetups = tankSlotVM.getSetups()
        if not vehicle.postProgressionAvailability().result:
            setupsIndexes = [(vehicle.battleBoosters.setupLayouts.layoutIndex,
                              vehicle.consumables.setupLayouts.layoutIndex,
                              vehicle.optDevices.setupLayouts.layoutIndex,
                              vehicle.shells.setupLayouts.layoutIndex)]
        else:
            setupsIndexes = [[layoutID] * self.__LAYOUTS_IN_SETUP
                             for layoutID in range(SWITCH_LAYOUT_CAPACITY)]
        numSetups = 0
        for setupIndexes in setupsIndexes:
            setupModel = NationChangeTankSetupModel()
            hasEquipment = self.__setSetupData(setupModel, vehicle,
                                               setupIndexes)
            if hasEquipment:
                tankSetups.addViewModel(setupModel)
                numSetups += 1

        tankSetups.invalidate()
        tankSlotVM.setNoEquipment(numSetups == 0)
        return numSetups
Ejemplo n.º 4
0
 def __getVehImgResource(vehicleName):
     resourceName = getIconResourceName(getNationLessName(vehicleName))
     if resourceName in R.images.gui.maps.icons.seniorityAwards.vehicles.c_390x245.keys(
     ):
         return R.images.gui.maps.icons.seniorityAwards.vehicles.c_390x245.dyn(
             resourceName)
     else:
         _logger.error("Image %s doesn't exist", resourceName)
         return None
Ejemplo n.º 5
0
def getBaseButtonsVO(vehicle):
    iconName = getIconResourceName(getNationLessName(vehicle.name))
    return {
        'shopIconPath':
        backport.image(
            R.images.gui.maps.shop.vehicles.c_360x270.dyn(iconName)()),
        'compareBtnVisible':
        True,
        'goToVehicleViewBtnVisible':
        True,
        'isPremium':
        vehicle.isPremium or vehicle.buyPrices.itemPrice.isActionPrice(),
        'vehicleId':
        vehicle.intCD
    }
Ejemplo n.º 6
0
 def _packVehicleBonusModel(cls, bonus, vInfo, isRent, vehicle):
     model = RewardModel()
     gpRentType, rentValue = bonus.getRentInfo(vInfo)
     model.setVehicleRentType(_convertRentType(gpRentType))
     model.setVehicleRentValue(rentValue)
     model.setName(cls._createUIName(bonus, isRent))
     model.setIsCompensation(bonus.isCompensation())
     model.setLabel(vehicle.userName)
     vehIconName = getIconResourceName(getNationLessName(vehicle.name))
     model.setItemID(vehicle.intCD)
     model.setUserName(vehicle.userName)
     model.setIcon(vehIconName)
     model.setVehicleLevel(vehicle.level)
     model.setVehicleType(vehicle.type)
     wasInHangarBeforeRent = gpRentType != RentType.NO_RENT and not vehicle.isRented
     model.setIsFromStorage(wasInHangarBeforeRent)
     return model
Ejemplo n.º 7
0
 def __fillSlotByVehicle(self, slotVm, vehicle):
     nation = vehicle.name.split(':')[0]
     slotVm.setVehicleIcon(
         R.images.gui.maps.shop.vehicles.c_360x270.dyn(
             replaceHyphenToUnderscore(getNationLessName(vehicle.name)))())
     slotVm.setVehicleName(vehicle.shortUserName)
     slotVm.setNationIcon(
         R.images.gui.maps.icons.flags.c_362x362.dyn(nation)())
     slotVm.setVehicleLevel(int2roman(vehicle.level))
     slotVm.setVehicleType(vehicle.type)
     slotVm.setVehicleTypeIcon(
         R.images.gui.maps.icons.vehicleTypes.white.dyn(
             replaceHyphenToUnderscore(vehicle.type))())
     nySlot = self.__nyController.getVehicleBranch().getSlotForVehicle(
         vehicle.invID)
     if nySlot is not None:
         bonusType, value = nySlot.getSlotBonus()
         slotVm.bonus.setBonusType(bonusType)
         slotVm.bonus.setBonusValue(value * PERCENT)
     return
 def __getVehImgResource(vehicleName):
     return getIconResourceName(getNationLessName(vehicleName))
Ejemplo n.º 9
0
 def _getVehicleIcon(self, item):
     return getNationLessName(item.name)
Ejemplo n.º 10
0
 def __updateTankSlot(self, tankSlotVM, vehicle):
     tankSlotVM.setTankImage(R.images.gui.maps.shop.vehicles.c_600x450.dyn(getIconResourceName(getNationLessName(vehicle.name)))())
     tankSlotVM.setTankNation(getIconResourceName(vehicle.nationName))
     tankSlotVM.setVehicleIntCD(vehicle.intCD)
     self.__setCrewViewModelData(tankSlotVM, vehicle)
     self.__setEquipmentViewModelData(tankSlotVM.getSupplyList(), vehicle)
     self.__setDevicesViewModelData(tankSlotVM.getEquipmentList(), vehicle)
     self.__setShellsViewModelData(tankSlotVM.getShellList(), vehicle)
     self.__setInstructionViewModelData(tankSlotVM.instructionSlot, vehicle)
     self.__setInventoryViewStatus(tankSlotVM, vehicle)