Exemple #1
0
 def _validate(self):
     if g_currentPreviewVehicle.isPresent():
         return ValidationResult(
             False, PREBATTLE_RESTRICTION.PREVIEW_VEHICLE_IS_PRESENT)
     if not g_currentVehicle.isReadyToFight():
         if not g_currentVehicle.isPresent():
             return ValidationResult(
                 False, PREBATTLE_RESTRICTION.VEHICLE_NOT_PRESENT)
         if g_currentVehicle.isInBattle():
             return ValidationResult(
                 False, PREBATTLE_RESTRICTION.VEHICLE_IN_BATTLE)
         if not g_currentVehicle.isCrewFull():
             return ValidationResult(False,
                                     PREBATTLE_RESTRICTION.CREW_NOT_FULL)
         if g_currentVehicle.isBroken():
             return ValidationResult(False,
                                     PREBATTLE_RESTRICTION.VEHICLE_BROKEN)
         if g_currentVehicle.isDisabledInRoaming():
             return ValidationResult(False,
                                     PREBATTLE_RESTRICTION.VEHICLE_ROAMING)
         if g_currentVehicle.isDisabledInPremIGR():
             return ValidationResult(
                 False, PREBATTLE_RESTRICTION.VEHICLE_IN_PREMIUM_IGR_ONLY)
         if g_currentVehicle.isDisabledInRent():
             if g_currentVehicle.isPremiumIGR():
                 return ValidationResult(
                     False,
                     PREBATTLE_RESTRICTION.VEHICLE_IGR_RENTALS_IS_OVER)
             return ValidationResult(
                 False, PREBATTLE_RESTRICTION.VEHICLE_RENTALS_IS_OVER)
         if g_currentVehicle.isRotationGroupLocked():
             return ValidationResult(
                 False, PREBATTLE_RESTRICTION.VEHICLE_ROTATION_GROUP_LOCKED)
     return super(CurrentVehicleActionsValidator, self)._validate()
Exemple #2
0
 def canPlayerDoAction(self):
     canDo, restriction = True, ''
     if not self.__queueFunctional.canPlayerDoAction():
         canDo = False
     else:
         if not g_currentVehicle.isReadyToFight():
             if not g_currentVehicle.isPresent():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_NOT_PRESENT
             elif g_currentVehicle.isInBattle():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_IN_BATTLE
             elif not g_currentVehicle.isCrewFull():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.CREW_NOT_FULL
             elif g_currentVehicle.isBroken():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_BROKEN
             elif g_currentVehicle.isDisabledInRoaming():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_ROAMING
         if canDo:
             canDo, restriction = self.__unitFunctional.canPlayerDoAction()
         if canDo:
             canDo, restriction = self.__prbFunctional.canPlayerDoAction()
     return (canDo, restriction)
Exemple #3
0
def _PrebattleDispatcher_canPlayerDoAction(base, self, *args, **kwargs):
    try:
        if not g_currentVehicle.isReadyToFight() and g_currentVehicle.item and not g_currentVehicle.item.isAmmoFull and config.get('hangar/blockVehicleIfLowAmmo'):
            return (False, PREBATTLE_RESTRICTION.VEHICLE_NOT_READY)
    except Exception as ex:
        err(traceback.format_exc())
    return base(self, *args, **kwargs)
Exemple #4
0
 def canPlayerDoAction(self):
     canDo, restriction = self.__collection.canPlayerDoAction(False)
     if canDo:
         if not g_currentVehicle.isReadyToFight():
             if not g_currentVehicle.isPresent():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_NOT_PRESENT
             elif g_currentVehicle.isInBattle():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_IN_BATTLE
             elif not g_currentVehicle.isCrewFull():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.CREW_NOT_FULL
             elif g_currentVehicle.isBroken():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_BROKEN
             elif g_currentVehicle.isDisabledInRoaming():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_ROAMING
             elif g_currentVehicle.isDisabledInPremIGR():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_IN_PREMIUM_IGR_ONLY
             elif g_currentVehicle.isDisabledInRent():
                 canDo = False
                 if g_currentVehicle.isPremiumIGR():
                     restriction = PREBATTLE_RESTRICTION.VEHICLE_IGR_RENTALS_IS_OVER
                 else:
                     restriction = PREBATTLE_RESTRICTION.VEHICLE_RENTALS_IS_OVER
         if canDo:
             canDo, restriction = self.__collection.canPlayerDoAction(True)
     return (canDo, restriction)
