public static void Handle(ClientMessage message, Session session) { //Console.WriteLine($"{session.Player.Name}.MoveToState"); var moveToState = new MoveToState(session.Player, message.Payload); session.Player.CurrentMoveToState = moveToState; if (!session.Player.Teleporting) { session.Player.OnMoveToState(moveToState); session.Player.LastMoveToState = moveToState; // MoveToState - UpdatePosition broadcasts were capped to 1 per second in retail session.Player.SetRequestedLocation(moveToState.Position, false); } //if (!moveToState.StandingLongJump) session.Player.BroadcastMovement(moveToState); if (session.Player.IsPlayerMovingTo) { session.Player.StopExistingMoveToChains(); } if (session.Player.IsPlayerMovingTo2) { session.Player.StopExistingMoveToChains2(); } }
/// <summary> /// 初始化状态机时,构造一个状态机 /// </summary> void ConstructFSM() { FSM = new FSMSystem(); AttackState attackState = new AttackState(gameObject); attackState.AddTransition(Transition.LostEnemy, StateID.Wander); MoveToState moveToState = new MoveToState(gameObject, MoveTarget); moveToState.AddTransition(Transition.ReadyToAttack, StateID.Attack); moveToState.AddTransition(Transition.LostEnemy, StateID.Wander); WanderState wanderState = new WanderState(gameObject, wanderPoints); wanderState.AddTransition(Transition.SawEnemy, StateID.MoveTo); wanderState.AddTransition(Transition.SawItem, StateID.MoveTo); FSM.AddState(attackState); FSM.AddState(wanderState); FSM.AddState(moveToState); FSM.start(StateID.Wander); }
public void BroadcastMovement(MoveToState moveToState) { var state = moveToState.RawMotionState; // update current style if ((state.Flags & RawMotionFlags.CurrentStyle) != 0) { // this lowercase stance field in Player doesn't really seem to be used anywhere stance = state.CurrentStyle; } // update CurrentMotionState here for substates? if ((state.Flags & RawMotionFlags.ForwardCommand) != 0) { if (((uint)state.ForwardCommand & (uint)CommandMask.SubState) != 0) { CurrentMotionState.SetForwardCommand(state.ForwardCommand); } } else { CurrentMotionState.SetForwardCommand(MotionCommand.Ready); } if (state.CommandListLength > 0) { if (((uint)state.Commands[0].MotionCommand & (uint)CommandMask.SubState) != 0) { CurrentMotionState.SetForwardCommand(state.Commands[0].MotionCommand); } } if (state.HasSoulEmote(false)) { // prevent soul emote spam / bug where client sends multiples var soulEmote = state.Commands[0].MotionCommand; if (soulEmote == LastSoulEmote && DateTime.UtcNow < LastSoulEmoteEndTime) { state.Commands.Clear(); state.CommandListLength = 0; } else { var animLength = Physics.Animation.MotionTable.GetAnimationLength(MotionTableId, CurrentMotionState.Stance, soulEmote, state.Commands[0].Speed); LastSoulEmote = soulEmote; LastSoulEmoteEndTime = DateTime.UtcNow + TimeSpan.FromSeconds(animLength); } } var movementData = new MovementData(this, moveToState); var movementEvent = new GameMessageUpdateMotion(this, movementData); EnqueueBroadcast(true, movementEvent); // shouldn't need to go to originating player? // TODO: use real motion / animation system from physics //CurrentMotionCommand = movementData.Invalid.State.ForwardCommand; CurrentMovementData = movementData; }
/// <summary> /// For advanced spellcasting / players glitching around during powersliding, /// the reason for this retail bug is from 2 different functions for player movement /// /// The client's self-player uses DoMotion/StopMotion /// The server and other players on the client use apply_raw_movement /// /// When a 3+ button powerslide is performed, this bugs out apply_raw_movement, /// and causes the player to spin in place. With DoMotion/StopMotion, it performs a powerslide. /// /// With this option enabled (retail defaults to false), the player's position on the server /// will match up closely with the player's client during powerslides. /// /// Since the client uses apply_raw_movement to simulate the movement of nearby players, /// the other players will still glitch around on screen, even with this option enabled. /// /// If you wish for the positions of other players to be less glitchy, the 'MoveToState_UpdatePosition_Threshold' /// can be lowered to achieve that /// </summary> public void OnMoveToState(MoveToState moveToState) { if (!FastTick) { return; } if (DebugPlayerMoveToStatePhysics) { Console.WriteLine(moveToState.RawMotionState); } if (RecordCast.Enabled) { RecordCast.OnMoveToState(moveToState); } if (!PhysicsObj.IsMovingOrAnimating) { PhysicsObj.UpdateTime = PhysicsTimer.CurrentTime; } if (!PropertyManager.GetBool("client_movement_formula").Item || moveToState.StandingLongJump) { OnMoveToState_ServerMethod(moveToState); } else { OnMoveToState_ClientMethod(moveToState); } }
private static MoveToState _instance; //only declared once private MoveToState() //set instance to itself { if (_instance != null) { return; } _instance = this; }
public static void Handle(ClientMessage message, Session session) { var moveToState = new MoveToState(session.Player, message.Payload); session.Player.SetRequestedLocation(moveToState.Position); //if (!moveToState.StandingLongJump) session.Player.BroadcastMovement(moveToState); }
public void OnMoveToState(MoveToState moveToState) { var rawState = moveToState.RawMotionState; var line = rawState.ToString(false).Replace(Environment.NewLine, " | "); line = line.Length >= 8 ? line.Substring(0, line.Length - 8) : ""; Output(line); }
//public DateTime LastSoulEmote; //private static TimeSpan SoulEmoteTime = TimeSpan.FromSeconds(2); public void BroadcastMovement(MoveToState moveToState) { var state = moveToState.RawMotionState; // update current style if ((state.Flags & RawMotionFlags.CurrentStyle) != 0) { // this lowercase stance field in Player doesn't really seem to be used anywhere stance = state.CurrentStyle; } // update CurrentMotionState here for substates? if ((state.Flags & RawMotionFlags.ForwardCommand) != 0) { if (((uint)state.ForwardCommand & (uint)CommandMask.SubState) != 0) { CurrentMotionState.SetForwardCommand(state.ForwardCommand); } } else { CurrentMotionState.SetForwardCommand(MotionCommand.Ready); } if (state.CommandListLength > 0) { if (((uint)state.Commands[0].MotionCommand & (uint)CommandMask.SubState) != 0) { CurrentMotionState.SetForwardCommand(state.Commands[0].MotionCommand); } } /*if (state.HasSoulEmote()) * { * // prevent soul emote spam / bug where client sends multiples * var elapsed = DateTime.UtcNow - LastSoulEmote; * if (elapsed < SoulEmoteTime) return; * * LastSoulEmote = DateTime.UtcNow; * }*/ var movementData = new MovementData(this, moveToState); var movementEvent = new GameMessageUpdateMotion(this, movementData); EnqueueBroadcast(false, movementEvent); // shouldn't need to go to originating player? // TODO: use real motion / animation system from physics //CurrentMotionCommand = movementData.Invalid.State.ForwardCommand; CurrentMovementData = movementData; }
void Update() { if (Input.GetButtonDown("Jump")) { if (moveToState == MoveToState.chaseTarget) { moveToState = MoveToState.escapeFromTarget; } else { moveToState = MoveToState.chaseTarget; } } }
public void GetPlayerPos(MoveToState state) { Vector3 pos = Vector3.zero; if (GlobalGameData.Instance.GetRandomPlayerPosition(out pos)) { var newPos = (state.gameObject.transform.position - pos).normalized; newPos *= 100f; state.target = -newPos; } else { state.target = Vector3.zero; } }
public static void Handle(ClientMessage message, Session session) { var moveToState = new MoveToState(session.Player, message.Payload); session.Player.CurrentMoveToState = moveToState; session.Player.SetRequestedLocation(moveToState.Position); //if (!moveToState.StandingLongJump) session.Player.BroadcastMovement(moveToState); if (session.Player.IsPlayerMovingTo) { session.Player.StopExistingMoveToChains(); } }
/// <summary> /// Code for the action that gets called in OldMan's update /// </summary> /// <param name="om">The Old Man script</param> public override void ExecuteAction(OldMan om) { if (!Active || Completed) { return; } //State control switch (state) { //Wait for a set amount of seconds before walking to the point case MoveToState.WaitingBefore: waitTimer += Time.deltaTime; if (waitTimer > waitBeforeMoving) { state = MoveToState.WalkingTo; SetNextPoint(om, goalPoint); } break; //Walk to the point case MoveToState.WalkingTo: if (!om.Agent.pathPending && om.Agent.remainingDistance < 0.3f) { //Wait if there is a value passed in, otherwise start walking back if (goalPoint.WaitAfterReaching > 0) { waitTimer = 0; state = MoveToState.WaitingAt; } else { CompleteAction(); } } break; //Wait for a set amount of seconds before walking back case MoveToState.WaitingAt: waitTimer += Time.deltaTime; if (waitTimer > goalPoint.WaitAfterReaching) { CompleteAction(); } break; } }
/// <summary> /// Create an action where the Old Man walks to a set point /// </summary> /// <param name="priority">How important the action is</param> /// <param name="name">The name of this action</param> /// <param name="goalPoint">The point the OM is walking to</param> /// <param name="waitBeforeMoving">How long the OM should wait before moving to the goalPoint</param> /// <param name="thoughtItem">The sprite to put in the thought bubble. Can be left null for no item to be shown</param> /// <param name="discardTime">The amount of time this action can spend in the queue without being discarded. 0 for infinite.</param> public OM_Action_MoveTo(float priority, string name, OM_MoveData goalPoint, float waitBeforeMoving, Sprite thoughtItem = null, float discardTime = 0) : base(priority, name, OM_ActionType.MoveTo, thoughtItem, discardTime) { this.goalPoint = goalPoint; this.waitBeforeMoving = waitBeforeMoving; if (waitBeforeMoving > 0) { state = MoveToState.WaitingBefore; } else { state = MoveToState.WalkingTo; } waitTimer = 0; }
public void OnMoveToState_ServerMethod(MoveToState moveToState) { var minterp = PhysicsObj.get_minterp(); minterp.RawState.SetState(moveToState.RawMotionState); if (moveToState.StandingLongJump) { minterp.RawState.ForwardCommand = (uint)MotionCommand.Ready; minterp.RawState.SideStepCommand = 0; } var allowJump = minterp.motion_allows_jump(minterp.InterpretedState.ForwardCommand) == WeenieError.None; //PhysicsObj.cancel_moveto(); minterp.apply_raw_movement(true, allowJump); }
public static MoveToState read(BinaryReader binaryReader) { MoveToState newObj = new MoveToState(); newObj.raw_motion_state = RawMotionState.read(binaryReader); newObj.position = Position.read(binaryReader); newObj.instance_timestamp = binaryReader.ReadUInt16(); newObj.server_control_timestamp = binaryReader.ReadUInt16(); newObj.teleport_timestamp = binaryReader.ReadUInt16(); newObj.force_position_ts = binaryReader.ReadUInt16(); byte flags = binaryReader.ReadByte(); newObj.contact = (flags & (1 << 0)) != 0; newObj.longjump_mode = (flags & (1 << 1)) != 0; Util.readToAlign(binaryReader); return(newObj); }
public void BroadcastMovement(MoveToState moveToState) { var state = moveToState.RawMotionState; // update current style if ((state.Flags & RawMotionFlags.CurrentStyle) != 0) { // this lowercase stance field in Player doesn't really seem to be used anywhere stance = state.CurrentStyle; } var movementData = new MovementData(this, moveToState); var movementEvent = new GameMessageUpdateMotion(this, movementData); EnqueueBroadcast(movementEvent); // shouldn't need to go to originating player? // TODO: use real motion / animation system from physics CurrentMotionCommand = movementData.Invalid.State.ForwardCommand; }
public void BroadcastMovement(MoveToState moveToState) { var state = moveToState.RawMotionState; // update current style if ((state.Flags & RawMotionFlags.CurrentStyle) != 0) { // this lowercase stance field in Player doesn't really seem to be used anywhere stance = state.CurrentStyle; } // update CurrentMotionState here for substates? if ((state.Flags & RawMotionFlags.ForwardCommand) != 0) { if (((uint)state.ForwardCommand & (uint)CommandMask.SubState) != 0) { CurrentMotionState.SetForwardCommand(state.ForwardCommand); } } else { CurrentMotionState.SetForwardCommand(MotionCommand.Ready); } if (state.CommandListLength > 0) { if (((uint)state.Commands[0].MotionCommand & (uint)CommandMask.SubState) != 0) { CurrentMotionState.SetForwardCommand(state.Commands[0].MotionCommand); } } var movementData = new MovementData(this, moveToState); var movementEvent = new GameMessageUpdateMotion(this, movementData); EnqueueBroadcast(movementEvent); // shouldn't need to go to originating player? // TODO: use real motion / animation system from physics CurrentMotionCommand = movementData.Invalid.State.ForwardCommand; }
private void Awake() { planState = new PlanState(this); performActionState = new PerformActionState(this); moveToState = new MoveToState(this); }
public void OnMoveToState_ClientMethod(MoveToState moveToState) { var rawState = moveToState.RawMotionState; var prevState = LastMoveToState?.RawMotionState ?? RawMotionState.None; var mvp = new Physics.Animation.MovementParameters(); mvp.HoldKeyToApply = rawState.CurrentHoldKey; if (!PhysicsObj.IsMovingOrAnimating) { PhysicsObj.UpdateTime = PhysicsTimer.CurrentTime; } // ForwardCommand if (rawState.ForwardCommand != MotionCommand.Invalid) { // press new key if (prevState.ForwardCommand == MotionCommand.Invalid) { PhysicsObj.DoMotion((uint)MotionCommand.Ready, mvp); PhysicsObj.DoMotion((uint)rawState.ForwardCommand, mvp); } // press alternate key else if (prevState.ForwardCommand != rawState.ForwardCommand) { PhysicsObj.DoMotion((uint)rawState.ForwardCommand, mvp); } } else if (prevState.ForwardCommand != MotionCommand.Invalid) { // release key PhysicsObj.StopMotion((uint)prevState.ForwardCommand, mvp, true); } // StrafeCommand if (rawState.SidestepCommand != MotionCommand.Invalid) { // press new key if (prevState.SidestepCommand == MotionCommand.Invalid) { PhysicsObj.DoMotion((uint)rawState.SidestepCommand, mvp); } // press alternate key else if (prevState.SidestepCommand != rawState.SidestepCommand) { PhysicsObj.DoMotion((uint)rawState.SidestepCommand, mvp); } } else if (prevState.SidestepCommand != MotionCommand.Invalid) { // release key PhysicsObj.StopMotion((uint)prevState.SidestepCommand, mvp, true); } // TurnCommand if (rawState.TurnCommand != MotionCommand.Invalid) { // press new key if (prevState.TurnCommand == MotionCommand.Invalid) { PhysicsObj.DoMotion((uint)rawState.TurnCommand, mvp); } // press alternate key else if (prevState.TurnCommand != rawState.TurnCommand) { PhysicsObj.DoMotion((uint)rawState.TurnCommand, mvp); } } else if (prevState.TurnCommand != MotionCommand.Invalid) { // release key PhysicsObj.StopMotion((uint)prevState.TurnCommand, mvp, true); } }
public void GetRandomPos(MoveToState state) { state.target = GlobalGameData.Instance.GetRandomCamPosition(); }
/// <summary> /// This routine gets called every time we end up fighting (because we pulled or /// because a mob aggroed) /// This should be implemented in the spcific class script /// </summary> protected override void DoExecute(WowPlayer player) { Output.Instance.Script("OnInCombat()", this); if (!player.HasTarget || player.IsTargetDead()) { Output.Instance.Script("We no longer have a target or our target is dead. We exit this state.", this); return; } // TODO: Before uncommenting this part we need to work out a FindBestTarget routine /* * if (player.IsTargetTapped() && !player.IsTargetTappedByMe()) * { * player.SpellStopCasting(); * player.ClearTarget(); * player.FindBestTarget(); * player.AttackTarget(); * } */ // We turn to face the target if we're facing away for some reason float angleDifference = Math.Abs(player.FacingDegrees() - player.AngleToTargetDegrees()); Output.Instance.Script(string.Format("Degrees difference between player and target: {0}", angleDifference)); if (angleDifference > 20.0f) { Output.Instance.Script("Facing target", this); player.FaceTarget(); } if (player.DistanceFromTarget() > Core.MaxMeleeDistance) { Output.Instance.Script("Moving towards target", this); player.FaceTarget(); //player.MoveToTarget(Core.MinMeleeDistance); var mts = new MoveToState(player.CurTarget.Location, Core.MinMeleeDistance); CallChangeStateEvent(player, mts, true, false); return; } if (player.IsMoving() && player.DistanceFromTarget() < Core.MaxMeleeDistance && player.DistanceFromTarget() > Core.MinMeleeDistance) { Output.Instance.Script("We reached the correct distance to attack. Stopping all movement.", this); player.Stop(); } if (player.DistanceFromTarget() < Core.MinMeleeDistance) { Output.Instance.Script("We are too close to the mob, let's take a step back", this); player.MoveBackward(300); } if (!player.IsAttacking()) { Output.Instance.Script("We're not yet attacking but we should. Let's do this!", this); player.AttackTarget(); } if (player.HpPct <= Core.HpPctEmergency) { Output.Instance.Script("We're about to die. Time to perform the Emergency routine", this); Core.Emergency(player); } if (player.HpPct <= Core.HpPctPotion && Core.HasHealthPotion()) { Output.Instance.Script("We're still dying.. but we have a health potion to use! weee! :D", this); player.SpellStopCasting(); // TODO: implement a function to select the best health potion and drink it //player.TakePotion("HP"); } if (player.MpPct <= Core.MpPctPotion && Core.HasManaPotion()) { Output.Instance.Script("We're low on mana but we do have a mana potion, let's use it!", this); player.SpellStopCasting(); // TODO: implement a function to select the best mana potion and drink it //player.TakePotion("MP"); } if (player.HpPct <= Core.HpHammer && player.MpPct > 5 && player.HpPct >= Core.HpPctEmergency && player.CanCast("Hammer of Justice")) { Output.Instance.Script("We can use Hammer Of Justice, let's do it.", this); player.CastSpellByName("Hammer of Justice", true); if (player.TargetHpPct > 10) { Core.HealSystem(player); Output.Instance.Script("Hammer of Justice healing", this); return; } return; } // TODO: implement IsBeingAttackedByManyMobs by going through all the mobs who have aggro on us and are in range /* * if (player.IsBeingAttackedByManyMobs()) * { * if (player.CanCast(multiAura)) * { * player.CastSpellByName(multiAura); * } * * if (player.CanCast("Consecration")) * { * player.CastSpellByName("Consecration"); * } * } */ // TODO: implement TargetIsCasting() /* * if (player.TargetIsCasting()) * { * CastInterruption(); * } */ if (player.TargetHpPct <= 20) { FinalFight(); } else { NormalFight(); } // TODO: implement TargetCreatureType() /* * if (useExorcism) * { * if (player.MpPct > 30 && player.TargetHpPct > exorcismHp && player.CanCast("Exorcism") && player.TargetCreatureType() == "Undead" || player.TargetCreatureType() == "Demon") * { * player.CastSpellByName("Exorcism"); * } * } */ if (Core.combatDebuff) { Output.Instance.Script("Debuffing.", this); Core.DebuffAll(); } // TODO: implement reading of the player race /* * if (player.Race() == "Blood Elf") * { * if (player.Buff("Mana Tap").Application > 0 && player.MpPct <= 20) * { * player.SpellStopCasting(); * player.CastSpellByName("Arcane Torrent"); * } * if (player.TargetMpPct > 0 && player.IsActionUsable("Mana Tap") && player.Buff("Mana Tap").Application < 3) * { * player.CastSpellByName("Mana Tap"); * } * } */ }
public static void Handle(ClientMessage message, Session session) { //Console.WriteLine($"{session.Player.Name}.MoveToState"); if (session.Player.PKLogout) { return; } var moveToState = new MoveToState(session.Player, message.Payload); session.Player.CurrentMoveToState = moveToState; if (session.Player.IsPlayerMovingTo) { session.Player.StopExistingMoveToChains(); } if (session.Player.IsPlayerMovingTo2) { session.Player.StopExistingMoveToChains2(); } // MoveToState - UpdatePosition broadcasts were capped to 1 per second in retail session.Player.OnMoveToState(moveToState); session.Player.LastMoveToState = moveToState; if (!session.Player.Teleporting) { session.Player.SetRequestedLocation(moveToState.Position, false); } //if (!moveToState.StandingLongJump) session.Player.BroadcastMovement(moveToState); if (session.Player.IsAfk) { if (moveToState.RawMotionState.CurrentHoldKey == ACE.Entity.Enum.HoldKey.Run) { switch (moveToState.RawMotionState.ForwardCommand) { case ACE.Entity.Enum.MotionCommand.Invalid: case ACE.Entity.Enum.MotionCommand.AFKState: break; default: session.Player.HandleActionSetAFKMode(false); break; } switch (moveToState.RawMotionState.TurnCommand) { case ACE.Entity.Enum.MotionCommand.Invalid: case ACE.Entity.Enum.MotionCommand.AFKState: break; default: session.Player.HandleActionSetAFKMode(false); break; } switch (moveToState.RawMotionState.SidestepCommand) { case ACE.Entity.Enum.MotionCommand.Invalid: case ACE.Entity.Enum.MotionCommand.AFKState: break; default: session.Player.HandleActionSetAFKMode(false); break; } } } }
/// <summary> /// This routine gets called every time we end up fighting (because we pulled or /// because a mob aggroed) /// This should be implemented in the spcific class script /// </summary> protected override void DoExecute(WowPlayer player) { Output.Instance.Script("OnInCombat()", this); if (!player.HasTarget || player.IsTargetDead()) { Output.Instance.Script("We no longer have a target or our target is dead. We exit this state.", this); return; } // TODO: Before uncommenting this part we need to work out a FindBestTarget routine /* if (player.IsTargetTapped() && !player.IsTargetTappedByMe()) { player.SpellStopCasting(); player.ClearTarget(); player.FindBestTarget(); player.AttackTarget(); } */ // We turn to face the target if we're facing away for some reason float angleDifference = Math.Abs(player.FacingDegrees() - player.AngleToTargetDegrees()); Output.Instance.Script(string.Format("Degrees difference between player and target: {0}", angleDifference)); if (angleDifference > 20.0f) { Output.Instance.Script("Facing target", this); player.FaceTarget(); } if (player.DistanceFromTarget() > Core.MaxMeleeDistance) { Output.Instance.Script("Moving towards target", this); player.FaceTarget(); //player.MoveToTarget(Core.MinMeleeDistance); var mts = new MoveToState(player.CurTarget.Location, Core.MinMeleeDistance); CallChangeStateEvent(player, mts, true, false); return; } if (player.IsMoving() && player.DistanceFromTarget() < Core.MaxMeleeDistance && player.DistanceFromTarget() > Core.MinMeleeDistance) { Output.Instance.Script("We reached the correct distance to attack. Stopping all movement.", this); player.Stop(); } if (player.DistanceFromTarget() < Core.MinMeleeDistance) { Output.Instance.Script("We are too close to the mob, let's take a step back", this); player.MoveBackward(300); } if (!player.IsAttacking()) { Output.Instance.Script("We're not yet attacking but we should. Let's do this!", this); player.AttackTarget(); } if (player.HpPct <= Core.HpPctEmergency) { Output.Instance.Script("We're about to die. Time to perform the Emergency routine", this); Core.Emergency(player); } if (player.HpPct <= Core.HpPctPotion && Core.HasHealthPotion()) { Output.Instance.Script("We're still dying.. but we have a health potion to use! weee! :D", this); player.SpellStopCasting(); // TODO: implement a function to select the best health potion and drink it //player.TakePotion("HP"); } if (player.MpPct <= Core.MpPctPotion && Core.HasManaPotion()) { Output.Instance.Script("We're low on mana but we do have a mana potion, let's use it!", this); player.SpellStopCasting(); // TODO: implement a function to select the best mana potion and drink it //player.TakePotion("MP"); } if (player.HpPct <= Core.HpHammer && player.MpPct > 5 && player.HpPct >= Core.HpPctEmergency && player.CanCast("Hammer of Justice")) { Output.Instance.Script("We can use Hammer Of Justice, let's do it.", this); player.CastSpellByName("Hammer of Justice", true); if (player.TargetHpPct > 10) { Core.HealSystem(player); Output.Instance.Script("Hammer of Justice healing", this); return; } return; } // TODO: implement IsBeingAttackedByManyMobs by going through all the mobs who have aggro on us and are in range /* if (player.IsBeingAttackedByManyMobs()) { if (player.CanCast(multiAura)) { player.CastSpellByName(multiAura); } if (player.CanCast("Consecration")) { player.CastSpellByName("Consecration"); } } */ // TODO: implement TargetIsCasting() /* if (player.TargetIsCasting()) { CastInterruption(); } */ if (player.TargetHpPct <= 20) { FinalFight(); } else { NormalFight(); } // TODO: implement TargetCreatureType() /* if (useExorcism) { if (player.MpPct > 30 && player.TargetHpPct > exorcismHp && player.CanCast("Exorcism") && player.TargetCreatureType() == "Undead" || player.TargetCreatureType() == "Demon") { player.CastSpellByName("Exorcism"); } } */ if (Core.combatDebuff) { Output.Instance.Script("Debuffing.", this); Core.DebuffAll(); } // TODO: implement reading of the player race /* if (player.Race() == "Blood Elf") { if (player.Buff("Mana Tap").Application > 0 && player.MpPct <= 20) { player.SpellStopCasting(); player.CastSpellByName("Arcane Torrent"); } if (player.TargetMpPct > 0 && player.IsActionUsable("Mana Tap") && player.Buff("Mana Tap").Application < 3) { player.CastSpellByName("Mana Tap"); } } */ }
public override bool acceptMessageData(BinaryReader messageDataReader, TreeView outputTreeView) { bool handled = true; PacketOpcode opcode = Util.readOpcode(messageDataReader); switch (opcode) { // TODO: PacketOpcode.Evt_Movement__PositionAndMovement_ID case PacketOpcode.Evt_Movement__Jump_ID: { Jump message = Jump.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; } case PacketOpcode.Evt_Movement__MoveToState_ID: { MoveToState message = MoveToState.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; } case PacketOpcode.Evt_Movement__DoMovementCommand_ID: { DoMovementCommand message = DoMovementCommand.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; } // TODO: PacketOpcode.Evt_Movement__TurnEvent_ID // TODO: PacketOpcode.Evt_Movement__TurnToEvent_ID case PacketOpcode.Evt_Movement__StopMovementCommand_ID: { StopMovementCommand message = StopMovementCommand.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; } case PacketOpcode.Evt_Movement__UpdatePosition_ID: { UpdatePosition message = UpdatePosition.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; } case PacketOpcode.Evt_Movement__MovementEvent_ID: { MovementEvent message = MovementEvent.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; } case PacketOpcode.Evt_Movement__AutonomyLevel_ID: { AutonomyLevel message = AutonomyLevel.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; } case PacketOpcode.Evt_Movement__AutonomousPosition_ID: { AutonomousPosition message = AutonomousPosition.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; } case PacketOpcode.Evt_Movement__Jump_NonAutonomous_ID: { Jump_NonAutonomous message = Jump_NonAutonomous.read(messageDataReader); message.contributeToTreeView(outputTreeView); break; } default: { handled = false; break; } } return(handled); }