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

add server scoreboard functionality

This commit is contained in:
RaidMax
2022-01-22 12:49:12 -06:00
parent a6292adf4b
commit 6458aee2ee
34 changed files with 278 additions and 100 deletions

View File

@ -18,7 +18,7 @@
@if (!string.IsNullOrWhiteSpace(Model.CommunityInformation.Name))
{
<h2 class="mb-4 p-0 col-12 text-center text-md-left">
<color-code value="@Model.CommunityInformation.Name" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@Model.CommunityInformation.Name"></color-code>
</h2>
}
@ -26,7 +26,7 @@
{
<div class="p-4 bg-dark border border-primary mb-4 text-white-50 col-12">
<h4 class="text-primary">@ViewBag.Localization["WEBFRONT_ABOUT_TITLE"]</h4>
<color-code value="@Model.CommunityInformation.Description" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@Model.CommunityInformation.Description"></color-code>
<div class="mt-3">
@foreach (var social in Model.CommunityInformation.SocialAccounts ?? new SocialAccountConfiguration[0])
{
@ -66,16 +66,16 @@
var start = 1;
<div class="col-12 bg-dark p-4 border border-primary mb-4 col-12">
<div class="text-primary h4">
<color-code value="@serverName" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@serverName"></color-code>
</div>
@foreach (var rule in rules)
{
<div class="text-white-50">
<span class="text-white">@start.</span>
<color-code value="@rule" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@rule"></color-code>
</div>
start++;
}
</div>
}
</div>
</div>

View File

@ -17,7 +17,7 @@
<th scope="row" class="bg-primary">@loc["WEBFRONT_PENALTY_TEMPLATE_ADMIN"]</th>
<td>
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@info.OriginId" class="link-inverse">
<color-code value="@info.OriginName" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@info.OriginName"></color-code>
</a>
</td>
</tr>
@ -27,7 +27,7 @@
@if (info.TargetId != null)
{
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@info.TargetId" class="link-inverse">
<color-code value="@info.TargetName" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@info.TargetName"></color-code>
</a>
}
else
@ -68,14 +68,14 @@
</td>
<td>
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@info.OriginId" class="link-inverse">
<color-code value="@info.OriginName" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@info.OriginName"></color-code>
</a>
</td>
<td>
@if (info.TargetId != null)
{
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@info.TargetId" class="link-inverse">
<color-code value="@info.TargetName" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@info.TargetName"></color-code>
</a>
}
else
@ -96,4 +96,4 @@
@info.When.ToString()
</td>
</tr>
}
}

View File

@ -17,7 +17,7 @@
<div class="row pt-2 pb-2 bg-dark">
<div class="col-5">
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@client.ClientId">
<color-code value="@client.Name" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@client.Name"></color-code>
</a>
</div>
@if (!ViewBag.Authorized && ViewBag.EnablePrivilegedUserPrivacy)
@ -45,7 +45,7 @@
<div class="col-7 bg-dark border-bottom">
<div class="p-2">
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@client.ClientId" class="link-inverse">
<color-code value="@client.Name" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@client.Name"></color-code>
</a>
</div>
@if (!ViewBag.Authorized && ViewBag.EnablePrivilegedUserPrivacy)
@ -59,4 +59,4 @@
<div class="p-2 text-white-50">@client.LastConnectionText</div>
</div>
}
</div>
</div>

View File

@ -7,21 +7,21 @@
<tr class="d-none d-lg-table-row">
<td>
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@message.ClientId" class="link-inverse">
<color-code value="@message.ClientName" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@message.ClientName"></color-code>
</a>
</td>
<td class="text-light w-50 text-break">
@if (message.IsHidden && !ViewBag.Authorized)
{
<color-code value="@SharedLibraryCore.Utilities.FormatExt(ViewBag.Localization["WEBFRONT_CLIENT_META_CHAT_HIDDEN"], message.HiddenMessage)" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@SharedLibraryCore.Utilities.FormatExt(ViewBag.Localization["WEBFRONT_CLIENT_META_CHAT_HIDDEN"], message.HiddenMessage)"></color-code>
}
else
{
<color-code value="@message.Message" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@message.Message"></color-code>
}
</td>
<td class="text-light">
<color-code value="@(message.ServerName ?? "--")" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@(message.ServerName ?? "--")"></color-code>
</td>
<td class="text-right text-light">
@message.When
@ -33,7 +33,7 @@
<th scope="row" class="bg-primary">@ViewBag.Localization["WEBFRONT_PENALTY_TEMPLATE_ADMIN"]</th>
<td class="text-light">
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@message.ClientId" class="link-inverse">
<color-code value="@message.ClientName" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@message.ClientName"></color-code>
</a>
</td>
</tr>
@ -43,11 +43,11 @@
<td class="text-light">
@if (message.IsHidden && !ViewBag.Authorized)
{
<color-code value="@SharedLibraryCore.Utilities.FormatExt(ViewBag.Localization["WEBFRONT_CLIENT_META_CHAT_HIDDEN"], message.HiddenMessage)" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@SharedLibraryCore.Utilities.FormatExt(ViewBag.Localization["WEBFRONT_CLIENT_META_CHAT_HIDDEN"], message.HiddenMessage)"></color-code>
}
else
{
<color-code value="@message.Message" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@message.Message"></color-code>
}
</td>
</tr>
@ -55,7 +55,7 @@
<tr class="d-table-row d-lg-none bg-dark">
<th scope="row" class="bg-primary">@ViewBag.Localization["WEBFRONT_STATS_MESSAGE_SERVER_NAME"]</th>
<td class="text-light">
<color-code value="@(message.ServerName ?? "--")" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@(message.ServerName ?? "--")"></color-code>
</td>
</tr>
@ -65,4 +65,4 @@
@message.When
</td>
</tr>
}
}

View File

@ -14,11 +14,11 @@
@foreach (var client in Model[key])
{
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@client.ClientId">
<color-code value="@client.Name" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@client.Name"></color-code>
</a>
<br />
}
</div>
}
}
</div>
</div>

View File

@ -25,7 +25,7 @@
<div class="w-50 d-block d-lg-inline-flex flex-column flex-fill text-center text-lg-left pb-3 pb-lg-0 pt-3 pt-lg-0 pl-3 pr-3 ml-auto mr-auto" style="overflow-wrap: anywhere">
<div class="mt-n2 d-block d-lg-inline-flex @(ViewBag.Authorized ? "" : "flex-fill")">
<div id="profile_name" class="client-name h1 mb-0">
<color-code value="@Model.Name" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@Model.Name"></color-code>
</div>
@if (ViewBag.Authorized)
{
@ -50,7 +50,7 @@
@foreach (var alias in Model.Aliases)
{
<div>
<color-code value="@alias" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@alias"></color-code>
</div>
}
@ -196,4 +196,4 @@
<script type="text/javascript" src="~/js/profile.js"></script>
</environment>
<script>initLoader('/Client/Meta/@Model.ClientId', '#profile_events', 30, 30, [{ 'name': 'metaFilterType', 'value': '@Model.MetaFilterType' }]);</script>
}
}

View File

@ -18,7 +18,7 @@
{
<span class="text-highlight">
<a class="link-inverse" href="@Model.OffenderClientId">
<color-code value="@Model.OffenderName" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@Model.OffenderName"></color-code>
</a>
</span>
}
@ -33,7 +33,7 @@
}
else
{
<color-code value="@Model.Offense" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@Model.Offense"></color-code>
}
</span>

View File

@ -15,7 +15,7 @@
break;
case "server":
<span class="text-white">
<color-code value="@Model.ServerName" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@Model.ServerName"></color-code>
</span>
break;
}
@ -25,4 +25,4 @@
{
<span class="text-muted">@token.MatchValue</span>
}
}
}

View File

@ -22,7 +22,7 @@
{
if (result.IsInterpolation)
{
<span class="profile-meta-value text-primary"><color-code value="@meta.Value" allow="@ViewBag.EnableColorCodes"></color-code></span>
<span class="profile-meta-value text-primary"><color-code value="@meta.Value"></color-code></span>
}
else
@ -34,10 +34,10 @@
else
{
<span class="profile-meta-value text-primary"><color-code value="@meta.Value" allow="@ViewBag.EnableColorCodes"></color-code></span>
<span class="profile-meta-value text-primary"><color-code value="@meta.Value"></color-code></span>
<span class="profile-meta-title text-muted"> @meta.Key</span>
}
</div>
}
</div>
}
}

View File

@ -11,12 +11,12 @@
@if (Model.IsHidden && !ViewBag.Authorized)
{
<color-code value="@SharedLibraryCore.Utilities.FormatExt(ViewBag.Localization["WEBFRONT_CLIENT_META_CHAT_HIDDEN"], Model.HiddenMessage)" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@SharedLibraryCore.Utilities.FormatExt(ViewBag.Localization["WEBFRONT_CLIENT_META_CHAT_HIDDEN"], Model.HiddenMessage)"></color-code>
}
else
{
<color-code value="@Model.Message" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@Model.Message"></color-code>
}
</span>
</span>
</span>

View File

@ -19,7 +19,7 @@
{
<span class="text-highlight">
<a class="link-inverse" href="@Model.PunisherClientId">
<color-code value="@Model.PunisherName" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@Model.PunisherName"></color-code>
</a>
</span>
}
@ -34,7 +34,7 @@
}
else
{
<color-code value="@Model.Offense" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@Model.Offense"></color-code>
}
</span>
@ -65,7 +65,7 @@
else
{
<a class="link-inverse" href="@Model.OffenderClientId">
<color-code value="@Model.OffenderName" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@Model.OffenderName"></color-code>
</a>
}
}

View File

@ -13,7 +13,7 @@
break;
case "alias":
<span class="text-white">
<color-code value="@Model.Name" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@Model.Name"></color-code>
[@Model.IPAddress]
</span>
break;

View File

@ -7,7 +7,7 @@
{
<li class="nav-item ">
<a class="nav-link top-players-link" href="#server_@server.ID" role="tab" data-toggle="tab" aria-selected="false" data-serverid="@server.ID">
<color-code value="@server.Name" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@server.Name"></color-code>
</a>
</li>
}

View File

@ -9,7 +9,7 @@
<th scope="row" class="bg-primary">@loc["WEBFRONT_PENALTY_TEMPLATE_NAME"]</th>
<td>
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@Model.OffenderId" class="link-inverse">
<color-code value="@Model.OffenderName" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@Model.OffenderName"></color-code>
</a>
</td>
</tr>
@ -24,7 +24,7 @@
<tr class="d-table-row d-lg-none bg-dark">
<th scope="row" class="bg-primary">@loc["WEBFRONT_PENALTY_TEMPLATE_OFFENSE"]</th>
<td class="text-light">
<color-code value="@($"{Model.Offense}{(ViewBag.Authorized ? Model.AdditionalPenaltyInformation : "")}")" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@($"{Model.Offense}{(ViewBag.Authorized ? Model.AdditionalPenaltyInformation : "")}")"></color-code>
</td>
</tr>
@ -59,14 +59,14 @@
<tr class="d-none d-lg-table-row">
<td>
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@Model.OffenderId" class="link-inverse">
<color-code value="@Model.OffenderName" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@Model.OffenderName"></color-code>
</a>
</td>
<td class="penalties-color-@Model.PenaltyTypeText.ToLower()">
@Model.PenaltyType
</td>
<td class="text-light w-50">
<color-code value="@($"{Model.Offense}{(ViewBag.Authorized ? Model.AdditionalPenaltyInformation : "")}")" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@($"{Model.Offense}{(ViewBag.Authorized ? Model.AdditionalPenaltyInformation : "")}")"></color-code>
</td>
<td>
@Html.ActionLink(SharedLibraryCore.Utilities.StripColors(Model.PunisherName), "ProfileAsync",
@ -88,4 +88,4 @@
}
}
</td>
</tr>
</tr>

View File

