47 lines
2.0 KiB
C#
47 lines
2.0 KiB
C#
using SVSim.Database.Enums;
|
|
using SVSim.Database.Models;
|
|
|
|
namespace SVSim.Database.Services;
|
|
|
|
/// <summary>
|
|
/// The single read/ownership authority for what a viewer is *treated as* owning. Knows the
|
|
/// Freeplay flag; all freeplay read-side behavior lives here. See
|
|
/// docs/superpowers/specs/2026-05-29-freeplay-mode-design.md.
|
|
/// </summary>
|
|
public interface IViewerEntitlements
|
|
{
|
|
/// <summary>True when the global Freeplay config section is enabled.</summary>
|
|
bool IsFreeplay { get; }
|
|
|
|
/// <summary>
|
|
/// The balance the viewer is treated as having: the configured freeplay amount for
|
|
/// Crystal/Rupee/RedEther when freeplay is on, otherwise (and always for SpotPoint) the real
|
|
/// <c>viewer.Currency</c> field.
|
|
/// </summary>
|
|
long EffectiveBalance(Viewer viewer, SpendCurrency currency);
|
|
|
|
bool OwnsCard(Viewer viewer, long cardId);
|
|
|
|
/// <summary><paramref name="type"/> uses <see cref="CosmeticType"/> (Skin == leader skin).</summary>
|
|
bool OwnsCosmetic(Viewer viewer, CosmeticType type, int id);
|
|
|
|
/// <summary>The full owned-card projection for /load/index's user_card_list.</summary>
|
|
Task<IReadOnlyList<OwnedCardEntry>> EffectiveOwnedCardsAsync(Viewer viewer, CancellationToken ct = default);
|
|
|
|
/// <summary>The cosmetic id-lists + leader-skin catalog/owned-set for /load/index.</summary>
|
|
Task<EffectiveCosmetics> EffectiveCosmeticsAsync(Viewer viewer, CancellationToken ct = default);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Cosmetic projection bundle for /load/index. The four id-lists are "what the viewer owns"
|
|
/// (all of them in freeplay). Leader skins are always the full catalog with a per-skin owned flag;
|
|
/// <see cref="OwnedLeaderSkinIds"/> is every skin id in freeplay.
|
|
/// </summary>
|
|
public sealed record EffectiveCosmetics(
|
|
IReadOnlyList<int> SleeveIds,
|
|
IReadOnlyList<int> EmblemIds,
|
|
IReadOnlyList<int> DegreeIds,
|
|
IReadOnlyList<int> MyPageBackgroundIds,
|
|
IReadOnlyList<LeaderSkinEntry> AllLeaderSkins,
|
|
IReadOnlySet<int> OwnedLeaderSkinIds);
|