[11356] Some cleanup of JUST_ALIVED for creature and add comments.

Also restore npcflags after LoadCreatureAddon.

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2011-04-15 11:00:26 +02:00
parent adcb84a325
commit 520f420aed
2 changed files with 14 additions and 5 deletions

View file

@ -1489,13 +1489,12 @@ void Creature::SetDeathState(DeathState s)
if (s == JUST_ALIVED)
{
CreatureInfo const *cinfo = GetCreatureInfo();
SetHealth(GetMaxHealth());
SetLootRecipient(NULL);
CreatureInfo const *cinfo = GetCreatureInfo();
SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0);
RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
AddSplineFlag(SPLINEFLAG_WALKMODE);
SetUInt32Value(UNIT_NPC_FLAGS, cinfo->npcflag);
if (GetTemporaryFactionFlags() & TEMPFACTION_RESTORE_RESPAWN)
ClearTemporaryFaction();
@ -1504,8 +1503,18 @@ void Creature::SetDeathState(DeathState s)
clearUnitState(UNIT_STAT_ALL_STATE);
i_motionMaster.Clear();
SetMeleeDamageSchool(SpellSchools(cinfo->dmgschool));
// Dynamic flags may be adjusted by spells. Clear them
// first and let spell from *addon apply where needed.
SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE);
LoadCreatureAddon(true);
// Flags after LoadCreatureAddon. Any spell in *addon
// will not be able to adjust these.
SetUInt32Value(UNIT_NPC_FLAGS, cinfo->npcflag);
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
}
}