Merge branch '3.3.5-instanceextend' into 3.3.5 (PR #16392)
This commit is contained in:
commit
62aff401f6
17 files changed
+232
-77
No files matched your search
@@ -3257,22 +3257,37 @@ bool InstanceMap::Reset(uint8 method)
|
||||
}
|
||||
else
|
||||
{
|
||||
bool doUnload = true;
|
||||
if (method == INSTANCE_RESET_GLOBAL)
|
||||
{
|
||||
// set the homebind timer for players inside (1 minute)
|
||||
for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
|
||||
itr->GetSource()->m_InstanceValid = false;
|
||||
{
|
||||
InstancePlayerBind* bind = itr->GetSource()->GetBoundInstance(GetId(), GetDifficulty());
|
||||
if (bind && bind->extendState && bind->save->GetInstanceId() == GetInstanceId())
|
||||
doUnload = false;
|
||||
else
|
||||
itr->GetSource()->m_InstanceValid = false;
|
||||
}
|
||||
|
||||
// the unload timer is not started
|
||||
// instead the map will unload immediately after the players have left
|
||||
m_unloadWhenEmpty = true;
|
||||
m_resetAfterUnload = true;
|
||||
if (doUnload && HasPermBoundPlayers()) // check if any unloaded players have a nonexpired save to this
|
||||
doUnload = false;
|
||||
}
|
||||
|
||||
if (doUnload)
|
||||
{
|
||||
// the unload timer is not started
|
||||
// instead the map will unload immediately after the players have left
|
||||
m_unloadWhenEmpty = true;
|
||||
m_resetAfterUnload = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// unloaded at next update
|
||||
m_unloadTimer = MIN_UNLOAD_DELAY;
|
||||
m_resetAfterUnload = true;
|
||||
m_resetAfterUnload = !(method == INSTANCE_RESET_GLOBAL && HasPermBoundPlayers());
|
||||
}
|
||||
|
||||
return m_mapRefManager.isEmpty();
|
||||
@@ -3353,6 +3368,13 @@ MapDifficulty const* Map::GetMapDifficulty() const
|
||||
return GetMapDifficultyData(GetId(), GetDifficulty());
|
||||
}
|
||||
|
||||
bool InstanceMap::HasPermBoundPlayers() const
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PERM_BIND_BY_INSTANCE);
|
||||
stmt->setUInt16(0,GetInstanceId());
|
||||
return !!CharacterDatabase.Query(stmt);
|
||||
}
|
||||
|
||||
uint32 InstanceMap::GetMaxPlayers() const
|
||||
{
|
||||
MapDifficulty const* mapDiff = GetMapDifficulty();
|
||||
|
||||
Reference in new issue
Block a user