check() && auth()->user()->character) { return redirect()->route('game.dashboard'); } return view('welcome'); })->name('home'); // Game routes - require authentication and character Route::middleware(['auth', 'verify.character'])->group(function () { // Dashboard Route::get('/game', [DashboardController::class, 'index'])->name('game.dashboard'); // Character routes Route::prefix('game/character')->name('game.character.')->group(function () { Route::get('/create', [CharacterController::class, 'create'])->name('create')->withoutMiddleware(['verify.character']); Route::post('/', [CharacterController::class, 'store'])->name('store')->withoutMiddleware(['verify.character']); Route::get('/', [CharacterController::class, 'show'])->name('show'); Route::get('/edit', [CharacterController::class, 'edit'])->name('edit'); Route::put('/', [CharacterController::class, 'update'])->name('update'); Route::post('/deposit', [CharacterController::class, 'deposit'])->name('deposit'); Route::post('/withdraw', [CharacterController::class, 'withdraw'])->name('withdraw'); Route::post('/revive', [CharacterController::class, 'revive'])->name('revive'); }); // Crime routes Route::prefix('game/crimes')->name('game.crimes.')->group(function () { Route::get('/', [CrimeController::class, 'index'])->name('index'); Route::get('/{crime}', [CrimeController::class, 'show'])->name('show'); Route::post('/{crime}/attempt', [CrimeController::class, 'attempt'])->name('attempt')->middleware(['check.energy:crime']); }); // Inventory routes Route::prefix('game/inventory')->name('game.inventory.')->group(function () { Route::get('/', [InventoryController::class, 'index'])->name('index'); Route::post('/{inventory}/equip', [InventoryController::class, 'equip'])->name('equip'); Route::post('/{inventory}/unequip', [InventoryController::class, 'unequip'])->name('unequip'); Route::post('/{inventory}/use', [InventoryController::class, 'use'])->name('use'); Route::post('/{inventory}/drop', [InventoryController::class, 'drop'])->name('drop'); }); // Gym routes Route::prefix('game/gym')->name('game.gym.')->group(function () { Route::get('/', [GymController::class, 'index'])->name('index'); Route::post('/train', [GymController::class, 'train'])->name('train')->middleware(['check.energy:gym']); }); }); // Hospital route (for when character is in hospital) Route::middleware(['auth'])->group(function () { Route::get('/game/hospital', function () { $character = auth()->user()->character; if (!$character || (!$character->isInHospital() && !$character->isDead())) { return redirect()->route('game.dashboard'); } $reviveCost = config('game.health.hospital_cost', 1000); $releaseTime = $character->in_hospital_until ? $character->in_hospital_until->diffForHumans() : 'unknown'; return view('game.hospital', compact('character', 'reviveCost', 'releaseTime')); })->name('game.hospital'); }); // Jail route (for when character is in jail) Route::middleware(['auth'])->group(function () { Route::get('/game/jail', function () { $character = auth()->user()->character; if (!$character || !$character->isInJail()) { return redirect()->route('game.dashboard'); } $releaseTime = $character->in_jail_until ? $character->in_jail_until->diffForHumans() : 'unknown'; $bustOutChance = (int) round((new \App\Services\Game\JailService())->calculateBustOutChance($character) * 100); $bustOutCost = config('game.jail.breakout_cost', 1000); return view('game.jail', compact('character', 'releaseTime', 'bustOutChance', 'bustOutCost')); })->name('game.jail'); Route::post('/game/jail/bust-out', [JailController::class, 'bustOut']) ->name('game.jail.bust-out'); });