mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
Core/Creatures: Reset unit flags/dynamic flags on Creature::SetDeathState(JUST_RESPAWNED)
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user