feat(Core/Hooks): Add parameter to detect XP origin for OnGiveXP hook. (#16109)

Added enum parameter to detect where XP originated from.
This commit is contained in:
AnchyDev
2023-05-06 11:39:36 +10:00
committed by GitHub
parent d7190451cf
commit 444793346d
6 changed files with 22 additions and 7 deletions

View File

@@ -2372,8 +2372,6 @@ void Player::GiveXP(uint32 xp, Unit* victim, float group_rate, bool isLFGReward)
uint8 level = GetLevel();
sScriptMgr->OnGivePlayerXP(this, xp, victim);
// Favored experience increase START
uint32 zone = GetZoneId();
float favored_exp_mult = 0;
@@ -5730,6 +5728,7 @@ void Player::CheckAreaExploreAndOutdoor()
XP = uint32(sObjectMgr->GetBaseXP(areaEntry->area_level) * sWorld->getRate(RATE_XP_EXPLORE));
}
sScriptMgr->OnGivePlayerXP(this, XP, nullptr, PlayerXPSource::XPSOURCE_EXPLORE);
GiveXP(XP, nullptr);
SendExplorationExperience(areaId, XP);
}
@@ -6119,7 +6118,11 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar
bg->UpdatePlayerScore(this, SCORE_BONUS_HONOR, honor, false); //false: prevent looping
// Xinef: Only for BG activities
if (!uVictim)
GiveXP(uint32(honor * (3 + GetLevel() * 0.30f)), nullptr);
{
uint32 xp = uint32(honor * (3 + GetLevel() * 0.30f));
sScriptMgr->OnGivePlayerXP(this, xp, nullptr, PlayerXPSource::XPSOURCE_BATTLEGROUND);
GiveXP(xp, nullptr);
}
}
if (sWorld->getBoolConfig(CONFIG_PVP_TOKEN_ENABLE))