@ -0,0 +1,30 @@
@model IEnumerable<WebfrontCore.ViewModels.ScoreboardInfo>
<ul class="nav nav-tabs border-top border-bottom nav-fill row" role="tablist" id="scoreboard_servers">
@{ var i = 0; }
@foreach (var server in Model)
{
<li class="nav-item">
<a class="nav-link" href="#server_@server.ServerId" role="tab" data-toggle="tab" id="server_@(server.ServerId)_nav" data-serverid="@server.ServerId">
<color-code value="@server.ServerName"></color-code>
</a>
</li>
i++;
}
</ul>
<div class="tab-content border-bottom row">
@{ i = 0; }
@foreach (var server in Model)
{
<div role="tabpanel" class="scoreboard-container tab-pane striped flex-fill" id="server_@server.ServerId" data-server-id="@server.ServerId">
@await Html.PartialAsync("_Scoreboard", server)
</div>
i++;
}
</div>
@section scripts {
<environment include="Development">
<script type="text/javascript" src="~/js/scoreboard.js" defer="defer"></script>
</environment>
}

View File

@ -21,24 +21,24 @@
{
<span class="text-light">
<span class="oi oi-account-login mr-2 text-success"> </span>
<color-code value="@Model.ChatHistory[i].Name" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@Model.ChatHistory[i].Name"></color-code>
</span><br />
}
if (Model.ChatHistory[i].Message == "DISCONNECTED")
{
<span class="text-light">
<span class="oi oi-account-logout mr-2 text-danger"> </span>
<color-code value="@Model.ChatHistory[i].Name" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@Model.ChatHistory[i].Name"></color-code>
</span><br />
}
if (Model.ChatHistory[i].Message != "CONNECTED" && Model.ChatHistory[i].Message != "DISCONNECTED")
{
<span class="text-light">
<color-code value="@Model.ChatHistory[i].Name" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@Model.ChatHistory[i].Name"></color-code>
</span>
<span>
&mdash;
<color-code value="@message.CapClientName(48)" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@message.CapClientName(48)"></color-code>
</span><br />
}
}
@ -63,7 +63,7 @@
}
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@Model.Players[i].ClientId" class="@levelColorClass">
<color-code value="@Model.Players[i].Name" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@Model.Players[i].Name"></color-code>
</a>
@if (ViewBag.Authorized)
@ -88,7 +88,7 @@
<div>
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@Model.Players[i].ClientId" class="@levelColorClass">
<color-code value="@Model.Players[i].Name" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@Model.Players[i].Name"></color-code>
</a>
@if (ViewBag.Authorized)
{
@ -122,26 +122,26 @@
{
<span class="text-light">
<span class="oi oi-account-login mr-2 text-success"> </span>
<color-code value="@Model.ChatHistory[i].Name" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@Model.ChatHistory[i].Name"></color-code>
</span><br />
}
if (Model.ChatHistory[i].Message == "DISCONNECTED")
{
<span class="text-light">
<span class="oi oi-account-logout mr-2 text-danger"> </span>
<color-code value="@Model.ChatHistory[i].Name" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@Model.ChatHistory[i].Name"></color-code>
</span><br />
}
if (Model.ChatHistory[i].Message != "CONNECTED" && Model.ChatHistory[i].Message != "DISCONNECTED")
{
<span class="text-light">
<color-code value="@Model.ChatHistory[i].Name" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@Model.ChatHistory[i].Name"></color-code>
</span>
<span>
&mdash;
<color-code value="@message.CapClientName(48)" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@message.CapClientName(48)"></color-code>
</span><br />
}
}
}
</div>
</div>

View File

