feat(packs): split TryGetFoilTwin into ICardFoilLookup
Extracts the foil-twin lookup from ICardPoolProvider into a dedicated ICardFoilLookup service. PackOpenService takes the lookup as a parameter; the legacy DbCardPoolProvider stays registered until T12 removes it. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -81,6 +81,7 @@ public class Program
|
||||
// in-process cache today; the IGameConfigService interface is shaped to allow one later.
|
||||
builder.Services.AddScoped<SVSim.Database.Services.IGameConfigService, GameConfigService>();
|
||||
builder.Services.AddScoped<ICardPoolProvider, DbCardPoolProvider>();
|
||||
builder.Services.AddScoped<ICardFoilLookup, DbCardFoilLookup>();
|
||||
builder.Services.AddScoped<PackOpenService>();
|
||||
builder.Services.AddScoped<IGachaPointService, GachaPointService>();
|
||||
builder.Services.AddScoped<ICardAcquisitionService, CardAcquisitionService>();
|
||||
|
||||
13
SVSim.EmulatedEntrypoint/Services/DbCardFoilLookup.cs
Normal file
13
SVSim.EmulatedEntrypoint/Services/DbCardFoilLookup.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using SVSim.Database;
|
||||
using SVSim.Database.Models;
|
||||
|
||||
namespace SVSim.EmulatedEntrypoint.Services;
|
||||
|
||||
public class DbCardFoilLookup : ICardFoilLookup
|
||||
{
|
||||
private readonly SVSimDbContext _db;
|
||||
public DbCardFoilLookup(SVSimDbContext db) { _db = db; }
|
||||
|
||||
public ShadowverseCardEntry? TryGetFoilTwin(long baseCardId) =>
|
||||
_db.Cards.FirstOrDefault(c => c.Id == baseCardId + 1 && c.IsFoil);
|
||||
}
|
||||
13
SVSim.EmulatedEntrypoint/Services/ICardFoilLookup.cs
Normal file
13
SVSim.EmulatedEntrypoint/Services/ICardFoilLookup.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using SVSim.Database.Models;
|
||||
|
||||
namespace SVSim.EmulatedEntrypoint.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Looks up the foil printing of a card. The card-master convention is foil_id = base_id + 1
|
||||
/// with the IsFoil flag set; leader-card / alt-art printings typically have no foil twin
|
||||
/// (TryGetFoilTwin returns null and the sampler silently keeps the base).
|
||||
/// </summary>
|
||||
public interface ICardFoilLookup
|
||||
{
|
||||
ShadowverseCardEntry? TryGetFoilTwin(long baseCardId);
|
||||
}
|
||||
Reference in New Issue
Block a user