3.3.5 game event respawn (#23391)

* Core/GameEvent: Remove respawn times of Creature and GameObjects when starting/stopping an event

* Add checks for pool

* Remove the check for pools

(cherry picked from commit 678f3dd687)
This commit is contained in:
Giacomo Pozzoni
2019-06-15 14:15:22 +02:00
committed by Shauren
parent 6b7bc82641
commit 4e7727d575

View File

@@ -1233,7 +1233,8 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
sObjectMgr->AddCreatureToGrid(*itr, data);
// Spawn if necessary (loaded grids only)
Map* map = sMapMgr->FindMap(data->spawnPoint.GetMapId(), 0);
Map* map = sMapMgr->CreateBaseMap(data->spawnPoint.GetMapId());
map->RemoveRespawnTime(SPAWN_TYPE_CREATURE, *itr);
// We use spawn coords to spawn
if (map && !map->Instanceable() && map->IsGridLoaded(data->spawnPoint))
Creature::CreateCreatureFromDB(*itr, map);
@@ -1255,7 +1256,8 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
sObjectMgr->AddGameobjectToGrid(*itr, data);
// Spawn if necessary (loaded grids only)
// this base map checked as non-instanced and then only existed
Map* map = sMapMgr->FindMap(data->spawnPoint.GetMapId(), 0);
Map* map = sMapMgr->CreateBaseMap(data->spawnPoint.GetMapId());
map->RemoveRespawnTime(SPAWN_TYPE_GAMEOBJECT, *itr);
// We use current coords to unspawn, not spawn coords since creature can have changed grid
if (map && !map->Instanceable() && map->IsGridLoaded(data->spawnPoint))
{
@@ -1306,6 +1308,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
sMapMgr->DoForAllMapsWithMapId(data->spawnPoint.GetMapId(), [&itr](Map* map)
{
map->RemoveRespawnTime(SPAWN_TYPE_CREATURE, *itr);
auto creatureBounds = map->GetCreatureBySpawnIdStore().equal_range(*itr);
for (auto itr2 = creatureBounds.first; itr2 != creatureBounds.second;)
{
@@ -1336,6 +1339,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
sMapMgr->DoForAllMapsWithMapId(data->spawnPoint.GetMapId(), [&itr](Map* map)
{
map->RemoveRespawnTime(SPAWN_TYPE_GAMEOBJECT, *itr);
auto gameobjectBounds = map->GetGameObjectBySpawnIdStore().equal_range(*itr);
for (auto itr2 = gameobjectBounds.first; itr2 != gameobjectBounds.second;)
{