From dfd5d51a063423d788ab112c694d9e0660b42bdf Mon Sep 17 00:00:00 2001 From: "raidmax@live.com" Date: Fri, 17 Jul 2015 17:53:51 -0500 Subject: [PATCH] Final touches for version 0.9.1 --- Admin/Command.cs | 19 ++++++++----------- Admin/Database.cs | 21 ++++++--------------- Admin/Main.cs | 8 +++++--- Admin/Manager.cs | 2 -- Admin/Server.cs | 32 +++++++++++++++----------------- Admin/WebFront.cs | 9 ++++++--- Admin/lib/AdminInterface.dll | Bin 6656 -> 10752 bytes Admin/version.txt | 4 +++- 8 files changed, 43 insertions(+), 52 deletions(-) diff --git a/Admin/Command.cs b/Admin/Command.cs index 23b4a0f9e..fb82f8d29 100644 --- a/Admin/Command.cs +++ b/Admin/Command.cs @@ -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,20 +740,17 @@ namespace IW4MAdmin List playerAliases = new List(); E.Owner.getAliases(playerAliases, E.Target); - // if (E.Target.Alias.getNames() != null) - { - message.Append("Aliases: "); + message.Append("Aliases: "); - foreach (Player P in playerAliases) + foreach (Player P in playerAliases) + { + foreach (String S in P.Alias.getNames()) { - foreach (String S in P.Alias.getNames()) - { - if (S != String.Empty && S != E.Target.getName()) - message.Append(S + " | "); - } + if (S != String.Empty && S != E.Target.getName()) + message.Append(S + " | "); } - E.Origin.Tell(message.ToString()); } + E.Origin.Tell(message.ToString()); message = new StringBuilder(); diff --git a/Admin/Database.cs b/Admin/Database.cs index 7a2833ce1..8ffa28914 100644 --- a/Admin/Database.cs +++ b/Admin/Database.cs @@ -129,7 +129,6 @@ namespace IW4MAdmin return; } - //END protected String FileName; protected String DBCon; @@ -391,9 +390,7 @@ 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 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 Top = new List(); @@ -477,17 +474,11 @@ namespace IW4MAdmin { foreach (DataRow D in Result.Rows) { - if (D["MEAN"] == DBNull.Value) - continue; - if (D["DEV"] == DBNull.Value) + if (D["MEAN"] == DBNull.Value || D["DEV"] == DBNull.Value || D["SKILL"] == 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); + 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"])); + Top.Add(S); } } diff --git a/Admin/Main.cs b/Admin/Main.cs index 0b36a7f4c..dd6b0029f 100644 --- a/Admin/Main.cs +++ b/Admin/Main.cs @@ -50,9 +50,11 @@ 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 :( - IW4MAdmin_Web.WebFront frontEnd = new IW4MAdmin_Web.WebFront(); - frontEnd.Init(); + if (serverManager.getServers().Count > 0) + { + IW4MAdmin_Web.WebFront frontEnd = new IW4MAdmin_Web.WebFront(); + frontEnd.Init(); + } } #if DEBUG static void setupConfig() diff --git a/Admin/Manager.cs b/Admin/Manager.cs index 4d282b8fe..7f79f67ce 100644 --- a/Admin/Manager.cs +++ b/Admin/Manager.cs @@ -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; diff --git a/Admin/Server.cs b/Admin/Server.cs index f74dd3a5c..3a44098dc 100644 --- a/Admin/Server.cs +++ b/Admin/Server.cs @@ -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,17 +642,19 @@ 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(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; @@ -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 toRemove = new List(); @@ -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; } } diff --git a/Admin/WebFront.cs b/Admin/WebFront.cs index 2264d0151..7d9dd06ee 100644 --- a/Admin/WebFront.cs +++ b/Admin/WebFront.cs @@ -450,7 +450,12 @@ namespace IW4MAdmin_Web Int32.TryParse(req[1], out page); } - if (request.QueryString == "bans") + if (IW4MAdmin.Program.getServers().Length < 1) + { + body = "

IT SEEMS LIKE THERE ARE NO LONGER ANY SERVERS BEING MONITORED!

"; + } + + 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); diff --git a/Admin/lib/AdminInterface.dll b/Admin/lib/AdminInterface.dll index b16bcd923888ccd81b52cf837467183778e10c2d..c237df605e54c8a4b85959d607c936340db4725d 100644 GIT binary patch literal 10752 zcmeHNeN-FQm46Zf%SON?g@n{jEW0?k@s~y;Y#|{d97G^Bjxd-H*S0L90U?7#Ml%H3 z;5v~xjWVWjH|d_Xn|AAx=JX`l#yL$J(x!|C%?mydeGUwd)aqoTi-gobN@4gwScIOe2K?u}x?J043x>4DG0O3*Jour^k%*6U&>wZ19FqQ3a+MX`;jEo)E3Zbx0SwYJLIV=F1@BvzBHCqXeNxfq){n2 zWFk!Dgiapav-@=&pqSdZ{yWn$M#`ePdTU+6${EK$$Nrj3Mrd$mr=0k_K_WgXKbm=n5&jVxi*nI(pSzphb{ z3}dcY>NTan1lwgv5Az3NKU)pvJlC1As{A|<$ExTCA){I3pp8iR+#7Y<<Q3PV$w%z-twp%)^v_}){c)4Td%iAcBRZ|q?XKRq}73fqz&@vq!s>3 z41_81-(Y9V>328A?@|w5X~=4<(%&Nq;*?-S=+ozAgfzVJ6DWxyh#j#j;l z^$<0QhB2qE&`B6989hNeKh>Tupt0$-CkGd6-NEf)+WaiRX1T~NPzK#~4EdVq<{FhZ`J!wNBIXY#;&^S64>0zb2UbxFl1G4$Gp9JA z%d;n`7Rz>%YN}SwT{9!*Hf0=l*C_>u)h#y{1=yX6LSlT%1lmi+0Q%KK=-LABROH)7 z!?!5+GmY_5oQYh_KDuXV?CLo>bl{4V6TM$`jaFVfs+mts3oe?FA5i>8Bo*ILdbqkH zQ-=D+rlSPgpZleI&~@22MDbC6TD}yO;xu{8MBd7y;nK-7lg09${NZPxdFGj`e~^Fm z_Qkh9u)o>!nPEg$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#21=oM|1JJldBwCSWrfN zu02nyty1D z-$hor*RFQg*u=8dKtP#eIi{R0d|A0^vF5+UHnr{E($*eq^0n+}4YYMgOrV9^r`e`>9%x7`YJ5llP09c(o;z< z8)cKcK(@-f?39mhBd%m5w zzhrmY>+Rd^yX}YUzp;O0e_}T~iX6Pd>3G=@a&$TlI1W30>-f-d%`xb>?fBC1)UndJ z+S%xAb^4uU?anuxZ#(xo_d5?c(@y}efb8bq<_GveJ|MIUF0opy5nDx{xL?H69sD<= C0FUMX diff --git a/Admin/version.txt b/Admin/version.txt index 928202d55..627172890 100644 --- a/Admin/version.txt +++ b/Admin/version.txt @@ -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: