Beispiel #1
0
        public override void Execute()
        {
            if (HookManager.GetFreeBagSlotCount() > 4 ||
                !CharacterManager.Inventory.Items.Any(e => e.Price > 0))
            {
                AmeisenBotStateMachine.SetState(AmeisenBotState.Idle);
                return;
            }

            WowUnit selectedUnit = ObjectManager.WowObjects.OfType <WowUnit>()
                                   .OrderBy(e => e.Position.GetDistance(ObjectManager.Player.Position))
                                   .FirstOrDefault(e => e.GetType() != typeof(WowPlayer) && e.IsRepairVendor && e.Position.GetDistance(ObjectManager.Player.Position) < 50);

            if (selectedUnit != null && !selectedUnit.IsDead)
            {
                double distance = ObjectManager.Player.Position.GetDistance(selectedUnit.Position);
                if (distance > 5.0)
                {
                    MovementEngine.SetState(MovementEngineState.Moving, selectedUnit.Position);
                    MovementEngine.Execute();
                }
                else
                {
                    if (distance > 4)
                    {
                        CharacterManager.InteractWithUnit(selectedUnit, 20.9f, 2f);
                    }
                    else
                    {
                        HookManager.RightClickUnit(selectedUnit);
                        Task.Delay(1000).GetAwaiter().GetResult();

                        HookManager.SellAllGrayItems();
                        foreach (IWowItem item in CharacterManager.Inventory.Items.Where(e => e.Price > 0))
                        {
                            IWowItem itemToSell = item;
                            if (CharacterManager.IsItemAnImprovement(item, out IWowItem itemToReplace))
                            {
                                itemToSell = itemToReplace;
                                HookManager.ReplaceItem(null, item);
                            }

                            HookManager.UseItemByBagAndSlot(itemToSell.BagId, itemToSell.BagSlot);
                        }
                    }
                }
            }
            else
            {
                AmeisenBotStateMachine.SetState(AmeisenBotState.Idle);
            }
        }
Beispiel #2
0
        public override void Execute()
        {
            if (XMemory.Process != null && XMemory.Process.HasExited)
            {
                AmeisenBotStateMachine.SetState(AmeisenBotState.None);
            }

            ObjectManager.RefreshIsWorldLoaded();
            if (ObjectManager.IsWorldLoaded)
            {
                AmeisenBotStateMachine.SetState(AmeisenBotState.Idle);
            }
        }
Beispiel #3
0
 public override void Enter()
 {
     if (Config.AutostartWow)
     {
         AmeisenBotStateMachine.SetState(AmeisenBotState.StartWow);
     }
     else if (Config.AutoLogin)
     {
         AmeisenBotStateMachine.SetState(AmeisenBotState.Login);
     }
     else
     {
         AmeisenBotStateMachine.SetState(AmeisenBotState.Idle);
     }
 }
Beispiel #4
0
 public override void Execute()
 {
     if (ObjectManager.Player.IsDead)
     {
         HookManager.ReleaseSpirit();
     }
     else if (HookManager.IsGhost("player"))
     {
         AmeisenBotStateMachine.SetState(AmeisenBotState.Ghost);
     }
     else
     {
         AmeisenBotStateMachine.SetState(AmeisenBotState.Idle);
     }
 }
Beispiel #5
0
 public override void Execute()
 {
     if (LoginHandler.Login(AmeisenBotStateMachine.XMemory.Process, Config.Username, Config.Password, Config.CharacterSlot))
     {
         if (AmeisenBotStateMachine.XMemory.Read(OffsetList.ChatOpened, out byte isChatOpened) &&
             isChatOpened == 0x1)
         {
             // send enter to close the chat lmao
             BotUtils.SendKey(AmeisenBotStateMachine.XMemory.Process.MainWindowHandle, new IntPtr(0x0D));
         }
         else
         {
             AmeisenBotStateMachine.SetState(AmeisenBotState.Idle);
         }
     }
 }
Beispiel #6
0
        public override void Execute()
        {
            if (WowProcess.HasExited)
            {
                AmeisenBotStateMachine.SetState(AmeisenBotState.None);
                return;
            }

            if (Config.AutoLogin)
            {
                AmeisenBotStateMachine.SetState(AmeisenBotState.Login);
            }
            else
            {
                AmeisenBotStateMachine.SetState(AmeisenBotState.Idle);
            }
        }
Beispiel #7
0
        public override void Execute()
        {
            ObjectManager.UpdateObject(PlayerToFollow.Type, PlayerToFollow.BaseAddress);
            double distance = PlayerToFollow.Position.GetDistance(ObjectManager.Player.Position);

            if (distance < Config.MinFollowDistance || distance > Config.MaxFollowDistance)
            {
                AmeisenBotStateMachine.SetState(AmeisenBotState.Idle);
            }

            if (ObjectManager.Player.CurrentlyCastingSpellId > 0 || ObjectManager.Player.CurrentlyChannelingSpellId > 0)
            {
                return;
            }

            MovementEngine.SetState(MovementEngineState.Following, PlayerToFollow.Position);
            MovementEngine.Execute();
        }
