Пример #1
0
        public void Execute()
        {
            ulong   targetGuid = ObjectManager.TargetGuid;
            WowUnit target     = ObjectManager.WowObjects.OfType <WowUnit>().FirstOrDefault(t => t.Guid == targetGuid);

            SearchNewTarget(ref target, false);
            if (target != null)
            {
                bool targetDistanceChanged = false;
                if (!LastPlayerPosition.Equals(ObjectManager.Player.Position))
                {
                    LastPlayerPosition    = new Vector3(ObjectManager.Player.Position.X, ObjectManager.Player.Position.Y, ObjectManager.Player.Position.Z);
                    targetDistanceChanged = true;
                }
                if (!LastTargetPosition.Equals(target.Position))
                {
                    hasTargetMoved        = true;
                    LastTargetPosition    = new Vector3(target.Position.X, target.Position.Y, target.Position.Z);
                    targetDistanceChanged = true;
                }
                else if (hasTargetMoved)
                {
                    hasTargetMoved  = false;
                    computeNewRoute = true;
                }
                if (targetDistanceChanged)
                {
                    distanceToTarget = LastPlayerPosition.GetDistance2D(LastTargetPosition);
                    Console.WriteLine("distanceToTarget: " + distanceToTarget);
                }
                HandleMovement(target);
                HandleAttacking(target);
            }
        }
Пример #2
0
        public void Execute()
        {
            computeNewRoute = false;
            WowUnit target = WowInterface.ObjectManager.Target;

            if ((WowInterface.ObjectManager.TargetGuid != 0 && target != null && !(target.IsDead || target.Health < 1)) || SearchNewTarget(ref target, false))
            {
                bool targetDistanceChanged = false;
                if (!LastPlayerPosition.Equals(WowInterface.ObjectManager.Player.Position))
                {
                    LastPlayerPosition    = new Vector3(WowInterface.ObjectManager.Player.Position.X, WowInterface.ObjectManager.Player.Position.Y, WowInterface.ObjectManager.Player.Position.Z);
                    targetDistanceChanged = true;
                }

                if (!LastTargetPosition.Equals(target.Position))
                {
                    computeNewRoute       = true;
                    LastTargetPosition    = new Vector3(target.Position.X, target.Position.Y, target.Position.Z);
                    targetDistanceChanged = true;
                }

                if (targetDistanceChanged)
                {
                    distanceToTarget = LastPlayerPosition.GetDistance(LastTargetPosition);
                }

                HandleMovement(target);
                HandleAttacking(target);
            }
            WowInterface.Globals.ForceCombat = false;
        }
Пример #3
0
        public void OutOfCombatExecute()
        {
            double distanceTraveled = WowInterface.ObjectManager.Player.Position.GetDistance(LastPlayerPosition);

            computeNewRoute = false;
            if (!LastPlayerPosition.Equals(WowInterface.ObjectManager.Player.Position))
            {
                distanceTraveled   = WowInterface.ObjectManager.Player.Position.GetDistance(LastPlayerPosition);
                LastPlayerPosition = new Vector3(WowInterface.ObjectManager.Player.Position.X, WowInterface.ObjectManager.Player.Position.Y, WowInterface.ObjectManager.Player.Position.Z);
            }

            if (distanceTraveled < 0.001)
            {
                ulong   leaderGuid = WowInterface.ObjectManager.PartyleaderGuid;
                WowUnit target     = WowInterface.ObjectManager.Target;
                WowUnit leader     = null;
                if (leaderGuid != 0)
                {
                    leader = WowInterface.ObjectManager.GetWowObjectByGuid <WowUnit>(leaderGuid);
                }

                if (leaderGuid != 0 && leaderGuid != WowInterface.ObjectManager.PlayerGuid && leader != null && !(leader.IsDead || leader.Health < 1))
                {
                    WowInterface.MovementEngine.SetMovementAction(Movement.Enums.MovementAction.Move, WowInterface.ObjectManager.GetWowObjectByGuid <WowUnit>(leaderGuid).Position);
                }
                else if ((WowInterface.ObjectManager.TargetGuid != 0 && target != null && !(target.IsDead || target.Health < 1)) || SearchNewTarget(ref target, true))
                {
                    if (!LastTargetPosition.Equals(target.Position))
                    {
                        computeNewRoute    = true;
                        LastTargetPosition = new Vector3(target.Position.X, target.Position.Y, target.Position.Z);
                        distanceToTarget   = LastPlayerPosition.GetDistance(LastTargetPosition);
                    }

                    Dancing = false;
                    HandleMovement(target);
                    WowInterface.Globals.ForceCombat = true;
                    HandleAttacking(target);
                }
                else if (!Dancing || standing)
                {
                    standing = false;
                    WowInterface.HookManager.WowClearTarget();
                    WowInterface.HookManager.LuaSendChatMessage(standingEmotes[new Random().Next(standingEmotes.Length)]);
                    Dancing = true;
                }
            }
            else
            {
                if (!Dancing || !standing)
                {
                    standing = true;
                    WowInterface.HookManager.WowClearTarget();
                    WowInterface.HookManager.LuaSendChatMessage(runningEmotes[new Random().Next(runningEmotes.Length)]);
                    Dancing = true;
                }
            }
        }
