track private slots for webfront overview

This commit is contained in:
RaidMax 2023-04-05 23:10:40 -05:00
parent 99e0990770
commit bc0ec6c050
7 changed files with 20 additions and 7 deletions

View File

@ -1342,6 +1342,8 @@ namespace IW4MAdmin
var logsync = await this.GetMappedDvarValueOrDefaultAsync<int>("g_logsync", token: Manager.CancellationToken); var logsync = await this.GetMappedDvarValueOrDefaultAsync<int>("g_logsync", token: Manager.CancellationToken);
var ip = await this.GetMappedDvarValueOrDefaultAsync<string>("net_ip", token: Manager.CancellationToken); var ip = await this.GetMappedDvarValueOrDefaultAsync<string>("net_ip", token: Manager.CancellationToken);
var gamePassword = await this.GetMappedDvarValueOrDefaultAsync("g_password", overrideDefault: "", token: Manager.CancellationToken); var gamePassword = await this.GetMappedDvarValueOrDefaultAsync("g_password", overrideDefault: "", token: Manager.CancellationToken);
var privateClients = await this.GetMappedDvarValueOrDefaultAsync("sv_privateClients", overrideDefault: 0,
token: Manager.CancellationToken);
if (Manager.GetApplicationSettings().Configuration().EnableCustomSayName) if (Manager.GetApplicationSettings().Configuration().EnableCustomSayName)
{ {
@ -1383,12 +1385,14 @@ namespace IW4MAdmin
} }
WorkingDirectory = basepath.Value; WorkingDirectory = basepath.Value;
this.Hostname = hostname; Hostname = hostname;
this.MaxClients = maxplayers; MaxClients = maxplayers;
this.FSGame = game.Value; FSGame = game.Value;
this.Gametype = gametype; Gametype = gametype;
this.IP = ip.Value is "localhost" or "0.0.0.0" ? ServerConfig.IPAddress : ip.Value ?? ServerConfig.IPAddress; IP = ip.Value is "localhost" or "0.0.0.0" ? ServerConfig.IPAddress : ip.Value ?? ServerConfig.IPAddress;
this.GamePassword = gamePassword.Value; GamePassword = gamePassword.Value;
PrivateClientSlots = privateClients.Value;
UpdateMap(mapname); UpdateMap(mapname);
if (RconParser.CanGenerateLogPath && string.IsNullOrEmpty(ServerConfig.ManualLogPath)) if (RconParser.CanGenerateLogPath && string.IsNullOrEmpty(ServerConfig.ManualLogPath))

View File

@ -14,6 +14,7 @@ namespace SharedLibraryCore.Dtos
public string GameType { get; set; } public string GameType { get; set; }
public int ClientCount { get; set; } public int ClientCount { get; set; }
public int MaxClients { get; set; } public int MaxClients { get; set; }
public int PrivateClientSlots { get; set; }
public List<ChatInfo> ChatHistory { get; set; } public List<ChatInfo> ChatHistory { get; set; }
public List<PlayerInfo> Players { get; set; } public List<PlayerInfo> Players { get; set; }
public List<Report> Reports { get; set; } public List<Report> Reports { get; set; }

View File

@ -73,6 +73,11 @@ namespace SharedLibraryCore.Interfaces
/// </summary> /// </summary>
string GamePassword { get; } string GamePassword { get; }
/// <summary>
/// Number of private client slots
/// </summary>
int PrivateClientSlots { get; }
/// <summary> /// <summary>
/// Current map the game server is running /// Current map the game server is running
/// </summary> /// </summary>

View File

@ -123,6 +123,7 @@ namespace SharedLibraryCore
?.FirstOrDefault(gt => gt.Name == Gametype)?.Alias ?? Gametype; ?.FirstOrDefault(gt => gt.Name == Gametype)?.Alias ?? Gametype;
public string GamePassword { get; protected set; } public string GamePassword { get; protected set; }
public int PrivateClientSlots { get; protected set; }
public Map CurrentMap { get; set; } public Map CurrentMap { get; set; }
public Map Map => CurrentMap; public Map Map => CurrentMap;

View File

@ -38,6 +38,7 @@ namespace WebfrontCore.Controllers
Game = (Reference.Game)matchingServer.GameName, Game = (Reference.Game)matchingServer.GameName,
ClientCount = matchingServer.ClientNum, ClientCount = matchingServer.ClientNum,
MaxClients = matchingServer.MaxClients, MaxClients = matchingServer.MaxClients,
PrivateClientSlots = matchingServer.PrivateClientSlots,
GameType = matchingServer.GametypeName, GameType = matchingServer.GametypeName,
Players = matchingServer.GetClientsAsList() Players = matchingServer.GetClientsAsList()
.Select(client => new PlayerInfo .Select(client => new PlayerInfo

View File

@ -74,6 +74,7 @@ namespace WebfrontCore.ViewComponents
Game = (Reference.Game)server.GameName, Game = (Reference.Game)server.GameName,
ClientCount = server.ClientNum, ClientCount = server.ClientNum,
MaxClients = server.MaxClients, MaxClients = server.MaxClients,
PrivateClientSlots = server.PrivateClientSlots,
GameType = server.GametypeName, GameType = server.GametypeName,
ClientHistory = new ClientHistoryInfo ClientHistory = new ClientHistoryInfo
{ {

View File

@ -65,7 +65,7 @@
</div> </div>
} }
<div class="mr-5 ml-5 align-self-center"> <div class="mr-5 ml-5 align-self-center">
<span class="server-clientcount">@Model.ClientCount</span>/<span class="server-maxclients">@Model.MaxClients</span> <span class="server-clientcount">@Model.ClientCount</span>/<span class="server-maxclients">@(Model.MaxClients - Model.PrivateClientSlots)@(Model.PrivateClientSlots > 0 ? $" ({Model.MaxClients})": "")</span>
</div> </div>
</div> </div>
</div> </div>