2015-03-08 17:20:10 -04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
2015-08-20 01:06:44 -04:00
|
|
|
|
using SharedLibrary;
|
2017-05-26 18:49:27 -04:00
|
|
|
|
using SharedLibrary.Network;
|
|
|
|
|
using System.Threading.Tasks;
|
2015-03-08 17:20:10 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
namespace SharedLibrary.Commands
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-26 18:49:27 -04:00
|
|
|
|
class Quit : Command
|
|
|
|
|
{
|
|
|
|
|
public Quit(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
|
|
|
|
|
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
|
|
|
|
{
|
|
|
|
|
E.Owner.Manager.Stop();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-08 17:20:10 -04:00
|
|
|
|
class Owner : Command
|
|
|
|
|
{
|
2017-05-26 18:49:27 -04:00
|
|
|
|
|
2015-03-08 17:20:10 -04:00
|
|
|
|
public Owner(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-29 22:25:49 -04:00
|
|
|
|
if (E.Owner.Manager.GetClientDatabase().GetOwner() == null)
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
|
|
|
|
E.Origin.setLevel(Player.Permission.Owner);
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("Congratulations, you have claimed ownership of this server!");
|
2015-03-08 17:20:10 -04:00
|
|
|
|
E.Owner.owner = E.Origin;
|
2017-05-29 22:25:49 -04:00
|
|
|
|
E.Owner.Manager.GetClientDatabase().UpdatePlayer(E.Origin);
|
2015-03-08 17:20:10 -04:00
|
|
|
|
}
|
|
|
|
|
else
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("This server already has an owner!");
|
2015-03-08 17:20:10 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class Warn : Command
|
|
|
|
|
{
|
|
|
|
|
public Warn(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-26 18:49:27 -04:00
|
|
|
|
E.Target.lastOffense = E.Data.RemoveWords(1);
|
2015-08-20 01:06:44 -04:00
|
|
|
|
if (E.Origin.Level <= E.Target.Level)
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("You cannot warn " + E.Target.Name);
|
2015-03-08 17:20:10 -04:00
|
|
|
|
else
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Target.Warn(E.Target.lastOffense, E.Origin);
|
2015-03-08 17:20:10 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class WarnClear : Command
|
|
|
|
|
{
|
|
|
|
|
public WarnClear(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2015-08-20 01:06:44 -04:00
|
|
|
|
E.Target.lastOffense = String.Empty;
|
2015-03-08 17:20:10 -04:00
|
|
|
|
E.Target.Warnings = 0;
|
2015-08-20 01:06:44 -04:00
|
|
|
|
String Message = String.Format("All warning cleared for {0}", E.Target.Name);
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Owner.Broadcast(Message);
|
2015-03-08 17:20:10 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class Kick : Command
|
|
|
|
|
{
|
|
|
|
|
public Kick(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
E.Target.lastOffense = E.Data.RemoveWords(1);
|
2015-08-20 01:06:44 -04:00
|
|
|
|
if (E.Origin.Level > E.Target.Level)
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Target.Kick(E.Target.lastOffense, E.Origin);
|
2015-03-08 17:20:10 -04:00
|
|
|
|
else
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("You cannot kick " + E.Target.Name);
|
2015-03-08 17:20:10 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class Say : Command
|
|
|
|
|
{
|
|
|
|
|
public Say(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Owner.Broadcast("^1" + E.Origin.Name + " - ^6" + E.Data + "^7");
|
2015-03-08 17:20:10 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class TempBan : Command
|
|
|
|
|
{
|
|
|
|
|
public TempBan(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-26 18:49:27 -04:00
|
|
|
|
E.Target.lastOffense = SharedLibrary.Utilities.RemoveWords(E.Data, 1);
|
|
|
|
|
String Message = E.Target.lastOffense;
|
2015-08-20 01:06:44 -04:00
|
|
|
|
if (E.Origin.Level > E.Target.Level)
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Target.TempBan(Message, E.Origin);
|
2015-03-08 17:20:10 -04:00
|
|
|
|
else
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("You cannot temp ban " + E.Target.Name);
|
2015-03-08 17:20:10 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
class CBan : Command
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
public CBan(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
2015-03-08 17:20:10 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-26 18:49:27 -04:00
|
|
|
|
E.Target.lastOffense = SharedLibrary.Utilities.RemoveWords(E.Data, 1);
|
2015-03-08 17:20:10 -04:00
|
|
|
|
E.Target.lastEvent = E; // needs to be fixed
|
2015-03-11 00:47:34 -04:00
|
|
|
|
String Message;
|
|
|
|
|
if (E.Owner.Website == null)
|
2015-08-20 01:06:44 -04:00
|
|
|
|
Message = "^1Player Banned: ^5" + E.Target.lastOffense;
|
2015-03-11 00:47:34 -04:00
|
|
|
|
else
|
2017-05-26 18:49:27 -04:00
|
|
|
|
Message = "^1Player Banned: ^5" + E.Target.lastOffense;
|
2015-08-20 01:06:44 -04:00
|
|
|
|
if (E.Origin.Level > E.Target.Level)
|
2015-03-09 00:28:57 -04:00
|
|
|
|
{
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Target.Ban(Message, E.Origin);
|
|
|
|
|
await E.Origin.Tell(String.Format("Sucessfully banned ^5{0} ^7({1})", E.Target.Name, E.Target.npID));
|
2015-03-09 00:28:57 -04:00
|
|
|
|
}
|
2015-03-08 17:20:10 -04:00
|
|
|
|
else
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("You cannot ban " + E.Target.Name);
|
2015-03-08 17:20:10 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
class CUnban : Command
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
public CUnban(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
2015-03-08 17:20:10 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-27 18:08:04 -04:00
|
|
|
|
await E.Owner.Unban(E.Target);
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell($"Successfully unbanned {E.Target.Name}::{E.Target.npID}");
|
2015-03-08 17:20:10 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
class CWhoAmI : Command
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
public CWhoAmI(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
2015-03-08 17:20:10 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2015-08-20 13:52:30 -04:00
|
|
|
|
String You = String.Format("{0} [^3#{1}^7] {2} [^3@{3}^7] [{4}^7] IP: {5}", E.Origin.Name, E.Origin.clientID, E.Origin.npID, E.Origin.databaseID, SharedLibrary.Utilities.levelToColor(E.Origin.Level), E.Origin.IP);
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell(You);
|
2015-03-08 17:20:10 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
class CList : Command
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
public CList(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
2015-03-08 17:20:10 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2015-08-26 01:49:47 -04:00
|
|
|
|
StringBuilder playerList = new StringBuilder();
|
2017-05-26 18:49:27 -04:00
|
|
|
|
int count = 0;
|
|
|
|
|
for (int i = 0; i < E.Owner.Players.Count; i++)
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-26 18:49:27 -04:00
|
|
|
|
var P = E.Owner.Players[i];
|
2015-03-11 00:47:34 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
if (P == null)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (P.Masked)
|
|
|
|
|
playerList.AppendFormat("[^3{0}^7]{3}[^3{1}^7] {2}", Utilities.levelToColor(Player.Permission.User), P.clientID, P.Name, SharedLibrary.Utilities.getSpaces(Player.Permission.SeniorAdmin.ToString().Length - Player.Permission.User.ToString().Length));
|
|
|
|
|
else
|
|
|
|
|
playerList.AppendFormat("[^3{0}^7]{3}[^3{1}^7] {2}", Utilities.levelToColor(P.Level), P.clientID, P.Name, SharedLibrary.Utilities.getSpaces(Player.Permission.SeniorAdmin.ToString().Length - P.Level.ToString().Length));
|
2015-08-26 01:49:47 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
if (count == 2 || E.Owner.getPlayers().Count == 1)
|
|
|
|
|
{
|
|
|
|
|
await E.Origin.Tell(playerList.ToString());
|
|
|
|
|
count = 0;
|
|
|
|
|
playerList = new StringBuilder();
|
|
|
|
|
continue;
|
2015-07-15 17:11:29 -04:00
|
|
|
|
}
|
2017-05-26 18:49:27 -04:00
|
|
|
|
|
|
|
|
|
count++;
|
2015-03-08 17:20:10 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
class CHelp : Command
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
public CHelp(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
2015-03-08 17:20:10 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
|
|
|
|
String cmd = E.Data.Trim();
|
|
|
|
|
|
|
|
|
|
if (cmd.Length > 2)
|
|
|
|
|
{
|
|
|
|
|
bool found = false;
|
2017-05-26 18:49:27 -04:00
|
|
|
|
foreach (Command C in E.Owner.Manager.GetCommands())
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2015-08-20 01:06:44 -04:00
|
|
|
|
if (C.Name.Contains(cmd) || C.Name == cmd)
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell(" [^3" + C.Name + "^7] " + C.Description);
|
2015-03-08 17:20:10 -04:00
|
|
|
|
found = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!found)
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("Could not find that command");
|
2015-03-08 17:20:10 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
{
|
2015-03-11 00:47:34 -04:00
|
|
|
|
int count = 0;
|
2015-08-22 12:41:14 -04:00
|
|
|
|
StringBuilder helpResponse = new StringBuilder();
|
2017-05-26 18:49:27 -04:00
|
|
|
|
List<Command> CommandList = E.Owner.Manager.GetCommands();
|
2015-03-11 00:47:34 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
foreach (Command C in CommandList)
|
2015-03-11 00:47:34 -04:00
|
|
|
|
{
|
2015-08-20 01:06:44 -04:00
|
|
|
|
if (E.Origin.Level >= C.Permission)
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2015-08-22 12:41:14 -04:00
|
|
|
|
helpResponse.Append(" [^3" + C.Name + "^7] ");
|
2015-04-10 00:02:12 -04:00
|
|
|
|
if (count >= 4)
|
2015-03-11 00:47:34 -04:00
|
|
|
|
{
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell(helpResponse.ToString());
|
2015-08-22 12:41:14 -04:00
|
|
|
|
helpResponse = new StringBuilder();
|
2015-03-11 00:47:34 -04:00
|
|
|
|
count = 0;
|
|
|
|
|
}
|
|
|
|
|
count++;
|
2015-03-08 17:20:10 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell(helpResponse.ToString());
|
|
|
|
|
await E.Origin.Tell("Type !help <cmd> to get command usage example");
|
2015-03-08 17:20:10 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
class CFastRestart : Command
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
public CFastRestart(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
2015-03-08 17:20:10 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-28 16:47:21 -04:00
|
|
|
|
if (!E.Origin.Masked)
|
|
|
|
|
await E.Owner.Broadcast($"Fast restarting in ^53 ^7seconds [^5{E.Origin.Name}^7]");
|
|
|
|
|
else
|
|
|
|
|
await E.Owner.Broadcast($"Fast restarting in ^53 ^7seconds [^5Masked Admin^7]");
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await Task.Delay(3000);
|
|
|
|
|
await E.Owner.ExecuteCommandAsync("fast_restart");
|
2015-03-08 17:20:10 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
class CMapRotate : Command
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
public CMapRotate(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
2015-03-08 17:20:10 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-28 16:47:21 -04:00
|
|
|
|
if (!E.Origin.Masked)
|
|
|
|
|
await E.Owner.Broadcast($"Map rotating in ^55 ^7seconds [^5{E.Origin.Name}^7]");
|
|
|
|
|
else
|
|
|
|
|
await E.Owner.Broadcast($"Map rotating in ^55 ^7seconds [^5Masked Admin^7]");
|
2017-05-27 18:08:04 -04:00
|
|
|
|
await Task.Delay(5000);
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Owner.ExecuteCommandAsync("map_rotate");
|
2015-03-08 17:20:10 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
class CSetLevel : Command
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
public CSetLevel(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
2015-03-08 17:20:10 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
|
|
|
|
if (E.Target == E.Origin)
|
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
await E.Origin.Tell("You cannot change your own level.");
|
2015-03-08 17:20:10 -04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
Player.Permission newPerm = Utilities.matchPermission(Utilities.RemoveWords(E.Data, 1));
|
2015-03-08 17:20:10 -04:00
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
if (newPerm == Player.Permission.Owner && E.Origin.Level != Player.Permission.Console)
|
|
|
|
|
newPerm = Player.Permission.Banned;
|
|
|
|
|
|
|
|
|
|
bool playerInOtherServer = false;
|
|
|
|
|
|
2015-03-08 17:20:10 -04:00
|
|
|
|
if (newPerm > Player.Permission.Banned)
|
|
|
|
|
{
|
|
|
|
|
E.Target.setLevel(newPerm);
|
2017-05-26 18:49:27 -04:00
|
|
|
|
// prevent saving of old permissions on disconnect
|
2017-05-27 00:22:50 -04:00
|
|
|
|
// todo: manager DB
|
2017-05-26 18:49:27 -04:00
|
|
|
|
foreach (var server in E.Owner.Manager.GetServers())
|
|
|
|
|
{
|
|
|
|
|
foreach (var player in server.getPlayers())
|
|
|
|
|
{
|
|
|
|
|
if (player != null && player.npID == E.Target.npID)
|
|
|
|
|
{
|
|
|
|
|
player.setLevel(newPerm);
|
|
|
|
|
await E.Target.Tell("Congratulations! You have been promoted to ^3" + newPerm);
|
2017-05-27 00:22:50 -04:00
|
|
|
|
playerInOtherServer = true;
|
2017-05-26 18:49:27 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
if (!playerInOtherServer)
|
|
|
|
|
await E.Target.Tell("Congratulations! You have been promoted to ^3" + newPerm);
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell(E.Target.Name + " was successfully promoted!");
|
|
|
|
|
|
2015-03-11 21:25:14 -04:00
|
|
|
|
//NEEED TO MOVE
|
2017-05-29 22:25:49 -04:00
|
|
|
|
E.Owner.Manager.GetClientDatabase().UpdatePlayer(E.Target);
|
2015-03-08 17:20:10 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("Invalid group specified.");
|
2015-03-08 17:20:10 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
class CUsage : Command
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
public CUsage(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
2015-03-08 17:20:10 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("IW4M Admin is using " + Math.Round(((System.Diagnostics.Process.GetCurrentProcess().PrivateMemorySize64 / 2048f) / 1200f), 1) + "MB");
|
2015-03-08 17:20:10 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
class CUptime : Command
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
public CUptime(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
2015-03-08 17:20:10 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
|
|
|
|
TimeSpan uptime = DateTime.Now - System.Diagnostics.Process.GetCurrentProcess().StartTime;
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell(String.Format("IW4M Admin has been up for {0} days, {1} hours, and {2} minutes", uptime.Days, uptime.Hours, uptime.Minutes));
|
2015-03-08 17:20:10 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
class CListAdmins : Command
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
public CListAdmins(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
2015-03-08 17:20:10 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
for (int i = 0; i < E.Owner.Players.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
var P = E.Owner.Players[i];
|
2017-05-26 18:49:27 -04:00
|
|
|
|
if (P != null && P.Level > Player.Permission.Flagged && !P.Masked)
|
|
|
|
|
await E.Origin.Tell(String.Format("[^3{0}^7] {1}", Utilities.levelToColor(P.Level), P.Name));
|
2017-05-27 00:22:50 -04:00
|
|
|
|
}
|
2015-03-08 17:20:10 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
class CLoadMap : Command
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
public CLoadMap(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
2015-03-08 17:20:10 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
|
|
|
|
string newMap = E.Data.Trim().ToLower();
|
|
|
|
|
foreach (Map m in E.Owner.maps)
|
|
|
|
|
{
|
|
|
|
|
if (m.Name.ToLower() == newMap || m.Alias.ToLower() == newMap)
|
|
|
|
|
{
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Owner.Broadcast("Changing to map ^2" + m.Alias);
|
|
|
|
|
await Task.Delay(5000);
|
|
|
|
|
await E.Owner.LoadMap(m.Name);
|
2015-03-08 17:20:10 -04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Owner.Broadcast("Attempting to change to unknown map ^1" + newMap);
|
|
|
|
|
await Task.Delay(5000);
|
|
|
|
|
await E.Owner.LoadMap(newMap);
|
2015-03-08 17:20:10 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
class CFindPlayer : Command
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
public CFindPlayer(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
2015-03-08 17:20:10 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-29 22:25:49 -04:00
|
|
|
|
var db_players = E.Owner.Manager.GetClientDatabase().FindPlayers(E.Data.Trim());
|
2015-03-23 23:01:05 -04:00
|
|
|
|
|
2015-03-08 17:20:10 -04:00
|
|
|
|
if (db_players == null)
|
|
|
|
|
{
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("No players found");
|
2015-03-08 17:20:10 -04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (Player P in db_players)
|
2015-03-13 19:40:16 -04:00
|
|
|
|
{
|
2015-08-20 13:52:30 -04:00
|
|
|
|
String mesg = String.Format("[^3{0}^7] [^3@{1}^7] - [{2}^7] - {3} | last seen {4} ago", P.Name, P.databaseID, SharedLibrary.Utilities.levelToColor(P.Level), P.IP, P.getLastConnection());
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell(mesg);
|
2015-03-08 17:20:10 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
class CFindAllPlayers : Command
|
2015-04-13 00:25:34 -04:00
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
public CFindAllPlayers(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
2015-04-13 00:25:34 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-04-13 00:25:34 -04:00
|
|
|
|
{
|
|
|
|
|
E.Data = E.Data.Trim();
|
|
|
|
|
|
|
|
|
|
if (E.Data.Length < 4)
|
|
|
|
|
{
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("You must enter at least 4 letters");
|
2015-04-13 00:25:34 -04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-29 22:25:49 -04:00
|
|
|
|
var db_aliases = E.Owner.Manager.GetAliasesDatabase().FindPlayerAliases(E.Data);
|
2015-04-13 00:25:34 -04:00
|
|
|
|
|
|
|
|
|
if (db_aliases == null)
|
|
|
|
|
{
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("No players found");
|
2015-04-13 00:25:34 -04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (Aliases P in db_aliases)
|
|
|
|
|
{
|
|
|
|
|
if (P == null)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
String lookingFor = String.Empty;
|
|
|
|
|
|
2015-08-21 21:11:35 -04:00
|
|
|
|
foreach(String S in P.Names)
|
2015-04-13 00:25:34 -04:00
|
|
|
|
{
|
|
|
|
|
if (S.Contains(E.Data))
|
|
|
|
|
lookingFor = S;
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-29 22:25:49 -04:00
|
|
|
|
Player Current = E.Owner.Manager.GetClientDatabase().GetPlayer(P.Number);
|
2015-04-13 00:25:34 -04:00
|
|
|
|
|
|
|
|
|
if (Current != null)
|
|
|
|
|
{
|
2015-08-20 01:06:44 -04:00
|
|
|
|
String mesg = String.Format("^1{0} ^7now goes by ^5{1}^7 [^3{2}^7]", lookingFor, Current.Name, Current.databaseID);
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell(mesg);
|
2015-04-13 00:25:34 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
class CListRules : Command
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
public CListRules(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
2015-03-08 17:20:10 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-03-08 17:20:10 -04:00
|
|
|
|
{
|
|
|
|
|
if (E.Owner.rules.Count < 1)
|
2017-05-27 00:22:50 -04:00
|
|
|
|
await E.Origin.Tell("The server onwer has not set any rules.");
|
2015-03-08 17:20:10 -04:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
foreach (String r in E.Owner.rules)
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("- " + r);
|
2015-03-08 17:20:10 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-03-09 16:11:09 -04:00
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
class CPrivateMessage : Command
|
2015-03-09 16:11:09 -04:00
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
public CPrivateMessage(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
2015-03-09 16:11:09 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-03-09 16:11:09 -04:00
|
|
|
|
{
|
2017-05-26 18:49:27 -04:00
|
|
|
|
E.Data = Utilities.RemoveWords(E.Data, 1);
|
|
|
|
|
await E.Target.Tell("^1" + E.Origin.Name + " ^3[PM]^7 - " + E.Data);
|
|
|
|
|
await E.Origin.Tell(String.Format("To ^3{0} ^7-> {1}", E.Target.Name, E.Data));
|
2015-03-09 16:11:09 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
2015-03-09 21:28:37 -04:00
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
class CReload : Command
|
2015-03-13 19:40:16 -04:00
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
public CReload(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
2015-03-13 19:40:16 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
|
|
|
|
{
|
2015-03-13 19:40:16 -04:00
|
|
|
|
if (E.Owner.Reload())
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("Sucessfully reloaded configs!");
|
2015-03-13 19:40:16 -04:00
|
|
|
|
else
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("Unable to reload configs :(");
|
2015-03-13 19:40:16 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-23 23:01:05 -04:00
|
|
|
|
class Flag : Command
|
|
|
|
|
{
|
|
|
|
|
public Flag(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-03-23 23:01:05 -04:00
|
|
|
|
{
|
2015-08-20 01:06:44 -04:00
|
|
|
|
if (E.Target.Level >= E.Origin.Level)
|
2015-03-23 23:01:05 -04:00
|
|
|
|
{
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("You cannot flag " + E.Target.Name);
|
2015-03-23 23:01:05 -04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-20 01:06:44 -04:00
|
|
|
|
if (E.Target.Level == Player.Permission.Flagged)
|
2015-03-23 23:01:05 -04:00
|
|
|
|
{
|
|
|
|
|
E.Target.setLevel(Player.Permission.User);
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("You have ^5unflagged ^7" + E.Target.Name);
|
2015-03-23 23:01:05 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
E.Target.setLevel(Player.Permission.Flagged);
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("You have ^5flagged ^7" + E.Target.Name);
|
2015-03-23 23:01:05 -04:00
|
|
|
|
}
|
|
|
|
|
|
2017-05-29 22:25:49 -04:00
|
|
|
|
E.Owner.Manager.GetClientDatabase().UpdatePlayer(E.Target);
|
2015-03-23 23:01:05 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
class CReport : Command
|
2015-03-23 23:01:05 -04:00
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
public CReport(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
2015-03-23 23:01:05 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-03-23 23:01:05 -04:00
|
|
|
|
{
|
2017-05-26 18:49:27 -04:00
|
|
|
|
if (E.Owner.Reports.Find(x => (x.Origin == E.Origin && x.Target.npID == E.Target.npID)) != null)
|
2016-01-16 17:58:24 -05:00
|
|
|
|
{
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("You have already reported this player");
|
2016-01-16 17:58:24 -05:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-10 00:02:12 -04:00
|
|
|
|
if (E.Target == E.Origin)
|
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
await E.Origin.Tell("You cannot report yourself.");
|
2015-04-10 00:02:12 -04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-20 01:06:44 -04:00
|
|
|
|
if (E.Target.Level > E.Origin.Level)
|
2015-03-23 23:01:05 -04:00
|
|
|
|
{
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("You cannot report " + E.Target.Name);
|
2015-03-23 23:01:05 -04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
E.Data = E.Data.RemoveWords(1);
|
2015-03-23 23:01:05 -04:00
|
|
|
|
E.Owner.Reports.Add(new Report(E.Target, E.Origin, E.Data));
|
2016-01-16 17:58:24 -05:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("Successfully reported " + E.Target.Name);
|
|
|
|
|
await E.Owner.ExecuteEvent(new Event(Event.GType.Report, E.Data, E.Origin, E.Target, E.Owner));
|
2016-01-16 17:58:24 -05:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Owner.ToAdmins(String.Format("^5{0}^7->^1{1}^7: {2}", E.Origin.Name, E.Target.Name, E.Data));
|
2015-03-23 23:01:05 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
class CListReports : Command
|
2015-03-23 23:01:05 -04:00
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
public CListReports(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
2015-03-23 23:01:05 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-03-23 23:01:05 -04:00
|
|
|
|
{
|
2015-08-26 01:49:47 -04:00
|
|
|
|
if (E.Data != null && E.Data.ToLower().Contains("clear"))
|
|
|
|
|
{
|
|
|
|
|
E.Owner.Reports = new List<Report>();
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("Reports successfully cleared!");
|
2015-08-26 01:49:47 -04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-23 23:01:05 -04:00
|
|
|
|
if (E.Owner.Reports.Count < 1)
|
|
|
|
|
{
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("No players reported yet.");
|
2015-03-23 23:01:05 -04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
foreach (Report R in E.Owner.Reports)
|
|
|
|
|
await E.Origin.Tell(String.Format("^5{0}^7->^1{1}^7: {2}", R.Origin.Name, R.Target.Name, R.Reason));
|
2015-03-23 23:01:05 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
class CMask : Command
|
2015-04-10 00:02:12 -04:00
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
public CMask(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
2015-04-10 00:02:12 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-04-10 00:02:12 -04:00
|
|
|
|
{
|
|
|
|
|
if (E.Origin.Masked)
|
|
|
|
|
{
|
|
|
|
|
E.Origin.Masked = false;
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("You are now unmasked");
|
2015-04-10 00:02:12 -04:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
E.Origin.Masked = true;
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("You are now masked");
|
2015-04-10 00:02:12 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
class CListBanInfo : Command
|
2015-04-10 00:02:12 -04:00
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
public CListBanInfo(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
2015-04-10 00:02:12 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-04-10 00:02:12 -04:00
|
|
|
|
{
|
|
|
|
|
if (E.Target == null)
|
|
|
|
|
{
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("No bans for that player.");
|
2015-04-10 00:02:12 -04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 18:08:04 -04:00
|
|
|
|
var B = E.Owner.Manager.GetClientPenalties().FindPenalties(E.Target);
|
|
|
|
|
var BannedPenalty = B.Find(b => b.BType == Penalty.Type.Ban);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (BannedPenalty == null)
|
2015-04-10 00:02:12 -04:00
|
|
|
|
{
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("No active ban was found for that player.");
|
2015-04-10 00:02:12 -04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-29 22:25:49 -04:00
|
|
|
|
Player Banner = E.Owner.Manager.GetClientDatabase().GetPlayer(BannedPenalty.bannedByID, -1);
|
2015-04-10 00:02:12 -04:00
|
|
|
|
|
|
|
|
|
if (Banner == null)
|
|
|
|
|
{
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell("Ban was found for the player, but origin of the ban is unavailable.");
|
2015-04-10 00:02:12 -04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 18:08:04 -04:00
|
|
|
|
await E.Origin.Tell(String.Format("^1{0} ^7was banned by ^5{1} ^7for: {2}", E.Target.Name, Banner.Name, BannedPenalty.Reason));
|
2015-04-10 00:02:12 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
class CListAlias : Command
|
2015-04-10 00:02:12 -04:00
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
public CListAlias(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
2015-04-10 00:02:12 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-04-10 00:02:12 -04:00
|
|
|
|
{
|
2017-05-29 22:25:49 -04:00
|
|
|
|
E.Target.Alias = E.Owner.Manager.GetAliasesDatabase().GetPlayerAliases(E.Target.databaseID);
|
2015-04-10 00:02:12 -04:00
|
|
|
|
|
|
|
|
|
if (E.Target.Alias == null)
|
|
|
|
|
{
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Target.Tell("Could not find alias info for that player.");
|
2015-04-10 00:02:12 -04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Target.Tell("[^3" + E.Target.Name + "^7]");
|
2015-04-10 00:02:12 -04:00
|
|
|
|
StringBuilder message = new StringBuilder();
|
|
|
|
|
|
2015-08-21 21:11:35 -04:00
|
|
|
|
List<Player> playerAliases = E.Owner.getPlayerAliases(E.Target);
|
2015-04-10 00:02:12 -04:00
|
|
|
|
|
2015-07-17 18:53:51 -04:00
|
|
|
|
message.Append("Aliases: ");
|
2015-04-10 00:02:12 -04:00
|
|
|
|
|
2015-07-17 18:53:51 -04:00
|
|
|
|
foreach (Player P in playerAliases)
|
|
|
|
|
{
|
2015-08-21 21:11:35 -04:00
|
|
|
|
foreach (String S in P.Alias.Names)
|
2015-04-10 00:02:12 -04:00
|
|
|
|
{
|
2015-08-20 01:06:44 -04:00
|
|
|
|
if (S != String.Empty && S != E.Target.Name)
|
2015-07-17 18:53:51 -04:00
|
|
|
|
message.Append(S + " | ");
|
2015-04-10 00:02:12 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell(message.ToString());
|
2015-04-10 00:02:12 -04:00
|
|
|
|
|
2015-04-11 13:31:04 -04:00
|
|
|
|
message = new StringBuilder();
|
|
|
|
|
|
2015-08-21 21:11:35 -04:00
|
|
|
|
if (E.Target.Alias.IPS != null)
|
2015-04-10 00:02:12 -04:00
|
|
|
|
{
|
2015-04-11 13:31:04 -04:00
|
|
|
|
message.Append("IPs: ");
|
2015-04-10 00:02:12 -04:00
|
|
|
|
|
|
|
|
|
foreach (Player P2 in playerAliases)
|
|
|
|
|
{
|
2015-08-21 21:11:35 -04:00
|
|
|
|
foreach (String IP in P2.Alias.IPS)
|
2015-04-10 00:02:12 -04:00
|
|
|
|
{
|
|
|
|
|
if (IP.Split('.').Length > 3 && IP != String.Empty && !message.ToString().Contains(IP))
|
|
|
|
|
message.Append (IP + " | ");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.Tell(message.ToString());
|
2015-04-10 00:02:12 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
class CExecuteRCON : Command
|
2015-04-10 00:02:12 -04:00
|
|
|
|
{
|
2017-05-27 00:22:50 -04:00
|
|
|
|
public CExecuteRCON(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
2015-04-10 00:02:12 -04:00
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
|
public override async Task ExecuteAsync(Event E)
|
2015-04-10 00:02:12 -04:00
|
|
|
|
{
|
2017-05-26 18:49:27 -04:00
|
|
|
|
await E.Origin.currentServer.ExecuteCommandAsync(E.Data.Trim());
|
|
|
|
|
await E.Origin.Tell("Successfuly sent RCON command!");
|
2015-04-10 00:02:12 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
2015-03-08 17:20:10 -04:00
|
|
|
|
}
|
2015-03-23 23:01:05 -04:00
|
|
|
|
|