From b382c0339fb3f94f7364bcdeaa696735239e65c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sat, 2 Aug 2014 08:18:30 +0200 Subject: [PATCH 1/5] only notify when the lobby settings differ from the default --- OpenRA.Game/Server/Server.cs | 38 +++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/OpenRA.Game/Server/Server.cs b/OpenRA.Game/Server/Server.cs index ed058d1596..b582377d8f 100644 --- a/OpenRA.Game/Server/Server.cs +++ b/OpenRA.Game/Server/Server.cs @@ -361,15 +361,35 @@ namespace OpenRA.Server void NotifyNewClientOfLobbyInfo(Connection newConn) { - SendOrderTo(newConn, "Message", "Diplomacy Changes: {0}".F(LobbyInfo.GlobalSettings.FragileAlliances)); - SendOrderTo(newConn, "Message", "Allow Cheats: {0}".F(LobbyInfo.GlobalSettings.AllowCheats)); - SendOrderTo(newConn, "Message", "Shroud: {0}".F(LobbyInfo.GlobalSettings.Shroud)); - SendOrderTo(newConn, "Message", "Fog of war: {0}".F(LobbyInfo.GlobalSettings.Fog)); - SendOrderTo(newConn, "Message", "Crates Appear: {0}".F(LobbyInfo.GlobalSettings.Crates)); - SendOrderTo(newConn, "Message", "Build off Ally ConYards: {0}".F(LobbyInfo.GlobalSettings.AllyBuildRadius)); - SendOrderTo(newConn, "Message", "Starting Units: {0}".F(LobbyInfo.GlobalSettings.StartingUnitsClass)); - SendOrderTo(newConn, "Message", "Starting Cash: ${0}".F(LobbyInfo.GlobalSettings.StartingCash)); - SendOrderTo(newConn, "Message", "Tech Level: {0}".F(LobbyInfo.GlobalSettings.TechLevel)); + var defaults = new Session.Global(); + FieldLoader.Load(defaults, Game.modData.Manifest.LobbyDefaults); + + if (LobbyInfo.GlobalSettings.FragileAlliances != defaults.FragileAlliances) + SendOrderTo(newConn, "Message", "Diplomacy Changes: {0}".F(LobbyInfo.GlobalSettings.FragileAlliances)); + + if (LobbyInfo.GlobalSettings.AllowCheats != defaults.AllowCheats) + SendOrderTo(newConn, "Message", "Allow Cheats: {0}".F(LobbyInfo.GlobalSettings.AllowCheats)); + + if (LobbyInfo.GlobalSettings.Shroud != defaults.Shroud) + SendOrderTo(newConn, "Message", "Shroud: {0}".F(LobbyInfo.GlobalSettings.Shroud)); + + if (LobbyInfo.GlobalSettings.Fog != defaults.Fog) + SendOrderTo(newConn, "Message", "Fog of war: {0}".F(LobbyInfo.GlobalSettings.Fog)); + + if (LobbyInfo.GlobalSettings.Crates != defaults.Crates) + SendOrderTo(newConn, "Message", "Crates Appear: {0}".F(LobbyInfo.GlobalSettings.Crates)); + + if (LobbyInfo.GlobalSettings.AllyBuildRadius != defaults.AllyBuildRadius) + SendOrderTo(newConn, "Message", "Build off Ally ConYards: {0}".F(LobbyInfo.GlobalSettings.AllyBuildRadius)); + + if (LobbyInfo.GlobalSettings.StartingUnitsClass != defaults.StartingUnitsClass) + SendOrderTo(newConn, "Message", "Starting Units: {0}".F(LobbyInfo.GlobalSettings.StartingUnitsClass)); + + if (LobbyInfo.GlobalSettings.StartingCash != defaults.StartingCash) + SendOrderTo(newConn, "Message", "Starting Cash: ${0}".F(LobbyInfo.GlobalSettings.StartingCash)); + + if (LobbyInfo.GlobalSettings.TechLevel != defaults.TechLevel) + SendOrderTo(newConn, "Message", "Tech Level: {0}".F(LobbyInfo.GlobalSettings.TechLevel)); } void SetOrderLag() From 65049f621260a01a3f91c6a69af1cdcf30b77b05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sat, 2 Aug 2014 08:18:46 +0200 Subject: [PATCH 2/5] announce map changes --- OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs b/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs index c6312db49e..f79186e35b 100644 --- a/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs +++ b/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs @@ -299,6 +299,7 @@ namespace OpenRA.Mods.RA.Server server.SendOrderTo(conn, "Message", "Map was not found on server"); return true; } + server.LobbyInfo.GlobalSettings.Map = s; var oldSlots = server.LobbyInfo.Slots.Keys.ToArray(); @@ -335,6 +336,9 @@ namespace OpenRA.Mods.RA.Server } server.SyncLobbyInfo(); + + server.SendMessage("{0} changed the map to {1}.".F(client.Name, server.Map.Title)); + return true; }}, { "fragilealliance", From 061ab42896dd13b5c1534ea61f6f683361d2b25f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sat, 2 Aug 2014 08:19:09 +0200 Subject: [PATCH 3/5] announce kicks and bans --- OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs b/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs index f79186e35b..2db7e1751f 100644 --- a/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs +++ b/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs @@ -618,9 +618,10 @@ namespace OpenRA.Mods.RA.Server return true; } - var kickConnIP = server.GetClient(kickConn).IpAddress; + var kickClient = server.GetClient(kickConn); Log.Write("server", "Kicking client {0} as requested", kickClientID); + server.SendMessage("{0} kicked {1} from the server.".F(client.Name, kickClient.Name)); server.SendOrderTo(kickConn, "ServerError", "You have been kicked from the server"); server.DropClient(kickConn); @@ -629,12 +630,14 @@ namespace OpenRA.Mods.RA.Server if (tempBan) { - Log.Write("server", "Temporarily banning client {0} ({1}) as requested", kickClientID, kickConnIP); - server.TempBans.Add(kickConnIP); + Log.Write("server", "Temporarily banning client {0} ({1}) as requested", kickClientID, kickClient.IpAddress); + server.SendMessage("{0} temporarily banned {1} from the server.".F(client.Name, kickClient.Name)); + server.TempBans.Add(kickClient.IpAddress); } server.SyncLobbyClients(); server.SyncLobbySlots(); + return true; }}, { "name", From ed2e4eef174886b0a23c2b3cdead1b04aeb46eaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 3 Aug 2014 09:56:45 +0200 Subject: [PATCH 4/5] make the change notifications more natural --- OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs | 24 ++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs b/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs index 2db7e1751f..ad4cf05546 100644 --- a/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs +++ b/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs @@ -358,7 +358,8 @@ namespace OpenRA.Mods.RA.Server bool.TryParse(s, out server.LobbyInfo.GlobalSettings.FragileAlliances); server.SyncLobbyGlobalSettings(); - server.SendMessage("{0} modified to {1}.".F(client.Name, s)); + server.SendMessage("{0} {1} Diplomacy Changes." + .F(client.Name, server.LobbyInfo.GlobalSettings.FragileAlliances ? "enabled" : "disabled")); return true; }}, @@ -379,7 +380,8 @@ namespace OpenRA.Mods.RA.Server bool.TryParse(s, out server.LobbyInfo.GlobalSettings.AllowCheats); server.SyncLobbyGlobalSettings(); - server.SendMessage("{0} modified to {1}.".F(client.Name, s)); + server.SendMessage("{0} {1} Developer Cheats." + .F(client.Name, server.LobbyInfo.GlobalSettings.AllowCheats ? "allowed" : "disallowed")); return true; }}, @@ -400,7 +402,8 @@ namespace OpenRA.Mods.RA.Server bool.TryParse(s, out server.LobbyInfo.GlobalSettings.Shroud); server.SyncLobbyGlobalSettings(); - server.SendMessage("{0} modified to {1}.".F(client.Name, s)); + server.SendMessage("{0} {1} Shroud." + .F(client.Name, server.LobbyInfo.GlobalSettings.Shroud ? "enabled" : "disabled")); return true; }}, @@ -422,7 +425,8 @@ namespace OpenRA.Mods.RA.Server bool.TryParse(s, out server.LobbyInfo.GlobalSettings.Fog); server.SyncLobbyGlobalSettings(); - server.SendMessage("{0} modified to {1}.".F(client.Name, s)); + server.SendMessage("{0} {1} Fog of War." + .F(client.Name, server.LobbyInfo.GlobalSettings.Fog ? "enabled" : "disabled")); return true; }}, @@ -484,7 +488,8 @@ namespace OpenRA.Mods.RA.Server bool.TryParse(s, out server.LobbyInfo.GlobalSettings.Crates); server.SyncLobbyGlobalSettings(); - server.SendMessage("{0} modified to {1}.".F(client.Name, s)); + server.SendMessage("{0} {1} Crates Appear." + .F(client.Name, server.LobbyInfo.GlobalSettings.Crates ? "enabled" : "disabled")); return true; }}, @@ -505,7 +510,8 @@ namespace OpenRA.Mods.RA.Server bool.TryParse(s, out server.LobbyInfo.GlobalSettings.AllyBuildRadius); server.SyncLobbyGlobalSettings(); - server.SendMessage("{0} modified to {1}.".F(client.Name, s)); + server.SendMessage("{0} {1} Build off Ally ConYards." + .F(client.Name, server.LobbyInfo.GlobalSettings.AllyBuildRadius ? "enabled" : "disabled")); return true; }}, @@ -546,7 +552,7 @@ namespace OpenRA.Mods.RA.Server server.LobbyInfo.GlobalSettings.StartingUnitsClass = s; server.SyncLobbyGlobalSettings(); - server.SendMessage("{0} modified to {1}.".F(client.Name, s)); + server.SendMessage("{0} changed Starting Units to {1}.".F(client.Name, s)); return true; }}, @@ -567,7 +573,7 @@ namespace OpenRA.Mods.RA.Server server.LobbyInfo.GlobalSettings.StartingCash = Exts.ParseIntegerInvariant(s); server.SyncLobbyGlobalSettings(); - server.SendMessage("{0} modified to ${1}.".F(client.Name, s)); + server.SendMessage("{0} changed Starting Cash to ${1}.".F(client.Name, s)); return true; }}, @@ -588,7 +594,7 @@ namespace OpenRA.Mods.RA.Server server.LobbyInfo.GlobalSettings.TechLevel = s; server.SyncLobbyInfo(); - server.SendMessage("{0} modified to {1}.".F(client.Name, s)); + server.SendMessage("{0} changed Tech Level to {1}.".F(client.Name, s)); return true; }}, From 658ae241dc20ec2ded65db9f4037035a247dcf77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 3 Aug 2014 14:20:09 +0200 Subject: [PATCH 5/5] notify about difficulty level changes --- OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs b/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs index ad4cf05546..885a499c6c 100644 --- a/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs +++ b/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs @@ -533,6 +533,8 @@ namespace OpenRA.Mods.RA.Server server.LobbyInfo.GlobalSettings.Difficulty = s; server.SyncLobbyGlobalSettings(); + server.SendMessage("{0} changed difficulty to {1}.".F(client.Name, s)); + return true; }}, { "startingunits",