Beispiel #1
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)
Beispiel #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)
 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())
Beispiel #4
0
def onXfwCommand(cmd, *args):
    try:
        if cmd == COMMANDS.PUT_PREVIOUS_CREW:
            if g_currentVehicle.isInHangar() and not (g_currentVehicle.isCrewFull() or g_currentVehicle.isInBattle() or g_currentVehicle.isLocked()):
                PutPreviousCrew(g_currentVehicle, False)
            return (None, True)
    except Exception, ex:
        err(traceback.format_exc())
        return (None, True)
Beispiel #5
0
 def __checkCurrent(self):
     isOn = False
     isLocked = False
     isCrewFull = False
     if g_currentVehicle.isPresent():
         isOn = self.isOn()
         isLocked = g_currentVehicle.isLocked()
         isCrewFull = g_currentVehicle.isCrewFull()
     self._setFlagValue(self.__isLockedFlagID, isLocked)
     self._setFlagValue(self.__isCrewFullFlagID, isCrewFull)
     self.toggle(isOn=isOn)
Beispiel #6
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)
 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)
Beispiel #8
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())
Beispiel #10
0
 def processReturnCrew(self, print_message = True):
     if not g_currentVehicle.isInHangar() or g_currentVehicle.isInBattle() or g_currentVehicle.isLocked() or g_currentVehicle.isCrewFull():
         return
     result = yield TankmanReturn(g_currentVehicle.item).request()
     if len(result.userMsg) and print_message:
         SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType)
Beispiel #11
0
 def isOn(self):
     return g_currentVehicle.isCrewFull()