Exemple #5
0
 def canPlayerDoAction(self):
     canDo, restriction = True, ''
     if not self.__queueFunctional.canPlayerDoAction():
         canDo = False
     else:
         if not g_currentVehicle.isReadyToFight():
             if not g_currentVehicle.isPresent():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_NOT_PRESENT
             elif g_currentVehicle.isInBattle():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_IN_BATTLE
             elif not g_currentVehicle.isCrewFull():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.CREW_NOT_FULL
             elif g_currentVehicle.isBroken():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_BROKEN
             elif g_currentVehicle.isDisabledInRoaming():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_ROAMING
         if canDo:
             canDo, restriction = self.__unitFunctional.canPlayerDoAction()
         if canDo:
             canDo, restriction = self.__prbFunctional.canPlayerDoAction()
     return (canDo, restriction)
 def __cv_onChanged(self, *args):
     if self.__steps:
         return
     if not g_currentVehicle.isReadyToFight() and not g_currentVehicle.isReadyToPrebattle():
         if g_currentVehicle.isCrewFull() and not g_currentVehicle.isBroken():
             self.closeWindow()
     else:
         self.as_setActionsLockedS(g_currentVehicle.isLocked() or g_currentVehicle.isBroken() or g_currentVehicle.isDisabledInRent())
Exemple #7
0
 def __cv_onChanged(self):
     if not g_currentVehicle.isReadyToFight():
         if g_currentVehicle.isCrewFull(
         ) and not g_currentVehicle.isBroken():
             self.closeWindow()
     else:
         self.as_setActionsLockedS(g_currentVehicle.isLocked()
                                   or g_currentVehicle.isBroken())
def _VehicleIsValid_check(base, self, *args, **kwargs):
    res = base(self, *args, **kwargs)
    if res[0] == True:
        try:
            if not g_currentVehicle.isReadyToFight() and g_currentVehicle.item and not g_currentVehicle.item.isAmmoFull and config.get('hangar/blockVehicleIfLowAmmo'):
                res = (False, PREBATTLE_RESTRICTION.VEHICLE_NOT_READY)
        except Exception as ex:
            err(traceback.format_exc())
    return res
Exemple #9
0
    def check(self, teamLimits):
        if not g_currentVehicle.isReadyToFight():
            return (False, PREBATTLE_RESTRICTION.VEHICLE_NOT_READY)
        vehicle = g_currentVehicle.item
        shellsList = []
        for shell in vehicle.shells:
            shellsList.extend([shell.intCD, shell.count])

        return isVehicleValid(vehicle.descriptor, shellsList, teamLimits)
Exemple #10
0
def _CurrentVehicleActionsValidator_validate(base, self):
    res = base(self)
    if not res or res[0] == True:
        try:
            if not g_currentVehicle.isReadyToFight() and g_currentVehicle.item and not g_currentVehicle.item.isAmmoFull and config.get('hangar/blockVehicleIfLowAmmo'):
                res = ValidationResult(False, PREBATTLE_RESTRICTION.VEHICLE_NOT_READY)
        except Exception as ex:
            err(traceback.format_exc())
    return res
Exemple #11
0
    def check(self, teamLimits):
        if not g_currentVehicle.isReadyToFight():
            return (False, PREBATTLE_RESTRICTION.VEHICLE_NOT_READY)
        vehicle = g_currentVehicle.item
        shellsList = []
        for shell in vehicle.shells:
            shellsList.extend([shell.intCD, shell.count])

        return isVehicleValid(vehicle.descriptor, shellsList, teamLimits)
