using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using DataServer.Data.Enums; namespace DataServer.Data.Entities; [Table("dungeon_npc_definitions")] public class DungeonNpcDefinition { [Key] public int Id { get; set; } [Required] [MaxLength(64)] public string Name { get; set; } = ""; [MaxLength(64)] public string Key { get; set; } = ""; [MaxLength(256)] public string Description { get; set; } = ""; public int Level { get; set; } = 1; public bool IsEnabled { get; set; } = true; public bool IsKillable { get; set; } = true; public bool CanShop { get; set; } = false; public bool HasDialog { get; set; } = false; public bool CanWander { get; set; } = true; public NpcBehaviorMode BehaviorMode { get; set; } = NpcBehaviorMode.Wander; public NpcOnAttackBehavior OnAttackBehavior { get; set; } = NpcOnAttackBehavior.FightBack; public int MaxHealth { get; set; } = 100; public int AttackPower { get; set; } = 10; public int Defense { get; set; } = 5; public int Strength { get; set; } = 5; public int Dexterity { get; set; } = 5; public int Intelligence { get; set; } = 5; public int Wisdom { get; set; } = 5; public int Endurance { get; set; } = 5; [MaxLength(2048)] public string ResistancesJson { get; set; } = "{}"; [MaxLength(4096)] public string? SpriteConfigJson { get; set; } [MaxLength(16)] public string TintColor { get; set; } = "#ffffff"; public float Scale { get; set; } = 1f; public float WanderRadiusPx { get; set; } = 96f; public float WanderIntervalSeconds { get; set; } = 2.5f; public int? LootTableId { get; set; } [ForeignKey(nameof(LootTableId))] public DungeonLootTable? LootTable { get; set; } public int? ShopId { get; set; } [ForeignKey(nameof(ShopId))] public DungeonNpcShop? Shop { get; set; } public int? DialogTreeId { get; set; } [ForeignKey(nameof(DialogTreeId))] public DungeonNpcDialogTree? DialogTree { get; set; } [MaxLength(2048)] public string AbilityDefinitionIdsJson { get; set; } = "[]"; public DateTime CreatedAt { get; set; } = DateTime.UtcNow; public DateTime UpdatedAt { get; set; } = DateTime.UtcNow; } [Table("dungeon_npc_shops")] public class DungeonNpcShop { [Key] public int Id { get; set; } [Required] [MaxLength(64)] public string Name { get; set; } = ""; public bool IsEnabled { get; set; } = true; public DateTime CreatedAt { get; set; } = DateTime.UtcNow; public DateTime UpdatedAt { get; set; } = DateTime.UtcNow; public ICollection Items { get; set; } = new List(); } [Table("dungeon_npc_shop_items")] public class DungeonNpcShopItem { [Key] public int Id { get; set; } public int ShopId { get; set; } [ForeignKey(nameof(ShopId))] public DungeonNpcShop? Shop { get; set; } public int SlotIndex { get; set; } public int ItemDefinitionId { get; set; } [ForeignKey(nameof(ItemDefinitionId))] public DungeonItemDefinition? ItemDefinition { get; set; } public int Quantity { get; set; } = 1; public long PriceGold { get; set; } = 1; public bool Restocks { get; set; } = true; public int RestockIntervalSeconds { get; set; } = 300; public DateTime? LastRestockAt { get; set; } } [Table("dungeon_npc_dialog_trees")] public class DungeonNpcDialogTree { [Key] public int Id { get; set; } [Required] [MaxLength(64)] public string Name { get; set; } = ""; [MaxLength(256)] public string Description { get; set; } = ""; public bool IsEnabled { get; set; } = true; public DateTime CreatedAt { get; set; } = DateTime.UtcNow; public DateTime UpdatedAt { get; set; } = DateTime.UtcNow; public ICollection Nodes { get; set; } = new List(); } [Table("dungeon_npc_dialog_nodes")] public class DungeonNpcDialogNode { [Key] public int Id { get; set; } public int DialogTreeId { get; set; } [ForeignKey(nameof(DialogTreeId))] public DungeonNpcDialogTree? DialogTree { get; set; } [MaxLength(128)] public string NodeKey { get; set; } = ""; [MaxLength(2048)] public string Text { get; set; } = ""; public bool IsRoot { get; set; } = false; public bool IsTerminal { get; set; } = false; [MaxLength(64)] public string? RewardType { get; set; } public int? RewardItemDefinitionId { get; set; } public int RewardItemQuantity { get; set; } = 1; public long RewardGold { get; set; } = 0; public long RewardXp { get; set; } = 0; [MaxLength(64)] public string? RewardQuestKey { get; set; } public ICollection Options { get; set; } = new List(); } [Table("dungeon_npc_dialog_options")] public class DungeonNpcDialogOption { [Key] public int Id { get; set; } public int NodeId { get; set; } [ForeignKey(nameof(NodeId))] public DungeonNpcDialogNode? Node { get; set; } [MaxLength(256)] public string PlayerText { get; set; } = ""; public int? NextNodeId { get; set; } public NpcDialogConditionType ConditionType { get; set; } = NpcDialogConditionType.None; [MaxLength(64)] public string? ConditionValue { get; set; } public int ConditionQuantity { get; set; } = 1; public bool ConsumeConditionItem { get; set; } = false; public int SortOrder { get; set; } = 0; }