add localized level names
intellisense suggestion junk
This commit is contained in:
parent
3c0e101f14
commit
bbade07646
@ -36,7 +36,7 @@ namespace IW4MAdmin.Application.API.Master
|
|||||||
public class Endpoint
|
public class Endpoint
|
||||||
{
|
{
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
private static IMasterApi api = RestClient.For<IMasterApi>("http://api.raidmax.org:5000");
|
private static readonly IMasterApi api = RestClient.For<IMasterApi>("http://api.raidmax.org:5000");
|
||||||
#else
|
#else
|
||||||
private static IMasterApi api = RestClient.For<IMasterApi>("http://127.0.0.1");
|
private static IMasterApi api = RestClient.For<IMasterApi>("http://127.0.0.1");
|
||||||
#endif
|
#endif
|
||||||
|
@ -11,7 +11,7 @@ namespace IW4MAdmin.Application.IO
|
|||||||
Server Server;
|
Server Server;
|
||||||
long PreviousFileSize;
|
long PreviousFileSize;
|
||||||
GameLogReader Reader;
|
GameLogReader Reader;
|
||||||
string GameLogFile;
|
readonly string GameLogFile;
|
||||||
|
|
||||||
class EventState
|
class EventState
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,7 @@ namespace IW4MAdmin.Application.IO
|
|||||||
class GameLogReader
|
class GameLogReader
|
||||||
{
|
{
|
||||||
IEventParser Parser;
|
IEventParser Parser;
|
||||||
string LogFile;
|
readonly string LogFile;
|
||||||
|
|
||||||
public GameLogReader(string logFile, IEventParser parser)
|
public GameLogReader(string logFile, IEventParser parser)
|
||||||
{
|
{
|
||||||
|
@ -17,8 +17,8 @@ namespace IW4MAdmin.Application
|
|||||||
Assert
|
Assert
|
||||||
}
|
}
|
||||||
|
|
||||||
string FileName;
|
readonly string FileName;
|
||||||
object ThreadLock;
|
readonly object ThreadLock;
|
||||||
|
|
||||||
public Logger(string fn)
|
public Logger(string fn)
|
||||||
{
|
{
|
||||||
|
@ -36,12 +36,12 @@ namespace IW4MAdmin.Application
|
|||||||
public DateTime StartTime { get; private set; }
|
public DateTime StartTime { get; private set; }
|
||||||
|
|
||||||
static ApplicationManager Instance;
|
static ApplicationManager Instance;
|
||||||
List<AsyncStatus> TaskStatuses;
|
readonly List<AsyncStatus> TaskStatuses;
|
||||||
List<Command> Commands;
|
List<Command> Commands;
|
||||||
List<MessageToken> MessageTokens;
|
readonly List<MessageToken> MessageTokens;
|
||||||
ClientService ClientSvc;
|
ClientService ClientSvc;
|
||||||
AliasService AliasSvc;
|
readonly AliasService AliasSvc;
|
||||||
PenaltyService PenaltySvc;
|
readonly PenaltyService PenaltySvc;
|
||||||
BaseConfigurationHandler<ApplicationConfiguration> ConfigHandler;
|
BaseConfigurationHandler<ApplicationConfiguration> ConfigHandler;
|
||||||
EventApi Api;
|
EventApi Api;
|
||||||
GameEventHandler Handler;
|
GameEventHandler Handler;
|
||||||
|
@ -14,7 +14,7 @@ namespace Application.RconParsers
|
|||||||
{
|
{
|
||||||
class IW4RConParser : IRConParser
|
class IW4RConParser : IRConParser
|
||||||
{
|
{
|
||||||
private static CommandPrefix Prefixes = new CommandPrefix()
|
private static readonly CommandPrefix Prefixes = new CommandPrefix()
|
||||||
{
|
{
|
||||||
Tell = "tellraw {0} {1}",
|
Tell = "tellraw {0} {1}",
|
||||||
Say = "sayraw {0}",
|
Say = "sayraw {0}",
|
||||||
@ -23,7 +23,7 @@ namespace Application.RconParsers
|
|||||||
TempBan = "tempbanclient {0} \"{1}\""
|
TempBan = "tempbanclient {0} \"{1}\""
|
||||||
};
|
};
|
||||||
|
|
||||||
private static string StatusRegex = @"^( *[0-9]+) +-*([0-9]+) +((?:[A-Z]+|[0-9]+)) +((?:[a-z]|[0-9]){16}|(?:[a-z]|[0-9]){32}|bot[0-9]+|(?:[0-9]+)) *(.{0,32}) +([0-9]+) +(\d+\.\d+\.\d+.\d+\:-*\d{1,5}|0+.0+:-*\d{1,5}|loopback) +(-*[0-9]+) +([0-9]+) *$";
|
private static readonly string StatusRegex = @"^( *[0-9]+) +-*([0-9]+) +((?:[A-Z]+|[0-9]+)) +((?:[a-z]|[0-9]){16}|(?:[a-z]|[0-9]){32}|bot[0-9]+|(?:[0-9]+)) *(.{0,32}) +([0-9]+) +(\d+\.\d+\.\d+.\d+\:-*\d{1,5}|0+.0+:-*\d{1,5}|loopback) +(-*[0-9]+) +([0-9]+) *$";
|
||||||
|
|
||||||
public async Task<string[]> ExecuteCommandAsync(Connection connection, string command)
|
public async Task<string[]> ExecuteCommandAsync(Connection connection, string command)
|
||||||
{
|
{
|
||||||
|
@ -16,7 +16,7 @@ namespace Application.RconParsers
|
|||||||
{
|
{
|
||||||
public class IW5MRConParser : IRConParser
|
public class IW5MRConParser : IRConParser
|
||||||
{
|
{
|
||||||
private static CommandPrefix Prefixes = new CommandPrefix()
|
private static readonly CommandPrefix Prefixes = new CommandPrefix()
|
||||||
{
|
{
|
||||||
Tell = "tell {0} {1}",
|
Tell = "tell {0} {1}",
|
||||||
Say = "say {0}",
|
Say = "say {0}",
|
||||||
|
@ -52,7 +52,7 @@ namespace Application.RconParsers
|
|||||||
public PInfo[] Players { get; set; }
|
public PInfo[] Players { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CommandPrefix Prefixes = new CommandPrefix()
|
private static readonly CommandPrefix Prefixes = new CommandPrefix()
|
||||||
{
|
{
|
||||||
Tell = "tell {0} {1}",
|
Tell = "tell {0} {1}",
|
||||||
Say = "say {0}",
|
Say = "say {0}",
|
||||||
|
@ -223,9 +223,18 @@ namespace IW4MAdmin
|
|||||||
$"{loc["SERVER_TB_REMAIN"]} ({(currentBan.Expires - DateTime.UtcNow).TimeSpanText()} {loc["WEBFRONT_PENALTY_TEMPLATE_REMAINING"]})");
|
$"{loc["SERVER_TB_REMAIN"]} ({(currentBan.Expires - DateTime.UtcNow).TimeSpanText()} {loc["WEBFRONT_PENALTY_TEMPLATE_REMAINING"]})");
|
||||||
await this.ExecuteCommandAsync(formattedKick);
|
await this.ExecuteCommandAsync(formattedKick);
|
||||||
}
|
}
|
||||||
|
// the player is permanently banned
|
||||||
else
|
else
|
||||||
await player.Kick($"{loc["SERVER_BAN_PREV"]} {currentBan.Offense} ({loc["SERVER_BAN_APPEAL"]} {Website})", autoKickClient);
|
{
|
||||||
|
// don't store the kick message
|
||||||
|
string formattedKick = String.Format(
|
||||||
|
RconParser.GetCommandPrefixes().Kick,
|
||||||
|
polledPlayer.ClientNumber,
|
||||||
|
$"{loc["SERVER_BAN_PREV"]} {currentBan.Offense} ({loc["SERVER_BAN_APPEAL"]} {Website})");
|
||||||
|
await this.ExecuteCommandAsync(formattedKick);
|
||||||
|
}
|
||||||
|
|
||||||
|
// reban the "evading" guid
|
||||||
if (player.Level != Player.Permission.Banned && currentBan.Type == Penalty.PenaltyType.Ban)
|
if (player.Level != Player.Permission.Banned && currentBan.Type == Penalty.PenaltyType.Ban)
|
||||||
await player.Ban($"{currentBan.Offense}", autoKickClient);
|
await player.Ban($"{currentBan.Offense}", autoKickClient);
|
||||||
|
|
||||||
@ -594,7 +603,6 @@ namespace IW4MAdmin
|
|||||||
DateTime start = DateTime.Now;
|
DateTime start = DateTime.Now;
|
||||||
DateTime playerCountStart = DateTime.Now;
|
DateTime playerCountStart = DateTime.Now;
|
||||||
DateTime lastCount = DateTime.Now;
|
DateTime lastCount = DateTime.Now;
|
||||||
DateTime tickTime = DateTime.Now;
|
|
||||||
|
|
||||||
override public async Task<bool> ProcessUpdatesAsync(CancellationToken cts)
|
override public async Task<bool> ProcessUpdatesAsync(CancellationToken cts)
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,7 @@ namespace IW4MAdmin.Plugins.Stats.Cheat
|
|||||||
long LastOffset;
|
long LastOffset;
|
||||||
ILogger Log;
|
ILogger Log;
|
||||||
Strain Strain;
|
Strain Strain;
|
||||||
DateTime ConnectionTime = DateTime.UtcNow;
|
readonly DateTime ConnectionTime = DateTime.UtcNow;
|
||||||
|
|
||||||
public Detection(ILogger log, EFClientStatistics clientStats)
|
public Detection(ILogger log, EFClientStatistics clientStats)
|
||||||
{
|
{
|
||||||
|
@ -99,7 +99,7 @@ namespace IW4MAdmin.Plugins.Welcome
|
|||||||
private string ProcessAnnouncement(string msg, Player joining)
|
private string ProcessAnnouncement(string msg, Player joining)
|
||||||
{
|
{
|
||||||
msg = msg.Replace("{{ClientName}}", joining.Name);
|
msg = msg.Replace("{{ClientName}}", joining.Name);
|
||||||
msg = msg.Replace("{{ClientLevel}}", Utilities.ConvertLevelToColor(joining.Level));
|
msg = msg.Replace("{{ClientLevel}}", Utilities.ConvertLevelToColor(joining.Level, joining.ClientPermission.Name));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
CountryLookupProj.CountryLookup CLT = new CountryLookupProj.CountryLookup($"{Utilities.OperatingDirectory}Plugins{System.IO.Path.DirectorySeparatorChar}GeoIP.dat");
|
CountryLookupProj.CountryLookup CLT = new CountryLookupProj.CountryLookup($"{Utilities.OperatingDirectory}Plugins{System.IO.Path.DirectorySeparatorChar}GeoIP.dat");
|
||||||
|
@ -273,7 +273,7 @@ namespace SharedLibraryCore.Commands
|
|||||||
|
|
||||||
public override async Task ExecuteAsync(GameEvent E)
|
public override async Task ExecuteAsync(GameEvent E)
|
||||||
{
|
{
|
||||||
String You = String.Format("{0} [^3#{1}^7] {2} [^3@{3}^7] [{4}^7] IP: {5}", E.Origin.Name, E.Origin.ClientNumber, E.Origin.NetworkId, E.Origin.ClientId, Utilities.ConvertLevelToColor(E.Origin.Level), E.Origin.IPAddressString);
|
String You = String.Format("{0} [^3#{1}^7] {2} [^3@{3}^7] [{4}^7] IP: {5}", E.Origin.Name, E.Origin.ClientNumber, E.Origin.NetworkId, E.Origin.ClientId, Utilities.ConvertLevelToColor(E.Origin.Level, E.Origin.ClientPermission.Name), E.Origin.IPAddressString);
|
||||||
await E.Origin.Tell(You);
|
await E.Origin.Tell(You);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -294,11 +294,11 @@ namespace SharedLibraryCore.Commands
|
|||||||
|
|
||||||
if (P == null)
|
if (P == null)
|
||||||
continue;
|
continue;
|
||||||
|
// todo: fix spacing
|
||||||
if (P.Masked)
|
if (P.Masked)
|
||||||
playerList.AppendFormat("[^3{0}^7]{3}[^3{1}^7] {2}", Utilities.ConvertLevelToColor(Player.Permission.User), P.ClientNumber, P.Name, Utilities.GetSpaces(Player.Permission.SeniorAdmin.ToString().Length - Player.Permission.User.ToString().Length));
|
playerList.AppendFormat("[^3{0}^7]{3}[^3{1}^7] {2}", Utilities.ConvertLevelToColor(Player.Permission.User, P.ClientPermission.Name), P.ClientNumber, P.Name, Utilities.GetSpaces(Player.Permission.SeniorAdmin.ToString().Length - Player.Permission.User.ToString().Length));
|
||||||
else
|
else
|
||||||
playerList.AppendFormat("[^3{0}^7]{3}[^3{1}^7] {2}", Utilities.ConvertLevelToColor(P.Level), P.ClientNumber, P.Name, Utilities.GetSpaces(Player.Permission.SeniorAdmin.ToString().Length - P.Level.ToString().Length));
|
playerList.AppendFormat("[^3{0}^7]{3}[^3{1}^7] {2}", Utilities.ConvertLevelToColor(P.Level, P.ClientPermission.Name), P.ClientNumber, P.Name, Utilities.GetSpaces(Player.Permission.SeniorAdmin.ToString().Length - P.Level.ToString().Length));
|
||||||
|
|
||||||
if (count == 2 || E.Owner.GetPlayersAsList().Count == 1)
|
if (count == 2 || E.Owner.GetPlayersAsList().Count == 1)
|
||||||
{
|
{
|
||||||
@ -536,7 +536,7 @@ namespace SharedLibraryCore.Commands
|
|||||||
var onlineAdmins = S.GetPlayersAsList()
|
var onlineAdmins = S.GetPlayersAsList()
|
||||||
.Where(p => p.Level > Player.Permission.Flagged)
|
.Where(p => p.Level > Player.Permission.Flagged)
|
||||||
.Where(p => !p.Masked)
|
.Where(p => !p.Masked)
|
||||||
.Select(p => $"[^3{Utilities.ConvertLevelToColor(p.Level)}^7] {p.Name}");
|
.Select(p => $"[^3{Utilities.ConvertLevelToColor(p.Level, p.ClientPermission.Name)}^7] {p.Name}");
|
||||||
|
|
||||||
return onlineAdmins.Count() > 0 ?
|
return onlineAdmins.Count() > 0 ?
|
||||||
string.Join(Environment.NewLine, onlineAdmins) :
|
string.Join(Environment.NewLine, onlineAdmins) :
|
||||||
@ -622,10 +622,11 @@ namespace SharedLibraryCore.Commands
|
|||||||
|
|
||||||
foreach (var P in db_players)
|
foreach (var P in db_players)
|
||||||
{
|
{
|
||||||
|
string localizedLevel = Utilities.CurrentLocalization.LocalizationIndex[$"GLOBAL_PERMISSION_{P.Level.ToString().ToUpper()}"];
|
||||||
// they're not going by another alias
|
// they're not going by another alias
|
||||||
string msg = P.Name.ToLower().Contains(E.Data.ToLower()) ?
|
string msg = P.Name.ToLower().Contains(E.Data.ToLower()) ?
|
||||||
$"[^3{P.Name}^7] [^3@{P.ClientId}^7] - [{ Utilities.ConvertLevelToColor(P.Level)}^7] - {P.IPAddressString} | last seen {Utilities.GetTimePassed(P.LastConnection)}" :
|
$"[^3{P.Name}^7] [^3@{P.ClientId}^7] - [{ Utilities.ConvertLevelToColor(P.Level, localizedLevel)}^7] - {P.IPAddressString} | last seen {Utilities.GetTimePassed(P.LastConnection)}" :
|
||||||
$"({P.AliasLink.Children.First(a => a.Name.ToLower().Contains(E.Data.ToLower())).Name})->[^3{P.Name}^7] [^3@{P.ClientId}^7] - [{ Utilities.ConvertLevelToColor(P.Level)}^7] - {P.IPAddressString} | last seen {Utilities.GetTimePassed(P.LastConnection)}";
|
$"({P.AliasLink.Children.First(a => a.Name.ToLower().Contains(E.Data.ToLower())).Name})->[^3{P.Name}^7] [^3@{P.ClientId}^7] - [{ Utilities.ConvertLevelToColor(P.Level, localizedLevel)}^7] - {P.IPAddressString} | last seen {Utilities.GetTimePassed(P.LastConnection)}";
|
||||||
await E.Origin.Tell(msg);
|
await E.Origin.Tell(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ namespace SharedLibraryCore
|
|||||||
{
|
{
|
||||||
public class RemoteFile : IFile
|
public class RemoteFile : IFile
|
||||||
{
|
{
|
||||||
string Location;
|
readonly string Location;
|
||||||
string[] FileCache = new string[0];
|
string[] FileCache = new string[0];
|
||||||
|
|
||||||
public RemoteFile(string location) : base(string.Empty)
|
public RemoteFile(string location) : base(string.Empty)
|
||||||
@ -101,7 +101,7 @@ namespace SharedLibraryCore
|
|||||||
//END
|
//END
|
||||||
|
|
||||||
private long sze;
|
private long sze;
|
||||||
private String Name;
|
private readonly String Name;
|
||||||
private StreamReader Handle;
|
private StreamReader Handle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
13
SharedLibraryCore/Objects/Permission.cs
Normal file
13
SharedLibraryCore/Objects/Permission.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using static SharedLibraryCore.Objects.Player;
|
||||||
|
|
||||||
|
namespace SharedLibraryCore.Objects
|
||||||
|
{
|
||||||
|
public sealed class ClientPermission
|
||||||
|
{
|
||||||
|
public Permission Level { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -26,7 +27,7 @@ namespace SharedLibraryCore.Objects
|
|||||||
SeniorAdmin = 5,
|
SeniorAdmin = 5,
|
||||||
Owner = 6,
|
Owner = 6,
|
||||||
Creator = 7,
|
Creator = 7,
|
||||||
Console = 8,
|
Console = 8
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player()
|
public Player()
|
||||||
@ -102,8 +103,6 @@ namespace SharedLibraryCore.Objects
|
|||||||
[NotMapped]
|
[NotMapped]
|
||||||
public int Score { get; set; }
|
public int Score { get; set; }
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public IList<Dtos.ProfileMeta> Meta { get; set; }
|
|
||||||
[NotMapped]
|
|
||||||
public bool IsBot { get; set; }
|
public bool IsBot { get; set; }
|
||||||
private int _ipaddress;
|
private int _ipaddress;
|
||||||
public override int IPAddress
|
public override int IPAddress
|
||||||
@ -115,7 +114,7 @@ namespace SharedLibraryCore.Objects
|
|||||||
public override string Name
|
public override string Name
|
||||||
{
|
{
|
||||||
get { return _name; }
|
get { return _name; }
|
||||||
set { _name = value; }
|
set { _name = value; }
|
||||||
}
|
}
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public bool IsAuthenticated { get; set; }
|
public bool IsAuthenticated { get; set; }
|
||||||
@ -123,6 +122,14 @@ namespace SharedLibraryCore.Objects
|
|||||||
public ClientState State { get; set; }
|
public ClientState State { get; set; }
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public Queue<GameEvent> DelayedEvents { get; set; }
|
public Queue<GameEvent> DelayedEvents { get; set; }
|
||||||
|
[NotMapped]
|
||||||
|
// this is kinda dirty, but I need localizable level names
|
||||||
|
public ClientPermission ClientPermission => new ClientPermission()
|
||||||
|
{
|
||||||
|
Level = Level,
|
||||||
|
Name = Utilities.CurrentLocalization
|
||||||
|
.LocalizationIndex[$"GLOBAL_PERMISSION_{Level.ToString().ToUpper()}"]
|
||||||
|
};
|
||||||
|
|
||||||
public override bool Equals(object obj)
|
public override bool Equals(object obj)
|
||||||
{
|
{
|
||||||
|
@ -330,8 +330,8 @@ namespace SharedLibraryCore
|
|||||||
protected ManualResetEventSlim OnRemoteCommandResponse;
|
protected ManualResetEventSlim OnRemoteCommandResponse;
|
||||||
|
|
||||||
// only here for performance
|
// only here for performance
|
||||||
private bool CustomSayEnabled;
|
private readonly bool CustomSayEnabled;
|
||||||
private string CustomSayName;
|
private readonly string CustomSayName;
|
||||||
|
|
||||||
//Remote
|
//Remote
|
||||||
public IList<CommandResponseInfo> CommandResult = new List<CommandResponseInfo>();
|
public IList<CommandResponseInfo> CommandResult = new List<CommandResponseInfo>();
|
||||||
|
@ -56,7 +56,8 @@ namespace SharedLibraryCore
|
|||||||
String lookingFor = str.ToLower();
|
String lookingFor = str.ToLower();
|
||||||
|
|
||||||
for (Player.Permission Perm = Player.Permission.User; Perm < Player.Permission.Console; Perm++)
|
for (Player.Permission Perm = Player.Permission.User; Perm < Player.Permission.Console; Perm++)
|
||||||
if (lookingFor.Contains(Perm.ToString().ToLower()))
|
if (lookingFor.Contains(Perm.ToString().ToLower())
|
||||||
|
|| lookingFor.Contains(CurrentLocalization.LocalizationIndex[$"GLOBAL_PERMISSION_{Perm.ToString().ToUpper()}"].ToLower()))
|
||||||
return Perm;
|
return Perm;
|
||||||
|
|
||||||
return Player.Permission.Banned;
|
return Player.Permission.Banned;
|
||||||
@ -83,25 +84,36 @@ namespace SharedLibraryCore
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="level">Specified player level</param>
|
/// <param name="level">Specified player level</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static String ConvertLevelToColor(Player.Permission level)
|
public static String ConvertLevelToColor(Player.Permission level, string localizedLevel)
|
||||||
{
|
{
|
||||||
|
char colorCode = '6';
|
||||||
|
// todo: maybe make this game independant?
|
||||||
switch (level)
|
switch (level)
|
||||||
{
|
{
|
||||||
case Player.Permission.Banned:
|
case Player.Permission.Banned:
|
||||||
return "^1" + Player.Permission.Banned;
|
colorCode = '1';
|
||||||
|
break;
|
||||||
case Player.Permission.Flagged:
|
case Player.Permission.Flagged:
|
||||||
return "^9" + Player.Permission.Flagged;
|
colorCode = '9';
|
||||||
|
break;
|
||||||
case Player.Permission.Owner:
|
case Player.Permission.Owner:
|
||||||
return "^5" + Player.Permission.Owner;
|
colorCode = '5';
|
||||||
|
break;
|
||||||
case Player.Permission.User:
|
case Player.Permission.User:
|
||||||
return "^2" + Player.Permission.User;
|
colorCode = '2';
|
||||||
|
break;
|
||||||
case Player.Permission.Trusted:
|
case Player.Permission.Trusted:
|
||||||
return "^3" + Player.Permission.Trusted;
|
colorCode = '3';
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return "^6" + level;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $"^{colorCode}{localizedLevel ?? level.ToString()}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string ToLocalizedLevelName(this Player.Permission perm) => CurrentLocalization.LocalizationIndex[$"GLOBAL_PERMISSION_{perm.ToString().ToUpper()}"];
|
||||||
|
|
||||||
public static String ProcessMessageToken(this Server server, IList<Helpers.MessageToken> tokens, String str)
|
public static String ProcessMessageToken(this Server server, IList<Helpers.MessageToken> tokens, String str)
|
||||||
{
|
{
|
||||||
MatchCollection RegexMatches = Regex.Matches(str, @"\{\{[A-Z]+\}\}", RegexOptions.IgnoreCase);
|
MatchCollection RegexMatches = Regex.Matches(str, @"\{\{[A-Z]+\}\}", RegexOptions.IgnoreCase);
|
||||||
|
@ -37,9 +37,9 @@ namespace WebfrontCore.Controllers.API
|
|||||||
player.Name,
|
player.Name,
|
||||||
player.Score,
|
player.Score,
|
||||||
player.Ping,
|
player.Ping,
|
||||||
player.State,
|
State = player.State.ToString(),
|
||||||
player.ClientNumber,
|
player.ClientNumber,
|
||||||
player.ConnectionTime,
|
ConnectionTime = (DateTime.UtcNow - player.ConnectionTime).TotalSeconds,
|
||||||
player.Level,
|
player.Level,
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
@ -27,7 +27,7 @@ namespace WebfrontCore.Controllers
|
|||||||
var clientDto = new PlayerInfo()
|
var clientDto = new PlayerInfo()
|
||||||
{
|
{
|
||||||
Name = client.Name,
|
Name = client.Name,
|
||||||
Level = client.Level.ToString(),
|
Level = client.Level.ToLocalizedLevelName(),
|
||||||
LevelInt = (int)client.Level,
|
LevelInt = (int)client.Level,
|
||||||
ClientId = client.ClientId,
|
ClientId = client.ClientId,
|
||||||
IPAddress = client.IPAddressString,
|
IPAddress = client.IPAddressString,
|
||||||
@ -148,7 +148,7 @@ namespace WebfrontCore.Controllers
|
|||||||
var clientsDto = clients.Select(c => new PlayerInfo()
|
var clientsDto = clients.Select(c => new PlayerInfo()
|
||||||
{
|
{
|
||||||
Name = c.Name,
|
Name = c.Name,
|
||||||
Level = c.Level.ToString(),
|
Level = c.Level.ToLocalizedLevelName(),
|
||||||
LevelInt = (int)c.Level,
|
LevelInt = (int)c.Level,
|
||||||
ClientId = c.ClientId,
|
ClientId = c.ClientId,
|
||||||
LastSeen = Utilities.GetTimePassed(c.LastConnection, false)
|
LastSeen = Utilities.GetTimePassed(c.LastConnection, false)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using SharedLibraryCore;
|
||||||
using SharedLibraryCore.Dtos;
|
using SharedLibraryCore.Dtos;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -31,7 +32,7 @@ namespace WebfrontCore.Controllers
|
|||||||
{
|
{
|
||||||
Name = p.Name,
|
Name = p.Name,
|
||||||
ClientId = p.ClientId,
|
ClientId = p.ClientId,
|
||||||
Level = p.Level.ToString(),
|
Level = p.Level.ToLocalizedLevelName(),
|
||||||
LevelInt = (int)p.Level
|
LevelInt = (int)p.Level
|
||||||
}).ToList(),
|
}).ToList(),
|
||||||
ChatHistory = s.ChatHistory,
|
ChatHistory = s.ChatHistory,
|
||||||
|
@ -14,7 +14,7 @@ namespace WebfrontCore
|
|||||||
{
|
{
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
private IHostingEnvironment _appHost;
|
private readonly IHostingEnvironment _appHost;
|
||||||
public static IConfigurationRoot Configuration { get; private set; }
|
public static IConfigurationRoot Configuration { get; private set; }
|
||||||
|
|
||||||
public Startup(IHostingEnvironment env)
|
public Startup(IHostingEnvironment env)
|
||||||
|
@ -20,7 +20,7 @@ namespace WebfrontCore.ViewComponents
|
|||||||
OffenderName = p.Offender.Name,
|
OffenderName = p.Offender.Name,
|
||||||
PunisherId = p.PunisherId,
|
PunisherId = p.PunisherId,
|
||||||
PunisherName = p.Punisher.Name,
|
PunisherName = p.Punisher.Name,
|
||||||
PunisherLevel = p.Punisher.Level.ToString(),
|
PunisherLevel = p.Punisher.Level.ToLocalizedLevelName(),
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
Offense = !string.IsNullOrEmpty(p.AutomatedOffense) ? p.AutomatedOffense : p.Offense,
|
Offense = !string.IsNullOrEmpty(p.AutomatedOffense) ? p.AutomatedOffense : p.Offense,
|
||||||
#else
|
#else
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using SharedLibraryCore;
|
||||||
using SharedLibraryCore.Dtos;
|
using SharedLibraryCore.Dtos;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
@ -24,7 +25,7 @@ namespace WebfrontCore.ViewComponents
|
|||||||
{
|
{
|
||||||
Name = p.Name,
|
Name = p.Name,
|
||||||
ClientId = p.ClientId,
|
ClientId = p.ClientId,
|
||||||
Level = p.Level.ToString(),
|
Level = p.Level.ToLocalizedLevelName(),
|
||||||
LevelInt = (int)p.Level
|
LevelInt = (int)p.Level
|
||||||
}).ToList(),
|
}).ToList(),
|
||||||
ChatHistory = s.ChatHistory,
|
ChatHistory = s.ChatHistory,
|
||||||
|
Loading…
Reference in New Issue
Block a user