@extends('layouts.app') @push('styles') @endpush @section('title', 'Lobby - GIGAX ARENA') @section('page_title', 'Lobby') @php $waitingMatches = collect($activeLobbies ?? []); $runningMatches = collect($liveMatches ?? []); $lobbyMatches = $runningMatches ->concat($waitingMatches) ->unique(fn ($match) => ($match->status ?? '') . ':' . ($match->id ?? '')) ->values(); $totalMatches = $lobbyMatches->count(); $liveTotal = $runningMatches->count(); $waitingTotal = $waitingMatches->count(); // GIGAX: somente para exibir os comandos administrativos nos cards. $gxLobbyUserId = (int) (session('user_id') ?? auth()->id() ?? 0); $gxLobbyUserRole = $gxLobbyUserId ? (string) (\Illuminate\Support\Facades\DB::table('users')->where('id', $gxLobbyUserId)->value('role') ?? '') : ''; $gxLobbyIsAdmin = $gxLobbyUserRole === 'admin'; $avatarUrl = static function ($player) { $url = trim((string) ($player->avatar_url ?? '')); return $url !== '' ? $url : asset('default-avatar.png'); }; // Ranking lateral: usa a mesma base real de XP do projeto. $gxLobbyRanking = collect(); try { if (\Illuminate\Support\Facades\Schema::hasTable('gx_player_experience') && \Illuminate\Support\Facades\Schema::hasTable('users')) { $gxLobbyRanking = \Illuminate\Support\Facades\DB::table('gx_player_experience as x') ->join('users as u', 'u.id', '=', 'x.user_id') ->where('x.monthly_xp', '>', 0) ->orderByDesc('x.monthly_xp') ->orderBy('u.nickname') ->limit(10) ->get([ 'u.id as user_id', 'u.nickname', 'u.avatar_url', 'x.level', 'x.monthly_xp as xp', ]); } } catch (\Throwable $e) { $gxLobbyRanking = collect(); } $gxPlacementMatches = 0; $gxCurrentSkill = 1; try { if ($gxLobbyUserId > 0) { $gxCurrentSkill = (int) (\Illuminate\Support\Facades\DB::table('users')->where('id',$gxLobbyUserId)->value('skill_level') ?? 1); if (\Illuminate\Support\Facades\Schema::hasTable('mix_ranking_modes')) { $gxPlacementMatches = min(10, (int) (\Illuminate\Support\Facades\DB::table('mix_ranking_modes')->where('user_id',$gxLobbyUserId)->where('game_slug','crossfire')->where('queue_mode','casual')->value('matches_played') ?? 0)); } } } catch (\Throwable $e) {} @endphp @push('styles') @endpush @section('content')
⚔

Partidas no Lobby

{{ $totalMatches }} partida{{ $totalMatches === 1 ? '' : 's' }} • {{ $waitingTotal }} disponível{{ $waitingTotal === 1 ? '' : 'is' }} • {{ $liveTotal }} ao vivo

