// Method: "GetClosestFlightToDestination(Vector3 destination)" // What it Does: Returns the string name of the closest flightmaster to player desired Vector3 destination // Purpose: Sometimes the player wishes to travel to another zone, but only has the destination. // This could be useful at times when the destination is know, the player is far away, but // the exact ideal flightmaster is not known. This finds it for you. public static string GetClosestFlightToDestination(Vector3 destination) { int continentID = API.Me.ContinentID; string closestName = ""; Vector3 closestPosition; List <object> zones = new List <object>(); if (continentID == 1116) { zones = DraenorZones.GetEveryFlightMaster(); } if (zones.Count > 0) { closestName = (string)zones[0]; closestPosition = new Vector3((float)zones[1], (float)zones[2], (float)zones[3]); Vector3 temp; for (int i = 6; i < zones.Count - 5; i = i + 6) { temp = new Vector3((float)zones[i + 1], (float)zones[i + 2], (float)zones[i + 3]); if (destination.Distance(temp) < destination.Distance(closestPosition)) { closestName = (string)zones[i]; closestPosition = temp; } } } return(closestName); }
// Filters out returns by continent public static List <object> getFlightMasterInfo() { List <object> result = new List <object>(); int continentID = API.Me.ContinentID; int zoneID = API.Me.ZoneId; bool factionIsHorde = API.Me.IsHorde; // Draenor Continent if (continentID == 1116) { result = DraenorZones.getDraenorInfo(zoneID, factionIsHorde); } // All Continents Eventually to be Added return(result); }
// Method: "ToFlightMaster(String)" public static IEnumerable <int> ToFlightMaster() { List <object> result = getClosestFlight(); // If Empty Result, Zone not known. if (result.Count == 0) { API.Print("Unfortunately the Zone Your Are in Does Not Have the Flightpaths Mapped yet!"); API.Print("It Would Be Amazing if You Could Report Back on the Forums Your Location. Thank you!"); yield break; } // Casting all the Object to Types string location = (string)result[0]; Vector3 destination = (Vector3)result[1]; float distance = (float)result[2]; distance = (int)Math.Ceiling(distance); int npcID = (int)result[3]; bool IsSpecialPathingNeeded = (bool)result[4]; location = location.Substring(0, location.IndexOf(',')); API.Print("The Closest Known Flightpath is Located at \"" + location + "\""); string yards = "Yards"; // String from plural to non. QoL thing only... if (distance == 1) { yards = "Yard"; } API.Print("Traveling Roughly " + distance + " " + yards + " to Get There..."); // This is where to add special pathing considerations. if (IsSpecialPathingNeeded) { if (API.Me.ContinentID == 1116) { var check = new Fiber <int>(DraenorZones.doSpecialPathing()); while (check.Run()) { yield return(100); } } // Add connections to other Classes There... // else if (API.Me.ContinentID == 1) // { // } } // Ok, time to move! while (!API.MoveTo(destination)) { yield return(100); } // Targeting the FlightMaster! foreach (var unit in API.Units) { if (unit.EntryID == npcID) { API.Me.SetFocus(unit); API.Me.SetTarget(unit); break; } } // Edging closer to FlightMaster while (API.Me.Focus != null && !API.MoveTo(API.Me.Focus.Position)) { yield return(100); } }