mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 16:38:42 +01:00
Core/Creatures: Reset unit flags/dynamic flags on Creature::SetDeathState(JUST_RESPAWNED)
(cherry picked from commit 132be2d25a)
This commit is contained in:
@@ -1631,10 +1631,26 @@ void Creature::setDeathState(DeathState s)
|
||||
|
||||
UpdateMovementFlags();
|
||||
|
||||
CreatureTemplate const* cinfo = GetCreatureTemplate();
|
||||
SetUInt64Value(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();
|
||||
|
||||
uint64 npcflag;
|
||||
uint32 unit_flags, dynamicflags;
|
||||
ObjectMgr::ChooseCreatureFlags(cinfo, npcflag, unit_flags, dynamicflags, creatureData);
|
||||
|
||||
SetUInt64Value(UNIT_NPC_FLAGS, npcflag);
|
||||
SetUInt32Value(UNIT_FIELD_FLAGS, unit_flags);
|
||||
SetUInt32Value(OBJECT_DYNAMIC_FLAGS, dynamicflags);
|
||||
|
||||
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
|
||||
|
||||
SetMeleeDamageSchool(SpellSchools(cinfo->dmgschool));
|
||||
}
|
||||
|
||||
Motion_Initialize();
|
||||
Unit::setDeathState(ALIVE);
|
||||
LoadCreaturesAddon();
|
||||
@@ -2641,12 +2657,12 @@ bool Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target)
|
||||
SetGuidValue(UNIT_FIELD_TARGET, newTarget);
|
||||
if (target)
|
||||
SetFacingToObject(target);
|
||||
|
||||
|
||||
if ( // here we determine if the (relatively expensive) forced update is worth it, or whether we can afford to wait until the scheduled update tick
|
||||
( // only require instant update for spells that actually have a visual
|
||||
focusSpell->GetSpellInfo()->SpellVisual[0] ||
|
||||
focusSpell->GetSpellInfo()->SpellVisual[1]
|
||||
) && (
|
||||
) && (
|
||||
!focusSpell->GetCastTime() || // if the spell is instant cast
|
||||
focusSpell->GetSpellInfo()->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST) // client gets confused if we attempt to turn at the regularly scheduled update packet
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user