fixed issue with timeline history!
This commit is contained in:
parent
c9889f0792
commit
8e7622c64e
@ -450,6 +450,9 @@ namespace IW4MAdmin
|
|||||||
//Update stat information of specified player
|
//Update stat information of specified player
|
||||||
public void updatePlayer(Player P)
|
public void updatePlayer(Player P)
|
||||||
{
|
{
|
||||||
|
if (P.stats == null)
|
||||||
|
return;
|
||||||
|
|
||||||
Dictionary<String, object> updatedPlayer = new Dictionary<String, object>();
|
Dictionary<String, object> updatedPlayer = new Dictionary<String, object>();
|
||||||
|
|
||||||
updatedPlayer.Add("KILLS", P.stats.Kills);
|
updatedPlayer.Add("KILLS", P.stats.Kills);
|
||||||
|
18
Admin/Helpers.cs
Normal file
18
Admin/Helpers.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace IW4MAdmin
|
||||||
|
{
|
||||||
|
class pHistory
|
||||||
|
{
|
||||||
|
public pHistory(DateTime w, int cNum)
|
||||||
|
{
|
||||||
|
When = w;
|
||||||
|
Players = cNum;
|
||||||
|
}
|
||||||
|
public DateTime When { get; private set; }
|
||||||
|
public int Players { get; private set; }
|
||||||
|
}
|
||||||
|
}
|
@ -97,6 +97,7 @@
|
|||||||
<Compile Include="Event.cs" />
|
<Compile Include="Event.cs" />
|
||||||
<Compile Include="File.cs" />
|
<Compile Include="File.cs" />
|
||||||
<Compile Include="Heartbeat.cs" />
|
<Compile Include="Heartbeat.cs" />
|
||||||
|
<Compile Include="Helpers.cs" />
|
||||||
<Compile Include="Log.cs" />
|
<Compile Include="Log.cs" />
|
||||||
<Compile Include="Main.cs" />
|
<Compile Include="Main.cs" />
|
||||||
<Compile Include="Maps.cs" />
|
<Compile Include="Maps.cs" />
|
||||||
@ -130,6 +131,9 @@
|
|||||||
<Content Include="webfront\footer.html">
|
<Content Include="webfront\footer.html">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="webfront\graph.html">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="webfront\header.html">
|
<Content Include="webfront\header.html">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
@ -146,7 +150,7 @@
|
|||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="config\messages.cfg">
|
<Content Include="config\messages.cfg">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="config\rules.cfg">
|
<Content Include="config\rules.cfg">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
@ -39,7 +39,7 @@ namespace IW4MAdmin
|
|||||||
Skills = new Moserware.TrueSkill();
|
Skills = new Moserware.TrueSkill();
|
||||||
statusPlayers = new Dictionary<string, Player>();
|
statusPlayers = new Dictionary<string, Player>();
|
||||||
chatHistory = new List<Chat>();
|
chatHistory = new List<Chat>();
|
||||||
playerHistory = new Queue<int>();
|
playerHistory = new Queue<pHistory>();
|
||||||
lastWebChat = DateTime.Now;
|
lastWebChat = DateTime.Now;
|
||||||
nextMessage = 0;
|
nextMessage = 0;
|
||||||
initCommands();
|
initCommands();
|
||||||
@ -529,9 +529,15 @@ namespace IW4MAdmin
|
|||||||
isRunning = true;
|
isRunning = true;
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
// Random rnd = new Random();
|
/* Random rnd = new Random();
|
||||||
// while (playerHistory.Count < 144)
|
DateTime testTOD = DateTime.Now;
|
||||||
// playerHistory.Enqueue(rnd.Next(0, 18));
|
while (playerHistory.Count < 144)
|
||||||
|
{
|
||||||
|
playerHistory.Enqueue(new pHistory(testTOD, rnd.Next(14, 19)));
|
||||||
|
testTOD = testTOD.AddMinutes(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("There are " + playerHistory.Count + " player counts");*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Handles new rcon requests in a fashionable manner
|
//Handles new rcon requests in a fashionable manner
|
||||||
@ -579,9 +585,9 @@ namespace IW4MAdmin
|
|||||||
|
|
||||||
if ((lastCount - playerCountStart).TotalMinutes > 4)
|
if ((lastCount - playerCountStart).TotalMinutes > 4)
|
||||||
{
|
{
|
||||||
while (playerHistory.Count > 144 )
|
while (playerHistory.Count > 144 ) // 12 times a minute for 12 hours
|
||||||
playerHistory.Dequeue();
|
playerHistory.Dequeue();
|
||||||
playerHistory.Enqueue(clientnum);
|
playerHistory.Enqueue(new pHistory(lastCount, clientnum));
|
||||||
playerCountStart = DateTime.Now;
|
playerCountStart = DateTime.Now;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1406,7 +1412,7 @@ namespace IW4MAdmin
|
|||||||
public int totalKills = 0;
|
public int totalKills = 0;
|
||||||
public List<Report> Reports;
|
public List<Report> Reports;
|
||||||
public List<Chat> chatHistory;
|
public List<Chat> chatHistory;
|
||||||
public Queue<int> playerHistory;
|
public Queue<pHistory> playerHistory;
|
||||||
|
|
||||||
|
|
||||||
//Info
|
//Info
|
||||||
|
@ -463,19 +463,20 @@ namespace IW4MAdmin_Web
|
|||||||
test.Append("<script type='text/javascript' src='//www.google.com/jsapi'></script><div id='chart_div'></div>");
|
test.Append("<script type='text/javascript' src='//www.google.com/jsapi'></script><div id='chart_div'></div>");
|
||||||
test.Append("<script> var players = [");
|
test.Append("<script> var players = [");
|
||||||
int count = 1;
|
int count = 1;
|
||||||
DateTime prev = DateTime.Now;
|
List<IW4MAdmin.pHistory> run = IW4MAdmin.Program.Servers[server].playerHistory.ToList();
|
||||||
foreach (int i in IW4MAdmin.Program.Servers[server].playerHistory.ToArray())
|
foreach (IW4MAdmin.pHistory i in run) //need to reverse for proper timeline
|
||||||
{
|
{
|
||||||
test.AppendFormat("[[{0},{1},{2}], {3}]", prev.Hour, prev.Minute, prev.Second, i);
|
test.AppendFormat("[new Date({0}, {1}, {2}, {3}, {4}), {5}]", i.When.Year, i.When.Month - 1, i.When.Day, i.When.Hour, i.When.Minute, i.Players);
|
||||||
prev = prev.AddMinutes(-5);
|
|
||||||
if (count < IW4MAdmin.Program.Servers[server].playerHistory.Count)
|
if (count < IW4MAdmin.Program.Servers[server].playerHistory.Count)
|
||||||
test.Append(',');
|
test.Append(",\n");
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
test.Append("];\n");
|
test.Append("];\n");
|
||||||
test.Append("</script>");
|
test.Append("</script>");
|
||||||
test.Append("<script>function drawBasic(){var a=new google.visualization.DataTable;a.addColumn('timeofday','Time'),a.addColumn('number','Players'),a.addRows(players);var e={ hAxis:{title:'Time', gridlines: {count:10}}, vAxis:{title:'Players'}, vAxis: {viewWindow: {max:18}, gridlines: {count:7}}},i=new google.visualization.LineChart(document.getElementById('chart_div'));i.draw(a,e)}google.load('visualization','1',{ callback: drawBasic, packages:['corechart','line']});</script>");
|
IW4MAdmin.file Graph = new IW4MAdmin.file("webfront\\graph.html");
|
||||||
body = test.ToString();
|
var graph = Graph.getLines();
|
||||||
|
Graph.Close();
|
||||||
|
body = test.ToString() + graph ;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (request.QueryString == "player")
|
else if (request.QueryString == "player")
|
||||||
@ -500,8 +501,8 @@ namespace IW4MAdmin_Web
|
|||||||
IW4MAdmin.Player P = IW4MAdmin.Program.Servers[server].clientDB.getPlayer(IP);
|
IW4MAdmin.Player P = IW4MAdmin.Program.Servers[server].clientDB.getPlayer(IP);
|
||||||
if (P == null)
|
if (P == null)
|
||||||
P = new IW4MAdmin.Player("Guest", "Guest", 0, 0);
|
P = new IW4MAdmin.Player("Guest", "Guest", 0, 0);
|
||||||
if (P.getLevel() > IW4MAdmin.Player.Permission.Flagged)
|
// if (P.getLevel() > IW4MAdmin.Player.Permission.Flagged)
|
||||||
Console.WriteLine(P.getName() + " is authenticated");
|
// Console.WriteLine(P.getName() + " is authenticate");
|
||||||
|
|
||||||
Client toSend = new Client(WebFront.Page.player, page, request.Headers, Data, P);
|
Client toSend = new Client(WebFront.Page.player, page, request.Headers, Data, P);
|
||||||
body = Macro.findMacros(header + player + footer, toSend, server);
|
body = Macro.findMacros(header + player + footer, toSend, server);
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
VERSION: 0.9
|
VERSION: 0.9.1
|
||||||
|
CHANGELOG:
|
||||||
|
fixed issue with `history` timelime
|
||||||
|
|
||||||
|
VERSION: 0.9
|
||||||
CHANGELOG:
|
CHANGELOG:
|
||||||
-webfront now displays player info and link to repz account
|
-webfront now displays player info and link to repz account
|
||||||
-webfront shows ips for authed admin ( determined by ip )
|
-webfront shows ips for authed admin ( determined by ip )
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
$("#history_dialog").dialog({
|
$("#history_dialog").dialog({
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
modal: true,
|
modal: true,
|
||||||
width: 1000,
|
width: 1100,
|
||||||
height: 350,
|
height: 450,
|
||||||
buttons: {
|
buttons: {
|
||||||
"Dismiss": function () {
|
"Dismiss": function () {
|
||||||
$(this).dialog("close");
|
$(this).dialog("close");
|
||||||
|
58
Admin/webfront/graph.html
Normal file
58
Admin/webfront/graph.html
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
<script type="text/javascript" src="//www.google.com/jsapi"></script>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
google.load('visualization', '1', { callback: drawChart, packages: ['corechart'] });
|
||||||
|
google.setOnLoadCallback(drawChart);
|
||||||
|
|
||||||
|
function drawChart() {
|
||||||
|
|
||||||
|
var data = new google.visualization.DataTable();
|
||||||
|
data.addColumn('datetime', 'Time');
|
||||||
|
data.addColumn('number', 'Players');
|
||||||
|
|
||||||
|
data.addRows(players);
|
||||||
|
|
||||||
|
var options = {
|
||||||
|
//curveType: 'function',
|
||||||
|
//width: 900,
|
||||||
|
height: 300,
|
||||||
|
legend: {position: 'none'},
|
||||||
|
enableInteractivity: true,
|
||||||
|
chartArea: {
|
||||||
|
width: '93%'
|
||||||
|
},
|
||||||
|
vAxis: {
|
||||||
|
title: 'Players',
|
||||||
|
gridlines: { count: 7 },
|
||||||
|
viewWindowMode: 'explicit',
|
||||||
|
viewWindow: {
|
||||||
|
min: 0,
|
||||||
|
max: 18
|
||||||
|
},
|
||||||
|
},
|
||||||
|
hAxis: {
|
||||||
|
viewWindow: {
|
||||||
|
//min: players[0][0],
|
||||||
|
//max: players[players.length-1][0]
|
||||||
|
},
|
||||||
|
gridlines: {
|
||||||
|
count: 12,
|
||||||
|
units: {
|
||||||
|
days: {format: ["MMM dd"]},
|
||||||
|
hours: {format: ["HH:mm", "ha"]},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
minorGridlines: {
|
||||||
|
count: 5,
|
||||||
|
units: {
|
||||||
|
hours: {format: ["hh:mm:ss a", "ha"]},
|
||||||
|
minutes: {format: ["HH:mm a Z", ":mm"]}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
|
||||||
|
chart.draw(data, options);
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
Reference in New Issue
Block a user