From 964542023cb3476ad447809307ff6e7b702c2281 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Tue, 4 Jan 2022 17:51:57 -0500 Subject: [PATCH] Core/Channels: Fix a bug that would cause channel settings to disappear in certain settings. Fix a bug that would cause channels to not be saved on .server shutdown without delay. Port From (https://github.com/TrinityCore/TrinityCore/commit/f434241305089942e7df5579e81137624c3ae0ef) --- Source/Game/Chat/Channels/ChannelManager.cs | 12 ------------ Source/Game/Entities/Player/Player.cs | 4 ---- Source/Game/Handlers/ChannelHandler.cs | 2 -- Source/Game/Server/WorldManager.cs | 9 ++------- 4 files changed, 2 insertions(+), 25 deletions(-) diff --git a/Source/Game/Chat/Channels/ChannelManager.cs b/Source/Game/Chat/Channels/ChannelManager.cs index fee43c755..924e51df9 100644 --- a/Source/Game/Chat/Channels/ChannelManager.cs +++ b/Source/Game/Chat/Channels/ChannelManager.cs @@ -193,18 +193,6 @@ namespace Game.Chat return result; } - public void LeftChannel(string name) - { - string channelName = name.ToLower(); - - var channel = _customChannels.LookupByKey(channelName); - if (channel == null) - return; - - if (channel.GetNumPlayers() == 0) - _customChannels.Remove(channelName); - } - public void LeftChannel(uint channelId, AreaTableRecord zoneEntry) { var guid = CreateBuiltinChannelGuid(channelId, zoneEntry); diff --git a/Source/Game/Entities/Player/Player.cs b/Source/Game/Entities/Player/Player.cs index 23e82faeb..19d555217 100644 --- a/Source/Game/Entities/Player/Player.cs +++ b/Source/Game/Entities/Player/Player.cs @@ -2617,12 +2617,8 @@ namespace Game.Entities // delete channel if empty ChannelManager cMgr = ChannelManager.ForTeam(GetTeam()); if (cMgr != null) - { if (ch.IsConstant()) cMgr.LeftChannel(ch.GetChannelId(), ch.GetZoneEntry()); - else - cMgr.LeftChannel(ch.GetName()); - } } Log.outDebug(LogFilter.ChatSystem, "Player {0}: channels cleaned up!", GetName()); } diff --git a/Source/Game/Handlers/ChannelHandler.cs b/Source/Game/Handlers/ChannelHandler.cs index 219ded875..70a28cb37 100644 --- a/Source/Game/Handlers/ChannelHandler.cs +++ b/Source/Game/Handlers/ChannelHandler.cs @@ -102,8 +102,6 @@ namespace Game if (packet.ZoneChannelID != 0) cMgr.LeftChannel((uint)packet.ZoneChannelID, zone); - else - cMgr.LeftChannel(packet.ChannelName); } } diff --git a/Source/Game/Server/WorldManager.cs b/Source/Game/Server/WorldManager.cs index 5e7c2a870..f4f0d7424 100644 --- a/Source/Game/Server/WorldManager.cs +++ b/Source/Game/Server/WorldManager.cs @@ -1806,14 +1806,9 @@ namespace Game m_ShutdownMask = options; m_ExitCode = exitcode; - // If the shutdown time is 0, set m_stopEvent (except if shutdown is 'idle' with remaining sessions) + // If the shutdown time is 0, evaluate shutdown on next tick (no message) if (time == 0) - { - if (!options.HasAnyFlag(ShutdownMask.Idle) || GetActiveAndQueuedSessionCount() == 0) - IsStopped = true; // exist code already set - else - m_ShutdownTimer = 1; //So that the session count is re-evaluated at next world tick - } + m_ShutdownTimer = 1; // Else set the shutdown timer and warn users else {