This commit is contained in:
gamer147
2026-05-25 12:03:47 -04:00
parent d067f8a64a
commit 558e8288eb
44 changed files with 6512 additions and 3 deletions

View File

@@ -0,0 +1,25 @@
using SVSim.Database.Common;
namespace SVSim.Database.Models;
/// <summary>
/// One row per basic_puzzle within a group. Static catalog seeded by SVSim.Bootstrap.
/// See docs/api-spec/endpoints/post-login/basic-puzzle/info.md (PuzzleEntry).
/// </summary>
public class PuzzleEntry : BaseEntity<int>
{
/// <summary>puzzle_id on the wire. PK.</summary>
public int PuzzleId { get => Id; set => Id = value; }
/// <summary>FK to <see cref="PuzzleGroupEntry"/>. Index this column for mission evaluation.</summary>
public int GroupId { get; set; }
public PuzzleGroupEntry Group { get; set; } = null!;
/// <summary>0..3 difficulty band.</summary>
public int PuzzleDifficulty { get; set; }
public bool IsAdditional { get; set; }
public bool IsPlayable { get; set; } = true;
public string ReleaseConditionTextId { get; set; } = string.Empty;
}

View File

@@ -0,0 +1,32 @@
using SVSim.Database.Common;
namespace SVSim.Database.Models;
/// <summary>
/// One row per basic_puzzle group (puzzle_master_id). Static catalog seeded by
/// SVSim.Bootstrap.GlobalsImporter from prod-captures/basic-puzzle-info-*.json.
/// See docs/api-spec/endpoints/post-login/basic-puzzle/info.md.
/// </summary>
public class PuzzleGroupEntry : BaseEntity<int>
{
/// <summary>puzzle_master_id on the wire. PK + display order key.</summary>
public int PuzzleMasterId { get => Id; set => Id = value; }
/// <summary>SystemText id. "Puzzle_QuestSelect_0301" etc. Client resolves with Data.SystemText.Get.</summary>
public string BasicTitleTextId { get; set; } = string.Empty;
/// <summary>Character id for the group portrait. Wire as string but stored as int.</summary>
public int PuzzleCharaId { get; set; }
/// <summary>Mission-attribution chara. Usually == PuzzleCharaId but observed group 2 has 3208/2703 split.</summary>
public int CharaId { get; set; }
/// <summary>1 = Special/Expert rounds, 2 = Regular numbered rounds. Drives client display ordering.</summary>
public int SortType { get; set; }
/// <summary>Difficulty-name dict serialized as JSON (e.g. {"Beginner":"0","Experienced":"1","Expert":"2"}).</summary>
public string DifficultyNameListJson { get; set; } = "{}";
// Navigation
public List<PuzzleEntry> Puzzles { get; set; } = new();
}

View File

@@ -0,0 +1,33 @@
using SVSim.Database.Common;
namespace SVSim.Database.Models;
/// <summary>
/// One row per basic_puzzle mission (e.g. "Clear all Round 1 puzzles"). Static catalog
/// seeded by SVSim.Bootstrap from prod-captures/basic-puzzle-mission-*.json. The wire has no
/// stable id; importer assigns 1-based by capture order via the inherited <see cref="BaseEntity{TKey}.Id"/>.
/// See docs/api-spec/endpoints/post-login/basic-puzzle/mission.md.
/// </summary>
public class PuzzleMissionEntry : BaseEntity<int>
{
/// <summary>Pre-localized name on the wire. "Clear all Round 1 puzzles".</summary>
public string MissionName { get; set; } = string.Empty;
/// <summary>Pre-localized achievement banner ("Cleared all Round 1 puzzles"). Derived by importer.</summary>
public string AchievedMessage { get; set; } = string.Empty;
public int RequireNumber { get; set; }
public long CampaignCommenceTime { get; set; }
public int OrderId { get; set; }
// Reward (single-entry per mission)
public int RewardType { get; set; } // UserGoodsType
public long RewardDetailId { get; set; }
public int RewardNumber { get; set; }
/// <summary>
/// Maps Round-N missions to their target group (300+N). NULL for Special-Round missions
/// (deferred per Phase 1; they always surface as total_count=0).
/// </summary>
public int? TargetPuzzleGroupId { get; set; }
}

View File

@@ -21,6 +21,14 @@ public class ShadowverseDeckEntry : BaseEntity<Guid>
public Format Format { get; set; }
public bool RandomLeaderSkin { get; set; }
/// <summary>
/// MyRotation period id (key into <see cref="MyRotationSettingEntry"/>). Required when
/// <see cref="Format"/> is <see cref="Format.MyRotation"/> so the client can resolve the
/// deck's pack range; null for every other format. If null on a MyRotation deck, clicking
/// the deck NREs inside DeckData.CreateMyRotationClassName (info.LastPackText on null).
/// </summary>
public string? MyRotationId { get; set; }
#region Navigation Properties
public ClassEntry Class { get; set; } = new ClassEntry();

View File

@@ -0,0 +1,22 @@
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using SVSim.Database.Common;
namespace SVSim.Database.Models;
/// <summary>
/// Per-viewer record of a cleared puzzle. Composite PK (ViewerId, PuzzleId) — at most one
/// row per (viewer, puzzle). NOT a Viewer owned collection on purpose (see CLAUDE.md
/// "EF nav include pitfall" — owned collection joins cartesian-explode the viewer graph).
/// </summary>
[PrimaryKey(nameof(ViewerId), nameof(PuzzleId))]
public class ViewerPuzzleClear
{
public long ViewerId { get; set; }
public int PuzzleId { get; set; }
public DateTime ClearedAt { get; set; }
/// <summary>Min retry_count across all wins. RetryCount = in-battle reset count, not loss retries.</summary>
public int BestRetryCount { get; set; }
}