Core/Creatures: Reset unit flags/dynamic flags on Creature::SetDeathState(JUST_RESPAWNED)

This commit is contained in:
Trisjdc
2016-01-24 01:11:19 +00:00
parent 9d8c90d9ee
commit 132be2d25a

View File

@@ -1604,13 +1604,29 @@ void Creature::setDeathState(DeathState s)
UpdateMovementFlags();
CreatureTemplate const* cinfo = GetCreatureTemplate();
SetUInt32Value(UNIT_NPC_FLAGS, cinfo->npcflag);
ClearUnitState(uint32(UNIT_STATE_ALL_STATE & ~UNIT_STATE_IGNORE_PATHFINDING));
SetMeleeDamageSchool(SpellSchools(cinfo->dmgschool));
if (!IsPet())
{
CreatureData const* creatureData = GetCreatureData();
CreatureTemplate const* cinfo = GetCreatureTemplate();
uint32 npcflag, unit_flags, dynamicflags;
ObjectMgr::ChooseCreatureFlags(cinfo, npcflag, unit_flags, dynamicflags, creatureData);
SetUInt32Value(UNIT_NPC_FLAGS, npcflag);
SetUInt32Value(UNIT_FIELD_FLAGS, unit_flags);
SetUInt32Value(UNIT_DYNAMIC_FLAGS, dynamicflags);
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
SetMeleeDamageSchool(SpellSchools(cinfo->dmgschool));
if (creatureData && GetPhaseMask() != creatureData->phaseMask)
SetPhaseMask(creatureData->phaseMask, false);
}
Motion_Initialize();
if (GetCreatureData() && GetPhaseMask() != GetCreatureData()->phaseMask)
SetPhaseMask(GetCreatureData()->phaseMask, false);
Unit::setDeathState(ALIVE);
LoadCreaturesAddon();
}