2019-09-27 16:53:52 -04:00
|
|
|
|
using Stats.Config;
|
|
|
|
|
using System;
|
|
|
|
|
using static SharedLibraryCore.Database.Models.EFPenalty;
|
2018-03-18 22:24:06 -04:00
|
|
|
|
|
2018-04-08 17:50:58 -04:00
|
|
|
|
namespace IW4MAdmin.Plugins.Stats.Cheat
|
2018-03-18 22:24:06 -04:00
|
|
|
|
{
|
2019-09-27 16:53:52 -04:00
|
|
|
|
public static class DistributionHelper
|
|
|
|
|
{
|
|
|
|
|
public static double CalculateMaxValue(this DistributionConfiguration config, PenaltyType penaltyType, int sampleSize)
|
|
|
|
|
{
|
|
|
|
|
switch (config.Type)
|
|
|
|
|
{
|
|
|
|
|
case DistributionConfiguration.DistributionType.Normal:
|
|
|
|
|
break;
|
|
|
|
|
case DistributionConfiguration.DistributionType.LogNormal:
|
|
|
|
|
double deviationNumber = penaltyType == PenaltyType.Flag ? 3.0 : 4.0;
|
|
|
|
|
double marginOfError = 1.644 / (config.StandardDeviation / Math.Sqrt(sampleSize));
|
|
|
|
|
double maxValue = (config.StandardDeviation * deviationNumber) + marginOfError;
|
|
|
|
|
return maxValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return double.MaxValue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-18 22:24:06 -04:00
|
|
|
|
class Thresholds
|
|
|
|
|
{
|
|
|
|
|
public static double HeadshotRatioThresholdLowSample(double deviations) => HeadshotRatioStandardDeviationLowSample * deviations + HeadshotRatioMean;
|
|
|
|
|
public static double HeadshotRatioThresholdHighSample(double deviations) => HeadshotRatioStandardDeviationHighSample * deviations + HeadshotRatioMean;
|
|
|
|
|
public const double HeadshotRatioStandardDeviationLowSample = 0.1769994181;
|
|
|
|
|
public const double HeadshotRatioStandardDeviationHighSample = 0.03924263235;
|
|
|
|
|
public const double HeadshotRatioMean = 0.222;
|
|
|
|
|
|
|
|
|
|
public static double BoneRatioThresholdLowSample(double deviations) => BoneRatioStandardDeviationLowSample * deviations + BoneRatioMean;
|
|
|
|
|
public static double BoneRatioThresholdHighSample(double deviations) => BoneRatioStandardDeviationHighSample * deviations + BoneRatioMean;
|
|
|
|
|
public const double BoneRatioStandardDeviationLowSample = 0.1324612879;
|
|
|
|
|
public const double BoneRatioStandardDeviationHighSample = 0.0515753935;
|
|
|
|
|
public const double BoneRatioMean = 0.4593110238;
|
|
|
|
|
|
|
|
|
|
public static double ChestAbdomenRatioThresholdLowSample(double deviations) => ChestAbdomenStandardDeviationLowSample * deviations + ChestAbdomenRatioMean;
|
|
|
|
|
public static double ChestAbdomenRatioThresholdHighSample(double deviations) => ChestAbdomenStandardDeviationHighSample * deviations + ChestAbdomenRatioMean;
|
|
|
|
|
public const double ChestAbdomenStandardDeviationLowSample = 0.2859234644;
|
|
|
|
|
public const double ChestAbdomenStandardDeviationHighSample = 0.2195212861;
|
|
|
|
|
public const double ChestAbdomenRatioMean = 0.4435;
|
|
|
|
|
|
|
|
|
|
public const int LowSampleMinKills = 15;
|
|
|
|
|
public const int MediumSampleMinKills = 30;
|
|
|
|
|
public const int HighSampleMinKills = 100;
|
|
|
|
|
public const double KillTimeThreshold = 0.2;
|
2019-07-07 18:57:06 -04:00
|
|
|
|
public const int LowSampleMinKillsRecoil = 5;
|
2019-09-09 18:40:04 -04:00
|
|
|
|
public const double SnapFlagValue = 6.12;
|
|
|
|
|
public const double SnapBanValue = 9.67;
|
2018-03-18 22:24:06 -04:00
|
|
|
|
|
2018-10-28 21:47:56 -04:00
|
|
|
|
public const double MaxStrainBan = 0.9;
|
2018-06-26 21:17:24 -04:00
|
|
|
|
|
2019-06-12 11:27:15 -04:00
|
|
|
|
private const double _offsetMeanLog = -2.727273;
|
|
|
|
|
private const double _offsetSdLog = 0.458325;
|
|
|
|
|
|
|
|
|
|
public static double MaxOffset(int sampleSize) => Math.Exp(Math.Max(_offsetMeanLog + (_offsetMeanLog / Math.Sqrt(sampleSize)), _offsetMeanLog - (_offsetMeanLog / Math.Sqrt(sampleSize))) + 4 * (_offsetSdLog));
|
2018-05-20 22:35:56 -04:00
|
|
|
|
public const double MaxStrainFlag = 0.36;
|
2018-05-04 00:22:10 -04:00
|
|
|
|
|
2019-09-27 16:53:52 -04:00
|
|
|
|
public static double GetMarginOfError(int numberOfHits) => 1.6455 / Math.Sqrt(numberOfHits);
|
2018-03-18 22:24:06 -04:00
|
|
|
|
|
|
|
|
|
public static double Lerp(double v1, double v2, double amount)
|
|
|
|
|
{
|
|
|
|
|
return v1 + (v2 - v1) * amount;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|