protected override Composite CreateMainBehavior()
        {
            return(new PrioritySelector(
                       // PvP server considerations...
                       // Combat is disabled while on the Taxi.  If on the ground, we want it enabled
                       // in case we get attacked on a PvP server.
                       new Decorator(context => !LevelBot.BehaviorFlags.HasFlag(BehaviorFlags.Combat),
                                     new Action(context => { LevelBot.BehaviorFlags |= BehaviorFlags.Combat; })),

                       // Move to flight master, and interact to take taxi ride...
                       new Decorator(context => !Me.OnTaxi,
                                     new PrioritySelector(context =>
            {
                FlightMaster =
                    Query.FindMobsAndFactions(Utility.ToEnumerable <int>(MobId_FlightMaster))
                    .FirstOrDefault()
                    as WoWUnit;

                return context;
            },

                                                          // If flight master not in view, move to where he should be...
                                                          new Decorator(context => FlightMaster == null,
                                                                        new ActionRunCoroutine(
                                                                            context => UtilityCoroutine.MoveTo(
                                                                                WaitLocation,
                                                                                "FlightMaster location",
                                                                                MovementBy))),

                                                          // Make certain the bombs are in our backpack...
                                                          new ActionRunCoroutine(
                                                              ctx => _waitForInventoryItem
                                                              ?? (_waitForInventoryItem = new UtilityCoroutine.WaitForInventoryItem(
                                                                      () => ItemId_Bomb,
                                                                      () =>
            {
                QBCLog.ProfileError(
                    "Cannot continue without required item: {0}",
                    Utility.GetItemNameFromId(ItemId_Bomb));
                BehaviorDone();
            }))),

                                                          // Move to flightmaster, and gossip to hitch a ride...
                                                          new Decorator(context => FlightMaster != null,
                                                                        new PrioritySelector(
                                                                            new Decorator(context => !FlightMaster.WithinInteractRange,
                                                                                          new ActionRunCoroutine(
                                                                                              context => UtilityCoroutine.MoveTo(
                                                                                                  FlightMaster.Location,
                                                                                                  FlightMaster.SafeName,
                                                                                                  MovementBy))),
                                                                            new ActionRunCoroutine(context => CommonCoroutines.StopMoving()),
                                                                            new Mount.ActionLandAndDismount(),
                                                                            new Decorator(context => !GossipFrame.Instance.IsVisible,
                                                                                          new Action(context => { FlightMaster.Interact(); })),
                                                                            new Action(context => { GossipFrame.Instance.SelectGossipOption(0); })
                                                                            ))
                                                          ))
                       ));
        }
예제 #2
0
        public override void OnStart()
        {
            var skillLine = (SkillLine)TradeSkillId;

            if (!Enum.GetValues(typeof(SkillLine)).Cast <SkillLine>().Contains(skillLine))
            {
                QBCLog.ProfileError("TradeSkillId {0} is not a valid tradeskill Id.", TradeSkillId);
            }

            // special case for Runeforging since it's not considered a profession.
            _recipeSpell = skillLine == SkillLine.Runeforging
                ? WoWSpell.FromId(TradeSkillItemId)
                : GetRecipeSpell(TradeSkillItemId);

            if (_recipeSpell == null || !_recipeSpell.IsValid)
            {
                QBCLog.ProfileError("TradeSkillItemId {0} is not a valid Item or Spell Id.", TradeSkillId);
            }
            // This reports problems, and stops BT processing if there was a problem with attributes...
            // We had to defer this action, as the 'profile line number' is not available during the element's
            // constructor call.
            OnStart_HandleAttributeProblem();

            // If the quest is complete, this behavior is already done...
            // So we don't want to falsely inform the user of things that will be skipped.
            if (!IsDone)
            {
                this.UpdateGoalText(QuestId);
            }
        }