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 ip = await this.GetMappedDvarValueOrDefaultAsync<string>("net_ip", 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)
{
@ -1383,12 +1385,14 @@ namespace IW4MAdmin
}
WorkingDirectory = basepath.Value;
this.Hostname = hostname;
this.MaxClients = maxplayers;
this.FSGame = game.Value;
this.Gametype = gametype;
this.IP = ip.Value is "localhost" or "0.0.0.0" ? ServerConfig.IPAddress : ip.Value ?? ServerConfig.IPAddress;
this.GamePassword = gamePassword.Value;
Hostname = hostname;
MaxClients = maxplayers;
FSGame = game.Value;
Gametype = gametype;
IP = ip.Value is "localhost" or "0.0.0.0" ? ServerConfig.IPAddress : ip.Value ?? ServerConfig.IPAddress;
GamePassword = gamePassword.Value;
PrivateClientSlots = privateClients.Value;
UpdateMap(mapname);
if (RconParser.CanGenerateLogPath && string.IsNullOrEmpty(ServerConfig.ManualLogPath))

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -65,7 +65,7 @@
</div>
}
<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>