mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-21 20:50:40 -05:00
added top player stats
fix for some commands returning multiple matches found when target not required
This commit is contained in:
13
Plugins/Stats/Web/Views/Stats/Index.cshtml
Normal file
13
Plugins/Stats/Web/Views/Stats/Index.cshtml
Normal file
@ -0,0 +1,13 @@
|
||||
@model List<IW4MAdmin.Plugins.Stats.Web.Dtos.TopStatsInfo>
|
||||
<h4 class="pb-2 text-center ">@ViewBag.Title</h4>
|
||||
|
||||
<div id="stats_top_players" class="row border-top border-bottom">
|
||||
@await Html.PartialAsync("_List", Model)
|
||||
</div>
|
||||
|
||||
@section scripts {
|
||||
<environment include="Development">
|
||||
<script type="text/javascript" src="~/js/loader.js"></script>
|
||||
</environment>
|
||||
<script>initLoader('/Stats/GetTopPlayersAsync', '#stats_top_players');</script>
|
||||
}
|
50
Plugins/Stats/Web/Views/Stats/_List.cshtml
Normal file
50
Plugins/Stats/Web/Views/Stats/_List.cshtml
Normal file
@ -0,0 +1,50 @@
|
||||
@model List<IW4MAdmin.Plugins.Stats.Web.Dtos.TopStatsInfo>
|
||||
@{
|
||||
Layout = null;
|
||||
var loc = SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex.Set;
|
||||
double getDeviation(double deviations) => Math.Pow(Math.E, 5.0813 + (deviations * 0.8694));
|
||||
string rankIcon(double elo)
|
||||
{
|
||||
if (elo >= getDeviation(-1) && elo < getDeviation(-0.25))
|
||||
return "0_no-place/menu_div_no_place.png";
|
||||
if (elo >= getDeviation(-0.25) && elo < getDeviation(0.25))
|
||||
return "1_iron/menu_div_iron_sub03.png";
|
||||
if (elo >= getDeviation(0.25) && elo < getDeviation(0.6875))
|
||||
return "2_bronze/menu_div_bronze_sub03.png";
|
||||
if (elo >= getDeviation(0.6875) && elo < getDeviation(1))
|
||||
return "3_silver/menu_div_silver_sub03.png";
|
||||
if (elo >= getDeviation(1) && elo < getDeviation(1.25))
|
||||
return "4_gold/menu_div_gold_sub03.png";
|
||||
if (elo >= getDeviation(1.25) && elo < getDeviation(1.5))
|
||||
return "5_platinum/menu_div_platinum_sub03.png";
|
||||
if (elo >= getDeviation(1.5) && elo < getDeviation(1.75))
|
||||
return "6_semipro/menu_div_semipro_sub03.png";
|
||||
if (elo >= getDeviation(1.75))
|
||||
return "7_pro/menu_div_pro_sub03.png";
|
||||
|
||||
return "0_no-place/menu_div_no_place.png";
|
||||
}
|
||||
}
|
||||
<table class="table table-striped mb-0" style="background-color:rgba(0, 0, 0, 0.1)">
|
||||
@foreach (var stat in Model)
|
||||
{
|
||||
<tr>
|
||||
<td style="vertical-align: middle">
|
||||
<div class="">
|
||||
<h2 class="text-muted">#@stat.Ranking — @Html.ActionLink(stat.Name, "ProfileAsync", "Client", new { id = stat.ClientId })</h2>
|
||||
<span class="text-primary">@stat.Performance</span><span class="text-muted"> @loc["PLUGINS_STATS_COMMANDS_PERFORMANCE"]</span><br />
|
||||
<span class="text-primary">@stat.KDR</span><span class="text-muted"> @loc["PLUGINS_STATS_TEXT_KDR"]</span>
|
||||
<span class="text-primary">@stat.Kills</span><span class="text-muted"> @loc["PLUGINS_STATS_TEXT_KILLS"]</span>
|
||||
<span class="text-primary">@stat.Deaths</span><span class="text-muted"> @loc["PLUGINS_STATS_TEXT_DEATHS"]</span><br />
|
||||
<span class="text-muted">@loc["WEBFRONT_PROFILE_PLAYER"]</span> <span class="text-primary"> @stat.TimePlayed </span><span class="text-muted">@loc["GLOBAL_HOURS"]</span><br />
|
||||
<span class="text-muted">@loc["WEBFRONT_PROFILE_LSEEN"]</span><span class="text-primary"> @stat.LastSeen </span><span class="text-muted">@loc["WEBFRONT_PENALTY_TEMPLATE_AGO"]</span>
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-right ml-0 pl-0" style="vertical-align: middle">
|
||||
<div>
|
||||
<img src="/images/icons/@rankIcon(stat.Performance)" />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
Reference in New Issue
Block a user