/* * ConsiderAvoidAdds - Avoid Adds */ internal void ConsiderAvoidAdds(PUnit target) { bool petattacking = false; List <PUnit> closeUnits = ObjectManager.CheckForMobsAtLoc(target.Location, PveBehaviorSettings.SkipAddsDis + 5, false); if (closeUnits.Count == 0) { return; } PUnit closestAdd = GetClosestBesides(closeUnits, target); if (closestAdd == null) { return; } if (closestAdd.GUID == target.GUID) { return; } // Somebody is close enough to maybe jump in. If the monster is in front of us and close // enough, might be time to back it up. if (closestAdd.DistanceToSelf < Avoidaddsdistance) { Logging.Write("Possible add: " + closestAdd.Name + ": " + closestAdd.DistanceToSelf); _addBackup.Reset(); var futility = new Ticker(3000); closestAdd.Face(); MoveHelper.Backwards(true); if (ObjectManager.MyPlayer.HasLivePet) { petattacking = ObjectManager.MyPlayer.Pet.Target.IsValid; PetFollow.SendKey(); } while (!futility.IsReady) { Thread.Sleep(10); closestAdd.Face(); if (closestAdd.DistanceToSelf > Avoidaddsdistance + 6.0) // Slack space. { break; } } MoveHelper.Backwards(false); if (ObjectManager.MyPlayer.HasLivePet && petattacking) { PetAttackKey.SendKey(); } _addBackup.Reset(); } }
private static void MoveRandom() { int d = Ran.Next(4); if (d == 0 || d == 1) { MoveHelper.Forwards(true); } if (d == 1) { MoveHelper.StrafeRight(true); } if (d == 2 || d == 3) { MoveHelper.Backwards(true); } if (d == 3) { MoveHelper.StrafeLeft(true); } }
internal static bool GatherFishNode(PGameObject node) { if (_reLure == null) { _reLure = new Ticker(600000); _reLure.ForceReady(); } FlyingEngine.Navigator.Stop(); var combat = new StateCombat(); int nearestIndexInPositionList = Location.GetClosestPositionInList(FlyingEngine.CurrentProfile.WaypointsNormal, node.Location); Location position = FlyingEngine.CurrentProfile.WaypointsNormal[nearestIndexInPositionList]; if (!ApproachPosFlying.Approach(position, 5)) { return(false); } node.Location.Face(); if (Bobber() != null) { Logging.Write("Someone is fishing, break"); return(false); } if (!CheckMobs(node)) { return(false); } if (FlyingBlackList.IsBlacklisted(node)) { ToldAboutNode.TellAbout("is blacklisted", node); return(false); } DescentToSchool(node); Mount.Dismount(); var timeout = new Ticker((FlyingSettings.MaxTimeAtSchool * 60) * 1000); var checkIfValid = new Ticker(8000); while (node.IsValid) { while (combat.NeedToRun) { combat.DoWork(); timeout.Reset(); } if (checkIfValid.IsReady) { if (ObjectManager.GetObjects.FirstOrDefault(u => u.BaseAddress == node.BaseAddress) == null) { break; } checkIfValid.Reset(); } if (FlyingSettings.Lure && _reLure.IsReady) { KeyHelper.SendKey("Lure"); Thread.Sleep(3500); _reLure.Reset(); } if (timeout.IsReady) { return(false); } if (ObjectManager.MyPlayer.IsSwimming) { MoveHelper.Jump(1500); Thread.Sleep(1000); KeyHelper.SendKey("Waterwalk"); Thread.Sleep(2000); MoveHelper.Jump(1500); Thread.Sleep(1500); if (ObjectManager.MyPlayer.IsSwimming) { return(false); } } node.Location.Face(); var timeout3 = new Ticker(4000); while (!timeout3.IsReady && (node.Location.DistanceToSelf2D < 14)) { MoveHelper.Backwards(true); Thread.Sleep(20); } MoveHelper.ReleaseKeys(); timeout3.Reset(); node.Location.Face(); while (!timeout3.IsReady && (node.Location.DistanceToSelf2D > 16)) { MoveHelper.Forwards(true); Thread.Sleep(20); } MoveHelper.ReleaseKeys(); KeyHelper.SendKey("Fishing"); Thread.Sleep(1500); Fishing.FindBobberAndClick(FlyingSettings.WaitForLoot); Thread.Sleep(100); } return(true); }