Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ElunaIncludes.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "ScriptMgr.h"
#include "Spell.h"
#include "SpellAuras.h"
#include "SpellAuraEffects.h"
#include "SpellMgr.h"
#include "TemporarySummon.h"
#include "WorldPacket.h"
Expand Down
7 changes: 7 additions & 0 deletions ElunaTemplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ ElunaConstrainedObjectRef<Aura> GetWeakPtrFor(Aura const* obj)
#endif
return { obj->GetWeakPtr(), map };
}

ElunaConstrainedObjectRef<AuraEffect> GetWeakPtrFor(AuraEffect const* obj)
{
Map* map = obj->GetBase()->GetOwner()->GetMap();
return { obj->GetWeakPtr(), map };
}

ElunaConstrainedObjectRef<BattleGround> GetWeakPtrFor(BattleGround const* obj) { return { obj->GetWeakPtr(), obj->GetBgMap() }; }
ElunaConstrainedObjectRef<Group> GetWeakPtrFor(Group const* obj) { return { obj->GetWeakPtr(), nullptr }; }
ElunaConstrainedObjectRef<Guild> GetWeakPtrFor(Guild const* obj) { return { obj->GetWeakPtr(), nullptr }; }
Expand Down
1 change: 1 addition & 0 deletions ElunaTemplate.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ struct ElunaConstrainedObjectRef
};

ElunaConstrainedObjectRef<Aura> GetWeakPtrFor(Aura const* obj);
ElunaConstrainedObjectRef<AuraEffect> GetWeakPtrFor(AuraEffect const* obj);
ElunaConstrainedObjectRef<BattleGround> GetWeakPtrFor(BattleGround const* obj);
ElunaConstrainedObjectRef<Group> GetWeakPtrFor(Group const* obj);
ElunaConstrainedObjectRef<Guild> GetWeakPtrFor(Guild const* obj);
Expand Down
6 changes: 6 additions & 0 deletions LuaEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,12 @@ class ELUNA_GAME_API Eluna

/* Spell */
void OnSpellCast(Spell* pSpell, bool skipCheck);
bool OnAuraApplication(Aura* aura, AuraEffect const* auraEff, Unit* target, uint8 mode, bool apply);
void OnAuraDispel(Aura* aura, DispelInfo* dispelInfo);
bool OnPerodicTick(Aura* aura, AuraEffect const* auraEff, Unit* target);
void OnPerodicUpdate(Aura* aura, AuraEffect const* auraEff);
void OnAuraCalcAmount(Aura* aura, AuraEffect const* auraEff, int32& amount, bool& canBeRecalculated);
void OnCalcPerodic(Aura* aura, AuraEffect const* auraEff, bool& isPeriodic, int32& amplitude);
};
template<> Unit* Eluna::CHECKOBJ<Unit>(int narg, bool error);
template<> Object* Eluna::CHECKOBJ<Object>(int narg, bool error);
Expand Down
84 changes: 45 additions & 39 deletions hooks/Hooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ namespace Hooks
};

// PACKET EVENTS
#define PACKET_EVENTS_LIST(X) \
#define PACKET_EVENTS_LIST(X) \
X(PACKET_EVENT_ON_PACKET_RECEIVE, 5, "on_receive") \
X(PACKET_EVENT_ON_PACKET_RECEIVE_UNKNOWN, 6, "on_receive_unk") \
X(PACKET_EVENT_ON_PACKET_SEND, 7, "on_send")

enum PacketEvents
{
#define X(ID, VALUE, NAME) ID = VALUE,
#define X(ID, VALUE, NAME) ID = VALUE,
PACKET_EVENTS_LIST(X)
#undef X
#undef X
PACKET_EVENT_COUNT
};

Expand All @@ -74,7 +74,7 @@ namespace Hooks
};

// SERVER EVENTS
#define SERVER_EVENTS_LIST(X) \
#define SERVER_EVENTS_LIST(X) \
/* Server */ \
X(SERVER_EVENT_ON_NETWORK_START, 1, "on_network_start") \
X(SERVER_EVENT_ON_NETWORK_STOP, 2, "on_network_stop") \
Expand Down Expand Up @@ -123,9 +123,9 @@ namespace Hooks

enum ServerEvents
{
#define X(ID, VALUE, NAME) ID = VALUE,
#define X(ID, VALUE, NAME) ID = VALUE,
SERVER_EVENTS_LIST(X)
#undef X
#undef X
SERVER_EVENT_COUNT
};

Expand All @@ -136,7 +136,7 @@ namespace Hooks
};

// PLAYER EVENTS
#define PLAYER_EVENTS_LIST(X) \
#define PLAYER_EVENTS_LIST(X) \
X(PLAYER_EVENT_ON_CHARACTER_CREATE, 1, "on_character_create") \
X(PLAYER_EVENT_ON_CHARACTER_DELETE, 2, "on_character_delete") \
X(PLAYER_EVENT_ON_LOGIN, 3, "on_login") \
Expand Down Expand Up @@ -191,9 +191,9 @@ namespace Hooks

enum PlayerEvents
{
#define X(ID, VALUE, NAME) ID = VALUE,
#define X(ID, VALUE, NAME) ID = VALUE,
PLAYER_EVENTS_LIST(X)
#undef X
#undef X
PLAYER_EVENT_COUNT
};

Expand All @@ -204,7 +204,7 @@ namespace Hooks
};

// GUILD EVENTS
#define GUILD_EVENTS_LIST(X) \
#define GUILD_EVENTS_LIST(X) \
X(GUILD_EVENT_ON_ADD_MEMBER, 1, "on_add_member") \
X(GUILD_EVENT_ON_REMOVE_MEMBER, 2, "on_remove_member") \
X(GUILD_EVENT_ON_MOTD_CHANGE, 3, "on_motd_change") \
Expand All @@ -219,9 +219,9 @@ namespace Hooks

enum GuildEvents
{
#define X(ID, VALUE, NAME) ID = VALUE,
#define X(ID, VALUE, NAME) ID = VALUE,
GUILD_EVENTS_LIST(X)
#undef X
#undef X
GUILD_EVENT_COUNT
};

Expand All @@ -232,7 +232,7 @@ namespace Hooks
};

// GROUP EVENTS
#define GROUP_EVENTS_LIST(X) \
#define GROUP_EVENTS_LIST(X) \
X(GROUP_EVENT_ON_MEMBER_ADD, 1, "on_add_member") \
X(GROUP_EVENT_ON_MEMBER_INVITE, 2, "on_invite_member") \
X(GROUP_EVENT_ON_MEMBER_REMOVE, 3, "on_remove_member") \
Expand All @@ -243,9 +243,9 @@ namespace Hooks

enum GroupEvents
{
#define X(ID, VALUE, NAME) ID = VALUE,
#define X(ID, VALUE, NAME) ID = VALUE,
GROUP_EVENTS_LIST(X)
#undef X
#undef X
GROUP_EVENT_COUNT
};

Expand All @@ -256,7 +256,7 @@ namespace Hooks
};

// VEHICLE EVENTS
#define VEHICLE_EVENTS_LIST(X) \
#define VEHICLE_EVENTS_LIST(X) \
X(VEHICLE_EVENT_ON_INSTALL, 1, "on_install") \
X(VEHICLE_EVENT_ON_UNINSTALL, 2, "on_uninstall") \
/* 3 unused */ \
Expand All @@ -266,9 +266,9 @@ namespace Hooks

enum VehicleEvents
{
#define X(ID, VALUE, NAME) ID = VALUE,
#define X(ID, VALUE, NAME) ID = VALUE,
VEHICLE_EVENTS_LIST(X)
#undef X
#undef X
VEHICLE_EVENT_COUNT
};

Expand All @@ -279,7 +279,7 @@ namespace Hooks
};

// CREATURE EVENTS
#define CREATURE_EVENTS_LIST(X) \
#define CREATURE_EVENTS_LIST(X) \
X(CREATURE_EVENT_ON_ENTER_COMBAT, 1, "on_enter_combat") \
X(CREATURE_EVENT_ON_LEAVE_COMBAT, 2, "on_leave_combat") \
X(CREATURE_EVENT_ON_TARGET_DIED, 3, "on_target_died") \
Expand Down Expand Up @@ -316,9 +316,9 @@ namespace Hooks

enum CreatureEvents
{
#define X(ID, VALUE, NAME) ID = VALUE,
#define X(ID, VALUE, NAME) ID = VALUE,
CREATURE_EVENTS_LIST(X)
#undef X
#undef X
CREATURE_EVENT_COUNT
};

Expand All @@ -329,7 +329,7 @@ namespace Hooks
};

// GAMEOBJECT EVENTS
#define GAMEOBJECT_EVENTS_LIST(X) \
#define GAMEOBJECT_EVENTS_LIST(X) \
X(GAMEOBJECT_EVENT_ON_AIUPDATE, 1, "on_ai_update") \
X(GAMEOBJECT_EVENT_ON_SPAWN, 2, "on_spawn") \
X(GAMEOBJECT_EVENT_ON_DUMMY_EFFECT, 3, "on_dummy_effect") \
Expand All @@ -347,9 +347,9 @@ namespace Hooks

