From 5ab57efd29b60d13e2ef74565bfe8e9acff0b95e Mon Sep 17 00:00:00 2001 From: Garashan Date: Mon, 11 Mar 2024 13:07:41 +0100 Subject: [PATCH] Ulduar base files Base files for ulduar. w/o any script --- .../raids/ulduar/RaidUlduarActionContext.h | 22 ++++++ .../raids/ulduar/RaidUlduarActions.cpp | 24 +++++++ src/strategy/raids/ulduar/RaidUlduarActions.h | 23 ++++++ .../raids/ulduar/RaidUlduarBossHelper.h | 71 +++++++++++++++++++ .../raids/ulduar/RaidUlduarMultipliers.cpp | 21 ++++++ .../raids/ulduar/RaidUlduarMultipliers.h | 8 +++ src/strategy/raids/ulduar/RaidUlduarScripts.h | 7 ++ .../raids/ulduar/RaidUlduarStrategy.cpp | 12 ++++ .../raids/ulduar/RaidUlduarStrategy.h | 21 ++++++ .../raids/ulduar/RaidUlduarTriggerContext.h | 23 ++++++ .../raids/ulduar/RaidUlduarTriggers.cpp | 5 ++ .../raids/ulduar/RaidUlduarTriggers.h | 13 ++++ 12 files changed, 250 insertions(+) create mode 100644 src/strategy/raids/ulduar/RaidUlduarActionContext.h create mode 100644 src/strategy/raids/ulduar/RaidUlduarActions.cpp create mode 100644 src/strategy/raids/ulduar/RaidUlduarActions.h create mode 100644 src/strategy/raids/ulduar/RaidUlduarBossHelper.h create mode 100644 src/strategy/raids/ulduar/RaidUlduarMultipliers.cpp create mode 100644 src/strategy/raids/ulduar/RaidUlduarMultipliers.h create mode 100644 src/strategy/raids/ulduar/RaidUlduarScripts.h create mode 100644 src/strategy/raids/ulduar/RaidUlduarStrategy.cpp create mode 100644 src/strategy/raids/ulduar/RaidUlduarStrategy.h create mode 100644 src/strategy/raids/ulduar/RaidUlduarTriggerContext.h create mode 100644 src/strategy/raids/ulduar/RaidUlduarTriggers.cpp create mode 100644 src/strategy/raids/ulduar/RaidUlduarTriggers.h diff --git a/src/strategy/raids/ulduar/RaidUlduarActionContext.h b/src/strategy/raids/ulduar/RaidUlduarActionContext.h new file mode 100644 index 00000000..e907a07f --- /dev/null +++ b/src/strategy/raids/ulduar/RaidUlduarActionContext.h @@ -0,0 +1,22 @@ +// /* +// * Copyright (C) 2016+ AzerothCore , released under GNU GPL v2 license, you may redistribute it and/or modify it under version 2 of the License, or (at your option), any later version. +// */ + +#ifndef _PLAYERBOT_RAIDULDUARACTIONCONTEXT_H +#define _PLAYERBOT_RAIDULDUARACTIONCONTEXT_H + +#include "Action.h" +#include "NamedObjectContext.h" +#include "RaidUlduarActions.h" + +class RaidUlduarActionContext : public NamedObjectContext +{ + public: + RaidUlduarActionContext() { + + } + private: + +}; + +#endif \ No newline at end of file diff --git a/src/strategy/raids/ulduar/RaidUlduarActions.cpp b/src/strategy/raids/ulduar/RaidUlduarActions.cpp new file mode 100644 index 00000000..f678bee8 --- /dev/null +++ b/src/strategy/raids/ulduar/RaidUlduarActions.cpp @@ -0,0 +1,24 @@ + +#include "ObjectGuid.h" +#include "PlayerbotAIConfig.h" +#include "Playerbots.h" +#include "RaidUlduarActions.h" +#include "RaidUlduarStrategy.h" +#include "ScriptedCreature.h" +#include "SharedDefines.h" +#include "RaidUlduarBossHelper.h" + +uint32 RotateAroundTheCenterPointAction::FindNearestWaypoint() +{ + float minDistance = 0; + int ret = -1; + for (int i = 0; i < intervals; i++) { + float w_x = waypoints[i].first, w_y = waypoints[i].second; + float dis = bot->GetDistance2d(w_x, w_y); + if (ret == -1 || dis < minDistance) { + ret = i; + minDistance = dis; + } + } + return ret; +} \ No newline at end of file diff --git a/src/strategy/raids/ulduar/RaidUlduarActions.h b/src/strategy/raids/ulduar/RaidUlduarActions.h new file mode 100644 index 00000000..314d4370 --- /dev/null +++ b/src/strategy/raids/ulduar/RaidUlduarActions.h @@ -0,0 +1,23 @@ +#ifndef _PLAYERBOT_RAIDULDUARACTIONS_H +#define _PLAYERBOT_RAIDULDUARACTIONS_H + +#include "Action.h" +#include "MovementActions.h" +#include "AttackAction.h" +#include "GenericActions.h" +#include "PlayerbotAI.h" +#include "Playerbots.h" +#include "RaidUlduarScripts.h" +#include "RaidUlduarBossHelper.h" + +// just for test +// class TryToGetBossAIAction : public Action +// { +// public: +// TryToGetBossAIAction(PlayerbotAI* ai) : Action(ai, "try to get boss ai") {} + +// public: +// virtual bool Execute(Event event); +// }; + +#endif \ No newline at end of file diff --git a/src/strategy/raids/ulduar/RaidUlduarBossHelper.h b/src/strategy/raids/ulduar/RaidUlduarBossHelper.h new file mode 100644 index 00000000..36360524 --- /dev/null +++ b/src/strategy/raids/ulduar/RaidUlduarBossHelper.h @@ -0,0 +1,71 @@ +#ifndef _PLAYERBOT_RAIDULDUARBOSSHELPER_H +#define _PLAYERBOT_RAIDULDUARBOSSHELPER_H + +#include "AiObject.h" +#include "AiObjectContext.h" +#include "EventMap.h" +#include "Log.h" +#include "ObjectGuid.h" +#include "Player.h" +#include "PlayerbotAI.h" +#include "Playerbots.h" +#include "ScriptedCreature.h" +#include "RaidUlduarScripts.h" +#include "SharedDefines.h" + +#include + +const uint32 ULDUAR_MAP_ID = 603; + +template +class GenericBossHelper : public AiObject { + public: + GenericBossHelper(PlayerbotAI* botAI, std::string name): AiObject(botAI), _name(name) {} + virtual bool UpdateBossAI() { + if (!bot->IsInCombat()) { + _unit = nullptr; + } + if(_unit && (!_unit->IsInWorld() || !_unit->IsAlive())) { + _unit = nullptr; + } + if (!_unit) { + _unit = AI_VALUE2(Unit*, "find target", _name); + if (!_unit) { + return false; + } + _target = _unit->ToCreature(); + if (!_target) { + return false; + } + _ai = dynamic_cast(_target->GetAI()); + if (!_ai) { + return false; + } + _event_map = &_ai->events; + if (!_event_map) { + return false; + } + } + if (!_event_map) { + return false; + } + _timer = _event_map->GetTimer(); + return true; + } + virtual void Reset() { + _unit = nullptr; + _target = nullptr; + _ai = nullptr; + _event_map = nullptr; + _timer = 0; + } + protected: + std::string _name; + Unit* _unit = nullptr; + Creature* _target = nullptr; + BossAiType *_ai = nullptr; + EventMap* _event_map = nullptr; + uint32 _timer = 0; +}; + +#endif diff --git a/src/strategy/raids/ulduar/RaidUlduarMultipliers.cpp b/src/strategy/raids/ulduar/RaidUlduarMultipliers.cpp new file mode 100644 index 00000000..8801c322 --- /dev/null +++ b/src/strategy/raids/ulduar/RaidUlduarMultipliers.cpp @@ -0,0 +1,21 @@ +#include "RaidUlduarMultipliers.h" +#include "GenericActions.h" +#include "MovementActions.h" +#include "ScriptedCreature.h" +#include "RaidUlduarActions.h" +#include "GenericSpellActions.h" +#include "ChooseTargetActions.h" +#include "ReachTargetActions.h" +#include "UseMeetingStoneAction.h" +#include "FollowActions.h" +#include "ShamanActions.h" +#include "PriestActions.h" +#include "DKActions.h" +#include "HunterActions.h" +#include "MageActions.h" +#include "RogueActions.h" +#include "DruidActions.h" +#include "PaladinActions.h" +#include "WarriorActions.h" +#include "DruidBearActions.h" + diff --git a/src/strategy/raids/ulduar/RaidUlduarMultipliers.h b/src/strategy/raids/ulduar/RaidUlduarMultipliers.h new file mode 100644 index 00000000..76ed53c3 --- /dev/null +++ b/src/strategy/raids/ulduar/RaidUlduarMultipliers.h @@ -0,0 +1,8 @@ + +#ifndef _PLAYERRBOT_RAIDULDUARMULTIPLIERS_H_ +#define _PLAYERRBOT_RAIDULDUARMULTIPLIERS_H_ + +#include "Multiplier.h" +#include "raids/ulduar/RaidUlduarBossHelper.h" + +#endif \ No newline at end of file diff --git a/src/strategy/raids/ulduar/RaidUlduarScripts.h b/src/strategy/raids/ulduar/RaidUlduarScripts.h new file mode 100644 index 00000000..382177de --- /dev/null +++ b/src/strategy/raids/ulduar/RaidUlduarScripts.h @@ -0,0 +1,7 @@ +#ifndef _PLAYERBOT_RAIDULDUARSCRIPTS_H +#define _PLAYERBOT_RAIDULDUARSCRIPTS_H + +//There are no header files for bosses in Ulduar directory +//#include "../../../../src/server/scripts/Northrend/Ulduar/Ulduar/" + +#endif diff --git a/src/strategy/raids/ulduar/RaidUlduarStrategy.cpp b/src/strategy/raids/ulduar/RaidUlduarStrategy.cpp new file mode 100644 index 00000000..3e3cd8e2 --- /dev/null +++ b/src/strategy/raids/ulduar/RaidUlduarStrategy.cpp @@ -0,0 +1,12 @@ +#include "RaidUlduarStrategy.h" +#include "RaidUlduarMultipliers.h" + + +void RaidUlduarStrategy::InitTriggers(std::vector &triggers) +{ + +} + +void RaidUlduarStrategy::InitMultipliers(std::vector &multipliers) +{ +} diff --git a/src/strategy/raids/ulduar/RaidUlduarStrategy.h b/src/strategy/raids/ulduar/RaidUlduarStrategy.h new file mode 100644 index 00000000..207cec7d --- /dev/null +++ b/src/strategy/raids/ulduar/RaidUlduarStrategy.h @@ -0,0 +1,21 @@ + +#ifndef _PLAYERBOT_RAIDULDUARSTRATEGY_H +#define _PLAYERBOT_RAIDULDUARSTRATEGY_H + +#include "Multiplier.h" +#include "AiObjectContext.h" +#include "Strategy.h" +#include "RaidUlduarScripts.h" + + +class RaidUlduarStrategy : public Strategy +{ +public: + RaidUlduarStrategy(PlayerbotAI* ai) : Strategy(ai) {} + virtual std::string const getName() override { return "ulduar"; } + virtual void InitTriggers(std::vector &triggers) override; + virtual void InitMultipliers(std::vector &multipliers) override; +}; + + +#endif \ No newline at end of file diff --git a/src/strategy/raids/ulduar/RaidUlduarTriggerContext.h b/src/strategy/raids/ulduar/RaidUlduarTriggerContext.h new file mode 100644 index 00000000..e086d2c6 --- /dev/null +++ b/src/strategy/raids/ulduar/RaidUlduarTriggerContext.h @@ -0,0 +1,23 @@ +// /* +// * Copyright (C) 2016+ AzerothCore , released under GNU GPL v2 license, you may redistribute it and/or modify it under version 2 of the License, or (at your option), any later version. +// */ + +#ifndef _PLAYERBOT_RAIDULDUARTRIGGERCONTEXT_H +#define _PLAYERBOT_RAIDULDUARTRIGGERCONTEXT_H + +#include "NamedObjectContext.h" +#include "AiObjectContext.h" +#include "RaidUlduarTriggers.h" + +class RaidUlduarTriggerContext : public NamedObjectContext +{ + public: + RaidUlduarTriggerContext() + { + + } + private: + +}; + +#endif \ No newline at end of file diff --git a/src/strategy/raids/ulduar/RaidUlduarTriggers.cpp b/src/strategy/raids/ulduar/RaidUlduarTriggers.cpp new file mode 100644 index 00000000..9255b19f --- /dev/null +++ b/src/strategy/raids/ulduar/RaidUlduarTriggers.cpp @@ -0,0 +1,5 @@ +#include "EventMap.h" +#include "Playerbots.h" +#include "RaidUlduarTriggers.h" +#include "ScriptedCreature.h" +#include "Trigger.h" diff --git a/src/strategy/raids/ulduar/RaidUlduarTriggers.h b/src/strategy/raids/ulduar/RaidUlduarTriggers.h new file mode 100644 index 00000000..fa4b62c0 --- /dev/null +++ b/src/strategy/raids/ulduar/RaidUlduarTriggers.h @@ -0,0 +1,13 @@ +#ifndef _PLAYERBOT_RAIDULDUARTRIGGERS_H +#define _PLAYERBOT_RAIDULDUARTRIGGERS_H + +#include "EventMap.h" +#include "Trigger.h" +#include "PlayerbotAIConfig.h" +#include "GenericTriggers.h" +#include "RaidUlduarScripts.h" +#include "RaidUlduarBossHelper.h" + + + +#endif \ No newline at end of file