Final touches for version 0.9.1

This commit is contained in:
raidmax@live.com 2015-07-17 17:53:51 -05:00
parent f304814ab0
commit dfd5d51a06
8 changed files with 43 additions and 52 deletions

View File

@ -525,7 +525,7 @@ namespace IW4MAdmin
foreach (Stats S in Top)
{
Player P = E.Owner.clientDB.getPlayer(S.Kills); // BAD
Player P = E.Owner.clientDB.getPlayer(S.statIndex);
if (P != null && P.getLevel() != Player.Permission.Banned)
{
P.stats = S;
@ -740,8 +740,6 @@ namespace IW4MAdmin
List<Player> playerAliases = new List<Player>();
E.Owner.getAliases(playerAliases, E.Target);
// if (E.Target.Alias.getNames() != null)
{
message.Append("Aliases: ");
foreach (Player P in playerAliases)
@ -753,7 +751,6 @@ namespace IW4MAdmin
}
}
E.Origin.Tell(message.ToString());
}
message = new StringBuilder();

View File

@ -129,7 +129,6 @@ namespace IW4MAdmin
return;
}
//END
protected String FileName;
protected String DBCon;
@ -392,8 +391,6 @@ namespace IW4MAdmin
String Query = String.Format("DELETE FROM BANS WHERE npID = '{0}' or IP= '%{1}%'", GUID, IP);
ExecuteNonQuery(Query);
}
}
class StatsDB : Database
@ -465,10 +462,10 @@ namespace IW4MAdmin
Update("STATS", updatedPlayer, String.Format("Number = '{0}'", P.getDBID()));
}
//Returns top 8 players (we filter through them later)
//Returns top 5 players (we filter through them later)
public List<Stats> topStats()
{
String Query = String.Format("SELECT * FROM STATS WHERE SKILL > '{0}' ORDER BY SKILL DESC LIMIT 5", 230);
String Query = String.Format("SELECT * FROM STATS WHERE KILLS > '{0}' AND KDR < '{1}' AND SKILL > '{2}' ORDER BY SKILL DESC LIMIT 5", 250, 7, 245);
DataTable Result = GetDataTable(Query);
List<Stats> Top = new List<Stats>();
@ -477,16 +474,10 @@ namespace IW4MAdmin
{
foreach (DataRow D in Result.Rows)
{
if (D["MEAN"] == DBNull.Value)
if (D["MEAN"] == DBNull.Value || D["DEV"] == DBNull.Value || D["SKILL"] == DBNull.Value)
continue;
if (D["DEV"] == DBNull.Value)
continue;
if (D["SKILL"] == DBNull.Value)
D["SKILL"] = 0;
Stats S = new Stats(Convert.ToInt32(D["Number"]), Convert.ToInt32(D["KILLS"]), Convert.ToInt32(D["DEATHS"]), Convert.ToDouble(D["KDR"]), Convert.ToDouble(D["SKILL"]), Convert.ToDouble(D["MEAN"]), Convert.ToDouble(D["DEV"]));
if (S.Skill > 230)
Top.Add(S);
}
}

View File

@ -50,10 +50,12 @@ namespace IW4MAdmin
if (serverManager.getServers() != null)
Console.WriteLine("IW4M Now Initialized! Visit http://127.0.0.1:1624 for server overview.");
//this is blocking so if it goes down :(
if (serverManager.getServers().Count > 0)
{
IW4MAdmin_Web.WebFront frontEnd = new IW4MAdmin_Web.WebFront();
frontEnd.Init();
}
}
#if DEBUG
static void setupConfig()
{

View File

@ -43,8 +43,6 @@ namespace IW4MAdmin
Thread IW4MServerThread = new Thread(IW4MServer.Monitor);
ThreadList.Add(IW4MServer.pID(), IW4MServerThread);
IW4MServerThread.Start();
//mainLog.Write("Now monitoring the server running on port " + IW4MServer.getPort(), Log.Level.All);
}
initialized = true;

View File

