fix(tk2): per-viewer is_join in arena_info + stub /arena/get_challenge_info

Bug 1 ("pay to enter again after restart"):
arena_info[0].is_join shipped from the static ArenaSeasonConfig seed,
so /load/index and /mypage/index always emitted false regardless of
viewer state. The client uses is_join to choose between the "Pay to
enter" and "Resume run" dialogs (Wizard/ChallengeEntry.cs:165 + the
ArenaEntryBase._isJoinFunc pivot). Without a per-viewer override every
cold start after a partial run looked like "no run" and the player got
charged again.

LoadController + MyPageController now compute is_join from
ViewerArenaTwoPickRuns presence. MyPageController grew an
IArenaTwoPickRunRepository dep (LoadController already had _db).

Bug 2: /arena/get_challenge_info 404. Stubbed via a new
ArenaController + DTO pair. Returns the season seed's begin/end_time
+ name where available; placeholder zeros for win history. All 6 keys
required by ChallangeHistoryInfoTask.Parse are present (unconditional
JsonData lookups).

Routing smoke added for /arena/get_challenge_info.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-05-31 13:13:11 -04:00
parent 1e2e18e828
commit 1af56b4ec4
6 changed files with 135 additions and 8 deletions

View File

@@ -0,0 +1,7 @@
using MessagePack;
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Requests.Arena;
[MessagePackObject]
public class GetChallengeInfoRequest : BaseRequest { }

View File

@@ -0,0 +1,40 @@
using System.Text.Json.Serialization;
using MessagePack;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Responses.Arena;
/// <summary>
/// Wire shape for /arena/get_challenge_info. Parsed by Wizard/ChallangeHistoryInfoTask.cs:25.
/// All 6 fields below are accessed unconditionally — KeyNotFoundException if any is omitted.
/// Stub values for now; TODO: source from a per-season "challenge history" snapshot when we
/// track viewer's lifetime TK2 stats.
/// </summary>
[MessagePackObject]
public class GetChallengeInfoResponseDto
{
[JsonPropertyName("challenge_name")] [Key("challenge_name")]
public string ChallengeName { get; set; } = "";
/// <summary>Client parses via DateTime.Parse — "yyyy-MM-dd HH:mm:ss" works.</summary>
[JsonPropertyName("begin_time")] [Key("begin_time")]
public string BeginTime { get; set; } = "";
[JsonPropertyName("end_time")] [Key("end_time")]
public string EndTime { get; set; } = "";
[JsonPropertyName("two_pick_all_win_count")] [Key("two_pick_all_win_count")]
public int TwoPickAllWinCount { get; set; }
[JsonPropertyName("reward_step_info")] [Key("reward_step_info")]
public RewardStepInfoDto RewardStepInfo { get; set; } = new();
}
[MessagePackObject]
public class RewardStepInfoDto
{
[JsonPropertyName("max_reward_step")] [Key("max_reward_step")]
public int MaxRewardStep { get; set; }
[JsonPropertyName("reward_step_list")] [Key("reward_step_list")]
public List<int> RewardStepList { get; set; } = new();
}