Pack opening

This commit is contained in:
gamer147
2026-05-24 02:03:13 -04:00
parent bdff142d16
commit 79209bd70b
41 changed files with 37320 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
using Microsoft.EntityFrameworkCore;
namespace SVSim.Database.Models;
/// <summary>One entry of <c>cardpack_banner_list</c> in /pack/info. Owned by PackConfigEntry.</summary>
[Owned]
public class PackBannerEntry
{
public string BannerName { get; set; } = string.Empty;
public string DialogTitle { get; set; } = string.Empty;
}

View File

@@ -0,0 +1,26 @@
using Microsoft.EntityFrameworkCore;
namespace SVSim.Database.Models;
/// <summary>
/// One sub-option inside a pack (single-open / 10-open / ticket / daily-free).
/// Wire shape: one entry of <c>child_gacha_info</c> in /pack/info. Owned by PackConfigEntry.
/// <c>TypeDetail</c> corresponds to <c>GachaUI.CardPackType</c>:
/// 1=CRYSTAL, 2=CRYSTAL_MULTI, 3=DAILY, 4=TICKET, 5=TICKET_MULTI, 6=RUPY, 7=RUPY_MULTI,
/// 8=CRYSTAL_SPECIAL, 9=CRYSTAL_SELECT_SKIN, 10=FREE_PACKS, 11=FREE_PACK_WITH_SKIN,
/// 12=ROTATION_STARTER_PACK, 13=CRYSTAL_ACQUIRE_SKIN_CARD_PACK.
/// </summary>
[Owned]
public class PackChildGachaEntry
{
public int GachaId { get; set; }
public int TypeDetail { get; set; }
public int Cost { get; set; }
public int CardCount { get; set; }
public long? ItemId { get; set; }
public bool IsDailySingle { get; set; }
public int OverrideIncreaseGachaPoint { get; set; }
public int PurchaseLimitCount { get; set; }
public int? FreeGachaCampaignId { get; set; }
public string? CampaignName { get; set; }
}

View File

@@ -0,0 +1,40 @@
using SVSim.Database.Common;
using SVSim.Database.Enums;
namespace SVSim.Database.Models;
/// <summary>
/// One row of /pack/info's <c>pack_config_list</c>. PK = <c>parent_gacha_id</c> (the wire id the
/// client treats as "this pack"). Child gachas and banners are owned collections — replaced
/// wholesale on importer re-runs.
/// </summary>
public class PackConfigEntry : BaseEntity<int>
{
public int BasePackId { get; set; }
public int GachaType { get; set; }
public PackCategory PackCategory { get; set; }
public int PosterType { get; set; }
public DateTime CommenceDate { get; set; }
public DateTime CompleteDate { get; set; }
public DateTime? SalesPeriodTime { get; set; }
public int SleeveId { get; set; }
public int SpecialSleeveId { get; set; }
public int OverrideDrawEffectPackId { get; set; }
public int OverrideUiEffectPackId { get; set; }
public string GachaDetail { get; set; } = string.Empty;
public bool IsHide { get; set; }
public bool IsNew { get; set; }
public bool IsPreRelease { get; set; }
public int OpenCountLimit { get; set; }
public PackGachaPointConfig? GachaPointConfig { get; set; }
public List<PackBannerEntry> Banners { get; set; } = new();
public List<PackChildGachaEntry> ChildGachas { get; set; } = new();
}

View File

@@ -0,0 +1,16 @@
using Microsoft.EntityFrameworkCore;
namespace SVSim.Database.Models;
/// <summary>
/// Per-pack gacha-point exchange config. Owned by <see cref="PackConfigEntry"/>; null when the
/// pack does not participate in gacha-point exchange. Wire shape (from /pack/info):
/// <c>{"pack_id":"10001","gacha_point":0,"increase_gacha_point":"1","exchangeable_gacha_point":400,"is_exchangeable_gacha_point":false}</c>.
/// v1 only persists the static catalog values; per-viewer accrual is deferred.
/// </summary>
[Owned]
public class PackGachaPointConfig
{
public int ExchangeablePoint { get; set; }
public int IncreaseGachaPoint { get; set; }
}

View File

@@ -55,6 +55,8 @@ public class Viewer : BaseEntity<long>
public List<MyPageBackgroundEntry> MyPageBackgrounds { get; set; } = new List<MyPageBackgroundEntry>();
public List<ViewerPackOpenCount> PackOpenCounts { get; set; } = new List<ViewerPackOpenCount>();
#endregion
#region Navigation Properties

View File

@@ -0,0 +1,17 @@
using Microsoft.EntityFrameworkCore;
namespace SVSim.Database.Models;
/// <summary>
/// Per-viewer, per-pack open counter. Owned collection on <see cref="Viewer"/>.
/// <c>PackId</c> = parent_gacha_id. <c>LastDailyFreeAt</c> is null until the viewer first opens
/// a DAILY (type_detail=3) child gacha; thereafter the controller compares it against the daily
/// reset boundary to decide whether the free open is available again.
/// </summary>
[Owned]
public class ViewerPackOpenCount
{
public int PackId { get; set; }
public int OpenCount { get; set; }
public DateTime? LastDailyFreeAt { get; set; }
}