substituting stepped hierarchy in place of trusted rank
added t5m to "supported" games fixed issue with unlimited replaces of client name is commands
This commit is contained in:
parent
88f31bc78c
commit
cd002a1413
@ -396,7 +396,7 @@ namespace SharedLibrary.Commands
|
|||||||
public class CSetLevel : Command
|
public class CSetLevel : Command
|
||||||
{
|
{
|
||||||
public CSetLevel() :
|
public CSetLevel() :
|
||||||
base("setlevel", "set player to specified administration level", "sl", Player.Permission.Owner, true, new CommandArgument[]
|
base("setlevel", "set player to specified administration level", "sl", Player.Permission.Moderator, true, new CommandArgument[]
|
||||||
{
|
{
|
||||||
new CommandArgument()
|
new CommandArgument()
|
||||||
{
|
{
|
||||||
@ -415,7 +415,7 @@ namespace SharedLibrary.Commands
|
|||||||
{
|
{
|
||||||
if (E.Target == E.Origin)
|
if (E.Target == E.Origin)
|
||||||
{
|
{
|
||||||
await E.Origin.Tell("You cannot change your own level.");
|
await E.Origin.Tell("You cannot change your own level");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,12 +424,29 @@ namespace SharedLibrary.Commands
|
|||||||
if (newPerm == Player.Permission.Owner && E.Origin.Level != Player.Permission.Console)
|
if (newPerm == Player.Permission.Owner && E.Origin.Level != Player.Permission.Console)
|
||||||
newPerm = Player.Permission.Banned;
|
newPerm = Player.Permission.Banned;
|
||||||
|
|
||||||
if (newPerm == Player.Permission.Owner && !E.Owner.Manager.GetApplicationSettings().Configuration().EnableMultipleOwners)
|
if (newPerm == Player.Permission.Owner &&
|
||||||
|
!E.Owner.Manager.GetApplicationSettings().Configuration().EnableMultipleOwners)
|
||||||
{
|
{
|
||||||
await E.Origin.Tell("There can only be 1 owner. Modify your appsettings if multiple owners are required");
|
await E.Origin.Tell("There can only be 1 owner. Modify your settings if multiple owners are required");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (E.Origin.Level < Player.Permission.Owner &&
|
||||||
|
!E.Owner.Manager.GetApplicationSettings().Configuration().EnableSteppedHierarchy)
|
||||||
|
{
|
||||||
|
await E.Origin.Tell($"This server does not allow you to promote ^5{E.Target.Name}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newPerm >= E.Origin.Level)
|
||||||
|
{
|
||||||
|
if (E.Origin.Level < Player.Permission.Owner)
|
||||||
|
{
|
||||||
|
await E.Origin.Tell($"You can only promote ^5{E.Target.Name} ^7to ^5{(E.Origin.Level - 1)} ^7or lower privilege");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (newPerm > Player.Permission.Banned)
|
if (newPerm > Player.Permission.Banned)
|
||||||
{
|
{
|
||||||
var ActiveClient = E.Owner.Manager.GetActiveClients()
|
var ActiveClient = E.Owner.Manager.GetActiveClients()
|
||||||
@ -447,11 +464,11 @@ namespace SharedLibrary.Commands
|
|||||||
await E.Owner.Manager.GetClientService().Update(E.Target);
|
await E.Owner.Manager.GetClientService().Update(E.Target);
|
||||||
}
|
}
|
||||||
|
|
||||||
await E.Origin.Tell($"{E.Target.Name} was successfully promoted!");
|
await E.Origin.Tell($"{E.Target.Name} was successfully promoted");
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
await E.Origin.Tell("Invalid group specified.");
|
await E.Origin.Tell("Invalid group specified");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -989,7 +1006,9 @@ namespace SharedLibrary.Commands
|
|||||||
{
|
{
|
||||||
if (!E.Owner.Throttled)
|
if (!E.Owner.Throttled)
|
||||||
{
|
{
|
||||||
// await E.Owner.ExecuteCommandAsync("quit");
|
#if !DEBUG
|
||||||
|
await E.Owner.ExecuteCommandAsync("quit");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ namespace SharedLibrary.Configuration
|
|||||||
public class ApplicationConfiguration : IBaseConfiguration
|
public class ApplicationConfiguration : IBaseConfiguration
|
||||||
{
|
{
|
||||||
public bool EnableMultipleOwners { get; set; }
|
public bool EnableMultipleOwners { get; set; }
|
||||||
public bool EnableTrustedRank { get; set; }
|
public bool EnableSteppedHierarchy { get; set; }
|
||||||
public bool EnableClientVPNs { get; set; }
|
public bool EnableClientVPNs { get; set; }
|
||||||
public bool EnableDiscordLink { get; set; }
|
public bool EnableDiscordLink { get; set; }
|
||||||
public string DiscordInviteCode { get; set; }
|
public string DiscordInviteCode { get; set; }
|
||||||
@ -24,13 +24,13 @@ namespace SharedLibrary.Configuration
|
|||||||
Console.Write("Enable multiple owners? [y/n]: ");
|
Console.Write("Enable multiple owners? [y/n]: ");
|
||||||
EnableMultipleOwners = (Console.ReadLine().ToLower().FirstOrDefault() as char?) == 'y';
|
EnableMultipleOwners = (Console.ReadLine().ToLower().FirstOrDefault() as char?) == 'y';
|
||||||
|
|
||||||
Console.Write("Enable trusted rank? [y/n]: ");
|
Console.Write("Enable stepped privilege hierarchy? [y/n]: ");
|
||||||
EnableTrustedRank = (Console.ReadLine().ToLower().FirstOrDefault() as char?) == 'y';
|
EnableSteppedHierarchy = (Console.ReadLine().ToLower().FirstOrDefault() as char?) == 'y';
|
||||||
|
|
||||||
Console.Write("Enable client VPNs [y/n]: ");
|
Console.Write("Enable client VPNs [y/n]: ");
|
||||||
EnableClientVPNs = (Console.ReadLine().ToLower().FirstOrDefault() as char?) == 'y';
|
EnableClientVPNs = (Console.ReadLine().ToLower().FirstOrDefault() as char?) == 'y';
|
||||||
|
|
||||||
if (EnableClientVPNs)
|
if (!EnableClientVPNs)
|
||||||
{
|
{
|
||||||
Console.Write("Enter iphub.info api key: ");
|
Console.Write("Enter iphub.info api key: ");
|
||||||
IPHubAPIKey = Console.ReadLine();
|
IPHubAPIKey = Console.ReadLine();
|
||||||
|
@ -56,7 +56,7 @@ namespace SharedLibrary.Database
|
|||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
foreach (string dllPath in System.IO.Directory.GetFiles($"{Utilities.OperatingDirectory}Plugins"))
|
foreach (string dllPath in System.IO.Directory.GetFiles($"{Utilities.OperatingDirectory}Plugins"))
|
||||||
#else
|
#else
|
||||||
foreach (string dllPath in System.IO.Directory.GetFiles(@"C:\Projects\IW4M-Admin\WebfrontCore\bin\x86\Debug\Plugins").Where(f => f.Contains(".dll")))
|
foreach (string dllPath in System.IO.Directory.GetFiles(/*C:\Projects\IW4M - Admin\WebfrontCore */ $@"{Environment.CurrentDirectory}\bin\x86\Debug\Plugins").Where(f => f.Contains(".dll")))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
Assembly library;
|
Assembly library;
|
||||||
|
@ -25,6 +25,7 @@ namespace SharedLibrary
|
|||||||
IW5,
|
IW5,
|
||||||
T4,
|
T4,
|
||||||
T5,
|
T5,
|
||||||
|
T5M,
|
||||||
}
|
}
|
||||||
|
|
||||||
public Server(Interfaces.IManager mgr, ServerConfiguration config)
|
public Server(Interfaces.IManager mgr, ServerConfiguration config)
|
||||||
|
@ -239,11 +239,6 @@ namespace SharedLibrary
|
|||||||
return new System.Net.IPAddress(BitConverter.GetBytes(ip)).ToString();
|
return new System.Net.IPAddress(BitConverter.GetBytes(ip)).ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String DateTimeSQLite(DateTime datetime)
|
|
||||||
{
|
|
||||||
return datetime.ToString("yyyy-MM-dd H:mm:ss");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String GetTimePassed(DateTime start)
|
public static String GetTimePassed(DateTime start)
|
||||||
{
|
{
|
||||||
return GetTimePassed(start, true);
|
return GetTimePassed(start, true);
|
||||||
@ -288,6 +283,8 @@ namespace SharedLibrary
|
|||||||
return Game.T4;
|
return Game.T4;
|
||||||
if (gameName.Contains("COD_T5_S"))
|
if (gameName.Contains("COD_T5_S"))
|
||||||
return Game.T5;
|
return Game.T5;
|
||||||
|
if (gameName.Contains("T5M"))
|
||||||
|
return Game.T5M;
|
||||||
if (gameName.Contains("IW5"))
|
if (gameName.Contains("IW5"))
|
||||||
return Game.IW5;
|
return Game.IW5;
|
||||||
|
|
||||||
@ -391,5 +388,7 @@ namespace SharedLibrary
|
|||||||
}
|
}
|
||||||
return cmdLine;
|
return cmdLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsPrivileged(this Player p) => p.Level > Player.Permission.User;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -296,8 +296,10 @@ namespace IW4MAdmin
|
|||||||
else if (matchingPlayers.Count == 1)
|
else if (matchingPlayers.Count == 1)
|
||||||
{
|
{
|
||||||
E.Target = matchingPlayers.First();
|
E.Target = matchingPlayers.First();
|
||||||
E.Data = Regex.Replace(E.Data, Regex.Escape($"\"{E.Target.Name}\""), "", RegexOptions.IgnoreCase).Trim();
|
|
||||||
E.Data = Regex.Replace(E.Data, Regex.Escape($"{E.Target.Name}"), "", RegexOptions.IgnoreCase).Trim();
|
string escapedName = Regex.Escape(E.Target.Name);
|
||||||
|
var reg = new Regex($"(\"{escapedName}\")|({escapedName})", RegexOptions.IgnoreCase);
|
||||||
|
E.Data = reg.Replace(E.Data, "", 1).Trim();
|
||||||
|
|
||||||
if (E.Data.Length == 0 && C.RequiredArgumentCount > 1)
|
if (E.Data.Length == 0 && C.RequiredArgumentCount > 1)
|
||||||
{
|
{
|
||||||
@ -321,8 +323,11 @@ namespace IW4MAdmin
|
|||||||
else if (matchingPlayers.Count == 1)
|
else if (matchingPlayers.Count == 1)
|
||||||
{
|
{
|
||||||
E.Target = matchingPlayers.First();
|
E.Target = matchingPlayers.First();
|
||||||
E.Data = Regex.Replace(E.Data, Regex.Escape($"{E.Target.Name}"), "", RegexOptions.IgnoreCase).Trim();
|
|
||||||
E.Data = Regex.Replace(E.Data, Regex.Escape($"{Args[0]}"), "", RegexOptions.IgnoreCase).Trim();
|
string escapedName = Regex.Escape(E.Target.Name);
|
||||||
|
string escapedArg = Regex.Escape(Args[0]);
|
||||||
|
var reg = new Regex($"({escapedName})|({escapedArg})", RegexOptions.IgnoreCase);
|
||||||
|
E.Data = reg.Replace(E.Data, "", 1).Trim();
|
||||||
|
|
||||||
if ((E.Data.Trim() == E.Target.Name.ToLower().Trim() ||
|
if ((E.Data.Trim() == E.Target.Name.ToLower().Trim() ||
|
||||||
E.Data == String.Empty) &&
|
E.Data == String.Empty) &&
|
||||||
@ -631,6 +636,8 @@ namespace IW4MAdmin
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
string mainPath = (GameName == Game.IW4 && onelog.Value >= 0) ? "userraw" : "main";
|
string mainPath = (GameName == Game.IW4 && onelog.Value >= 0) ? "userraw" : "main";
|
||||||
|
// patch for T5M log path
|
||||||
|
mainPath = (GameName == Game.T5M) ? "rzodemo" : mainPath;
|
||||||
|
|
||||||
string logPath = (game.Value == "" || onelog?.Value == 1) ?
|
string logPath = (game.Value == "" || onelog?.Value == 1) ?
|
||||||
$"{basepath.Value.Replace('\\', Path.DirectorySeparatorChar)}{Path.DirectorySeparatorChar}{mainPath}{Path.DirectorySeparatorChar}{logfile.Value}" :
|
$"{basepath.Value.Replace('\\', Path.DirectorySeparatorChar)}{Path.DirectorySeparatorChar}{mainPath}{Path.DirectorySeparatorChar}{logfile.Value}" :
|
||||||
@ -672,8 +679,8 @@ namespace IW4MAdmin
|
|||||||
if (E.Origin.Level > Player.Permission.Moderator)
|
if (E.Origin.Level > Player.Permission.Moderator)
|
||||||
await E.Origin.Tell($"There are ^5{Reports.Count} ^7recent reports");
|
await E.Origin.Tell($"There are ^5{Reports.Count} ^7recent reports");
|
||||||
|
|
||||||
// give trusted rank
|
/*// give trusted rank
|
||||||
if (Manager.GetApplicationSettings().Configuration().EnableTrustedRank &&
|
if (Manager.GetApplicationSettings().Configuration().EnableSteppedHierarchy &&
|
||||||
E.Origin.TotalConnectionTime / 60.0 >= 2880 &&
|
E.Origin.TotalConnectionTime / 60.0 >= 2880 &&
|
||||||
E.Origin.Level < Player.Permission.Trusted &&
|
E.Origin.Level < Player.Permission.Trusted &&
|
||||||
E.Origin.Level != Player.Permission.Flagged)
|
E.Origin.Level != Player.Permission.Flagged)
|
||||||
@ -682,7 +689,7 @@ namespace IW4MAdmin
|
|||||||
await E.Origin.Tell("Congratulations, you are now a ^5trusted ^7player! Type ^5!help ^7to view new commands");
|
await E.Origin.Tell("Congratulations, you are now a ^5trusted ^7player! Type ^5!help ^7to view new commands");
|
||||||
await E.Origin.Tell("You earned this by playing for ^53 ^7full days");
|
await E.Origin.Tell("You earned this by playing for ^53 ^7full days");
|
||||||
await Manager.GetClientService().Update(E.Origin);
|
await Manager.GetClientService().Update(E.Origin);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (E.Type == Event.GType.Disconnect)
|
else if (E.Type == Event.GType.Disconnect)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user