fix(Core/Entities): Use lifetime PvP rank rather than current title for PvP credit message. (#23961)

Co-authored-by: Shauren <shauren.trinity@gmail.com>
This commit is contained in:
Benjamin Jackson
2025-12-26 18:45:33 -05:00
committed by GitHub
parent 5fb395dcc5
commit d025568b65
4 changed files with 13 additions and 30 deletions

View File

@@ -6165,7 +6165,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar
*/
ObjectGuid victim_guid;
uint32 victim_rank = 0;
int32 victim_rank = 0;
// need call before fields update to have chance move yesterday data to appropriate fields before today data change.
UpdateHonorFields();
@@ -6198,28 +6198,11 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar
if (v_level <= k_grey)
return false;
// PLAYER_CHOSEN_TITLE VALUES DESCRIPTION
// [0] Just name
// [1..14] Alliance honor titles and player name
// [15..28] Horde honor titles and player name
// [29..38] Other title and player name
// [39+] Nothing
uint32 victim_title = victim->GetUInt32Value(PLAYER_CHOSEN_TITLE);
uint32 killer_title = 0;
sScriptMgr->OnPlayerVictimRewardBefore(this, victim, killer_title, victim_title);
// Get Killer titles, CharTitlesEntry::bit_index
// Ranks:
// title[1..14] -> rank[5..18]
// title[15..28] -> rank[5..18]
// title[other] -> 0
if (victim_title == 0)
victim_guid.Clear(); // Don't show HK: <rank> message, only log.
else if (victim_title < 15)
victim_rank = victim_title + 4;
else if (victim_title < 29)
victim_rank = victim_title - 14 + 4;
else
victim_guid.Clear(); // Don't show HK: <rank> message, only log.
victim_rank = victim->GetByteValue(PLAYER_FIELD_BYTES, PLAYER_FIELD_BYTES_OFFSET_LIFETIME_MAX_PVP_RANK);
uint32 killer_title = GetUInt32Value(PLAYER_CHOSEN_TITLE);
sScriptMgr->OnPlayerVictimRewardBefore(this, victim, killer_title, victim_rank);
honor_f = std::ceil(Acore::Honor::hk_honor_at_level_f(k_level) * (v_level - k_grey) / (k_level - k_grey));