Beispiel #8
0
        public override void Execute()
        {
            if (ObjectManager.Player.Health > 1)
            {
                AmeisenBotStateMachine.SetState(AmeisenBotState.Idle);
            }

            if (AmeisenBotStateMachine.XMemory.ReadStruct(OffsetList.CorpsePosition, out Vector3 corpsePosition) &&
                ObjectManager.Player.Position.GetDistance(corpsePosition) > 16)
            {
                MovementEngine.SetState(MovementEngineState.Moving, corpsePosition);
                MovementEngine.Execute();
            }
            else
            {
                HookManager.RetrieveCorpse();
            }
        }
Beispiel #9
0
        public override void Execute()
        {
            // do i need to loot units
            if (UnitLootList.Count > 0)
            {
                AmeisenBotStateMachine.SetState(AmeisenBotState.Looting);
                return;
            }

            // do i need to follow someone
            if (IsUnitToFollowThere())
            {
                AmeisenBotStateMachine.SetState(AmeisenBotState.Following);
            }

            // do we need to repair our equipment
            if (DateTime.Now - LastRepairCheck > TimeSpan.FromSeconds(12))
            {
                if (IsRepairNpcNear() &&
                    CharacterManager.Equipment.Equipment.Any(e => ((double)e.Value.MaxDurability / (double)e.Value.Durability) < 0.2))
                {
                    AmeisenBotStateMachine.SetState(AmeisenBotState.Repairing);
                }

                LastRepairCheck = DateTime.Now;
            }

            // do we need to sell stuff
            if (DateTime.Now - LastBagSlotCheck > TimeSpan.FromSeconds(5) &&
                CharacterManager.Inventory.Items.Any(e => e.Price > 0))
            {
                if (IsVendorNpcNear() &&
                    HookManager.GetFreeBagSlotCount() < 4)
                {
                    AmeisenBotStateMachine.SetState(AmeisenBotState.Selling);
                }

                LastBagSlotCheck = DateTime.Now;
            }

            // do buffing etc...
            CombatClass?.OutOfCombatExecute();
        }
Beispiel #10
0
        public override void Execute()
        {
            if (CharacterManager.Equipment.Equipment.Any(e => ((double)e.Value.MaxDurability / (double)e.Value.Durability) > 0.2))
            {
                AmeisenBotStateMachine.SetState(AmeisenBotState.Idle);
                return;
            }

            WowUnit selectedUnit = ObjectManager.WowObjects.OfType <WowUnit>()
                                   .OrderBy(e => e.Position.GetDistance(ObjectManager.Player.Position))
                                   .FirstOrDefault(e => e.GetType() != typeof(WowPlayer) && e.IsRepairVendor && e.Position.GetDistance(ObjectManager.Player.Position) < 50);

            if (selectedUnit != null && !selectedUnit.IsDead)
            {
                double distance = ObjectManager.Player.Position.GetDistance(selectedUnit.Position);
                if (distance > 5.0)
                {
                    MovementEngine.SetState(MovementEngineState.Moving, selectedUnit.Position);
                    MovementEngine.Execute();
                }
                else
                {
                    if (distance > 3)
                    {
                        CharacterManager.InteractWithUnit(selectedUnit, 20.9f, 0.2f);
                    }
                    else
                    {
                        HookManager.RightClickUnit(selectedUnit);
                        Task.Delay(1000).GetAwaiter().GetResult();

                        HookManager.RepairAllItems();
                        HookManager.SellAllGrayItems();
                        Task.Delay(1000).GetAwaiter().GetResult();
                    }
                }
            }
            else
            {
                AmeisenBotStateMachine.SetState(AmeisenBotState.Idle);
            }
        }
Beispiel #11
0
        public override void Execute()
        {
            if (UnitLootList.Count == 0)
            {
                AmeisenBotStateMachine.SetState(AmeisenBotState.Idle);
            }
            else
            {
                if (UnitsAlreadyLootedList.Contains(UnitLootList.Peek()))
                {
                    UnitLootList.Dequeue();
                    return;
                }

                WowUnit selectedUnit = ObjectManager.WowObjects.OfType <WowUnit>().FirstOrDefault(e => e.Guid == UnitLootList.Peek());
                if (selectedUnit != null && selectedUnit.IsDead && selectedUnit.IsLootable)
                {
                    if (ObjectManager.Player.Position.GetDistance(selectedUnit.Position) > 3.0)
                    {
                        MovementEngine.SetState(MovementEngineState.Moving, selectedUnit.Position);
                        MovementEngine.Execute();
                    }
                    else
                    {
                        do
                        {
                            HookManager.RightClickUnit(selectedUnit);
                            LootTryCount++;
                            Task.Delay(500).GetAwaiter().GetResult();
                        } while (AmeisenBotStateMachine.XMemory.ReadByte(OffsetList.LootWindowOpen, out byte lootOpen) &&
                                 lootOpen == 0 &&
                                 LootTryCount < 2);

                        UnitsAlreadyLootedList.Add(UnitLootList.Dequeue());
                    }
                }
                else
                {
                    UnitLootList.Dequeue();
                }
            }
        }
Beispiel #12
0
        public override void Execute()
        {
            if (ObjectManager != null &&
                ObjectManager.Player != null)
            {
                // TODO: exclude friendly spells like Circle of Healing
                WowDynobject aoeSpellObject = ObjectManager.WowObjects.OfType <WowDynobject>()
                                              .FirstOrDefault(e => e.Position.GetDistance2D(ObjectManager.Player.Position) < e.Radius + 1);

                if (aoeSpellObject == null)
                {
                    AmeisenBotStateMachine.SetState(AmeisenBotState.Idle);
                    return;
                }

                Vector3 targetPosition = FindPositionOutsideOfAoeSpell(aoeSpellObject.Position, aoeSpellObject.Radius);

                MovementEngine.SetState(MovementEngineState.Moving, targetPosition);
                MovementEngine.Execute();
            }
        }
Beispiel #13
0
        public override void Enter()
        {
            PlayerToFollow = null;

            // TODO: make this crap less redundant
            // check the specific character
            List <WowPlayer> wowPlayers = ObjectManager.WowObjects.OfType <WowPlayer>().ToList();

            if (wowPlayers.Count > 0)
            {
                if (Config.FollowSpecificCharacter)
                {
                    PlayerToFollow = wowPlayers.FirstOrDefault(p => p.Name == Config.SpecificCharacterToFollow);
                    PlayerToFollow = SkipIfOutOfRange(PlayerToFollow);
                }

                // check the group/raid leader
                if (PlayerToFollow == null && Config.FollowGroupLeader)
                {
                    PlayerToFollow = wowPlayers.FirstOrDefault(p => p.Guid == ObjectManager.PartyleaderGuid);
                    PlayerToFollow = SkipIfOutOfRange(PlayerToFollow);
                }

                // check the group members
                if (PlayerToFollow == null && Config.FollowGroupMembers)
                {
                    PlayerToFollow = wowPlayers.FirstOrDefault(p => ObjectManager.PartymemberGuids.Contains(p.Guid));
                    PlayerToFollow = SkipIfOutOfRange(PlayerToFollow);
                }
            }

            if (PlayerToFollow == null)
            {
                AmeisenBotStateMachine.SetState(AmeisenBotState.Idle);
            }
        }
Beispiel #14
0
        public override void Execute()
        {
            if (!ObjectManager.Player.IsInCombat && !AmeisenBotStateMachine.IsAnyPartymemberInCombat())
            {
                AmeisenBotStateMachine.SetState(AmeisenBotState.Idle);
                return;
            }

            // we can do nothing until the ObjectManager is initialzed
            if (ObjectManager != null &&
                ObjectManager.Player != null)
            {
                // use the default Target selection algorithm if the CombatClass doenst

                // Note: this only works for dps classes, tanks and healers need
                //        to implement their own target selection algorithm
                if (CombatClass == null || !CombatClass.HandlesTargetSelection)
                {
                    // make sure we got both objects refreshed before we check them
                    ObjectManager.UpdateObject(ObjectManager.Player);
                    ObjectManager.UpdateObject(ObjectManager.Target);

                    // do we need to clear our target
                    if (ObjectManager.TargetGuid > 0 &&
                        (ObjectManager.Target.IsDead ||
                         HookManager.GetUnitReaction(ObjectManager.Player, ObjectManager.Target) == WowUnitReaction.Friendly))
                    {
                        HookManager.ClearTarget();
                        ObjectManager.UpdateObject(ObjectManager.Player);
                    }

                    // select a new target if our current target is invalid
                    if ((ObjectManager.TargetGuid == 0 ||
                         (ObjectManager.Target == null || ObjectManager.Target.Guid == ObjectManager.PlayerGuid)) &&
                        SelectTargetToAttack(out WowUnit target))
                    {
                        HookManager.TargetGuid(target.Guid);

                        ObjectManager.UpdateObject(ObjectManager.Player);
                        ObjectManager.UpdateObject(ObjectManager.Target);
                    }
                }

                // use the default MovementEngine to move if the CombatClass doesnt
                if (CombatClass == null || !CombatClass.HandlesMovement)
                {
                    HandleMovement(ObjectManager.Target);
                }

                // if no CombatClass is loaded, just autoattack
                if (CombatClass != null)
                {
                    CombatClass.Execute();
                }
                else
                {
                    if (!ObjectManager.Player.IsAutoAttacking)
                    {
                        HookManager.StartAutoAttack();
                    }
                }
            }

            TryCount = 0;
        }