Seeding reorg

This commit is contained in:
gamer147
2026-05-24 21:13:15 -04:00
parent 34bcc579a5
commit c14408ba06
73 changed files with 4611 additions and 369716 deletions

View File

@@ -1,12 +1,11 @@
using Microsoft.EntityFrameworkCore;
namespace SVSim.Database.Models.Config;
/// <summary>
/// Tunables for pack-opening RNG. Defaults reproduce the original Shadowverse Classic rates
/// exactly so the cutover from hardcoded magic numbers is zero-behavior-change.
/// Tunables for pack-opening RNG. Property initialisers reproduce the original Shadowverse
/// Classic main-slot rates exactly. Collection-shaped defaults (slot-8 PerSlot entry) live in
/// <see cref="ShippedDefaults"/>, not in the initialiser — see PerSlot docstring.
/// </summary>
[Owned]
[ConfigSection("PackRates")]
public class PackRateConfig
{
/// <summary>
@@ -27,21 +26,32 @@ public class PackRateConfig
};
/// <summary>
/// Per-slot overrides (1-based slot index) applied to all packs. A missing slot falls back
/// to <see cref="Default"/>. Each entry is a FULL OVERRIDE, not a delta — if you change
/// <see cref="Default"/>, existing PerSlot entries do NOT auto-recompute. The slot-8 default
/// expresses the SV Classic "Silver-or-better guarantee" as data (Bronze=0) instead of a
/// separate code path.
/// Per-slot overrides keyed by 1-based slot index (stored as a list for json compatibility —
/// Dictionary&lt;string,T&gt; of complex owned types is not supported). Look up by
/// <see cref="SlotRarityWeights.Slot"/>. A missing slot falls back to <see cref="Default"/>.
/// Each entry is a FULL OVERRIDE, not a delta — if you change <see cref="Default"/>, existing
/// PerSlot entries do NOT auto-recompute.
/// <para>
/// MUST default to empty. The original EF Core 8 <c>OwnsMany</c>+<c>ToJson</c> path APPENDED
/// jsonb rows onto whatever collection the parent's parameterless ctor produced — a non-empty
/// initialiser here meant every config load doubled-up and the original seed silently won the
/// <c>FirstOrDefault</c> lookup in <c>PackOpenService.ResolveWeights</c>. The EF path is gone
/// now (config goes through <c>IGameConfigService</c> + STJ), but the rule stays: collection
/// defaults live in <see cref="ShippedDefaults"/>, not in property initialisers.
/// </para>
/// </summary>
public List<SlotRarityWeights> PerSlot { get; set; } = [];
/// <summary>
/// Per-slot overrides keyed by 1-based slot index (stored as a list for EF Core 8 json
/// compatibility — Dictionary&lt;string,T&gt; of complex owned types is not supported).
/// Look up by <see cref="SlotRarityWeights.Slot"/>. A missing slot falls back to
/// <see cref="Default"/>. Slot-8 entry expresses the SV Classic "Silver-or-better
/// guarantee" as data (Bronze=0).
/// Canonical SV Classic shipped defaults — what an operator gets if neither the DB nor
/// appsettings.json supplies a PackRates section. Source of truth for the fresh-install seeder
/// and the <c>IGameConfigService</c> inline-default tier.
/// </summary>
public List<SlotRarityWeights> PerSlot { get; set; } =
[
new() { Slot = "8", Bronze = 0, Silver = 0.7692, Gold = 0.1846, Legendary = 0.0462 },
];
public static PackRateConfig ShippedDefaults() => new()
{
PerSlot =
{
new SlotRarityWeights { Slot = "8", Bronze = 0, Silver = 0.7692, Gold = 0.1846, Legendary = 0.0462 },
},
};
}