Ejemplo n.º 1
0
        public void Execute()
        {
            Combat();

            IWowGameobject FlagNode = Bot.Objects.All
                                      .OfType <IWowGameobject>()
                                      .Where(x => Enum.IsDefined(typeof(Flags), x.DisplayId) &&
                                             x.Position.GetDistance(Bot.Player.Position) < 15)
                                      .OrderBy(x => x.Position.GetDistance(Bot.Player.Position))
                                      .FirstOrDefault();

            if (FlagNode != null)
            {
                Bot.Movement.SetMovementAction(MovementAction.Move, FlagNode.Position);

                if (Bot.Player.Position.GetDistance(FlagNode.Position) <= 4)
                {
                    Bot.Movement.StopMovement();

                    if (CaptureFlagEvent.Run())
                    {
                        Bot.Wow.InteractWithObject(FlagNode);
                    }
                }
                else
                {
                    Bot.Movement.SetMovementAction(MovementAction.Move, FlagNode.Position);
                }
            }
            else
            {
                if (Bot.Wow.ExecuteLuaAndRead(BotUtils.ObfuscateLua("{v:0}=\"\" for i = 1, GetNumMapLandmarks(), 1 do base, status = GetMapLandmarkInfo(i) {v:0}= {v:0}..base..\":\"..status..\";\" end"), out string result))
                {
                    Vector3  currentNode = PathBase[CurrentNodeCounter];
                    string[] AllBaseList = result.Split(';');

                    if (Bot.Player.HasBuffById(34976))
                    {
                        if (AllBaseList[CurrentNodeCounter].Contains(FactionFlagState))
                        {
                            Bot.Movement.SetMovementAction(MovementAction.Move, currentNode);
                        }
                        else
                        {
                            ++CurrentNodeCounter;
                            if (CurrentNodeCounter >= PathBase.Count)
                            {
                                CurrentNodeCounter = 0;
                            }
                        }
                    }
                    else
                    {
                        if (AllBaseList[CurrentNodeCounter].Contains("Uncontrolled") ||
                            AllBaseList[CurrentNodeCounter].Contains("In Conflict") ||
                            AllBaseList[CurrentNodeCounter].Contains(FactionFlagState))
                        {
                            Bot.Movement.SetMovementAction(MovementAction.Move, currentNode);
                        }

                        if (Bot.Player.Position.GetDistance(currentNode) < 10.0f)
                        {
                            ++CurrentNodeCounter;

                            if (CurrentNodeCounter >= PathBase.Count)
                            {
                                CurrentNodeCounter = 0;
                            }
                        }
                        else if (FactionFlagState != null && AllBaseList[CurrentNodeCounter].Contains(FactionFlagState))
                        {
                            ++CurrentNodeCounter;
                            if (CurrentNodeCounter >= PathBase.Count)
                            {
                                CurrentNodeCounter = 0;
                            }
                        }
                        else if (FlagNode != null)
                        {
                            IEnumerable <IWowPlayer> enemiesNearFlag   = Bot.GetNearEnemies <IWowPlayer>(FlagNode.Position, 40);
                            IEnumerable <IWowPlayer> friendsNearFlag   = Bot.GetNearFriends <IWowPlayer>(FlagNode.Position, 40);
                            IEnumerable <IWowPlayer> friendsNearPlayer = Bot.GetNearFriends <IWowPlayer>(Bot.Player.Position, 20);

                            if (enemiesNearFlag != null)
                            {
                                if (enemiesNearFlag.Count() >= 2)
                                {
                                    if (friendsNearFlag != null && (friendsNearFlag.Any() || friendsNearPlayer.Any()))
                                    {
                                        Bot.Movement.SetMovementAction(MovementAction.Move, currentNode);
                                        return;
                                    }
                                }
                                else
                                {
                                    Bot.Movement.SetMovementAction(MovementAction.Move, currentNode);
                                    return;
                                }
                            }
                        }
                        else
                        {
                            Bot.Movement.SetMovementAction(MovementAction.Move, currentNode);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void Execute()
        {
            Combat();

            WowGameobject FlagNode = WowInterface.ObjectManager.WowObjects
                                     .OfType <WowGameobject>()
                                     .Where(x => !FlagsNodelist.Contains((Flags)x.DisplayId) &&
                                            Enum.IsDefined(typeof(Flags), x.DisplayId) &&
                                            x.Position.GetDistance(WowInterface.ObjectManager.Player.Position) < 15)
                                     .OrderBy(x => x.Position.GetDistance(WowInterface.ObjectManager.Player.Position))
                                     .FirstOrDefault();

            if (FlagNode != null)
            {
                WowInterface.MovementEngine.SetMovementAction(MovementAction.Move, FlagNode.Position);

                if (WowInterface.ObjectManager.Player.Position.GetDistance(FlagNode.Position) <= 4)
                {
                    WowInterface.MovementEngine.StopMovement();

                    if (CaptureFlagEvent.Run())
                    {
                        WowInterface.HookManager.WowObjectRightClick(FlagNode);
                    }
                }
                else
                {
                    WowInterface.MovementEngine.SetMovementAction(MovementAction.Move, FlagNode.Position);
                }
            }
            else
            {
                if (WowInterface.HookManager.WowExecuteLuaAndRead(BotUtils.ObfuscateLua("{v:0}=\"\" for i = 1, GetNumMapLandmarks(), 1 do base, status = GetMapLandmarkInfo(i) {v:0}= {v:0}..base..\":\"..status..\";\" end"), out string result))
                {
                    //AmeisenLogger.I.Log("KAMEL_DEBUG", $"time result: {result}");

                    string[] AllBaseList = result.Split(';');

                    Vector3 currentNode = Path[CurrentNodeCounter];

                    if (AllBaseList[CurrentNodeCounter].Contains("Uncontrolled") ||
                        AllBaseList[CurrentNodeCounter].Contains("In Conflict") ||
                        AllBaseList[CurrentNodeCounter].Contains(factionFlagState))
                    {
                        WowInterface.MovementEngine.SetMovementAction(MovementAction.Move, currentNode);
                    }

                    if (WowInterface.Player.Position.GetDistance(currentNode) < 10.0f)
                    {
                        ++CurrentNodeCounter;

                        if (CurrentNodeCounter >= Path.Count)
                        {
                            CurrentNodeCounter = 0;
                        }
                    }
                    else if (factionFlagState != null && AllBaseList[CurrentNodeCounter].Contains(factionFlagState))
                    {
                        ++CurrentNodeCounter;
                        if (CurrentNodeCounter >= Path.Count)
                        {
                            CurrentNodeCounter = 0;
                        }
                    }
                    else if (FlagNode != null)
                    {
                        IEnumerable <WowPlayer> enemiesNearFlag   = WowInterface.ObjectManager.GetNearEnemies <WowPlayer>(FlagNode.Position, 40);
                        IEnumerable <WowPlayer> friendsNearFlag   = WowInterface.ObjectManager.GetNearFriends <WowPlayer>(FlagNode.Position, 40);
                        IEnumerable <WowPlayer> friendsNearPlayer = WowInterface.ObjectManager.GetNearFriends <WowPlayer>(WowInterface.ObjectManager.Player.Position, 20);

                        if (enemiesNearFlag != null)
                        {
                            if (enemiesNearFlag.Count() >= 2)
                            {
                                if (friendsNearFlag != null && (friendsNearFlag.Count() >= 1 || friendsNearPlayer.Count() >= 1))
                                {
                                    WowInterface.MovementEngine.SetMovementAction(MovementAction.Move, currentNode);
                                    return;
                                }
                            }
                            else
                            {
                                WowInterface.MovementEngine.SetMovementAction(MovementAction.Move, currentNode);
                                return;
                            }
                        }
                    }
                    else
                    {
                        WowInterface.MovementEngine.SetMovementAction(MovementAction.Move, currentNode);
                    }
                }
            }
        }