Core/Creatures: Prevent resetting creature sparring health thresholds on evade if it was changed to a custom value by a script

Port From (https://github.com/TrinityCore/TrinityCore/commit/305cb9a81a1567759e4e3b3adcc4c6ba0b128df7)
This commit is contained in:
hondacrx
2024-02-21 21:10:29 -05:00
parent 33f3e9d68f
commit 7919985741
@@ -2586,8 +2586,11 @@ namespace Game.Entities
{ {
var templateValues = Global.ObjectMgr.GetCreatureTemplateSparringValues(GetCreatureTemplate().Entry); var templateValues = Global.ObjectMgr.GetCreatureTemplateSparringValues(GetCreatureTemplate().Entry);
if (!templateValues.Empty()) if (!templateValues.Empty())
{
if (templateValues.Contains(_sparringHealthPct)) // only re-randomize sparring value if it was loaded from template (not when set to custom value from script)
_sparringHealthPct = templateValues.SelectRandom(); _sparringHealthPct = templateValues.SelectRandom();
} }
}
// Send a message to LocalDefense channel for players opposition team in the zone // Send a message to LocalDefense channel for players opposition team in the zone
public void SendZoneUnderAttackMessage(Player attacker) public void SendZoneUnderAttackMessage(Player attacker)