Fix(Hooks): Update OnReputationChange method

Fix(Hooks): Update OnReputationChange method
This commit is contained in:
55Honey
2022-02-01 22:06:26 +01:00
committed by GitHub
3 changed files with 8 additions and 4 deletions

View File

@@ -210,7 +210,7 @@ httplib::Result HttpManager::DoRequest(httplib::Client& client, HttpWorkItem* re
return client.Options(path, req->headers);
}
ELUNA_LOG_ERROR("[Eluna]: HTTP request error: invalid HTTP verb {}", req->httpVerb));
ELUNA_LOG_ERROR("[Eluna]: HTTP request error: invalid HTTP verb {}", req->httpVerb);
return client.Get(path, req->headers);
}

View File

@@ -450,7 +450,7 @@ public:
void OnTalentsReset(Player* pPlayer, bool noCost);
void OnMoneyChanged(Player* pPlayer, int32& amount);
void OnGiveXP(Player* pPlayer, uint32& amount, Unit* pVictim);
void 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 OnDuelStart(Player* pStarter, Player* pChallenger);
void OnDuelEnd(Player* pWinner, Player* pLoser, DuelCompleteType type);

View File

@@ -251,9 +251,10 @@ void Eluna::OnGiveXP(Player* pPlayer, uint32& amount, Unit* pVictim)
CleanUpStack(3);
}
void Eluna::OnReputationChange(Player* pPlayer, uint32 factionID, int32& standing, bool incremental)
bool Eluna::OnReputationChange(Player* pPlayer, uint32 factionID, int32& standing, bool incremental)
{
START_HOOK(PLAYER_EVENT_ON_REPUTATION_CHANGE);
START_HOOK_WITH_RETVAL(PLAYER_EVENT_ON_REPUTATION_CHANGE, true);
bool result = true;
Push(pPlayer);
Push(factionID);
Push(standing);
@@ -268,6 +269,8 @@ void Eluna::OnReputationChange(Player* pPlayer, uint32 factionID, int32& standin
if (lua_isnumber(L, r))
{
standing = CHECKVAL<int32>(L, r);
if (standing == -1)
result = false;
// Update the stack for subsequent calls.
ReplaceArgument(standing, standingIndex);
}
@@ -276,6 +279,7 @@ void Eluna::OnReputationChange(Player* pPlayer, uint32 factionID, int32& standin
}
CleanUpStack(4);
return result;
}
void Eluna::OnDuelRequest(Player* pTarget, Player* pChallenger)