Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.33 KB | None | 0 0
  1. using System.Collections.Generic;
  2. using Styx.Helpers;
  3. using Styx.Logic.BehaviorTree;
  4. using Styx.Logic.Pathing;
  5. using Styx.Logic.Questing;
  6. using TreeSharp;
  7. using Action = TreeSharp.Action;
  8.  
  9. namespace Styx.Bot.Quest_Behaviors
  10. {
  11.     class FlyTo : CustomForcedBehavior
  12.     {
  13.  
  14.         public WoWPoint Location { get; private set; }
  15.         public float Distance { get; private set; }
  16.  
  17.         public FlyTo(Dictionary<string, string> args)
  18.             : base(args)
  19.         {
  20.             WoWPoint p;
  21.             float f;
  22.             bool HasLocation = GetXYZAttributeAsWoWPoint("X", "Y", "Z", true, WoWPoint.Empty, out p);
  23.             if (!HasLocation)
  24.             {
  25.                 Logging.Write("FlyTo has no location! {0}", this);
  26.                 TreeRoot.Stop();
  27.                 return;
  28.             }
  29.             Location = p;
  30.             GetAttributeAsFloat("Distance", false, "10.0", 1, float.MaxValue, out f);
  31.             Distance = f;
  32.         }
  33.  
  34.         public override bool IsDone
  35.         {
  36.             get { return Location.Distance(StyxWoW.Me.Location) <= Distance; }
  37.         }
  38.  
  39.         private Composite _root;
  40.         protected override TreeSharp.Composite CreateBehavior()
  41.         {
  42.             return _root ?? (_root =
  43.                 new Action(ret => Gatherbuddy.Flightor.MoveTo(Location)));
  44.  
  45.         }
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement