| | | 1 | | namespace RaidLoop.Core; |
| | | 2 | | |
| | | 3 | | public static class GameEventLog |
| | | 4 | | { |
| | | 5 | | private static readonly List<GameEvent> Entries = []; |
| | | 6 | | |
| | | 7 | | public static IReadOnlyList<GameEvent> Events => Entries; |
| | | 8 | | |
| | | 9 | | public static string CurrentRaidId { get; private set; } = string.Empty; |
| | | 10 | | |
| | | 11 | | public static void SetRaidContext(string raidId) |
| | | 12 | | { |
| | | 13 | | CurrentRaidId = raidId ?? string.Empty; |
| | | 14 | | } |
| | | 15 | | |
| | | 16 | | public static void Append(GameEvent evt) |
| | | 17 | | { |
| | | 18 | | Entries.Add(evt); |
| | | 19 | | } |
| | | 20 | | |
| | | 21 | | public static void Clear() |
| | | 22 | | { |
| | | 23 | | Entries.Clear(); |
| | | 24 | | CurrentRaidId = string.Empty; |
| | | 25 | | } |
| | | 26 | | |
| | | 27 | | public static IReadOnlyList<ItemSnapshot> CreateItemSnapshots(IEnumerable<Item> items) |
| | | 28 | | { |
| | | 29 | | return items |
| | | 30 | | .Select(item => new ItemSnapshot(item.ItemDefId, item.Type.ToString(), item.DisplayRarity.ToString(), item.V |
| | | 31 | | .ToList(); |
| | | 32 | | } |
| | | 33 | | } |
| | | 34 | | |
| | | 35 | | public sealed record GameEvent( |
| | | 36 | | string EventName, |
| | | 37 | | string RaidId, |
| | | 38 | | IReadOnlyList<ItemSnapshot> Items, |
| | | 39 | | DateTimeOffset Timestamp, |
| | | 40 | | int TotalValue = 0); |
| | | 41 | | |
| | 10029 | 42 | | public sealed record ItemSnapshot(int ItemDefId, string Category, string Rarity, int Value); |