134 lines
8.9 KiB
PHP
134 lines
8.9 KiB
PHP
@extends('layouts.game')
|
|||
|
|
|
||
|
|
@section('title', 'Inventory')
|
||
|
|
|
||
|
|
@section('game-content')
|
||
|
|
<div class="max-w-4xl mx-auto">
|
||
|
|
<div class="bg-white dark:bg-gray-800 overflow-hidden shadow-sm sm:rounded-lg">
|
||
|
|
<div class="p-6 border-b border-gray-200 dark:border-gray-700">
|
||
|
|
<h1 class="text-xl font-semibold text-gray-800 dark:text-gray-200">Inventory</h1>
|
||
|
|
<p class="mt-2 text-sm text-gray-600 dark:text-gray-400">
|
||
|
|
Manage your items. Equip weapons and armor, or use consumables.
|
||
|
|
</p>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="p-6">
|
||
|
|
@if($inventory->isEmpty())
|
||
|
|
<p class="text-center text-gray-500 dark:text-gray-400 py-8">
|
||
|
|
Your inventory is empty.
|
||
|
|
</p>
|
||
|
|
@else
|
||
|
|
<div class="space-y-4">
|
||
|
|
@foreach($inventory->groupBy('item.type') as $type => $items)
|
||
|
|
<div>
|
||
|
|
<h3 class="text-lg font-medium text-gray-800 dark:text-gray-200 capitalizes mb-3">
|
||
|
|
{{ ucfirst($type) }}s ({{ $items->sum('quantity') }})
|
||
|
|
</h3>
|
||
|
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||
|
|
@foreach($items as $item)
|
||
|
|
<div class="bg-gray-50 dark:bg-gray-700 rounded-lg p-4 border border-gray-200 dark:border-gray-600">
|
||
|
|
<div class="flex justify-between items-start mb-2">
|
||
|
|
<div>
|
||
|
|
<h4 class="font-medium text-gray-800 dark:text-gray-200">{{ $item->item->name }}</h4>
|
||
|
|
<p class="text-xs text-gray-500 dark:text-gray-400">
|
||
|
|
x{{ $item->quantity }}
|
||
|
|
</p>
|
||
|
|
</div>
|
||
|
|
@if($item->equipped)
|
||
|
|
<span class="text-xs px-2 py-1 bg-green-500 text-white rounded-full">Equipped</span>
|
||
|
|
@endif
|
||
|
|
</div>
|
||
|
|
|
||
|
|
@if($item->item->description)
|
||
|
|
<p class="text-sm text-gray-600 dark:text-gray-400 mb-3">
|
||
|
|
{{ Str::limit($item->item->description, 80) }}
|
||
|
|
</p>
|
||
|
|
@endif
|
||
|
|
|
||
|
|
<div class="grid grid-cols-2 gap-2 text-xs mb-3">
|
||
|
|
@if($item->item->attack_bonus > 0)
|
||
|
|
<div class="flex items-center">
|
||
|
|
<span class="text-red-500 mr-1">⚔️</span>
|
||
|
|
<span>+{{ $item->item->attack_bonus }} Attack</span>
|
||
|
|
</div>
|
||
|
|
@endif
|
||
|
|
@if($item->item->defense_bonus > 0)
|
||
|
|
<div class="flex items-center">
|
||
|
|
<span class="text-blue-500 mr-1">🛡️</span>
|
||
|
|
<span>+{{ $item->item->defense_bonus }} Defense</span>
|
||
|
|
</div>
|
||
|
|
@endif
|
||
|
|
@if($item->item->health_bonus > 0)
|
||
|
|
<div class="flex items-center">
|
||
|
|
<span class="text-green-500 mr-1">❤️</span>
|
||
|
|
<span>+{{ $item->item->health_bonus }} Health</span>
|
||
|
|
</div>
|
||
|
|
@endif
|
||
|
|
@if($item->item->energy_bonus > 0)
|
||
|
|
<div class="flex items-center">
|
||
|
|
<span class="text-yellow-500 mr-1">⚡</span>
|
||
|
|
<span>+{{ $item->item->energy_bonus }} Energy</span>
|
||
|
|
</div>
|
||
|
|
@endif
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="flex space-x-2">
|
||
|
|
@if($item->item->canEquip())
|
||
|
|
@if($item->equipped)
|
||
|
|
<form action="{{ route('game.inventory.unequip', $item) }}" method="POST">
|
||
|
|
@csrf
|
||
|
|
<button
|
||
|
|
type="submit"
|
||
|
|
class="px-3 py-1 text-xs bg-gray-400 hover:bg-gray-500 text-white rounded transition"
|
||
|
|
>
|
||
|
|
Unequip
|
||
|
|
</button>
|
||
|
|
</form>
|
||
|
|
@else
|
||
|
|
<form action="{{ route('game.inventory.equip', $item) }}" method="POST">
|
||
|
|
@csrf
|
||
|
|
<button
|
||
|
|
type="submit"
|
||
|
|
class="px-3 py-1 text-xs bg-blue-500 hover:bg-blue-600 text-white rounded transition"
|
||
|
|
>
|
||
|
|
Equip
|
||
|
|
</button>
|
||
|
|
</form>
|
||
|
|
@endif
|
||
|
|
@endif
|
||
|
|
|
||
|
|
@if($item->item->canUse())
|
||
|
|
<form action="{{ route('game.inventory.use', $item) }}" method="POST">
|
||
|
|
@csrf
|
||
|
|
<button
|
||
|
|
type="submit"
|
||
|
|
class="px-3 py-1 text-xs bg-green-500 hover:bg-green-600 text-white rounded transition"
|
||
|
|
>
|
||
|
|
Use
|
||
|
|
</button>
|
||
|
|
</form>
|
||
|
|
@endif
|
||
|
|
|
||
|
|
<form action="{{ route('game.inventory.drop', $item) }}" method="POST">
|
||
|
|
@csrf
|
||
|
|
<input type="number" name="quantity" value="1" min="1" max="{{ $item->quantity }}" class="hidden">
|
||
|
|
<button
|
||
|
|
type="submit"
|
||
|
|
class="px-3 py-1 text-xs bg-red-500 hover:bg-red-600 text-white rounded transition"
|
||
|
|
>
|
||
|
|
Drop
|
||
|
|
</button>
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
@endforeach
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
@endforeach
|
||
|
|
</div>
|
||
|
|
@endif
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
@endsection
|