Exemple #12
0
def checkAmmoLevel(callback):
    """
    Check ammo for current vehicle, if it is lower then 20% shows message dialog
    Example:
            isAmmoOk = yield checkAmmoLevel()
            if isAmmoOk:
                    do something...
    
    @return: True if ammo level is ok or user confirm, False otherwise
    """
    showAmmoWarning = False
    from CurrentVehicle import g_currentVehicle
    if g_currentVehicle.isReadyToFight():
        vehicle = g_currentVehicle.item
        if not g_currentVehicle.isAutoLoadFull(
        ) or not g_currentVehicle.isAutoEquipFull():
            from gui import SystemMessages
            from gui.shared.gui_items.processors.vehicle import VehicleLayoutProcessor
            shellsLayout = []
            eqsLayout = []
            for shell in vehicle.shells:
                shellsLayout.append(shell.intCD if not shell.isBoughtForCredits
                                    else -shell.intCD)
                shellsLayout.append(shell.defaultCount)

            for eq in vehicle.eqsLayout:
                if eq is not None:
                    eqsLayout.append(
                        eq.intCD if not eq.isBoughtForCredits else -eq.intCD)
                    eqsLayout.append(1)
                else:
                    eqsLayout.append(0)
                    eqsLayout.append(0)

            LOG_DEBUG('setVehicleLayouts', shellsLayout, eqsLayout)
            result = yield VehicleLayoutProcessor(vehicle, shellsLayout,
                                                  eqsLayout).request()
            if result and result.auxData:
                for m in result.auxData:
                    SystemMessages.g_instance.pushI18nMessage(
                        m.userMsg, type=m.sysMsgType)

            if result and len(result.userMsg):
                SystemMessages.g_instance.pushI18nMessage(
                    result.userMsg, type=result.sysMsgType)
        showAmmoWarning = not g_currentVehicle.item.isAmmoFull
    if showAmmoWarning:
        from gui import DialogsInterface
        success = yield DialogsInterface.showI18nConfirmDialog('lowAmmo')
        callback(success)
    else:
        yield lambda callback: callback(None)
        callback(True)
    return
Exemple #13
0
    def check(self, teamLimits):
        if g_currentVehicle.isFalloutOnly() and not getFalloutCtrl().isSelected():
            return (False, PREBATTLE_RESTRICTION.VEHICLE_FALLOUT_ONLY)
        if not g_currentVehicle.isReadyToFight():
            return (False, PREBATTLE_RESTRICTION.VEHICLE_NOT_READY)
        vehicle = g_currentVehicle.item
        shellsList = []
        for shell in vehicle.shells:
            shellsList.extend([shell.intCD, shell.count])

        return isVehicleValid(vehicle.descriptor, shellsList, teamLimits)
Exemple #14
0
 def __updateState(self):
     isVehicleDisabled = False
     if self.prbDispatcher is not None:
         permission = self.prbDispatcher.getGUIPermissions()
         if permission is not None:
             isVehicleDisabled = not permission.canChangeVehicle()
     isInHangar = g_currentVehicle.isInHangar() and not g_currentVehicle.item.isInUnit
     msg, msgLvl = g_currentVehicle.getHangarMessage()
     isPresent = g_currentVehicle.isPresent()
     self.as_readyToFightS(g_currentVehicle.isReadyToFight(), msg, msgLvl, isPresent, isVehicleDisabled, g_currentVehicle.isCrewFull(), isInHangar, g_currentVehicle.isBroken() if isPresent else False, g_currentVehicle.isDisabledInRoaming())
     return
Exemple #15
0
def _CurrentVehicleActionsValidator_validate(base, self):
    res = base(self)
    if not res or res[0] == True:
        try:
            if not g_currentVehicle.isReadyToFight(
            ) and g_currentVehicle.item and not g_currentVehicle.item.isAmmoFull and config.get(
                    'hangar/blockVehicleIfLowAmmo'):
                res = ValidationResult(False,
                                       PREBATTLE_RESTRICTION.VEHICLE_NOT_READY)
        except Exception as ex:
            err(traceback.format_exc())
    return res
