private async static Task <bool> PoolSafetyChecks(WoWGameObject pool) { if (pool == null || !pool.IsValid) { BotPoi.Clear(); return(true); } if (pool.Guid != _lastVisitedPoolGuid) { _lastVisitedPoolGuid = pool.Guid; TimeAtPoolTimer.Restart(); } // safety check. if spending more than 5 mins at pool than black list it. if (TimeAtPoolTimer.ElapsedMilliseconds >= AutoAnglerSettings.Instance.MaxTimeAtPool * 60000) { Utility.BlacklistPool(pool, TimeSpan.FromMinutes(10), "Spend too much time at pool"); return(true); } // move to another spot if we have too many failed casts if (_castCounter >= AutoAnglerSettings.Instance.MaxFailedCasts) { AutoAnglerBot.Log("Moving to a new fishing location since we have {0} failed casts", _castCounter); _castCounter = 0; RemovePointAtTop(pool); return(true); } return(false); }
private void MailButtonClick(object sender, EventArgs e) { Profile profile = ProfileManager.CurrentProfile; if (profile != null && profile.MailboxManager != null) { Mailbox mailbox = profile.MailboxManager.GetClosestMailbox(); if (mailbox != null) { if (!string.IsNullOrEmpty(CharacterSettings.Instance.MailRecipient)) { BotPoi.Current = new BotPoi(mailbox); AutoAnglerBot.Log("Forced Mail run"); TreeRoot.StatusText = "Doing Mail Run"; } else { AutoAnglerBot.Log("No mail recipient set"); } } else { AutoAnglerBot.Log("Profile has no Mailbox"); } } }
// does nothing if no baits are in bag public async static Task <bool> Applybait() { if (StyxWoW.Me.IsCasting || IsBait) { return(false); } if (!BaitRecastTimer.IsFinished) { return(false); } BaitRecastTimer.Reset(); var mainHand = StyxWoW.Me.Inventory.Equipped.MainHand; if (mainHand == null || mainHand.ItemInfo.WeaponClass != WoWItemWeaponClass.FishingPole) { return(false); } foreach (var baitInBag in GetBaits()) { if (baitInBag != null && baitInBag.Use()) { AutoAnglerBot.Log("Applying bait: {0}", baitInBag.GetItemName()); await CommonCoroutines.SleepForLagDuration(); return(true); } } return(false); }
// does nothing if no lures are in bag public async static Task <bool> Applylure() { if (StyxWoW.Me.IsCasting || IsLureOnPole) { return(false); } if (!LureRecastTimer.IsFinished) { return(false); } LureRecastTimer.Reset(); var mainHand = StyxWoW.Me.Inventory.Equipped.MainHand; if (mainHand == null || mainHand.ItemInfo.WeaponClass != WoWItemWeaponClass.FishingPole) { return(false); } // Ancient Pandaren Fishing Charm WoWItem ancientPandarenFishingCharm = StyxWoW.Me.BagItems .FirstOrDefault(r => r.Entry == AncientPandarenFishingCharmItemId); if (ancientPandarenFishingCharm != null && !StyxWoW.Me.HasAura(AncientPandarenFishingCharmAuraId)) { AutoAnglerBot.Log("Appling Ancient Pandaren Fishing Charm lure"); ancientPandarenFishingCharm.Use(); await CommonCoroutines.SleepForLagDuration(); return(true); } // Fishing Hats WoWItem head = StyxWoW.Me.Inventory.Equipped.Head; if (head != null && Utility.FishingHatIds.Any(hat => hat == head.Entry && hat != 118393)) // Checking for Draenor tentacle hat { AutoAnglerBot.Log("Appling Fishing Hat lure to fishing pole"); head.Use(); await CommonCoroutines.SleepForLagDuration(); return(true); } foreach (var kv in Lures) { WoWItem lureInBag = Utility.GetItemInBag(kv.Key); if (lureInBag != null && lureInBag.Use()) { AutoAnglerBot.Log("Appling {0} to fishing pole", kv.Value); await CommonCoroutines.SleepForLagDuration(); return(true); } } return(false); }
static void Gear_OnStop() { if (Utility.EquipWeapons()) { AutoAnglerBot.Log("Equipping weapons"); } if (Utility.EquipMainHat()) { AutoAnglerBot.Log("Switched to my normal hat"); } }
public async static Task <bool> FaceWater() { float?bestDirection = GetFaceWaterDirection(); if (bestDirection.HasValue && !WoWMathHelper.IsFacing(StyxWoW.Me.Location, StyxWoW.Me.Rotation, StyxWoW.Me.Location.RayCast(bestDirection.Value, 10f), WoWMathHelper.DegreesToRadians(15))) { AutoAnglerBot.Log("auto facing towards water"); Me.SetFacing(bestDirection.Value); } return(false); }
internal static bool EquipItem(WoWItem item, WoWInventorySlot slot) { if (item == null || !item.IsValid) { return(false); } AutoAnglerBot.Log("Equipping {0}", item.SafeName); Lua.DoString("ClearCursor()"); item.PickUp(); Lua.DoString(string.Format("PickupInventoryItem({0})", (int)slot + 1)); return(true); }
static void CheckPulseTime() { if (_pulseTimestamp == DateTime.MinValue) { _pulseTimestamp = DateTime.Now; return; } var pulseTime = DateTime.Now - _pulseTimestamp; if (pulseTime >= TimeSpan.FromSeconds(3)) { AutoAnglerBot.Err( "Warning: It took {0} seconds to pulse.\nThis can cause missed bites. To fix try disabling all plugins", pulseTime.TotalSeconds); } _pulseTimestamp = DateTime.Now; }
public async static Task <bool> FlyTo(WoWPoint destination, string destinationName = null) { if (destination.DistanceSqr(_lastMoveTo) > 5 * 5) { if (MoveToLogTimer.IsFinished) { if (string.IsNullOrEmpty(destinationName)) { destinationName = destination.ToString(); } AutoAnglerBot.Log("Flying to {0}", destinationName); MoveToLogTimer.Reset(); } _lastMoveTo = destination; } Flightor.MoveTo(destination); return(true); }
public async static Task <bool> MoveTo(WoWPoint destination, string destinationName = null) { if (destination.DistanceSqr(_lastMoveTo) > 5 * 5) { if (MoveToLogTimer.IsFinished) { if (string.IsNullOrEmpty(destinationName)) { destinationName = destination.ToString(); } AutoAnglerBot.Log("Moving to {0}", destinationName); MoveToLogTimer.Reset(); } _lastMoveTo = destination; } var moveResult = Navigator.MoveTo(destination); return(moveResult != MoveResult.Failed && moveResult != MoveResult.PathGenerationFailed); }
public async static Task <bool> Logout() { var activeMover = WoWMovement.ActiveMover; if (activeMover == null) { return(false); } var hearthStone = Me.BagItems.FirstOrDefault( h => h != null && h.IsValid && h.Entry == 6948 && h.CooldownTimeLeft == TimeSpan.FromMilliseconds(0)); if (hearthStone == null) { AutoAnglerBot.Log("Unable to find a hearthstone"); return(false); } if (activeMover.IsMoving) { WoWMovement.MoveStop(); if (!await Coroutine.Wait(4000, () => !activeMover.IsMoving)) { return(false); } } hearthStone.UseContainerItem(); if (await Coroutine.Wait(15000, () => Me.Combat)) { return(false); } AutoAnglerBot.Log("Logging out"); Lua.DoString("Logout()"); TreeRoot.Stop(); return(true); }
public static async Task <bool> DoFishing() { if (AutoAnglerBot.Instance.Profile.FishAtHotspot && !Navigator.AtLocation(AutoAnglerBot.Instance.Profile.CurrentPoint)) { return(false); } if (AutoAnglerSettings.Instance.Poolfishing && BotPoi.Current.Type != PoiType.Harvest) { return(false); } if (await CheckLootFrame()) { return(true); } // refresh water walking if needed if (!Me.Mounted && WaterWalking.CanCast && !WaterWalking.IsActive && await WaterWalking.Cast()) { return(true); } if (AutoAnglerSettings.Instance.Poolfishing) { var pool = BotPoi.Current.AsObject as WoWGameObject; if (pool == null || !pool.IsValid) { BotPoi.Clear(); return(false); } if (await MoveToPool(pool)) { return(true); } } if (await EquipPole()) { return(true); } if (await EquipHat()) { return(true); } if (await Applylure()) { return(true); } if (await Applybait()) { return(true); } if (!AutoAnglerSettings.Instance.Poolfishing && AutoAnglerBot.Instance.ShouldFaceWaterNow) { AutoAnglerBot.Instance.ShouldFaceWaterNow = false; if (await FaceWater()) { return(true); } } if (Me.Mounted && await CommonCoroutines.Dismount("Fishing")) { return(true); } if (!await Coroutine.Wait(10000, () => !Me.IsFalling)) { AutoAnglerBot.Log("Falling for 10 seconds; I don't think this will end good."); return(false); } if (Me.IsSwimming) { await JumpOnWaterSurface(); } if (Me.IsMoving) { WoWMovement.MoveStop(); if (!await Coroutine.Wait(4000, () => !Me.IsMoving)) { return(false); } } // Checks if we got a bite and recasts if needed. if (await CheckFishLine()) { return(true); } return(false); }
static async Task JumpOnWaterSurface() { if (!Me.IsSwimming) { return; } AutoAnglerBot.Log("Jumping up on water surface since I'm swimming but have water walking"); var sw = Stopwatch.StartNew(); while (StyxWoW.Me.IsSwimming) { if (StyxWoW.Me.IsBeingAttacked) { return; } if (sw.ElapsedMilliseconds > 15000) { var pool = BotPoi.Current.AsObject as WoWGameObject; if (pool != null) { AutoAnglerBot.Log("Moving to another spot since couldn't jump on top."); RemovePointAtTop(pool); } break; } try { // Make sure the player's pitch is not pointing down causing player to not being able to // water walk Lua.DoString("VehicleAimIncrement(1)"); WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend); await Coroutine.Wait(15000, () => Me.IsFalling || !Me.IsSwimming); if (SpellManager.HasSpell("Zen Flight") && AutoAnglerSettings.Instance.UseWaterWalking) { var timer = new WaitTimer(TimeSpan.FromSeconds(3)); timer.Reset(); while (!Me.IsSwimming && !Me.HasAura("Zen Flight") && !timer.IsFinished) { SpellManager.Cast("Zen Flight"); await Coroutine.Yield(); } if (Me.HasAura("Zen Flight")) { await Coroutine.Sleep(200); } } } finally { WoWMovement.MoveStop(WoWMovement.MovementDirection.JumpAscend); } if (await Coroutine.Wait(2000, () => !StyxWoW.Me.IsSwimming && !StyxWoW.Me.IsFalling)) { AutoAnglerBot.Log("Successfuly landed on water surface."); return; } } }
public async static Task <bool> MoveToPool(WoWGameObject pool) { if (!AutoAnglerSettings.Instance.Poolfishing || AutoAnglerBot.Instance.Profile.FishAtHotspot) { return(false); } if (pool == null || !pool.IsValid) { return(false); } if (_lastPoolGuid != pool.Guid) { MoveToPoolTimer.Reset(); _lastPoolGuid = pool.Guid; if (!FindPoolPoint(pool, out _poolPoints) || !_poolPoints.Any()) { Utility.BlacklistPool(pool, TimeSpan.FromDays(1), "Found no landing spots"); return(false); } } // should never be true.. but being safe.. if (!_poolPoints.Any()) { Utility.BlacklistPool(pool, TimeSpan.FromDays(1), "Pool landing points mysteriously disapear..."); return(false); } var myLoc = Me.Location; var moveto = _poolPoints[0]; TreeRoot.StatusText = "Moving to " + pool.Name; if (myLoc.DistanceSqr(moveto) > 4 * 4) { MoveResult moveResult; if (AutoAnglerSettings.Instance.Fly) { // don't bother mounting up if we can use navigator to walk over if it's less than 25 units away if (myLoc.DistanceSqr(moveto) < 25 * 25 && !Me.Mounted) { moveResult = Navigator.MoveTo(moveto); if (moveResult != MoveResult.Failed && moveResult != MoveResult.PathGenerationFailed) { return(true); } } //if (!Me.Mounted && !SpellManager.GlobalCooldown) //{ // Flightor.MountHelper.MountUp(); // return true; //} Flightor.MoveTo(WoWMathHelper.CalculatePointFrom(myLoc, moveto, -1f)); return(true); } moveResult = Navigator.MoveTo(moveto); if (moveResult == MoveResult.UnstuckAttempt || moveResult == MoveResult.PathGenerationFailed || moveResult == MoveResult.Failed) { if (!RemovePointAtTop(pool)) { return(true); } AutoAnglerBot.Debug("Unable to path to pool point, switching to a new point"); _poolPoints.Sort((a, b) => a.DistanceSqr(myLoc).CompareTo(b.DistanceSqr(myLoc))); } // if it takes more than 25 seconds to get to a point remove that point and try another. if (MoveToPoolTimer.IsFinished) { if (!RemovePointAtTop(pool)) { return(false); } } return(true); } // wait for bot to reach destination before dismounting await Coroutine.Wait(2000, () => !Me.IsMoving); if (Me.Mounted) { await CommonCoroutines.Dismount("Fishing"); } // can't fish while swimming.. if (Me.IsSwimming && !WaterWalking.IsActive && !WaterWalking.CanCast) { AutoAnglerBot.Debug("Moving to new PoolPoint since I'm swimming at current PoolPoint"); if (!RemovePointAtTop(pool)) { return(false); } return(true); } return(false); }