From aeae6410f6d24124aeb01cba0146ce81782ce238 Mon Sep 17 00:00:00 2001 From: Atidot3 Date: Fri, 2 Aug 2024 22:45:14 +0200 Subject: [PATCH] Allow bots to manage their own quest log and removed quests based on conditions --- src/strategy/actions/ActionContext.h | 3 +++ src/strategy/actions/DropQuestAction.cpp | 1 - src/strategy/generic/NonCombatStrategy.cpp | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/strategy/actions/ActionContext.h b/src/strategy/actions/ActionContext.h index 795c7aab..1f289871 100644 --- a/src/strategy/actions/ActionContext.h +++ b/src/strategy/actions/ActionContext.h @@ -42,6 +42,7 @@ #include "NonCombatActions.h" #include "OutfitAction.h" #include "PositionAction.h" +#include "DropQuestAction.h" #include "RandomBotUpdateAction.h" #include "ReachTargetActions.h" #include "ReleaseSpiritAction.h" @@ -180,6 +181,7 @@ class ActionContext : public NamedObjectContext creators["turn in petition"] = &ActionContext::turn_in_petition; creators["buy tabard"] = &ActionContext::buy_tabard; creators["guild manage nearby"] = &ActionContext::guild_manage_nearby; + creators["clean quest log"] = &ActionContext::clean_quest_log; // BG Tactics creators["bg tactics"] = &ActionContext::bg_tactics; @@ -351,6 +353,7 @@ class ActionContext : public NamedObjectContext static Action* turn_in_petition(PlayerbotAI* botAI) { return new PetitionTurnInAction(botAI); } static Action* buy_tabard(PlayerbotAI* botAI) { return new BuyTabardAction(botAI); } static Action* guild_manage_nearby(PlayerbotAI* botAI) { return new GuildManageNearbyAction(botAI); } + static Action* clean_quest_log(PlayerbotAI* botAI) { return new CleanQuestLogAction(botAI); } // BG Tactics static Action* bg_tactics(PlayerbotAI* botAI) { return new BGTactics(botAI); } diff --git a/src/strategy/actions/DropQuestAction.cpp b/src/strategy/actions/DropQuestAction.cpp index d595cccb..cb2ea770 100644 --- a/src/strategy/actions/DropQuestAction.cpp +++ b/src/strategy/actions/DropQuestAction.cpp @@ -66,7 +66,6 @@ bool CleanQuestLogAction::Execute(Event event) uint8 totalQuests = 0; DropQuestType(totalQuests); //Count the total quests - if (MAX_QUEST_LOG_SIZE - totalQuests > 6) { DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE, true, true); //Drop failed quests diff --git a/src/strategy/generic/NonCombatStrategy.cpp b/src/strategy/generic/NonCombatStrategy.cpp index 41874d59..825658b1 100644 --- a/src/strategy/generic/NonCombatStrategy.cpp +++ b/src/strategy/generic/NonCombatStrategy.cpp @@ -7,6 +7,7 @@ void NonCombatStrategy::InitTriggers(std::vector& triggers) { + triggers.push_back(new TriggerNode("random", NextAction::array(0, new NextAction("clean quest log", 1.0f), nullptr))); triggers.push_back(new TriggerNode("timer", NextAction::array(0, new NextAction("check mount state", 1.0f), // new NextAction("check values", 1.0f), nullptr)));