Пример #4
0
        public void OutOfCombatExecute()
        {
            computeNewRoute = false;
            List <string> buffs = WowInterface.ObjectManager.Player.Auras.Select(e => e.Name).ToList();

            if (!buffs.Any(e => e.Contains("tealth")))
            {
                WowInterface.HookManager.LuaCastSpell("Stealth");
                spells.ResetAfterTargetDeath();
            }

            if (!LastPlayerPosition.Equals(WowInterface.ObjectManager.Player.Position))
            {
                distanceTraveled   = WowInterface.ObjectManager.Player.Position.GetDistance(LastPlayerPosition);
                LastPlayerPosition = new Vector3(WowInterface.ObjectManager.Player.Position.X, WowInterface.ObjectManager.Player.Position.Y, WowInterface.ObjectManager.Player.Position.Z);
            }

            if (distanceTraveled < 0.001)
            {
                ulong   leaderGuid = WowInterface.ObjectManager.PartyleaderGuid;
                WowUnit target     = WowInterface.ObjectManager.Target;
                if ((WowInterface.ObjectManager.TargetGuid != 0 && target != null && !(target.IsDead || target.Health < 1)) || SearchNewTarget(ref target, true))
                {
                    if (!LastTargetPosition.Equals(target.Position))
                    {
                        computeNewRoute          = true;
                        LastTargetPosition       = new Vector3(target.Position.X, target.Position.Y, target.Position.Z);
                        LastBehindTargetPosition = BotMath.CalculatePositionBehind(target.Position, target.Rotation, 5f);
                        distanceToTarget         = LastPlayerPosition.GetDistance(LastTargetPosition);
                        distanceToBehindTarget   = LastPlayerPosition.GetDistance(LastBehindTargetPosition);
                    }

                    Dancing = false;
                    HandleMovement(target);
                    WowInterface.Globals.ForceCombat = true;
                    HandleAttacking(target);
                }
                else if (!Dancing || standing)
                {
                    standing = false;
                    WowInterface.HookManager.WowClearTarget();
                    WowInterface.HookManager.LuaSendChatMessage(standingEmotes[new Random().Next(standingEmotes.Length)]);
                    Dancing = true;
                }
            }
            else
            {
                if (!Dancing || !standing)
                {
                    standing = true;
                    WowInterface.HookManager.WowClearTarget();
                    Dancing = true;
                }
            }
        }
