mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-28 04:42:10 +01:00
Core/Instances: Delete InstanceSaveMgr and replace most of its uses with new InstanceLockMgr
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user