-added trusted group ( will need a new database or manual update )

-reports capture screenshot
This commit is contained in:
RaidMax 2016-01-16 16:58:24 -06:00
parent c396428282
commit d797be07cf
9 changed files with 87 additions and 25 deletions

View File

@ -29,16 +29,12 @@ namespace IW4MAdmin
public override void Execute(Event E) public override void Execute(Event E)
{ {
E.Target.lastOffense = SharedLibrary.Utilities.removeWords(E.Data, 1);
if (E.Origin.Level <= E.Target.Level) if (E.Origin.Level <= E.Target.Level)
E.Origin.Tell("You cannot warn " + E.Target.Name); E.Origin.Tell("You cannot warn " + E.Target.Name);
else else
{ {
E.Target.lastOffense = SharedLibrary.Utilities.removeWords(E.Data, 1); E.Target.Warn(E.Data, E.Origin);
E.Target.Warnings++;
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.Origin);
} }
} }
} }
@ -63,9 +59,8 @@ namespace IW4MAdmin
public override void Execute(Event E) public override void Execute(Event E)
{ {
E.Target.lastOffense = SharedLibrary.Utilities.removeWords(E.Data, 1); 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) if (E.Origin.Level > E.Target.Level)
E.Target.Kick(Message, E.Origin); E.Target.Kick(E.Target.lastOffense, E.Origin);
else else
E.Origin.Tell("You cannot kick " + E.Target.Name); E.Origin.Tell("You cannot kick " + E.Target.Name);
} }
@ -504,6 +499,12 @@ namespace IW4MAdmin
public override void Execute(Event E) public override void Execute(Event E)
{ {
if (E.Owner.Reports.Find(x => x.Origin == E.Origin) != null)
{
E.Origin.Tell("You have already reported this player");
return;
}
if (E.Target == E.Origin) if (E.Target == E.Origin)
{ {
E.Origin.Tell("You cannot report yourself, silly."); E.Origin.Tell("You cannot report yourself, silly.");
@ -518,6 +519,10 @@ namespace IW4MAdmin
E.Data = SharedLibrary.Utilities.removeWords(E.Data, 1); E.Data = SharedLibrary.Utilities.removeWords(E.Data, 1);
E.Owner.Reports.Add(new Report(E.Target, E.Origin, E.Data)); E.Owner.Reports.Add(new Report(E.Target, E.Origin, E.Data));
Connection Screenshot = new Connection(String.Format("http://server.nbsclan.org/screen.php?id={0}&name={1}?save=1", SharedLibrary.Utilities.getForumIDFromStr(E.Target.npID), E.Origin.Name));
String Response = Screenshot.Read();
E.Origin.Tell("Successfully reported " + E.Target.Name); E.Origin.Tell("Successfully reported " + E.Target.Name);
E.Owner.ToAdmins(String.Format("^5{0}^7->^1{1}^7: {2}", E.Origin.Name, E.Target.Name, E.Data)); E.Owner.ToAdmins(String.Format("^5{0}^7->^1{1}^7: {2}", E.Origin.Name, E.Target.Name, E.Data));

View File

@ -838,15 +838,29 @@ namespace IW4MAdmin
return false; return false;
} }
public override void Warn(string Reason, Player Target, Player Origin)
{
Penalty newPenalty = new Penalty(Penalty.Type.Warning, SharedLibrary.Utilities.stripColors(Reason), 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();
Target.Warnings++;
String Message = String.Format("^1WARNING ^7[^3{0}^7]: ^3{1}^7, {2}", Target.Warnings, Target.Name, Target.lastOffense);
Broadcast(Message);
if (Target.Warnings >= 4)
Target.Kick("You were kicked for too many warnings!", Origin);
}
public override void Kick(string Reason, Player Target, Player Origin) public override void Kick(string Reason, Player Target, Player Origin)
{ {
if (Target.clientID > -1) if (Target.clientID > -1)
{ {
String Message = "^1Player Kicked: ^5" + Reason + " ^1Admin: ^5" + Origin.Name;
Penalty newPenalty = new Penalty(Penalty.Type.Kick, SharedLibrary.Utilities.stripColors(Reason.Split(':')[1]), Target.npID, Origin.npID, DateTime.Now, Target.IP); Penalty newPenalty = new Penalty(Penalty.Type.Kick, SharedLibrary.Utilities.stripColors(Reason.Split(':')[1]), Target.npID, Origin.npID, DateTime.Now, Target.IP);
clientDB.addBan(newPenalty); clientDB.addBan(newPenalty);
foreach (SharedLibrary.Server S in Program.getServers()) // make sure bans show up on the webfront foreach (SharedLibrary.Server S in Program.getServers()) // make sure bans show up on the webfront
S.Bans = S.clientDB.getBans(); S.Bans = S.clientDB.getBans();
executeCommand("clientkick " + Target.clientID + " \"" + Reason + "^7\""); executeCommand("clientkick " + Target.clientID + " \"" + Message + "^7\"");
} }
} }
@ -961,7 +975,7 @@ namespace IW4MAdmin
foreach (Command C in PluginImporter.potentialCommands) foreach (Command C in PluginImporter.potentialCommands)
commands.Add(C); commands.Add(C);
commands.Add(new Kick("kick", "kick a player by name. syntax: !kick <player> <reason>.", "k", Player.Permission.Moderator, 2, true)); commands.Add(new Kick("kick", "kick a player by name. syntax: !kick <player> <reason>.", "k", Player.Permission.Trusted, 2, true));
commands.Add(new Say("say", "broadcast message to all players. syntax: !say <message>.", "s", Player.Permission.Moderator, 1, false)); commands.Add(new Say("say", "broadcast message to all players. syntax: !say <message>.", "s", Player.Permission.Moderator, 1, false));
commands.Add(new TempBan("tempban", "temporarily ban a player for 1 hour. syntax: !tempban <player> <reason>.", "tb", Player.Permission.Moderator, 2, true)); commands.Add(new TempBan("tempban", "temporarily ban a player for 1 hour. syntax: !tempban <player> <reason>.", "tb", Player.Permission.Moderator, 2, true));
commands.Add(new SBan("ban", "permanently ban a player from the server. syntax: !ban <player> <reason>", "b", Player.Permission.SeniorAdmin, 2, true)); commands.Add(new SBan("ban", "permanently ban a player from the server. syntax: !ban <player> <reason>", "b", Player.Permission.SeniorAdmin, 2, true));
@ -973,8 +987,8 @@ namespace IW4MAdmin
commands.Add(new SetLevel("setlevel", "set player to specified administration level. syntax: !setlevel <player> <level>.", "sl", Player.Permission.Owner, 2, true)); commands.Add(new SetLevel("setlevel", "set player to specified administration level. syntax: !setlevel <player> <level>.", "sl", Player.Permission.Owner, 2, true));
commands.Add(new Usage("usage", "get current application memory usage. syntax: !usage.", "us", Player.Permission.Moderator, 0, false)); commands.Add(new Usage("usage", "get current application memory usage. syntax: !usage.", "us", Player.Permission.Moderator, 0, false));
commands.Add(new Uptime("uptime", "get current application running time. syntax: !uptime.", "up", Player.Permission.Moderator, 0, false)); commands.Add(new Uptime("uptime", "get current application running time. syntax: !uptime.", "up", Player.Permission.Moderator, 0, false));
commands.Add(new Warn("warn", "warn player for infringing rules syntax: !warn <player> <reason>.", "w", Player.Permission.Moderator, 2, true)); commands.Add(new Warn("warn", "warn player for infringing rules syntax: !warn <player> <reason>.", "w", Player.Permission.Trusted, 2, true));
commands.Add(new WarnClear("warnclear", "remove all warning for a player syntax: !warnclear <player>.", "wc", Player.Permission.Administrator, 1, true)); commands.Add(new WarnClear("warnclear", "remove all warning for a player syntax: !warnclear <player>.", "wc", Player.Permission.Trusted, 1, true));
commands.Add(new Unban("unban", "unban player by database id. syntax: !unban @<id>.", "ub", Player.Permission.SeniorAdmin, 1, true)); commands.Add(new Unban("unban", "unban player by database id. syntax: !unban @<id>.", "ub", Player.Permission.SeniorAdmin, 1, true));
commands.Add(new Admins("admins", "list currently connected admins. syntax: !admins.", "a", Player.Permission.User, 0, false)); commands.Add(new Admins("admins", "list currently connected admins. syntax: !admins.", "a", Player.Permission.User, 0, false));
commands.Add(new MapCMD("map", "change to specified map. syntax: !map", "m", Player.Permission.Administrator, 1, false)); commands.Add(new MapCMD("map", "change to specified map. syntax: !map", "m", Player.Permission.Administrator, 1, false));

View File

@ -1,10 +1,12 @@
VERSION 1.1 VERSION 1.1
CHANGELOG: CHANGELOG:
-fixed ban sorting ( and an overlooked bug ) -fixed ban sorting ( and an overlooked bug )
-added kicks and temp-bans to penalty list -added kicks, warnings and temp-bans to penalty list
-bans are now named penalties -bans are now named penalties
-readded pubbans page http://127.0.0.1:1624/pubbans -readded pubbans page http://127.0.0.1:1624/pubbans
-updated RepZ profile link -updated RepZ profile link
-added trusted group ( will need a new database or manual update )
-reports capture screenshot
VERSION 1.0 VERSION 1.0
CHANGELOG: CHANGELOG:

View File

@ -24,6 +24,7 @@ namespace SharedLibrary
public enum Type public enum Type
{ {
Warning,
Kick, Kick,
TempBan, TempBan,
Ban Ban

View File

@ -26,12 +26,13 @@ namespace SharedLibrary
Banned = -1, Banned = -1,
User = 0, User = 0,
Flagged = 1, Flagged = 1,
Moderator = 2, Trusted = 2,
Administrator = 3, Moderator = 3,
SeniorAdmin = 4, Administrator = 4,
Owner = 5, SeniorAdmin = 5,
Creator = 6, Owner = 6,
Console = 7, Creator = 7,
Console = 8,
} }
public Player(string n, string id, int num, int l) public Player(string n, string id, int num, int l)
@ -138,6 +139,11 @@ namespace SharedLibrary
lastEvent.Owner.tempBan(Message, this, Sender); lastEvent.Owner.tempBan(Message, this, Sender);
} }
public void Warn(String Message, Player Sender)
{
lastEvent.Owner.Warn(Message, this, Sender);
}
public void Ban(String Message, Player Sender) public void Ban(String Message, Player Sender)
{ {
lastEvent.Owner.Ban(Message, this, Sender); lastEvent.Owner.Ban(Message, this, Sender);

View File

@ -303,6 +303,8 @@ namespace SharedLibrary
/// <param name="Origin">The person who banned the target</param> /// <param name="Origin">The person who banned the target</param>
abstract public void Ban(String Reason, Player Target, Player Origin); abstract public void Ban(String Reason, Player Target, Player Origin);
abstract public void Warn(String Reason, Player Target, Player Origin);
/// <summary> /// <summary>
/// Unban a player by npID / GUID /// Unban a player by npID / GUID
/// </summary> /// </summary>

View File

@ -118,13 +118,15 @@ namespace SharedLibrary
case Player.Permission.Banned: case Player.Permission.Banned:
return "^1" + Player.Permission.Banned; return "^1" + Player.Permission.Banned;
case Player.Permission.Flagged: case Player.Permission.Flagged:
return "^0" + Player.Permission.Flagged; return "^9" + Player.Permission.Flagged;
case Player.Permission.Owner: case Player.Permission.Owner:
return "^5" + Player.Permission.Owner; return "^5" + Player.Permission.Owner;
case Player.Permission.User: case Player.Permission.User:
return "^2" + Player.Permission.User; return "^2" + Player.Permission.User;
case Player.Permission.Trusted:
return "^3" + Player.Permission.Trusted;
default: default:
return "^3" + level; return "^6" + level;
} }
} }
@ -153,6 +155,8 @@ namespace SharedLibrary
return "<span style='color:rgb(196, 22, 28)'>" + Level + "</span>"; return "<span style='color:rgb(196, 22, 28)'>" + Level + "</span>";
case Player.Permission.Flagged: case Player.Permission.Flagged:
return "<span style='color:rgb(251, 124, 98)'>" + Level + "</span>"; return "<span style='color:rgb(251, 124, 98)'>" + Level + "</span>";
case Player.Permission.Trusted:
return "<span style='color:orange'>" + Level + "</span>";
default: default:
return "<i>" + Level + "</i>"; return "<i>" + Level + "</i>";
} }
@ -178,6 +182,8 @@ namespace SharedLibrary
return "<span style='color:rgb(196, 22, 28)'>" + P.Name + "</span>"; return "<span style='color:rgb(196, 22, 28)'>" + P.Name + "</span>";
case Player.Permission.Flagged: case Player.Permission.Flagged:
return "<span style='color:rgb(251, 124, 98)'>" + P.Name + "</span>"; return "<span style='color:rgb(251, 124, 98)'>" + P.Name + "</span>";
case Player.Permission.Trusted:
return "<span style='color:orange'>" + P.Name + "</span>";
default: default:
return "<i>" + P.Name + "</i>"; return "<i>" + P.Name + "</i>";
} }
@ -188,11 +194,13 @@ namespace SharedLibrary
switch(BType) switch(BType)
{ {
case Penalty.Type.Ban: case Penalty.Type.Ban:
return "<span style='color:Red'>" + BType.ToString() + "</span>"; return "<span style='color:rgb(196, 22, 28)'>" + BType.ToString() + "</span>";
case Penalty.Type.TempBan: case Penalty.Type.TempBan:
return "<span style='color:Orange'>" + BType.ToString() + "</span>"; return "<span style='color:#E6840C'>" + BType.ToString() + "</span>";
case Penalty.Type.Kick: case Penalty.Type.Kick:
return "<span style='color:#ffff80'>" + BType.ToString() + "</span>"; return "<span style='color:#8A0578'>" + BType.ToString() + "</span>";
case Penalty.Type.Warning:
return "<span style='color:#CAB11D'>" + BType.ToString() + "</span>";
default: default:
return ""; return "";
} }
@ -334,9 +342,24 @@ namespace SharedLibrary
return "One-Hundreth (amazing!)"; return "One-Hundreth (amazing!)";
case 500: case 500:
return "^7You're really ^5dedicated ^7to this server! This is your ^5500th ^7time connecting!"; return "^7You're really ^5dedicated ^7to this server! This is your ^5500th ^7time connecting!";
case 1000:
return "WOW! Soldier, it's your ^11000th ^7time connecting! You deserve a medal.";
default: default:
return connection.ToString() + Prefix; return connection.ToString() + Prefix;
} }
} }
public static Int64 getForumIDFromStr(String npID)
{
Int64 forumID = 0;
if (npID.Length == 16)
{
forumID = Int64.Parse(npID.Substring(0, 16), System.Globalization.NumberStyles.AllowHexSpecifier);
forumID = forumID - 76561197960265728;
}
return forumID;
}
} }
} }

