refactor(CS): schedule + periods are config-owned, AdminPanel-editable
Some checks failed
.NET Core / build (push) Has been cancelled

Move the auto-schedule from context-owned state to the plugin config (single source
of truth): RegistrationOpenDays + RegistrationOpenTimes + Registration/Preparation/
SiegeDuration are all editable in the AdminPanel plugin config and take effect live
(context refreshes its config reference each tick via UpdateConfiguration). /csschedule
now writes the config. Removed the duplicate Persisted schedule fields. 12 tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Acentech Dev
2026-07-15 14:52:07 +03:00
parent f586321123
commit 4651ef232c
5 changed files with 61 additions and 69 deletions

View File

@@ -88,12 +88,15 @@ public class CastleSiegeScheduleChatCommandPlugIn : IChatCommandPlugIn
private static string Describe(CastleSiegeContext context)
{
if (context.ScheduleTime is not { } time || context.ScheduleDays.Count == 0)
var config = context.Configuration;
if (config.RegistrationOpenTimes.Count == 0)
{
return "Castle Siege auto-schedule: (none). Set with /csschedule <days> <HH:mm UTC>.";
}
return $"Castle Siege auto-schedule: {string.Join(",", context.ScheduleDays)} at {time:HH:mm} UTC.";
var days = config.RegistrationOpenDays.Count > 0 ? string.Join(",", config.RegistrationOpenDays) : "every day";
var times = string.Join(",", config.RegistrationOpenTimes.Select(t => t.ToString("HH\\:mm")));
return $"Castle Siege auto-schedule: {days} at {times} UTC (reg {config.RegistrationDuration:g} -> prep {config.PreparationDuration:g} -> war {config.SiegeDuration:g}).";
}
private static ValueTask ShowAsync(Player player, string text)