@page "/admin/roomtemplates" @model RoomTemplates.IndexModel @using DataServer.Data.Entities @{ ViewData["Title"] = "Room Templates"; }

Room Templates

Create and manage room layouts for dungeon generation

+ New Room
Filter: @foreach (var type in Enum.GetValues().Take(10)) { var count = Model.Rooms.Count(r => r.Type == type); if (count > 0) { @type (@count) } }
@foreach (var room in Model.Rooms) {

@room.Name

@room.Widthร—@room.Height tiles

@room.Type @(room.IsEnabled ? "On" : "Off")
@if (!string.IsNullOrEmpty(room.Description)) {

@room.Description

}
Tier: @room.MinTier - @(room.MaxTier == 0 ? "โˆž" : room.MaxTier.ToString())
Weight: @room.Weight
@if (!string.IsNullOrEmpty(room.Tags)) {
@foreach (var tag in room.Tags.Split(',', StringSplitOptions.RemoveEmptyEntries).Take(4)) { @tag.Trim() }
}
@if (!string.IsNullOrEmpty(room.TileDataJson)) { @(CountTiles(room.TileDataJson)) tiles placed } else { No tiles placed }
Edit
}
@if (Model.Rooms.Count == 0) {

No room templates yet. Create rooms to use in dungeon generation.

Create Your First Room
} @functions { string GetRoomTypeColor(RoomType type) { return type switch { RoomType.Entrance => "bg-green-900 text-green-300", RoomType.Exit => "bg-blue-900 text-blue-300", RoomType.Boss => "bg-red-900 text-red-300", RoomType.Treasure => "bg-yellow-900 text-yellow-300", RoomType.Secret => "bg-purple-900 text-purple-300", RoomType.Shop => "bg-cyan-900 text-cyan-300", RoomType.Hallway => "bg-gray-700 text-gray-300", _ => "bg-gray-600 text-gray-300" }; } int CountTiles(string? json) { if (string.IsNullOrEmpty(json)) return 0; try { var tiles = System.Text.Json.JsonSerializer.Deserialize>(json); return tiles?.Count ?? 0; } catch { return 0; } } }