mirror of
https://github.com/MikuLeaks/MikuSB.git
synced 2026-06-04 10:03:57 +00:00
Rewrite girl skin type handling
This commit is contained in:
60
GameServer/Command/Commands/CommandDebug.cs
Normal file
60
GameServer/Command/Commands/CommandDebug.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using MikuSB.Configuration;
|
||||
using MikuSB.Enums.Player;
|
||||
using MikuSB.Util;
|
||||
|
||||
namespace MikuSB.GameServer.Command.Commands;
|
||||
|
||||
[CommandInfo("debug", "Debug packet output", "/debug [on|off|simple|detail|file]", ["dbg"], [PermEnum.Admin, PermEnum.Support])]
|
||||
public class CommandDebug : ICommands
|
||||
{
|
||||
private static readonly Logger Logger = new("CommandManager");
|
||||
|
||||
[CommandDefault]
|
||||
public async ValueTask ToggleDebug(CommandArg arg)
|
||||
{
|
||||
var option = arg.Args.FirstOrDefault()?.ToLowerInvariant() ?? "on";
|
||||
var serverOption = ConfigManager.Config.ServerOption;
|
||||
var message = option switch
|
||||
{
|
||||
"on" => EnableDebug(serverOption),
|
||||
"off" => DisableDebug(serverOption),
|
||||
"simple" => EnableSimpleDebug(serverOption),
|
||||
"detail" => EnableDebug(serverOption),
|
||||
"file" => ToggleDebugFile(serverOption),
|
||||
_ => "Usage: /debug [on|off|simple|detail|file]"
|
||||
};
|
||||
|
||||
Logger.Info(message);
|
||||
await arg.SendMsg(message);
|
||||
}
|
||||
|
||||
private static string EnableDebug(ServerOption serverOption)
|
||||
{
|
||||
serverOption.EnableDebug = true;
|
||||
serverOption.DebugMessage = true;
|
||||
serverOption.DebugDetailMessage = true;
|
||||
return "Debug packet output enabled.";
|
||||
}
|
||||
|
||||
private static string DisableDebug(ServerOption serverOption)
|
||||
{
|
||||
serverOption.EnableDebug = false;
|
||||
return "Debug packet output disabled.";
|
||||
}
|
||||
|
||||
private static string EnableSimpleDebug(ServerOption serverOption)
|
||||
{
|
||||
serverOption.EnableDebug = true;
|
||||
serverOption.DebugMessage = true;
|
||||
serverOption.DebugDetailMessage = false;
|
||||
return "Simple debug packet output enabled.";
|
||||
}
|
||||
|
||||
private static string ToggleDebugFile(ServerOption serverOption)
|
||||
{
|
||||
serverOption.SavePersonalDebugFile = !serverOption.SavePersonalDebugFile;
|
||||
return serverOption.SavePersonalDebugFile
|
||||
? "Personal debug file output enabled."
|
||||
: "Personal debug file output disabled.";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user