diff options
-rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 4f527c7563a..d75d0ab0fd4 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -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 ) |