From 05aa8f01f128700a76582cc6915e58ef2925cfa9 Mon Sep 17 00:00:00 2001 From: AnchyDev Date: Tue, 2 May 2023 09:33:59 +1000 Subject: [PATCH] Update OnGiveXP to include new parameter. --- src/ElunaLuaEngine_SC.cpp | 4 ++-- src/LuaEngine/LuaEngine.h | 2 +- src/LuaEngine/PlayerHooks.cpp | 9 +++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/ElunaLuaEngine_SC.cpp b/src/ElunaLuaEngine_SC.cpp index 9e31be5..343de8b 100644 --- a/src/ElunaLuaEngine_SC.cpp +++ b/src/ElunaLuaEngine_SC.cpp @@ -657,9 +657,9 @@ public: sEluna->OnMoneyChanged(player, amount); } - void OnGiveXP(Player* player, uint32& amount, Unit* victim) override + void OnGiveXP(Player* player, uint32& amount, Unit* victim, uint8 xpSource) override { - sEluna->OnGiveXP(player, amount, victim); + sEluna->OnGiveXP(player, amount, victim, xpSource); } bool OnReputationChange(Player* player, uint32 factionID, int32& standing, bool incremental) override diff --git a/src/LuaEngine/LuaEngine.h b/src/LuaEngine/LuaEngine.h index 4bce4cb..f9d300d 100644 --- a/src/LuaEngine/LuaEngine.h +++ b/src/LuaEngine/LuaEngine.h @@ -456,7 +456,7 @@ public: void OnFreeTalentPointsChanged(Player* pPlayer, uint32 newPoints); void OnTalentsReset(Player* pPlayer, bool noCost); void OnMoneyChanged(Player* pPlayer, int32& amount); - void OnGiveXP(Player* pPlayer, uint32& amount, Unit* pVictim); + void OnGiveXP(Player* pPlayer, uint32& amount, Unit* pVictim, uint8 xpSource); bool OnReputationChange(Player* pPlayer, uint32 factionID, int32& standing, bool incremental); void OnDuelRequest(Player* pTarget, Player* pChallenger); void OnDuelStart(Player* pStarter, Player* pChallenger); diff --git a/src/LuaEngine/PlayerHooks.cpp b/src/LuaEngine/PlayerHooks.cpp index bdf0549..bd9bca2 100644 --- a/src/LuaEngine/PlayerHooks.cpp +++ b/src/LuaEngine/PlayerHooks.cpp @@ -227,18 +227,19 @@ void Eluna::OnMoneyChanged(Player* pPlayer, int32& amount) CleanUpStack(2); } -void Eluna::OnGiveXP(Player* pPlayer, uint32& amount, Unit* pVictim) +void Eluna::OnGiveXP(Player* pPlayer, uint32& amount, Unit* pVictim, uint8 xpSource) { START_HOOK(PLAYER_EVENT_ON_GIVE_XP); Push(pPlayer); Push(amount); Push(pVictim); + Push(xpSource); int amountIndex = lua_gettop(L) - 1; - int n = SetupStack(PlayerEventBindings, key, 3); + int n = SetupStack(PlayerEventBindings, key, 4); while (n > 0) { - int r = CallOneFunction(n--, 3, 1); + int r = CallOneFunction(n--, 4, 1); if (lua_isnumber(L, r)) { @@ -250,7 +251,7 @@ void Eluna::OnGiveXP(Player* pPlayer, uint32& amount, Unit* pVictim) lua_pop(L, 1); } - CleanUpStack(3); + CleanUpStack(4); } bool Eluna::OnReputationChange(Player* pPlayer, uint32 factionID, int32& standing, bool incremental)