Divers
This commit is contained in:
@@ -0,0 +1,132 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace DungeonCrawler.Data.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Active dungeon instance (persists until cleared)
|
||||
/// </summary>
|
||||
[Table("dungeon_instances")]
|
||||
public class DungeonInstance
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
public int Tier { get; set; } = 1;
|
||||
public int Seed { get; set; } // For regenerating the same layout
|
||||
|
||||
public DungeonStatus Status { get; set; } = DungeonStatus.Active;
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime? CompletedAt { get; set; }
|
||||
|
||||
// Dungeon state
|
||||
public int TotalRooms { get; set; }
|
||||
public int ClearedRooms { get; set; }
|
||||
public int TotalMobs { get; set; }
|
||||
public int RemainingMobs { get; set; }
|
||||
public int TotalChests { get; set; }
|
||||
public int OpenedChests { get; set; }
|
||||
|
||||
// Serialized dungeon data (rooms, corridors, mob positions)
|
||||
[MaxLength(65536)]
|
||||
public string LayoutJson { get; set; } = "{}";
|
||||
|
||||
// Track who's been here
|
||||
public virtual ICollection<DungeonVisit> Visits { get; set; } = new List<DungeonVisit>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tracks character visits to dungeons
|
||||
/// </summary>
|
||||
[Table("dungeon_visits")]
|
||||
public class DungeonVisit
|
||||
{
|
||||
[Key]
|
||||
public ulong Id { get; set; }
|
||||
|
||||
public Guid DungeonId { get; set; }
|
||||
public ulong CharacterId { get; set; }
|
||||
|
||||
public DateTime EnteredAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime? LeftAt { get; set; }
|
||||
|
||||
public VisitOutcome Outcome { get; set; } = VisitOutcome.InProgress;
|
||||
|
||||
public int MobsKilled { get; set; }
|
||||
public int ChestsOpened { get; set; }
|
||||
public int PlayersKilled { get; set; }
|
||||
|
||||
// Navigation
|
||||
public virtual DungeonInstance? Dungeon { get; set; }
|
||||
public virtual Character? Character { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Loot table for mobs and chests
|
||||
/// </summary>
|
||||
[Table("loot_tables")]
|
||||
public class LootTable
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
[MaxLength(64)]
|
||||
public string Name { get; set; } = "";
|
||||
|
||||
public LootSourceType SourceType { get; set; }
|
||||
public int MinTier { get; set; } = 1;
|
||||
|
||||
public virtual ICollection<LootTableEntry> Entries { get; set; } = new List<LootTableEntry>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Individual entry in a loot table
|
||||
/// </summary>
|
||||
[Table("loot_table_entries")]
|
||||
public class LootTableEntry
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
public int LootTableId { get; set; }
|
||||
public int ItemDefinitionId { get; set; }
|
||||
|
||||
public float DropChance { get; set; } = 0.1f; // 0.0 - 1.0
|
||||
public int MinQuantity { get; set; } = 1;
|
||||
public int MaxQuantity { get; set; } = 1;
|
||||
|
||||
// Weight for weighted random selection
|
||||
public int Weight { get; set; } = 100;
|
||||
|
||||
// Navigation
|
||||
public virtual LootTable? LootTable { get; set; }
|
||||
public virtual ItemDefinition? ItemDefinition { get; set; }
|
||||
}
|
||||
|
||||
// Enums
|
||||
|
||||
public enum DungeonStatus
|
||||
{
|
||||
Active, // In progress
|
||||
Completed, // All mobs dead, exit available
|
||||
Abandoned // Cleanup candidate
|
||||
}
|
||||
|
||||
public enum VisitOutcome
|
||||
{
|
||||
InProgress,
|
||||
Extracted, // Left via exit/teleport
|
||||
Died,
|
||||
Disconnected
|
||||
}
|
||||
|
||||
|
||||
public enum LootSourceType
|
||||
{
|
||||
Mob,
|
||||
Chest,
|
||||
Boss
|
||||
}
|
||||
Reference in New Issue
Block a user