diff --git a/src/DiIiS-NA/Core/Logging/AnsiTarget.cs b/src/DiIiS-NA/Core/Logging/AnsiTarget.cs index 4cf51ac..cca05f5 100644 --- a/src/DiIiS-NA/Core/Logging/AnsiTarget.cs +++ b/src/DiIiS-NA/Core/Logging/AnsiTarget.cs @@ -1,5 +1,6 @@ using System; using System.Diagnostics; +using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using Spectre.Console; @@ -134,7 +135,30 @@ public class AnsiTarget : LogTarget } catch (Exception ex) { - Debugger.Break(); + var regex = new Regex(@"\$\[.*?\]\$"); + var matches = regex.Matches(message); + foreach (Match match in matches) + { + message = message.Replace(match.Value, ""); + } + + if (IncludeTimeStamps) + { + _table.AddRow( + new Markup(DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss.fff"), GetStyleByLevel(level)), + new Markup(level.ToString(), GetStyleByLevel(level)).RightJustified(), + new Markup(logger, GetStyleByLevel(level)).LeftJustified(), + new Markup(Cleanup(message), GetStyleByLevel(level)).LeftJustified(), + new Markup(ex.Message, new Style(foreground: Color.Red3_1)).Centered()); + } + else + { + _table.AddRow( + new Markup(level.ToString()).RightJustified(), + new Markup(logger, GetStyleByLevel(level)).LeftJustified(), + new Markup(Cleanup(message), GetStyleByLevel(level)).LeftJustified(), + new Markup(ex.Message, new Style(foreground: Color.Red3_1)).Centered()); + } } } @@ -164,7 +188,30 @@ public class AnsiTarget : LogTarget } catch (Exception ex) { - Debugger.Break(); + var regex = new Regex(@"\$\[.*?\]\$"); + var matches = regex.Matches(message); + foreach (Match match in matches) + { + message = message.Replace(match.Value, ""); + } + + if (IncludeTimeStamps) + { + _table.AddRow( + new Markup(DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss.fff"), GetStyleByLevel(level)), + new Markup(level.ToString(), GetStyleByLevel(level)).RightJustified(), + new Markup(logger, GetStyleByLevel(level)).LeftJustified(), + new Markup(Cleanup(message), GetStyleByLevel(level)).LeftJustified(), + new Markup(ex.Message, new Style(foreground: Color.Red3_1)).Centered()); + } + else + { + _table.AddRow( + new Markup(level.ToString()).RightJustified(), + new Markup(logger, GetStyleByLevel(level)).LeftJustified(), + new Markup(Cleanup(message), GetStyleByLevel(level)).LeftJustified(), + new Markup(ex.Message, new Style(foreground: Color.Red3_1)).Centered()); + } } } diff --git a/src/DiIiS-NA/D3-GameServer/CommandManager/Commands/ActorsCommand.cs b/src/DiIiS-NA/D3-GameServer/CommandManager/Commands/ActorsCommand.cs index f3abb21..b438afa 100644 --- a/src/DiIiS-NA/D3-GameServer/CommandManager/Commands/ActorsCommand.cs +++ b/src/DiIiS-NA/D3-GameServer/CommandManager/Commands/ActorsCommand.cs @@ -11,7 +11,7 @@ namespace DiIiS_NA.GameServer.CommandManager; Account.UserLevels.Tester)] public class ActorsCommand : CommandGroup { - [Command("all", "Lists all actors.", Account.UserLevels.Tester)] + [Command("all", "Lists all actors in world sorted by distance to you.", Account.UserLevels.Tester)] public string All(string[] @params, BattleClient invokerClient) { if (invokerClient?.InGameClient?.Player is not {} player) @@ -32,7 +32,7 @@ public class ActorsCommand : CommandGroup })); } - [Command("revealed", "Lists all revealed actors.", Account.UserLevels.Tester)] + [Command("revealed", "Lists all revealed actors sorted by distance to you.", Account.UserLevels.Tester)] public string Revealed(string[] @params, BattleClient invokerClient) { if (invokerClient?.InGameClient?.Player is not {} player) @@ -54,8 +54,8 @@ public class ActorsCommand : CommandGroup })); } - [Command("setoperable", "Sets all actors operable (not the wisest invention).", Account.UserLevels.Tester)] - public string Operable(string[] @params, BattleClient invokerClient) + [Command("all-usable", "Sets all actors operable in world sorted by distance to you.e (not the wisest invention).", Account.UserLevels.Tester)] + public string Usable(string[] @params, BattleClient invokerClient) { if (invokerClient?.InGameClient?.Player is not {} player) return "You are not in game.";