mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
fix: Include new parameter for OnGiveXP hook. (#131)
This commit is contained in:
@@ -657,9 +657,9 @@ public:
|
|||||||
sEluna->OnMoneyChanged(player, amount);
|
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
|
bool OnReputationChange(Player* player, uint32 factionID, int32& standing, bool incremental) override
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ namespace Hooks
|
|||||||
PLAYER_EVENT_ON_DUEL_REQUEST = 9, // (event, target, challenger)
|
PLAYER_EVENT_ON_DUEL_REQUEST = 9, // (event, target, challenger)
|
||||||
PLAYER_EVENT_ON_DUEL_START = 10, // (event, player1, player2)
|
PLAYER_EVENT_ON_DUEL_START = 10, // (event, player1, player2)
|
||||||
PLAYER_EVENT_ON_DUEL_END = 11, // (event, winner, loser, type)
|
PLAYER_EVENT_ON_DUEL_END = 11, // (event, winner, loser, type)
|
||||||
PLAYER_EVENT_ON_GIVE_XP = 12, // (event, player, amount, victim) - Can return new XP amount
|
PLAYER_EVENT_ON_GIVE_XP = 12, // (event, player, amount, victim, source) - Can return new XP amount
|
||||||
PLAYER_EVENT_ON_LEVEL_CHANGE = 13, // (event, player, oldLevel)
|
PLAYER_EVENT_ON_LEVEL_CHANGE = 13, // (event, player, oldLevel)
|
||||||
PLAYER_EVENT_ON_MONEY_CHANGE = 14, // (event, player, amount) - Can return new money amount
|
PLAYER_EVENT_ON_MONEY_CHANGE = 14, // (event, player, amount) - Can return new money amount
|
||||||
PLAYER_EVENT_ON_REPUTATION_CHANGE = 15, // (event, player, factionId, standing, incremental) - Can return new standing -> if standing == -1, it will prevent default action (rep gain)
|
PLAYER_EVENT_ON_REPUTATION_CHANGE = 15, // (event, player, factionId, standing, incremental) - Can return new standing -> if standing == -1, it will prevent default action (rep gain)
|
||||||
|
|||||||
@@ -456,7 +456,7 @@ public:
|
|||||||
void OnFreeTalentPointsChanged(Player* pPlayer, uint32 newPoints);
|
void OnFreeTalentPointsChanged(Player* pPlayer, uint32 newPoints);
|
||||||
void OnTalentsReset(Player* pPlayer, bool noCost);
|
void OnTalentsReset(Player* pPlayer, bool noCost);
|
||||||
void OnMoneyChanged(Player* pPlayer, int32& amount);
|
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);
|
bool OnReputationChange(Player* pPlayer, uint32 factionID, int32& standing, bool incremental);
|
||||||
void OnDuelRequest(Player* pTarget, Player* pChallenger);
|
void OnDuelRequest(Player* pTarget, Player* pChallenger);
|
||||||
void OnDuelStart(Player* pStarter, Player* pChallenger);
|
void OnDuelStart(Player* pStarter, Player* pChallenger);
|
||||||
|
|||||||
@@ -227,18 +227,19 @@ void Eluna::OnMoneyChanged(Player* pPlayer, int32& amount)
|
|||||||
CleanUpStack(2);
|
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);
|
START_HOOK(PLAYER_EVENT_ON_GIVE_XP);
|
||||||
Push(pPlayer);
|
Push(pPlayer);
|
||||||
Push(amount);
|
Push(amount);
|
||||||
Push(pVictim);
|
Push(pVictim);
|
||||||
|
Push(xpSource);
|
||||||
int amountIndex = lua_gettop(L) - 1;
|
int amountIndex = lua_gettop(L) - 1;
|
||||||
int n = SetupStack(PlayerEventBindings, key, 3);
|
int n = SetupStack(PlayerEventBindings, key, 4);
|
||||||
|
|
||||||
while (n > 0)
|
while (n > 0)
|
||||||
{
|
{
|
||||||
int r = CallOneFunction(n--, 3, 1);
|
int r = CallOneFunction(n--, 4, 1);
|
||||||
|
|
||||||
if (lua_isnumber(L, r))
|
if (lua_isnumber(L, r))
|
||||||
{
|
{
|
||||||
@@ -250,7 +251,7 @@ void Eluna::OnGiveXP(Player* pPlayer, uint32& amount, Unit* pVictim)
|
|||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
CleanUpStack(3);
|
CleanUpStack(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Eluna::OnReputationChange(Player* pPlayer, uint32 factionID, int32& standing, bool incremental)
|
bool Eluna::OnReputationChange(Player* pPlayer, uint32 factionID, int32& standing, bool incremental)
|
||||||
|
|||||||
Reference in New Issue
Block a user