Core/Auras: Corrected SPELL_AURA_MOD_HONOR_GAIN_PCT implementation - it should only increase honor gains from some sources

Port From (https://github.com/TrinityCore/TrinityCore/commit/c56d18287dad88b214b4a33ccd785484b165acbe)
This commit is contained in:
Hondacrx
2025-12-08 14:03:10 -05:00
parent b267c12273
commit b3b42d29ad
8 changed files with 35 additions and 15 deletions
+1 -1
View File
@@ -147,7 +147,7 @@ namespace Game.Entities
{
// Rewarded player must be alive.
if (player.IsAlive())
player.RewardHonor(_victim, _count, -1, true);
player.RewardHonor(_victim, _count, -1, HonorGainSource.Kill);
}
void _RewardXP(Player player, float rate)
+1 -1
View File
@@ -478,7 +478,7 @@ namespace Game.Entities
// Honor points after duel (the winner) - ImpConfig
int amount = WorldConfig.GetIntValue(WorldCfg.HonorAfterDuel);
if (amount != 0)
opponent.RewardHonor(null, 1, amount);
opponent.RewardHonor(null, 1, amount, HonorGainSource.Kill);
break;
default:
+4 -4
View File
@@ -45,7 +45,7 @@ namespace Game.Entities
m_lastHonorUpdateTime = now;
}
public bool RewardHonor(Unit victim, uint groupsize, int honor = -1, bool pvptoken = false)
public bool RewardHonor(Unit victim, uint groupsize, int honor = -1, HonorGainSource source = HonorGainSource.Kill)
{
// do not reward honor in arenas, but enable onkill spellproc
if (InArena())
@@ -146,7 +146,7 @@ namespace Game.Entities
honor_f /= groupsize;
// apply honor multiplier from aura (not stacking-get highest)
MathFunctions.AddPct(ref honor_f, GetMaxPositiveAuraModifier(AuraType.ModHonorGainPct));
MathFunctions.AddPct(ref honor_f, GetMaxPositiveAuraModifierByMiscMask(AuraType.ModHonorGainPctFromSource, 1u << (int)source));
honor_f += _restMgr.GetRestBonusFor(RestTypes.Honor, (uint)honor_f);
}
@@ -173,11 +173,11 @@ namespace Game.Entities
Battleground bg = GetBattleground();
if (bg != null)
{
bg.UpdatePlayerScore(this, ScoreType.BonusHonor, (uint)honor, false); //false: prevent looping
bg.UpdatePlayerScore(this, ScoreType.BonusHonor, (uint)honor, false, source); //false: prevent looping
}
}
if (WorldConfig.GetBoolValue(WorldCfg.PvpTokenEnable) && pvptoken)
if (WorldConfig.GetBoolValue(WorldCfg.PvpTokenEnable) && source == HonorGainSource.Kill)
{
if (victim == null || victim == this || victim.HasAuraType(AuraType.NoPvpCredit))
return true;
+1 -1
View File
@@ -1118,7 +1118,7 @@ namespace Game.Entities
// honor reward
uint honor = quest.CalculateHonorGain(GetLevel());
if (honor != 0)
RewardHonor(null, 0, (int)honor);
RewardHonor(null, 0, (int)honor, HonorGainSource.Quest);
// title reward
if (quest.RewardTitleId != 0)