feat(Core/Hooks): Add the KillRewarder reference to the OnRewardKillRewarder hook. (#18290)

* Another hackfix attempt at warden payload forcechecks ban fix.

* Revert last commit, interrupt all forcechecks instead of just _dataSent ones.

* Add rewarder parameter to OnRewardKillRewarder hook.

* Undo old warden changes.

* Removed too much!
This commit is contained in:
AnchyDev
2024-02-11 07:58:49 +11:00
committed by GitHub
parent 6b1dd7e19e
commit 1d8c4056b3
5 changed files with 19 additions and 5 deletions

View File

@@ -204,12 +204,13 @@ void KillRewarder::_RewardPlayer(Player* player, bool isDungeon)
if (_victim->GetTypeId() == TYPEID_PLAYER)
player->KilledPlayerCredit();
}
// Give XP only in PvE or in battlegrounds.
// Give reputation and kill credit only in PvE.
if (!_isPvP || _isBattleGround)
{
float xpRate = _group ? _groupRate * float(player->GetLevel()) / _aliveSumLevel : /*Personal rate is 100%.*/ 1.0f; // Group rate depends on the sum of levels.
sScriptMgr->OnRewardKillRewarder(player, isDungeon, xpRate); // Personal rate is 100%.
sScriptMgr->OnRewardKillRewarder(player, this, isDungeon, xpRate); // Personal rate is 100%.
if (_xp)
{
@@ -290,3 +291,13 @@ void KillRewarder::Reward()
if (Map* map = _victim->FindMap())
map->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, _victim->GetEntry(), _victim);
}
Unit* KillRewarder::GetVictim()
{
return _victim;
}
Player* KillRewarder::GetKiller()
{
return _killer;
}

View File

@@ -30,6 +30,8 @@ public:
KillRewarder(Player* killer, Unit* victim, bool isBattleGround);
void Reward();
Unit* GetVictim();
Player* GetKiller();
private:
void _InitXP(Player* player);