From caf9464cc7782cff37a9f529a64e61aa942cae39 Mon Sep 17 00:00:00 2001 From: Keleborn <22352763+Celandriel@users.noreply.github.com> Date: Wed, 17 Sep 2025 21:33:29 -0700 Subject: [PATCH] Integrate playerbots strategies, and actions for Onyxia (#737) playerbots strategies for Onyxia40 --- ...divualProgressionPlayerbotsActionContext.h | 22 +++++++++++++ .../IndividualProgressionOnyxiaActions.cpp | 31 +++++++++++++++++++ .../IndividualProgressionOnyxiaActions.h | 14 +++++++++ 3 files changed, 67 insertions(+) create mode 100644 src/playerbots/InidivualProgressionPlayerbotsActionContext.h create mode 100644 src/playerbots/raids/Onyxia/IndividualProgressionOnyxiaActions.cpp create mode 100644 src/playerbots/raids/Onyxia/IndividualProgressionOnyxiaActions.h diff --git a/src/playerbots/InidivualProgressionPlayerbotsActionContext.h b/src/playerbots/InidivualProgressionPlayerbotsActionContext.h new file mode 100644 index 0000000..c12509d --- /dev/null +++ b/src/playerbots/InidivualProgressionPlayerbotsActionContext.h @@ -0,0 +1,22 @@ +#ifdef MOD_PLAYERBOTS +#ifndef MOD_INDIVIDUAL_PROGRESSION_ACTIONCONTEXT_H +#define MOD_INDIVIDUAL_PROGRESSION_ACTIONCONTEXT_H + +#include "ActionContext.h" +#include "IndividualProgressionOnyxiaActions.h" +#include "RaidOnyxiaActionContext.h" + +class IPOnyxiaActionContext : public RaidOnyxiaActionContext +{ +public: + IPOnyxiaActionContext : public RaidOnyxiaActionContext () + { + creators["ony kill whelps"] = &IPOnyxiaActionContext::kill_whelps; + } +private: + static Action* kill_playerbots::ActionRegistry::RegisterAction("ony kill whelps", []() { return new IPOnyxiaKillWhelpsAction(ai); } + +}; + +#endif +#endif diff --git a/src/playerbots/raids/Onyxia/IndividualProgressionOnyxiaActions.cpp b/src/playerbots/raids/Onyxia/IndividualProgressionOnyxiaActions.cpp new file mode 100644 index 0000000..868e298 --- /dev/null +++ b/src/playerbots/raids/Onyxia/IndividualProgressionOnyxiaActions.cpp @@ -0,0 +1,31 @@ +#ifdef MOD_PLAYERBOTS +#include "Playerbots.h" +#include "IndividualProgressionOnyxiaActions.h" + +bool IPOnyxiaKillWhelpsAction::Execute(Event event) +{ + Unit* currentTarget = AI_VALUE(Unit*, "current target"); + // If already attacking a whelp, don't swap targets + if (currentTarget + && (currentTarget->GetEntry() == 11262 // Default AzerothCore Onyxian Whelp + || currentTarget->GetEntry() == 301001)) // mod-individual-progression Onyxian Whelp + { + return false; + } + GuidVector targets = AI_VALUE(GuidVector, "possible targets"); + for (ObjectGuid guid : targets) + { + Creature* unit = botAI->GetCreature(guid); + if (!unit || !unit->IsAlive() || !unit->IsInWorld()) + continue; + + if (unit->GetEntry() == 11262 // Default AzerothCore Onyxian Whelp + || unit->GetEntry() == 301001) // mod-individual-progression Onyxian Whelp + { + // bot->Yell("Attacking Whelps!", LANG_UNIVERSAL); + return Attack(unit); + } + } + return false; +} +#endif diff --git a/src/playerbots/raids/Onyxia/IndividualProgressionOnyxiaActions.h b/src/playerbots/raids/Onyxia/IndividualProgressionOnyxiaActions.h new file mode 100644 index 0000000..0f432db --- /dev/null +++ b/src/playerbots/raids/Onyxia/IndividualProgressionOnyxiaActions.h @@ -0,0 +1,14 @@ +#ifdef MOD_PLAYERBOTS +#ifndef MOD_INDIVIDUAL_PROGRESSION_ONYXIAACTIONS_H +#define MOD_INDIVIDUAL_PROGRESSION_ONYXIAACTIONS_H +#include "RaidOnyxiaActions.h" + +class IPOnyxiaKillWhelpsAction : public RaidOnyxiaKillWhelpsAction +{ +public: + using RaidOnyxiaKillWhelpsAction::RaidOnyxiaKillWhelpsAction; + bool Execute(Event event) override; +}; + +#endif +#endif