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
This commit is contained in:
Giacomo Pozzoni
2019-06-15 14:15:22 +02:00
committed by Ovahlord
parent 480068bee7
commit 2190cf9524

View File

@@ -1258,6 +1258,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
// Spawn if necessary (loaded grids only)
Map* map = sMapMgr->CreateBaseMap(data->spawnPoint.GetMapId());
map->RemoveRespawnTime(SPAWN_TYPE_CREATURE, *itr);
// We use spawn coords to spawn
if (!map->Instanceable() && map->IsGridLoaded(data->spawnPoint))
{
@@ -1285,6 +1286,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
// Spawn if necessary (loaded grids only)
// this base map checked as non-instanced and then only existed
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->Instanceable() && map->IsGridLoaded(data->spawnPoint))
{
@@ -1340,6 +1342,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;)
{
@@ -1370,6 +1373,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;)
{