Skip to content

Commit

Permalink
DynGuid: Safeguard respawning of creature grouped dynguids in respawn…
Browse files Browse the repository at this point in the history
… command
  • Loading branch information
killerwife committed Nov 29, 2023
1 parent 253f1e1 commit 3055cee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/game/Chat/Level3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5555,10 +5555,13 @@ bool ChatHandler::HandleRespawnCommand(char* /*args*/)
Creature* creature = static_cast<Creature*>(target);
if (target->IsUsingNewSpawningSystem())
{
if (creature->GetMap()->GetMapDataContainer().GetSpawnGroupByGuid(creature->GetDbGuid(), TYPEID_UNIT))
target->GetMap()->GetPersistentState()->SaveCreatureRespawnTime(target->GetDbGuid(), time(nullptr));
else
target->GetMap()->GetSpawnManager().RespawnCreature(target->GetDbGuid(), 0);
if (!creature->GetCreatureGroup())
{
if (creature->GetMap()->GetMapDataContainer().GetSpawnGroupByGuid(creature->GetDbGuid(), TYPEID_UNIT))
target->GetMap()->GetPersistentState()->SaveCreatureRespawnTime(target->GetDbGuid(), time(nullptr));
else
target->GetMap()->GetSpawnManager().RespawnCreature(target->GetDbGuid(), 0);
}
}
else
creature->Respawn();
Expand Down
2 changes: 1 addition & 1 deletion src/game/Grids/GridNotifiers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ void MaNGOS::RespawnDo::operator()(Creature* u) const

if (u->IsUsingNewSpawningSystem())
{
if (u->IsDead())
if (u->IsDead() && !u->GetCreatureGroup())
{
if (u->GetMap()->GetMapDataContainer().GetSpawnGroupByGuid(u->GetDbGuid(), TYPEID_UNIT))
u->GetMap()->GetPersistentState()->SaveCreatureRespawnTime(u->GetDbGuid(), time(nullptr));
Expand Down

0 comments on commit 3055cee

Please sign in to comment.