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); } }
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(); }
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(); } }
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); } }
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(); } } }
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(); } }
private void HandleMovement(WowUnit target) { // we cant move to a null target if (target == null) { return; } // perform a facing check every 250ms, should be enough if (target.Guid != ObjectManager.PlayerGuid && !BotMath.IsFacing(ObjectManager.Player.Position, ObjectManager.Player.Rotation, target.Position) && DateTime.Now - LastRotationCheck > TimeSpan.FromMilliseconds(250)) { HookManager.FacePosition(ObjectManager.Player, target.Position); CharacterManager.Face(target.Position, target.Guid); LastRotationCheck = DateTime.Now; } // we don't want to move when we are casting or channeling something if (ObjectManager.Player.CurrentlyCastingSpellId > 0 || ObjectManager.Player.CurrentlyChannelingSpellId > 0) { return; } // if we are close enough, stop movement and start attacking double distance = ObjectManager.Player.Position.GetDistance2D(target.Position); if (distance <= DistanceToTarget) { // do we need to stop movement HookManager.StopClickToMove(ObjectManager.Player); } else { MovementEngine.SetState(MovementEngineState.Chasing, target.Position); MovementEngine.Execute(); } }