From 8a8d2e3ba69f6809fc2497c7369077718f2552ea Mon Sep 17 00:00:00 2001 From: RaidMax Date: Mon, 27 Apr 2015 22:29:43 -0500 Subject: [PATCH] fixed issue with mapname not being updated --- Admin/Event.cs | 8 ++++---- Admin/Server.cs | 35 +++++++++++++++++++++++++++++++---- Admin/config/maps.cfg | 1 + Admin/version.txt | 3 ++- Admin/webfront/graph.html | 9 ++++----- IW4M Admin.sln | 8 ++++---- 6 files changed, 46 insertions(+), 18 deletions(-) diff --git a/Admin/Event.cs b/Admin/Event.cs index 3d37cf195..38ed3dcf4 100644 --- a/Admin/Event.cs +++ b/Admin/Event.cs @@ -100,11 +100,11 @@ namespace IW4MAdmin return new Event(GType.Say, Utilities.removeNastyChars(message), SV.clientFromEventLine(line, 2), null, SV); } - if (eventType == ":") - return new Event(GType.MapEnd, null, null, null, null); + if (eventType == ":") + return new Event(GType.MapEnd, line[0], new Player("WORLD", "WORLD", 0, 0), null, null); - if (line[0].Length > 400) // blaze it - return new Event(GType.MapChange, line[0], null, null, null); + if (line[0].Split('\\').Length > 5) // blaze it + return new Event(GType.MapChange, line[0], new Player("WORLD", "WORLD", 0, 0), null, null); return null; diff --git a/Admin/Server.cs b/Admin/Server.cs index 268cae753..72193231e 100644 --- a/Admin/Server.cs +++ b/Admin/Server.cs @@ -1071,9 +1071,36 @@ namespace IW4MAdmin if (E.Type == Event.GType.MapChange) { Log.Write("New map loaded - " + clientnum + " active players", Log.Level.Debug); - String[] statusResponse = E.Data.Split('\\'); - if (statusResponse.Length >= 15 && statusResponse[13] == "mapname") - mapname = maps.Find(m => m.Name.Equals(statusResponse[14])).Alias; //update map for heartbeat + + Dictionary infoResponseDict = new Dictionary(); + String[] infoResponse = E.Data.Split('\\'); + + for (int i = 0; i < infoResponse.Length; i++) + { + if (i % 2 == 0 || infoResponse[i] == String.Empty) + continue; + infoResponseDict.Add(infoResponse[i], infoResponse[i + 1]); + } + + String newMapName = null; + infoResponseDict.TryGetValue("mapname", out newMapName); + + if (newMapName != null) + { + try + { + mapname = maps.Find(m => m.Name.Equals(mapname)).Alias; + } + + catch (Exception) + { + Log.Write(mapname + " doesn't appear to be in the maps.cfg", Log.Level.Debug); + } + } + + else + Log.Write("Could not get new mapname from InitGame line!", Log.Level.Debug); + return true; } @@ -1124,7 +1151,7 @@ namespace IW4MAdmin public void Tell(String Message, Player Target) { if (Target.getClientNum() > -1) - RCON.addRCON("tell " + Target.getClientNum() + " " + Message + "^7"); + RCON.addRCON("tellraw " + Target.getClientNum() + " " + Message + "^7"); // I fixed tellraw :> } public void Kick(String Message, Player Target) diff --git a/Admin/config/maps.cfg b/Admin/config/maps.cfg index 58c1b3ec8..e58d9666d 100644 --- a/Admin/config/maps.cfg +++ b/Admin/config/maps.cfg @@ -27,4 +27,5 @@ mp_fuel2:Fuel mp_storm:Storm mp_complex:Bailout mp_compact:Salvage +iw4_credits:IW4 Credits mp_raidmax:^1L^23^33^4T^5M^6A^75^8T^93^0R \ No newline at end of file diff --git a/Admin/version.txt b/Admin/version.txt index 410d6d081..1853511c5 100644 --- a/Admin/version.txt +++ b/Admin/version.txt @@ -1,6 +1,7 @@ VERSION: 0.9.1 CHANGELOG: -fixed issue with `history` timelime +-fixed issue with `history` timelime +-fixed issue with mapname not being updated VERSION: 0.9 CHANGELOG: diff --git a/Admin/webfront/graph.html b/Admin/webfront/graph.html index 8b5751cb2..575ca3934 100644 --- a/Admin/webfront/graph.html +++ b/Admin/webfront/graph.html @@ -13,8 +13,7 @@ function drawChart() { data.addRows(players); var options = { - //curveType: 'function', - //width: 900, + //curveType: 'function', still haven't decided on this height: 300, legend: {position: 'none'}, enableInteractivity: true, @@ -27,13 +26,13 @@ function drawChart() { viewWindowMode: 'explicit', viewWindow: { min: 0, - max: 18 + max: 18 // for iw4 }, }, hAxis: { viewWindow: { - //min: players[0][0], - //max: players[players.length-1][0] + //min: players[0][0], no longer needed as timeline adjusts automatically + //max: players[players.length-1][0] // ditto }, gridlines: { count: 12, diff --git a/IW4M Admin.sln b/IW4M Admin.sln index a4117879e..2d8df26e6 100644 --- a/IW4M Admin.sln +++ b/IW4M Admin.sln @@ -11,10 +11,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Debug|Any CPU.ActiveCfg = Release|Any CPU - {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Debug|Any CPU.Build.0 = Release|Any CPU - {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release|Any CPU.Build.0 = Release|Any CPU + {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release|Any CPU.ActiveCfg = Debug|Any CPU + {DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release|Any CPU.Build.0 = Debug|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE