Merge pull request #6134 from Mailaender/lobby-notify-followup

Made the lobby notifications less spammy and added some more cases
This commit is contained in:
obrakmann
2014-08-06 19:58:15 +02:00
2 changed files with 56 additions and 21 deletions

View File

@@ -361,15 +361,35 @@ namespace OpenRA.Server
void NotifyNewClientOfLobbyInfo(Connection newConn) void NotifyNewClientOfLobbyInfo(Connection newConn)
{ {
SendOrderTo(newConn, "Message", "Diplomacy Changes: {0}".F(LobbyInfo.GlobalSettings.FragileAlliances)); var defaults = new Session.Global();
SendOrderTo(newConn, "Message", "Allow Cheats: {0}".F(LobbyInfo.GlobalSettings.AllowCheats)); FieldLoader.Load(defaults, Game.modData.Manifest.LobbyDefaults);
SendOrderTo(newConn, "Message", "Shroud: {0}".F(LobbyInfo.GlobalSettings.Shroud));
SendOrderTo(newConn, "Message", "Fog of war: {0}".F(LobbyInfo.GlobalSettings.Fog)); if (LobbyInfo.GlobalSettings.FragileAlliances != defaults.FragileAlliances)
SendOrderTo(newConn, "Message", "Crates Appear: {0}".F(LobbyInfo.GlobalSettings.Crates)); SendOrderTo(newConn, "Message", "Diplomacy Changes: {0}".F(LobbyInfo.GlobalSettings.FragileAlliances));
SendOrderTo(newConn, "Message", "Build off Ally ConYards: {0}".F(LobbyInfo.GlobalSettings.AllyBuildRadius));
SendOrderTo(newConn, "Message", "Starting Units: {0}".F(LobbyInfo.GlobalSettings.StartingUnitsClass)); if (LobbyInfo.GlobalSettings.AllowCheats != defaults.AllowCheats)
SendOrderTo(newConn, "Message", "Starting Cash: ${0}".F(LobbyInfo.GlobalSettings.StartingCash)); SendOrderTo(newConn, "Message", "Allow Cheats: {0}".F(LobbyInfo.GlobalSettings.AllowCheats));
SendOrderTo(newConn, "Message", "Tech Level: {0}".F(LobbyInfo.GlobalSettings.TechLevel));
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() void SetOrderLag()

View File

@@ -299,6 +299,7 @@ namespace OpenRA.Mods.RA.Server
server.SendOrderTo(conn, "Message", "Map was not found on server"); server.SendOrderTo(conn, "Message", "Map was not found on server");
return true; return true;
} }
server.LobbyInfo.GlobalSettings.Map = s; server.LobbyInfo.GlobalSettings.Map = s;
var oldSlots = server.LobbyInfo.Slots.Keys.ToArray(); var oldSlots = server.LobbyInfo.Slots.Keys.ToArray();
@@ -335,6 +336,9 @@ namespace OpenRA.Mods.RA.Server
} }
server.SyncLobbyInfo(); server.SyncLobbyInfo();
server.SendMessage("{0} changed the map to {1}.".F(client.Name, server.Map.Title));
return true; return true;
}}, }},
{ "fragilealliance", { "fragilealliance",
@@ -354,7 +358,8 @@ namespace OpenRA.Mods.RA.Server
bool.TryParse(s, out server.LobbyInfo.GlobalSettings.FragileAlliances); bool.TryParse(s, out server.LobbyInfo.GlobalSettings.FragileAlliances);
server.SyncLobbyGlobalSettings(); server.SyncLobbyGlobalSettings();
server.SendMessage("{0} modified <Diplomacy Changes> to {1}.".F(client.Name, s)); server.SendMessage("{0} {1} Diplomacy Changes."
.F(client.Name, server.LobbyInfo.GlobalSettings.FragileAlliances ? "enabled" : "disabled"));
return true; return true;
}}, }},
@@ -375,7 +380,8 @@ namespace OpenRA.Mods.RA.Server
bool.TryParse(s, out server.LobbyInfo.GlobalSettings.AllowCheats); bool.TryParse(s, out server.LobbyInfo.GlobalSettings.AllowCheats);
server.SyncLobbyGlobalSettings(); server.SyncLobbyGlobalSettings();
server.SendMessage("{0} modified <Allow Cheats> to {1}.".F(client.Name, s)); server.SendMessage("{0} {1} Developer Cheats."
.F(client.Name, server.LobbyInfo.GlobalSettings.AllowCheats ? "allowed" : "disallowed"));
return true; return true;
}}, }},
@@ -396,7 +402,8 @@ namespace OpenRA.Mods.RA.Server
bool.TryParse(s, out server.LobbyInfo.GlobalSettings.Shroud); bool.TryParse(s, out server.LobbyInfo.GlobalSettings.Shroud);
server.SyncLobbyGlobalSettings(); server.SyncLobbyGlobalSettings();
server.SendMessage("{0} modified <Shroud> to {1}.".F(client.Name, s)); server.SendMessage("{0} {1} Shroud."
.F(client.Name, server.LobbyInfo.GlobalSettings.Shroud ? "enabled" : "disabled"));
return true; return true;
}}, }},
@@ -418,7 +425,8 @@ namespace OpenRA.Mods.RA.Server
bool.TryParse(s, out server.LobbyInfo.GlobalSettings.Fog); bool.TryParse(s, out server.LobbyInfo.GlobalSettings.Fog);
server.SyncLobbyGlobalSettings(); server.SyncLobbyGlobalSettings();
server.SendMessage("{0} modified <Fog of War> to {1}.".F(client.Name, s)); server.SendMessage("{0} {1} Fog of War."
.F(client.Name, server.LobbyInfo.GlobalSettings.Fog ? "enabled" : "disabled"));
return true; return true;
}}, }},
@@ -480,7 +488,8 @@ namespace OpenRA.Mods.RA.Server
bool.TryParse(s, out server.LobbyInfo.GlobalSettings.Crates); bool.TryParse(s, out server.LobbyInfo.GlobalSettings.Crates);
server.SyncLobbyGlobalSettings(); server.SyncLobbyGlobalSettings();
server.SendMessage("{0} modified <Crates Appear> to {1}.".F(client.Name, s)); server.SendMessage("{0} {1} Crates Appear."
.F(client.Name, server.LobbyInfo.GlobalSettings.Crates ? "enabled" : "disabled"));
return true; return true;
}}, }},
@@ -501,7 +510,8 @@ namespace OpenRA.Mods.RA.Server
bool.TryParse(s, out server.LobbyInfo.GlobalSettings.AllyBuildRadius); bool.TryParse(s, out server.LobbyInfo.GlobalSettings.AllyBuildRadius);
server.SyncLobbyGlobalSettings(); server.SyncLobbyGlobalSettings();
server.SendMessage("{0} modified <Build off Ally ConYards> 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; return true;
}}, }},
@@ -523,6 +533,8 @@ namespace OpenRA.Mods.RA.Server
server.LobbyInfo.GlobalSettings.Difficulty = s; server.LobbyInfo.GlobalSettings.Difficulty = s;
server.SyncLobbyGlobalSettings(); server.SyncLobbyGlobalSettings();
server.SendMessage("{0} changed difficulty to {1}.".F(client.Name, s));
return true; return true;
}}, }},
{ "startingunits", { "startingunits",
@@ -542,7 +554,7 @@ namespace OpenRA.Mods.RA.Server
server.LobbyInfo.GlobalSettings.StartingUnitsClass = s; server.LobbyInfo.GlobalSettings.StartingUnitsClass = s;
server.SyncLobbyGlobalSettings(); server.SyncLobbyGlobalSettings();
server.SendMessage("{0} modified <Starting Units> to {1}.".F(client.Name, s)); server.SendMessage("{0} changed Starting Units to {1}.".F(client.Name, s));
return true; return true;
}}, }},
@@ -563,7 +575,7 @@ namespace OpenRA.Mods.RA.Server
server.LobbyInfo.GlobalSettings.StartingCash = Exts.ParseIntegerInvariant(s); server.LobbyInfo.GlobalSettings.StartingCash = Exts.ParseIntegerInvariant(s);
server.SyncLobbyGlobalSettings(); server.SyncLobbyGlobalSettings();
server.SendMessage("{0} modified <Starting Cash> to ${1}.".F(client.Name, s)); server.SendMessage("{0} changed Starting Cash to ${1}.".F(client.Name, s));
return true; return true;
}}, }},
@@ -584,7 +596,7 @@ namespace OpenRA.Mods.RA.Server
server.LobbyInfo.GlobalSettings.TechLevel = s; server.LobbyInfo.GlobalSettings.TechLevel = s;
server.SyncLobbyInfo(); server.SyncLobbyInfo();
server.SendMessage("{0} modified <Tech Level> to {1}.".F(client.Name, s)); server.SendMessage("{0} changed Tech Level to {1}.".F(client.Name, s));
return true; return true;
}}, }},
@@ -614,9 +626,10 @@ namespace OpenRA.Mods.RA.Server
return true; return true;
} }
var kickConnIP = server.GetClient(kickConn).IpAddress; var kickClient = server.GetClient(kickConn);
Log.Write("server", "Kicking client {0} as requested", kickClientID); 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.SendOrderTo(kickConn, "ServerError", "You have been kicked from the server");
server.DropClient(kickConn); server.DropClient(kickConn);
@@ -625,12 +638,14 @@ namespace OpenRA.Mods.RA.Server
if (tempBan) if (tempBan)
{ {
Log.Write("server", "Temporarily banning client {0} ({1}) as requested", kickClientID, kickConnIP); Log.Write("server", "Temporarily banning client {0} ({1}) as requested", kickClientID, kickClient.IpAddress);
server.TempBans.Add(kickConnIP); server.SendMessage("{0} temporarily banned {1} from the server.".F(client.Name, kickClient.Name));
server.TempBans.Add(kickClient.IpAddress);
} }
server.SyncLobbyClients(); server.SyncLobbyClients();
server.SyncLobbySlots(); server.SyncLobbySlots();
return true; return true;
}}, }},
{ "name", { "name",