AzerothCore 3.3.5a
OpenSource WoW Emulator
|
#include "InstanceSaveMgr.h"
Classes | |
struct | InstResetEvent |
Public Types | |
typedef std::unordered_map< uint32, InstanceSave * > | InstanceSaveHashMap |
typedef std::multimap< time_t, InstResetEvent > | ResetTimeQueue |
Static Public Member Functions | |
static InstanceSaveMgr * | instance () |
Static Protected Attributes | |
static uint16 | ResetTimeDelay [] = {3600, 900, 300, 60, 0} |
static PlayerBindStorage | playerBindStorage |
static BoundInstancesMap | emptyBoundInstancesMap |
Private Member Functions | |
InstanceSaveMgr ()=default | |
~InstanceSaveMgr () | |
void | _ResetOrWarnAll (uint32 mapid, Difficulty difficulty, bool warn, time_t resetTime) |
void | _ResetSave (InstanceSaveHashMap::iterator &itr) |
Friends | |
class | InstanceSave |
typedef std::unordered_map<uint32 , InstanceSave*> InstanceSaveMgr::InstanceSaveHashMap |
typedef std::multimap<time_t , InstResetEvent> InstanceSaveMgr::ResetTimeQueue |
|
privatedefault |
|
private |
References lock_instLists.
|
private |
References _ResetSave(), CHAR_UPD_GLOBAL_INSTANCE_RESETTIME, CharacterDatabase, CONFIG_INSTANCE_RESET_TIME_HOUR, DAY, Map::GetDifficulty(), GameTime::GetGameTime(), Map::GetInstanceId(), GetInstanceSave(), GetMapDifficultyData(), HOUR, INSTANCE_RESET_GLOBAL, MapEntry::Instanceable(), Map::IsDungeon(), LOG_ERROR, m_instanceSaveById, InstanceSave::m_playerList, MINUTE, RATE_INSTANCE_RESET_TIME, InstanceMap::Reset(), MapDifficulty::resetTime, ScheduleReset(), InstanceMap::SendResetWarnings(), PreparedStatementBase::SetData(), SetExtendedResetTimeFor(), SetResetTimeFor(), sMapMgr, sMapStore, sWorld, and Map::ToInstanceMap().
Referenced by Update().
|
private |
References CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE, CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE_NOT_EXTENDED, CHAR_DEL_INSTANCE_BY_INSTANCE, CHAR_UPD_CHAR_INSTANCE_SET_NOT_EXTENDED, CharacterDatabase, DeleteInstanceSavedData(), Map::DeleteRespawnTimesInDB(), ObjectAccessor::FindConnectedPlayer(), GetExtendedResetTimeFor(), GetResetTimeFor(), lock_instLists, m_instanceSaveById, PlayerUnbindInstanceNotExtended(), PreparedStatementBase::SetData(), sMapMgr, and sScriptMgr.
Referenced by _ResetOrWarnAll().
InstanceSave * InstanceSaveMgr::AddInstanceSave | ( | uint32 | mapId, |
uint32 | instanceId, | ||
Difficulty | difficulty, | ||
bool | startup = false |
||
) |
References ASSERT, DAY, DUNGEON_DIFFICULTY_NORMAL, GetExtendedResetTimeFor(), GameTime::GetGameTime(), GetInstanceSave(), GetResetTimeFor(), InstanceSave::InsertToDB(), InstanceSave, MapEntry::IsRaid(), LOG_ERROR, m_instanceSaveById, MAP_RAID, MapEntry::map_type, MAX_DUNGEON_DIFFICULTY, MAX_RAID_DIFFICULTY, and sMapStore.
Referenced by LoadInstanceSaves().
void InstanceSaveMgr::CopyBinds | ( | ObjectGuid | from, |
ObjectGuid | to, | ||
Player * | toPlr = nullptr |
||
) |
References MAX_DIFFICULTY, PlayerBindToInstance(), PlayerGetBoundInstance(), and PlayerGetBoundInstances().
void InstanceSaveMgr::DeleteInstanceSavedData | ( | uint32 | instanceId | ) |
References CHAR_DELETE_INSTANCE_SAVED_DATA, CharacterDatabase, and PreparedStatementBase::SetData().
Referenced by _ResetSave(), and DeleteInstanceSaveIfNeeded().
bool InstanceSaveMgr::DeleteInstanceSaveIfNeeded | ( | InstanceSave * | save, |
bool | skipMapCheck, | ||
bool | deleteSave = true |
||
) |
References ASSERT, CHAR_DEL_INSTANCE_BY_INSTANCE, CharacterDatabase, DeleteInstanceSavedData(), Map::DeleteRespawnTimesInDB(), InstanceSave::GetInstanceId(), InstanceSave::GetMapId(), lock_instLists, m_instanceSaveById, InstanceSave::m_playerList, PreparedStatementBase::SetData(), sMapMgr, and sScriptMgr.
bool InstanceSaveMgr::DeleteInstanceSaveIfNeeded | ( | uint32 | InstanceId, |
bool | skipMapCheck | ||
) |
References DeleteInstanceSaveIfNeeded(), and GetInstanceSave().
Referenced by DeleteInstanceSaveIfNeeded(), and InstanceSave::RemovePlayer().
|
inline |
References m_resetExtendedTimeByMapDifficulty, and MAKE_PAIR32().
Referenced by _ResetSave(), and AddInstanceSave().
InstanceSave * InstanceSaveMgr::GetInstanceSave | ( | uint32 | InstanceId | ) |
References m_instanceSaveById.
Referenced by _ResetOrWarnAll(), AddInstanceSave(), DeleteInstanceSaveIfNeeded(), and LoadCharacterBinds().
|
inline |
References m_resetTimeByMapDifficulty, and MAKE_PAIR32().
Referenced by _ResetSave(), AddInstanceSave(), LoadResetTimes(), and Update().
|
inline |
References m_resetTimeByMapDifficulty.
|
static |
void InstanceSaveMgr::LoadCharacterBinds | ( | ) |
References CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE_GUID, CharacterDatabase, InstancePlayerBind::extended, Field::Get(), ObjectGuid::GetCounter(), InstanceSave::GetInstanceId(), GetInstanceSave(), lock_instLists, InstancePlayerBind::perm, playerBindStorage, PlayerCreateBoundInstancesMaps(), InstanceSave::RemovePlayer(), InstancePlayerBind::save, and PreparedStatementBase::SetData().
Referenced by LoadInstances().
void InstanceSaveMgr::LoadInstances | ( | ) |
References CharacterDatabase, getMSTime(), GetMSTimeDiffToNow(), LoadCharacterBinds(), LoadInstanceSaves(), LoadResetTimes(), LOG_INFO, SanitizeInstanceSavedData(), and sMapMgr.
void InstanceSaveMgr::LoadInstanceSaves | ( | ) |
References AddInstanceSave(), CharacterDatabase, Field::Get(), InstanceSave::SetCompletedEncounterMask(), InstanceSave::SetInstanceData(), InstanceSave::SetResetTime(), and sMapMgr.
Referenced by LoadInstances().
void InstanceSaveMgr::LoadResetTimes | ( | ) |
References CharacterDatabase, CONFIG_INSTANCE_RESET_TIME_HOUR, DAY, Field::Get(), GameTime::GetGameTime(), GetMapDifficultyData(), GetResetTimeFor(), HOUR, LOG_ERROR, PAIR32_HIPART(), PAIR32_LOPART(), RATE_INSTANCE_RESET_TIME, MapDifficulty::resetTime, ResetTimeDelay, ScheduleReset(), SetExtendedResetTimeFor(), SetResetTimeFor(), sMapDifficultyMap, and sWorld.
Referenced by LoadInstances().
InstancePlayerBind * InstanceSaveMgr::PlayerBindToInstance | ( | ObjectGuid | guid, |
InstanceSave * | save, | ||
bool | permanent, | ||
Player * | player = nullptr |
||
) |
References ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_RAID, InstanceSave::AddPlayer(), ASSERT, CHAR_INS_CHAR_INSTANCE, CHAR_UPD_CHAR_INSTANCE, CharacterDatabase, InstancePlayerBind::extended, ObjectGuid::GetCounter(), InstanceSave::GetDifficulty(), InstanceSave::GetInstanceId(), InstanceSave::GetMapId(), Player::GetSession(), InstancePlayerBind::perm, playerBindStorage, InstanceSave::RemovePlayer(), InstancePlayerBind::save, WorldSession::SendCalendarRaidLockout(), InstanceSave::SetCanReset(), PreparedStatementBase::SetData(), sScriptMgr, and Player::UpdateAchievementCriteria().
Referenced by CopyBinds().
void InstanceSaveMgr::PlayerCreateBoundInstancesMaps | ( | ObjectGuid | guid | ) |
References playerBindStorage.
Referenced by LoadCharacterBinds().
InstancePlayerBind * InstanceSaveMgr::PlayerGetBoundInstance | ( | ObjectGuid | guid, |
uint32 | mapid, | ||
Difficulty | difficulty | ||
) |
References GetDownscaledMapDifficultyData(), IsSharedDifficultyMap(), BoundInstancesMapWrapper::m, and playerBindStorage.
Referenced by CopyBinds(), PlayerGetDestinationInstanceId(), PlayerGetInstanceSave(), and PlayerIsPermBoundToInstance().
BoundInstancesMap const & InstanceSaveMgr::PlayerGetBoundInstances | ( | ObjectGuid | guid, |
Difficulty | difficulty | ||
) |
References emptyBoundInstancesMap, and playerBindStorage.
Referenced by CopyBinds().
uint32 InstanceSaveMgr::PlayerGetDestinationInstanceId | ( | Player * | player, |
uint32 | mapid, | ||
Difficulty | difficulty | ||
) |
References Player::GetGroup(), Object::GetGUID(), InstanceSave::GetInstanceId(), InstancePlayerBind::perm, PlayerGetBoundInstance(), and InstancePlayerBind::save.
InstanceSave * InstanceSaveMgr::PlayerGetInstanceSave | ( | ObjectGuid | guid, |
uint32 | mapid, | ||
Difficulty | difficulty | ||
) |
References PlayerGetBoundInstance(), and InstancePlayerBind::save.
bool InstanceSaveMgr::PlayerIsPermBoundToInstance | ( | ObjectGuid | guid, |
uint32 | mapid, | ||
Difficulty | difficulty | ||
) |
References PlayerGetBoundInstance().
void InstanceSaveMgr::PlayerUnbindInstance | ( | ObjectGuid | guid, |
uint32 | mapid, | ||
Difficulty | difficulty, | ||
bool | deleteFromDB, | ||
Player * | player = nullptr |
||
) |
References CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE_GUID, CharacterDatabase, ObjectGuid::GetCounter(), Player::GetSession(), BoundInstancesMapWrapper::m, playerBindStorage, InstanceSave::RemovePlayer(), WorldSession::SendCalendarRaidLockout(), and PreparedStatementBase::SetData().
Referenced by UnbindAllFor().
void InstanceSaveMgr::PlayerUnbindInstanceNotExtended | ( | ObjectGuid | guid, |
uint32 | mapid, | ||
Difficulty | difficulty, | ||
Player * | player = nullptr |
||
) |
References Player::GetSession(), BoundInstancesMapWrapper::m, playerBindStorage, InstanceSave::RemovePlayer(), and WorldSession::SendCalendarRaidLockout().
Referenced by _ResetSave().
void InstanceSaveMgr::SanitizeInstanceSavedData | ( | ) |
References CHAR_SANITIZE_INSTANCE_SAVED_DATA, and CharacterDatabase.
Referenced by LoadInstances().
void InstanceSaveMgr::ScheduleReset | ( | time_t | time, |
InstResetEvent | event | ||
) |
References m_resetTimeQueue.
Referenced by _ResetOrWarnAll(), LoadResetTimes(), and Update().
|
inline |
References m_resetExtendedTimeByMapDifficulty, and MAKE_PAIR32().
Referenced by _ResetOrWarnAll(), and LoadResetTimes().
|
inline |
References m_resetTimeByMapDifficulty, and MAKE_PAIR32().
Referenced by _ResetOrWarnAll(), and LoadResetTimes().
void InstanceSaveMgr::UnbindAllFor | ( | InstanceSave * | save | ) |
References ObjectAccessor::FindConnectedPlayer(), InstanceSave::GetDifficulty(), InstanceSave::GetMapId(), InstanceSave::m_playerList, and PlayerUnbindInstance().
void InstanceSaveMgr::Update | ( | ) |
References _ResetOrWarnAll(), GameTime::GetGameTime(), GetResetTimeFor(), LOG_INFO, m_resetTimeQueue, ResetTimeDelay, ScheduleReset(), and sWorld.
|
friend |
Referenced by AddInstanceSave().
|
staticprotected |
Referenced by PlayerGetBoundInstances().
|
private |
Referenced by _ResetSave(), DeleteInstanceSaveIfNeeded(), LoadCharacterBinds(), and ~InstanceSaveMgr().
|
private |
Referenced by _ResetOrWarnAll(), _ResetSave(), AddInstanceSave(), DeleteInstanceSaveIfNeeded(), and GetInstanceSave().
|
private |
Referenced by GetExtendedResetTimeFor(), and SetExtendedResetTimeFor().
|
private |
Referenced by GetResetTimeFor(), GetResetTimeMap(), and SetResetTimeFor().
|
private |
Referenced by ScheduleReset(), and Update().
|
staticprotected |
|
staticprotected |
Referenced by LoadResetTimes(), and Update().