1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-24 06:00:34 -05:00

added moment for parsing dates in profile timeline

fixed bug of duplicate penalties
fixed showing timeline date for non events
refresh player count on server overview
fix refresh privileged users on map load
fix 1h showing on tempban if manually specified
This commit is contained in:
RaidMax
2018-03-27 19:27:01 -05:00
parent 106e925bca
commit ee6ac59041
395 changed files with 191125 additions and 43 deletions

View File

@ -15,19 +15,19 @@ namespace StatsPlugin.Cheat
int Kills;
int AboveThresholdCount;
double AverageKillTime;
double AverageHitOffset;
int avgcnt;
Dictionary<IW4Info.HitLocation, int> HitLocationCount;
EFClientStatistics ClientStats;
DateTime LastKill;
ILogger Log;
public Detection(ILogger log)
public Detection(ILogger log, EFClientStatistics clientStats)
{
Log = log;
HitLocationCount = new Dictionary<IW4Info.HitLocation, int>();
foreach (var loc in Enum.GetValues(typeof(IW4Info.HitLocation)))
HitLocationCount.Add((IW4Info.HitLocation)loc, 0);
LastKill = DateTime.UtcNow;
ClientStats = clientStats;
}
/// <summary>
@ -62,10 +62,11 @@ namespace StatsPlugin.Cheat
if (kill.AdsPercent > 0.5)
{
Log.WriteInfo($"{((float)angle).ToDegrees()}");
AverageHitOffset += angle;
avgcnt++;
double avg = AverageHitOffset / (float)avgcnt;
var hitLoc = ClientStats.HitLocations
.First(hl => hl.Location == kill.HitLoc);
float previousAverage = hitLoc.HitOffsetAverage;
double newAverage = (previousAverage * (hitLoc.HitCount - 1) + angle) / hitLoc.HitCount;
hitLoc.HitOffsetAverage = (float)newAverage;
}
#endregion

View File

@ -156,7 +156,7 @@ namespace StatsPlugin.Helpers
if (detectionStats.ContainsKey(pl.ClientId))
detectionStats.TryRemove(pl.ClientId, out Cheat.Detection removedValue);
detectionStats.TryAdd(pl.ClientId, new Cheat.Detection(Log));
detectionStats.TryAdd(pl.ClientId, new Cheat.Detection(Log, clientStats));
return clientStats;
}

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SharedLibrary.Database.Models;
using System.ComponentModel.DataAnnotations.Schema;
@ -13,8 +9,6 @@ namespace StatsPlugin.Models
{
public class EFClientKill : SharedEntity
{
public EFClientKill() { }
[Key]
public long KillId { get; set; }
public int VictimId { get; set; }

View File

@ -38,7 +38,12 @@ namespace StatsPlugin.Models
public double Skill { get; set; }
[Required]
public int TimePlayed { get; set; }
[NotMapped]
public float AverageHitOffset
{
get => (float)Math.Round(HitLocations.Sum(c => c.HitOffsetAverage) / HitLocations.Where(c => c.HitOffsetAverage > 0).Count(), 4);
}
[NotMapped]
public int SessionKills { get; set; }
[NotMapped]

View File

@ -1,11 +1,5 @@
using SharedLibrary.Database.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StatsPlugin.Models
{
@ -17,5 +11,7 @@ namespace StatsPlugin.Models
public IW4Info.HitLocation Location { get; set; }
[Required]
public int HitCount { get; set; }
[Required]
public float HitOffsetAverage { get; set; }
}
}

View File

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SharedLibrary;
@ -110,6 +109,7 @@ namespace StatsPlugin
double chestRatio = 0;
double abdomenRatio = 0;
double chestAbdomenRatio = 0;
double hitOffsetAverage = 0;
if (clientStats.Where(cs => cs.HitLocations.Count > 0).FirstOrDefault() != null)
{
@ -128,6 +128,8 @@ namespace StatsPlugin
headRatio = Math.Round(clientStats.Where(c => c.HitLocations.Count > 0).Sum(cs => cs.HitLocations.First(hl => hl.Location == IW4Info.HitLocation.head).HitCount) /
(double)clientStats.Where(c => c.HitLocations.Count > 0)
.Sum(c => c.HitLocations.Where(hl => hl.Location != IW4Info.HitLocation.none).Sum(f => f.HitCount)), 2);
hitOffsetAverage = clientStats.Sum(c => c.AverageHitOffset) / clientStats.Where(c => c.AverageHitOffset > 0).Count();
}
return new List<ProfileMeta>()
@ -180,6 +182,12 @@ namespace StatsPlugin
Key = "Headshot Ratio",
Value = headRatio,
Sensitive = true
},
new ProfileMeta()
{
Key = "Hit Offset Average",
Value = $"{Math.Round(((float)hitOffsetAverage).ToDegrees(), 4)}°",
Sensitive = true
}
};
}