mirror of
https://github.com/araxiaonline/mod-mythic-plus.git
synced 2026-06-13 03:02:24 -04:00
Added new base class for updating creatures for events from AI
This commit is contained in:
28
src/BaseCreatureHandler.h
Normal file
28
src/BaseCreatureHandler.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "CreatureHooks.h"
|
||||
#include "MpLogger.h"
|
||||
|
||||
class BaseCreatureHandler {
|
||||
public:
|
||||
BaseCreatureHandler(uint32 entry) {
|
||||
|
||||
ASSERT(entry > 0);
|
||||
|
||||
MpLogger::debug("Registering JustDied and OnSpawn events for entry: ", entry);
|
||||
|
||||
// Register the JustDied event
|
||||
sCreatureHooks->RegisterJustDied(entry, [this](Creature* creature, Unit* killer) {
|
||||
this->OnJustDied(creature, killer);
|
||||
});
|
||||
|
||||
// Register the OnSpawn event
|
||||
sCreatureHooks->RegisterOnSpawn(entry, [this](Creature* creature) {
|
||||
this->OnJustSpawned(creature);
|
||||
});
|
||||
}
|
||||
|
||||
// Virtual event handlers to be overridden by bosses
|
||||
virtual void OnJustDied(Creature* creature, Unit* killer) = 0;
|
||||
virtual void OnJustSpawned(Creature* creature) = 0;
|
||||
|
||||
virtual ~BaseCreatureHandler() {}
|
||||
};
|
||||
Reference in New Issue
Block a user