< Summary

Information
Class: RaidLoop.Core.Contracts.ShopOfferSnapshot
Assembly: RaidLoop.Core
File(s): /home/runner/work/RaidLoop/RaidLoop/src/RaidLoop.Core/Contracts/PlayerSnapshot.cs
Line coverage
100%
Covered lines: 4
Uncovered lines: 0
Coverable lines: 4
Total lines: 85
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_ItemDefId()100%11100%
get_Price()100%11100%
get_Stock()100%11100%

File(s)

/home/runner/work/RaidLoop/RaidLoop/src/RaidLoop.Core/Contracts/PlayerSnapshot.cs

#LineLine coverage
 1using System.Text.Json.Serialization;
 2
 3namespace RaidLoop.Core.Contracts;
 4
 5public sealed record OnPersonSnapshot(Item Item, bool IsEquipped);
 6
 7public sealed record ItemRuleSnapshot(
 8    int ItemDefId,
 9    ItemType Type,
 10    int Weight,
 11    int Slots,
 12    Rarity Rarity);
 13
 3014public sealed record ShopOfferSnapshot(
 2915    int ItemDefId,
 1016    int Price,
 3417    int Stock);
 18
 19public sealed record RandomCharacterSnapshot
 20{
 21    public RandomCharacterSnapshot(string Name, IReadOnlyList<Item> Inventory, PlayerStats Stats)
 22    {
 23        ArgumentNullException.ThrowIfNull(Stats);
 24        this.Name = Name;
 25        this.Inventory = Inventory;
 26        this.Stats = Stats;
 27    }
 28
 29    public string Name { get; init; }
 30    public IReadOnlyList<Item> Inventory { get; init; }
 31    public PlayerStats Stats { get; init; }
 32}
 33
 34public sealed record PlayerSnapshot
 35{
 36    public PlayerSnapshot(
 37        int Money,
 38        IReadOnlyList<Item> MainStash,
 39        IReadOnlyList<OnPersonSnapshot> OnPersonItems,
 40        int PlayerConstitution,
 41        int PlayerMaxHealth,
 42        DateTimeOffset RandomCharacterAvailableAt,
 43        RandomCharacterSnapshot? RandomCharacter,
 44        RaidSnapshot? ActiveRaid,
 45        PlayerStats? AcceptedStats = null,
 46        PlayerStats? DraftStats = null,
 47        int AvailableStatPoints = PlayerStatRules.StartingPool,
 48        bool StatsAccepted = false,
 49        IReadOnlyList<ShopOfferSnapshot>? ShopStock = null,
 50        IReadOnlyList<ItemRuleSnapshot>? ItemRules = null)
 51    {
 52        this.Money = Money;
 53        this.MainStash = MainStash;
 54        this.OnPersonItems = OnPersonItems;
 55        this.ShopStock = ShopStock ?? [];
 56        this.ItemRules = ItemRules ?? [];
 57        this.PlayerConstitution = PlayerConstitution;
 58        this.PlayerMaxHealth = PlayerMaxHealth;
 59        this.RandomCharacterAvailableAt = RandomCharacterAvailableAt;
 60        this.RandomCharacter = RandomCharacter;
 61        this.ActiveRaid = ActiveRaid;
 62        this.AcceptedStats = AcceptedStats ?? PlayerStats.Default;
 63        this.DraftStats = DraftStats ?? PlayerStats.Default;
 64        this.AvailableStatPoints = AvailableStatPoints;
 65        this.StatsAccepted = StatsAccepted;
 66    }
 67
 68    public int Money { get; init; }
 69    public IReadOnlyList<Item> MainStash { get; init; }
 70    public IReadOnlyList<OnPersonSnapshot> OnPersonItems { get; init; }
 71    public IReadOnlyList<ShopOfferSnapshot> ShopStock { get; init; }
 72    public IReadOnlyList<ItemRuleSnapshot> ItemRules { get; init; }
 73    public int PlayerConstitution { get; init; }
 74    public int PlayerMaxHealth { get; init; }
 75
 76    [JsonConverter(typeof(FlexibleDateTimeOffsetJsonConverter))]
 77    public DateTimeOffset RandomCharacterAvailableAt { get; init; }
 78
 79    public RandomCharacterSnapshot? RandomCharacter { get; init; }
 80    public RaidSnapshot? ActiveRaid { get; init; }
 81    public PlayerStats AcceptedStats { get; init; }
 82    public PlayerStats DraftStats { get; init; }
 83    public int AvailableStatPoints { get; init; }
 84    public bool StatsAccepted { get; init; }
 85}