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)
This commit is contained in:
hondacrx
2022-01-04 17:51:57 -05:00
parent 66df29db11
commit 964542023c
4 changed files with 2 additions and 25 deletions
@@ -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);
-4
View File
@@ -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());
}
-2
View File
@@ -102,8 +102,6 @@ namespace Game
if (packet.ZoneChannelID != 0)
cMgr.LeftChannel((uint)packet.ZoneChannelID, zone);
else
cMgr.LeftChannel(packet.ChannelName);
}
}
+2 -7
View File
@@ -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
{