From 7be917335ac94c1c6269027da48b63d9c941c5a2 Mon Sep 17 00:00:00 2001 From: Foereaper Date: Wed, 10 Sep 2014 01:28:52 +0200 Subject: [PATCH] Added new hook for post reload --- HookMgr.cpp | 7 +++++++ HookMgr.h | 7 ++++--- LuaEngine.cpp | 2 ++ LuaEngine.h | 1 + 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/HookMgr.cpp b/HookMgr.cpp index 9b82013..4a9ea3d 100644 --- a/HookMgr.cpp +++ b/HookMgr.cpp @@ -116,6 +116,13 @@ void Eluna::OnLuaStateClose() ENDCALL(); } +void Eluna::OnLuaStateOpen() +{ + EVENT_BEGIN(ServerEventBindings, ELUNA_EVENT_ON_LUA_STATE_OPEN, return); + EVENT_EXECUTE(0); + ENDCALL(); +} + // areatrigger bool Eluna::OnAreaTrigger(Player* pPlayer, AreaTriggerEntry const* pTrigger) { diff --git a/HookMgr.h b/HookMgr.h index deb4eba..1008fcb 100644 --- a/HookMgr.h +++ b/HookMgr.h @@ -49,10 +49,10 @@ namespace HookMgr SERVER_EVENT_ON_PACKET_RECEIVE_UNKNOWN = 6, // Not Implemented SERVER_EVENT_ON_PACKET_SEND = 7, // (event, packet, player) - Player only if accessible. Can return false or a new packet - // World // Not implemented on mangos - WORLD_EVENT_ON_OPEN_STATE_CHANGE = 8, // (event, open) + // World + WORLD_EVENT_ON_OPEN_STATE_CHANGE = 8, // (event, open) - Needs core support on Mangos WORLD_EVENT_ON_CONFIG_LOAD = 9, // (event, reload) - // UNUSED = 10, // (event) + // UNUSED = 10, WORLD_EVENT_ON_SHUTDOWN_INIT = 11, // (event, code, mask) WORLD_EVENT_ON_SHUTDOWN_CANCEL = 12, // (event) WORLD_EVENT_ON_UPDATE = 13, // (event, diff) @@ -61,6 +61,7 @@ namespace HookMgr // Eluna ELUNA_EVENT_ON_LUA_STATE_CLOSE = 16, // (event) + ELUNA_EVENT_ON_LUA_STATE_OPEN = 33, // (event) - Possibly change hook ID for increments? Not implemented on TC/Cmangos // Map MAP_EVENT_ON_CREATE = 17, // (event, map) diff --git a/LuaEngine.cpp b/LuaEngine.cpp index a6e3107..fbe8f77 100644 --- a/LuaEngine.cpp +++ b/LuaEngine.cpp @@ -124,6 +124,8 @@ playerGossipBindings(new EntryBind("GossipEvents (player) // run scripts RunScripts(); + + OnLuaStateOpen(); } Eluna::~Eluna() diff --git a/LuaEngine.h b/LuaEngine.h index 82a2efb..0cece17 100644 --- a/LuaEngine.h +++ b/LuaEngine.h @@ -194,6 +194,7 @@ public: void OnQuestAbandon(Player* pPlayer, uint32 questId); InventoryResult OnCanUseItem(const Player* pPlayer, uint32 itemEntry); void OnLuaStateClose(); + void OnLuaStateOpen(); bool OnAddonMessage(Player* sender, uint32 type, std::string& msg, Player* receiver, Guild* guild, Group* group, Channel* channel); /* Item */