コード例 #1
0
        protected override Composite CreateBehavior()
        {
            return(_behaviorRoot ?? (_behaviorRoot =
                                         new PrioritySelector(

                                             // If the quest is complete, and we need to press a final button...
                                             new Decorator(ret => Me.IsQuestComplete(QuestId),
                                                           new Sequence(
                                                               new DecoratorContinue(ret => ButtonOnQuestComplete.HasValue,
                                                                                     new Action(delegate
            {
                TreeRoot.StatusText = string.Format("Pressing Button {0} at Quest Complete.",
                                                    ButtonOnQuestComplete.Value);
                Lua.DoString("RunMacroText(\"/click OverrideActionBarButton{0}\")", ButtonOnQuestComplete.Value);
            })),

                                                               // If behavior done, bail...
                                                               // Note that this is also an implicit "is quest complete" exit criteria, also.
                                                               new Action(delegate
            {
                GuiShowProgress("quest complete");
                _isBehaviorDone = true;
            })
                                                               )),

                                             // Find next target...
                                             _behavior_HuntingGround.CreateBehavior_SelectTarget(),

                                             // Move to next target...
                                             _behavior_HuntingGround.CreateBehavior_MoveToTarget(),

                                             new PrioritySelector(context => TargetAurasShowing(CurrentTarget, _targetAuraToButtonMap).FirstOrDefault(),

                                                                  // If no aura showing, blacklist the target, we're done with it...
                                                                  new Decorator(auraShowing => (auraShowing == null),
                                                                                new Action(delegate
            {
                TreeRoot.StatusText = string.Format("Done with '{0}'... moving on", CurrentTarget.SafeName);
                CurrentTarget.LocallyBlacklist(_delay_MobConsumedExpiry);
            })),

                                                                  // Push the button associated with the next aura shown...
                                                                  // We assume the target may have multiple auras that need redress, so we don't
                                                                  // blacklist the target reacting to one aura.
                                                                  new Sequence(
                                                                      new Action(delegate { WoWMovement.MoveStop(); }),
                                                                      new DecoratorContinue(ret => (Me.CurrentTarget != CurrentTarget),
                                                                                            new Action(delegate { CurrentTarget.Target(); })),
                                                                      new DecoratorContinue(ret => !Me.IsSafelyFacing(CurrentTarget),
                                                                                            new Action(delegate { CurrentTarget.Face(); })),
                                                                      new Action(delegate { _behavior_HuntingGround.MobEngaged(CurrentTarget); }),
                                                                      new WaitContinue(Delay_WowClientLagTime, ret => false, new ActionAlwaysSucceed()),
                                                                      new Action(auraShowing =>
            {
                WoWAura aura = (WoWAura)auraShowing;
                TreeRoot.StatusText = string.Format("Pressing Button {0} on {1} for Aura({2}).",
                                                    _targetAuraToButtonMap[aura.SpellId],
                                                    CurrentTarget.SafeName,
                                                    aura.Name);
                Lua.DoString("RunMacroText(\"/click OverrideActionBarButton{0}\")", _targetAuraToButtonMap[aura.SpellId]);
            }),
                                                                      new WaitContinue(Delay_WowClientLagTime, ret => false, new ActionAlwaysSucceed()),
                                                                      new WaitContinue(PostInteractDelay, ret => false, new ActionAlwaysSucceed()),
                                                                      new Action(delegate { Me.ClearTarget(); })
                                                                      )
                                                                  )
                                             )));
        }