@if($gxPlacementMatches < 10)NIVELAMENTO {{ $gxPlacementMatches }}/10
Complete 10 partidas@else⚡ PLAY
Skill {{ $gxCurrentSkill }}@endif
{{-- GIGAX_CUSTOM_MODES_V3 --}} @include('components.gigax-custom-modes')
@forelse($lobbyMatches as $index => $match) @php $isLive = (string) ($match->status ?? '') === 'in_progress'; $currentPlayers = (int) ($match->current_players ?? 0); $maxPlayers = max(1, (int) ($match->max_players ?? 10)); $gxTeamCapacity = max(1, min(8, (int) ceil(max(2, $maxPlayers) / 2))); // V40: 5v5=5 por time, 8v8=8 por time $gameSlug = strtoupper((string) ($match->game_slug ?? 'crossfire')); $statusLabel = match((string) ($match->status ?? 'waiting')) { 'in_progress' => 'Ao vivo', 'ready_check' => 'Confirmação', 'veto' => 'Veto', default => 'Aguardando', }; $teamA = collect($match->left_players ?? [])->take(8); $teamB = collect($match->right_players ?? [])->take(8); $teamAName = (string) ($match->left_team ?? 'Time A'); $teamBName = (string) ($match->right_team ?? 'Time B'); $modeLabel = strtoupper(str_replace(['_', 'x'], [' ', ' x '], (string) ($match->training_type ?: 'MIX 5V5'))); $gxIsC1s = strtolower(trim((string) ($match->training_type ?? ''))) === 'c1s'; $gxIsHost = (int) ($match->host_id ?? 0) === $gxLobbyUserId; $gxCanStartC1s = $gxIsC1s && !$isLive && (string) ($match->status ?? 'waiting') === 'waiting' && $gxIsHost && $currentPlayers >= 2; @endphp
= 12 ? 'hidden' : '' }}>
{{ mb_strtoupper((string)($match->title ?? $match->name ?? 'SALA')) }} #{{ $match->id }} 5v5
⋮
Partida #{{ (int) $match->id }} DETALHES @if($isLive) ASSISTIR @elseif($gxCanStartC1s) @elseif(!$gxIsHost && (string) ($match->status ?? 'waiting') === 'waiting')
@csrf
@elseif($gxIsHost && $gxIsC1s && $currentPlayers < 2) @endif @if($gxLobbyIsAdmin) MANUTENÇÃO @endif
Mapa{{ $match->map_name ?: 'A definir' }}
Modo{{ $modeLabel }}
Jogadores{{ $currentPlayers }}/{{ $maxPlayers }}
{{ $teamAName }}{{ (int) ($match->team_a_count ?? $teamA->count()) }}/{{ $gxTeamCapacity }}
@foreach($teamA as $player) @php $name = $player->nickname ?? 'Jogador'; @endphp {{ $name }} @endforeach @for($i = $teamA->count(); $i < $gxTeamCapacity; $i++) + @endfor
VS
{{ $teamBName }}{{ (int) ($match->team_b_count ?? $teamB->count()) }}/{{ $gxTeamCapacity }}
@foreach($teamB as $player) @php $name = $player->nickname ?? 'Jogador'; @endphp {{ $name }} @endforeach @for($i = $teamB->count(); $i < $gxTeamCapacity; $i++) + @endfor
@empty
Nenhuma partida disponível. Use JOGAR AGORA para entrar na Fila MIX.
@endforelse
@if($totalMatches > 12)
@endif
{{-- GIGAX_LOBBY_JOIN_PASSWORD_V8_BEGIN --}} {{-- GIGAX_LOBBY_JOIN_PASSWORD_V8_END --}} {{-- GIGAX_LOBBY_READY_MODAL_BEGIN --}} {{-- GIGAX_LOBBY_READY_MODAL_END --}} {{-- GIGAX_LOBBY_ALIGNED_MENU_V34_BEGIN --}} {{-- GIGAX_LOBBY_ALIGNED_MENU_V34_END --}} @endsection @push('scripts') @endpush {{-- GIGAX_LOBBY_MODAL_RUNTIME_V3_BEGIN --}} {{-- GIGAX_LOBBY_MODAL_RUNTIME_V3_END --}} {{-- GIGAX_OPEN_MATCH_MODAL_CARD_V1_SCRIPT --}} {{-- GIGAX_LOBBY_VIBRANT_TOOLBAR_V31_BEGIN --}} {{-- GIGAX_LOBBY_VIBRANT_TOOLBAR_V31_END --}} {{-- GIGAX_LOBBY_WIDE_SAFE_V32_BEGIN --}} {{-- GIGAX_LOBBY_WIDE_SAFE_V32_END --}} {{-- GIGAX_LOBBY_FIT5_V33_BEGIN --}} {{-- GIGAX_LOBBY_FIT5_V33_END --}} {{-- GIGAX_LOBBY_HEADER_CENTER_PLAYERS_V35_BEGIN --}} {{-- GIGAX_LOBBY_HEADER_CENTER_PLAYERS_V35_END --}} {{-- GIGAX_LOBBY_8_SLOTS_EXACT_V37_BEGIN --}} {{-- GIGAX_LOBBY_8_SLOTS_EXACT_V37_END --}} {{-- GIGAX_LOBBY_MENU_HEADER_V38_BEGIN --}} {{-- GIGAX_LOBBY_MENU_HEADER_V38_END --}} {{-- GIGAX_LOBBY_FOOTER_SINGLE_LINE_V39_BEGIN --}} {{-- GIGAX_LOBBY_FOOTER_SINGLE_LINE_V39_END --}} {{-- GIGAX_LOBBY_ALIGNMENT_DYNAMIC_V40_BEGIN --}} {{-- GIGAX_LOBBY_ALIGNMENT_DYNAMIC_V40_END --}}