1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

fix T6 reading

add WaW support
fix stats threading
This commit is contained in:
RaidMax
2018-05-10 23:52:20 -05:00
parent 27233e3069
commit e817c333a5
15 changed files with 246 additions and 151 deletions

View File

@ -1,15 +1,18 @@
using SharedLibraryCore.Helpers;
using SharedLibraryCore.Interfaces;
using System;
using System.Collections.Generic;
using System.Text;
namespace IW4MAdmin.Plugins.Stats.Cheat
{
class Strain
class Strain : ITrackable
{
private static double StrainDecayBase = 0.15;
private double CurrentStrain;
private Vector3 LastAngle;
private double LastDeltaTime;
private double LastDistance;
public int TimesReachedMaxStrain { get; private set; }
@ -18,10 +21,13 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
if (LastAngle == null)
LastAngle = newAngle;
LastDeltaTime = deltaTime;
double decayFactor = GetDecay(deltaTime);
CurrentStrain *= decayFactor;
double[] distance = Helpers.Extensions.AngleStuff(newAngle, LastAngle);
LastDistance = distance[0] + distance[1];
// this happens on first kill
if ((distance[0] == 0 && distance[1] == 0) ||
@ -34,13 +40,18 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
double newStrain = Math.Pow(distance[0] + distance[1], 0.99) / deltaTime;
CurrentStrain += newStrain;
if (CurrentStrain > Thresholds.MaxStrain)
if (CurrentStrain > Thresholds.MaxStrainFlag)
TimesReachedMaxStrain++;
LastAngle = newAngle;
return CurrentStrain;
}
public string GetTrackableValue()
{
return $"Strain - {CurrentStrain}, Angle - {LastAngle}, Delta Time - {LastDeltaTime}, Distance - {LastDistance}";
}
private double GetDecay(double deltaTime) => Math.Pow(StrainDecayBase, deltaTime / 1000.0);
}
}