changes for latest release

This commit is contained in:
RaidMax 2019-03-30 17:21:01 -05:00
parent 8521df85f5
commit 37d3f4f90d
7 changed files with 142 additions and 69 deletions

View File

@ -409,7 +409,7 @@ namespace IW4MAdmin.Application
Key = Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CLIENT_META_LAST_MAP"], Key = Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CLIENT_META_LAST_MAP"],
Value = lastMapMeta.Value, Value = lastMapMeta.Value,
Show = true, Show = true,
Type = ProfileMeta.MetaType.Information Type = ProfileMeta.MetaType.Information,
}); });
} }
@ -433,8 +433,10 @@ namespace IW4MAdmin.Application
{ {
Id = client.ClientId, Id = client.ClientId,
Key = $"{Utilities.CurrentLocalization.LocalizationIndex["GLOBAL_TIME_HOURS"]} {Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_PROFILE_PLAYER"]}", Key = $"{Utilities.CurrentLocalization.LocalizationIndex["GLOBAL_TIME_HOURS"]} {Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_PROFILE_PLAYER"]}",
Value = Math.Round(client.TotalConnectionTime / 3600.0, 1).ToString("#,##0"), Value = Math.Round(client.TotalConnectionTime / 3600.0, 1).ToString("#,##0", new System.Globalization.CultureInfo(Utilities.CurrentLocalization.LocalizationName)),
Show = true, Show = true,
Column = 1,
Order = 0,
Type = ProfileMeta.MetaType.Information Type = ProfileMeta.MetaType.Information
}); });
@ -444,6 +446,8 @@ namespace IW4MAdmin.Application
Key = Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_PROFILE_FSEEN"], Key = Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_PROFILE_FSEEN"],
Value = Utilities.GetTimePassed(client.FirstConnection, false), Value = Utilities.GetTimePassed(client.FirstConnection, false),
Show = true, Show = true,
Column = 1,
Order = 1,
Type = ProfileMeta.MetaType.Information Type = ProfileMeta.MetaType.Information
}); });
@ -453,16 +457,19 @@ namespace IW4MAdmin.Application
Key = Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_PROFILE_LSEEN"], Key = Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_PROFILE_LSEEN"],
Value = Utilities.GetTimePassed(client.LastConnection, false), Value = Utilities.GetTimePassed(client.LastConnection, false),
Show = true, Show = true,
Column = 1,
Order = 2,
Type = ProfileMeta.MetaType.Information Type = ProfileMeta.MetaType.Information
}); });
metaList.Add(new ProfileMeta() metaList.Add(new ProfileMeta()
{ {
Id = client.ClientId, Id = client.ClientId,
Key = Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CLIENT_META_CONNECTIONS"], Key = Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CLIENT_META_CONNECTIONS"],
Value = client.Connections, Value = client.Connections.ToString("#,##0", new System.Globalization.CultureInfo(Utilities.CurrentLocalization.LocalizationName)),
Show = true, Show = true,
Column = 1,
Order = 3,
Type = ProfileMeta.MetaType.Information Type = ProfileMeta.MetaType.Information
}); });
@ -471,6 +478,8 @@ namespace IW4MAdmin.Application
Key = Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CLIENT_META_MASKED"], Key = Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CLIENT_META_MASKED"],
Value = client.Masked ? Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CLIENT_META_TRUE"] : Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CLIENT_META_FALSE"], Value = client.Masked ? Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CLIENT_META_TRUE"] : Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CLIENT_META_FALSE"],
Sensitive = true, Sensitive = true,
Column = 1,
Order = 4,
Type = ProfileMeta.MetaType.Information Type = ProfileMeta.MetaType.Information
}); });

View File

