diff --git a/src/ElunaLuaEngine_SC.cpp b/src/ElunaLuaEngine_SC.cpp index dbe2300..449c1ed 100644 --- a/src/ElunaLuaEngine_SC.cpp +++ b/src/ElunaLuaEngine_SC.cpp @@ -69,6 +69,7 @@ public: bool CanCreatureQuestAccept(Player* player, Creature* creature, Quest const* quest) override { + sEluna->OnPlayerQuestAccept(player, quest); sEluna->OnQuestAccept(player, creature, quest); return false; } @@ -146,6 +147,7 @@ public: bool CanGameObjectQuestAccept(Player* player, GameObject* go, Quest const* quest) override { + sEluna->OnPlayerQuestAccept(player, quest); sEluna->OnQuestAccept(player, go, quest); return false; } @@ -169,7 +171,10 @@ public: bool CanGameObjectQuestReward(Player* player, GameObject* go, Quest const* quest, uint32 opt) override { if (sEluna->OnQuestAccept(player, go, quest)) + { + sEluna->OnPlayerQuestAccept(player, quest); return false; + } if (sEluna->OnQuestReward(player, go, quest, opt)) return false; @@ -192,7 +197,10 @@ public: bool CanItemQuestAccept(Player* player, Item* item, Quest const* quest) override { if (sEluna->OnQuestAccept(player, item, quest)) + { + sEluna->OnPlayerQuestAccept(player, quest); return false; + } return true; } diff --git a/src/LuaEngine/Hooks.h b/src/LuaEngine/Hooks.h index da72aad..e348d93 100644 --- a/src/LuaEngine/Hooks.h +++ b/src/LuaEngine/Hooks.h @@ -226,6 +226,7 @@ namespace Hooks PLAYER_EVENT_ON_CAN_UPDATE_SKILL = 60, // (event, player, skill_id) -- Can return true or false PLAYER_EVENT_ON_BEFORE_UPDATE_SKILL = 61, // (event, player, skill_id, value, max, step) -- Can return new amount PLAYER_EVENT_ON_UPDATE_SKILL = 62, // (event, player, skill_id, value, max, step, new_value) + PLAYER_EVENT_ON_QUEST_ACCEPT = 63, // (event, player, quest) PLAYER_EVENT_COUNT }; diff --git a/src/LuaEngine/LuaEngine.h b/src/LuaEngine/LuaEngine.h index 19be307..86c408c 100644 --- a/src/LuaEngine/LuaEngine.h +++ b/src/LuaEngine/LuaEngine.h @@ -491,6 +491,7 @@ public: void OnPlayerBeforeUpdateSkill(Player* player, uint32 skill_id, uint32& value, uint32 max, uint32 step); void OnPlayerUpdateSkill(Player* player, uint32 skill_id, uint32 value, uint32 max, uint32 step, uint32 new_value); bool CanPlayerResurrect(Player* player); + void OnPlayerQuestAccept(Player* player, Quest const* quest); /* Vehicle */ void OnInstall(Vehicle* vehicle); diff --git a/src/LuaEngine/hooks/PlayerHooks.cpp b/src/LuaEngine/hooks/PlayerHooks.cpp index 08823dd..b38f529 100644 --- a/src/LuaEngine/hooks/PlayerHooks.cpp +++ b/src/LuaEngine/hooks/PlayerHooks.cpp @@ -754,10 +754,17 @@ void Eluna::OnPlayerUpdateSkill(Player* player, uint32 skill_id, uint32 value, u CallAllFunctions(PlayerEventBindings, key); } - bool Eluna::CanPlayerResurrect(Player* player) { START_HOOK_WITH_RETVAL(PLAYER_EVENT_ON_CAN_RESURRECT, true); Push(player); return CallAllFunctionsBool(PlayerEventBindings, key); } + +void Eluna::OnPlayerQuestAccept(Player* player, Quest const* quest) +{ + START_HOOK(PLAYER_EVENT_ON_QUEST_ACCEPT); + Push(player); + Push(quest); + CallAllFunctions(PlayerEventBindings, key); +}