diff --git a/Admin/App.config b/Admin/App.config
index fe52a9bf4..d229c2d91 100644
--- a/Admin/App.config
+++ b/Admin/App.config
@@ -1,6 +1,6 @@
-
-
+
+
diff --git a/Admin/Bans.cs b/Admin/Bans.cs
index c2dc9c62f..266e83928 100644
--- a/Admin/Bans.cs
+++ b/Admin/Bans.cs
@@ -37,7 +37,12 @@ namespace IW4MAdmin
public String getWhen()
{
- return When.ToString("yyyy-MM-dd HH:mm:ss"); ;
+ return When.ToString("MM/dd/yy HH:mm:ss"); ;
+ }
+
+ public DateTime getTime()
+ {
+ return When;
}
private String Reason;
diff --git a/Admin/Command.cs b/Admin/Command.cs
index a191a0e6f..f833f5b84 100644
--- a/Admin/Command.cs
+++ b/Admin/Command.cs
@@ -154,7 +154,6 @@ namespace IW4MAdmin
E.Target.tempBan(Message);
else
E.Origin.Tell("You cannot temp ban " + E.Target.getName());
-
}
}
@@ -171,7 +170,7 @@ namespace IW4MAdmin
if (E.Owner.Website == null)
Message = "^1Player Banned: ^5" + E.Target.LastOffense;
else
- Message = "^1Player Banned: ^5" + E.Target.LastOffense + "^7 (appeal at " + E.Owner.Website + ")";
+ Message = "^1Player Banned: ^5" + E.Target.LastOffense + "^7 (appeal at nbsclan.org)";
if (E.Origin.getLevel() > E.Target.getLevel())
{
E.Target.Ban(Message, E.Origin);
@@ -203,7 +202,7 @@ namespace IW4MAdmin
public override void Execute(Event E)
{
- String You = String.Format("{0} [^3{1}^7] {{2}} {{3}} [{4}^7] IP: {5}", E.Origin.getName(), E.Origin.getClientNum(), E.Origin.getID(), Utilities.levelToColor(E.Origin.getLevel()), E.Origin.getDBID(), E.Origin.getIP());
+ String You = String.Format("{0} [^3#{1}^7] {2} [^3@{3}^7] [{4}^7] IP: {5}", E.Origin.getName(), E.Origin.getClientNum(), E.Origin.getID(), E.Origin.getDBID(), Utilities.levelToColor(E.Origin.getLevel()), E.Origin.getIP());
E.Origin.Tell(You);
}
@@ -260,7 +259,7 @@ namespace IW4MAdmin
if (E.Origin.getLevel() >= C.getNeededPerm())
{
_commands = _commands + " [^3" + C.getName() + "^7] ";
- if (count >= 3)
+ if (count >= 4)
{
E.Origin.Tell(_commands);
_commands = String.Empty;
@@ -359,7 +358,7 @@ namespace IW4MAdmin
{
foreach (Player P in E.Owner.getPlayers())
{
- if (P != null && P.getLevel() > Player.Permission.User)
+ if (P != null && P.getLevel() > Player.Permission.User && !P.Masked)
{
E.Origin.Tell(String.Format("[^3{0}^7] {1}", Utilities.levelToColor(P.getLevel()), P.getName()));
}
@@ -421,46 +420,10 @@ namespace IW4MAdmin
foreach (Player P in db_players)
{
- String mesg;
- P.Alias = E.Owner.aliasDB.getPlayer(P.getDBID());
-
- if (P.getLevel() == Player.Permission.Banned)
- mesg = String.Format("[^3{0}^7] [^3@{1}^7] - {2} [{3}^7] - {4}", P.getName(), P.getDBID(), P.getID(), Utilities.levelToColor(P.getLevel()), P.getLastO());
- else
- mesg = String.Format("[^3{0}^7] [^3@{1}^7] - {2} [{3}^7]", P.getName(), P.getDBID(), P.getID(), Utilities.levelToColor(P.getLevel()));
-
+ String mesg = String.Format("[^3{0}^7] [^3@{1}^7] - [{2}^7] - {3} | last seen {4} ago", P.getName(), P.getDBID(), Utilities.levelToColor(P.getLevel()), P.getIP(), P.getLastConnection());
E.Origin.Tell(mesg);
-
- if (P.Alias == null)
- continue;
-
- if (P.Alias.getNames() != null)
- {
- mesg = "Aliases: ";
- foreach (String S in P.Alias.getNames())
- {
- if (S != String.Empty)
- mesg += S + " | ";
- }
- E.Origin.Tell(mesg);
- }
-
- if (P.Alias.getIPS() != null)
- {
- mesg = "IPs: ";
- foreach (String IP in P.Alias.getIPS())
- {
- if (IP.Split('.').Length > 3 && IP != String.Empty)
- mesg += IP + " | ";
- }
-
- E.Origin.Tell(mesg);
-
- }
}
-
}
-
}
class Rules : Command
@@ -477,7 +440,6 @@ namespace IW4MAdmin
E.Origin.Tell("- " + r);
}
}
-
}
class PrivateMessage : Command
@@ -487,6 +449,7 @@ namespace IW4MAdmin
public override void Execute(Event E)
{
E.Data = Utilities.removeWords(E.Data, 1);
+ E.Target.Alert();
E.Target.Tell("^1" + E.Origin.getName() + " ^3[PM]^7 - " + E.Data);
E.Origin.Tell(String.Format("To ^3{0} ^7-> {1}", E.Target.getName(), E.Data));
}
@@ -499,12 +462,20 @@ namespace IW4MAdmin
public override void Execute(Event E)
{
if (E.Target == null)
- E.Origin.Tell(String.Format("^5{0} ^7KILLS | ^5{1} ^7DEATHS | ^5{2} ^7KDR | ^5{3} ^7SKILL", E.Origin.stats.Kills, E.Origin.stats.Deaths, E.Origin.stats.KDR, E.Origin.stats.Skill));
- else
{
if (E.Target.stats == null)
- E.Target.stats = E.Owner.statDB.getStats(E.Target.getDBID());
- E.Origin.Tell(String.Format("[^3{4}^7] ^5{0} ^7KILLS | ^5{1} ^7DEATHS | ^5{2} ^7KDR | ^5{3} ^7SKILL", E.Target.stats.Kills, E.Target.stats.Deaths, E.Target.stats.KDR, E.Target.stats.Skill, E.Target.getName()));
+ E.Origin.Tell("You do not have any stats!");
+ else
+ E.Origin.Tell(String.Format("^5{0} ^7KILLS | ^5{1} ^7DEATHS | ^5{2} ^7KDR | ^5{3} ^7SKILL", E.Origin.stats.Kills, E.Origin.stats.Deaths, E.Origin.stats.KDR, E.Origin.stats.Skill));
+ }
+
+ else
+ {
+ E.Target.stats = E.Owner.statDB.getStats(E.Target.getDBID());
+ if (E.Target.stats == null)
+ E.Origin.Tell("That person does not have any stats at this time!");
+ else
+ E.Origin.Tell(String.Format("[^3{4}^7] ^5{0} ^7KILLS | ^5{1} ^7DEATHS | ^5{2} ^7KDR | ^5{3} ^7SKILL", E.Target.stats.Kills, E.Target.stats.Deaths, E.Target.stats.KDR, E.Target.stats.Skill, E.Target.getName()));
}
}
}
@@ -527,6 +498,7 @@ namespace IW4MAdmin
TopP.Add(P);
}
}
+
if (TopP.Count > 0)
{
E.Origin.Tell("^1TOP PLAYERS");
@@ -536,6 +508,7 @@ namespace IW4MAdmin
E.Origin.Tell(String.Format("^3{0}^7 - ^5{1} ^7KDR | ^5{2} ^7SKILL", P.getName(), P.stats.KDR, P.stats.Skill));
}
}
+
else
E.Origin.Tell("There are no top players yet!");
}
@@ -608,6 +581,12 @@ namespace IW4MAdmin
public override void Execute(Event E)
{
+ if (E.Target == E.Origin)
+ {
+ E.Origin.Tell("You cannot report yourself, silly.");
+ return;
+ }
+
if (E.Target.getLevel() > E.Origin.getLevel())
{
E.Origin.Tell("You cannot report " + E.Target.getName());
@@ -655,5 +634,121 @@ namespace IW4MAdmin
E.Owner.RCON.addRCON(String.Format("admin_lastevent tell;{0};{1};{2}", E.Origin.getID(), E.Target.getID(), E.Data));
}
}
+
+ class Mask : Command
+ {
+ public Mask(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
+
+ public override void Execute(Event E)
+ {
+ if (E.Origin.Masked)
+ {
+ E.Origin.Masked = false;
+ E.Origin.Tell("You are now unmasked");
+ }
+ else
+ {
+ E.Origin.Masked = true;
+ E.Origin.Tell("You are now masked");
+ }
+ }
+ }
+
+ class BanInfo : Command
+ {
+ public BanInfo(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
+
+ public override void Execute(Event E)
+ {
+ if (E.Target == null)
+ {
+ E.Origin.Tell("No bans for that player.");
+ return;
+ }
+
+ Ban B = E.Owner.Bans.Find(b => b.getID().Equals(E.Target.getID()));
+
+ if (B == null)
+ {
+ E.Origin.Tell("No active ban was found for that player.");
+ return;
+ }
+
+ Player Banner = E.Owner.clientDB.getPlayer(B.getBanner(), -1);
+
+ if (Banner == null)
+ {
+ E.Origin.Tell("Ban was found for the player, but origin of the ban is unavailable.");
+ return;
+ }
+
+ E.Origin.Tell(String.Format("^1{0} ^7was banned by ^5{1} ^7for: {2}", E.Target.getName(), Banner.getName(), B.getReason()));
+ }
+ }
+
+ class Alias : Command
+ {
+ public Alias(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
+
+ public override void Execute(Event E)
+ {
+ E.Target.Alias = E.Owner.aliasDB.getPlayer(E.Target.getDBID());
+
+ if (E.Target.Alias == null)
+ {
+ E.Target.Tell("Could not find alias info for that player.");
+ return;
+ }
+
+ E.Target.Tell("[^3" + E.Target.getName() + "^7]");
+ StringBuilder message = new StringBuilder();
+
+ List playerAliases = new List();
+ E.Owner.getAliases(playerAliases, E.Target);
+
+ // if (E.Target.Alias.getNames() != null)
+ {
+ message.Append("Aliases: ");
+
+ foreach (Player P in playerAliases)
+ {
+ foreach (String S in P.Alias.getNames())
+ {
+ if (S != String.Empty && S != E.Target.getName())
+ message.Append(S + " | ");
+ }
+ }
+ E.Origin.Tell(message.ToString());
+ }
+
+ if (E.Target.Alias.getIPS() != null)
+ {
+ message.Append("IPS: ");
+
+ foreach (Player P2 in playerAliases)
+ {
+ foreach (String IP in P2.Alias.getIPS())
+ {
+ if (IP.Split('.').Length > 3 && IP != String.Empty && !message.ToString().Contains(IP))
+ message.Append (IP + " | ");
+ }
+ }
+
+ E.Origin.Tell(message.ToString());
+ }
+ }
+ }
+
+ class _RCON : Command
+ {
+ public _RCON(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
+
+ public override void Execute(Event E)
+ {
+ String[] Response = E.Owner.RCON.addRCON(E.Data.Trim());
+ if (Response.Length > 0)
+ E.Origin.Tell("Successfuly sent RCON command!");
+ }
+ }
}
\ No newline at end of file
diff --git a/Admin/Database.cs b/Admin/Database.cs
index 218f5a847..40353ac3d 100644
--- a/Admin/Database.cs
+++ b/Admin/Database.cs
@@ -79,11 +79,17 @@ namespace IW4MAdmin
protected int ExecuteNonQuery(String Request)
{
waitForClose();
- Con.Open();
- SQLiteCommand CMD = new SQLiteCommand(Con);
- CMD.CommandText = Request;
- int rowsUpdated = CMD.ExecuteNonQuery();
- Con.Close();
+ int rowsUpdated = 0;
+
+ lock (Con)
+ {
+ Con.Open();
+ SQLiteCommand CMD = new SQLiteCommand(Con);
+ CMD.CommandText = Request;
+ rowsUpdated = CMD.ExecuteNonQuery();
+ Con.Close();
+ }
+
return rowsUpdated;
}
@@ -93,13 +99,17 @@ namespace IW4MAdmin
try
{
waitForClose();
- Con.Open();
- SQLiteCommand mycommand = new SQLiteCommand(Con);
- mycommand.CommandText = sql;
- SQLiteDataReader reader = mycommand.ExecuteReader();
- dt.Load(reader);
- reader.Close();
- Con.Close();
+ lock (Con)
+ {
+ Con.Open();
+ SQLiteCommand mycommand = new SQLiteCommand(Con);
+ mycommand.CommandText = sql;
+ SQLiteDataReader reader = mycommand.ExecuteReader();
+ dt.Load(reader);
+ reader.Close();
+ Con.Close();
+ }
+
}
catch (Exception e)
{
@@ -134,7 +144,7 @@ namespace IW4MAdmin
{
if(!File.Exists(FileName))
{
- String Create = "CREATE TABLE [CLIENTS] ( [Name] TEXT NULL, [npID] TEXT NULL, [Number] INTEGER PRIMARY KEY AUTOINCREMENT, [Level] INT DEFAULT 0 NULL, [LastOffense] TEXT NULL, [Connections] INT DEFAULT 1 NULL, [IP] TEXT NULL);";
+ String Create = "CREATE TABLE [CLIENTS] ( [Name] TEXT NULL, [npID] TEXT NULL, [Number] INTEGER PRIMARY KEY AUTOINCREMENT, [Level] INT DEFAULT 0 NULL, [LastOffense] TEXT NULL, [Connections] INT DEFAULT 1 NULL, [IP] TEXT NULL, [LastConnection] TEXT NULL);";
ExecuteNonQuery(Create);
Create = "CREATE TABLE [BANS] ( [Reason] TEXT NULL, [npID] TEXT NULL, [bannedByID] TEXT NULL, [IP] TEXT NULL, [TIME] TEXT NULL);";
ExecuteNonQuery(Create);
@@ -150,12 +160,18 @@ namespace IW4MAdmin
if (Result != null && Result.Rows.Count > 0)
{
DataRow ResponseRow = Result.Rows[0];
-
-
- // if (ResponseRow["IP"].ToString().Length < 2)
- // ResponseRow["IP"] = DateTime.Now.ToString(); // because aliases and backwards compatibility
+ DateTime LC;
- return new Player(ResponseRow["Name"].ToString(), ResponseRow["npID"].ToString(), cNum, (Player.Permission)(ResponseRow["Level"]), Convert.ToInt32(ResponseRow["Number"]), ResponseRow["LastOffense"].ToString(), (int)ResponseRow["Connections"], ResponseRow["IP"].ToString());
+ try
+ {
+ LC = DateTime.Parse(ResponseRow["LastConnection"].ToString());
+ }
+ catch (Exception)
+ {
+ LC = DateTime.Now;
+ }
+
+ return new Player(ResponseRow["Name"].ToString(), ResponseRow["npID"].ToString(), cNum, (Player.Permission)(ResponseRow["Level"]), Convert.ToInt32(ResponseRow["Number"]), ResponseRow["LastOffense"].ToString(), (int)ResponseRow["Connections"], ResponseRow["IP"].ToString(), LC);
}
else
@@ -171,11 +187,17 @@ namespace IW4MAdmin
if (Result != null && Result.Rows.Count > 0)
{
DataRow p = Result.Rows[0];
+ DateTime LC;
+ try
+ {
+ LC = DateTime.Parse(p["LastConnection"].ToString());
+ }
+ catch (Exception)
+ {
+ LC = DateTime.Now;
+ }
- // if (p["IP"].ToString().Length < 2)
- // p["IP"] = DateTime.Now.ToString(); // because aliases and backwards compatibility
-
- return new Player(p["Name"].ToString(), p["npID"].ToString(), -1, (Player.Permission)(p["Level"]), Convert.ToInt32(p["Number"]), p["LastOffense"].ToString(), Convert.ToInt32(p["Connections"]), p["IP"].ToString());
+ return new Player(p["Name"].ToString(), p["npID"].ToString(), -1, (Player.Permission)(p["Level"]), Convert.ToInt32(p["Number"]), p["LastOffense"].ToString(), Convert.ToInt32(p["Connections"]), p["IP"].ToString(), LC);
}
else
@@ -194,7 +216,17 @@ namespace IW4MAdmin
{
foreach (DataRow p in Result.Rows)
{
- Players.Add(new Player(p["Name"].ToString(), p["npID"].ToString(), -1, (Player.Permission)(p["Level"]), Convert.ToInt32(p["Number"]), p["LastOffense"].ToString(), Convert.ToInt32(p["Connections"]), p["IP"].ToString()));
+ DateTime LC;
+ try
+ {
+ LC = DateTime.Parse(p["LastConnection"].ToString());
+ }
+ catch (Exception)
+ {
+ LC = DateTime.Now;
+ }
+
+ Players.Add(new Player(p["Name"].ToString(), p["npID"].ToString(), -1, (Player.Permission)(p["Level"]), Convert.ToInt32(p["Number"]), p["LastOffense"].ToString(), Convert.ToInt32(p["Connections"]), p["IP"].ToString(), LC));
}
return Players;
}
@@ -206,7 +238,7 @@ namespace IW4MAdmin
//Returns any player with level 4 permissions, null if no owner found
public Player getOwner()
{
- String Query = String.Format("SELECT * FROM CLIENTS WHERE Level = '{0}'", 4);
+ String Query = String.Format("SELECT * FROM CLIENTS WHERE Level >= '{0}'", 4);
DataTable Result = GetDataTable(Query);
if (Result != null && Result.Rows.Count > 0)
@@ -225,14 +257,12 @@ namespace IW4MAdmin
public List getBans()
{
List Bans = new List();
- DataTable Result = GetDataTable("SELECT * FROM BANS");
+ DataTable Result = GetDataTable("SELECT * FROM BANS ORDER BY TIME DESC");
foreach (DataRow Row in Result.Rows)
{
if (Row["TIME"].ToString().Length < 2) //compatibility with my old database
Row["TIME"] = DateTime.Now.ToString();
- // if (Row["IP"].ToString().Length < 2)
- // Row["IP"] = DateTime.Now.ToString(); //because we don't have old ip's and don't want a messy alias
Bans.Add(new Ban(Row["Reason"].ToString(), Row["npID"].ToString(), Row["bannedByID"].ToString(), DateTime.Parse(Row["TIME"].ToString()), Row["IP"].ToString()));
}
@@ -261,6 +291,7 @@ namespace IW4MAdmin
newPlayer.Add("LastOffense", "");
newPlayer.Add("Connections", 1);
newPlayer.Add("IP", P.getIP());
+ newPlayer.Add("LastConnection", Utilities.DateTimeSQLite(DateTime.Now));
Insert("CLIENTS", newPlayer);
}
@@ -276,6 +307,7 @@ namespace IW4MAdmin
updatedPlayer.Add("LastOffense", P.getLastO());
updatedPlayer.Add("Connections", P.getConnections());
updatedPlayer.Add("IP", P.getIP());
+ updatedPlayer.Add("LastConnection", Utilities.DateTimeSQLite(DateTime.Now));
Update("CLIENTS", updatedPlayer, String.Format("npID = '{0}'", P.getID()));
}
@@ -314,7 +346,7 @@ namespace IW4MAdmin
{
if (!File.Exists(FileName))
{
- String Create = "CREATE TABLE [STATS] ( [Number] INTEGER, [KILLS] INTEGER DEFAULT 0, [DEATHS] INTEGER DEFAULT 0, [KDR] REAL DEFAULT 0, [SKILL] REAL DEFAULT 0 );";
+ String Create = "CREATE TABLE [STATS] ( [Number] INTEGER, [KILLS] INTEGER DEFAULT 0, [DEATHS] INTEGER DEFAULT 0, [KDR] REAL DEFAULT 0, [SKILL] REAL DEFAULT 0, [MEAN] REAL DEFAULT 0, [DEV] REAL DEFAULT 0 );";
ExecuteNonQuery(Create);
}
}
@@ -328,11 +360,18 @@ namespace IW4MAdmin
if (Result != null && Result.Rows.Count > 0)
{
DataRow ResponseRow = Result.Rows[0];
- return new Stats(Convert.ToInt32(ResponseRow["KILLS"]), Convert.ToInt32(ResponseRow["DEATHS"]), Convert.ToDouble(ResponseRow["KDR"]), Convert.ToDouble(ResponseRow["SKILL"]));
+ if (ResponseRow["MEAN"] == DBNull.Value)
+ ResponseRow["MEAN"] = 25;
+ if (ResponseRow["DEV"] == DBNull.Value)
+ ResponseRow["DEV"] = 8;
+ if (ResponseRow["SKILL"] == DBNull.Value)
+ ResponseRow["SKILL"] = 0;
+
+ return new Stats(Convert.ToInt32(ResponseRow["Number"]), Convert.ToInt32(ResponseRow["KILLS"]), Convert.ToInt32(ResponseRow["DEATHS"]), Convert.ToDouble(ResponseRow["KDR"]), Convert.ToDouble(ResponseRow["SKILL"]), Convert.ToDouble(ResponseRow["MEAN"]), Convert.ToDouble(ResponseRow["DEV"]));
}
else
- return null;
+ return new Stats(0, 0, 0, 0, 0, 25, 8.3333);
}
public void addPlayer(Player P)
@@ -343,7 +382,9 @@ namespace IW4MAdmin
newPlayer.Add("KILLS", 0);
newPlayer.Add("DEATHS", 0);
newPlayer.Add("KDR", 0);
- newPlayer.Add("SKILL", 1);
+ newPlayer.Add("SKILL", Moserware.Skills.GameInfo.DefaultGameInfo.DefaultRating.ConservativeRating);
+ newPlayer.Add("MEAN", Moserware.Skills.GameInfo.DefaultGameInfo.DefaultRating.Mean);
+ newPlayer.Add("DEV", Moserware.Skills.GameInfo.DefaultGameInfo.DefaultRating.StandardDeviation);
Insert("STATS", newPlayer);
}
@@ -357,6 +398,8 @@ namespace IW4MAdmin
updatedPlayer.Add("DEATHS", P.stats.Deaths);
updatedPlayer.Add("KDR", Math.Round(P.stats.KDR, 2));
updatedPlayer.Add("SKILL", P.stats.Skill);
+ updatedPlayer.Add("MEAN", P.stats.Rating.Mean);
+ updatedPlayer.Add("DEV", P.stats.Rating.StandardDeviation);
Update("STATS", updatedPlayer, String.Format("Number = '{0}'", P.getDBID()));
}
@@ -364,7 +407,7 @@ namespace IW4MAdmin
//Returns top 8 players (we filter through them later)
public List topStats()
{
- String Query = String.Format("SELECT * FROM STATS WHERE SKILL > '{0}' ORDER BY SKILL DESC LIMIT 8", 10);
+ String Query = String.Format("SELECT * FROM STATS WHERE SKILL > '{0}' ORDER BY SKILL DESC LIMIT 5", 230);
DataTable Result = GetDataTable(Query);
List Top = new List();
@@ -373,8 +416,16 @@ namespace IW4MAdmin
{
foreach (DataRow D in Result.Rows)
{
- Stats S = new Stats(Convert.ToInt32(D["Number"]), Convert.ToInt32(D["DEATHS"]), Convert.ToDouble(D["KDR"]), Convert.ToDouble(D["SKILL"]));
- if (S.Skill > 10)
+ if (D["MEAN"] == 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);
}
}
@@ -382,6 +433,42 @@ namespace IW4MAdmin
return Top;
}
+ public List getMultipleStats(int start, int length)
+ {
+ String Query = String.Format("SELECT * FROM STATS ORDER BY SKILL DESC LIMIT '{0}' OFFSET '{1}'", length, start);
+ DataTable Result = GetDataTable(Query);
+
+ List Stats = new List();
+
+ if (Result != null && Result.Rows.Count > 0)
+ {
+ foreach (DataRow D in Result.Rows)
+ {
+ if (D["MEAN"] == 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"]));
+ Stats.Add(S);
+ }
+ }
+
+ return Stats;
+ }
+
+ public int totalStats()
+ {
+ DataTable Result = GetDataTable("SELECT * from STATS ORDER BY Number DESC LIMIT 1");
+ if (Result.Rows.Count > 0)
+ return Convert.ToInt32(Result.Rows[0]["Number"]);
+ else
+ return 0;
+ }
+
public void clearSkill()
{
String Query = "SELECT * FROM STATS";
@@ -423,6 +510,21 @@ namespace IW4MAdmin
return null;
}
+ public List getPlayer(String IP)
+ {
+ String Query = String.Format("SELECT * FROM ALIASES WHERE IPS LIKE '%{0}%'", IP);
+ DataTable Result = GetDataTable(Query);
+ List players = new List();
+
+ if (Result != null && Result.Rows.Count > 0)
+ {
+ foreach (DataRow p in Result.Rows)
+ players.Add(new Aliases(Convert.ToInt32(p["Number"]), p["NAMES"].ToString(), p["IPS"].ToString()));
+ }
+
+ return players;
+ }
+
public void addPlayer(Aliases Alias)
{
Dictionary newPlayer = new Dictionary();
diff --git a/Admin/Event.cs b/Admin/Event.cs
index 19563b17a..510808fe9 100644
--- a/Admin/Event.cs
+++ b/Admin/Event.cs
@@ -66,24 +66,19 @@ namespace IW4MAdmin
eventType = eventType.Trim();
if (eventType == "J")
- return new Event(GType.Connect, null, SV.clientFromLine(line, 3, true), null, SV);
+ return new Event(GType.Connect, null, SV.clientFromEventLine(line, 2), null, SV);
if (eventType == "Q")
- return new Event(GType.Disconnect, null, SV.getPlayers()[Convert.ToInt16(line[2])], null, null);
+ return new Event(GType.Disconnect, null, SV.clientFromEventLine(line, 2), null, SV);
if (eventType == "K")
- return new Event(GType.Kill, line[9], SV.clientFromLineArr(line, true), SV.clientFromLineArr(line, false), null);
+ return new Event(GType.Kill, line[9], SV.clientFromEventLine(line, 6), SV.clientFromEventLine(line, 2), SV);
if (line[0].Substring(line[0].Length - 3).Trim() == "say")
{
- if (line.Length < 4)
- {
- Console.WriteLine("SAY FUCKED UP BIG-TIME");
- return null;
- }
Regex rgx = new Regex("[^a-zA-Z0-9 -! -_]");
string message = rgx.Replace(line[4], "");
- return new Event(GType.Say, Utilities.removeNastyChars(message), SV.clientFromLine(line, 3, false), null, null);
+ return new Event(GType.Say, Utilities.removeNastyChars(message), SV.clientFromEventLine(line, 2), null, SV);
}
if (eventType == ":")
diff --git a/Admin/File.cs b/Admin/File.cs
index 98fd3f3fa..d6c96c445 100644
--- a/Admin/File.cs
+++ b/Admin/File.cs
@@ -112,11 +112,17 @@ namespace IW4MAdmin
return encoding.GetString(buffer);
}
}
+
public String[] readAll()
{
return Handle.ReadToEnd().Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
}
+ public String getLines()
+ {
+ return Handle.ReadToEnd();
+ }
+
public String[] end(int neededLines)
{
var lines = new List();
diff --git a/Admin/Heartbeat.cs b/Admin/Heartbeat.cs
index 8fd6e601c..c43560873 100644
--- a/Admin/Heartbeat.cs
+++ b/Admin/Heartbeat.cs
@@ -14,7 +14,7 @@ namespace IW4MAdmin
public void Send()
{
- String URI = String.Format("http://raidmax.org/IW4M/Admin/heartbeat.php?address={0}&name={1}&map={2}&players={3}&version={4}", Instance.getPort().ToString(), Instance.getName(), Instance.getMap(), Instance.getClientNum().ToString() + '/' + Instance.getMaxClients().ToString(), IW4MAdmin.Program.Version.ToString());
+ String URI = String.Format("http://raidmax.org/IW4M/Admin/heartbeat.php?address={0}&name={1}&map={2}&players={3}&version={4}", Instance.getPort().ToString(), Instance.getName(), Instance.getMap(), Instance.statusPlayers.Count.ToString() + '/' + Instance.getMaxClients().ToString(), IW4MAdmin.Program.Version.ToString());
Handle.Request(URI);
}
diff --git a/Admin/IW4M ADMIN.csproj b/Admin/IW4M ADMIN.csproj
index 3ba02d142..b46b6200f 100644
--- a/Admin/IW4M ADMIN.csproj
+++ b/Admin/IW4M ADMIN.csproj
@@ -9,7 +9,7 @@
Properties
IW4MAdmin
IW4MAdmin
- v2.0
+ v4.0
512
true
@@ -78,11 +78,18 @@
IW4MAdmin.Program
+
+ ..\packages\Kayak.0.7.2\lib\Kayak.dll
+
+
+ False
+ bin\Debug\Moserware.Skills.dll
+
-
+
False
- bin\Release\System.Data.SQLite.dll
+ libs\System.Data.SQLite.dll
@@ -110,9 +117,31 @@
+
-
+
+ PreserveNewest
+
+
+
+ PreserveNewest
+
+
+ Always
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
PreserveNewest
@@ -127,6 +156,7 @@
PreserveNewest
+
SettingsSingleFileGenerator
@@ -151,7 +181,8 @@
- copy $(TargetDir)$(TargetFileName) $(SolutionDir)OFFICIAL\NBS\$(TargetFileName)
+ copy $(TargetDir)$(TargetFileName) $(SolutionDir)OFFICIAL\Release\$(TargetFileName)
+copy $(SolutionDir)Admin\version.txt $(SolutionDir)OFFICIAL\Release\version.txt