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,7 +199,10 @@ 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;
if (!Plugin.Config.Configuration().RecoilessWeapons.Any(_weaponRegex => Regex.IsMatch(hit.Weapon.ToString(), _weaponRegex)))
{
hitRecoilAverage = (hit.AnglesList.Sum(_angle => _angle.Z) + hit.ViewAngles.Z) / (hit.AnglesList.Count + 1);
sessionAverageRecoilAmount = (sessionAverageRecoilAmount * (HitCount - 1) + hitRecoilAverage) / HitCount; sessionAverageRecoilAmount = (sessionAverageRecoilAmount * (HitCount - 1) + hitRecoilAverage) / HitCount;
var lifeTimeHits = ClientStats.HitLocations.Sum(_loc => _loc.HitCount); var lifeTimeHits = ClientStats.HitLocations.Sum(_loc => _loc.HitCount);
@ -214,6 +218,7 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
Type = DetectionType.Recoil Type = DetectionType.Recoil
}); });
} }
}
#endregion #endregion
#region SESSION_RATIOS #region SESSION_RATIOS

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))
{ {
} }