diff options
author | Trisjdc <trisjdc@gmail.com> | 2016-01-24 01:11:19 +0000 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2016-04-02 17:49:20 +0200 |
commit | a51ec98044c9251d28aade205ae5e300ab61d955 (patch) | |
tree | d4d4a1c12e5854679bcadd2bbb538d6639770843 | |
parent | 0466de43cc23ab036753f285a83a8b74dafb86cd (diff) |
Core/Creatures: Reset unit flags/dynamic flags on Creature::SetDeathState(JUST_RESPAWNED)
(cherry picked from commit 132be2d25a3766c1ef2099fb65ef3cbcdf9705ae)
-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 ) |