1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

update mapname from status query

This commit is contained in:
RaidMax
2019-11-18 14:02:35 -06:00
parent 564c1524e3
commit 89b690938a
7 changed files with 54 additions and 14 deletions

View File

@ -498,7 +498,7 @@ namespace IW4MAdmin
Hostname = dict["hostname"];
string mapname = dict["mapname"] ?? CurrentMap.Name;
CurrentMap = Maps.Find(m => m.Name == mapname) ?? new Map() { Alias = mapname, Name = mapname };
UpdateMap(mapname);
}
}
@ -510,11 +510,7 @@ namespace IW4MAdmin
MaxClients = int.Parse(dict["sv_maxclients"]);
string mapname = dict["mapname"];
CurrentMap = Maps.Find(m => m.Name == mapname) ?? new Map()
{
Alias = mapname,
Name = mapname
};
UpdateMap(mapname);
}
}
@ -598,7 +594,8 @@ namespace IW4MAdmin
var now = DateTime.Now;
#endif
var currentClients = GetClientsAsList();
var polledClients = (await this.GetStatusAsync()).AsEnumerable();
var statusResponse = (await this.GetStatusAsync());
var polledClients = statusResponse.Item1.AsEnumerable();
if (Manager.GetApplicationSettings().Configuration().IgnoreBots)
{
@ -611,6 +608,8 @@ namespace IW4MAdmin
var connectingClients = polledClients.Except(currentClients);
var updatedClients = polledClients.Except(connectingClients).Except(disconnectingClients);
UpdateMap(statusResponse.Item2);
return new List<EFClient>[]
{
connectingClients.ToList(),
@ -619,6 +618,18 @@ namespace IW4MAdmin
};
}
private void UpdateMap(string mapname)
{
if (!string.IsNullOrEmpty(mapname))
{
CurrentMap = Maps.Find(m => m.Name == mapname) ?? new Map()
{
Alias = mapname,
Name = mapname
};
}
}
private async Task ShutdownInternal()
{
foreach (var client in GetClientsAsList())
@ -887,11 +898,11 @@ namespace IW4MAdmin
InitializeMaps();
this.Hostname = hostname;
this.CurrentMap = Maps.Find(m => m.Name == mapname) ?? new Map() { Alias = mapname, Name = mapname };
this.MaxClients = maxplayers;
this.FSGame = game;
this.Gametype = gametype;
this.IP = ip.Value == "localhost" ? ServerConfig.IPAddress : ip.Value ?? ServerConfig.IPAddress;
UpdateMap(mapname);
if (RconParser.CanGenerateLogPath)
{