VERSION 1.1
CHANGELOG: -fixed ban sorting ( and an overlooked bug ) -added kicks and temp-bans to penalty list -bans are now named penalties -readded pubbans page http://127.0.0.1:1624/pubbans -updated RepZ profile link
This commit is contained in:
parent
c06cd191a2
commit
c396428282
@ -38,7 +38,7 @@ namespace IW4MAdmin
|
||||
String Message = String.Format("^1WARNING ^7[^3{0}^7]: ^3{1}^7, {2}", E.Target.Warnings, E.Target.Name, E.Target.lastOffense);
|
||||
E.Owner.Broadcast(Message);
|
||||
if (E.Target.Warnings >= 4)
|
||||
E.Target.Kick("You were kicked for too many warnings!");
|
||||
E.Target.Kick("You were kicked for too many warnings!", E.Origin);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -65,7 +65,7 @@ namespace IW4MAdmin
|
||||
E.Target.lastOffense = SharedLibrary.Utilities.removeWords(E.Data, 1);
|
||||
String Message = "^1Player Kicked: ^5" + E.Target.lastOffense + " ^1Admin: ^5" + E.Origin.Name;
|
||||
if (E.Origin.Level > E.Target.Level)
|
||||
E.Target.Kick(Message);
|
||||
E.Target.Kick(Message, E.Origin);
|
||||
else
|
||||
E.Origin.Tell("You cannot kick " + E.Target.Name);
|
||||
}
|
||||
@ -90,7 +90,7 @@ namespace IW4MAdmin
|
||||
E.Target.lastOffense = SharedLibrary.Utilities.removeWords(E.Data, 1);
|
||||
String Message = "^1Player Temporarily Banned: ^5" + E.Target.lastOffense + "^7 (1 hour)";
|
||||
if (E.Origin.Level > E.Target.Level)
|
||||
E.Target.tempBan(Message);
|
||||
E.Target.tempBan(Message, E.Origin);
|
||||
else
|
||||
E.Origin.Tell("You cannot temp ban " + E.Target.Name);
|
||||
}
|
||||
@ -596,7 +596,7 @@ namespace IW4MAdmin
|
||||
return;
|
||||
}
|
||||
|
||||
Ban B = E.Owner.Bans.Find(b => b.npID.Equals(E.Target.npID));
|
||||
Penalty B = E.Owner.Bans.Find(b => b.npID.Equals(E.Target.npID));
|
||||
|
||||
if (B == null)
|
||||
{
|
||||
|
@ -77,7 +77,7 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup />
|
||||
<PropertyGroup>
|
||||
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
||||
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GenerateManifests>false</GenerateManifests>
|
||||
@ -300,14 +300,8 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>cd "$(TargetDir)"
|
||||
del *.application
|
||||
del *.pdb
|
||||
del *.dll
|
||||
del app.config
|
||||
del *.manifest
|
||||
del *.log
|
||||
xcopy /Y /I /E "*" "$(SolutionDir)Release Build"</PostBuildEvent>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
@ -15,7 +15,7 @@ namespace IW4MAdmin
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Version = 1.0;
|
||||
Version = 1.1;
|
||||
double latestVersion = 0;
|
||||
handler = new ConsoleEventDelegate(OnProcessExit);
|
||||
SetConsoleCtrlHandler(handler, true);
|
||||
|
@ -121,7 +121,7 @@ namespace IW4MAdmin
|
||||
else
|
||||
Message = "Player Kicked: Previous Ban";
|
||||
|
||||
NewPlayer.Kick(Message);
|
||||
NewPlayer.Kick(Message, NewPlayer);
|
||||
|
||||
if (players[NewPlayer.clientID] != null)
|
||||
{
|
||||
@ -144,9 +144,9 @@ namespace IW4MAdmin
|
||||
if (aP.Level == Player.Permission.Flagged)
|
||||
NewPlayer.setLevel(Player.Permission.Flagged);
|
||||
|
||||
Ban B = isBanned(aP);
|
||||
Penalty B = isBanned(aP);
|
||||
|
||||
if (B != null)
|
||||
if (B != null && B.BType == Penalty.Type.Ban)
|
||||
{
|
||||
Log.Write(String.Format("Banned client {0} is connecting with new alias {1}", aP.Name, NewPlayer.Name), Log.Level.Debug);
|
||||
NewPlayer.lastOffense = String.Format("Evading ( {0} )", aP.Name);
|
||||
@ -270,13 +270,13 @@ namespace IW4MAdmin
|
||||
}
|
||||
|
||||
//Check ban list for every banned player and return ban if match is found
|
||||
override public Ban isBanned(Player C)
|
||||
override public Penalty isBanned(Player C)
|
||||
{
|
||||
|
||||
if (C.Level == Player.Permission.Banned)
|
||||
return Bans.Find(p => p.npID.Equals(C.npID));
|
||||
|
||||
foreach (Ban B in Bans)
|
||||
foreach (Penalty B in Bans)
|
||||
{
|
||||
if (B.npID.Length < 5 || B.IP.Length < 5)
|
||||
continue;
|
||||
@ -838,6 +838,29 @@ namespace IW4MAdmin
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Kick(string Reason, Player Target, Player Origin)
|
||||
{
|
||||
if (Target.clientID > -1)
|
||||
{
|
||||
Penalty newPenalty = new Penalty(Penalty.Type.Kick, SharedLibrary.Utilities.stripColors(Reason.Split(':')[1]), Target.npID, Origin.npID, DateTime.Now, Target.IP);
|
||||
clientDB.addBan(newPenalty);
|
||||
foreach (SharedLibrary.Server S in Program.getServers()) // make sure bans show up on the webfront
|
||||
S.Bans = S.clientDB.getBans();
|
||||
executeCommand("clientkick " + Target.clientID + " \"" + Reason + "^7\"");
|
||||
}
|
||||
}
|
||||
|
||||
public override void tempBan(string Reason, Player Target, Player Origin)
|
||||
{
|
||||
if (Target.clientID > -1)
|
||||
{
|
||||
executeCommand("tempbanclient " + Target.clientID + " \"" + Reason + "\"");
|
||||
Penalty newPenalty = new Penalty(Penalty.Type.TempBan, SharedLibrary.Utilities.stripColors(Reason.Split(':')[1]), Target.npID, Origin.npID, DateTime.Now, Target.IP);
|
||||
foreach (SharedLibrary.Server S in Program.getServers()) // make sure bans show up on the webfront
|
||||
S.Bans = S.clientDB.getBans();
|
||||
clientDB.addBan(newPenalty);
|
||||
}
|
||||
}
|
||||
override public void Ban(String Message, Player Target, Player Origin)
|
||||
{
|
||||
if (Target.clientID > -1)
|
||||
@ -846,7 +869,7 @@ namespace IW4MAdmin
|
||||
if (Origin != null)
|
||||
{
|
||||
Target.setLevel(Player.Permission.Banned);
|
||||
Ban newBan = new Ban(Target.lastOffense, Target.npID, Origin.npID, DateTime.Now, Target.IP);
|
||||
Penalty newBan = new Penalty(Penalty.Type.Ban, Target.lastOffense, Target.npID, Origin.npID, DateTime.Now, Target.IP);
|
||||
|
||||
clientDB.addBan(newBan);
|
||||
clientDB.updatePlayer(Target);
|
||||
@ -874,7 +897,7 @@ namespace IW4MAdmin
|
||||
|
||||
override public bool Unban(String GUID, Player Target)
|
||||
{
|
||||
foreach (Ban B in Bans)
|
||||
foreach (Penalty B in Bans)
|
||||
{
|
||||
if (B.npID == Target.npID)
|
||||
{
|
||||
|
@ -1,4 +1,12 @@
|
||||
VERSION 1.0
|
||||
VERSION 1.1
|
||||
CHANGELOG:
|
||||
-fixed ban sorting ( and an overlooked bug )
|
||||
-added kicks and temp-bans to penalty list
|
||||
-bans are now named penalties
|
||||
-readded pubbans page http://127.0.0.1:1624/pubbans
|
||||
-updated RepZ profile link
|
||||
|
||||
VERSION 1.0
|
||||
CHANGELOG:
|
||||
-first official stable release
|
||||
-fixed last known error (due to web front passing invalid sql syntax)
|
||||
@ -30,7 +38,7 @@ CHANGELOG:
|
||||
-webfront now displays player info and link to repz account
|
||||
-webfront shows ips for authed admin ( determined by ip )
|
||||
-webfront now show chat and allows authed players to send ingame messages
|
||||
-webfront now has public ban list http://127.0.0.1/?pubbans
|
||||
-webfront now has public ban list http://127.0.0.1:1624/pubbans
|
||||
-webfront now shows player history
|
||||
-fixed time span issue in webfront
|
||||
-fixed most recent ban always missing
|
||||
|
@ -1,5 +1,5 @@
|
||||
<div id="container">
|
||||
<div class="h0" style="margin-top: 0; line-height:normal;">BANS<br/><a style="padding: 0; margin: 0; font-size: 24px; float: right;" href="/">Back</a></div>
|
||||
<div class="h0" style="margin-top: 0; line-height:normal;">Penalties<br/><a style="padding: 0; margin: 0; font-size: 24px; float: right;" href="/">Back</a></div>
|
||||
<div id="logo_shit"></div>
|
||||
{{BANS}}
|
||||
</div>
|
@ -48,7 +48,7 @@
|
||||
width: 100px;
|
||||
height: 96px;
|
||||
float: right;
|
||||
background-image: url("http://23.251.150.125:8000/static/images/logo.png");
|
||||
background-image: url("");
|
||||
background-size: 100px 96px;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
@ -58,7 +58,7 @@
|
||||
width: 100px;
|
||||
height: 96px;
|
||||
float: left;
|
||||
background-image: url("http://23.251.150.125:8000/static/images/logo.png");
|
||||
background-image: url("");
|
||||
background-size: 100px 96px;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.30723.0
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.24720.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IW4M ADMIN", "Admin\IW4M ADMIN.csproj", "{DD5DCDA2-51DB-4B1A-922F-5705546E6115}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
@ -23,6 +23,9 @@ EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharedLibrary", "SharedLibrary\SharedLibrary.csproj", "{D51EECEB-438A-47DA-870F-7D7B41BC24D6}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Welcome Plugin", "Welcome Plugin\Welcome Plugin.csproj", "{AF097E6B-48D5-4452-9CCF-0A81A21F341D}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{D51EECEB-438A-47DA-870F-7D7B41BC24D6} = {D51EECEB-438A-47DA-870F-7D7B41BC24D6}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
@ -5,15 +5,16 @@ using System.Text;
|
||||
|
||||
namespace SharedLibrary
|
||||
{
|
||||
public class Ban
|
||||
public class Penalty
|
||||
{
|
||||
public Ban(String Reas, String TargID, String From, DateTime time, String ip)
|
||||
public Penalty(Type BType, String Reas, String TargID, String From, DateTime time, String ip)
|
||||
{
|
||||
Reason = Reas;
|
||||
npID = TargID;
|
||||
bannedByID = From;
|
||||
When = time;
|
||||
IP = ip;
|
||||
this.BType = BType;
|
||||
}
|
||||
|
||||
public String getWhen()
|
||||
@ -21,10 +22,18 @@ namespace SharedLibrary
|
||||
return When.ToString("MM/dd/yy HH:mm:ss"); ;
|
||||
}
|
||||
|
||||
public enum Type
|
||||
{
|
||||
Kick,
|
||||
TempBan,
|
||||
Ban
|
||||
}
|
||||
|
||||
public String Reason { get; private set; }
|
||||
public String npID { get; private set; }
|
||||
public String bannedByID { get; private set; }
|
||||
public DateTime When { get; private set; }
|
||||
public String IP { get; private set; }
|
||||
public Type BType { get; private set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Data.SQLite;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
|
||||
namespace SharedLibrary
|
||||
{
|
||||
@ -157,7 +155,7 @@ namespace SharedLibrary
|
||||
{
|
||||
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);";
|
||||
Create = "CREATE TABLE [BANS] ( [TYPE] TEXT NULL, [Reason] TEXT NULL, [npID] TEXT NULL, [bannedByID] TEXT NULL, [IP] TEXT NULL, [TIME] TEXT NULL);";
|
||||
ExecuteNonQuery(Create);
|
||||
}
|
||||
}
|
||||
@ -340,9 +338,9 @@ namespace SharedLibrary
|
||||
}
|
||||
|
||||
//Returns list of bans in database
|
||||
public List<Ban> getBans()
|
||||
public List<Penalty> getBans()
|
||||
{
|
||||
List<Ban> Bans = new List<Ban>();
|
||||
List<Penalty> Bans = new List<Penalty>();
|
||||
DataTable Result = GetDataTable("SELECT * FROM BANS ORDER BY TIME DESC");
|
||||
|
||||
foreach (DataRow Row in Result.Rows)
|
||||
@ -350,7 +348,12 @@ namespace SharedLibrary
|
||||
if (Row["TIME"].ToString().Length < 2) //compatibility with my old database
|
||||
Row["TIME"] = DateTime.Now.ToString();
|
||||
|
||||
Bans.Add(new Ban(Row["Reason"].ToString(), Row["npID"].ToString(), Row["bannedByID"].ToString(), DateTime.Parse(Row["TIME"].ToString()), Row["IP"].ToString()));
|
||||
SharedLibrary.Penalty.Type BanType = Penalty.Type.Ban;
|
||||
if (Row["TYPE"].ToString().Length != 0)
|
||||
BanType = (Penalty.Type)Enum.Parse(typeof(Penalty.Type), Row["TYPE"].ToString());
|
||||
|
||||
Bans.Add(new Penalty(BanType, Row["Reason"].ToString(), Row["npID"].ToString(), Row["bannedByID"].ToString(), DateTime.Parse(Row["TIME"].ToString()), Row["IP"].ToString()));
|
||||
|
||||
}
|
||||
|
||||
return Bans;
|
||||
@ -413,7 +416,7 @@ namespace SharedLibrary
|
||||
|
||||
|
||||
//Add specified ban to database
|
||||
public void addBan(Ban B)
|
||||
public void addBan(Penalty B)
|
||||
{
|
||||
Dictionary<String, object> newBan = new Dictionary<String, object>();
|
||||
|
||||
@ -422,6 +425,7 @@ namespace SharedLibrary
|
||||
newBan.Add("bannedByID", B.bannedByID);
|
||||
newBan.Add("IP", B.IP);
|
||||
newBan.Add("TIME", Utilities.DateTimeSQLite(DateTime.Now));
|
||||
newBan.Add("TYPE", B.BType);
|
||||
|
||||
Insert("BANS", newBan);
|
||||
}
|
||||
|
@ -128,14 +128,14 @@ namespace SharedLibrary
|
||||
lastEvent.Owner.Tell(Message, this);
|
||||
}
|
||||
|
||||
public void Kick(String Message)
|
||||
public void Kick(String Message, Player Sender)
|
||||
{
|
||||
lastEvent.Owner.Kick(Message, this);
|
||||
lastEvent.Owner.Kick(Message, this, Sender);
|
||||
}
|
||||
|
||||
public void tempBan(String Message)
|
||||
public void tempBan(String Message, Player Sender)
|
||||
{
|
||||
lastEvent.Owner.tempBan(Message, this);
|
||||
lastEvent.Owner.tempBan(Message, this, Sender);
|
||||
}
|
||||
|
||||
public void Ban(String Message, Player Sender)
|
||||
|
@ -23,7 +23,7 @@ namespace SharedLibrary
|
||||
clientDB = new ClientsDB("clients.rm");
|
||||
aliasDB = new AliasesDB("aliases.rm");
|
||||
|
||||
Bans = new List<Ban>();
|
||||
Bans = new List<Penalty>();
|
||||
players = new List<Player>(new Player[18]);
|
||||
events = new Queue<Event>();
|
||||
Macros = new Dictionary<String, Object>();
|
||||
@ -97,7 +97,7 @@ namespace SharedLibrary
|
||||
}
|
||||
|
||||
//Returns list of all active bans (loaded at runtime)
|
||||
public List<Ban> getBans()
|
||||
public List<Penalty> getBans()
|
||||
{
|
||||
return Bans;
|
||||
}
|
||||
@ -169,7 +169,7 @@ namespace SharedLibrary
|
||||
/// </summary>
|
||||
/// <param name="C">Player to check if banned</param>
|
||||
/// <returns>Matching ban if found</returns>
|
||||
abstract public Ban isBanned(Player C);
|
||||
abstract public Penalty isBanned(Player C);
|
||||
|
||||
/// <summary>
|
||||
/// Process requested command correlating to an event
|
||||
@ -286,21 +286,14 @@ namespace SharedLibrary
|
||||
/// </summary>
|
||||
/// <param name="Reason">Reason for kicking</param>
|
||||
/// <param name="Target">Player to kick</param>
|
||||
public void Kick(String Reason, Player Target)
|
||||
{
|
||||
if (Target.clientID > -1)
|
||||
executeCommand("clientkick " + Target.clientID + " \"" + Reason + "^7\"");
|
||||
}
|
||||
abstract public void Kick(String Reason, Player Target, Player Origin);
|
||||
|
||||
/// <summary>
|
||||
/// Temporarily ban a player ( default 1 hour ) from the server
|
||||
/// </summary>
|
||||
/// <param name="Reason">Reason for banning the player</param>
|
||||
/// <param name="Target">The player to ban</param>
|
||||
public void tempBan(String Reason, Player Target)
|
||||
{
|
||||
executeCommand("tempbanclient " + Target.clientID + " \"" + Reason + "\"");
|
||||
}
|
||||
abstract public void tempBan(String Reason, Player Target, Player Origin);
|
||||
|
||||
/// <summary>
|
||||
/// Perm ban a player from the server
|
||||
@ -472,7 +465,7 @@ namespace SharedLibrary
|
||||
|
||||
//Objects
|
||||
public Log Log { get; private set; }
|
||||
public List<Ban> Bans;
|
||||
public List<Penalty> Bans;
|
||||
public Player owner;
|
||||
public List<Map> maps;
|
||||
public List<String> rules;
|
||||
|
@ -38,7 +38,7 @@
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.SQLite">
|
||||
<HintPath>..\..\Admin\lib\System.Data.SQLite.dll</HintPath>
|
||||
<HintPath>D:\SOURCE\Admin\lib\System.Data.SQLite.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
|
@ -183,6 +183,21 @@ namespace SharedLibrary
|
||||
}
|
||||
}
|
||||
|
||||
public static String penaltyHTMLFormatted(Penalty.Type BType)
|
||||
{
|
||||
switch(BType)
|
||||
{
|
||||
case Penalty.Type.Ban:
|
||||
return "<span style='color:Red'>" + BType.ToString() + "</span>";
|
||||
case Penalty.Type.TempBan:
|
||||
return "<span style='color:Orange'>" + BType.ToString() + "</span>";
|
||||
case Penalty.Type.Kick:
|
||||
return "<span style='color:#ffff80'>" + BType.ToString() + "</span>";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static String processMacro(Dictionary<String, Object> Dict, String str)
|
||||
{
|
||||
MatchCollection Found = Regex.Matches(str, @"\{\{[A-Z]+\}\}", RegexOptions.IgnoreCase);
|
||||
|
@ -169,7 +169,7 @@ namespace Webfront_Plugin
|
||||
<th class=server_map><span>{1}</span></th>
|
||||
<th class=server_players><span>{2}</span></th>
|
||||
<th class=server_gametype><span>{3}</span></th>
|
||||
<th><a href=/bans>Bans</a></th>
|
||||
<th><a href=/bans>Penalties</a></th>
|
||||
<th><a class='history' href='/graph?server={4}'>History</a></th>
|
||||
</tr>
|
||||
</table>
|
||||
@ -296,7 +296,7 @@ namespace Webfront_Plugin
|
||||
//if (logged)
|
||||
Screenshot = String.Format("<a href='http://server.nbsclan.org/screen.php?id={0}&name={1}' target='_blank'><div style='background-image:url(http://server.nbsclan.org/shutter.png); width: 20px; height: 20px;float: right; position:relative; right: 21%; background-size: contain;'></div></a>", forumID, Player.Name);
|
||||
|
||||
buffer.AppendFormat("<td><a style='float: left;' href='{9}'>{0}</a>{10}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td><td>{6} ago</td><td><a href='https://repziw4.de/memberlist.php?mode=viewprofile&u={7}'>{8}</a></td>", Player.Name, Names, IPs, 0, SharedLibrary.Utilities.levelHTMLFormatted(Player.Level), Player.Connections, Player.getLastConnection(), forumID, Player.Name, "/player?id=" + Player.databaseID, Screenshot);
|
||||
buffer.AppendFormat("<td><a style='float: left;' href='{9}'>{0}</a>{10}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td><td>{6} ago</td><td><a href='https://repziw4.de/forum/memberlist.php?mode=viewprofile&u={7}'>{8}</a></td>", Player.Name, Names, IPs, 0, SharedLibrary.Utilities.levelHTMLFormatted(Player.Level), Player.Connections, Player.getLastConnection(), forumID, Player.Name, "/player?id=" + Player.databaseID, Screenshot);
|
||||
buffer.Append("</tr>");
|
||||
}
|
||||
|
||||
@ -319,36 +319,36 @@ namespace Webfront_Plugin
|
||||
int cycleFix = 0;
|
||||
|
||||
if (totalBans <= limitPerPage)
|
||||
range = totalBans - 1;
|
||||
range = totalBans;
|
||||
else if ((totalBans - start) < limitPerPage)
|
||||
range = (totalBans - start);
|
||||
else
|
||||
range = limitPerPage;
|
||||
|
||||
List<Ban> Bans = new List<Ban>();
|
||||
List<Penalty> Bans = new List<Penalty>();
|
||||
|
||||
if (totalBans > 0)
|
||||
Bans = S.Bans.GetRange(start, range).OrderByDescending(x => x.When).ToList();
|
||||
Bans = S.Bans.OrderByDescending(x => x.When).ToList().GetRange(start, range);
|
||||
|
||||
if (Bans.Count == 0)
|
||||
buffer.Append("<span style='font-size: 16pt;'>No bans yet.</span>");
|
||||
|
||||
else
|
||||
{
|
||||
buffer.Append("<h1 style=margin-top: 0;>{{TIME}}</h1><hr /><tr><th>Name</th><th style=text-align:left;>Offense</th><th style=text-align:left;>Banned By</th><th style='width: 175px; text-align:right;padding-right: 80px;'>Time</th></tr>");
|
||||
buffer.Append("<h1 style=margin-top: 0;>{{TIME}}</h1><hr /><tr><th>Name</th><th>Type</th><th style=text-align:left;>Offense</th><th style=text-align:left;>Penalty By</th><th style='width: 175px; text-align:right;padding-right: 80px;'>Time</th></tr>");
|
||||
|
||||
if (Bans[0] != null)
|
||||
buffer = buffer.Replace("{{TIME}}", "From " + SharedLibrary.Utilities.timePassed(Bans[0].When) + " ago" + " — " + totalBans + " total");
|
||||
|
||||
List<String> npIDs = new List<string>();
|
||||
|
||||
foreach (Ban B in Bans)
|
||||
foreach (Penalty B in Bans)
|
||||
npIDs.Add(B.npID);
|
||||
|
||||
|
||||
List<Player> bannedPlayers = S.clientDB.getPlayers(npIDs);
|
||||
|
||||
for (int i = 0; i < Bans.Count-1; i++)
|
||||
for (int i = 0; i < Bans.Count; i++)
|
||||
{
|
||||
if (Bans[i] == null)
|
||||
continue;
|
||||
@ -380,7 +380,7 @@ namespace Webfront_Plugin
|
||||
Prefix = "class=row-white";
|
||||
|
||||
String Link = "/player?id=" + P.databaseID;
|
||||
buffer.AppendFormat("<tr {4}><td><a href='{5}'>{0}</a></th><td style='border-left: 3px solid #bbb; text-align:left;'>{1}</td><td style='border-left: 3px solid #bbb;text-align:left;'>{2}</td><td style='width: 175px; text-align:right;'>{3}</td></tr></div>", P.Name, P.lastOffense, SharedLibrary.Utilities.nameHTMLFormatted(B), Bans[i].getWhen(), Prefix, Link);
|
||||
buffer.AppendFormat("<tr {4}><td><a href='{5}'>{0}</a></td><td style='width: 150px; border-left: 3px solid #bbb; text-align:left;'>{6}</td><td style='border-left: 3px solid #bbb; text-align:left;'>{1}</td><td style='border-left: 3px solid #bbb;text-align:left;'>{2}</td><td style='width: 175px; text-align:right;'>{3}</td></tr></div>", P.Name, P.lastOffense.Substring(0, Math.Min(70, P.lastOffense.Length)), SharedLibrary.Utilities.nameHTMLFormatted(B), Bans[i].getWhen(), Prefix, Link, Utilities.penaltyHTMLFormatted(Bans[i].BType));
|
||||
cycleFix++;
|
||||
}
|
||||
}
|
||||
@ -416,7 +416,21 @@ namespace Webfront_Plugin
|
||||
return Input.Replace(Macro, "IW4MAdmin by RaidMax");
|
||||
|
||||
if (Looking == "VERSION")
|
||||
return Input.Replace(Macro, "0.9.5");
|
||||
return Input.Replace(Macro, "1.1");
|
||||
|
||||
if (Looking == "PUBBANS" || Looking == "PUBBANSR")
|
||||
{
|
||||
String pubBans = "=========================================\r\nIW4MAdmin Public Banlist\r\n=========================================\r\n";
|
||||
foreach (Penalty P in activeServers[0].Bans.OrderByDescending(x => x.When).ToList())
|
||||
{
|
||||
if (P.BType == Penalty.Type.Ban)
|
||||
pubBans += String.Format("{0};{1};{2};{3}\r\n",P.npID, P.IP, P.Reason.Trim(), P.When);
|
||||
if (Looking == "PUBBANSR")
|
||||
pubBans += "<br/>";
|
||||
}
|
||||
|
||||
return Input.Replace(Macro, pubBans);
|
||||
}
|
||||
|
||||
return "PLACEHOLDER";
|
||||
|
||||
@ -451,6 +465,10 @@ namespace Webfront_Plugin
|
||||
case "error":
|
||||
requestedPage = new error();
|
||||
break;
|
||||
case "pubbans":
|
||||
return processTemplate("{{PUBBANS}}", null);
|
||||
case "pubbansr":
|
||||
return processTemplate("{{PUBBANSR}}", null);
|
||||
default:
|
||||
requestedPage = new notfound();
|
||||
break;
|
||||
|
@ -35,7 +35,7 @@
|
||||
</Reference>
|
||||
<Reference Include="SharedLibrary, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Admin\lib\SharedLibrary.dll</HintPath>
|
||||
<HintPath>..\SharedLibrary\bin\Release\SharedLibrary.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
|
Loading…
Reference in New Issue
Block a user