feat(packs): add PackDraw* tables and IsEnabled column

Three new EF entities and a migration:
- PackDrawConfigEntry (per-pack: animation rate, has-bonus flag, special-kind label)
- PackDrawSlotRateEntry (pack/slot/tier -> rate, unique index)
- PackDrawCardWeightEntry (per-card-rate facts incl rate-less rows)

DrawSlot {General, Eighth, Bonus} and DrawTier {Bronze, Silver, Gold, Legendary, Special}.
Special collapses leader_card and limited_time_leader (verified mutually exclusive per pack).

IsEnabled column on PackConfigEntry — admin gate for synthesized stubs, distinct from
the wire-mirror IsHide.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-05-30 21:40:50 -04:00
parent f754ef1ad3
commit b78d7d6cbe
10 changed files with 4247 additions and 0 deletions

View File

@@ -33,6 +33,13 @@ public class PackConfigEntry : BaseEntity<int>
public int OpenCountLimit { get; set; }
/// <summary>
/// Server admin gate. True for live-capture-derived rows; false for synthesized stubs
/// (operator opt-in per pack). Filtered in PackRepository.GetActivePacks; distinct from
/// the wire-mirror IsHide.
/// </summary>
public bool IsEnabled { get; set; } = true;
public PackGachaPointConfig? GachaPointConfig { get; set; }
public List<PackBannerEntry> Banners { get; set; } = new();

View File

@@ -0,0 +1,24 @@
using System.ComponentModel.DataAnnotations.Schema;
using SVSim.Database.Common;
using SVSim.Database.Enums;
namespace SVSim.Database.Models;
/// <summary>
/// Per-card-rate fact: which card prints in which (pack, slot, tier) at what rate.
/// RatePct is nullable for rate-less "Guaranteed Leader Card" rows (sampler uses
/// "uniform over (pool minus owned)" in that case).
/// </summary>
public class PackDrawCardWeightEntry : BaseEntity<long>
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public override long Id { get; set; }
public int PackId { get; set; }
public DrawSlot Slot { get; set; }
public DrawTier Tier { get; set; }
public long CardId { get; set; }
public double? RatePct { get; set; }
public bool IsLeader { get; set; }
public bool IsAltArt { get; set; }
}

View File

@@ -0,0 +1,16 @@
using SVSim.Database.Common;
namespace SVSim.Database.Models;
/// <summary>
/// One row per pack covered by drawrates data. PK is the pack id (matches PackConfigEntry.Id
/// for live-capture rows; standalone for archive-only packs). Weak relationship — PackDraw rows
/// exist for all archived packs even when no PackConfigEntry is enabled.
/// </summary>
public class PackDrawConfigEntry : BaseEntity<int>
{
public double AnimationRatePct { get; set; }
public bool HasBonusSlot { get; set; }
public string? SpecialKind { get; set; }
public string? ShortCode { get; set; }
}

View File

@@ -0,0 +1,20 @@
using System.ComponentModel.DataAnnotations.Schema;
using SVSim.Database.Common;
using SVSim.Database.Enums;
namespace SVSim.Database.Models;
/// <summary>
/// Per (pack, slot, tier) rate. Natural key (PackId, Slot, Tier) is enforced via unique index.
/// Id is auto-generated — override BaseEntity's [DatabaseGenerated(None)] default.
/// </summary>
public class PackDrawSlotRateEntry : BaseEntity<long>
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public override long Id { get; set; }
public int PackId { get; set; }
public DrawSlot Slot { get; set; }
public DrawTier Tier { get; set; }
public double RatePct { get; set; }
}