internal static void Dispose() { try { Script.CachedScripts = new Dictionary <string, IScript>(); // clear cache on Stop. Fsm.StopEngine(); Fight.StopFight(); MovementManager.StopMove(); MountTask.AllowMounting = true; Quest.GetSetIgnoreFight = false; Quest.GetSetIgnoreAllFight = false; Quest.GetSetDismissPet = false; Profile = null; QuestingTask.Cleanup(); EventsListener.UnHookEvent(WoWEventsType.QUEST_DETAIL, callback => Quest.AutoCompleteQuest()); EventsListener.UnHookEvent(WoWEventsType.QUEST_AUTOCOMPLETE, callback => Quest.AutoCompleteQuest()); } catch (Exception e) { Logging.WriteError("Quester > Bot > Bot > Dispose(): " + e); } }
public override void Run() { // Get or set selected quest if (QuestingTask.CurrentQuest != null) { int id = QuestingTask.CurrentQuest.Id; if (Quest.GetQuestCompleted(id) || id == 0) { QuestingTask.SelectQuest(); return; } if (QuestingTask.CurrentQuest.WorldQuestLocation != null && QuestingTask.CurrentQuest.WorldQuestLocation.IsValid && !Quest.GetLogQuestId().Contains(id)) { // World Quest that we don't have in our inventory if (!QuestingTask.IsWorldQuestAvailable(id)) { // The WorldQuest is no longer available, therefor, it's complete. QuestingTask.SelectQuest(); return; } } } else { QuestingTask.SelectQuest(); return; } // Need PickUp or TurnIn if (QuestingTask.CurrentQuest.Id != -1 && ((Quest.GetLogQuestIsComplete(QuestingTask.CurrentQuest.Id) && QuestingTask.AllForcedObjectiveComplete()) || QuestingTask.CurrentQuest.Objectives.Count <= 0) && Quest.GetLogQuestId().Contains(QuestingTask.CurrentQuest.Id) && QuestingTask.CurrentQuest.ScriptConditionIsFinish.Replace(" ", "").Length <= 0) // TurnIn { QuestingTask.TurnInQuest(); return; } if (QuestingTask.CurrentQuest.Id != -1) { // PickUp if (!Quest.GetLogQuestId().Contains(QuestingTask.CurrentQuest.Id) && !Quest.GetLogQuestIsComplete(QuestingTask.CurrentQuest.Id) && !Quest.IsQuestFlaggedCompletedLUA(QuestingTask.CurrentQuest.Id)) { QuestingTask.PickUpQuest(); if (!Quest.GetLogQuestId().Contains(QuestingTask.CurrentQuest.Id) && Quest.IsQuestFlaggedCompletedLUA(QuestingTask.CurrentQuest.Id)) { Quest.FinishedQuestSet.Add(QuestingTask.CurrentQuest.Id); } return; } } QuestingTask._travelDisabled = false; // reset travel after PickUp worked. (code exclusive for WQ) if (Script.Run(QuestingTask.CurrentQuest.ScriptConditionIsFinish) && QuestingTask.CurrentQuest.ScriptConditionIsFinish.Replace(" ", "").Length > 0) { QuestingTask.TurnInQuest(); return; } // Quest Objective if (QuestingTask.CurrentQuestObjectiveIsFinish() || QuestingTask.CurrentQuestObjective == null) { QuestingTask.SelectNextQuestObjective(); if (QuestingTask.CurrentQuestObjective == null && QuestingTask.CurrentQuest.Objectives.Count > 0) { QuestingTask.ResetQuestObjective(); } if (QuestingTask.CurrentQuestObjectiveIsFinish()) { return; } if (QuestingTask.CurrentQuestObjective == null) { QuestingTask.TurnInQuest(); } return; } // Execute Objective QuestingTask.CurrentQuestObjectiveExecute(); }