Exemplo n.º 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)
Exemplo n.º 2
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()
Exemplo n.º 3
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)
Exemplo n.º 4
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)
Exemplo n.º 5
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)
def _getTankmanLockMessage(invVehicle):
    if invVehicle.isInBattle:
        return (True, i18n.makeString('#menu:tankmen/lockReason/inbattle'))
    if invVehicle.invID == g_currentVehicle.invID and (
            g_currentVehicle.isInPrebattle() or g_currentVehicle.isInBattle()):
        return (True, i18n.makeString('#menu:tankmen/lockReason/prebattle'))
    return (True, i18n.makeString('#menu:tankmen/lockReason/disabled')
            ) if invVehicle.isDisabled else (False, '')
Exemplo n.º 7
0
 def _generateOptions(self, ctx=None):
     return [
         self._makeItem(CREW.PERSONAL_CASE,
                        MENU.contextmenu('personalCase')),
         self._makeSeparator(),
         self._makeItem(CREW.UNLOAD, MENU.contextmenu('tankmanUnload'),
                        {'enabled': not g_currentVehicle.isInBattle()})
     ]
Exemplo n.º 8
0
def _getTankmanLockMessage(invVehicle):
    if invVehicle.lock == LOCK_REASON.ON_ARENA:
        return (True, i18n.makeString('#menu:tankmen/lockReason/inbattle'))
    if invVehicle.repairCost > 0:
        return (True, i18n.makeString('#menu:tankmen/lockReason/broken'))
    if invVehicle.invID == g_currentVehicle.invID and g_currentVehicle.isInPrebattle(
    ) or g_currentVehicle.isInBattle():
        return (True, i18n.makeString('#menu:tankmen/lockReason/prebattle'))
    return (False, '')
Exemplo n.º 9
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)
Exemplo n.º 10
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)
Exemplo n.º 11
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)
Exemplo n.º 12
0
 def registerSettings(self):
     super(self.__class__, self).registerSettings()
     if hasattr(BigWorld, 'g_modsListApi'):
         kwargs = dict(id='CamoSelectorUI',
                       name=self.i18n['UI_flash_header'],
                       description=self.i18n['UI_flash_header_tooltip'],
                       icon='gui/flash/CamoSelector.png',
                       enabled=self.data['enabled'],
                       login=False,
                       lobby=True,
                       callback=lambda: None if g_currentVehicle.isInBattle(
                       ) or g_currentPreviewVehicle.isPresent() else
                       (self.onMSAPopulate(), g_appLoader.getDefLobbyApp().
                        loadView(ViewLoadParams('CamoSelectorMainView'))))
         try:
             BigWorld.g_modsListApi.addModification(**kwargs)
         except AttributeError:
             BigWorld.g_modsListApi.addMod(**kwargs)
         self.isModAdded = True
Exemplo n.º 13
0
 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)
Exemplo n.º 14
0
 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)
Exemplo n.º 15
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)
Exemplo n.º 16
0
def _getTankmanLockMessage(invVehicle):
    if invVehicle.lock == LOCK_REASON.ON_ARENA:
        return (True, i18n.makeString('#menu:tankmen/lockReason/inbattle'))
    elif invVehicle.repairCost > 0:
        return (True, i18n.makeString('#menu:tankmen/lockReason/broken'))
    elif invVehicle.invID == g_currentVehicle.invID and (g_currentVehicle.isInPrebattle() or g_currentVehicle.isInBattle()):
        return (True, i18n.makeString('#menu:tankmen/lockReason/prebattle'))
    else:
        return (False, '')
Exemplo n.º 17
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)