More story fixes

This commit is contained in:
gamer147
2026-05-25 19:07:49 -04:00
parent ce8d80559b
commit fa0901b776
16 changed files with 6361 additions and 48 deletions

View File

@@ -39,6 +39,7 @@ public class StoryChapter
public SpecialBattleSetting? SpecialBattleSetting { get; set; }
public int ReleasePoint { get; set; }
public string? UnlockText { get; set; }
public bool IsMaintenanceChapter { get; set; }
public bool IsPlayAnotherEndAppearanceAnimation { get; set; }
public bool IsReleasedAnotherEnd { get; set; }

View File

@@ -23,4 +23,7 @@ public class StorySection
public int StoryTypeOverwrite { get; set; }
public bool IsUnderMaintenance { get; set; }
public bool IsPlayAnotherEndAppearanceAnimation { get; set; }
public int IsSpoiler { get; set; }
public string SpoilerMessage { get; set; } = string.Empty;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,28 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SVSim.Database.Migrations
{
/// <inheritdoc />
public partial class AddStoryChapterUnlockText : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "UnlockText",
table: "StoryChapters",
type: "text",
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "UnlockText",
table: "StoryChapters");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,40 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SVSim.Database.Migrations
{
/// <inheritdoc />
public partial class AddStorySectionSpoilerFields : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "IsSpoiler",
table: "StorySections",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "SpoilerMessage",
table: "StorySections",
type: "text",
nullable: false,
defaultValue: "");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsSpoiler",
table: "StorySections");
migrationBuilder.DropColumn(
name: "SpoilerMessage",
table: "StorySections");
}
}
}

View File

@@ -230,6 +230,9 @@ namespace SVSim.Database.Migrations
b.Property<int?>("SpecialBattleSettingId")
.HasColumnType("integer");
b.Property<string>("UnlockText")
.HasColumnType("text");
b.Property<decimal>("XCoordinate")
.HasColumnType("numeric");
@@ -271,6 +274,9 @@ namespace SVSim.Database.Migrations
b.Property<bool>("IsPlayAnotherEndAppearanceAnimation")
.HasColumnType("boolean");
b.Property<int>("IsSpoiler")
.HasColumnType("integer");
b.Property<bool>("IsUnderMaintenance")
.HasColumnType("boolean");
@@ -281,6 +287,10 @@ namespace SVSim.Database.Migrations
b.Property<int>("OrderId")
.HasColumnType("integer");
b.Property<string>("SpoilerMessage")
.IsRequired()
.HasColumnType("text");
b.Property<int>("StoryApiType")
.HasColumnType("integer");

View File

@@ -16,4 +16,12 @@ public interface IStoryMasterRepository
Task<StoryChapter?> GetChapterByIdAsync(int storyId);
Task<SpecialBattleSetting?> GetSbsByIdAsync(int sbsId);
/// <summary>
/// Resolve a wire story_id to a sub-chapter row when no top-level <see cref="StoryChapter"/>
/// exists for it. Sub-chapter story_ids have no chapter master data of their own — they're
/// progress markers hanging off the parent. Used by /finish to record progress at the sub's
/// story_id when the client sends sub-chapter ids directly.
/// </summary>
Task<StorySubChapter?> FindSubChapterByStoryIdAsync(int storyId);
}

View File

@@ -51,4 +51,15 @@ public class StoryMasterRepository : IStoryMasterRepository
public Task<SpecialBattleSetting?> GetSbsByIdAsync(int sbsId)
=> _db.SpecialBattleSettings.FirstOrDefaultAsync(s => s.Id == sbsId);
public async Task<StorySubChapter?> FindSubChapterByStoryIdAsync(int storyId)
{
// StorySubChapter is an owned entity (no DbSet of its own); query through the owning
// chapter. SelectMany over the owned collection translates to a JOIN in the relational
// provider — no need to materialize the full chapter row.
return await _db.StoryChapters
.AsNoTracking()
.SelectMany(c => c.SubChapters)
.FirstOrDefaultAsync(sc => sc.SubChapterStoryId == storyId);
}
}