mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 01:37:37 +01:00
Core/Pooling: Remove respawn times from the database when despawning a pool (#24422)
* Core/Pooling: Remove respawn times from the database when despawning a pool Remove respawn times from the database when despawning a pool. This is needed when a Game Event ends but there are still some respawn times saved in the database. * Remove respawn time of active pool objects even if they are not spawned
This commit is contained in:
@@ -3136,17 +3136,22 @@ void Map::DeleteRespawnInfo(RespawnInfo* info, CharacterDatabaseTransaction dbTr
|
||||
_respawnTimes.erase(info->handle);
|
||||
|
||||
// database
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_RESPAWN);
|
||||
stmt->setUInt16(0, info->type);
|
||||
stmt->setUInt32(1, info->spawnId);
|
||||
stmt->setUInt16(2, GetId());
|
||||
stmt->setUInt32(3, GetInstanceId());
|
||||
CharacterDatabase.ExecuteOrAppend(dbTrans, stmt);
|
||||
DeleteRespawnInfoFromDB(info->type, info->spawnId, dbTrans);
|
||||
|
||||
// then cleanup the object
|
||||
delete info;
|
||||
}
|
||||
|
||||
void Map::DeleteRespawnInfoFromDB(SpawnObjectType type, ObjectGuid::LowType spawnId, CharacterDatabaseTransaction dbTrans)
|
||||
{
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_RESPAWN);
|
||||
stmt->setUInt16(0, type);
|
||||
stmt->setUInt32(1, spawnId);
|
||||
stmt->setUInt16(2, GetId());
|
||||
stmt->setUInt32(3, GetInstanceId());
|
||||
CharacterDatabase.ExecuteOrAppend(dbTrans, stmt);
|
||||
}
|
||||
|
||||
void Map::DoRespawn(SpawnObjectType type, ObjectGuid::LowType spawnId, uint32 gridId)
|
||||
{
|
||||
if (!IsGridLoaded(gridId)) // if grid isn't loaded, this will be processed in grid load handler
|
||||
|
||||
Reference in New Issue
Block a user