From eef41ab3b713334584c3807e6198354714a9316b Mon Sep 17 00:00:00 2001 From: kadeshar Date: Fri, 20 Dec 2024 23:04:22 +0100 Subject: [PATCH] Added worldbuff strategy --- src/strategy/StrategyContext.h | 2 ++ src/strategy/generic/NonCombatStrategy.cpp | 6 +++++- src/strategy/generic/NonCombatStrategy.h | 10 ++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/strategy/StrategyContext.h b/src/strategy/StrategyContext.h index dad46bd8..ff16df1a 100644 --- a/src/strategy/StrategyContext.h +++ b/src/strategy/StrategyContext.h @@ -119,6 +119,7 @@ public: creators["move random"] = &StrategyContext::move_random; creators["formation"] = &StrategyContext::combat_formation; creators["move from group"] = &StrategyContext::move_from_group; + creators["worldbuff"] = &StrategyContext::world_buff; } private: @@ -186,6 +187,7 @@ private: static Strategy* move_random(PlayerbotAI* ai) { return new MoveRandomStrategy(ai); } static Strategy* combat_formation(PlayerbotAI* ai) { return new CombatFormationStrategy(ai); } static Strategy* move_from_group(PlayerbotAI* botAI) { return new MoveFromGroupStrategy(botAI); } + static Strategy* world_buff(PlayerbotAI* botAI) { return new WorldBuffStrategy(botAI); } }; class MovementStrategyContext : public NamedObjectContext diff --git a/src/strategy/generic/NonCombatStrategy.cpp b/src/strategy/generic/NonCombatStrategy.cpp index c35e6168..1fa49d61 100644 --- a/src/strategy/generic/NonCombatStrategy.cpp +++ b/src/strategy/generic/NonCombatStrategy.cpp @@ -16,7 +16,6 @@ void NonCombatStrategy::InitTriggers(std::vector& triggers) // triggers.push_back(new TriggerNode("near dark portal", NextAction::array(0, new NextAction("move to dark portal", 1.0f), nullptr))); // triggers.push_back(new TriggerNode("at dark portal azeroth", NextAction::array(0, new NextAction("use dark portal azeroth", 1.0f), nullptr))); // triggers.push_back(new TriggerNode("at dark portal outland", NextAction::array(0, new NextAction("move from dark portal", 1.0f), nullptr))); - // triggers.push_back(new TriggerNode("need world buff", NextAction::array(0, new NextAction("world buff", 1.0f), nullptr))); // triggers.push_back(new TriggerNode("vehicle near", NextAction::array(0, new NextAction("enter vehicle", 10.0f), nullptr))); } @@ -33,3 +32,8 @@ void MountStrategy::InitTriggers(std::vector& triggers) nullptr)));*/ /*triggers.push_back(new TriggerNode("often", NextAction::array(0, new NextAction("mount", 4.0f), nullptr)));*/ } + +void WorldBuffStrategy::InitTriggers(std::vector& triggers) +{ + triggers.push_back(new TriggerNode("need world buff", NextAction::array(0, new NextAction("world buff", 1.0f), NULL))); +} diff --git a/src/strategy/generic/NonCombatStrategy.h b/src/strategy/generic/NonCombatStrategy.h index d032dcf4..c6f266d1 100644 --- a/src/strategy/generic/NonCombatStrategy.h +++ b/src/strategy/generic/NonCombatStrategy.h @@ -48,4 +48,14 @@ public: std::string const getName() override { return "attack tagged"; } }; +class WorldBuffStrategy : public Strategy +{ +public: + WorldBuffStrategy(PlayerbotAI* ai) : Strategy(ai) {} + + uint32 GetType() const override { return STRATEGY_TYPE_NONCOMBAT; } + void InitTriggers(std::vector& triggers) override; + std::string const getName() override { return "worldbuff"; } +}; + #endif