enum GameObjectEvents
{
#define X(ID, VALUE, NAME) ID = VALUE,
#define X(ID, VALUE, NAME) ID = VALUE,
GAMEOBJECT_EVENTS_LIST(X)
#undef X
#undef X
GAMEOBJECT_EVENT_COUNT
};

Expand All @@ -360,14 +360,20 @@ namespace Hooks
};

// SPELL EVENTS
#define SPELL_EVENTS_LIST(X) \
#define SPELL_EVENTS_LIST(X) \
X(SPELL_EVENT_ON_CAST, 1, "on_cast")
X(SPELL_EVENT_ON_AURA_APPLICATION, 2, "on_aura_application")
X(SPELL_EVENT_ON_DISPEL, 3, "on_dispel")
X(SPELL_EVENT_ON_PERODIC_TICK, 4, "on_periodic_tick")
X(SPELL_EVENT_ON_PERODIC_UPDATE, 5, "on_periodic_update")
X(SPELL_EVENT_ON_AURA_CALC_AMOUNT, 6, "on_aura_calc_amount")
X(SPELL_EVENT_ON_CALC_PERODIC, 7, "on_calc_periodic")

enum SpellEvents
{
#define X(ID, VALUE, NAME) ID = VALUE,
#define X(ID, VALUE, NAME) ID = VALUE,
SPELL_EVENTS_LIST(X)
#undef X
#undef X
SPELL_EVENT_COUNT
};

Expand All @@ -378,7 +384,7 @@ namespace Hooks
};

// ITEM EVENTS
#define ITEM_EVENTS_LIST(X) \
#define ITEM_EVENTS_LIST(X) \
X(ITEM_EVENT_ON_DUMMY_EFFECT, 1, "on_dummy_effect") \
X(ITEM_EVENT_ON_USE, 2, "on_use") \
X(ITEM_EVENT_ON_QUEST_ACCEPT, 3, "on_quest_accept") \
Expand All @@ -391,9 +397,9 @@ namespace Hooks

enum ItemEvents
{
#define X(ID, VALUE, NAME) ID = VALUE,
#define X(ID, VALUE, NAME) ID = VALUE,
ITEM_EVENTS_LIST(X)
#undef X
#undef X
ITEM_EVENT_COUNT
};

Expand All @@ -404,15 +410,15 @@ namespace Hooks
};

// GOSSIP EVENTS
#define GOSSIP_EVENTS_LIST(X) \
#define GOSSIP_EVENTS_LIST(X) \
X(GOSSIP_EVENT_ON_HELLO, 1, "on_hello") \
X(GOSSIP_EVENT_ON_SELECT, 2, "on_select")

enum GossipEvents
{
#define X(ID, VALUE, NAME) ID = VALUE,
#define X(ID, VALUE, NAME) ID = VALUE,
GOSSIP_EVENTS_LIST(X)
#undef X
#undef X
GOSSIP_EVENT_COUNT
};

Expand All @@ -423,17 +429,17 @@ namespace Hooks
};

// BG EVENTS
#define BG_EVENTS_LIST(X) \
#define BG_EVENTS_LIST(X) \
X(BG_EVENT_ON_START, 1, "on_start") \
X(BG_EVENT_ON_END, 2, "on_end") \
X(BG_EVENT_ON_CREATE, 3, "on_create") \
X(BG_EVENT_ON_PRE_DESTROY,4, "on_pre_destroy")

enum BGEvents
{
#define X(ID, VALUE, NAME) ID = VALUE,
#define X(ID, VALUE, NAME) ID = VALUE,
BG_EVENTS_LIST(X)
#undef X
#undef X
BG_EVENT_COUNT
};

Expand All @@ -444,7 +450,7 @@ namespace Hooks
};

// INSTANCE EVENTS
#define INSTANCE_EVENTS_LIST(X) \
#define INSTANCE_EVENTS_LIST(X) \
X(INSTANCE_EVENT_ON_INITIALIZE, 1, "on_initialize") \
X(INSTANCE_EVENT_ON_LOAD, 2, "on_load") \
X(INSTANCE_EVENT_ON_UPDATE, 3, "on_update") \
Expand All @@ -455,9 +461,9 @@ namespace Hooks

enum InstanceEvents
{
#define X(ID, VALUE, NAME) ID = VALUE,
#define X(ID, VALUE, NAME) ID = VALUE,
INSTANCE_EVENTS_LIST(X)
#undef X
#undef X
INSTANCE_EVENT_COUNT
};

Expand Down
Loading
Loading