@ -150,37 +150,49 @@ namespace IW4MAdmin.Plugins.Stats
new ProfileMeta() new ProfileMeta()
{ {
Key = Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CLIENT_META_RANKING"], Key = Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CLIENT_META_RANKING"],
Value = "#" + await StatManager.GetClientOverallRanking(clientId), Value = "#" + (await StatManager.GetClientOverallRanking(clientId)).ToString("#,##0", new System.Globalization.CultureInfo(Utilities.CurrentLocalization.LocalizationName)),
Column = 0,
Order = 0,
Type = ProfileMeta.MetaType.Information Type = ProfileMeta.MetaType.Information
}, },
new ProfileMeta() new ProfileMeta()
{ {
Key = Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_STATS_TEXT_KILLS"], Key = Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_STATS_TEXT_KILLS"],
Value = kills, Value = kills.ToString("#,##0", new System.Globalization.CultureInfo(Utilities.CurrentLocalization.LocalizationName)),
Column = 0,
Order = 1,
Type = ProfileMeta.MetaType.Information Type = ProfileMeta.MetaType.Information
}, },
new ProfileMeta() new ProfileMeta()
{ {
Key = Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_STATS_TEXT_DEATHS"], Key = Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_STATS_TEXT_DEATHS"],
Value = deaths, Value = deaths.ToString("#,##0", new System.Globalization.CultureInfo(Utilities.CurrentLocalization.LocalizationName)),
Column = 0,
Order = 2,
Type = ProfileMeta.MetaType.Information Type = ProfileMeta.MetaType.Information
}, },
new ProfileMeta() new ProfileMeta()
{ {
Key = Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_STATS_TEXT_KDR"], Key = Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_STATS_TEXT_KDR"],
Value = kdr, Value = kdr.ToString(new System.Globalization.CultureInfo(Utilities.CurrentLocalization.LocalizationName)),
Column = 0,
Order = 3,
Type = ProfileMeta.MetaType.Information Type = ProfileMeta.MetaType.Information
}, },
new ProfileMeta() new ProfileMeta()
{ {
Key = Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_STATS_COMMANDS_PERFORMANCE"], Key = Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_STATS_COMMANDS_PERFORMANCE"],
Value = performance, Value = performance.ToString("#,##0", new System.Globalization.CultureInfo(Utilities.CurrentLocalization.LocalizationName)),
Column = 0,
Order = 4,
Type = ProfileMeta.MetaType.Information Type = ProfileMeta.MetaType.Information
}, },
new ProfileMeta() new ProfileMeta()
{ {
Key = Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_STATS_META_SPM"], Key = Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_STATS_META_SPM"],
Value = spm, Value = spm.ToString(new System.Globalization.CultureInfo(Utilities.CurrentLocalization.LocalizationName)),
Column = 0,
Order = 5,
Type = ProfileMeta.MetaType.Information Type = ProfileMeta.MetaType.Information
} }
}; };
@ -236,45 +248,57 @@ namespace IW4MAdmin.Plugins.Stats
{ {
new ProfileMeta() new ProfileMeta()
{ {
Key = "Chest Ratio", Key = $"{Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CLIENT_META_AC_METRIC"]} 1",
Value = chestRatio, Value = chestRatio.ToString(new System.Globalization.CultureInfo(Utilities.CurrentLocalization.LocalizationName)),
Type = ProfileMeta.MetaType.Information, Type = ProfileMeta.MetaType.Information,
Column = 2,
Order = 0,
Sensitive = true Sensitive = true
}, },
new ProfileMeta() new ProfileMeta()
{ {
Key = "Abdomen Ratio", Key = $"{Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CLIENT_META_AC_METRIC"]} 2",
Value = abdomenRatio, Value = abdomenRatio.ToString(new System.Globalization.CultureInfo(Utilities.CurrentLocalization.LocalizationName)),
Type = ProfileMeta.MetaType.Information, Type = ProfileMeta.MetaType.Information,
Column = 2,
Order = 1,
Sensitive = true Sensitive = true
}, },
new ProfileMeta() new ProfileMeta()
{ {
Key = "Chest To Abdomen Ratio", Key = $"{Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CLIENT_META_AC_METRIC"]} 3",
Value = chestAbdomenRatio, Value = chestAbdomenRatio.ToString(new System.Globalization.CultureInfo(Utilities.CurrentLocalization.LocalizationName)),
Type = ProfileMeta.MetaType.Information, Type = ProfileMeta.MetaType.Information,
Column = 2,
Order = 2,
Sensitive = true Sensitive = true
}, },
new ProfileMeta() new ProfileMeta()
{ {
Key = "Headshot Ratio", Key = $"{Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CLIENT_META_AC_METRIC"]} 4",
Value = headRatio, Value = headRatio.ToString(new System.Globalization.CultureInfo(Utilities.CurrentLocalization.LocalizationName)),
Type = ProfileMeta.MetaType.Information, Type = ProfileMeta.MetaType.Information,
Column = 2,
Order = 3,
Sensitive = true Sensitive = true
}, },
new ProfileMeta() new ProfileMeta()
{ {
Key = "Hit Offset Average", Key = $"{Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CLIENT_META_AC_METRIC"]} 5",
// todo: make sure this is wrapped somewhere else // todo: make sure this is wrapped somewhere else
Value = $"{Math.Round(((float)hitOffsetAverage), 4).ToString(new System.Globalization.CultureInfo(Utilities.CurrentLocalization.LocalizationName))}°", Value = $"{Math.Round(((float)hitOffsetAverage), 4).ToString(new System.Globalization.CultureInfo(Utilities.CurrentLocalization.LocalizationName))}°",
Type = ProfileMeta.MetaType.Information, Type = ProfileMeta.MetaType.Information,
Column = 2,
Order = 4,
Sensitive = true Sensitive = true
}, },
new ProfileMeta() new ProfileMeta()
{ {
Key = "Max Strain", Key = $"{Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CLIENT_META_AC_METRIC"]} 6",
Value = Math.Round(maxStrain, 3), Value = Math.Round(maxStrain, 3).ToString(new System.Globalization.CultureInfo(Utilities.CurrentLocalization.LocalizationName)),
Type = ProfileMeta.MetaType.Information, Type = ProfileMeta.MetaType.Information,
Column = 2,
Order = 5,
Sensitive = true Sensitive = true
}, },
}; };
@ -291,8 +315,11 @@ namespace IW4MAdmin.Plugins.Stats
new ProfileMeta() new ProfileMeta()
{ {
Key = Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_PROFILE_MESSAGES"], Key = Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_PROFILE_MESSAGES"],
Value = await ctx.Set<EFClientMessage>() Value = (await ctx.Set<EFClientMessage>()
.CountAsync(_message => _message.ClientId == clientId), .CountAsync(_message => _message.ClientId == clientId))
.ToString("#,##0", new System.Globalization.CultureInfo(Utilities.CurrentLocalization.LocalizationName)),
Column = 1,
Order= 4,
Type = ProfileMeta.MetaType.Information Type = ProfileMeta.MetaType.Information
} }
}; };
@ -335,7 +362,7 @@ namespace IW4MAdmin.Plugins.Stats
using (var ctx = new DatabaseContext(disableTracking: true)) using (var ctx = new DatabaseContext(disableTracking: true))
{ {
long kills = await ctx.Set<EFServerStatistics>().Where(s => s.Active).SumAsync(s => s.TotalKills); long kills = await ctx.Set<EFServerStatistics>().Where(s => s.Active).SumAsync(s => s.TotalKills);
return kills.ToString("#,##0"); return kills.ToString("#,##0", new System.Globalization.CultureInfo(Utilities.CurrentLocalization.LocalizationName));
} }
} }
@ -344,7 +371,7 @@ namespace IW4MAdmin.Plugins.Stats
using (var ctx = new DatabaseContext(disableTracking: true)) using (var ctx = new DatabaseContext(disableTracking: true))
{ {
long playTime = await ctx.Set<EFServerStatistics>().Where(s => s.Active).SumAsync(s => s.TotalPlayTime); long playTime = await ctx.Set<EFServerStatistics>().Where(s => s.Active).SumAsync(s => s.TotalPlayTime);
return (playTime / 3600.0).ToString("#,##0"); return (playTime / 3600.0).ToString("#,##0", new System.Globalization.CultureInfo(Utilities.CurrentLocalization.LocalizationName));
} }
} }

