Nothing huge, just log changes on a mis-interpreted logging and changed ActorsCommand.cs descriptions.

This commit is contained in:
Lucca Faria Ferri 2023-02-04 11:13:49 -08:00
parent 614031d550
commit ba357de3b5
2 changed files with 53 additions and 6 deletions

View File

@ -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());
}
}
}

View File

@ -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.";