using DataServer.Data.Entities; namespace GameServer.Dungeon; /// /// Extended room with template info /// public class DungeonRoomV2 : DungeonRoom { public int? TemplateId { get; set; } public string? TemplateName { get; set; } public HashSet TemplateTags { get; set; } = new(StringComparer.OrdinalIgnoreCase); public new RoomType Type { get; set; } = RoomType.Normal; /// Connection points parsed from template public List ConnectionPoints { get; set; } = new(); /// Mob spawns from template (intermediate storage before conversion) public List MobSpawns { get; set; } = new(); /// Player spawn position (for entrance rooms) public int? PlayerSpawnX { get; set; } public int? PlayerSpawnY { get; set; } /// Exit position (for exit rooms) public int? ExitX { get; set; } public int? ExitY { get; set; } public DungeonRoomV2(int x, int y, int width, int height) : base(x, y, width, height) { } /// Get the best connection point for a given direction public ConnectionPoint? GetConnectionPoint(string direction) { // First try exact match var exact = ConnectionPoints.FirstOrDefault(c => c.Direction.Equals(direction, StringComparison.OrdinalIgnoreCase)); if (exact != null) return exact; // No exact match - create a default one for this direction return direction.ToLower() switch { "north" => new ConnectionPoint { X = Width / 2, Y = 0, Direction = "north", Width = 3 }, "south" => new ConnectionPoint { X = Width / 2, Y = Height - 1, Direction = "south", Width = 3 }, "east" => new ConnectionPoint { X = Width - 1, Y = Height / 2, Direction = "east", Width = 3 }, "west" => new ConnectionPoint { X = 0, Y = Height / 2, Direction = "west", Width = 3 }, _ => ConnectionPoints.FirstOrDefault() }; } /// Get world position of a connection point public (int X, int Y) GetConnectionWorldPos(ConnectionPoint cp) { return (X + cp.X, Y + cp.Y); } } /// /// Mob spawn point within a room (intermediate type for template data) /// public class RoomMobSpawn { public int X { get; set; } public int Y { get; set; } public string Type { get; set; } = "normal"; public int? MobDefinitionId { get; set; } // Specific mob, or null for random from pool public int Count { get; set; } = 1; }