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:
@@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user