update values for snap and offset

fix some issues from .NET Core 3.0 upgrade
This commit is contained in:
RaidMax
2019-10-07 10:26:07 -05:00
parent c4e0b0272c
commit 068e943fd3
14 changed files with 1522 additions and 265 deletions

View File

@ -17,7 +17,7 @@ namespace LiveRadar.Web.Controllers
[HttpGet]
[Route("Radar/{serverId}")]
public IActionResult Index(long? serverId = null)
public IActionResult Index([FromQuery] long? serverId = null)
{
ViewBag.IsFluid = true;
ViewBag.Title = Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_RADAR_TITLE"];

View File

@ -303,12 +303,12 @@
};
function updateRadarData() {
$.getJSON('@Url.Action("Data", "Radar", null)', function (_radarItem) {
$.getJSON('@Url.Action("Data", "Radar", new { serverId = ViewBag.ActiveServerId })', function (_radarItem) {
newRadarData = _radarItem;
});
$.getJSON('@Url.Action("Map", "Radar", null)', function (_map) {
$.getJSON('@Url.Action("Map", "Radar", new { serverId = ViewBag.ActiveServerId })', function (_map) {
stateInfo.mapInfo = _map
});
@ -458,7 +458,7 @@
}
$(document).ready(function () {
$.getJSON('@Url.Action("Map", "Radar", null)', function (_map) {
$.getJSON('@Url.Action("Map", "Radar", new { serverId = ViewBag.ActiveServerId })', function (_map) {
stateInfo.mapInfo = _map;
updateRadarData();
setInterval(updateRadarData, stateInfo.updateFrequency);

View File

@ -125,32 +125,32 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
//var marginOfError = Thresholds.GetMarginOfError(sessionSnapHits);
//var marginOfErrorLifetime = Thresholds.GetMarginOfError(ClientStats.SnapHitCount);
if (sessionSnapHits >= Thresholds.LowSampleMinKills &&
if (sessionSnapHits >= Thresholds.MediumSampleMinKills &&
sessionAverageSnapAmount >= Thresholds.SnapFlagValue/* + marginOfError*/)
{
results.Add(new DetectionPenaltyResult()
{
ClientPenalty = EFPenalty.PenaltyType.Flag,
Value = sessionAverageSnapAmount,
HitCount = ClientStats.SnapHitCount,
HitCount = sessionSnapHits,
Type = DetectionType.Snap
});
}
if (sessionSnapHits >= Thresholds.LowSampleMinKills &&
if (sessionSnapHits >= Thresholds.MediumSampleMinKills &&
sessionAverageSnapAmount >= Thresholds.SnapBanValue/* + marginOfError*/)
{
results.Add(new DetectionPenaltyResult()
{
ClientPenalty = EFPenalty.PenaltyType.Ban,
Value = sessionAverageSnapAmount,
HitCount = ClientStats.SnapHitCount,
HitCount = sessionSnapHits,
Type = DetectionType.Snap
});
}
// lifetime
if (ClientStats.SnapHitCount >= Thresholds.MediumSampleMinKills &&
if (ClientStats.SnapHitCount >= Thresholds.MediumSampleMinKills * 2 &&
ClientStats.AverageSnapValue >= Thresholds.SnapFlagValue/* + marginOfErrorLifetime*/)
{
results.Add(new DetectionPenaltyResult()
@ -162,7 +162,7 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
});
}
if (ClientStats.SnapHitCount >= Thresholds.MediumSampleMinKills &&
if (ClientStats.SnapHitCount >= Thresholds.MediumSampleMinKills * 2 &&
ClientStats.AverageSnapValue >= Thresholds.SnapBanValue/* + marginOfErrorLifetime*/)
{
results.Add(new DetectionPenaltyResult()
@ -183,7 +183,6 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
int angleOffsetIndex = totalUsableAngleCount / 2;
if (hit.AnglesList.Count == 5)
{
double realAgainstPredict = Vector3.ViewAngleDistance(hit.AnglesList[angleOffsetIndex - 1], hit.AnglesList[angleOffsetIndex + 1], hit.ViewAngles);
// LIFETIME
@ -201,15 +200,15 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
if (weightedLifetimeAverage > Thresholds.MaxOffset(totalHits) &&
hitLoc.HitCount > 100)
{
Log.WriteDebug("*** Reached Max Lifetime Average for Angle Difference ***");
Log.WriteDebug($"Lifetime Average = {newAverage}");
Log.WriteDebug($"Bone = {hitLoc.Location}");
Log.WriteDebug($"HitCount = {hitLoc.HitCount}");
Log.WriteDebug($"ID = {hit.AttackerId}");
//Log.WriteDebug("*** Reached Max Lifetime Average for Angle Difference ***");
//Log.WriteDebug($"Lifetime Average = {newAverage}");
//Log.WriteDebug($"Bone = {hitLoc.Location}");
//Log.WriteDebug($"HitCount = {hitLoc.HitCount}");
//Log.WriteDebug($"ID = {hit.AttackerId}");
results.Add(new DetectionPenaltyResult()
{
ClientPenalty = EFPenalty.PenaltyType.Flag,
ClientPenalty = EFPenalty.PenaltyType.Ban,
Value = hitLoc.HitOffsetAverage,
HitCount = hitLoc.HitCount,
Type = DetectionType.Offset
@ -236,7 +235,7 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
results.Add(new DetectionPenaltyResult()
{
ClientPenalty = EFPenalty.PenaltyType.Flag,
ClientPenalty = EFPenalty.PenaltyType.Ban,
Value = weightedSessionAverage,
HitCount = HitCount,
Type = DetectionType.Offset,

View File

@ -48,13 +48,13 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
public const int HighSampleMinKills = 100;
public const double KillTimeThreshold = 0.2;
public const int LowSampleMinKillsRecoil = 5;
public const double SnapFlagValue = 6.12;
public const double SnapBanValue = 9.67;
public const double SnapFlagValue = 5.5;
public const double SnapBanValue = 8.7;
public const double MaxStrainBan = 0.9;
private const double _offsetMeanLog = -2.727273;
private const double _offsetSdLog = 0.458325;
private const double _offsetMeanLog = -2.3243889;
private const double _offsetSdLog = 0.5851351;
public static double MaxOffset(int sampleSize) => Math.Exp(Math.Max(_offsetMeanLog + (_offsetMeanLog / Math.Sqrt(sampleSize)), _offsetMeanLog - (_offsetMeanLog / Math.Sqrt(sampleSize))) + 4 * (_offsetSdLog));
public const double MaxStrainFlag = 0.36;

View File

@ -843,7 +843,7 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
Active = true,
Newest = true,
ServerId = clientStats.ServerId,
RatingHistoryId = clientHistory.RatingHistoryId,
RatingHistory = clientHistory,
ActivityAmount = currentServerTotalPlaytime,
};
@ -921,7 +921,7 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
Performance = performanceAverage,
Ranking = overallClientRanking,
ServerId = null,
RatingHistoryId = clientHistory.RatingHistoryId,
RatingHistory = clientHistory,
ActivityAmount = clientStatsList.Sum(s => s.TimePlayed)
};

View File

@ -17,11 +17,13 @@ namespace IW4MAdmin.Plugins.Stats.Models
[Required]
public float MaxAngleDistance { get; set; }
[Required]
public int ClientId { get; set; }
[ForeignKey("ClientId"), Column(Order = 0 )]
[Column("EFClientStatisticsClientId")]
public int EFClientStatisticsClientId { get; set; }
[ForeignKey("EFClientStatisticsClientId")]
public EFClient Client { get; set; }
public long ServerId { get; set; }
[ForeignKey("ServerId"), Column(Order = 1)]
[Column("EFClientStatisticsServerId")]
public long EFClientStatisticsServerId { get; set; }
[ForeignKey("EFClientStatisticsServerId")]
public EFServer Server { get; set; }
}
}

View File

@ -13,12 +13,12 @@ namespace Stats.Models
// fix linking from SQLCe
builder.Entity<EFHitLocationCount>()
.Property(c => c.ClientId)
.HasColumnName("EFClientStatistics_ClientId");
.Property(c => c.EFClientStatisticsClientId)
.HasColumnName("EFClientStatisticsClientId");
builder.Entity<EFHitLocationCount>()
.Property(c => c.ServerId)
.HasColumnName("EFClientStatistics_ServerId");
.Property(c => c.EFClientStatisticsServerId)
.HasColumnName("EFClientStatisticsServerId");
builder.Entity<EFRating>()
.HasIndex(p => new { p.Performance, p.Ranking, p.When });