![]() |
TrinityCore
|
#include <InstanceSaveMgr.h>
Classes | |
| struct | InstResetEvent |
Public Types | |
| typedef std::unordered_map< uint32, InstanceSave * > | InstanceSaveHashMap |
| typedef std::multimap< time_t, InstResetEvent > | ResetTimeQueue |
Public Member Functions | |
| void | Unload () |
| void | LoadInstances () |
| void | LoadResetTimes () |
| time_t | GetResetTimeFor (uint32 mapid, Difficulty d) const |
| time_t | GetSubsequentResetTime (uint32 mapid, Difficulty difficulty, time_t resetTime) const |
| void | InitializeResetTimeFor (uint32 mapid, Difficulty d, time_t t) |
| void | SetResetTimeFor (uint32 mapid, Difficulty d, time_t t) |
| ResetTimeByMapDifficultyMap const & | GetResetTimeMap () const |
| void | ScheduleReset (bool add, time_t time, InstResetEvent event) |
| void | ForceGlobalReset (uint32 mapId, Difficulty difficulty) |
| void | Update () |
| InstanceSave * | AddInstanceSave (uint32 mapId, uint32 instanceId, Difficulty difficulty, time_t resetTime, bool canReset, bool load=false) |
| void | RemoveInstanceSave (uint32 InstanceId) |
| void | UnloadInstanceSave (uint32 InstanceId) |
| InstanceSave * | GetInstanceSave (uint32 InstanceId) |
| uint32 | GetNumInstanceSaves () const |
| uint32 | GetNumBoundPlayersTotal () const |
| uint32 | GetNumBoundGroupsTotal () const |
Static Public Member Functions | |
| static InstanceSaveManager * | instance () |
| static void | DeleteInstanceFromDB (uint32 instanceid) |
Static Protected Attributes | |
| static uint16 | ResetTimeDelay [] = {3600, 900, 300, 60} |
Private Member Functions | |
| InstanceSaveManager () | |
| ~InstanceSaveManager () | |
| void | _ResetOrWarnAll (uint32 mapid, Difficulty difficulty, bool warn, time_t resetTime) |
| void | _ResetInstance (uint32 mapid, uint32 instanceId) |
| void | _ResetSave (InstanceSaveHashMap::iterator &itr) |
Private Attributes | |
| bool | lock_instLists |
| InstanceSaveHashMap | m_instanceSaveById |
| ResetTimeByMapDifficultyMap | m_resetTimeByMapDifficulty |
| ResetTimeQueue | m_resetTimeQueue |
Friends | |
| class | InstanceSave |
Definition at line 149 of file InstanceSaveMgr.h.
| typedef std::unordered_map<uint32 , InstanceSave*> InstanceSaveManager::InstanceSaveHashMap |
Definition at line 158 of file InstanceSaveMgr.h.
| typedef std::multimap<time_t , InstResetEvent> InstanceSaveManager::ResetTimeQueue |
Definition at line 178 of file InstanceSaveMgr.h.
|
inlineprivate |
Definition at line 154 of file InstanceSaveMgr.h.
|
private |
Definition at line 39 of file InstanceSaveMgr.cpp.
Definition at line 595 of file InstanceSaveMgr.cpp.
References _ResetSave(), Map::DeleteCorpseData(), DeleteInstanceFromDB(), Map::DeleteRespawnTimes(), Map::DeleteRespawnTimesInDB(), INSTANCE_RESET_RESPAWN_DELAY, Map::Instanceable(), Map::IsDungeon(), m_instanceSaveById, sMapMgr, and TC_LOG_DEBUG.
Referenced by Update().
|
private |
Definition at line 625 of file InstanceSaveMgr.cpp.
References _ResetSave(), CHAR_DEL_EXPIRED_CHAR_INSTANCE_BY_MAP_DIFF, CHAR_DEL_EXPIRED_INSTANCE_BY_MAP_DIFF, CHAR_DEL_GROUP_INSTANCE_BY_MAP_DIFF, CHAR_UPD_EXPIRE_CHAR_INSTANCE_BY_MAP_DIFF, CHAR_UPD_GLOBAL_INSTANCE_RESETTIME, CharacterDatabase, GameTime::GetGameTime(), MapInstanced::GetInstancedMaps(), GetSubsequentResetTime(), INSTANCE_RESET_GLOBAL, MapEntry::Instanceable(), m_instanceSaveById, MapEntry::MapName, InstanceMap::Reset(), ScheduleReset(), InstanceMap::SendResetWarnings(), SetResetTimeFor(), PreparedStatementBase::setUInt16(), PreparedStatementBase::setUInt64(), PreparedStatementBase::setUInt8(), sMapMgr, sMapStore, TC_LOG_DEBUG, Map::ToInstanceMap(), and Map::ToMapInstanced().
Referenced by ForceGlobalReset(), and Update().
|
private |
Definition at line 548 of file InstanceSaveMgr.cpp.
References ASSERT, EXTEND_STATE_EXPIRED, EXTEND_STATE_EXTENDED, EXTEND_STATE_NORMAL, lock_instLists, m_instanceSaveById, and Group::UnbindInstance().
Referenced by _ResetInstance(), and _ResetOrWarnAll().
| InstanceSave * InstanceSaveManager::AddInstanceSave | ( | uint32 | mapId, |
| uint32 | instanceId, | ||
| Difficulty | difficulty, | ||
| time_t | resetTime, | ||
| bool | canReset, | ||
| bool | load = false |
||
| ) |
Definition at line 76 of file InstanceSaveMgr.cpp.
References DUNGEON_DIFFICULTY_NORMAL, GameTime::GetGameTime(), GetInstanceSave(), GetResetTimeFor(), HOUR, InstanceSave, MapEntry::InstanceType, MapEntry::IsRaid(), m_instanceSaveById, MAP_RAID, MAX_DUNGEON_DIFFICULTY, MAX_RAID_DIFFICULTY, InstanceSave::SaveToDB(), ScheduleReset(), sMapStore, TC_LOG_DEBUG, and TC_LOG_ERROR.
|
static |
Definition at line 130 of file InstanceSaveMgr.cpp.
References CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE, CHAR_DEL_GROUP_INSTANCE_BY_INSTANCE, CHAR_DEL_INSTANCE_BY_INSTANCE, CharacterDatabase, and PreparedStatementBase::setUInt32().
Referenced by _ResetInstance(), and InstanceSave::DeleteFromDB().
| void InstanceSaveManager::ForceGlobalReset | ( | uint32 | mapId, |
| Difficulty | difficulty | ||
| ) |
Definition at line 503 of file InstanceSaveMgr.cpp.
References _ResetOrWarnAll(), GetDownscaledMapDifficultyData(), GameTime::GetGameTime(), and ScheduleReset().
| InstanceSave * InstanceSaveManager::GetInstanceSave | ( | uint32 | InstanceId | ) |
Definition at line 124 of file InstanceSaveMgr.cpp.
References m_instanceSaveById.
Referenced by AddInstanceSave(), and UnloadInstanceSave().
| uint32 InstanceSaveManager::GetNumBoundGroupsTotal | ( | ) | const |
Definition at line 721 of file InstanceSaveMgr.cpp.
References m_instanceSaveById.
| uint32 InstanceSaveManager::GetNumBoundPlayersTotal | ( | ) | const |
Definition at line 712 of file InstanceSaveMgr.cpp.
References m_instanceSaveById.
|
inline |
Definition at line 217 of file InstanceSaveMgr.h.
|
inline |
Definition at line 183 of file InstanceSaveMgr.h.
References MAKE_PAIR32().
Referenced by AddInstanceSave(), LoadResetTimes(), and Update().
|
inline |
Definition at line 199 of file InstanceSaveMgr.h.
| time_t InstanceSaveManager::GetSubsequentResetTime | ( | uint32 | mapid, |
| Difficulty | difficulty, | ||
| time_t | resetTime | ||
| ) | const |
Definition at line 442 of file InstanceSaveMgr.cpp.
References CONFIG_INSTANCE_RESET_TIME_HOUR, DAY, GetLocalHourTimestamp(), GetMapDifficultyData(), MINUTE, MapDifficultyEntry::RaidDuration, RATE_INSTANCE_RESET_TIME, sWorld, and TC_LOG_ERROR.
Referenced by _ResetOrWarnAll().
|
inline |
Definition at line 191 of file InstanceSaveMgr.h.
References MAKE_PAIR32().
Referenced by LoadResetTimes().
|
static |
| void InstanceSaveManager::LoadInstances | ( | ) |
Definition at line 266 of file InstanceSaveMgr.cpp.
References CharacterDatabase, getMSTime(), GetMSTimeDiffToNow(), sInstanceSaveMgr, sMapMgr, and TC_LOG_INFO.
| void InstanceSaveManager::LoadResetTimes | ( | ) |
Definition at line 300 of file InstanceSaveMgr.cpp.
References CHAR_DEL_GLOBAL_INSTANCE_RESETTIME, CHAR_INS_GLOBAL_INSTANCE_RESETTIME, CHAR_UPD_GLOBAL_INSTANCE_RESETTIME, CharacterDatabase, CONFIG_INSTANCE_RESET_TIME_HOUR, DAY, GameTime::GetGameTime(), GetLocalHourTimestamp(), GetMapDifficultyData(), GetResetTimeFor(), Field::GetUInt16(), Field::GetUInt32(), Field::GetUInt64(), Field::GetUInt8(), InitializeResetTimeFor(), MAKE_PAIR32(), PAIR32_HIPART(), PAIR32_LOPART(), RATE_INSTANCE_RESET_TIME, ResetTimeDelay, ScheduleReset(), PreparedStatementBase::setUInt16(), PreparedStatementBase::setUInt64(), PreparedStatementBase::setUInt8(), sMapDifficultyStore, sMapMgr, sWorld, and TC_LOG_ERROR.
| void InstanceSaveManager::RemoveInstanceSave | ( | uint32 | InstanceId | ) |
Definition at line 150 of file InstanceSaveMgr.cpp.
References CHAR_UPD_INSTANCE_RESETTIME, CharacterDatabase, m_instanceSaveById, PreparedStatementBase::setUInt32(), and PreparedStatementBase::setUInt64().
| void InstanceSaveManager::ScheduleReset | ( | bool | add, |
| time_t | time, | ||
| InstResetEvent | event | ||
| ) |
Definition at line 466 of file InstanceSaveMgr.cpp.
References InstanceSaveManager::InstResetEvent::instanceId, m_resetTimeQueue, InstanceSaveManager::InstResetEvent::mapid, TC_LOG_ERROR, and InstanceSaveManager::InstResetEvent::type.
Referenced by _ResetOrWarnAll(), AddInstanceSave(), ForceGlobalReset(), LoadResetTimes(), and Update().
| void InstanceSaveManager::SetResetTimeFor | ( | uint32 | mapid, |
| Difficulty | d, | ||
| time_t | t | ||
| ) |
Definition at line 459 of file InstanceSaveMgr.cpp.
References ASSERT, m_resetTimeByMapDifficulty, and MAKE_PAIR32().
Referenced by _ResetOrWarnAll().
| void InstanceSaveManager::Unload | ( | ) |
Definition at line 49 of file InstanceSaveMgr.cpp.
References InstanceSave::GetDifficultyID(), InstanceSave::GetMapId(), lock_instLists, InstanceSave::m_groupList, m_instanceSaveById, and InstanceSave::m_playerList.
| void InstanceSaveManager::UnloadInstanceSave | ( | uint32 | InstanceId | ) |
Definition at line 171 of file InstanceSaveMgr.cpp.
References GetInstanceSave().
| void InstanceSaveManager::Update | ( | ) |
Definition at line 514 of file InstanceSaveMgr.cpp.
References _ResetInstance(), _ResetOrWarnAll(), GameTime::GetGameTime(), GetResetTimeFor(), m_resetTimeQueue, ResetTimeDelay, and ScheduleReset().
|
friend |
Definition at line 151 of file InstanceSaveMgr.h.
Referenced by AddInstanceSave().
|
private |
Definition at line 229 of file InstanceSaveMgr.h.
Referenced by _ResetSave(), and Unload().
|
private |
Definition at line 231 of file InstanceSaveMgr.h.
Referenced by _ResetInstance(), _ResetOrWarnAll(), _ResetSave(), AddInstanceSave(), GetInstanceSave(), GetNumBoundGroupsTotal(), GetNumBoundPlayersTotal(), RemoveInstanceSave(), and Unload().
|
private |
Definition at line 233 of file InstanceSaveMgr.h.
Referenced by SetResetTimeFor().
|
private |
Definition at line 234 of file InstanceSaveMgr.h.
Referenced by ScheduleReset(), and Update().
|
staticprotected |
Definition at line 37 of file InstanceSaveMgr.h.
Referenced by LoadResetTimes(), and Update().