From c6765f9365126fbe90d66ca36e2d766a734ce4bb Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 17 Jun 2009 01:01:39 -0500 Subject: *Allow to force to respawn creatures. *Save creature data for vehicles. *Change some visibility update sequence of respawned creatures. *Fix bugs of quest 12687: dark rider may not be on horse / horse cannot be used twice / horse does not respawn at correct phase --HG-- branch : trunk --- src/game/Creature.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'src/game/Creature.cpp') diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index eb711a77ab5..be0747f0a89 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -1780,7 +1780,7 @@ void Creature::setDeathState(DeathState s) LoadCreaturesAddon(true); Motion_Initialize(); if(GetCreatureData() && GetPhaseMask() != GetCreatureData()->phaseMask) - SetPhaseMask(GetCreatureData()->phaseMask, true); + SetPhaseMask(GetCreatureData()->phaseMask, false); } } @@ -1802,16 +1802,19 @@ bool Creature::FallGround() return true; } -void Creature::Respawn() +void Creature::Respawn(bool force) { - RemoveCorpse(); + DestroyForNearbyPlayers(); - // forced recreate creature object at clients - UnitVisibility currentVis = GetVisibility(); - SetVisibility(VISIBILITY_RESPAWN); - ObjectAccessor::UpdateObjectVisibility(this); - SetVisibility(currentVis); // restore visibility state - ObjectAccessor::UpdateObjectVisibility(this); + if(force) + { + if(isAlive()) + setDeathState(JUST_DIED); + else if(getDeathState() != CORPSE) + setDeathState(CORPSE); + } + + RemoveCorpse(); if(getDeathState()==DEAD) { @@ -1846,11 +1849,9 @@ void Creature::Respawn() uint16 poolid = poolhandler.IsPartOfAPool(GetGUIDLow(), GetTypeId()); if (poolid) poolhandler.UpdatePool(poolid, GetGUIDLow(), GetTypeId()); - - //GetMap()->Add(this); - - } + + SetToNotify(); } bool Creature::IsImmunedToSpell(SpellEntry const* spellInfo) -- cgit v1.2.3