Exemple #16
0
 def __cv_onChanged(self, *args):
     if self.__steps:
         return
     if not g_currentVehicle.isReadyToFight(
     ) and not g_currentVehicle.isReadyToPrebattle():
         if g_currentVehicle.isCrewFull(
         ) and not g_currentVehicle.isBroken():
             self.closeWindow()
     else:
         self.as_setActionsLockedS(g_currentVehicle.isLocked()
                                   or g_currentVehicle.isBroken()
                                   or g_currentVehicle.isDisabledInRent())
Exemple #17
0
    def check(self, teamLimits):
        if not g_currentVehicle.isPresent():
            return (False, PREBATTLE_RESTRICTION.VEHICLE_NOT_PRESENT)
        if g_currentVehicle.isEvent():
            return (False, PREBATTLE_RESTRICTION.VEHICLE_NOT_SUPPORTED)
        if g_currentVehicle.isFalloutOnly() and not getFalloutCtrl().isSelected():
            return (False, PREBATTLE_RESTRICTION.VEHICLE_FALLOUT_ONLY)
        if not g_currentVehicle.isReadyToFight():
            return (False, PREBATTLE_RESTRICTION.VEHICLE_NOT_READY)
        vehicle = g_currentVehicle.item
        shellsList = []
        for shell in vehicle.shells:
            shellsList.extend([shell.intCD, shell.count])

        return isVehicleValid(vehicle.descriptor, shellsList, teamLimits)
Exemple #18
0
def checkAmmoLevel(callback):
    """
    Check ammo for current vehicle, if it is lower then 20% shows message dialog
    Example:
            isAmmoOk = yield checkAmmoLevel()
            if isAmmoOk:
                    do something...
    
    @return: True if ammo level is ok or user confirm, False otherwise
    """
    showAmmoWarning = False
    from CurrentVehicle import g_currentVehicle
    if g_currentVehicle.isReadyToFight():
        vehicle = g_currentVehicle.item
        if not g_currentVehicle.isAutoLoadFull() or not g_currentVehicle.isAutoEquipFull():
            from gui import SystemMessages
            from gui.shared.gui_items.processors.vehicle import VehicleLayoutProcessor
            shellsLayout = []
            eqsLayout = []
            for shell in vehicle.shells:
                shellsLayout.append(shell.intCD if not shell.isBoughtForCredits else -shell.intCD)
                shellsLayout.append(shell.defaultCount)

            for eq in vehicle.eqsLayout:
                if eq is not None:
                    eqsLayout.append(eq.intCD if not eq.isBoughtForCredits else -eq.intCD)
                    eqsLayout.append(1)
                else:
                    eqsLayout.append(0)
                    eqsLayout.append(0)

            LOG_DEBUG('setVehicleLayouts', shellsLayout, eqsLayout)
            result = yield VehicleLayoutProcessor(vehicle, shellsLayout, eqsLayout).request()
            if result and result.auxData:
                for m in result.auxData:
                    SystemMessages.g_instance.pushI18nMessage(m.userMsg, type=m.sysMsgType)

            if result and len(result.userMsg):
                SystemMessages.g_instance.pushI18nMessage(result.userMsg, type=result.sysMsgType)
        showAmmoWarning = not g_currentVehicle.item.isAmmoFull
    if showAmmoWarning:
        from gui import DialogsInterface
        success = yield DialogsInterface.showI18nConfirmDialog('lowAmmo')
        callback(success)
    else:
        yield lambda callback: callback(None)
        callback(True)
    return
