feat(CS): on-map siege countdown timer (S6 client protocol C1 B2 17/1E)
Some checks failed
.NET Core / build (push) Has been cancelled
Some checks failed
.NET Core / build (push) Has been cancelled
Client already renders the siege-map countdown but never received the packets. New ICastleSiegeStatusViewPlugIn + RemoteView impl send the raw S6 packets: C1 B2 17 (battle start/stop flag, arms the countdown) and C1 B2 1E (remaining hour/minute). CastleSiegeEventPlugIn broadcasts them to players on the battle map every 10s during Siege and sends stop at Settlement. No client changes. +1 test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -193,6 +193,22 @@ public class CastleSiegeContext
|
||||
return scheduleTime <= nowTime && nowTime <= windowEnd;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns how much time is left in the running siege battle (the on-map countdown value), or
|
||||
/// <see cref="TimeSpan.Zero"/> when the siege is not currently running.
|
||||
/// </summary>
|
||||
/// <param name="nowUtc">The current UTC time.</param>
|
||||
public TimeSpan GetRemainingSiegeTime(DateTime nowUtc)
|
||||
{
|
||||
if (this.Phase != CastleSiegePhase.Siege)
|
||||
{
|
||||
return TimeSpan.Zero;
|
||||
}
|
||||
|
||||
var remaining = (this._phaseStartedUtc + this.Configuration.SiegeDuration) - nowUtc;
|
||||
return remaining > TimeSpan.Zero ? remaining : TimeSpan.Zero;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether the persistable state changed since the last call, resetting the flag.
|
||||
/// Called each tick by the plugin to decide whether to write state to the database.
|
||||
|
||||
Reference in New Issue
Block a user