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