add web project for stats to fix bug with pre compiled razor templates

This commit is contained in:
RaidMax
2019-02-16 17:18:50 -06:00
parent 40f1697c97
commit e3944fb8c2
130 changed files with 99 additions and 49 deletions

View File

@ -0,0 +1,14 @@
@model List<IW4MAdmin.Plugins.Stats.Web.Dtos.TopStatsInfo>
<h4 class="pb-2 text-center ">@ViewBag.Title</h4>
<div id="stats_top_players" class="striped border-top border-bottom">
@await Html.PartialAsync("_List", Model)
</div>
@section scripts {
<environment include="Development">
<script type="text/javascript" src="~/js/loader.js"></script>
<script type="text/javascript" src="~/js/stats.js"></script>
</environment>
<script>initLoader('/Stats/GetTopPlayersAsync', '#stats_top_players', 50);</script>
}

View File

@ -0,0 +1,68 @@
@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";
}
}
@foreach (var stat in Model)
{
<div class="row ml-0 mr-0 pt-2 pb-2">
<div class="col-md-4 text-md-left text-center">
<div class="h2 d-flex flex-row justify-content-center justify-content-md-start align-items-center">
<div class="text-muted pr-1">#@stat.Ranking</div>
@if (stat.RatingChange > 0)
{
<div class="d-flex flex-column text-center">
<div class="oi oi-caret-top text-success client-rating-change-up"></div>
<div class="client-rating-change-amount text-success">@stat.RatingChange</div>
</div>
}
@if (stat.RatingChange < 0)
{
<div class="d-flex flex-column text-center">
<div class="client-rating-change-amount client-rating-change-amount-down text-danger">@Math.Abs(stat.RatingChange)</div>
<div class="oi oi-caret-bottom text-danger client-rating-change-down"></div>
</div>
}
<span class="text-muted pl-1 pr-1" style="font-size: 1.25rem;">&mdash;</span>
@Html.ActionLink(stat.Name, "ProfileAsync", "Client", new { id = stat.ClientId })
</div>
<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_TIME_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>
<div class="col-md-6 client-rating-graph" id="rating_history_@stat.ClientId" data-history="@Html.Raw(Json.Serialize(stat.PerformanceHistory))">
</div>
<div class="col-md-2 client-rating-icon text-md-right text-center align-items-center d-flex justify-content-center">
<img src="/images/icons/@rankIcon(stat.Performance)" />
</div>
</div>
}

View File

@ -0,0 +1,12 @@
@model IEnumerable<SharedLibraryCore.Dtos.ChatInfo>
@{
Layout = null;
}
<div class="client-message-context bg-dark p-2 mt-2 mb-2 border-top border-bottom">
<h5>@Model.First().Time.ToString()</h5>
@foreach (var message in Model)
{
<span class="text-white">@Html.ActionLink(@message.Name, "ProfileAsync", "Client", new { id = message.ClientId})</span><span> &mdash; @message.Message</span><br />
}
</div>

View File

@ -0,0 +1,29 @@
@model IEnumerable<IW4MAdmin.Plugins.Stats.Models.EFACSnapshot>
@{
Layout = null;
}
<div class="penalty-info-context bg-dark p-2 mt-2 mb-2 border-top border-bottom">
@foreach (var snapshot in Model)
{
<!-- this is not ideal, but I didn't want to manually write out all the properties-->
var snapProperties = Model.First().GetType().GetProperties();
foreach (var prop in snapProperties)
{
<!-- this is another ugly hack-->
@if (prop.GetValue(snapshot) is System.Collections.Generic.HashSet<SharedLibraryCore.Helpers.Vector3>)
{
<span class="text-white">@prop.Name </span>
foreach (var v in (System.Collections.Generic.HashSet<SharedLibraryCore.Helpers.Vector3>)prop.GetValue(snapshot))
{
<span>@v.ToString(),</span><br />
}
}
else
{
<span class="text-white">@prop.Name </span> <span>&mdash; @prop.GetValue(snapshot)</span><br />
}
}
<div class="w-100 mt-1 mb-1 border-bottom"></div>
}
</div>