128 lines
5.4 KiB
Plaintext
128 lines
5.4 KiB
Plaintext
@page "/admin/abilities"
|
|
@model Abilities.IndexModel
|
|
@using DataServer.Data.Enums
|
|
@{
|
|
ViewData["Title"] = "Mob Abilities";
|
|
}
|
|
|
|
<div class="space-y-6">
|
|
<div class="flex items-center justify-between">
|
|
<div>
|
|
<h1 class="text-3xl font-bold text-white">Mob Abilities</h1>
|
|
<p class="text-gray-400 mt-1">Manage abilities that can be assigned to mobs</p>
|
|
</div>
|
|
<a href="/admin/abilities/edit" class="btn btn-primary">+ New Ability</a>
|
|
</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>
|
|
}
|
|
|
|
<!-- Filters -->
|
|
<div class="card p-4">
|
|
<form method="get" class="flex flex-wrap gap-4 items-end">
|
|
<div class="flex-1 min-w-[200px]">
|
|
<label class="label">Search</label>
|
|
<input type="text" name="search" value="@Model.Search" class="input" placeholder="Name or key..." />
|
|
</div>
|
|
<div class="w-48">
|
|
<label class="label">Type</label>
|
|
<select name="typeFilter" class="input">
|
|
<option value="">All Types</option>
|
|
@foreach (var type in Enum.GetValues<MobAbilityType>())
|
|
{
|
|
<option value="@type" selected="@(Model.TypeFilter == type)">@type</option>
|
|
}
|
|
</select>
|
|
</div>
|
|
<button type="submit" class="btn btn-secondary">Filter</button>
|
|
<a href="/admin/abilities" class="btn btn-secondary">Clear</a>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- Abilities Table -->
|
|
<div class="card">
|
|
<table class="w-full">
|
|
<thead class="border-b border-gray-700">
|
|
<tr>
|
|
<th class="table-header">Name</th>
|
|
<th class="table-header">Key</th>
|
|
<th class="table-header">Type</th>
|
|
<th class="table-header">Damage</th>
|
|
<th class="table-header">Range</th>
|
|
<th class="table-header">Cooldown</th>
|
|
<th class="table-header">Status</th>
|
|
<th class="table-header">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-700">
|
|
@foreach (var ability in Model.Abilities)
|
|
{
|
|
<tr class="hover:bg-gray-800/50">
|
|
<td class="table-cell font-medium text-white">@ability.Name</td>
|
|
<td class="table-cell font-mono text-xs text-gray-400">@ability.Key</td>
|
|
<td class="table-cell">
|
|
<span class="badge @GetTypeBadge(ability.AbilityType)">@ability.AbilityType</span>
|
|
</td>
|
|
<td class="table-cell">@ability.BaseDamage</td>
|
|
<td class="table-cell">@ability.Range</td>
|
|
<td class="table-cell">@ability.Cooldown.ToString("0.#")s</td>
|
|
<td class="table-cell">
|
|
@if (ability.IsEnabled)
|
|
{
|
|
<span class="text-green-400">Enabled</span>
|
|
}
|
|
else
|
|
{
|
|
<span class="text-gray-500">Disabled</span>
|
|
}
|
|
</td>
|
|
<td class="table-cell">
|
|
<div class="flex gap-2">
|
|
<a href="/admin/abilities/edit?id=@ability.Id" class="btn btn-sm btn-secondary">Edit</a>
|
|
<form method="post" asp-page-handler="Delete" class="inline" onsubmit="return confirm('Delete this ability?')">
|
|
@Html.AntiForgeryToken()
|
|
<input type="hidden" name="id" value="@ability.Id" />
|
|
<button type="submit" class="btn btn-sm btn-danger">Delete</button>
|
|
</form>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
|
|
@if (Model.Abilities.Count == 0)
|
|
{
|
|
<div class="p-8 text-center text-gray-400">
|
|
No abilities found. <a href="/admin/abilities/edit" class="text-indigo-400 hover:underline">Create one</a>
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
|
|
@functions {
|
|
string GetTypeBadge(MobAbilityType type)
|
|
{
|
|
return type switch
|
|
{
|
|
MobAbilityType.MeleeAttack or MobAbilityType.Cleave => "bg-red-600",
|
|
MobAbilityType.ProjectileSingle or MobAbilityType.ProjectileAoe => "bg-orange-600",
|
|
MobAbilityType.HealSelf or MobAbilityType.HealAlly or MobAbilityType.HealAoe => "bg-green-600",
|
|
MobAbilityType.Poison or MobAbilityType.Bleed or MobAbilityType.Burn => "bg-purple-600",
|
|
MobAbilityType.Stun or MobAbilityType.Knockback or MobAbilityType.Fear or MobAbilityType.Pull => "bg-yellow-600",
|
|
MobAbilityType.SummonSingle or MobAbilityType.SummonBulk => "bg-blue-600",
|
|
_ => "bg-gray-600"
|
|
};
|
|
}
|
|
}
|