Example #1
0
        public override void OnStart()
        {
            // 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)
            {
                PlayerQuest quest = StyxWoW.Me.QuestLog.GetQuestById((uint)QuestId);

                if (quest == null)
                {
                    LogMessage("warning", "Cannot find quest with QuestId({0}).", QuestId);
                }

                else if ((quest != null) && quest.IsCompleted && (Type != AbandonType.All))
                {
                    LogMessage("warning", "Quest({0}, \"{1}\") is Complete--skipping abandon.", QuestId, quest.Name);
                }

                else if ((quest != null) && !quest.IsFailed && (Type == AbandonType.Failed))
                {
                    LogMessage("warning", "Quest({0}, \"{1}\") has not Failed--skipping abandon.", QuestId, quest.Name);
                }

                else
                {
                    TreeRoot.GoalText = string.Format("Abandoning QuestId({0}): \"{1}\"", QuestId, quest.Name);
                    QuestLog ql = new QuestLog();
                    ql.AbandonQuestById((uint)QuestId);
                    LogMessage("info", "Quest({0}, \"{1}\") successfully abandoned", QuestId, quest.Name);
                }

                _isBehaviorDone = true;
            }
        }
Example #2
0
        public override void OnStart()
        {
            // 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)
            {
                PlayerQuest quest = StyxWoW.Me.QuestLog.GetQuestById((uint)QuestId);

                if (quest == null)
                { LogMessage("warning", "Cannot find quest with QuestId({0}).", QuestId); }

                else if ((quest != null) && quest.IsCompleted && (Type != AbandonType.All))
                { LogMessage("warning", "Quest({0}, \"{1}\") is Complete--skipping abandon.", QuestId, quest.Name); }

                else if ((quest != null) && !quest.IsFailed && (Type == AbandonType.Failed))
                { LogMessage("warning", "Quest({0}, \"{1}\") has not Failed--skipping abandon.", QuestId, quest.Name); }

                else
                {
                    TreeRoot.GoalText = string.Format("Abandoning QuestId({0}): \"{1}\"", QuestId, quest.Name);
                    QuestLog ql = new QuestLog();
                    ql.AbandonQuestById((uint)QuestId);
                    LogMessage("info", "Quest({0}, \"{1}\") successfully abandoned", QuestId, quest.Name);
                }

                _isBehaviorDone = true;
            }
        }