fixed bug with lifetime hit ratio causing erroneous ban
ip lookup on profile shows error if failed truncate chat messages over 50 characters removed html raw on client messages :c show client rank colors on server overview if authorized break long messages on profile page prevent masked status showing up to non privileged users in webfront
This commit is contained in:
parent
233aeeb12f
commit
9db8ad80ef
@ -271,7 +271,8 @@ if (totalChestKills >= 250)
|
|||||||
double chestAbdomenRatioLerpValueForFlag = Thresholds.Lerp(Thresholds.ChestAbdomenRatioThresholdLowSample(2.25), Thresholds.ChestAbdomenRatioThresholdHighSample(2.25), lerpAmount) + marginOfError;
|
double chestAbdomenRatioLerpValueForFlag = Thresholds.Lerp(Thresholds.ChestAbdomenRatioThresholdLowSample(2.25), Thresholds.ChestAbdomenRatioThresholdHighSample(2.25), lerpAmount) + marginOfError;
|
||||||
double chestAbdomenLerpValueForBan = Thresholds.Lerp(Thresholds.ChestAbdomenRatioThresholdLowSample(3.0), Thresholds.ChestAbdomenRatioThresholdHighSample(3.0), lerpAmount) + marginOfError;
|
double chestAbdomenLerpValueForBan = Thresholds.Lerp(Thresholds.ChestAbdomenRatioThresholdLowSample(3.0), Thresholds.ChestAbdomenRatioThresholdHighSample(3.0), lerpAmount) + marginOfError;
|
||||||
|
|
||||||
double currentChestAbdomenRatio = HitLocationCount[IW4Info.HitLocation.torso_upper] / (double)HitLocationCount[IW4Info.HitLocation.torso_lower];
|
double currentChestAbdomenRatio = stats.HitLocations.Single(hl => hl.Location == IW4Info.HitLocation.torso_upper).HitCount /
|
||||||
|
stats.HitLocations.Single(hl => hl.Location == IW4Info.HitLocation.torso_lower).HitCount;
|
||||||
|
|
||||||
if (currentChestAbdomenRatio > chestAbdomenRatioLerpValueForFlag)
|
if (currentChestAbdomenRatio > chestAbdomenRatioLerpValueForFlag)
|
||||||
{
|
{
|
||||||
@ -284,8 +285,8 @@ if (totalChestKills >= 250)
|
|||||||
Log.WriteDebug($"**Ratio {currentChestAbdomenRatio}");
|
Log.WriteDebug($"**Ratio {currentChestAbdomenRatio}");
|
||||||
Log.WriteDebug($"**MaxRatio {chestAbdomenLerpValueForBan}");
|
Log.WriteDebug($"**MaxRatio {chestAbdomenLerpValueForBan}");
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
foreach (var kvp in HitLocationCount)
|
foreach (var location in stats.HitLocations)
|
||||||
sb.Append($"HitLocation: {kvp.Key} -> {kvp.Value}\r\n");
|
sb.Append($"HitLocation: {location.Location} -> {location.HitCount}\r\n");
|
||||||
Log.WriteDebug(sb.ToString());
|
Log.WriteDebug(sb.ToString());
|
||||||
// Log.WriteDebug($"ThresholdReached: {AboveThresholdCount}");
|
// Log.WriteDebug($"ThresholdReached: {AboveThresholdCount}");
|
||||||
|
|
||||||
@ -305,8 +306,8 @@ if (totalChestKills >= 250)
|
|||||||
Log.WriteDebug($"**Ratio {currentChestAbdomenRatio}");
|
Log.WriteDebug($"**Ratio {currentChestAbdomenRatio}");
|
||||||
Log.WriteDebug($"**MaxRatio {chestAbdomenRatioLerpValueForFlag}");
|
Log.WriteDebug($"**MaxRatio {chestAbdomenRatioLerpValueForFlag}");
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
foreach (var kvp in HitLocationCount)
|
foreach (var location in stats.HitLocations)
|
||||||
sb.Append($"HitLocation: {kvp.Key} -> {kvp.Value}\r\n");
|
sb.Append($"HitLocation: {location.Location} -> {location.HitCount}\r\n");
|
||||||
Log.WriteDebug(sb.ToString());
|
Log.WriteDebug(sb.ToString());
|
||||||
// Log.WriteDebug($"ThresholdReached: {AboveThresholdCount}");
|
// Log.WriteDebug($"ThresholdReached: {AboveThresholdCount}");
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ namespace StatsPlugin.Models
|
|||||||
[NotMapped]
|
[NotMapped]
|
||||||
public float AverageHitOffset
|
public float AverageHitOffset
|
||||||
{
|
{
|
||||||
get => (float)Math.Round(HitLocations.Sum(c => c.HitOffsetAverage) / HitLocations.Where(c => c.HitOffsetAverage > 0).Count(), 4);
|
get => (float)Math.Round(HitLocations.Sum(c => c.HitOffsetAverage) / Math.Max(1, HitLocations.Where(c => c.HitOffsetAverage > 0).Count()), 4);
|
||||||
}
|
}
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public int SessionKills { get; set; }
|
public int SessionKills { get; set; }
|
||||||
|
@ -129,7 +129,7 @@ namespace StatsPlugin
|
|||||||
(double)clientStats.Where(c => c.HitLocations.Count > 0)
|
(double)clientStats.Where(c => c.HitLocations.Count > 0)
|
||||||
.Sum(c => c.HitLocations.Where(hl => hl.Location != IW4Info.HitLocation.none).Sum(f => f.HitCount)), 2);
|
.Sum(c => c.HitLocations.Where(hl => hl.Location != IW4Info.HitLocation.none).Sum(f => f.HitCount)), 2);
|
||||||
|
|
||||||
hitOffsetAverage = clientStats.Sum(c => c.AverageHitOffset) / clientStats.Where(c => c.AverageHitOffset > 0).Count();
|
hitOffsetAverage = clientStats.Sum(c => c.AverageHitOffset) / Math.Max(1, clientStats.Where(c => c.AverageHitOffset > 0).Count());
|
||||||
}
|
}
|
||||||
|
|
||||||
return new List<ProfileMeta>()
|
return new List<ProfileMeta>()
|
||||||
|
@ -45,7 +45,7 @@ namespace WebfrontCore.Controllers
|
|||||||
var administeredPenaltiesMeta = await Manager.GetPenaltyService()
|
var administeredPenaltiesMeta = await Manager.GetPenaltyService()
|
||||||
.ReadGetClientPenaltiesAsync(client.ClientId, false);
|
.ReadGetClientPenaltiesAsync(client.ClientId, false);
|
||||||
|
|
||||||
if (client.Level > SharedLibrary.Objects.Player.Permission.Trusted)
|
if (Authorized && client.Level > SharedLibrary.Objects.Player.Permission.Trusted)
|
||||||
clientDto.Meta.Add(new ProfileMeta()
|
clientDto.Meta.Add(new ProfileMeta()
|
||||||
{
|
{
|
||||||
Key = "Masked",
|
Key = "Masked",
|
||||||
|
@ -30,7 +30,8 @@ namespace WebfrontCore.Controllers
|
|||||||
Players = s.Players.Where(p => p != null).Select(p => new PlayerInfo
|
Players = s.Players.Where(p => p != null).Select(p => new PlayerInfo
|
||||||
{
|
{
|
||||||
Name = p.Name,
|
Name = p.Name,
|
||||||
ClientId = p.ClientId
|
ClientId = p.ClientId,
|
||||||
|
Level = p.Level.ToString()
|
||||||
}).ToList(),
|
}).ToList(),
|
||||||
ChatHistory = s.ChatHistory.OrderBy(c => c.Time).Take((int)Math.Ceiling(s.ClientNum / 2.0)).ToArray(),
|
ChatHistory = s.ChatHistory.OrderBy(c => c.Time).Take((int)Math.Ceiling(s.ClientNum / 2.0)).ToArray(),
|
||||||
PlayerHistory = s.PlayerHistory.ToArray()
|
PlayerHistory = s.PlayerHistory.ToArray()
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
@{
|
@{
|
||||||
for (int i = 0; i < Model.ChatHistory.Length; i++)
|
for (int i = 0; i < Model.ChatHistory.Length; i++)
|
||||||
{
|
{
|
||||||
string message = "– " + @Model.ChatHistory[i].Message;
|
string message = @Model.ChatHistory[i].Message;
|
||||||
if (Model.ChatHistory[i].Message == "CONNECTED")
|
if (Model.ChatHistory[i].Message == "CONNECTED")
|
||||||
{
|
{
|
||||||
<span class="text-light"><span class="oi oi-account-login mr-2 text-success"> </span>@Model.ChatHistory[i].Name</span><br />
|
<span class="text-light"><span class="oi oi-account-login mr-2 text-success"> </span>@Model.ChatHistory[i].Name</span><br />
|
||||||
@ -20,7 +20,7 @@
|
|||||||
}
|
}
|
||||||
if (Model.ChatHistory[i].Message != "CONNECTED" && Model.ChatHistory[i].Message != "DISCONNECTED")
|
if (Model.ChatHistory[i].Message != "CONNECTED" && Model.ChatHistory[i].Message != "DISCONNECTED")
|
||||||
{
|
{
|
||||||
<span class="text-light">@Model.ChatHistory[i].Name</span><span> @Html.Raw(@message) </span><br />
|
<span class="text-light">@Model.ChatHistory[i].Name</span><span> — @message.Substring(0, Math.Min(50, message.Length - 1)) </span><br />
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,7 +31,8 @@
|
|||||||
@{
|
@{
|
||||||
for (int i = 0; i < half; i++)
|
for (int i = 0; i < half; i++)
|
||||||
{
|
{
|
||||||
<span>@Html.ActionLink(Model.Players[i].Name, "ProfileAsync", "Client", new { id = Model.Players[i].ClientId })</span><br />
|
string levelColorClass = !ViewBag.Authorized ? "" : $"level-color-{Model.Players[i].Level.ToLower()}";
|
||||||
|
<span>@Html.ActionLink(Model.Players[i].Name, "ProfileAsync", "Client", new { id = Model.Players[i].ClientId }, new { @class=levelColorClass })</span><br />
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@ -39,7 +40,8 @@
|
|||||||
@{
|
@{
|
||||||
for (int i = half; i < Model.ClientCount; i++)
|
for (int i = half; i < Model.ClientCount; i++)
|
||||||
{
|
{
|
||||||
<span>@Html.ActionLink(Model.Players[i].Name, "ProfileAsync", "Client", new { id = Model.Players[i].ClientId })</span><br />
|
string levelColorClass = !ViewBag.Authorized ? "" : $"level-color-{Model.Players[i].Level.ToLower()}";
|
||||||
|
<span>@Html.ActionLink(Model.Players[i].Name, "ProfileAsync", "Client", new { id = Model.Players[i].ClientId }, new { @class = levelColorClass })</span><br />
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
<!-- Main Modal -->
|
||||||
<div class="modal fade" id="mainModal" tabindex="-1" role="dialog" aria-labelledby="mainModalLabel" aria-hidden="true">
|
<div class="modal fade" id="mainModal" tabindex="-1" role="dialog" aria-labelledby="mainModalLabel" aria-hidden="true">
|
||||||
<div class="modal-dialog" role="document">
|
<div class="modal-dialog" role="document">
|
||||||
<div class="modal-content bg-dark">
|
<div class="modal-content bg-dark">
|
||||||
@ -60,6 +61,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- End Main Modal -->
|
||||||
|
|
||||||
<!-- Action Modal -->
|
<!-- Action Modal -->
|
||||||
<div class="modal fade" id="actionModal" tabindex="-1" role="dialog" aria-labelledby="actionModalLabel" aria-hidden="true">
|
<div class="modal fade" id="actionModal" tabindex="-1" role="dialog" aria-labelledby="actionModalLabel" aria-hidden="true">
|
||||||
|
@ -3,14 +3,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.level-color-user, .level-color-guest {
|
.level-color-user, .level-color-guest {
|
||||||
color: rgba(255, 255, 255, 0.85);
|
color: rgba(255, 255, 255, 0.7);
|
||||||
}
|
}
|
||||||
|
|
||||||
.level-bgcolor-user, .level-bgcolor-guest {
|
.level-bgcolor-user, .level-bgcolor-guest {
|
||||||
background-color: rgba(255, 255, 255, 0.85);
|
background-color: rgba(255, 255, 255, 0.85);
|
||||||
}
|
}
|
||||||
|
|
||||||
.level-color-trusted, .level-color-user {
|
.level-color-trusted {
|
||||||
color: rgba(116,147,99,1);
|
color: rgba(116,147,99,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,3 +158,7 @@
|
|||||||
.profile-action:hover {
|
.profile-action:hover {
|
||||||
opacity: 0.75;
|
opacity: 0.75;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#profile_events span {
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
@ -57,12 +57,17 @@ $(document).ready(function () {
|
|||||||
const ip = $(this).data("ip");
|
const ip = $(this).data("ip");
|
||||||
$.getJSON("http://ip-api.com/json/" + ip)
|
$.getJSON("http://ip-api.com/json/" + ip)
|
||||||
.done(function (response) {
|
.done(function (response) {
|
||||||
$('.modal-title').text(ip);
|
$('#mainModal .modal-title').text(ip);
|
||||||
$('.modal-body').text("");
|
$('#mainModal .modal-body').text("");
|
||||||
$('.modal-body').append("ASN — " + response["as"] + "<br/>");
|
$('#mainModal .modal-body').append("ASN — " + response["as"] + "<br/>");
|
||||||
$('.modal-body').append("ISP — " + response["isp"] + "<br/>");
|
$('#mainModal .modal-body').append("ISP — " + response["isp"] + "<br/>");
|
||||||
$('.modal-body').append("Organization — " + response["org"] + "<br/>");
|
$('#mainModal .modal-body').append("Organization — " + response["org"] + "<br/>");
|
||||||
$('.modal-body').append("Location — " + response["city"] + ", " + response["regionName"] + ", " + response["country"] + "<br/>");
|
$('#mainModal .modal-body').append("Location — " + response["city"] + ", " + response["regionName"] + ", " + response["country"] + "<br/>");
|
||||||
|
$('#mainModal').modal();
|
||||||
|
})
|
||||||
|
.fail(function (jqxhr, textStatus, error) {
|
||||||
|
$('#mainModal .modal-title').text("Error");
|
||||||
|
$('#mainModal .modal-body').html('<span class="text-danger">—'+ error + '</span>');
|
||||||
$('#mainModal').modal();
|
$('#mainModal').modal();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user