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

[Use in Plugin] CanFly ?

LiquidAtoR

Community Developer
Joined
Jan 15, 2010
Messages
1,430
Reaction score
52
Few questions for a change in 1 of my test plugs...

Code:
    if (!CanFly)
     Navigator.MoveTo(loc);
    else
     Flightor.MoveTo(loc);

Does this do it correctly (if you can fly you fly, otherwise you ride) and does it automagically use the right mount when called like that?
Or am I making too simple assumptions?
 
Unfortunately, you're in a poorly documented area of the Honorbuddy API. (What's new?)

The last time I tried stuff like this (a few months ago), here were my empirical findings:
  • WoWMovementInfo.CanFly will return 'true' if everything is kosher to fly (e.g., you are flying-mounted, and in a flyable area, and have the appropriate skill such as the Flight Master's License)

  • Navigator will _not_ automatically mount when using MoveTo(loc)

  • Flightor _will_ automatically mount when using MoveTo(loc)

  • Flightor always prefers a flying mount, and will never use a ground-only mount.

  • (Relatively new) Flightor falls back to using Navigator, if the toon is in a non-flying area.

The above empirical findings are very dated. Honorbuddy could have easily changed the implementation of things. Without documentation, there is no way to know the guaranteed behavior versus what 'just works that way for now'.

Developing based on empirical findings is sheer folly, but its all we have. You may prefer to wait for an authoritative answer on the current state of affairs from one of the HBcore developers. :D


cheers,
chinajade
 
Last edited:
Thanks for the answer China. As a result I moved the Mountcode to the Navigator part only (since Flightor does the mounting himself as you stated).
Alas it doesn't do me much good so far.

When I add your part for the check to see if we can fly *WoWMovementInfo.CanFly* the whole thing pukes about An object reference is required for the non-static field, method, or property
Styx.WoWInternals.WoWObjects.WoWMovementInfo.CanFly.get.

I assume (with the knowlegde I currently posess) I have to move WoWMovementInfo.CanFly out of that place and into it's own function to get a static return value and call that outcome inside this codepiece. I don't have that much C# experience, but this is my best guess about the error. Anyone with a bit more codesense, help would be appreciated...
This is how it currently looks.
Code:
  public static void movetoLoc(WoWPoint loc)
  {
   while (loc.Distance(Me.Location) > 5)
   {
    if (CanFly)
     Flightor.MoveTo(loc);
    else
     {
     if (!Me.Mounted) Mount.MountUp();
     Navigator.MoveTo(loc);
     }
     Thread.Sleep(100);
    if (inCombat) return;
   }
   WoWMovement.MoveStop();
  }

Going on this thought I probably have to declare CanFly separately something like this:
Code:
  static public bool CanFly
  {
   get
   {
    if (WoWMovementInfo.CanFly) return true;
    return false;
   }
  }

Gonna tinker around a bit. Any pointers would be appreciated.
 
Last edited:
When I add your part for the check to see if we can fly *WoWMovementInfo.CanFly* the whole thing pukes about An object reference is required for the non-static field, method, or property
Styx.WoWInternals.WoWObjects.WoWMovementInfo.CanFly.get.

Sorry I was unclear on this.

Yes, you do need the object reference supplied by the WoWUnit base class. The unambiguous reference to CanFly can be obtained as follows:

Code:
if (ObjectManager.Me.MovementInfo.CanFly)
    // ...whatever...


The other concern is this chunk of code you show:
Code:
    if (CanFly)
     Flightor.MoveTo(loc);

It is possible that the CanFly will fail if you are not already sitting on a flying mount. They may have changed this since I last tested it. Testing for 'mounted' is not good enough--it must be a flying mount.

cheers & good luck with it,
chinajade
 
Last edited:
Then my last question on the matter (at least I hope so):

If I call for CanFly, and this returns true (so I can fly), and then call Mount.Mountup(), will it then mount a flying mount or will you have to call for one specifically?

Taking into account that I don't want to mount while flying already (You fall to your death if you dismount in flight, and we want to fly after all) I check for !Me.IsFlying before mounting (in case the above is assumed correctly).

In that light I would change it to this:

Code:
 public static void movetoLoc(WoWPoint loc)
  {
   while (loc.Distance(Me.Location) > 5)
    {
     if (Me.MovementInfo.CanFly)
      {
       if (!Me.IsFlying) Mount.MountUp();
       Flightor.MoveTo(loc);
      }
    else
    {
     if (!Me.Mounted) Mount.MountUp();
     Navigator.MoveTo(loc);
    }
   Thread.Sleep(100);
  if (inCombat) return;
  }
 WoWMovement.MoveStop();
 }
 
Last edited:
This is a snippit out of the plugin I've been working on

PHP:
private void Repair()
{
if (!onRoute)
{
currentPOI = BotPoi.Current.Type;
startLocation = ObjectManager.Me.Location;
}
if ((currentPOI.Equals(PoiType.Repair)) && (!onRoute) && (!ObjectManager.Me.IsActuallyInCombat))
{
onRoute = true;
Flightor.MountHelper.MountUp();
Navigator.Clear();
FlyToLocation(BotPoi.Current.Location, "Flying to repair");
}
if ((!BotPoi.Current.Type.Equals(currentPOI)) && (!ObjectManager.Me.IsActuallyInCombat))
{
Flightor.MountHelper.MountUp();
Navigator.Clear();
FlyToLocation(BotPoi.Current.Location, "Returning after repair");
onRoute = false;
}
}
The FlyToLocation() method While loops over the Flightor.MoveTo() (among other things)
http://www.thebuddyforum.com/honorbuddy-forum/plugins/free/leveling/34783-%5Bplugin%5D-gift-flight-test-uses-flying-mount-quest-grind-profiles.html
 
I've seen your plugin, but it's too much for a simple thing I want it to do by itself (and not depending on another plugin).
The Flightor.MountHelper.MountUp(); part is handy and I used it, thanks for showing that snippet.
I think I got it's final state (will run some tests) but this looks solid for what I want it to do.
I assume calling the Navigator.Clear(); will clear current path and generate a new one to the 'new' objective.

Code:
 public static void movetoLoc(WoWPoint loc)
  {
   while (loc.Distance(Me.Location) > 5)
    {
     if (Me.MovementInfo.CanFly)
      {
       if (!Me.IsFlying) Flightor.MountHelper.MountUp();
       Navigator.Clear();
       Flightor.MoveTo(loc);
      }
    else
      {
       if (!Me.Mounted) Mount.MountUp();
       Navigator.Clear();
       Navigator.MoveTo(loc);
      }
     Thread.Sleep(100);
    if (inCombat) return;
   }
  WoWMovement.MoveStop();
 }
 
The Navigator.Clear() is there because, Flightor uses its own navigation system so the ground navigation route needs to be cleared. Otherwise, when it lands, the bot will try to run to the first wowpoint in the (ground route) until it gets stuck and calls the stuck handler, which recalculates the route and then it realises the current location has changed.
 
Thanks for the tips.
Have to do some stuff @ home, and then I can go and run some tests with this thing.
Will look up a common thing that is around to be picked up so I can test the behaviours (does it mount correctly, fly etc).
When it's done I will update another plugin and release it proper.

Regards, Liquid.
 
Back
Top