private static async Task ClearExpiredFate() { OracleFateManager.DoNotWaitBeforeMovingFlag = true; await OracleFateManager.ClearCurrentFate("FATE ended before we got there.", false); Navigator.Stop(); }
private static async Task <IEnumerable <Vector3> > GenerateFlightPathToFate(FateData currentFate) { Logger.SendLog("Generating new flight path to FATE."); var flightPathTimer = Stopwatch.StartNew(); var aStar = new AStarNavigator(ZoneFlightMesh.Graph); var startingNode = GetClosestNodeToLocation(Core.Player.Location); var endingNode = GetClosestNodeToFate(currentFate); if (startingNode == null || endingNode == null) { Logger.SendErrorLog("Couldn't generate a flight path to the FATE, blacklisting it and selecting another."); Blacklist.Add(currentFate.Id, BlacklistFlags.Node, currentFate.TimeLeft, "Could not generate flight path."); await OracleFateManager.ClearCurrentFate("Couldn't generate a flight path to the FATE", false); return(null); } var path = aStar.GeneratePath(startingNode.Position, endingNode.Position).ToList(); if (!path.Any()) { Logger.SendErrorLog("Couldn't generate a flight path to the FATE, blacklisting it and selecting another."); Blacklist.Add(currentFate.Id, BlacklistFlags.Node, currentFate.TimeLeft, "Could not generate flight path."); await OracleFateManager.ClearCurrentFate("Couldn't generate a flight path to the FATE", false); return(null); } // Skip first node if we can to prevent bot-like mid-air direction change. if (path.Count > 1) { Vector3 collision; if (!WorldManager.Raycast(Core.Player.Location, path[1], out collision)) { Logger.SendDebugLog("Skipping first node, no collision detected."); path.Remove(path.First()); } else { Logger.SendDebugLog("Not skipping first node, collision detected at: " + collision); } } flightPathTimer.Stop(); Logger.SendDebugLog("Flight path generated in " + flightPathTimer.ElapsedMilliseconds + " ms."); return(path); }