Ejemplo n.º 1
0
        public string UpdateText(string name)
        {
            foreach (NPC npc in Npcs)
            {
                if (npc.Name.Equals(name))
                {
                    CurrentNpc = npc;
                }
            }

            CurrentNpc.CurrentSentance = CurrentNpc.GetSentanceByIndex(CurrentNpc.History);
            string choices = String.Empty;

            foreach (string choice in CurrentNpc.CurrentSentance._choices.Values)
            {
                choices += $"{choice}\n";
            }

            Text = $"{CurrentNpc.Name}:\n{CurrentNpc.CurrentSentance._info}\n\n{choices}\n\n";

            if (CommandFailed)
            {
                Text += $"I dont think i can do that.";
            }
            else
            {
                Text += $"What should i do.";
            }
            return(Text);
        }
        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)))
                                     )));
        }
Ejemplo n.º 3
0
    public void FinishDialog(float delay = 0f)
    {
        _panelCanvasGroup.DOFade(0, .45f).SetDelay(delay);

        DOTween.Sequence()
        .SetDelay(delay + .45f + .55f)
        .OnComplete(() => {
            CurrentNpc.FinishTrade();
        });
    }