Пример #5
0
        public void Execute()
        {
            computeNewRoute = false;
            WowUnit target = WowInterface.ObjectManager.Target;

            if ((WowInterface.ObjectManager.TargetGuid != 0 && target != null && !(target.IsDead || target.Health < 1)) || SearchNewTarget(ref target, false))
            {
                Dancing = false;
                bool targetDistanceChanged = false;
                if (!LastPlayerPosition.Equals(WowInterface.ObjectManager.Player.Position))
                {
                    distanceTraveled      = WowInterface.ObjectManager.Player.Position.GetDistance(LastPlayerPosition);
                    LastPlayerPosition    = new Vector3(WowInterface.ObjectManager.Player.Position.X, WowInterface.ObjectManager.Player.Position.Y, WowInterface.ObjectManager.Player.Position.Z);
                    targetDistanceChanged = true;
                }

                if (LastTargetRotation != target.Rotation)
                {
                    computeNewRoute    = true;
                    LastTargetRotation = target.Rotation;
                }

                if (!LastTargetPosition.Equals(target.Position))
                {
                    computeNewRoute          = true;
                    LastTargetPosition       = new Vector3(target.Position.X, target.Position.Y, target.Position.Z);
                    LastBehindTargetPosition = BotMath.CalculatePositionBehind(target.Position, target.Rotation, 3f);
                    targetDistanceChanged    = true;
                }

                if (targetDistanceChanged)
                {
                    distanceToTarget       = LastPlayerPosition.GetDistance(LastTargetPosition);
                    distanceToBehindTarget = LastPlayerPosition.GetDistance(LastBehindTargetPosition);
                }

                HandleMovement(target);
                HandleAttacking(target);
            }
            else if (!Dancing)
            {
                if (distanceTraveled < 0.001)
                {
                    WowInterface.HookManager.WowClearTarget();
                    WowInterface.HookManager.LuaSendChatMessage(standingEmotes[new Random().Next(standingEmotes.Length)]);
                    Dancing = true;
                    WowInterface.Globals.ForceCombat = false;
                }
                else
                {
                    WowInterface.HookManager.WowClearTarget();
                    Dancing = true;
                }
            }
        }
Пример #6
0
        public void OutOfCombatExecute()
        {
            if (!HookManager.GetBuffs(WowLuaUnit.Player).Any(e => e.Contains("tealth")))
            {
                HookManager.CastSpell("Stealth");
                spells.ResetAfterTargetDeath();
            }

            if (!LastPlayerPosition.Equals(ObjectManager.Player.Position))
            {
                distanceTraveled   = ObjectManager.Player.Position.GetDistance(LastPlayerPosition);
                LastPlayerPosition = new Vector3(ObjectManager.Player.Position.X, ObjectManager.Player.Position.Y, ObjectManager.Player.Position.Z);
            }

            if (distanceTraveled < 0.001)
            {
                ulong   leaderGuid = ObjectManager.PartyleaderGuid;
                WowUnit target     = null;
                if (leaderGuid == ObjectManager.PlayerGuid && SearchNewTarget(ref target, true))
                {
                    if (!LastTargetPosition.Equals(target.Position))
                    {
                        hasTargetMoved     = true;
                        LastTargetPosition = new Vector3(target.Position.X, target.Position.Y, target.Position.Z);
                        distanceToTarget   = LastPlayerPosition.GetDistance(LastTargetPosition);
                    }
                    else
                    {
                        computeNewRoute = true;
                        hasTargetMoved  = false;
                    }

                    Dancing = false;
                    HandleMovement(target);
                    HandleAttacking(target);
                }
                else if (!Dancing || standing)
                {
                    standing = false;
                    HookManager.ClearTarget();
                    HookManager.SendChatMessage(standingEmotes[new Random().Next(standingEmotes.Length)]);
                    Dancing = true;
                }
            }
            else
            {
                if (!Dancing || !standing)
                {
                    standing = true;
                    HookManager.ClearTarget();
                    HookManager.SendChatMessage(runningEmotes[new Random().Next(runningEmotes.Length)]);
                    Dancing = true;
                }
            }
        }
Пример #7
0
        public void Execute()
        {
            ulong targetGuid = ObjectManager.TargetGuid;

            /*Character.Inventory.Objects.IWowItem weapon;
             * if(CharacterManager.Equipment.Equipment.TryGetValue(Character.Inventory.Enums.EquipmentSlot.INVSLOT_MAINHAND, out weapon))
             * {
             *  if(mainhandSpeed != 1 && weapon != null && weapon.Stats != null && weapon.Stats.Keys != null)
             *  {
             *      foreach (string stat in weapon.Stats.Keys)
             *      {
             *          Console.WriteLine(stat);
             *          mainhandSpeed = 1;
             *      }
             *  }
             *  //mainhandSpeed = weapon.Stats["ITEM_MOD_SPEED_SHORT"];
             * }*/
            WowUnit target = ObjectManager.WowObjects.OfType <WowUnit>().FirstOrDefault(t => t.Guid == targetGuid);

            SearchNewTarget(ref target, false);
            if (target != null)
            {
                bool targetDistanceChanged = false;
                if (!LastPlayerPosition.Equals(ObjectManager.Player.Position))
                {
                    distanceTraveled      = ObjectManager.Player.Position.GetDistance(LastPlayerPosition);
                    LastPlayerPosition    = new Vector3(ObjectManager.Player.Position.X, ObjectManager.Player.Position.Y, ObjectManager.Player.Position.Z);
                    targetDistanceChanged = true;
                }

                if (!LastTargetPosition.Equals(target.Position))
                {
                    hasTargetMoved        = true;
                    LastTargetPosition    = new Vector3(target.Position.X, target.Position.Y, target.Position.Z);
                    targetDistanceChanged = true;
                }
                else if (hasTargetMoved)
                {
                    hasTargetMoved  = false;
                    computeNewRoute = true;
                }

                if (targetDistanceChanged)
                {
                    distanceToTarget = LastPlayerPosition.GetDistance(LastTargetPosition);
                }

                HandleMovement(target);
                HandleAttacking(target);
            }
        }
Пример #8
0
 public void OutOfCombatExecute()
 {
     if (!LastPlayerPosition.Equals(ObjectManager.Player.Position))
     {
         distanceTraveled   = ObjectManager.Player.Position.GetDistance2D(LastPlayerPosition);
         LastPlayerPosition = new Vector3(ObjectManager.Player.Position.X, ObjectManager.Player.Position.Y, ObjectManager.Player.Position.Z);
     }
     if (distanceTraveled < 0.001)
     {
         ulong   leaderGuid = ObjectManager.ReadPartyLeaderGuid();
         WowUnit target     = null;
         if (leaderGuid == ObjectManager.PlayerGuid && SearchNewTarget(ref target, true))
         {
             if (!LastTargetPosition.Equals(target.Position))
             {
                 hasTargetMoved     = true;
                 LastTargetPosition = new Vector3(target.Position.X, target.Position.Y, target.Position.Z);
                 distanceToTarget   = LastPlayerPosition.GetDistance2D(LastTargetPosition);
             }
             else
             {
                 computeNewRoute = true;
                 hasTargetMoved  = false;
             }
             Dancing = false;
             HandleMovement(target);
             HandleAttacking(target);
         }
         else if (!Dancing || standing)
         {
             standing = false;
             HookManager.ClearTarget();
             HookManager.SendChatMessage(standingEmotes[new Random().Next(standingEmotes.Length)]);
             Dancing = true;
         }
     }
     else
     {
         if (!Dancing || !standing)
         {
             standing = true;
             HookManager.ClearTarget();
             HookManager.SendChatMessage(runningEmotes[new Random().Next(runningEmotes.Length)]);
             Dancing = true;
         }
     }
 }
