aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Handlers/MovementHandler.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2020-01-02 14:19:35 +0100
committerShauren <shauren.trinity@gmail.com>2022-10-04 00:19:38 +0200
commit9b924522d0549dd67b10e2cbdfc20297dd21e182 (patch)
treef0fcdf96902b7c497c1bc65db83621a8dfadf43a /src/server/game/Handlers/MovementHandler.cpp
parenta131542855d23022714a97640be1c8d68a741c31 (diff)
Core/Instances: Delete InstanceSaveMgr and replace most of its uses with new InstanceLockMgr
Diffstat (limited to 'src/server/game/Handlers/MovementHandler.cpp')
-rw-r--r--src/server/game/Handlers/MovementHandler.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp
index 0c027ea5f33..b28f83e03dc 100644
--- a/src/server/game/Handlers/MovementHandler.cpp
+++ b/src/server/game/Handlers/MovementHandler.cpp
@@ -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