308 lines
14 KiB
Plaintext
308 lines
14 KiB
Plaintext
@page "/admin/dungeons"
|
|
@model Admin.Pages.Dungeons.IndexModel
|
|
@{
|
|
ViewData["Title"] = "Dungeon Management";
|
|
}
|
|
|
|
<style>
|
|
.dungeon-card {
|
|
transition: all 0.2s ease;
|
|
}
|
|
.dungeon-card:hover {
|
|
border-color: rgba(99, 102, 241, 0.5);
|
|
}
|
|
.phase-active { color: #4ade80; }
|
|
.phase-completed { color: #60a5fa; }
|
|
.phase-failed { color: #f87171; }
|
|
.stat-badge {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 4px;
|
|
padding: 2px 8px;
|
|
border-radius: 4px;
|
|
font-size: 12px;
|
|
}
|
|
.live-indicator {
|
|
width: 8px;
|
|
height: 8px;
|
|
background: #4ade80;
|
|
border-radius: 50%;
|
|
animation: pulse 2s infinite;
|
|
}
|
|
@@keyframes pulse {
|
|
0%, 100% { opacity: 1; }
|
|
50% { opacity: 0.5; }
|
|
}
|
|
</style>
|
|
|
|
<div class="space-y-6">
|
|
<!-- Header -->
|
|
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-4">
|
|
<div>
|
|
<h1 class="text-3xl font-bold text-white">Dungeon Management</h1>
|
|
<p class="text-gray-400 mt-1">View and manage active dungeon instances</p>
|
|
</div>
|
|
<div class="flex gap-2">
|
|
<button onclick="refreshDungeons()" class="btn btn-secondary">
|
|
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/>
|
|
</svg>
|
|
Refresh
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
@if (TempData["Message"] != null)
|
|
{
|
|
<div class="p-4 rounded-lg bg-green-900/50 border border-green-700 text-green-300">
|
|
@TempData["Message"]
|
|
</div>
|
|
}
|
|
@if (TempData["Error"] != null)
|
|
{
|
|
<div class="p-4 rounded-lg bg-red-900/50 border border-red-700 text-red-300">
|
|
@TempData["Error"]
|
|
</div>
|
|
}
|
|
|
|
<!-- Stats Overview -->
|
|
<div class="grid grid-cols-2 md:grid-cols-4 gap-4">
|
|
<div class="card p-4">
|
|
<div class="text-2xl font-bold text-white">@Model.ActiveCount</div>
|
|
<div class="text-gray-400 text-sm">Active Dungeons</div>
|
|
</div>
|
|
<div class="card p-4">
|
|
<div class="text-2xl font-bold text-green-400">@Model.TotalPlayers</div>
|
|
<div class="text-gray-400 text-sm">Players In Dungeons</div>
|
|
</div>
|
|
<div class="card p-4">
|
|
<div class="text-2xl font-bold text-blue-400">@Model.CompletedToday</div>
|
|
<div class="text-gray-400 text-sm">Completed Today</div>
|
|
</div>
|
|
<div class="card p-4">
|
|
<div class="text-2xl font-bold text-yellow-400">@Model.AverageDuration</div>
|
|
<div class="text-gray-400 text-sm">Avg Duration (min)</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Filters -->
|
|
<div class="card p-4">
|
|
<form method="get" class="flex flex-wrap gap-3 items-end">
|
|
<div>
|
|
<label class="text-xs text-gray-400 mb-1 block">Status</label>
|
|
<select name="status" class="input text-sm">
|
|
<option value="">Active Only</option>
|
|
<option value="completed" selected="@(Model.StatusFilter == "completed")">Completed/Cleared</option>
|
|
<option value="all" selected="@(Model.StatusFilter == "all")">All Dungeons</option>
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label class="text-xs text-gray-400 mb-1 block">Tier</label>
|
|
<select name="tier" class="input text-sm">
|
|
<option value="">All Tiers</option>
|
|
@for (int i = 1; i <= 10; i++)
|
|
{
|
|
<option value="@i" selected="@(Model.TierFilter == i)">Tier @i</option>
|
|
}
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label class="text-xs text-gray-400 mb-1 block">Level Bracket</label>
|
|
<select name="bracket" class="input text-sm">
|
|
<option value="">All Brackets</option>
|
|
<option value="1" selected="@(Model.BracketFilter == 1)">1-10</option>
|
|
<option value="2" selected="@(Model.BracketFilter == 2)">11-20</option>
|
|
<option value="3" selected="@(Model.BracketFilter == 3)">21-30</option>
|
|
<option value="4" selected="@(Model.BracketFilter == 4)">31-40</option>
|
|
<option value="5" selected="@(Model.BracketFilter == 5)">41-50</option>
|
|
</select>
|
|
</div>
|
|
<button type="submit" class="btn btn-secondary text-sm">Filter</button>
|
|
<a href="/admin/dungeons" class="btn btn-ghost text-sm">Clear</a>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- Active Dungeons -->
|
|
<div class="space-y-4">
|
|
<h2 class="text-xl font-semibold text-white flex items-center gap-2">
|
|
<div class="live-indicator"></div>
|
|
Dungeons (@Model.Dungeons.Count)
|
|
@if (string.IsNullOrEmpty(Model.StatusFilter) || Model.StatusFilter == "active")
|
|
{
|
|
<span class="text-sm font-normal text-gray-500">(active only)</span>
|
|
}
|
|
</h2>
|
|
|
|
@if (Model.Dungeons.Count > 0)
|
|
{
|
|
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
|
@foreach (var dungeon in Model.Dungeons)
|
|
{
|
|
<div class="dungeon-card card p-4">
|
|
<div class="flex items-start justify-between mb-3">
|
|
<div>
|
|
<div class="flex items-center gap-2">
|
|
<span class="text-lg font-semibold text-white">Tier @dungeon.Tier</span>
|
|
<span class="stat-badge bg-indigo-500/20 text-indigo-300">Lvl @dungeon.LevelBracketMin-@dungeon.LevelBracketMax</span>
|
|
@if (dungeon.BossKilled)
|
|
{
|
|
<span class="stat-badge bg-green-500/20 text-green-300">Boss Killed</span>
|
|
}
|
|
</div>
|
|
<div class="text-xs text-gray-500 mt-1 font-mono">@dungeon.Id.ToString()[..8]...</div>
|
|
</div>
|
|
<div class="text-right">
|
|
<span class="@GetPhaseClass(dungeon.Phase)">@dungeon.Phase</span>
|
|
<div class="text-xs text-gray-500">@dungeon.Duration</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="grid grid-cols-3 gap-2 text-sm mb-3">
|
|
<div class="bg-gray-800/50 rounded p-2 text-center">
|
|
<div class="text-white font-semibold">@dungeon.PlayerCount</div>
|
|
<div class="text-xs text-gray-400">Players</div>
|
|
</div>
|
|
<div class="bg-gray-800/50 rounded p-2 text-center">
|
|
<div class="text-white font-semibold">@dungeon.MobsAlive / @dungeon.TotalMobs</div>
|
|
<div class="text-xs text-gray-400">Mobs</div>
|
|
</div>
|
|
<div class="bg-gray-800/50 rounded p-2 text-center">
|
|
<div class="text-white font-semibold">@dungeon.RoomCount</div>
|
|
<div class="text-xs text-gray-400">Rooms</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="text-xs text-gray-400 mb-3">
|
|
<span>Created by: <span class="text-white">@dungeon.CreatorName</span></span>
|
|
<span class="mx-2">•</span>
|
|
<span>Seed: <span class="font-mono text-gray-300">@dungeon.Seed</span></span>
|
|
</div>
|
|
|
|
<div class="flex gap-2">
|
|
<a href="/admin/dungeons/view?id=@dungeon.Id" class="btn btn-sm btn-secondary flex-1">
|
|
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/>
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/>
|
|
</svg>
|
|
View
|
|
</a>
|
|
<form method="post" asp-page-handler="Archive" onsubmit="return confirm('Archive this dungeon now? It will be removed from active list.')">
|
|
@Html.AntiForgeryToken()
|
|
<input type="hidden" name="id" value="@dungeon.Id" />
|
|
<button type="submit" class="btn btn-sm btn-secondary" disabled="@(dungeon.PlayerCount > 0)" title="@(dungeon.PlayerCount > 0 ? "Players must leave before archiving." : "Archive dungeon")">
|
|
Archive
|
|
</button>
|
|
</form>
|
|
<form method="post" asp-page-handler="Delete" onsubmit="return confirm('Delete this dungeon? All players will be removed.')">
|
|
@Html.AntiForgeryToken()
|
|
<input type="hidden" name="id" value="@dungeon.Id" />
|
|
<button type="submit" class="btn btn-sm btn-danger">
|
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/>
|
|
</svg>
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
}
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
<div class="card p-8 text-center text-gray-500">
|
|
<div class="text-4xl mb-2">🏰</div>
|
|
<p>No active dungeons at the moment.</p>
|
|
<p class="text-sm mt-1">Dungeons are created when players enter them.</p>
|
|
</div>
|
|
}
|
|
</div>
|
|
|
|
<!-- Archived Dungeons -->
|
|
<div class="space-y-4">
|
|
<h2 class="text-xl font-semibold text-white">
|
|
Archived Dungeons (@Model.ArchivedDungeons.Count)
|
|
<span class="text-sm font-normal text-gray-500">(persisted in DB)</span>
|
|
</h2>
|
|
|
|
@if (Model.ArchivedDungeons.Count > 0)
|
|
{
|
|
<div class="card p-4 overflow-x-auto">
|
|
<table class="w-full text-sm">
|
|
<thead class="text-gray-400 text-xs uppercase">
|
|
<tr>
|
|
<th class="text-left py-2">Id</th>
|
|
<th class="text-left py-2">Tier</th>
|
|
<th class="text-left py-2">Bracket</th>
|
|
<th class="text-left py-2">Creator</th>
|
|
<th class="text-left py-2">Created</th>
|
|
<th class="text-left py-2">Last Activity</th>
|
|
<th class="text-left py-2">Persisted</th>
|
|
<th class="text-left py-2">Boss</th>
|
|
<th class="text-left py-2">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="text-gray-300">
|
|
@foreach (var dungeon in Model.ArchivedDungeons)
|
|
{
|
|
<tr class="border-t border-gray-800">
|
|
<td class="py-2 font-mono">@dungeon.Id.ToString()[..8]...</td>
|
|
<td class="py-2">@($"T{dungeon.Tier}")</td>
|
|
<td class="py-2">@dungeon.LevelBracketMin-@dungeon.LevelBracketMax</td>
|
|
<td class="py-2">@dungeon.CreatorName</td>
|
|
<td class="py-2">@dungeon.CreatedAt.ToString("u")</td>
|
|
<td class="py-2">@dungeon.LastActivity.ToString("u")</td>
|
|
<td class="py-2">@(dungeon.PersistedAt?.ToString("u") ?? "-")</td>
|
|
<td class="py-2">@(dungeon.BossKilled ? "Yes" : "No")</td>
|
|
<td class="py-2">
|
|
<form method="post" asp-page-handler="DeleteArchive" onsubmit="return confirm('Delete this archived dungeon? This cannot be undone.')">
|
|
@Html.AntiForgeryToken()
|
|
<input type="hidden" name="id" value="@dungeon.Id" />
|
|
<button type="submit" class="btn btn-sm btn-danger">
|
|
Delete
|
|
</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
<div class="card p-6 text-center text-gray-500">
|
|
<p>No archived dungeons found.</p>
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
|
|
@section Scripts {
|
|
<script>
|
|
function refreshDungeons() {
|
|
window.location.reload();
|
|
}
|
|
|
|
// Auto-refresh every 30 seconds
|
|
setInterval(() => {
|
|
// Only refresh if page is visible
|
|
if (!document.hidden) {
|
|
refreshDungeons();
|
|
}
|
|
}, 30000);
|
|
</script>
|
|
}
|
|
|
|
@functions {
|
|
string GetPhaseClass(string phase)
|
|
{
|
|
return phase.ToLower() switch
|
|
{
|
|
"active" => "phase-active",
|
|
"completed" => "phase-completed",
|
|
"failed" => "phase-failed",
|
|
_ => "text-gray-400"
|
|
};
|
|
}
|
|
}
|