Core/Instances: Delete InstanceSaveMgr and replace most of its uses with new InstanceLockMgr

This commit is contained in:
Shauren
2020-01-02 14:19:35 +01:00
parent a131542855
commit 9b924522d0
35 changed files with 268 additions and 2000 deletions

View File

@@ -22,8 +22,8 @@
#include "FlightPathMovementGenerator.h"
#include "GameTime.h"
#include "Garrison.h"
#include "InstanceLockMgr.h"
#include "InstancePackets.h"
#include "InstanceSaveMgr.h"
#include "Log.h"
#include "Map.h"
#include "MapManager.h"
@@ -193,17 +193,24 @@ void WorldSession::HandleMoveWorldportAck()
if (mEntry->IsDungeon())
{
// check if this instance has a reset time and send it to player if so
Difficulty diff = newMap->GetDifficultyID();
if (MapDifficultyEntry const* mapDiff = sDB2Manager.GetMapDifficultyData(mEntry->ID, diff))
MapDb2Entries entries{ mEntry->ID, newMap->GetDifficultyID() };
if (entries.MapDifficulty->HasResetSchedule())
{
if (mapDiff->GetRaidDuration())
WorldPackets::Instance::RaidInstanceMessage raidInstanceMessage;
raidInstanceMessage.Type = RAID_INSTANCE_WELCOME;
raidInstanceMessage.MapID = mEntry->ID;
raidInstanceMessage.DifficultyID = newMap->GetDifficultyID();
if (InstanceLock const* playerLock = sInstanceLockMgr.FindActiveInstanceLock(GetPlayer()->GetGUID(), entries))
{
if (time_t timeReset = sInstanceSaveMgr->GetResetTimeFor(mEntry->ID, diff))
{
uint32 timeleft = uint32(timeReset - GameTime::GetGameTime());
player->SendInstanceResetWarning(mEntry->ID, diff, timeleft, true);
}
raidInstanceMessage.Locked = !playerLock->IsExpired();
raidInstanceMessage.Extended = playerLock->IsExtended();
}
else
{
raidInstanceMessage.Locked = false;
raidInstanceMessage.Extended = false;
}
SendPacket(raidInstanceMessage.Write());
}
// check if instance is valid