@ -236,7 +236,7 @@ namespace IW4MAdmin
aliasDB.updatePlayer(NewPlayer.Alias);
clientDB.updatePlayer(NewPlayer);
Utilities.Wait(10); // they're loading in.
// Utilities.Wait(10); // they're loading in.
if (NewPlayer.getLevel() == Player.Permission.Banned) // their guid is already banned so no need to check aliases
{
@ -513,7 +513,6 @@ namespace IW4MAdmin
events.Enqueue(E);
}
//process new event every 50 milliseconds
private void manageEventQueue()
{
@ -540,7 +539,7 @@ namespace IW4MAdmin
private void setDvar(String Dvar, String Value)
{
// Utilities.setDvar(PID, Dvar, Value);
Utilities.executeCommand(PID, Dvar + " " + Value);
}
[DllImport("kernel32.dll")]
@ -572,19 +571,11 @@ namespace IW4MAdmin
if (!intializeBasics())
{
Log.Write("Stopping " + Port + " due to uncorrectable errors (check log)" + logPath, Log.Level.Production);
Log.Write("Stopping " + Port + " due to uncorrectable errors (check log)", Log.Level.Production);
isRunning = false;
Utilities.Wait(10);
return;
}
#if DEBUG
//Thread to handle polling server for IP's
Thread statusUpdate = new Thread(new ThreadStart(pollServer));
statusUpdate.Start();
#endif
//Handles new events in a fashionable manner
Thread eventQueue = new Thread(new ThreadStart(manageEventQueue));
eventQueue.Start();
@ -651,18 +642,20 @@ namespace IW4MAdmin
{
Byte[] buff = new Byte[681872]; // struct size ( 0.68MB :( )
ReadProcessMemory((int)Handle, 0x31D9390 + (buff.Length)*(i), buff, buff.Length, ref numberRead); // svs_clients start + current client
client_s eachClient = (client_s)Helpers.ReadStruct<client_s>(buff);
if (eachClient.isBot == 1)
continue;
if (eachClient.state == 0)
removePlayer(i);
else if (eachClient.state > 1)
else if (eachClient.state > 2)
{
addPlayer(new Player(Utilities.stripColors(Utilities.cleanChars(eachClient.name)), eachClient.steamid.ToString("x16"), i, 0, i, null, 0, Helpers.NET_AdrToString(eachClient.adr).Split(':')[0]));
if (eachClient.state > 2)
activeClients++;
}
}
lastPoll = DateTime.Now;
clientnum = activeClients;
@ -1090,9 +1083,13 @@ namespace IW4MAdmin
{
Target.setLevel(Player.Permission.Banned);
Ban newBan = new Ban(Target.getLastO(), Target.getID(), Origin.getID(), DateTime.Now, Target.getIP());
Bans.Add(newBan);
clientDB.addBan(newBan);
clientDB.updatePlayer(Target);
foreach (Server S in Program.getServers()) // make sure bans show up on the webfront
S.Bans = S.clientDB.getBans();
lock (Reports) // threading seems to do something weird here
{
List<Report> toRemove = new List<Report>();
@ -1123,7 +1120,8 @@ namespace IW4MAdmin
P.setLevel(Player.Permission.User);
clientDB.updatePlayer(P);
Bans = clientDB.getBans();
foreach (Server S in Program.getServers())
S.Bans = S.clientDB.getBans();
return true;
}
}

View File

@ -450,7 +450,12 @@ namespace IW4MAdmin_Web
Int32.TryParse(req[1], out page);
}
if (request.QueryString == "bans")
if (IW4MAdmin.Program.getServers().Length < 1)
{
body = "<h1 style='font-family: Segoe UI;'>IT SEEMS LIKE THERE ARE NO LONGER ANY SERVERS BEING MONITORED!</h1>";
}
else if (request.QueryString == "bans")
{
IW4MAdmin.file Bans = new IW4MAdmin.file("webfront\\bans.html");
var bans = Bans.getLines();
@ -513,8 +518,6 @@ namespace IW4MAdmin_Web
IW4MAdmin.Player P = IW4MAdmin.Program.getServers()[server].clientDB.getPlayer(IP);
if (P == null)
P = new IW4MAdmin.Player("Guest", "Guest", 0, 0);
// if (P.getLevel() > IW4MAdmin.Player.Permission.Flagged)
// Console.WriteLine(P.getName() + " is authenticate");
Client toSend = new Client(WebFront.Page.player, page, request.Headers, Data, P);
body = Macro.findMacros(header + player + footer, toSend, server);

Binary file not shown.

View File

@ -3,7 +3,9 @@ CHANGELOG:
-fixed issue with `history` timelime
-fixed issue with mapname not being updated
-fixed rare crash related to !list
-now reads memory for player info! ( experimental debug only )
-fixed topstats issues ( prevents cheaters from jumping to the top )
-fixed webfront banlist not updating until tool restart
-now reads memory for player info!
VERSION: 0.9
CHANGELOG: