removed code that mysteriously caused player count to be inaccurate.
fixed unrepresentable datetime when minute rounded to 60 (forgot to copy changes to release code) fixed the player graph render time (apparently canvasjs doesn't like big numbers hopefully fixed duplicate 'stats' pages from appearing.
This commit is contained in:
parent
0bdec1147b
commit
4c813b18d6
@ -328,7 +328,7 @@ namespace IW4MAdmin
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ClientNum = await PollPlayersAsync();
|
await PollPlayersAsync();
|
||||||
|
|
||||||
if (ConnectionErrors > 0)
|
if (ConnectionErrors > 0)
|
||||||
{
|
{
|
||||||
@ -375,7 +375,9 @@ namespace IW4MAdmin
|
|||||||
start = DateTime.Now;
|
start = DateTime.Now;
|
||||||
}
|
}
|
||||||
|
|
||||||
//logFile = new IFile();
|
if (LogFile == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (l_size != LogFile.Length())
|
if (l_size != LogFile.Length())
|
||||||
{
|
{
|
||||||
// this should be the longest running task
|
// this should be the longest running task
|
||||||
|
Binary file not shown.
@ -1,6 +1,13 @@
|
|||||||
<script>
|
<script>
|
||||||
function getPlayerHistoryChart(playerHistory, i) {
|
function getPlayerHistoryChart(playerHistory, i) {
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
|
|
||||||
|
// thanks to cnavas js :(
|
||||||
|
playerHistory.forEach(function(item, i) {
|
||||||
|
playerHistory[i].x = new Date(playerHistory[i].x);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
return new CanvasJS.Chart(`graph-player-history-${i}`, {
|
return new CanvasJS.Chart(`graph-player-history-${i}`, {
|
||||||
backgroundColor: "#191919",
|
backgroundColor: "#191919",
|
||||||
height: 100,
|
height: 100,
|
||||||
@ -8,7 +15,7 @@
|
|||||||
|
|
||||||
toolTip: {
|
toolTip: {
|
||||||
contentFormatter: function (e) {
|
contentFormatter: function (e) {
|
||||||
var date = new Date(e.entries[0].dataPoint.x * 1000);
|
var date = new Date(e.entries[0].dataPoint.x);
|
||||||
return date.toLocaleTimeString('en-US', { timeZone: 'America/New_York', hour12: true }) + " - " + e.entries[0].dataPoint.y + " players";
|
return date.toLocaleTimeString('en-US', { timeZone: 'America/New_York', hour12: true }) + " - " + e.entries[0].dataPoint.y + " players";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -154,7 +154,7 @@ namespace StatsPlugin
|
|||||||
|
|
||||||
public static List<StatTracking> statLists;
|
public static List<StatTracking> statLists;
|
||||||
|
|
||||||
public struct StatTracking
|
public class StatTracking
|
||||||
{
|
{
|
||||||
public StatsDB playerStats;
|
public StatsDB playerStats;
|
||||||
public DateTime[] lastKill, connectionTime;
|
public DateTime[] lastKill, connectionTime;
|
||||||
@ -222,9 +222,12 @@ namespace StatsPlugin
|
|||||||
if (ManagerInstance == null)
|
if (ManagerInstance == null)
|
||||||
{
|
{
|
||||||
ManagerInstance = S.Manager;
|
ManagerInstance = S.Manager;
|
||||||
|
lock (WebService.PageList)
|
||||||
|
{
|
||||||
WebService.PageList.Add(new StatsPage());
|
WebService.PageList.Add(new StatsPage());
|
||||||
WebService.PageList.Add(new KillStatsJSON());
|
WebService.PageList.Add(new KillStatsJSON());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
statLists.Add(new StatTracking(S.GetPort()));
|
statLists.Add(new StatTracking(S.GetPort()));
|
||||||
|
|
||||||
@ -292,7 +295,8 @@ namespace StatsPlugin
|
|||||||
if (E.Origin == E.Target || E.Origin == null)
|
if (E.Origin == E.Target || E.Origin == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string[] killInfo = E.Data.Split(';');
|
string[] killInfo = (E.Data != null) ? E.Data.Split(';') : new string[0];
|
||||||
|
|
||||||
if (killInfo.Length >= 9 && killInfo[0].Contains("ScriptKill"))
|
if (killInfo.Length >= 9 && killInfo[0].Contains("ScriptKill"))
|
||||||
{
|
{
|
||||||
var killEvent = new KillInfo(E.Origin.DatabaseID, E.Target.DatabaseID, S.CurrentMap.Name, killInfo[7], killInfo[8], killInfo[5], killInfo[6], killInfo[3], killInfo[4])
|
var killEvent = new KillInfo(E.Origin.DatabaseID, E.Target.DatabaseID, S.CurrentMap.Name, killInfo[7], killInfo[8], killInfo[5], killInfo[6], killInfo[3], killInfo[4])
|
||||||
@ -415,6 +419,8 @@ namespace StatsPlugin
|
|||||||
{
|
{
|
||||||
StatTracking selectedPlayers = statLists.Find(x => x.Port == serverPort);
|
StatTracking selectedPlayers = statLists.Find(x => x.Port == serverPort);
|
||||||
|
|
||||||
|
if (selectedPlayers == null)
|
||||||
|
return;
|
||||||
selectedPlayers.Kills[cID] = 0;
|
selectedPlayers.Kills[cID] = 0;
|
||||||
selectedPlayers.connectionTime[cID] = DateTime.Now;
|
selectedPlayers.connectionTime[cID] = DateTime.Now;
|
||||||
selectedPlayers.inactiveMinutes[cID] = 0;
|
selectedPlayers.inactiveMinutes[cID] = 0;
|
||||||
@ -640,7 +646,7 @@ namespace StatsPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct PlayerStats
|
public class PlayerStats
|
||||||
{
|
{
|
||||||
public PlayerStats(int K, int D, double DR, double S, double sc, int P)
|
public PlayerStats(int K, int D, double DR, double S, double sc, int P)
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,7 @@ _______
|
|||||||
|
|
||||||
### Setup
|
### Setup
|
||||||
IW4MAdmin requires minimal configuration to run. There is only one prerequisite.
|
IW4MAdmin requires minimal configuration to run. There is only one prerequisite.
|
||||||
2. [.NET Framework 4.5](https://www.microsoft.com/en-us/download/details.aspx?id=30653) *or better*
|
1. [.NET Framework 4.5](https://www.microsoft.com/en-us/download/details.aspx?id=30653) *or newer*
|
||||||
|
|
||||||
Extract `IW4MAdmin.zip`
|
Extract `IW4MAdmin.zip`
|
||||||
Run `IW4MAdmin.exe`
|
Run `IW4MAdmin.exe`
|
||||||
|
@ -7,7 +7,7 @@ namespace SharedLibrary.Helpers
|
|||||||
public PlayerHistory(int cNum)
|
public PlayerHistory(int cNum)
|
||||||
{
|
{
|
||||||
DateTime t = DateTime.UtcNow;
|
DateTime t = DateTime.UtcNow;
|
||||||
When = new DateTime(t.Year, t.Month, t.Day, t.Hour, 5 * (int)Math.Round(t.Minute / 5.0), 0);
|
When = new DateTime(t.Year, t.Month, t.Day, t.Hour, Math.Min(59, 15 * (int)Math.Round(t.Minute / 15.0)), 0);
|
||||||
PlayerCount = cNum;
|
PlayerCount = cNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,11 +25,11 @@ namespace SharedLibrary.Helpers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used by CanvasJS as a point on the x axis
|
/// Used by CanvasJS as a point on the x axis
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double x
|
public string x
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return (When - DateTime.MinValue).TotalSeconds;
|
return When.ToString("yyyy-MM-ddTHH:mm:ssZ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@ namespace SharedLibrary
|
|||||||
Port = config.Port;
|
Port = config.Port;
|
||||||
Manager = mgr;
|
Manager = mgr;
|
||||||
Logger = Manager.GetLogger();
|
Logger = Manager.GetLogger();
|
||||||
ClientNum = 0;
|
|
||||||
Config = config;
|
Config = config;
|
||||||
|
|
||||||
Players = new List<Player>(new Player[18]);
|
Players = new List<Player>(new Player[18]);
|
||||||
@ -359,7 +358,13 @@ namespace SharedLibrary
|
|||||||
public string Website { get; protected set; }
|
public string Website { get; protected set; }
|
||||||
public string Gametype { get; protected set; }
|
public string Gametype { get; protected set; }
|
||||||
public Map CurrentMap { get; protected set; }
|
public Map CurrentMap { get; protected set; }
|
||||||
public int ClientNum { get; protected set; }
|
public int ClientNum
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Players.Where(p => p != null).Count();
|
||||||
|
}
|
||||||
|
}
|
||||||
public int MaxClients { get; protected set; }
|
public int MaxClients { get; protected set; }
|
||||||
public List<Player> Players { get; protected set; }
|
public List<Player> Players { get; protected set; }
|
||||||
public string Password { get; private set; }
|
public string Password { get; private set; }
|
||||||
|
Loading…
Reference in New Issue
Block a user