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
+6 -6
View File
@@ -172,7 +172,7 @@ namespace Game.Chat
}
}
public void JoinChannel(Player player, string pass)
public void JoinChannel(Player player, string pass = "")
{
ObjectGuid guid = player.GetGUID();
if (IsOn(guid))
@@ -193,7 +193,7 @@ namespace Game.Chat
return;
}
if (!string.IsNullOrEmpty(_channelPassword) && pass != _channelPassword)
if (!CheckPassword(pass))
{
var builder = new ChannelNameBuilder(this, new WrongPasswordAppend());
SendToOne(builder, guid);
@@ -892,11 +892,11 @@ namespace Game.Chat
public bool IsLFG() { return GetFlags().HasAnyFlag(ChannelFlags.Lfg); }
bool IsAnnounce() { return _announceEnabled; }
void SetAnnounce(bool nannounce) { _announceEnabled = nannounce; }
string GetPassword() { return _channelPassword; }
void SetPassword(string npassword) { _channelPassword = npassword; }
void SetAnnounce(bool announce) { _announceEnabled = announce; }
public void SetPassword(string npassword) { _channelPassword = npassword; }
public bool CheckPassword(string password) { return _channelPassword.IsEmpty() || (_channelPassword == password); }
public uint GetNumPlayers() { return (uint)_playersStore.Count; }
public ChannelFlags GetFlags() { return _channelFlags; }