aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2023-11-28 16:24:38 +0100
committerfunjoker <funjoker109@gmail.com>2023-12-01 23:29:27 +0100
commit33510fafd866ab14045731ad6e6833a01ade9ba6 (patch)
treee90b68caaaff65f2e492cc4600b052bc85faa49e
parent845667ca59d64bc001a5cab78f73e346d0cb2160 (diff)
Core/Instances: Prevent sending PendingRaidLock in instances that don't have a InstanceScript
Closes #29470 (cherry picked from commit 75a306e422cfb83c688b90ea428522251a70e68b)
-rw-r--r--src/server/game/Maps/Map.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index c9f1a768d8c..beb84ff09e8 100644
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -2862,7 +2862,7 @@ bool InstanceMap::AddPlayerToMap(Player* player, bool initPlayer /*= true*/)
player->AddInstanceEnterTime(GetInstanceId(), GameTime::GetGameTime());
MapDb2Entries entries{ GetEntry(), GetMapDifficulty() };
- if (entries.MapDifficulty->HasResetSchedule() && i_instanceLock && !i_instanceLock->IsNew())
+ if (entries.MapDifficulty->HasResetSchedule() && i_instanceLock && !i_instanceLock->IsNew() && i_data)
{
if (!entries.MapDifficulty->IsUsingEncounterLocks())
{
@@ -2995,7 +2995,7 @@ InstanceResetResult InstanceMap::Reset(InstanceResetMethod method)
{
case InstanceResetMethod::Manual:
// notify the players to leave the instance so it can be reset
- for (MapReference& ref : m_mapRefManager)
+ for (MapReference const& ref : m_mapRefManager)
ref.GetSource()->SendResetFailedNotify(GetId());
break;
case InstanceResetMethod::OnChangeDifficulty:
@@ -3009,20 +3009,25 @@ InstanceResetResult InstanceMap::Reset(InstanceResetMethod method)
raidInstanceMessage.DifficultyID = GetDifficultyID();
raidInstanceMessage.Write();
- WorldPackets::Instance::PendingRaidLock pendingRaidLock;
- pendingRaidLock.TimeUntilLock = 60000;
- pendingRaidLock.CompletedMask = i_instanceLock->GetData()->CompletedEncountersMask;
- pendingRaidLock.Extending = true;
- pendingRaidLock.WarningOnly = GetEntry()->IsFlexLocking();
- pendingRaidLock.Write();
-
- for (MapReference& ref : m_mapRefManager)
- {
+ for (MapReference const& ref : m_mapRefManager)
ref.GetSource()->SendDirectMessage(raidInstanceMessage.GetRawPacket());
- ref.GetSource()->SendDirectMessage(pendingRaidLock.GetRawPacket());
- if (!pendingRaidLock.WarningOnly)
- ref.GetSource()->SetPendingBind(GetInstanceId(), 60000);
+ if (i_data)
+ {
+ WorldPackets::Instance::PendingRaidLock pendingRaidLock;
+ pendingRaidLock.TimeUntilLock = 60000;
+ pendingRaidLock.CompletedMask = i_instanceLock->GetData()->CompletedEncountersMask;
+ pendingRaidLock.Extending = true;
+ pendingRaidLock.WarningOnly = GetEntry()->IsFlexLocking();
+ pendingRaidLock.Write();
+
+ for (MapReference const& ref : m_mapRefManager)
+ {
+ ref.GetSource()->SendDirectMessage(pendingRaidLock.GetRawPacket());
+
+ if (!pendingRaidLock.WarningOnly)
+ ref.GetSource()->SetPendingBind(GetInstanceId(), 60000);
+ }
}
break;
}