protected override Composite CreateBehavior()
        {
            return(_root ?? (_root =
                                 new PrioritySelector(
                                     new Decorator(ret => Me.OnTaxi || _tryNumber >= 5 || (_doingQuestTimer.ElapsedMilliseconds >= 180000 && !WaitForNpcs),
                                                   new Action(ret => _isBehaviorDone = true)),

                                     new Decorator(ret => CurrentNpc == null,
                                                   new PrioritySelector(
                                                       new Decorator(ret => NpcLocation.DistanceSquared(Me.Location) > 10 * 10,
                                                                     new Sequence(
                                                                         new Action(ret => QBCLog.Info("Cant find flightmaster, Moving to place provided by profile")),
                                                                         new Action(ret => Flightor.MoveTo(NpcLocation)))),
                                                       new Action(ret => QBCLog.Info("Waiting for flightmaster to spawn"))
                                                       )
                                                   ),

                                     new Decorator(ctx => Me.Mounted, new ActionRunCoroutine(ctx => CommonCoroutines.LandAndDismount("Interact Flightmaster"))),

                                     new Decorator(ret => !CurrentNpc.WithinInteractRange,
                                                   new Action(ret => Navigator.MoveTo(CurrentNpc.Location))
                                                   ),

                                     // Getting ready to interact
                                     new Decorator(ctx => !TaxiFrame.Instance.IsVisible,
                                                   new Sequence(
                                                       new DecoratorContinue(ret => WoWMovement.ActiveMover.IsMoving,
                                                                             new Sequence(
                                                                                 new Action(ret => WoWMovement.MoveStop()),
                                                                                 new SleepForLagDuration())),
                                                       new Action(ret => CurrentNpc.Interact()),
                                                       new Sleep(1000),
                                                       new SleepForLagDuration()
                                                       )),

                                     new Decorator(ret => TaxiNumber == "0" && DestName == "ViewNodesOnly",
                                                   new Sequence(
                                                       new Action(ret => QBCLog.Info("Targeting Flightmaster: " + CurrentNpc.SafeName + " Distance: " +
                                                                                     CurrentNpc.Location.Distance(Me.Location) + " to listing known TaxiNodes")),
                                                       new Action(ret => Lua.DoString(string.Format("RunMacroText(\"{0}\")", "/run for i=1,NumTaxiNodes() do a=TaxiNodeName(i); print(i,a);end;"))),
                                                       new Sleep(WaitTime),
                                                       new Action(ret => _isBehaviorDone = true))),

                                     new Decorator(ret => TaxiNumber != "0",
                                                   new Sequence(
                                                       new Action(ret => QBCLog.Info("Targeting Flightmaster: " + CurrentNpc.SafeName + " Distance: " +
                                                                                     CurrentNpc.Location.Distance(Me.Location))),
                                                       new Action(ret => Lua.DoString(string.Format("RunMacroText(\"{0}\")", "/click TaxiButton" + TaxiNumber))),
                                                       new Action(ret => _tryNumber++),
                                                       new Sleep(WaitTime))),

                                     new Decorator(ret => DestName != "ViewNodesOnly",
                                                   new Sequence(
                                                       new Action(ret => QBCLog.Info("Taking a ride to: " + DestName)),
                                                       new Action(ret => Lua.DoString(string.Format("RunMacroText(\"{0}\")", "/run for i=1,NumTaxiNodes() do a=TaxiNodeName(i); if strmatch(a,'" + DestName + "')then b=i; TakeTaxiNode(b); end end"))),
                                                       new Action(ret => _tryNumber++),
                                                       new Sleep(WaitTime)))
                                     )));
        }
        /// <summary>
        /// Converts the entity into a domain model.
        /// </summary>
        /// <returns>The domain model.</returns>
        /// <param name="npcLocationEntity">NpcLocation entity.</param>
        internal static NpcLocation ToDomainModel(this NpcLocationEntity npcLocationEntity)
        {
            NpcLocation npcLocation = new NpcLocation
            {
                InitialCoordinates = new Point2D(npcLocationEntity.InitialX, npcLocationEntity.InitialY),
                MinimumCoordinates = new Point2D(npcLocationEntity.MinX, npcLocationEntity.MinY),
                MaximumCoordinates = new Point2D(npcLocationEntity.MaxX, npcLocationEntity.MaxY)
            };

            return(npcLocation);
        }
        /// <summary>
        /// Converts the domain model into an entity.
        /// </summary>
        /// <returns>The entity.</returns>
        /// <param name="npcLocation">NpcLocation.</param>
        internal static NpcLocationEntity ToEntity(this NpcLocation npcLocation)
        {
            NpcLocationEntity npcLocationEntity = new NpcLocationEntity
            {
                InitialX = npcLocation.InitialCoordinates.X,
                InitialY = npcLocation.InitialCoordinates.Y,
                MinX     = npcLocation.MinimumCoordinates.X,
                MinY     = npcLocation.MinimumCoordinates.Y,
                MaxX     = npcLocation.MaximumCoordinates.X,
                MaxY     = npcLocation.MaximumCoordinates.Y
            };

            return(npcLocationEntity);
        }
        public async Task <bool> ReturnToZone()
        {
            await this.TeleportTo();

            await NpcLocation.MoveTo(true, radius : InteractDistance);

            GameObjectManager.GetObjectByNPCId(NpcId).Target();
            Core.Player.CurrentTarget.Interact();

            // Temporarily assume selectyesno until we see if we need it for anything but hinterlands
            await Coroutine.Wait(5000, () => SelectYesno.IsOpen);

            SelectYesno.ClickYes();

            await Coroutine.Wait(5000, () => CommonBehaviors.IsLoading);

            await CommonTasks.HandleLoading();

            await Coroutine.Sleep(2000);

            return(true);
        }