/// <summary>
        ///
        /// </summary>
        /// <param name="result"></param>
        private void Finish(GameActionTypeEnum result)
        {
            var message = WorldMessage.GAME_ACTION(result, Attacker.Id, Defender.Id.ToString());

            Attacker.Dispatch(message);
            Defender.Dispatch(message);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="actionType"></param>
        public override void StartAction(GameActionTypeEnum actionType)
        {
            switch (actionType)
            {
            case GameActionTypeEnum.FIGHT:
                StopAction(GameActionTypeEnum.MAP);
                break;

            case GameActionTypeEnum.FIGHT_WEAPON_USE:
            case GameActionTypeEnum.FIGHT_SPELL_LAUNCH:
                Fight.Dispatch(WorldMessage.GAME_ACTION(CurrentAction.Type, Id, CurrentAction.SerializeAs_GameAction()));
                break;

            case GameActionTypeEnum.MAP_MOVEMENT:
                if (HasGameAction(GameActionTypeEnum.FIGHT))
                {
                    if (StateManager.HasState(FighterStateEnum.STATE_STEALTH))
                    {
                        Team.Dispatch(WorldMessage.GAME_ACTION(actionType, Id, CurrentAction.SerializeAs_GameAction()));
                        return;
                    }
                }
                break;
            }

            base.StartAction(actionType);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="actionType"></param>
        public virtual void StartAction(GameActionTypeEnum actionType)
        {
            if (CurrentAction != null && CurrentAction.Type == actionType)
            {
                CurrentAction.Start();
            }

            switch (actionType)
            {
            case GameActionTypeEnum.MAP:
                Map.SpawnEntity(this);
                break;

            case GameActionTypeEnum.SKILL_HARVEST:
            case GameActionTypeEnum.MAP_MOVEMENT:
                MovementHandler.Dispatch(WorldMessage.GAME_ACTION(actionType, Id, CurrentAction.SerializeAs_GameAction()));
                break;

            case GameActionTypeEnum.MAP_TELEPORT:
                StopAction(GameActionTypeEnum.MAP);
                StopAction(GameActionTypeEnum.MAP_TELEPORT);
                // Switch back to world context
                WorldService.Instance.AddUpdatable(this);
                break;
            }
        }
Ejemplo n.º 4
0
 public override bool CanSubAction(GameActionTypeEnum ActionType)
 {
     if (ActionType == GameActionTypeEnum.GROUP)
     {
         return(false);
     }
     return(true);
 }
Ejemplo n.º 5
0
 public void EndGameAction(GameActionTypeEnum Action)
 {
     lock (this.myActions)
         if (this.myActions.ContainsKey(Action))
         {
             this.myActions[Action].EndExecute();
         }
 }
Ejemplo n.º 6
0
 public void AbortGameAction(GameActionTypeEnum Action, params object[] Args)
 {
     lock (this.myActions)
         if (this.myActions.ContainsKey(Action))
         {
             this.myActions[Action].Abort(Args);
         }
 }
Ejemplo n.º 7
0
        public override bool CanSubAction(GameActionTypeEnum Action)
        {
            if (Action == GameActionTypeEnum.CHALLENGE_DENY || Action == GameActionTypeEnum.CHALLENGE_ACCEPT)
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 8
0
 public bool CanGameAction(GameActionTypeEnum ActionType)
 {
     if (Character != null && ActionType == GameActionTypeEnum.BASIC_REQUEST && Character.isAaway)
     {
         return(false);
     }
     lock (this.myActions)
         return(this.myActions.Values.All(x => x.CanSubAction(ActionType)));
 }
Ejemplo n.º 9
0
 public GameAction GetGameAction(GameActionTypeEnum Action)
 {
     lock (this.myActions)
         if (this.myActions.ContainsKey(Action))
         {
             return(this.myActions[Action]);
         }
     return(null);
 }
Ejemplo n.º 10
0
        public override bool CanSubAction(GameActionTypeEnum ActionType)
        {
            switch (ActionType)
            {
            case GameActionTypeEnum.MAP_MOVEMENT:
            case GameActionTypeEnum.FIGHT_LAUNCHSPELL:
            case GameActionTypeEnum.FIGHT_USEWEAPON:
                return(true);
            }

            return(false);
        }
Ejemplo n.º 11
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="actionType"></param>
 /// <returns></returns>
 public bool HasGameAction(GameActionTypeEnum actionType)
 {
     if (actionType == GameActionTypeEnum.MAP && MovementHandler != null)
     {
         return(MovementHandler.FieldType == FieldTypeEnum.TYPE_MAP && Map.GetEntity(Id) != null);
     }
     if (actionType == GameActionTypeEnum.FIGHT && MovementHandler != null)
     {
         return(MovementHandler.FieldType == FieldTypeEnum.TYPE_FIGHT);
     }
     return(CurrentAction != null && CurrentAction.Type == actionType);
 }
Ejemplo n.º 12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="actionType"></param>
        /// <param name="args"></param>
        public override void AbortAction(GameActionTypeEnum actionType, params object[] args)
        {
            switch (actionType)
            {
            case GameActionTypeEnum.FIGHT:
                if (Fight != null)
                {
                    Fight.FighterDisconnect(this);
                }
                break;
            }

            base.AbortAction(actionType, args);
        }
Ejemplo n.º 13
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="actionType"></param>
        /// <param name="args"></param>
        public virtual void AbortAction(GameActionTypeEnum actionType, params object[] args)
        {
            if (CurrentAction != null && CurrentAction.Type == actionType && CurrentAction.CanAbort)
            {
                if (!CurrentAction.IsFinished)
                {
                    CurrentAction.Abort(args);
                }
                if (CurrentAction != null && CurrentAction.Type == actionType)
                {
                    CurrentAction = null;
                }
            }

            switch (actionType)
            {
            case GameActionTypeEnum.MAP:
                Map?.DestroyEntity(this);
                break;
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="actionType"></param>
        public virtual void StartAction(GameActionTypeEnum actionType)
        {
            if(CurrentAction != null && CurrentAction.Type == actionType)
                CurrentAction.Start();

            switch (actionType)
            {
                case GameActionTypeEnum.MAP:
                    Map.SpawnEntity(this);
                    break;

                case GameActionTypeEnum.SKILL_HARVEST:
                case GameActionTypeEnum.MAP_MOVEMENT:
                    MovementHandler.Dispatch(WorldMessage.GAME_ACTION(actionType, Id, CurrentAction.SerializeAs_GameAction()));
                    break;

                case GameActionTypeEnum.MAP_TELEPORT:
                    StopAction(GameActionTypeEnum.MAP);
                    StopAction(GameActionTypeEnum.MAP_TELEPORT);
                    // Switch back to world context
                    WorldService.Instance.AddUpdatable(this);
                    break;
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="actionType"></param>
        public virtual void StopAction(GameActionTypeEnum actionType, params object[] args)
        {
            if (CurrentAction != null && CurrentAction.Type == actionType)
            {
                if (!CurrentAction.IsFinished)
                    CurrentAction.Stop(args);
                if(CurrentAction != null && CurrentAction.Type == actionType)
                    CurrentAction = null;
            }

            switch(actionType)
            {
                case GameActionTypeEnum.MAP:
                    Map?.DestroyEntity(this);
                    break;
            }
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="type"></param>
 /// <param name="entity"></param>
 /// <param name="duration"></param>
 protected AbstractGameAction(GameActionTypeEnum type, AbstractEntity entity, long duration = -1)
 {
     Type = type;
     Entity = entity;
     Duration = duration;
 }
Ejemplo n.º 17
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="type"></param>
 /// <param name="fighter"></param>
 /// <param name="timeout"></param>
 public AbstractGameFightAction(GameActionTypeEnum type, AbstractFighter fighter, long duration)
     : base(type, fighter, duration)
 {
     Fighter = fighter;
     Timeout = Fighter.Fight.UpdateTime + duration;
 }
Ejemplo n.º 18
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="type"></param>
 /// <param name="entity"></param>
 /// <param name="duration"></param>
 protected AbstractGameAction(GameActionTypeEnum type, AbstractEntity entity, long duration = -1)
 {
     Type     = type;
     Entity   = entity;
     Duration = duration;
 }
Ejemplo n.º 19
0
 public override bool CanSubAction(GameActionTypeEnum ActionType)
 {
     return(false);
 }
Ejemplo n.º 20
0
 public GameAction(GameActionTypeEnum ActionType, IGameActor Actor)
 {
     this.Actor      = Actor;
     this.ActionType = ActionType;
 }
Ejemplo n.º 21
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="actionType"></param>
 /// <returns></returns>
 public bool HasGameAction(GameActionTypeEnum actionType)
 {
     if (actionType == GameActionTypeEnum.MAP && MovementHandler != null)
         return MovementHandler.FieldType == FieldTypeEnum.TYPE_MAP && Map.GetEntity(Id) != null;
     if (actionType == GameActionTypeEnum.FIGHT && MovementHandler != null)
         return MovementHandler.FieldType == FieldTypeEnum.TYPE_FIGHT;
     return CurrentAction != null && CurrentAction.Type == actionType;
 }
Ejemplo n.º 22
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="actionType"></param>
        /// <param name="args"></param>
        public override void StopAction(GameActionTypeEnum actionType, params object[] args)
        {
            base.StopAction(actionType, args);

            switch (actionType)
            {
                case GameActionTypeEnum.MAP_TELEPORT:
                    FrameManager.AddFrame(GameInformationFrame.Instance);
                    Dispatch(WorldMessage.GAME_DATA_MAP(MapId, Map.CreateTime, Map.DataKey));
                    break;

                case GameActionTypeEnum.WAYPOINT:
                    FrameManager.AddFrame(GameActionFrame.Instance);
                    FrameManager.AddFrame(InventoryFrame.Instance);
                    FrameManager.AddFrame(MapFrame.Instance);
                    FrameManager.RemoveFrame(WaypointFrame.Instance);
                    break;

                case GameActionTypeEnum.NPC_DIALOG:
                    FrameManager.AddFrame(GameActionFrame.Instance);
                    FrameManager.AddFrame(InventoryFrame.Instance);
                    FrameManager.AddFrame(MapFrame.Instance);
                    FrameManager.RemoveFrame(NpcDialogFrame.Instance);
                    break;

                case GameActionTypeEnum.TAXCOLLECTOR_AGGRESSION:
                case GameActionTypeEnum.GUILD_CREATE:
                case GameActionTypeEnum.EXCHANGE:
                    FrameManager.AddFrame(GameActionFrame.Instance);
                    FrameManager.AddFrame(InventoryFrame.Instance);
                    FrameManager.AddFrame(MapFrame.Instance);
                    break;

                case GameActionTypeEnum.MAP:
                    FrameManager.RemoveFrame(MapFrame.Instance);
                    FrameManager.RemoveFrame(GameActionFrame.Instance);
                    FrameManager.RemoveFrame(ExchangeFrame.Instance);
                    break;

                case GameActionTypeEnum.FIGHT:
                    if (!IsDisconnected)
                    {
                        WorldService.Instance.AddUpdatable(this);
                        FrameManager.AddFrame(GameCreationFrame.Instance);
                        FrameManager.RemoveFrame(FightPlacementFrame.Instance);
                        FrameManager.RemoveFrame(FightFrame.Instance);
                    }
                    break;
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="actionType"></param>
        /// <returns></returns>
        public bool CanGameAction(GameActionTypeEnum actionType)
        {
            if (CurrentAction != null && CurrentAction.Type == GameActionTypeEnum.MAP_MOVEMENT)
            {
                CurrentAction = null;
            }

            switch (actionType)
            {
            case GameActionTypeEnum.FIGHT_AGGRESSION:
                return(((CurrentAction == null || CurrentAction.IsFinished) ||
                        CurrentAction.Type == GameActionTypeEnum.MAP_MOVEMENT) &&
                       !HasPlayerRestriction(PlayerRestrictionEnum.RESTRICTION_CANT_ASSAULT) &&
                       !HasEntityRestriction(EntityRestrictionEnum.RESTRICTION_CANT_BE_ASSAULT));

            case GameActionTypeEnum.SKILL_USE:
                return(((CurrentAction == null || CurrentAction.IsFinished) ||
                        CurrentAction.Type == GameActionTypeEnum.MAP_MOVEMENT) &&
                       !HasPlayerRestriction(PlayerRestrictionEnum.RESTRICTION_CANT_USE_IO) &&
                       !HasEntityRestriction(EntityRestrictionEnum.RESTRICTION_IS_TOMBESTONE));

            case GameActionTypeEnum.CHALLENGE_REQUEST:
                return((CurrentAction == null || CurrentAction.IsFinished) &&
                       HasGameAction(GameActionTypeEnum.MAP) &&
                       !HasEntityRestriction(EntityRestrictionEnum.RESTRICTION_CANT_BE_CHALLENGE) &&
                       !HasPlayerRestriction(PlayerRestrictionEnum.RESTRICTION_CANT_CHALLENGE) &&
                       !HasEntityRestriction(EntityRestrictionEnum.RESTRICTION_IS_TOMBESTONE));

            case GameActionTypeEnum.CHALLENGE_ACCEPT:
                return(CurrentAction != null &&
                       CurrentAction.Type == GameActionTypeEnum.CHALLENGE_REQUEST &&
                       ((GameChallengeRequestAction)CurrentAction).Entity.Id != Id);

            case GameActionTypeEnum.CHALLENGE_DECLINE:
                return(CurrentAction != null &&
                       CurrentAction.Type == GameActionTypeEnum.CHALLENGE_REQUEST);

            case GameActionTypeEnum.EXCHANGE:
                return((CurrentAction == null || CurrentAction.IsFinished) &&
                       !HasEntityRestriction(EntityRestrictionEnum.RESTRICTION_CANT_EXCHANGE) &&
                       !HasPlayerRestriction(PlayerRestrictionEnum.RESTRICTION_CANT_EXCHANGE) &&
                       !HasEntityRestriction(EntityRestrictionEnum.RESTRICTION_IS_TOMBESTONE));

            case GameActionTypeEnum.MAP_MOVEMENT:
                return((CurrentAction == null || CurrentAction.IsFinished) &&
                       !HasEntityRestriction(EntityRestrictionEnum.RESTRICTION_IS_TOMBESTONE));

            case GameActionTypeEnum.FIGHT_WEAPON_USE:
            case GameActionTypeEnum.FIGHT_SPELL_LAUNCH:
                return((CurrentAction == null || CurrentAction.IsFinished) &&
                       HasGameAction(GameActionTypeEnum.FIGHT));

            case GameActionTypeEnum.MAP_TELEPORT:
                return(CurrentAction == null || CurrentAction.IsFinished);

            case GameActionTypeEnum.NPC_DIALOG:
                return((CurrentAction == null || CurrentAction.IsFinished) &&
                       !HasPlayerRestriction(PlayerRestrictionEnum.RESTRICTION_CANT_SPEAK_NPC));

            case GameActionTypeEnum.FIGHT_JOIN:
            case GameActionTypeEnum.FIGHT:
                return((CurrentAction == null || CurrentAction.IsFinished) &&
                       !HasEntityRestriction(EntityRestrictionEnum.RESTRICTION_IS_TOMBESTONE) &&
                       !HasPlayerRestriction(PlayerRestrictionEnum.RESTRICTION_CANT_ASSAULT));

            case GameActionTypeEnum.TAXCOLLECTOR_AGGRESSION:
                return((CurrentAction == null || CurrentAction.IsFinished) &&
                       !HasPlayerRestriction(PlayerRestrictionEnum.RESTRICTION_CANT_INTERACT_WITH_TAX_COLLECTOR));
            }

            return(CurrentAction == null || CurrentAction.IsFinished);
        }
Ejemplo n.º 24
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="actionType"></param>
        public override void StartAction(GameActionTypeEnum actionType)
        {
            switch(actionType)
            {
                case GameActionTypeEnum.FIGHT:
                    StopAction(GameActionTypeEnum.MAP);
                    break;

                case GameActionTypeEnum.FIGHT_WEAPON_USE:
                case GameActionTypeEnum.FIGHT_SPELL_LAUNCH:
                    Fight.Dispatch(WorldMessage.GAME_ACTION(CurrentAction.Type, Id, CurrentAction.SerializeAs_GameAction()));
                    break;

                case GameActionTypeEnum.MAP_MOVEMENT:
                    if (HasGameAction(GameActionTypeEnum.FIGHT))
                    {
                        if (StateManager.HasState(FighterStateEnum.STATE_STEALTH))
                        {
                            Team.Dispatch(WorldMessage.GAME_ACTION(actionType, Id, CurrentAction.SerializeAs_GameAction()));
                            return;
                        }
                    }
                    break;
            }

            base.StartAction(actionType);
        }
Ejemplo n.º 25
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="actionType"></param>
        /// <param name="args"></param>
        public override void AbortAction(GameActionTypeEnum actionType, params object[] args)
        {
            switch(actionType)
            {
                case GameActionTypeEnum.FIGHT:
                    if(Fight != null)
                        Fight.FighterDisconnect(this);
                    break;
            }

            base.AbortAction(actionType, args);
        }
Ejemplo n.º 26
0
 public void DelGameAction(GameActionTypeEnum Action)
 {
     lock (this.myActions)
         this.myActions.Remove(Action);
 }
Ejemplo n.º 27
0
 public bool IsGameAction(GameActionTypeEnum Action)
 {
     lock (this.myActions)
         return(this.myActions.ContainsKey(Action));
 }
Ejemplo n.º 28
0
 public override bool CanSubAction(GameActionTypeEnum ActionType)
 {
     return(this.Request.CanSubAction(ActionType));
 }
Ejemplo n.º 29
0
 public abstract bool CanSubAction(GameActionTypeEnum Action);
 /// <summary>
 /// 
 /// </summary>
 /// <param name="type"></param>
 /// <param name="fighter"></param>
 /// <param name="timeout"></param>
 public AbstractGameFightAction(GameActionTypeEnum type, AbstractFighter fighter, long duration)
     : base(type, fighter, duration)
 {
     Fighter = fighter;
     Timeout = Fighter.Fight.UpdateTime + duration;
 }
Ejemplo n.º 31
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="actionType"></param>
        public override void StartAction(GameActionTypeEnum actionType)
        {
            base.StartAction(actionType);

            switch (actionType)
            {
                case GameActionTypeEnum.MAP_MOVEMENT:
                    StopEmote();
                    if (AutomaticSkillId != -1 && HasGameAction(GameActionTypeEnum.MAP))
                    {
                        var movement = CurrentAction as GameMapMovementAction;
                        movement.SkillId = AutomaticSkillId;
                        movement.SkillCellId = AutomaticSkillCellId;
                        movement.SkillMapId = AutomaticSkillMapId;

                        AutomaticSkillId = -1;
                        AutomaticSkillCellId = -1;
                        AutomaticSkillMapId = -1;
                    }
                    break;

                case GameActionTypeEnum.MAP_TELEPORT:
                    StopEmote();
                    Dispatch(WorldMessage.GAME_ACTION(actionType, Id));
                    break;

                case GameActionTypeEnum.MAP:
                    if(Map == null)
                    {
                        MapId = SavedMapId;
                        CellId = SavedCellId;
                    }
                    if (HasEntityRestriction(EntityRestrictionEnum.RESTRICTION_IS_TOMBESTONE))
                        FrameManager.AddFrame(GameTombestoneFrame.Instance);
                    FrameManager.AddFrame(MapFrame.Instance);
                    FrameManager.AddFrame(InventoryFrame.Instance);
                    FrameManager.AddFrame(ExchangeFrame.Instance);
                    FrameManager.AddFrame(GameActionFrame.Instance);
                    break;

                case GameActionTypeEnum.WAYPOINT:
                    FrameManager.RemoveFrame(GameActionFrame.Instance);
                    FrameManager.RemoveFrame(InventoryFrame.Instance);
                    FrameManager.RemoveFrame(MapFrame.Instance);
                    FrameManager.AddFrame(WaypointFrame.Instance);
                    break;

                case GameActionTypeEnum.NPC_DIALOG:
                    FrameManager.RemoveFrame(GameActionFrame.Instance);
                    FrameManager.RemoveFrame(InventoryFrame.Instance);
                    FrameManager.RemoveFrame(MapFrame.Instance);
                    FrameManager.AddFrame(NpcDialogFrame.Instance);
                    break;

                case GameActionTypeEnum.TAXCOLLECTOR_AGGRESSION:
                case GameActionTypeEnum.GUILD_CREATE:
                case GameActionTypeEnum.EXCHANGE:
                    FrameManager.RemoveFrame(GameActionFrame.Instance);
                    FrameManager.RemoveFrame(InventoryFrame.Instance);
                    FrameManager.RemoveFrame(MapFrame.Instance);
                    break;

                case GameActionTypeEnum.FIGHT:
                    StopEmote();
                    FrameManager.RemoveFrame(MapFrame.Instance);
                    if (IsSpectating)
                    {
                        FrameManager.AddFrame(FightFrame.Instance);
                    }
                    else
                    {
                        if (Fight.Map.Id != MapId)
                        {
                            Dispatch(WorldMessage.GAME_ACTION(GameActionTypeEnum.MAP_TELEPORT, Id));
                            Dispatch(WorldMessage.GAME_DATA_MAP(Fight.Map.Id, Fight.Map.CreateTime, Fight.Map.DataKey));
                            FrameManager.AddFrame(GameInformationFrame.Instance);
                        }
                        FrameManager.AddFrame(FightPlacementFrame.Instance);
                    }
                    break;
            }
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="result"></param>
 private void Finish(GameActionTypeEnum result)
 {
     var message = WorldMessage.GAME_ACTION(result, Attacker.Id, Defender.Id.ToString());
     Attacker.Dispatch(message);
     Defender.Dispatch(message);
 }
Ejemplo n.º 33
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="actionType"></param>
        /// <param name="args"></param>
        public override void AbortAction(GameActionTypeEnum actionType, params object[] args)
        {
            base.AbortAction(actionType, args);

            switch (actionType)
            {
                case GameActionTypeEnum.MAP:
                    FrameManager.RemoveFrame(MapFrame.Instance);
                    FrameManager.RemoveFrame(GameActionFrame.Instance);
                    FrameManager.RemoveFrame(ExchangeFrame.Instance);
                    break;

                case GameActionTypeEnum.WAYPOINT:
                    FrameManager.AddFrame(GameActionFrame.Instance);
                    FrameManager.AddFrame(InventoryFrame.Instance);
                    FrameManager.AddFrame(MapFrame.Instance);
                    FrameManager.RemoveFrame(WaypointFrame.Instance);
                    break;

                case GameActionTypeEnum.NPC_DIALOG:
                    FrameManager.AddFrame(GameActionFrame.Instance);
                    FrameManager.AddFrame(InventoryFrame.Instance);
                    FrameManager.AddFrame(MapFrame.Instance);
                    FrameManager.RemoveFrame(NpcDialogFrame.Instance);
                    break;

                case GameActionTypeEnum.TAXCOLLECTOR_AGGRESSION:
                case GameActionTypeEnum.GUILD_CREATE:
                case GameActionTypeEnum.EXCHANGE:
                    FrameManager.AddFrame(GameActionFrame.Instance);
                    FrameManager.AddFrame(InventoryFrame.Instance);
                    FrameManager.AddFrame(MapFrame.Instance);
                    break;
            }
        }
Ejemplo n.º 34
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="actionType"></param>
        /// <returns></returns>
        public bool CanGameAction(GameActionTypeEnum actionType)
        {
            if (CurrentAction != null && CurrentAction.Type == GameActionTypeEnum.MAP_MOVEMENT)
                CurrentAction = null;

            switch (actionType)
            {
                case GameActionTypeEnum.FIGHT_AGGRESSION:
                    return ((CurrentAction == null || CurrentAction.IsFinished)
                        || CurrentAction.Type == GameActionTypeEnum.MAP_MOVEMENT)
                        && !HasPlayerRestriction(PlayerRestrictionEnum.RESTRICTION_CANT_ASSAULT)
                        && !HasEntityRestriction(EntityRestrictionEnum.RESTRICTION_CANT_BE_ASSAULT);

                case GameActionTypeEnum.SKILL_USE:
                    return ((CurrentAction == null || CurrentAction.IsFinished)
                        || CurrentAction.Type == GameActionTypeEnum.MAP_MOVEMENT)
                        && !HasPlayerRestriction(PlayerRestrictionEnum.RESTRICTION_CANT_USE_IO)
                        && !HasEntityRestriction(EntityRestrictionEnum.RESTRICTION_IS_TOMBESTONE);

                case GameActionTypeEnum.CHALLENGE_REQUEST:
                    return (CurrentAction == null || CurrentAction.IsFinished)
                        && HasGameAction(GameActionTypeEnum.MAP)
                        && !HasEntityRestriction(EntityRestrictionEnum.RESTRICTION_CANT_BE_CHALLENGE)
                        && !HasPlayerRestriction(PlayerRestrictionEnum.RESTRICTION_CANT_CHALLENGE)
                        && !HasEntityRestriction(EntityRestrictionEnum.RESTRICTION_IS_TOMBESTONE);

                case GameActionTypeEnum.CHALLENGE_ACCEPT:
                    return CurrentAction != null
                        && CurrentAction.Type == GameActionTypeEnum.CHALLENGE_REQUEST
                        && ((GameChallengeRequestAction)CurrentAction).Entity.Id != Id;

                case GameActionTypeEnum.CHALLENGE_DECLINE:
                    return CurrentAction != null
                        && CurrentAction.Type == GameActionTypeEnum.CHALLENGE_REQUEST;

                case GameActionTypeEnum.EXCHANGE:
                    return (CurrentAction == null || CurrentAction.IsFinished)
                        && !HasEntityRestriction(EntityRestrictionEnum.RESTRICTION_CANT_EXCHANGE)
                        && !HasPlayerRestriction(PlayerRestrictionEnum.RESTRICTION_CANT_EXCHANGE)
                        && !HasEntityRestriction(EntityRestrictionEnum.RESTRICTION_IS_TOMBESTONE);

                case GameActionTypeEnum.MAP_MOVEMENT:
                    return (CurrentAction == null || CurrentAction.IsFinished)
                        && !HasEntityRestriction(EntityRestrictionEnum.RESTRICTION_IS_TOMBESTONE);

                case GameActionTypeEnum.FIGHT_WEAPON_USE:
                case GameActionTypeEnum.FIGHT_SPELL_LAUNCH:
                    return (CurrentAction == null || CurrentAction.IsFinished)
                        && HasGameAction(GameActionTypeEnum.FIGHT);

                case GameActionTypeEnum.MAP_TELEPORT:
                    return (CurrentAction == null || CurrentAction.IsFinished);

                case GameActionTypeEnum.NPC_DIALOG:
                    return (CurrentAction == null || CurrentAction.IsFinished)
                        && !HasPlayerRestriction(PlayerRestrictionEnum.RESTRICTION_CANT_SPEAK_NPC);

                case GameActionTypeEnum.FIGHT_JOIN:
                case GameActionTypeEnum.FIGHT:
                    return (CurrentAction == null || CurrentAction.IsFinished)
                         && !HasEntityRestriction(EntityRestrictionEnum.RESTRICTION_IS_TOMBESTONE)
                         && !HasPlayerRestriction(PlayerRestrictionEnum.RESTRICTION_CANT_ASSAULT);

                case GameActionTypeEnum.TAXCOLLECTOR_AGGRESSION:
                    return (CurrentAction == null || CurrentAction.IsFinished)
                        && !HasPlayerRestriction(PlayerRestrictionEnum.RESTRICTION_CANT_INTERACT_WITH_TAX_COLLECTOR);
            }

            return CurrentAction == null || CurrentAction.IsFinished;
        }