View File

@ -70,6 +70,15 @@ namespace StatsPlugin
if (E.Type == Event.GType.Connect) if (E.Type == Event.GType.Connect)
{ {
resetCounters(E.Origin.clientID); resetCounters(E.Origin.clientID);
PlayerStats checkForTrusted = playerStats.getStats(E.Origin);
if (checkForTrusted.playTime >= 4320 && E.Origin.Level < Player.Permission.Trusted)
{
E.Origin.setLevel(Player.Permission.Trusted);
E.Owner.clientDB.updatePlayer(E.Origin);
E.Origin.Tell("Congratulations, you are now a ^5trusted ^7player! Type ^5!help ^7to view new commands.");
E.Origin.Tell("You earned this by playing for ^53 ^7full days!");
}
} }
if (E.Type == Event.GType.MapEnd) if (E.Type == Event.GType.MapEnd)

View File

@ -380,7 +380,7 @@ namespace Webfront_Plugin
Prefix = "class=row-white"; Prefix = "class=row-white";
String Link = "/player?id=" + P.databaseID; String Link = "/player?id=" + P.databaseID;
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)); 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, Bans[i].Reason.Substring(0, Math.Min(70, Bans[i].Reason.Length)), SharedLibrary.Utilities.nameHTMLFormatted(B), Bans[i].getWhen(), Prefix, Link, Utilities.penaltyHTMLFormatted(Bans[i].BType));
cycleFix++; cycleFix++;
} }
} }