422 lines
23 KiB
Plaintext
422 lines
23 KiB
Plaintext
@page "/admin/players/character"
|
|
@model Players.CharacterModel
|
|
@using DataServer.Data.Entities
|
|
@using DataServer.Data.Enums
|
|
@{
|
|
ViewData["Title"] = $"Character: {Model.Character.Name}";
|
|
}
|
|
|
|
<div class="space-y-4">
|
|
<!-- Header -->
|
|
<div class="flex items-center justify-between">
|
|
<div>
|
|
<a href="/admin/players/edit?id=@Model.Character.AccountId" class="text-gray-400 hover:text-white text-sm">← Back to Account</a>
|
|
<h1 class="text-2xl font-bold text-white mt-1">@Model.Character.Name</h1>
|
|
<p class="text-gray-400 text-sm">Level @Model.Character.Level • @Model.Character.Gold.ToString("N0") Gold • ID: @Model.Character.Id</p>
|
|
</div>
|
|
</div>
|
|
|
|
@if (!string.IsNullOrEmpty(Model.Message))
|
|
{
|
|
<div class="p-3 rounded-lg text-sm @(Model.IsError ? "bg-red-900/50 border border-red-700 text-red-300" : "bg-green-900/50 border border-green-700 text-green-300")">
|
|
@Model.Message
|
|
</div>
|
|
}
|
|
|
|
<div class="grid grid-cols-1 lg:grid-cols-4 gap-4">
|
|
<!-- Left: Basic + Stats -->
|
|
<div class="lg:col-span-3 space-y-4">
|
|
<!-- Basic Info -->
|
|
<form method="post" asp-page-handler="UpdateBasic" class="card p-4">
|
|
@Html.AntiForgeryToken()
|
|
<input type="hidden" name="characterId" value="@Model.Character.Id" />
|
|
|
|
<h2 class="text-md font-semibold text-white mb-3">Basic Information</h2>
|
|
|
|
<div class="grid grid-cols-2 md:grid-cols-4 gap-3 mb-3">
|
|
<div class="col-span-2">
|
|
<label class="label text-xs">Name</label>
|
|
<input type="text" name="name" value="@Model.Character.Name" class="input text-sm py-1" required maxlength="32" />
|
|
</div>
|
|
<div>
|
|
<label class="label text-xs">Level</label>
|
|
<input type="number" name="level" value="@Model.Character.Level" class="input text-sm py-1" min="1" max="100" />
|
|
</div>
|
|
<div>
|
|
<label class="label text-xs">Experience</label>
|
|
<input type="number" name="experience" value="@Model.Character.Experience" class="input text-sm py-1" min="0" />
|
|
</div>
|
|
<div>
|
|
<label class="label text-xs">Gold</label>
|
|
<input type="number" name="gold" value="@Model.Character.Gold" class="input text-sm py-1" min="0" />
|
|
</div>
|
|
<div>
|
|
<label class="label text-xs">Unspent Pts</label>
|
|
<input type="number" name="unspentStatPoints" value="@Model.Character.UnspentStatPoints" class="input text-sm py-1" min="0" />
|
|
</div>
|
|
<div>
|
|
<label class="label text-xs">HP</label>
|
|
<input type="number" name="currentHealth" value="@Model.Character.CurrentHealth" class="input text-sm py-1" min="0" />
|
|
</div>
|
|
<div>
|
|
<label class="label text-xs">Mana</label>
|
|
<input type="number" name="currentMana" value="@Model.Character.CurrentMana" class="input text-sm py-1" min="0" />
|
|
</div>
|
|
</div>
|
|
<button type="submit" class="btn btn-primary btn-sm">Save Basic</button>
|
|
</form>
|
|
|
|
<!-- Stats -->
|
|
<form method="post" asp-page-handler="UpdateStats" class="card p-4">
|
|
@Html.AntiForgeryToken()
|
|
<input type="hidden" name="characterId" value="@Model.Character.Id" />
|
|
|
|
<h2 class="text-md font-semibold text-white mb-3">Stats</h2>
|
|
|
|
<div class="grid grid-cols-5 gap-3 mb-3">
|
|
<div>
|
|
<label class="label text-xs text-red-400">STR</label>
|
|
<input type="number" name="strength" value="@Model.Character.Strength" class="input text-sm py-1" min="1" />
|
|
</div>
|
|
<div>
|
|
<label class="label text-xs text-blue-400">INT</label>
|
|
<input type="number" name="intelligence" value="@Model.Character.Intelligence" class="input text-sm py-1" min="1" />
|
|
</div>
|
|
<div>
|
|
<label class="label text-xs text-purple-400">WIS</label>
|
|
<input type="number" name="wisdom" value="@Model.Character.Wisdom" class="input text-sm py-1" min="1" />
|
|
</div>
|
|
<div>
|
|
<label class="label text-xs text-green-400">END</label>
|
|
<input type="number" name="endurance" value="@Model.Character.Endurance" class="input text-sm py-1" min="1" />
|
|
</div>
|
|
<div>
|
|
<label class="label text-xs text-yellow-400">DEX</label>
|
|
<input type="number" name="dexterity" value="@Model.Character.Dexterity" class="input text-sm py-1" min="1" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="grid grid-cols-6 gap-2 p-2 bg-gray-800 rounded text-center text-xs mb-3">
|
|
<div><span class="text-gray-500">HP</span><br/><span class="text-white">@Model.ComputedMaxHealth</span></div>
|
|
<div><span class="text-gray-500">Mana</span><br/><span class="text-white">@Model.ComputedMaxMana</span></div>
|
|
<div><span class="text-gray-500">Stam</span><br/><span class="text-white">@Model.ComputedMaxStamina</span></div>
|
|
<div><span class="text-gray-500">XP+</span><br/><span class="text-white">@(((Model.ComputedXpBonus - 1) * 100).ToString("0"))%</span></div>
|
|
<div><span class="text-gray-500">Spd</span><br/><span class="text-white">@Model.ComputedMoveSpeed.ToString("0")</span></div>
|
|
<div><span class="text-gray-500">Atk</span><br/><span class="text-white">@Model.ComputedAttackSpeed.ToString("0.0")</span></div>
|
|
</div>
|
|
<button type="submit" class="btn btn-primary btn-sm">Save Stats</button>
|
|
</form>
|
|
|
|
<!-- Inventory Grid - Compact -->
|
|
<div class="card p-4">
|
|
<h2 class="text-md font-semibold text-white mb-3">Inventory (@Model.InventoryItems.Count/30)</h2>
|
|
|
|
<div class="grid grid-cols-10 gap-1">
|
|
@for (int i = 0; i < 30; i++)
|
|
{
|
|
var item = Model.InventoryItems.FirstOrDefault(it => it.SlotIndex == i);
|
|
var rarityBorder = item?.ItemDefinition?.Rarity switch
|
|
{
|
|
ItemRarity.Uncommon => "border-green-500",
|
|
ItemRarity.Rare => "border-blue-500",
|
|
ItemRarity.Epic => "border-purple-500",
|
|
ItemRarity.Legendary => "border-orange-500",
|
|
_ => "border-gray-700"
|
|
};
|
|
<div class="w-10 h-10 bg-gray-900 rounded border @rarityBorder flex items-center justify-center relative group cursor-pointer"
|
|
@if (item != null) { <text>onclick="showItemModal(@item.Id, @item.Quantity, @item.SlotIndex)"</text> }>
|
|
@if (item?.ItemDefinition != null)
|
|
{
|
|
@if (!string.IsNullOrEmpty(item.ItemDefinition.SpritePath))
|
|
{
|
|
<img src="@Model.CdnBaseUrl/downloads/@item.ItemDefinition.SpritePath" class="w-8 h-8 object-contain" />
|
|
}
|
|
else
|
|
{
|
|
<span class="text-xs text-gray-400">@item.ItemDefinition.Name.Substring(0, Math.Min(2, item.ItemDefinition.Name.Length))</span>
|
|
}
|
|
@if (item.Quantity > 1)
|
|
{
|
|
<span class="absolute bottom-0 right-0 bg-black/80 text-white text-[10px] px-0.5 rounded-tl">@item.Quantity</span>
|
|
}
|
|
@if (item.CraftedItem != null)
|
|
{
|
|
<span class="absolute top-0 left-0 text-cyan-400 text-[10px] font-bold">⚒️</span>
|
|
}
|
|
<div class="absolute left-full ml-1 top-0 z-50 hidden group-hover:block">
|
|
@await Html.PartialAsync("_CharacterItemTooltip", item)
|
|
</div>
|
|
}
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Stash Grid (VIP Feature) -->
|
|
<div class="card p-4">
|
|
<h2 class="text-md font-semibold text-white mb-3">🔐 Stash (@Model.StashItems.Count/50)</h2>
|
|
|
|
<div class="grid grid-cols-10 gap-1">
|
|
@for (int i = 0; i < 50; i++)
|
|
{
|
|
var item = Model.StashItems.FirstOrDefault(s => s.SlotIndex == i);
|
|
var rarityBorder = item?.Definition?.Rarity switch
|
|
{
|
|
ItemRarity.Uncommon => "border-green-500",
|
|
ItemRarity.Rare => "border-blue-500",
|
|
ItemRarity.Epic => "border-purple-500",
|
|
ItemRarity.Legendary => "border-orange-500",
|
|
_ => "border-gray-700"
|
|
};
|
|
<div class="w-10 h-10 bg-gray-900 rounded border @rarityBorder flex items-center justify-center relative group cursor-pointer"
|
|
@if (item != null) { <text>onclick="showStashModal(@item.Id, @item.Quantity, @item.SlotIndex)"</text> }>
|
|
@if (item?.Definition != null)
|
|
{
|
|
@if (!string.IsNullOrEmpty(item.Definition.SpritePath))
|
|
{
|
|
<img src="@Model.CdnBaseUrl/downloads/@item.Definition.SpritePath" class="w-8 h-8 object-contain" />
|
|
}
|
|
else
|
|
{
|
|
<span class="text-xs text-gray-400">@item.Definition.Name.Substring(0, Math.Min(2, item.Definition.Name.Length))</span>
|
|
}
|
|
@if (item.Quantity > 1)
|
|
{
|
|
<span class="absolute bottom-0 right-0 bg-black/80 text-white text-[10px] px-0.5 rounded-tl">@item.Quantity</span>
|
|
}
|
|
<div class="absolute left-full ml-1 top-0 z-50 hidden group-hover:block">
|
|
@await Html.PartialAsync("_ItemTooltip", item.Definition)
|
|
</div>
|
|
}
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Lifetime Stats -->
|
|
<div class="card p-4">
|
|
<h2 class="text-md font-semibold text-white mb-3">Lifetime Stats</h2>
|
|
<div class="grid grid-cols-5 gap-2 text-center text-sm">
|
|
<div class="bg-gray-800 rounded p-2"><span class="block text-lg font-bold text-white">@Model.Character.TotalKills</span><span class="text-xs text-gray-500">Kills</span></div>
|
|
<div class="bg-gray-800 rounded p-2"><span class="block text-lg font-bold text-white">@Model.Character.TotalDeaths</span><span class="text-xs text-gray-500">Deaths</span></div>
|
|
<div class="bg-gray-800 rounded p-2"><span class="block text-lg font-bold text-red-400">@Model.Character.PlayersKilled</span><span class="text-xs text-gray-500">PvP Kills</span></div>
|
|
<div class="bg-gray-800 rounded p-2"><span class="block text-lg font-bold text-green-400">@Model.Character.DungeonsCompleted</span><span class="text-xs text-gray-500">Dungeons</span></div>
|
|
<div class="bg-gray-800 rounded p-2"><span class="block text-lg font-bold text-purple-400">@Model.Character.BossesKilled</span><span class="text-xs text-gray-500">Bosses</span></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Right: Equipment -->
|
|
<div class="space-y-4">
|
|
<div class="card p-4">
|
|
<h2 class="text-md font-semibold text-white mb-3">Equipment</h2>
|
|
<div class="space-y-1">
|
|
@foreach (var slot in new[] {
|
|
(DungeonEquipmentSlot.MainHand, "Weapon"),
|
|
(DungeonEquipmentSlot.OffHand, "Off-Hand"),
|
|
(DungeonEquipmentSlot.Head, "Head"),
|
|
(DungeonEquipmentSlot.Chest, "Chest"),
|
|
(DungeonEquipmentSlot.Legs, "Legs"),
|
|
(DungeonEquipmentSlot.Boots, "Boots"),
|
|
(DungeonEquipmentSlot.Gloves, "Gloves"),
|
|
(DungeonEquipmentSlot.Necklace, "Necklace"),
|
|
(DungeonEquipmentSlot.Ring1, "Ring 1"),
|
|
(DungeonEquipmentSlot.Ring2, "Ring 2"),
|
|
(DungeonEquipmentSlot.Quiver, "Quiver")
|
|
})
|
|
{
|
|
var item = Model.EquippedItems.FirstOrDefault(i => i.EquipSlot == slot.Item1);
|
|
<div class="flex items-center gap-2 p-1.5 bg-gray-800 rounded group relative">
|
|
<div class="w-8 h-8 bg-gray-900 rounded border border-gray-700 flex items-center justify-center flex-shrink-0 relative">
|
|
@if (item?.ItemDefinition != null && !string.IsNullOrEmpty(item.ItemDefinition.SpritePath))
|
|
{
|
|
<img src="@Model.CdnBaseUrl/downloads/@item.ItemDefinition.SpritePath" class="w-6 h-6 object-contain" />
|
|
}
|
|
else
|
|
{
|
|
<span class="text-gray-600 text-[10px]">@slot.Item2.Substring(0, 1)</span>
|
|
}
|
|
@if (item?.CraftedItem != null)
|
|
{
|
|
<span class="absolute -top-1 -right-1 text-cyan-400 text-[10px] font-bold">⚒️</span>
|
|
}
|
|
</div>
|
|
<div class="flex-1 min-w-0">
|
|
<p class="text-[10px] text-gray-500">@slot.Item2</p>
|
|
<p class="text-xs @(item != null ? "text-white" : "text-gray-600 italic") truncate">
|
|
@(item?.ItemDefinition?.Name ?? "Empty")
|
|
@if (item?.CraftedItem != null)
|
|
{
|
|
<span class="text-cyan-400 text-[10px]">(Q@(item.CraftedItem.QualityRating)%)</span>
|
|
}
|
|
</p>
|
|
</div>
|
|
@if (item?.ItemDefinition != null)
|
|
{
|
|
<div class="absolute right-full mr-1 top-0 z-50 hidden group-hover:block">
|
|
@await Html.PartialAsync("_CharacterItemTooltip", item)
|
|
</div>
|
|
}
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Item Edit Modal -->
|
|
<div id="itemModal" class="fixed inset-0 bg-black/70 hidden items-center justify-center z-50">
|
|
<div class="bg-gray-800 rounded-xl p-4 max-w-xs w-full mx-4 border border-gray-700">
|
|
<h3 class="text-md font-semibold text-white mb-3">Edit Item</h3>
|
|
|
|
<div class="space-y-3 mb-4">
|
|
<div>
|
|
<label class="label text-xs">Quantity</label>
|
|
<input type="number" id="modalQuantity" class="input text-sm py-1" min="1" />
|
|
</div>
|
|
<div>
|
|
<label class="label text-xs">Slot (0-29)</label>
|
|
<input type="number" id="modalSlotIndex" class="input text-sm py-1" min="0" max="29" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex justify-between gap-2 pt-3 border-t border-gray-700">
|
|
<button type="button" onclick="deleteItem()" class="btn bg-red-700 hover:bg-red-600 text-white btn-sm">Delete</button>
|
|
<div class="flex gap-2">
|
|
<button type="button" onclick="closeItemModal()" class="btn btn-secondary btn-sm">Cancel</button>
|
|
<button type="button" onclick="saveItem()" class="btn btn-primary btn-sm">Save</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Hidden forms -->
|
|
<form id="updateItemForm" method="post" asp-page-handler="UpdateItem" style="display:none">
|
|
@Html.AntiForgeryToken()
|
|
<input type="hidden" name="characterId" value="@Model.Character.Id" />
|
|
<input type="hidden" name="itemId" id="updateItemId" />
|
|
<input type="hidden" name="quantity" id="updateQuantity" />
|
|
<input type="hidden" name="slotIndex" id="updateSlotIndex" />
|
|
</form>
|
|
|
|
<form id="deleteItemForm" method="post" asp-page-handler="DeleteItem" style="display:none">
|
|
@Html.AntiForgeryToken()
|
|
<input type="hidden" name="characterId" value="@Model.Character.Id" />
|
|
<input type="hidden" name="itemId" id="deleteItemId" />
|
|
</form>
|
|
|
|
<!-- Stash Edit Modal -->
|
|
<div id="stashModal" class="fixed inset-0 bg-black/70 hidden items-center justify-center z-50">
|
|
<div class="bg-gray-800 rounded-xl p-4 max-w-xs w-full mx-4 border border-gray-700">
|
|
<h3 class="text-md font-semibold text-white mb-3">🔐 Edit Stash Item</h3>
|
|
|
|
<div class="space-y-3 mb-4">
|
|
<div>
|
|
<label class="label text-xs">Quantity</label>
|
|
<input type="number" id="stashModalQuantity" class="input text-sm py-1" min="1" />
|
|
</div>
|
|
<div>
|
|
<label class="label text-xs">Slot (0-49)</label>
|
|
<input type="number" id="stashModalSlotIndex" class="input text-sm py-1" min="0" max="49" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex justify-between gap-2 pt-3 border-t border-gray-700">
|
|
<button type="button" onclick="deleteStashItem()" class="btn bg-red-700 hover:bg-red-600 text-white btn-sm">Delete</button>
|
|
<div class="flex gap-2">
|
|
<button type="button" onclick="closeStashModal()" class="btn btn-secondary btn-sm">Cancel</button>
|
|
<button type="button" onclick="saveStashItem()" class="btn btn-primary btn-sm">Save</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Hidden stash forms -->
|
|
<form id="updateStashItemForm" method="post" asp-page-handler="UpdateStashItem" style="display:none">
|
|
@Html.AntiForgeryToken()
|
|
<input type="hidden" name="characterId" value="@Model.Character.Id" />
|
|
<input type="hidden" name="stashItemId" id="updateStashItemId" />
|
|
<input type="hidden" name="quantity" id="updateStashQuantity" />
|
|
<input type="hidden" name="slotIndex" id="updateStashSlotIndex" />
|
|
</form>
|
|
|
|
<form id="deleteStashItemForm" method="post" asp-page-handler="DeleteStashItem" style="display:none">
|
|
@Html.AntiForgeryToken()
|
|
<input type="hidden" name="characterId" value="@Model.Character.Id" />
|
|
<input type="hidden" name="stashItemId" id="deleteStashItemId" />
|
|
</form>
|
|
|
|
@section Scripts {
|
|
<script>
|
|
let currentItemId = null;
|
|
let currentStashItemId = null;
|
|
|
|
function showItemModal(itemId, quantity, slotIndex) {
|
|
currentItemId = itemId;
|
|
document.getElementById('modalQuantity').value = quantity;
|
|
document.getElementById('modalSlotIndex').value = slotIndex;
|
|
document.getElementById('itemModal').classList.remove('hidden');
|
|
document.getElementById('itemModal').classList.add('flex');
|
|
}
|
|
|
|
function closeItemModal() {
|
|
document.getElementById('itemModal').classList.add('hidden');
|
|
document.getElementById('itemModal').classList.remove('flex');
|
|
currentItemId = null;
|
|
}
|
|
|
|
function saveItem() {
|
|
if (!currentItemId) return;
|
|
document.getElementById('updateItemId').value = currentItemId;
|
|
document.getElementById('updateQuantity').value = document.getElementById('modalQuantity').value;
|
|
document.getElementById('updateSlotIndex').value = document.getElementById('modalSlotIndex').value;
|
|
document.getElementById('updateItemForm').submit();
|
|
}
|
|
|
|
function deleteItem() {
|
|
if (!currentItemId) return;
|
|
if (!confirm('Delete this item permanently?')) return;
|
|
document.getElementById('deleteItemId').value = currentItemId;
|
|
document.getElementById('deleteItemForm').submit();
|
|
}
|
|
|
|
// Stash functions
|
|
function showStashModal(stashItemId, quantity, slotIndex) {
|
|
currentStashItemId = stashItemId;
|
|
document.getElementById('stashModalQuantity').value = quantity;
|
|
document.getElementById('stashModalSlotIndex').value = slotIndex;
|
|
document.getElementById('stashModal').classList.remove('hidden');
|
|
document.getElementById('stashModal').classList.add('flex');
|
|
}
|
|
|
|
function closeStashModal() {
|
|
document.getElementById('stashModal').classList.add('hidden');
|
|
document.getElementById('stashModal').classList.remove('flex');
|
|
currentStashItemId = null;
|
|
}
|
|
|
|
function saveStashItem() {
|
|
if (!currentStashItemId) return;
|
|
document.getElementById('updateStashItemId').value = currentStashItemId;
|
|
document.getElementById('updateStashQuantity').value = document.getElementById('stashModalQuantity').value;
|
|
document.getElementById('updateStashSlotIndex').value = document.getElementById('stashModalSlotIndex').value;
|
|
document.getElementById('updateStashItemForm').submit();
|
|
}
|
|
|
|
function deleteStashItem() {
|
|
if (!currentStashItemId) return;
|
|
if (!confirm('Delete this stash item permanently?')) return;
|
|
document.getElementById('deleteStashItemId').value = currentStashItemId;
|
|
document.getElementById('deleteStashItemForm').submit();
|
|
}
|
|
|
|
document.addEventListener('keydown', e => {
|
|
if (e.key === 'Escape') {
|
|
closeItemModal();
|
|
closeStashModal();
|
|
}
|
|
});
|
|
</script>
|
|
}
|