Core/Chat: Rewrite some custom channel handling. Channel creation now properly saves passwords.

Port From (https://github.com/TrinityCore/TrinityCore/commit/ea753efb9370455979c8af8ebaafa734b77d6052)
This commit is contained in:
hondacrx
2021-12-27 17:23:39 -05:00
parent 855c9611e0
commit 12f472cee1
4 changed files with 56 additions and 34 deletions
+23 -21
View File
@@ -67,31 +67,33 @@ namespace Game.Chat
return null;
}
public Channel GetJoinChannel(uint channelId, string name, AreaTableRecord zoneEntry = null)
public Channel GetSystemChannel(uint channelId, AreaTableRecord zoneEntry = null)
{
if (channelId != 0) // builtin
{
ObjectGuid channelGuid = CreateBuiltinChannelGuid(channelId, zoneEntry);
var channel = _channels.LookupByKey(channelGuid);
if (channel != null)
return channel;
ObjectGuid channelGuid = CreateBuiltinChannelGuid(channelId, zoneEntry);
var currentChannel = _channels.LookupByKey(channelGuid);
if (currentChannel != null)
return currentChannel;
Channel newChannel = new(channelGuid, channelId, _team, zoneEntry);
_channels[channelGuid] = newChannel;
return newChannel;
}
else // custom
{
var channel = _customChannels.LookupByKey(name.ToLower());
if (channel != null)
return channel;
Channel newChannel = new(CreateCustomChannelGuid(), name, _team);
_customChannels[name.ToLower()] = newChannel;
return newChannel;
}
Channel newChannel = new Channel(channelGuid, channelId, _team, zoneEntry);
_channels[channelGuid] = newChannel;
return newChannel;
}
public Channel CreateCustomChannel(string name)
{
if (_customChannels.ContainsKey(name.ToLower()))
return null;
Channel newChannel = new(CreateCustomChannelGuid(), name, _team);
_customChannels[name.ToLower()] = newChannel;
return newChannel;
}
public Channel GetCustomChannel(string name)
{
return _customChannels.LookupByKey(name.ToLower());
}
public Channel GetChannel(uint channelId, string name, Player player, bool notify = true, AreaTableRecord zoneEntry = null)
{
Channel result = null;