fix(heykel-savasi): allow /starths restart + accept unencrypted team-select
Some checks failed
.NET Core / build (push) Has been cancelled
Some checks failed
.NET Core / build (push) Has been cancelled
Two TvT (Heykel Savasi) event fixes found during mobile+PC client work: - PeriodicTaskBasePlugIn: a forced start (GM /starths) no longer blocked while a previous run's TaskDuration window is still open. When an event finished early (team won / empty / before the 20-min duration) players are warped out but the periodic state stayed Started with a future NextRunUtc, so the guard returned on every tick and a re-start only worked after the full duration or a server restart. Force-finish the stale run when _isStartForced so the same execution falls through and prepares a fresh one; the NextRunUtc wait now applies to scheduled runs only. - HeykelSavasiTeamSelectHandlerPlugIn: IsEncryptionExpected => false. The AdaMu client sends client-to-server packets unencrypted (like walk / animation / talk-to-npc), so the server was dropping the team-select (JOIN) packet. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -43,7 +43,21 @@ public abstract class PeriodicTaskBasePlugIn<TConfiguration, TState> : IPeriodic
|
||||
|
||||
var state = this.GetStateByGameContext(gameContext);
|
||||
|
||||
if (state.NextRunUtc > DateTime.UtcNow)
|
||||
// A forced start (GM command, e.g. /starths) must not be blocked while a previous run's
|
||||
// TaskDuration window is still open. When an event finished early (e.g. a team won, a team was
|
||||
// empty, or simply before the 20-minute TaskDuration elapsed) the players are warped out but the
|
||||
// periodic state stays Started with a future NextRunUtc. Without this, the guard below returns on
|
||||
// every tick and a re-start only worked after the full TaskDuration elapsed (or a server restart).
|
||||
// Force-finish the stale run here so this same execution falls through and prepares a fresh one.
|
||||
if (this._isStartForced && state.State == PeriodicTaskState.Started)
|
||||
{
|
||||
state.State = PeriodicTaskState.NotStarted;
|
||||
state.NextRunUtc = DateTime.MinValue;
|
||||
await this.OnFinishedAsync(state).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
// The NextRunUtc wait applies to scheduled runs only; a forced start bypasses it.
|
||||
if (!this._isStartForced && state.NextRunUtc > DateTime.UtcNow)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,9 @@ public class HeykelSavasiTeamSelectHandlerPlugIn : IPacketHandlerPlugIn
|
||||
private readonly HeykelSavasiJoinAction _joinAction = new();
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool IsEncryptionExpected => true;
|
||||
// The AdaMu client sends client-to-server packets unencrypted (like every other working handler:
|
||||
// walk, animation, talk-to-npc), so this must be false or the server drops the team-select packet.
|
||||
public bool IsEncryptionExpected => false;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public byte Key => HeykelSavasiTeamSelect.Code;
|
||||
|
||||
Reference in New Issue
Block a user