(a410fd46c) Trying to help the merge script through a jungle of merges

This commit is contained in:
Joonas Rikkonen
2019-06-04 16:19:53 +03:00
parent 5208b922d8
commit bea7b58ff3
84 changed files with 1720 additions and 929 deletions
@@ -576,7 +576,7 @@ namespace Barotrauma.Networking
HandleOwnership(msgContent, inc.SenderConnection);
}
DebugConsole.NewMessage(packetHeader.ToString(), Color.Lime);
DebugConsole.Log(packetHeader.ToString());
if (inc.SenderConnection != OwnerConnection && serverSettings.BanList.IsBanned(inc.SenderEndPoint.Address, 0))
{
inc.SenderConnection.Deny(DisconnectReason.Banned.ToString());
@@ -661,7 +661,13 @@ namespace Barotrauma.Networking
if (GameMain.Config.UseSteamMatchmaking)
{
SteamManager.RefreshServerDetails(this);
bool refreshSuccessful = SteamManager.RefreshServerDetails(this);
if (GameSettings.VerboseLogging)
{
Log(refreshSuccessful ?
"Refreshed server info on the server list." :
"Refreshing server info on the server list failed.", ServerLog.MessageType.ServerMessage);
}
}
else
{
@@ -865,6 +871,8 @@ namespace Barotrauma.Networking
c.LastRecvLobbyUpdate = NetIdUtils.Clamp(inc.ReadUInt16(), c.LastRecvLobbyUpdate, GameMain.NetLobbyScreen.LastUpdateID);
c.LastRecvChatMsgID = NetIdUtils.Clamp(inc.ReadUInt16(), c.LastRecvChatMsgID, c.LastChatMsgQueueID);
c.LastRecvClientListUpdate = NetIdUtils.Clamp(inc.ReadUInt16(), c.LastRecvClientListUpdate, LastClientListUpdateID);
TryChangeClientName(c, inc.ReadString());
c.LastRecvCampaignSave = inc.ReadUInt16();
if (c.LastRecvCampaignSave > 0)
@@ -2066,11 +2074,44 @@ namespace Barotrauma.Networking
public override void AddChatMessage(ChatMessage message)
{
if (string.IsNullOrEmpty(message.Text)) { return; }
Log(message.TextWithSender, ServerLog.MessageType.Chat);
Log(message.TextWithSender, ServerLog.MessageType.Chat);
base.AddChatMessage(message);
}
private bool TryChangeClientName(Client c, string newName)
{
if (c == null || string.IsNullOrEmpty(newName)) { return false; }
newName = Client.SanitizeName(newName);
if (newName == c.Name) { return false; }
//update client list even if the name cannot be changed to the one sent by the client,
//so the client will be informed what their actual name is
LastClientListUpdateID++;
if (!Client.IsValidName(newName, this))
{
SendDirectChatMessage("Could not change your name to \"" + newName + "\" (the name contains disallowed symbols).", c, ChatMessageType.MessageBox);
return false;
}
if (c.Connection != OwnerConnection && Homoglyphs.Compare(newName.ToLower(), Name.ToLower()))
{
SendDirectChatMessage("Could not change your name to \"" + newName + "\" (too similar to the server's name).", c, ChatMessageType.MessageBox);
return false;
}
Client nameTaken = ConnectedClients.Find(c2 => c != c2 && Homoglyphs.Compare(c2.Name.ToLower(), newName.ToLower()));
if (nameTaken != null)
{
SendDirectChatMessage("Could not change your name to \"" + newName + "\" (too similar to the name of the client \"" + nameTaken.Name + "\").", c, ChatMessageType.MessageBox);
return false;
}
SendChatMessage("Player \"" + c.Name + "\" has changed their name to \"" + newName + "\".", ChatMessageType.Server);
c.Name = newName;
return true;
}
public override void KickPlayer(string playerName, string reason)
{
playerName = playerName.ToLowerInvariant();