View File

@ -95,6 +95,51 @@ namespace SharedLibraryCore.Services
if (count == 1) if (count == 1)
{ {
var table = new List<List<ProfileMeta>>();
var metaWithColumn = meta
.Where(_meta => _meta.Column != null);
var columnGrouping = metaWithColumn
.GroupBy(_meta => _meta.Column);
var metaToSort = meta.Except(metaWithColumn).ToList();
foreach (var metaItem in columnGrouping)
{
table.Add(new List<ProfileMeta>(metaItem));
}
while (metaToSort.Count > 0)
{
var sortingMeta = metaToSort.First();
int indexOfSmallestColumn()
{
int index = 0;
int smallestColumnSize = int.MaxValue;
for (int i = 0; i < table.Count; i++)
{
if (table[i].Count < smallestColumnSize)
{
smallestColumnSize = table[i].Count;
index = i;
}
}
return index;
}
int columnIndex = indexOfSmallestColumn();
sortingMeta.Column = columnIndex;
sortingMeta.Order = columnGrouping
.First(_group => _group.Key == columnIndex)
.Count();
table[columnIndex].Add(sortingMeta);
metaToSort.Remove(sortingMeta);
}
return meta; return meta;
} }

View File

@ -7,7 +7,9 @@
bool isTempBanned = Model.ActivePenaltyType == "TempBan"; bool isTempBanned = Model.ActivePenaltyType == "TempBan";
var informationMeta = Model.Meta var informationMeta = Model.Meta
.Where(_meta => _meta.Type == SharedLibraryCore.Dtos.ProfileMeta.MetaType.Information) .Where(_meta => _meta.Type == SharedLibraryCore.Dtos.ProfileMeta.MetaType.Information)
.ToList(); .OrderBy(_meta => _meta.Order)
.GroupBy(_meta => _meta.Column)
.OrderBy(_grouping => _grouping.Key);
} }
<div id="profile_wrapper" class="pb-3 row d-flex flex-column flex-lg-row"> <div id="profile_wrapper" class="pb-3 row d-flex flex-column flex-lg-row">
@ -79,37 +81,20 @@
</div> </div>
<div id="profile_info" class="row d-block d-lg-flex flex-row border-bottom border-top pt-2 pb-2"> <div id="profile_info" class="row d-block d-lg-flex flex-row border-bottom border-top pt-2 pb-2">
<div id="profile_meta_0" class="text-center text-lg-left mr-0 mr-lg-4"> @foreach (var metaColumn in informationMeta)
@for (int i = 0; i < informationMeta.Count; i += 3) {
<div class="text-center text-lg-left mr-0 mr-lg-4">
@foreach (var meta in metaColumn)
{ {
<div class="profile-meta-entry"> <div class="profile-meta-entry">
<span class="profile-meta-value text-primary">@informationMeta[i].Value</span> <span class="profile-meta-value text-primary">@meta.Value</span>
<span class="profile-meta-title text-muted"> @informationMeta[i].Key</span> <span class="profile-meta-title text-muted"> @meta.Key</span>
</div> </div>
} }
</div> </div>
<div class="text-center text-lg-left mr-0 mr-lg-4" id="profile_meta_1">
@for (int i = 1; i < informationMeta.Count; i += 3)
{
<div class="profile-meta-entry">
<span class="profile-meta-value text-primary">@informationMeta[i].Value</span>
<span class="profile-meta-title text-muted"> @informationMeta[i].Key</span>
</div>
} }
</div> </div>
<div class="text-center text-lg-left" id="profile_meta_2">
@for (int i = 2; i < informationMeta.Count; i += 3)
{
<div class="profile-meta-entry">
<span class="profile-meta-value text-primary">@informationMeta[i].Value</span>
<span class="profile-meta-title text-muted"> @informationMeta[i].Key</span>
</div>
}
</div>
</div>
<div class="row d-md-flex pt-2"> <div class="row d-md-flex pt-2">
<div id="profile_events" class="text-muted text-left ml-sm-0"> <div id="profile_events" class="text-muted text-left ml-sm-0">
@await Component.InvokeAsync("ProfileMetaList", new { clientId = Model.ClientId, count = 30, offset = 0 }) @await Component.InvokeAsync("ProfileMetaList", new { clientId = Model.ClientId, count = 30, offset = 0 })

