| | | 1 | | using System.Text.Json.Serialization; |
| | | 2 | | |
| | | 3 | | namespace RaidLoop.Core.Contracts; |
| | | 4 | | |
| | | 5 | | public sealed record OnPersonSnapshot(Item Item, bool IsEquipped); |
| | | 6 | | |
| | 53 | 7 | | public sealed record ItemRuleSnapshot( |
| | 8 | 8 | | int ItemDefId, |
| | 2 | 9 | | ItemType Type, |
| | 2 | 10 | | int Weight, |
| | 2 | 11 | | int Slots, |
| | 55 | 12 | | Rarity Rarity); |
| | | 13 | | |
| | | 14 | | public sealed record ShopOfferSnapshot( |
| | | 15 | | int ItemDefId, |
| | | 16 | | int Price, |
| | | 17 | | int Stock); |
| | | 18 | | |
| | | 19 | | public 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 | | |
| | | 34 | | public 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 | | } |