Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private bool CheckWaypoint(string WPName, out string WPTarget)
- {
- WPTarget = "";
- Game.Print("Checking Waypoint Availability");
- var warps = UIElement.Get().Where(u => u.Name.Contains("waypoints_dialog") && u.Name.EndsWith("wrapper.text")); // Return all the waypoint text entries.
- foreach (UIElement u in warps)
- {
- if (u.Text.ToLower().Contains(WPName.ToLower())) // Let's see if we can find a waypoint that matches the text we were given.
- {
- WPTarget = u.Name.Replace("wrapper.text", "wrapper.button"); // Fill out the name of the UIElement we need to click on.
- return true;
- }
- }
- return false;
- }
- private bool WarpTo(string warp_target)
- {
- Game.Print("Running WarpTo");
- string warp_button = "";
- if (!CheckWaypoint(warp_target, out warp_button)) //Check to see if we can actually warp there...
- return false;
- if (warp_button == "") // We didn't find it, return.
- return false;
- Game.Print("Okay, clicking the button...");
- clickUI(warp_button, true); // Clicky wait for level change...
- uint _lvlArea = (uint)Me.LevelArea;
- Game.Print("Waiting for level change...");
- while ((uint)Me.LevelArea == _lvlArea)
- {
- Thread.Sleep(400);
- }
- Game.Print("Done!");
- return true;
- }
- public bool TakeWaypointTo(string warp_target)
- {
- var Waypoint = Unit.Get().Where(u => u.Name.ToLower().Contains("waypoint")).FirstOrDefault();
- if (!Waypoint.Name.ToLower().Contains("waypoint"))
- {
- Game.Print("Unable to locate Waypoint!");
- return false;
- }
- interact(Waypoint, true);
- Thread.Sleep(500);
- bool WarpAction = WarpTo(warp_target);
- return WarpAction;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement