feat(debug-panel): [Item 8 & Item 3] add outfit toggle UI endpoint and update enemy camp selection

This commit is contained in:
CAtlas0784 committed 2026-09-16 02:19:44 +07:00
1 parent 3c3d9b141e
commit 97a371001b
2 files changed
+33 -5

No files matched your search

@@ -124,6 +124,8 @@ internal sealed class DebugApiServer(PrivateServerConfig config, GameSessionHub
await WriteJsonAsync(ctx, await UnstuckBlackScreenAsync(token), token);
else if (method == "POST" && path == "/api/player/rollback-10s")
await WriteJsonAsync(ctx, await RollbackPositionAsync(token), token);
else if (method == "POST" && path == "/api/player/toggle-clothes")
await WriteJsonAsync(ctx, await ToggleClothesAsync(token), token);
else if (method == "POST" && path == "/api/enemy/spawn")
await WriteJsonAsync(ctx, await SpawnEnemyAsync(await ReadBodyAsync(ctx.Request, token), token), token);
else if (method == "POST" && path == "/api/cutscene/play")
@@ -1032,6 +1034,19 @@ internal sealed class DebugApiServer(PrivateServerConfig config, GameSessionHub
return new { ok = true, timeline };
}
private async Task<object> ToggleClothesAsync(CancellationToken token)
{
var session = hub.Current;
if (session is null)
return new { ok = false, error = "no live game session (is the client in the world?)" };
var cmd = "CMD:TOGGLE_CLOTHES";
await session.NotifyAsync(MethodId.SyncNotice, UxSerializer.Serialize(cmd), token);
session.Log.Info("[DEBUG-API] toggle clothes dispatched");
return new { ok = true };
}
private static async Task<string> ReadBodyAsync(HttpListenerRequest request, CancellationToken token)
{
if (!request.HasEntityBody)