What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal
RebornBuddy Forums

Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

How to use CanFullyNavigateTo()?

Neverdyne

Community Developer
Joined
Sep 12, 2014
Messages
649
Say if I want to know if the navigator can take me from my current location to a location B, how should I use the CanFullyNaviateTo() method? How do I get the IEnumerable of targets?
 
Last edited:
So I guess most of your question could be answered wihtin the thread of the Patrol Plugin which used orginally the Can Fully Navigate But mashtag did not like this very much in the way it was used.
He stated
When you set the poi the bot will request a path, if it returns a path that won't reach the mob the it will blacklist the mob and clear the poi.
Here is the function from the old Partol
Code:
 public static GameObject FindNavigableTarget(GameObject[] targets)
        {
            if (!targets.Any()) return null;
            var navtarget = targets.Select(unit => new CanFullyNavigateTarget { Id = unit.ObjectId, Position = unit.Location });
            if (Navigator.NavigationProvider == null) return null;
            var resultsArray = Navigator.NavigationProvider.CanFullyNavigateTo(navtarget);
            if (resultsArray == null) return null;
            var result = resultsArray.OrderBy(z => z.PathLength).FirstOrDefault(r => r.CanNavigate == 1);
            return result != null ? targets.FirstOrDefault(z => z.ObjectId == result.Id) : null;
        }
And in my Fate oderbot tag you might find something about Ienumerable if you want to selct your own target.

May I ask what you have in mind :-)
 
Thanks. I understand why he didn't like the high frequency of requests being sent to the server by Patrol. I'm not using it to kill mobs, however, so it'll happen only once every two minutes or so. I'm finishing Lisbeth 2.0's merchant Buy Orders, and was having the problem that some merchants are in a sub-zone of the main city with no aetheryte and the navigator cannot reach them from the previous zone. So what I ended up doing was creating waypoints to handle the zone transitions in a reusable manner. This works, however it has the down same side of always starting the waypoint trail from the beginning. I needed a way to know if I can navigate to a location before trying to do so. This should work.
 
Did you see my travel Orderbot tag. It enables you to walk/ride to all zones. So you could stay in South shroud and just add the Tag <Travel To=128> and it will walk/ride you to Limsa. Maybe you can steel from there some parts.
 
I got it working now, but I might look into that Travel tag one day. By the way, why aren't you on the dev Skype chat wolf?
 
Congrats.
No not in the Skype chat at all since I only have very little time for this project.
 
Last edited:
Code:
          var navReq = fateDatas.Select(r => new CanFullyNavigateTarget { Id = r.Id, Position = r.Location });
            if (!navReq.Any())
            {
                if (!string.IsNullOrEmpty(thisfateonly))
                {
                   Logging.Write(@"Waiting for {0} ...",thisfateonly);
                }
                else
                {
                    Logging.Write(@"No fates within operational parameters.");
                }
                
                return RunStatus.Failure;
            }


            var paths = nav.CanFullyNavigateTo(navReq);
            if (paths == null)
            {
                Logging.WriteDiagnostic("Something strange happened, null path returned.");
                return RunStatus.Failure;
            }

            foreach (var badfate in paths.Where(r => r.CanNavigate == 0))
            {

                var val = fateDatas.FirstOrDefault(r => r.Id == badfate.Id);

                if (val != null)
                {
                    var feedback = string.Format("Could not find a path to {0} from {1} ({2})", val.Location, Core.Player.Location, val.Name);

                    Blacklist.Add(badfate.Id, BlacklistFlags.Node, TimeSpan.FromMinutes(20), feedback);
                }
                else
                {
                    var feedback = string.Format("Could not navigate to");

                    Blacklist.Add(badfate.Id, BlacklistFlags.Node, TimeSpan.FromMinutes(20), "Could not navigate to " + badfate.Id);
                }



            }

If your not navigating to an object with an id you can just make your own up.
This function is synchronus and will lockup the game until it gets a response.
I really need to rewrite it to be async now that we have coroutines.
 
Figured since all pathfinding seems to be done in the server, asking if something can be navigated to would cause a server request and take some time. It's been working fine so far since I call it very rarely and with a single target. It would be perfect if you could await it though.
 
Back
Top