mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Run clang-format
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#ifndef _PLAYERBOT_RAIDULDUARBOSSHELPER_H
|
||||
#define _PLAYERBOT_RAIDULDUARBOSSHELPER_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "AiObject.h"
|
||||
#include "AiObjectContext.h"
|
||||
#include "EventMap.h"
|
||||
@@ -9,63 +11,73 @@
|
||||
#include "Player.h"
|
||||
#include "PlayerbotAI.h"
|
||||
#include "Playerbots.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "RaidUlduarScripts.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "SharedDefines.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
_timer = _event_map->GetTimer();
|
||||
return true;
|
||||
}
|
||||
virtual void Reset() {
|
||||
_unit = nullptr;
|
||||
_target = nullptr;
|
||||
_ai = nullptr;
|
||||
_event_map = nullptr;
|
||||
_timer = 0;
|
||||
if (!_event_map)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
protected:
|
||||
std::string _name;
|
||||
Unit* _unit = nullptr;
|
||||
Creature* _target = nullptr;
|
||||
BossAiType *_ai = nullptr;
|
||||
EventMap* _event_map = nullptr;
|
||||
uint32 _timer = 0;
|
||||
_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
|
||||
|
||||
Reference in New Issue
Block a user