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

stats tweaked to scale SPM based on team size

invalid client id results in 404 rather than exception page
performance based on traditional elo rating
fixed @ (broadcast commands)
added reports to penalty list and profile
This commit is contained in:
RaidMax
2018-05-24 14:48:57 -05:00
parent 8ac75ec63a
commit eb3b208e4f
12 changed files with 108 additions and 47 deletions

View File

@ -1,6 +1,8 @@
using IW4MAdmin.Plugins.Stats.Cheat;
using IW4MAdmin.Plugins.Stats.Models;
using System;
using System.Collections.Concurrent;
using System.Linq;
namespace IW4MAdmin.Plugins.Stats.Helpers
{
@ -9,6 +11,7 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
public ConcurrentDictionary<int, Detection> PlayerDetections { get; set; }
public EFServerStatistics ServerStatistics { get; private set; }
public EFServer Server { get; private set; }
public bool IsTeamBased { get; set; }
public ServerStats(EFServer sv, EFServerStatistics st)
{
@ -17,5 +20,18 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
ServerStatistics = st;
Server = sv;
}
public int TeamCount(IW4Info.Team teamName)
{
if (PlayerStats.Count(p => p.Value.Team == IW4Info.Team.Spectator) / (double)PlayerStats.Count <= 0.25)
{
return IsTeamBased ? Math.Max(PlayerStats.Count(p => p.Value.Team == teamName), 1) : Math.Max(PlayerStats.Count - 1, 1);
}
else
{
return IsTeamBased ? (int)Math.Max(Math.Floor(PlayerStats.Count / 2.0), 1) : Math.Max(PlayerStats.Count - 1, 1);
}
}
}
}