void PoolGroup<Creature>::Despawn1Object(uint64 guid) { if (CreatureData const* data = sObjectMgr->GetCreatureData(guid)) { sObjectMgr->RemoveCreatureFromGrid(guid, data); Map* map = sMapMgr->CreateBaseMap(data->mapid); if (!map->Instanceable()) { auto creatureBounds = map->GetCreatureBySpawnIdStore().equal_range(guid); for (auto itr = creatureBounds.first; itr != creatureBounds.second; ++itr) itr->second->AddObjectToRemoveList(); } } }
void PoolGroup<Creature>::Despawn1Object(ObjectGuid::LowType guid) { if (CreatureData const* data = sObjectMgr->GetCreatureData(guid)) { sObjectMgr->RemoveCreatureFromGrid(guid, data); Map* map = sMapMgr->CreateBaseMap(data->spawnPoint.GetMapId()); if (!map->Instanceable()) { auto creatureBounds = map->GetCreatureBySpawnIdStore().equal_range(guid); for (auto itr = creatureBounds.first; itr != creatureBounds.second;) { Creature* creature = itr->second; ++itr; // For dynamic spawns, save respawn time here if (!creature->GetRespawnCompatibilityMode()) creature->SaveRespawnTime(0, false); creature->AddObjectToRemoveList(); } } } }