예제 #1
0
 public void Faction()
 {
     if (WowInterface.ObjectManager.Player.IsHorde())
     {
         faction          = true;
         factionFlagState = "Alliance Controlled";
         FlagsNodelist.Add(Flags.HordFlags);
         FlagsNodelist.Add(Flags.HordFlagsAktivate);
     }
     else
     {
         faction          = false;
         factionFlagState = "Hord Controlled";
         FlagsNodelist.Add(Flags.AlliFlags);
         FlagsNodelist.Add(Flags.AlliFlagsAktivate);
     }
 }
예제 #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);
                    }
                }
            }
        }