using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace DataServer.Data.Entities; /// /// Tracks death chests spawned when loot exceeds player inventory. /// Used for auditing and rule enforcement. /// [Table("dungeon_death_chests")] public class DeathChest { [Key] public ulong Id { get; set; } /// /// The dungeon instance ID where this chest was created /// public Guid DungeonInstanceId { get; set; } /// /// Character who owns this chest (the killer who received the loot) /// public ulong OwnerCharacterId { get; set; } /// /// Character who died and dropped this loot (null if mob death) /// public ulong? VictimCharacterId { get; set; } /// /// Mob that died and dropped this loot (null if player death) /// public int? VictimMobDefinitionId { get; set; } /// /// World position where chest spawned /// public float X { get; set; } public float Y { get; set; } /// /// Total gold in the chest /// public long GoldAmount { get; set; } /// /// When the chest was created /// public DateTime CreatedAt { get; set; } = DateTime.UtcNow; /// /// When the chest was fully emptied (null if still has items) /// public DateTime? EmptiedAt { get; set; } /// /// Whether all items have been collected /// public bool IsEmpty { get; set; } = false; /// /// Navigation to owner /// public virtual DungeonCharacter? OwnerCharacter { get; set; } /// /// Navigation to victim (if player) /// public virtual DungeonCharacter? VictimCharacter { get; set; } /// /// Items stored in this chest /// public virtual ICollection Items { get; set; } = new List(); } /// /// An item stored in a death chest /// [Table("dungeon_death_chest_items")] public class DeathChestItem { [Key] public ulong Id { get; set; } public ulong DeathChestId { get; set; } public int ItemDefinitionId { get; set; } public int Quantity { get; set; } = 1; public int SlotIndex { get; set; } // 0-99 for 100 slot chest /// /// Whether this item has been taken /// public bool IsTaken { get; set; } = false; /// /// When the item was taken (for auditing) /// public DateTime? TakenAt { get; set; } // Navigation public virtual DeathChest? DeathChest { get; set; } [ForeignKey(nameof(ItemDefinitionId))] public virtual DungeonItemDefinition? ItemDefinition { get; set; } }