Exemple #19
0
 def canPlayerDoAction(self):
     canDo, restriction = self.__collection.canPlayerDoAction(False)
     falloutCtrl = getFalloutCtrl()
     if canDo:
         if falloutCtrl.isEnabled():
             if falloutCtrl.getBattleType(
             ) == FALLOUT_BATTLE_TYPE.UNDEFINED:
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.FALLOUT_NOT_SELECTED
             elif not g_currentVehicle.isGroupReady():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_GROUP_IS_NOT_READY
         elif not g_currentVehicle.isReadyToFight():
             if not g_currentVehicle.isPresent():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_NOT_PRESENT
             elif g_currentVehicle.isInBattle():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_IN_BATTLE
             elif not g_currentVehicle.isCrewFull():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.CREW_NOT_FULL
             elif g_currentVehicle.isBroken():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_BROKEN
             elif g_currentVehicle.isFalloutOnly():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_FALLOUT_ONLY
             elif g_currentVehicle.isDisabledInRoaming():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_ROAMING
             elif g_currentVehicle.isDisabledInPremIGR():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_IN_PREMIUM_IGR_ONLY
             elif g_currentVehicle.isDisabledInRent():
                 unit = self.getUnitFunctional()
                 if unit is not None and unit.getFlags().isInPreArena():
                     canDo = True
                 else:
                     canDo = False
                     if g_currentVehicle.isPremiumIGR():
                         restriction = PREBATTLE_RESTRICTION.VEHICLE_IGR_RENTALS_IS_OVER
                     else:
                         restriction = PREBATTLE_RESTRICTION.VEHICLE_RENTALS_IS_OVER
         if canDo:
             canDo, restriction = self.__collection.canPlayerDoAction(True)
     return (canDo, restriction)
Exemple #20
0
 def canPlayerDoAction(self):
     canDo, restriction = self.__collection.canPlayerDoAction(False)
     falloutCtrl = getFalloutCtrl()
     if canDo:
         if falloutCtrl.isEnabled():
             if falloutCtrl.getBattleType() == FALLOUT_BATTLE_TYPE.UNDEFINED:
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.FALLOUT_NOT_SELECTED
             elif not g_currentVehicle.isGroupReady():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_GROUP_IS_NOT_READY
         elif not g_currentVehicle.isReadyToFight():
             if not g_currentVehicle.isPresent():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_NOT_PRESENT
             elif g_currentVehicle.isInBattle():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_IN_BATTLE
             elif not g_currentVehicle.isCrewFull():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.CREW_NOT_FULL
             elif g_currentVehicle.isBroken():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_BROKEN
             elif g_currentVehicle.isFalloutOnly():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_FALLOUT_ONLY
             elif g_currentVehicle.isDisabledInRoaming():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_ROAMING
             elif g_currentVehicle.isDisabledInPremIGR():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_IN_PREMIUM_IGR_ONLY
             elif g_currentVehicle.isDisabledInRent():
                 unit = self.getUnitFunctional()
                 if unit is not None and unit.getFlags().isInPreArena():
                     canDo = True
                 else:
                     canDo = False
                     if g_currentVehicle.isPremiumIGR():
                         restriction = PREBATTLE_RESTRICTION.VEHICLE_IGR_RENTALS_IS_OVER
                     else:
                         restriction = PREBATTLE_RESTRICTION.VEHICLE_RENTALS_IS_OVER
         if canDo:
             canDo, restriction = self.__collection.canPlayerDoAction(True)
     return (canDo, restriction)
