Merge branch '2.3' into 2.4-pr

This commit is contained in:
RaidMax 2019-07-27 17:50:25 -05:00
commit ebe85a9ded
3 changed files with 28 additions and 15 deletions

View File

@ -6,6 +6,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
namespace IW4MAdmin.Plugins.Stats.Cheat namespace IW4MAdmin.Plugins.Stats.Cheat
{ {
@ -198,21 +199,25 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
#endregion #endregion
#region RECOIL #region RECOIL
var hitRecoilAverage = (hit.AnglesList.Sum(_angle => _angle.Z) + hit.ViewAngles.Z) / (hit.AnglesList.Count + 1); float hitRecoilAverage = 0;
sessionAverageRecoilAmount = (sessionAverageRecoilAmount * (HitCount - 1) + hitRecoilAverage) / HitCount; if (!Plugin.Config.Configuration().RecoilessWeapons.Any(_weaponRegex => Regex.IsMatch(hit.Weapon.ToString(), _weaponRegex)))
var lifeTimeHits = ClientStats.HitLocations.Sum(_loc => _loc.HitCount);
ClientStats.AverageRecoilOffset = (ClientStats.AverageRecoilOffset * (lifeTimeHits - 1) + hitRecoilAverage) / lifeTimeHits;
if (HitCount >= Thresholds.LowSampleMinKills && Kills > Thresholds.LowSampleMinKillsRecoil && sessionAverageRecoilAmount == 0)
{ {
results.Add(new DetectionPenaltyResult() hitRecoilAverage = (hit.AnglesList.Sum(_angle => _angle.Z) + hit.ViewAngles.Z) / (hit.AnglesList.Count + 1);
sessionAverageRecoilAmount = (sessionAverageRecoilAmount * (HitCount - 1) + hitRecoilAverage) / HitCount;
var lifeTimeHits = ClientStats.HitLocations.Sum(_loc => _loc.HitCount);
ClientStats.AverageRecoilOffset = (ClientStats.AverageRecoilOffset * (lifeTimeHits - 1) + hitRecoilAverage) / lifeTimeHits;
if (HitCount >= Thresholds.LowSampleMinKills && Kills > Thresholds.LowSampleMinKillsRecoil && sessionAverageRecoilAmount == 0)
{ {
ClientPenalty = EFPenalty.PenaltyType.Ban, results.Add(new DetectionPenaltyResult()
Value = sessionAverageRecoilAmount, {
HitCount = HitCount, ClientPenalty = EFPenalty.PenaltyType.Ban,
Type = DetectionType.Recoil Value = sessionAverageRecoilAmount,
}); HitCount = HitCount,
Type = DetectionType.Recoil
});
}
} }
#endregion #endregion
@ -312,7 +317,7 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
if (currentChestAbdomenRatio > chestAbdomenRatioLerpValueForFlag) if (currentChestAbdomenRatio > chestAbdomenRatioLerpValueForFlag)
{ {
if (currentChestAbdomenRatio > chestAbdomenLerpValueForBan && chestHits >= Thresholds.MediumSampleMinKills * 2) if (currentChestAbdomenRatio > chestAbdomenLerpValueForBan && chestHits >= Thresholds.MediumSampleMinKills * 2)
{ {
results.Add(new DetectionPenaltyResult() results.Add(new DetectionPenaltyResult()
{ {

View File

@ -9,6 +9,7 @@ namespace IW4MAdmin.Plugins.Stats.Config
public bool EnableAntiCheat { get; set; } public bool EnableAntiCheat { get; set; }
public List<StreakMessageConfiguration> KillstreakMessages { get; set; } public List<StreakMessageConfiguration> KillstreakMessages { get; set; }
public List<StreakMessageConfiguration> DeathstreakMessages { get; set; } public List<StreakMessageConfiguration> DeathstreakMessages { get; set; }
public List<string> RecoilessWeapons { get; set; }
public int TopPlayersMinPlayTime { get; set; } public int TopPlayersMinPlayTime { get; set; }
public bool StoreClientKills { get; set; } public bool StoreClientKills { get; set; }
public string Name() => "Stats"; public string Name() => "Stats";
@ -49,6 +50,13 @@ namespace IW4MAdmin.Plugins.Stats.Config
}, },
}; };
RecoilessWeapons = new List<string>()
{
"ranger.*_mp",
"model1887.*_mp",
".+shotgun.*_mp"
};
TopPlayersMinPlayTime = 3600 * 3; TopPlayersMinPlayTime = 3600 * 3;
StoreClientKills = false; StoreClientKills = false;

View File

@ -289,7 +289,7 @@ namespace SharedLibraryCore
} }
} }
else if (long.TryParse(str, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out id)) else if (long.TryParse(str.Length > 16 ? str.Substring(0, 16) : str, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out id))
{ {
} }