Core/Instances: Prevent sending PendingRaidLock in instances that don't have a InstanceScript

Port From (https://github.com/TrinityCore/TrinityCore/commit/75a306e422cfb83c688b90ea428522251a70e68b)
This commit is contained in:
hondacrx
2024-02-03 14:04:56 -05:00
parent f2888995e4
commit 89ad2414c4
+18 -13
View File
@@ -4977,7 +4977,7 @@ namespace Game.Maps
public InstanceResetResult Reset(InstanceResetMethod method) public InstanceResetResult Reset(InstanceResetMethod method)
{ {
// raids can be reset if no boss was killed // raids can be reset if no boss was killed
if (method != InstanceResetMethod.Expire && i_instanceLock != null && !i_instanceLock.IsNew()) if (method != InstanceResetMethod.Expire && i_instanceLock != null && !i_instanceLock.IsNew() && i_data != null)
return InstanceResetResult.CannotReset; return InstanceResetResult.CannotReset;
if (HavePlayers()) if (HavePlayers())
@@ -5000,20 +5000,25 @@ namespace Game.Maps
raidInstanceMessage.DifficultyID = GetDifficultyID(); raidInstanceMessage.DifficultyID = GetDifficultyID();
raidInstanceMessage.Write(); raidInstanceMessage.Write();
PendingRaidLock pendingRaidLock = new(); foreach (Player player in GetPlayers())
pendingRaidLock.TimeUntilLock = 60000;
pendingRaidLock.CompletedMask = i_instanceLock.GetData().CompletedEncountersMask;
pendingRaidLock.Extending = true;
pendingRaidLock.WarningOnly = GetEntry().IsFlexLocking();
pendingRaidLock.Write();
foreach (Player player in GetPlayers())
{
player.SendPacket(raidInstanceMessage); player.SendPacket(raidInstanceMessage);
player.SendPacket(pendingRaidLock);
if (i_data != null)
{
PendingRaidLock pendingRaidLock = new();
pendingRaidLock.TimeUntilLock = 60000;
pendingRaidLock.CompletedMask = i_instanceLock.GetData().CompletedEncountersMask;
pendingRaidLock.Extending = true;
pendingRaidLock.WarningOnly = GetEntry().IsFlexLocking();
pendingRaidLock.Write();
if (!pendingRaidLock.WarningOnly) foreach (Player player in GetPlayers())
player.SetPendingBind(GetInstanceId(), 60000); {
player.SendPacket(pendingRaidLock);
if (!pendingRaidLock.WarningOnly)
player.SetPendingBind(GetInstanceId(), 60000);
}
} }
break; break;
} }