@ -0,0 +1,32 @@
@model WebfrontCore.ViewModels.ScoreboardInfo
@{
Layout = null;
}
<table class="table table-striped thead-light bg-dark mb-0 table-responsive-md">
<tr class="bg-dark border-bottom">
<th>@ViewBag.Localization["WEBFRONT_SCOREBOARD_TABLE_PLAYER"]</th>
<th>@ViewBag.Localization["WEBFRONT_ADV_STATS_SCORE"]</th>
<th>@ViewBag.Localization["WEBFRONT_ADV_STATS_KILLS"]</th>
<th>@ViewBag.Localization["WEBFRONT_SCOREBOARD_TABLE_DEATHS"]</th>
<th>@ViewBag.Localization["WEBFRONT_SCOREBOARD_TABLE_RATIO"]</th>
<th>@ViewBag.Localization["WEBFRONT_SCOREBOARD_TABLE_SPM"]</th>
<th class="text-right">@ViewBag.Localization["WEBFRONT_SCOREBOARD_TABLE_PING"]</th>
</tr>
@foreach (var client in Model.ClientInfo.OrderByDescending(c => c.Score))
{
<tr>
<td>
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@client.ClientId">
<color-code value="@client.ClientName"></color-code>
</a>
</td>
<td>@client.Score</td>
<td>@(client.Kills ?? 0)</td>
<td>@(client.Deaths ?? 0)</td>
<td>@Math.Round(client.Kdr ?? 0, 2)</td>
<td>@Math.Round(client.ScorePerMinute ?? 0)</td>
<td class="text-right">@client.Ping</td>
</tr>
}
</table>

View File

@ -5,15 +5,19 @@
<div class="row server-header pt-1 pb-1 bg-primary " id="server_header_@Model.ID">
<div class="col-md-4 text-center text-md-left d-inline-flex justify-content-center justify-content-md-start">
<color-code value="@Model.Name" allow="@ViewBag.EnableColorCodes"></color-code>
<a href="@Model.ConnectProtocolUrl" class="ml-2 mr-2 align-self-center d-none d-md-flex server-join-button" title="@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_HOME_JOIN_DESC"]">
<color-code value="@Model.Name"></color-code>
<a href="@Model.ConnectProtocolUrl" class="ml-2 mr-2 align-self-center d-none d-md-flex server-join-button" title="@Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_HOME_JOIN_DESC"]">
<span class="oi oi-play-circle mr-1 align-self-center"></span>
<span class="server-header-ip-address" style="display:none;">@Model.IPAddress</span>
</a>
@if (ViewBag.Authorized)
{
<span class="oi oi-chat align-self-center profile-action d-none d-md-flex" data-action="chat" data-action-id="@Model.ID"></span>
<span class="oi oi-chat align-self-center profile-action d-none d-md-flex mr-2" data-action="chat" data-action-id="@Model.ID"></span>
}
<a asp-controller="Server" asp-action="Scoreboard" asp-fragment="server_@Model.ID" title="@ViewBag.Localization["WEBFRONT_TITLE_SCOREBOARD"]"
class="align-self-center d-none d-md-flex">
<span class="oi oi-spreadsheet ml-1"></span>
</a>
</div>
<div class="text-center col-md-4 align-self-center">
@ -39,10 +43,14 @@
@if (ViewBag.Authorized)
{
<div class=" p-1 d-flex d-md-none justify-content-center col-12">
<div class="p-1 d-flex d-md-none justify-content-center col-12">
<span class="oi oi-chat align-self-center profile-action d-flex d-md-none" data-action="chat" data-action-id="@Model.ID"></span>
</div>
}
<a asp-controller="Server" asp-action="Scoreboard" title="@ViewBag.Localization["WEBFRONT_TITLE_SCOREBOARD"]"
class="p-1 d-flex d-md-none justify-content-center col-12">
<span class="oi oi-spreadsheet ml-1"></span>
</a>
</div>
<div id="server_clientactivity_@Model.ID" class="bg-dark row server-activity @(Model.ClientCount > 0 ? "pt-2 pb-2" : "")">

View File

@ -40,7 +40,7 @@
<div class="p-2 mb-3 border-bottom" style="background-color: #222;">
<div class="d-flex flex-row">
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@client.ClientId" class="h4 mr-auto">
<color-code value="@client.Name" allow="@ViewBag.EnableColorCodes"></color-code>
<color-code value="@client.Name"></color-code>
</a>
<div class="client-location-flag align-self-center" data-ip="@client.IPAddress"></div>
</div>
@ -49,4 +49,4 @@
<div class="align-self-center">@client.LastConnectionText</div>
</div>
</div>
}
}