public async Task <bool> Main() { if (WorldManager.ZoneId != ZoneId) { thisPath = await NavGraph.GetPathAsync((ushort)ZoneId, XYZ); if (thisPath == null || thisPath.Count == 0) { return(false); } while (WorldManager.ZoneId != ZoneId && await NavGraph.NavGraphConsumer(ctx => thisPath).ExecuteCoroutine()) { await Coroutine.Yield(); } } if (!await Movement.MoveTo(XYZ, Land, Dismount)) { return(false); } await Coroutine.Wait(4000, () => !Core.Me.InCombat); return(_done = true); }
public static async Task <bool> GetTo(uint ZoneId, Vector3 XYZ) { var path = await GenerateNodes(ZoneId, XYZ); if (path == null) { return(false); } if (path.Count < 1) { LogCritical($"Couldn't get a path to {XYZ} on {ZoneId}, Stopping."); return(false); } object object_0 = new object(); var composite = NavGraph.NavGraphConsumer(j => path); while (path.Count > 0) { composite.Start(object_0); await Coroutine.Yield(); while (composite.Tick(object_0) == RunStatus.Running) { await Coroutine.Yield(); } composite.Stop(object_0); await Coroutine.Yield(); } Navigator.Stop(); return(Navigator.InPosition(Core.Me.Location, XYZ, 3)); }
public static async Task <bool> GetTo(uint ZoneId, Vector3 XYZ) { /*if (ZoneId == 620) * { * var AE = WorldManager.AetheryteIdsForZone(ZoneId).OrderBy(i => i.Item2.DistanceSqr(XYZ)).First(); * //LogCritical("Can teleport to AE"); * WorldManager.TeleportById(AE.Item1); * await Coroutine.Wait(20000, () => WorldManager.ZoneId == AE.Item1); * await Coroutine.Sleep(2000); * return await FlightorMove(XYZ); * }*/ if (ZoneId == 401 && WorldManager.ZoneId == ZoneId) { return(await FlightorMove(XYZ)); } var path = await GenerateNodes(ZoneId, XYZ); if (ZoneId == 399 && path == null && WorldManager.ZoneId != ZoneId) { await GetToMap399(); } if (path == null && WorldManager.ZoneId != ZoneId) { if (WorldManager.AetheryteIdsForZone(ZoneId).Length >= 1) { var AE = WorldManager.AetheryteIdsForZone(ZoneId).OrderBy(i => i.Item2.DistanceSqr(XYZ)).First(); //LogCritical("Can teleport to AE"); WorldManager.TeleportById(AE.Item1); await Coroutine.Wait(20000, () => WorldManager.ZoneId == AE.Item1); await Coroutine.Sleep(2000); return(await GetTo(ZoneId, XYZ)); } else { return(false); } } if (path == null) { bool result = await FlightorMove(XYZ); Navigator.Stop(); return(result); } if (path.Count < 1) { LogCritical($"Couldn't get a path to {XYZ} on {ZoneId}, Stopping."); return(false); } object object_0 = new object(); var composite = NavGraph.NavGraphConsumer(j => path); while (path.Count > 0) { composite.Start(object_0); await Coroutine.Yield(); while (composite.Tick(object_0) == RunStatus.Running) { await Coroutine.Yield(); } composite.Stop(object_0); await Coroutine.Yield(); } Navigator.Stop(); return(Navigator.InPosition(Core.Me.Location, XYZ, 3)); }
protected Composite Behavior() { return(new PrioritySelector( // can tag execute? new Decorator(ret => !CanRepair(), new Action(r => { _done = true; }) ), new Decorator(ret => CraftingLog.IsOpen, new ActionRunCoroutine(ctx => StopCrafting()) ), new Decorator(r => !_generatedNodes, new ActionRunCoroutine(r => GenerateNodes())), // stage 1: Find the NPC new Decorator(ret => Poi.Current.Type == PoiType.None, new PrioritySelector( new Decorator(ret => GameObjectManager.GetObjectByNPCId(NpcId) != null, new Action(r => { NPC = GameObjectManager.GetObjectByNPCId(NpcId); Poi.Current = new Poi(NPC, PoiType.Vendor); }) ), new Decorator(ret => XYZ != null && Core.Player.Location.Distance(XYZ) > 20f, NavGraph.NavGraphConsumer(r => FinalizedPath) ), new Decorator(ret => NPC == null, new Action(r => { _done = true; }) ) ) ), // stage 2: go to NPC and Interact new Decorator(ret => Poi.Current.Type == PoiType.Vendor && !Repair.IsOpen, new PrioritySelector( new Decorator(ret => SelectIconString.IsOpen, new Action(r => { SelectIconString.ClickSlot(DialogOption); }) ), new Decorator(ret => Core.Player.Location.Distance(Poi.Current.Location) > 3f, CommonBehaviors.MoveAndStop(ret => Poi.Current.Location, 2f, true, null, RunStatus.Failure) ), new Decorator(ret => Poi.Current.Type == PoiType.Vendor, new Action(r => { Poi.Current.Unit.Interact(); }) ) )), // stage 3: repair new Decorator(ret => Repair.IsOpen, new PrioritySelector( new Decorator(ret => Repaired, new Action(r => { Repair.Close(); _done = true; }) ), new Decorator(ret => Repair.IsOpen && !RepairAllClicked, new Action(r => { RepairAllClicked = true; Repair.RepairAll(); }) ), new Decorator(ret => SelectYesno.IsOpen, new Action(r => { SelectYesno.ClickYes(); Repaired = true; }) ) )) )); }