/// <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); }
/// <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); }
/// <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; } }
public override bool CanSubAction(GameActionTypeEnum ActionType) { if (ActionType == GameActionTypeEnum.GROUP) { return(false); } return(true); }
public void EndGameAction(GameActionTypeEnum Action) { lock (this.myActions) if (this.myActions.ContainsKey(Action)) { this.myActions[Action].EndExecute(); } }
public void AbortGameAction(GameActionTypeEnum Action, params object[] Args) { lock (this.myActions) if (this.myActions.ContainsKey(Action)) { this.myActions[Action].Abort(Args); } }
public override bool CanSubAction(GameActionTypeEnum Action) { if (Action == GameActionTypeEnum.CHALLENGE_DENY || Action == GameActionTypeEnum.CHALLENGE_ACCEPT) { return(true); } return(false); }
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))); }
public GameAction GetGameAction(GameActionTypeEnum Action) { lock (this.myActions) if (this.myActions.ContainsKey(Action)) { return(this.myActions[Action]); } return(null); }
public override bool CanSubAction(GameActionTypeEnum ActionType) { switch (ActionType) { case GameActionTypeEnum.MAP_MOVEMENT: case GameActionTypeEnum.FIGHT_LAUNCHSPELL: case GameActionTypeEnum.FIGHT_USEWEAPON: return(true); } return(false); }
/// <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); }
/// <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); }
/// <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; } }
/// <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; } }
/// <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; }
/// <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; }
public override bool CanSubAction(GameActionTypeEnum ActionType) { return(false); }
public GameAction(GameActionTypeEnum ActionType, IGameActor Actor) { this.Actor = Actor; this.ActionType = ActionType; }
/// <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; }
/// <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; } }
/// <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); }
/// <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); }
/// <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); }
public void DelGameAction(GameActionTypeEnum Action) { lock (this.myActions) this.myActions.Remove(Action); }
public bool IsGameAction(GameActionTypeEnum Action) { lock (this.myActions) return(this.myActions.ContainsKey(Action)); }
public override bool CanSubAction(GameActionTypeEnum ActionType) { return(this.Request.CanSubAction(ActionType)); }
public abstract bool CanSubAction(GameActionTypeEnum Action);
/// <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="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; } }
/// <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; }