View File

@ -13,7 +13,7 @@
</tr> </tr>
<tr class="d-table-row d-md-none bg-dark"> <tr class="d-table-row d-md-none bg-dark">
<th scope="row" class="bg-primary">@loc["WEBFRONT_PENALTY_TEMPLATE_PenaltyType"]</th> <th scope="row" class="bg-primary">@loc["WEBFRONT_PENALTY_TEMPLATE_TYPE"]</th>
<td class="penalties-color-@Model.PenaltyType.ToLower()"> <td class="penalties-color-@Model.PenaltyType.ToLower()">
@Model.PenaltyType @Model.PenaltyType
</td> </td>

View File

@ -2,6 +2,8 @@
@{ @{
Layout = null; Layout = null;
var timeSinceLastEvent = DateTime.MinValue;
string formatPenalty(SharedLibraryCore.Dtos.ProfileMeta meta) string formatPenalty(SharedLibraryCore.Dtos.ProfileMeta meta)
{ {
var penalty = meta.Value as SharedLibraryCore.Dtos.PenaltyInfo; var penalty = meta.Value as SharedLibraryCore.Dtos.PenaltyInfo;
@ -11,7 +13,7 @@
$"WEBFRONT_CLIENT_META_WAS_PENALIZED_{penalty.PenaltyType.ToUpper()}"; $"WEBFRONT_CLIENT_META_WAS_PENALIZED_{penalty.PenaltyType.ToUpper()}";
string localizationMessage = SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex[localizationKey]; string localizationMessage = SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex[localizationKey];
var regexMatch = System.Text.RegularExpressions.Regex.Match(localizationMessage, @"^{{([^{}]+)}}.+$"); var regexMatch = System.Text.RegularExpressions.Regex.Match(localizationMessage, @"^.*{{([^{}]+)}}.+$");
string penaltyType = regexMatch.Groups[1].Value.ToString(); string penaltyType = regexMatch.Groups[1].Value.ToString();
localizationMessage = localizationMessage.Replace(penaltyType, $"<span class='penalties-color-{penalty.PenaltyType.ToLower()}'>{penaltyType}</span>"); localizationMessage = localizationMessage.Replace(penaltyType, $"<span class='penalties-color-{penalty.PenaltyType.ToLower()}'>{penaltyType}</span>");
@ -24,21 +26,13 @@
.Replace("}", "") : .Replace("}", "") :
string.Format(localizationMessage, string.Format(localizationMessage,
$"<span class='text-highlight'><a class='link-inverse' href='{penalty.PunisherId}'>{penalty.PunisherName}</a></span>", $"<span class='text-highlight'><a class='link-inverse' href='{penalty.PunisherId}'>{penalty.PunisherName}</a></span>",
$"<span class='automated-penalty-info-detailed text-white' data-clientid='{penalty.OffenderId}'>{penalty.Offense}</span>", $"<span class='automated-penalty-info-detailed text-white' data-clientid='{penalty.OffenderId}'>{(ViewBag.Authorized && !string.IsNullOrEmpty(penalty.AutomatedOffense) ? $"{penalty.Offense} ({penalty.AutomatedOffense})" : penalty.Offense)}</span>",
penalty.Offense) penalty.Offense)
.Replace("{", "") .Replace("{", "")
.Replace("}", ""); .Replace("}", "");
} }
} }
@if (Model.Count > 0)
{
<div class="p2 text-white profile-event-timestep">
<span class="text-primary">&mdash;</span>
<span>@SharedLibraryCore.Utilities.GetTimePassed(Model.First().When, true)</span>
</div>
}
@if (Model.Count == 0) @if (Model.Count == 0)
{ {
<div class="p2 text-muted profile-event-timestep">@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CLIENT_META_NONE"]</div> <div class="p2 text-muted profile-event-timestep">@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CLIENT_META_NONE"]</div>
@ -46,6 +40,16 @@
@foreach (var meta in Model.OrderByDescending(_meta => _meta.When)) @foreach (var meta in Model.OrderByDescending(_meta => _meta.When))
{ {
@if (Math.Abs((meta.When - timeSinceLastEvent).TotalDays) >= 1)
{
<div class="p2 text-white profile-event-timestep">
<span class="text-primary">&mdash;</span>
<span>@SharedLibraryCore.Utilities.GetTimePassed(meta.When, true)</span>
</div>
timeSinceLastEvent = meta.When;
}
@switch (meta.Type) @switch (meta.Type)
{ {
case SharedLibraryCore.Dtos.ProfileMeta.MetaType.ChatMessage: case SharedLibraryCore.Dtos.ProfileMeta.MetaType.ChatMessage:

View File

@ -1,5 +1,6 @@
let loaderOffset = 10; let loaderOffset = 10;
let loadCount = 10; let loadCount = 10;
let loaderReachedEnd = false;
let startAt = null; let startAt = null;
let isLoaderLoading = false; let isLoaderLoading = false;
let loadUri = ''; let loadUri = '';
@ -14,7 +15,7 @@ function initLoader(location, loaderId, count = 10, start = count) {
} }
function loadMoreItems() { function loadMoreItems() {
if (isLoaderLoading) { if (isLoaderLoading || loaderReachedEnd) {
return false; return false;
} }
@ -25,6 +26,8 @@ function loadMoreItems() {
$(loaderResponseId).append(response); $(loaderResponseId).append(response);
if (response.trim().length === 0) { if (response.trim().length === 0) {
staleLoader(); staleLoader();
loaderReachedEnd = true;
$('.loader-load-more').addClass('disabled');
} }
$(document).trigger("loaderFinished", response); $(document).trigger("loaderFinished", response);
startAt = $(response).filter('.loader-data-time').last().data('time'); startAt = $(response).filter('.loader-data-time').last().data('time');
@ -66,7 +69,7 @@ function setupListeners() {
$window $window
.off('scroll', ScrollHandler) .off('scroll', ScrollHandler)
.on('scroll', ScrollHandler); .on('scroll', ScrollHandler);
$('.loader-load-more').click(function (e) { $('.loader-load-more:not(.disabled)').click(function (e) {
if (!isLoaderLoading) { if (!isLoaderLoading) {
loadMoreItems(); loadMoreItems();
} }