Core/SAI: do not pass old creatureData to UpdateEntry() and keep current health when changing a NPC's entry.

Port From (https://github.com/TrinityCore/TrinityCore/commit/62f5d9b46bd20faf90dd973e2786d1517b1b3bd2)
This commit is contained in:
hondacrx
2021-12-24 20:57:58 -05:00
parent 5a7d42530e
commit b3759bb7b0
2 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -960,7 +960,7 @@ namespace Game.AI
{
foreach (var target in targets)
if (IsCreature(target))
target.ToCreature().UpdateEntry(e.Action.updateTemplate.creature, target.ToCreature().GetCreatureData(), e.Action.updateTemplate.updateLevel != 0);
target.ToCreature().UpdateEntry(e.Action.updateTemplate.creature, null, e.Action.updateTemplate.updateLevel != 0);
break;
}
case SmartActions.Die:
@@ -370,7 +370,12 @@ namespace Game.Entities
if (updateLevel)
SelectLevel();
else
{
ulong previousHealth = GetHealth();
UpdateLevelDependantStats(); // We still re-initialize level dependant stats on entry update
if (previousHealth > 0)
SetHealth(previousHealth);
}
SetMeleeDamageSchool((SpellSchools)cInfo.DmgSchool);
SetStatFlatModifier(UnitMods.ResistanceHoly, UnitModifierFlatType.Base, cInfo.Resistance[(int)SpellSchools.Holy]);