Пример #9
0
        public void OutOfCombatExecute()
        {
            if (!LastPlayerPosition.Equals(ObjectManager.Player.Position))
            {
                distanceTraveled   = ObjectManager.Player.Position.GetDistance(LastPlayerPosition);
                LastPlayerPosition = new Vector3(ObjectManager.Player.Position.X, ObjectManager.Player.Position.Y, ObjectManager.Player.Position.Z);
            }

            if (distanceTraveled < 0.001)
            {
                ulong   leaderGuid = ObjectManager.PartyleaderGuid;
                WowUnit target     = null;
                if (leaderGuid == ObjectManager.PlayerGuid && SearchNewTarget(ref target, true))
                {
                    if (!LastTargetPosition.Equals(target.Position))
                    {
                        hasTargetMoved     = true;
                        LastTargetPosition = new Vector3(target.Position.X, target.Position.Y, target.Position.Z);
                        distanceToTarget   = LastPlayerPosition.GetDistance(LastTargetPosition);
                    }
                    else
                    {
                        computeNewRoute = true;
                        hasTargetMoved  = false;
                    }

                    HandleMovement(target);
                    HandleAttacking(target);
                }
                else if (!Dancing)
                {
                    HookManager.ClearTarget();
                    HookManager.SendChatMessage("/dance");
                    Dancing = true;
                }
            }
            else
            {
                Dancing = false;
            }
        }
Пример #10
0
        public void Execute()
        {
            ulong targetGuid = ObjectManager.TargetGuid;

            /*Character.Inventory.Objects.IWowItem weapon;
             * if(CharacterManager.Equipment.Equipment.TryGetValue(Character.Inventory.Enums.EquipmentSlot.INVSLOT_MAINHAND, out weapon))
             * {
             *  if(mainhandSpeed != 1 && weapon != null && weapon.Stats != null && weapon.Stats.Keys != null)
             *  {
             *      foreach (string stat in weapon.Stats.Keys)
             *      {
             *          Console.WriteLine(stat);
             *          mainhandSpeed = 1;
             *      }
             *  }
             *  //mainhandSpeed = weapon.Stats["ITEM_MOD_SPEED_SHORT"];
             * }*/
            WowUnit target = ObjectManager.WowObjects.OfType <WowUnit>().FirstOrDefault(t => t.Guid == targetGuid);

            SearchNewTarget(ref target, false);
            if (target != null)
            {
                Dancing = false;
                bool targetDistanceChanged = false;
                if (!LastPlayerPosition.Equals(ObjectManager.Player.Position))
                {
                    distanceTraveled      = ObjectManager.Player.Position.GetDistance2D(LastPlayerPosition);
                    LastPlayerPosition    = new Vector3(ObjectManager.Player.Position.X, ObjectManager.Player.Position.Y, ObjectManager.Player.Position.Z);
                    targetDistanceChanged = true;
                }
                if (LastTargetRotation != target.Rotation)
                {
                    hasTargetMoved     = true;
                    LastTargetRotation = target.Rotation;
                }
                if (!LastTargetPosition.Equals(target.Position))
                {
                    hasTargetMoved           = true;
                    LastTargetPosition       = new Vector3(target.Position.X, target.Position.Y, target.Position.Z);
                    LastBehindTargetPosition = new Vector3(LastTargetPosition.X - (9 * (float)Math.Cos(LastTargetRotation)), LastTargetPosition.Y, LastTargetPosition.Z - (9 * (float)Math.Sin(LastTargetRotation)));
                    targetDistanceChanged    = true;
                }
                else if (hasTargetMoved)
                {
                    hasTargetMoved  = false;
                    computeNewRoute = true;
                }
                if (targetDistanceChanged)
                {
                    distanceToTarget       = LastPlayerPosition.GetDistance2D(LastTargetPosition);
                    distanceToBehindTarget = LastPlayerPosition.GetDistance2D(LastBehindTargetPosition);
                }
                HandleMovement(target);
                HandleAttacking(target);
            }
            else if (!Dancing)
            {
                if (distanceTraveled < 0.001)
                {
                    HookManager.ClearTarget();
                    HookManager.SendChatMessage(standingEmotes[new Random().Next(standingEmotes.Length)]);
                    Dancing = true;
                }
                else
                {
                    HookManager.ClearTarget();
                    HookManager.SendChatMessage(runningEmotes[new Random().Next(runningEmotes.Length)]);
                    Dancing = true;
                }
            }
        }