mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-24 22:16:23 +00:00
84 lines
1.8 KiB
C++
84 lines
1.8 KiB
C++
#ifndef _PLAYERBOT_RAIDULDUARBOSSHELPER_H
|
|
#define _PLAYERBOT_RAIDULDUARBOSSHELPER_H
|
|
|
|
#include <string>
|
|
|
|
#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 "RaidUlduarScripts.h"
|
|
#include "ScriptedCreature.h"
|
|
#include "SharedDefines.h"
|
|
|
|
const uint32 ULDUAR_MAP_ID = 603;
|
|
|
|
template <class BossAiType>
|
|
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<BossAiType*>(_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
|