Exemple #21
0
def _CurrentVehicleActionsValidator_validate(base, self):
    res = base(self)
    if isInBootcamp():
        return res
    elif g_currentVehicle.isOnlyForEventBattles():
        return res
    elif g_currentVehicle.isOnlyForBattleRoyaleBattles():
        return res
    if not res or res[0] == True:
        try:
            if not g_currentVehicle.isReadyToFight(
            ) and g_currentVehicle.item and not g_currentVehicle.item.isAmmoFull and cfg_hangar_blockVehicleIfLowAmmo:
                res = ValidationResult(False,
                                       PREBATTLE_RESTRICTION.VEHICLE_NOT_READY)
        except Exception as ex:
            err(traceback.format_exc())
    return res
 def canPlayerDoAction(self):
     canDo, restriction = self.__collection.canPlayerDoAction(False)
     if canDo:
         if g_currentPreviewVehicle.isPresent():
             canDo = False
             restriction = PREBATTLE_RESTRICTION.PREVIEW_VEHICLE_IS_PRESENT
         elif not g_currentVehicle.isReadyToFight():
             if not g_currentVehicle.isPresent():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_NOT_PRESENT
             elif g_currentVehicle.isInBattle():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_IN_BATTLE
             elif not g_currentVehicle.isCrewFull():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.CREW_NOT_FULL
             elif g_currentVehicle.isBroken():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_BROKEN
             elif g_currentVehicle.isFalloutOnly(
             ) and not game_control.getFalloutCtrl().isSelected():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_FALLOUT_ONLY
             elif g_currentVehicle.isDisabledInRoaming():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_ROAMING
             elif g_currentVehicle.isDisabledInPremIGR():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_IN_PREMIUM_IGR_ONLY
             elif g_currentVehicle.isDisabledInRent():
                 unit = self.getUnitFunctional()
                 if unit is not None and unit.getFlags().isInPreArena():
                     canDo = True
                 else:
                     canDo = False
                     if g_currentVehicle.isPremiumIGR():
                         restriction = PREBATTLE_RESTRICTION.VEHICLE_IGR_RENTALS_IS_OVER
                     else:
                         restriction = PREBATTLE_RESTRICTION.VEHICLE_RENTALS_IS_OVER
         if canDo:
             canDo, restriction = self.__collection.canPlayerDoAction(True)
     return (canDo, restriction)
 def canPlayerDoAction(self):
     canDo, restriction = self.__collection.canPlayerDoAction(False)
     if canDo:
         if g_currentPreviewVehicle.isPresent():
             canDo = False
             restriction = PREBATTLE_RESTRICTION.PREVIEW_VEHICLE_IS_PRESENT
         elif not g_currentVehicle.isReadyToFight():
             if not g_currentVehicle.isPresent():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_NOT_PRESENT
             elif g_currentVehicle.isInBattle():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_IN_BATTLE
             elif not g_currentVehicle.isCrewFull():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.CREW_NOT_FULL
             elif g_currentVehicle.isBroken():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_BROKEN
             elif g_currentVehicle.isFalloutOnly() and not game_control.getFalloutCtrl().isSelected():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_FALLOUT_ONLY
             elif g_currentVehicle.isDisabledInRoaming():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_ROAMING
             elif g_currentVehicle.isDisabledInPremIGR():
                 canDo = False
                 restriction = PREBATTLE_RESTRICTION.VEHICLE_IN_PREMIUM_IGR_ONLY
             elif g_currentVehicle.isDisabledInRent():
                 unit = self.getUnitFunctional()
                 if unit is not None and unit.getFlags().isInPreArena():
                     canDo = True
                 else:
                     canDo = False
                     if g_currentVehicle.isPremiumIGR():
                         restriction = PREBATTLE_RESTRICTION.VEHICLE_IGR_RENTALS_IS_OVER
                     else:
                         restriction = PREBATTLE_RESTRICTION.VEHICLE_RENTALS_IS_OVER
         if canDo:
             canDo, restriction = self.__collection.canPlayerDoAction(True)
     return (canDo, restriction)
Exemple #24
0
 def __updateState(self):
     isVehicleDisabled = False
     if self.prbDispatcher is not None:
         permission = self.prbDispatcher.getGUIPermissions()
         if permission is not None:
             isVehicleDisabled = not permission.canChangeVehicle()
     isInHangar = g_currentVehicle.isInHangar() and not g_currentVehicle.item.isInUnit
     msg, msgLvl = g_currentVehicle.getHangarMessage()
     isPresent = g_currentVehicle.isPresent()
     self.as_readyToFightS(
         g_currentVehicle.isReadyToFight(),
         msg,
         msgLvl,
         isPresent,
         isVehicleDisabled,
         g_currentVehicle.isCrewFull(),
         isInHangar,
         g_currentVehicle.isBroken() if isPresent else False,
         g_currentVehicle.isDisabledInRoaming(),
     )
     return
 def __cv_onChanged(self):
     if not g_currentVehicle.isReadyToFight():
         if g_currentVehicle.isCrewFull() and not g_currentVehicle.isBroken():
             self.closeWindow()
     else:
         self.as_setActionsLockedS(g_currentVehicle.isLocked() or g_currentVehicle.isBroken())