diff options
author | megamage <none@none> | 2009-06-17 01:01:39 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-06-17 01:01:39 -0500 |
commit | c6765f9365126fbe90d66ca36e2d766a734ce4bb (patch) | |
tree | a5864e4155f4160c3cdee55d814e2c7464a89fd4 /src/game/Creature.cpp | |
parent | 30195348ac7e004acf84043c5bf9f1c70f19755e (diff) |
*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
Diffstat (limited to 'src/game/Creature.cpp')
-rw-r--r-- | src/game/Creature.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
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) |