@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(); } // GIGAX_RANKING_MODALIDADES_V17: ranking fechado, isolado do PUG/Skill. $gxModeRankings = collect(); $gxModeKeys = ['custom_x1','custom_x2','custom_x3','custom_x4','custom_x5','custom_x6','custom_x7','custom_x8','team_5l','c1s','awp']; try { if (\Illuminate\Support\Facades\Schema::hasTable('gigax_player_mode_stats') && \Illuminate\Support\Facades\Schema::hasTable('users')) { $gxModeRankings = \Illuminate\Support\Facades\DB::table('gigax_player_mode_stats as s') ->join('users as u','u.id','=','s.user_id') ->whereIn('s.mode_code',$gxModeKeys) ->select('s.user_id','s.mode_code as mode_key','s.matches_played','s.wins','s.losses','s.kills','s.deaths','s.headshots','s.points','s.rating','s.current_streak','u.nickname','u.avatar_url') ->orderByDesc('s.points')->orderByDesc('s.wins')->get()->groupBy('mode_key'); } } catch (\Throwable $e) { $gxModeRankings = 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')
{{-- GIGAX_V53_LIVE_QUEUES_BEGIN --}}
♙MIX OPEN
0/10
♙MIX ADVANCED
0/10
♙MIX PRO
0/10
{{-- GIGAX_V53_LIVE_QUEUES_END --}}
⚔

PARTIDAS

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

{{-- 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 }} {{ $gxTeamCapacity }}v{{ $gxTeamCapacity }}
⋮
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($gxIsHost && (string) ($match->status ?? 'waiting') === 'waiting') SUA SALA @endif @if($gxLobbyIsAdmin) MANUTENÇÃO @if($isLive) @endif @if((string) ($match->status ?? 'waiting') === 'waiting' && empty($match->started_at)) @endif @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 }} {{ $name }}
@endforeach @for($i = $teamA->count(); $i < $gxTeamCapacity; $i++)
+Vaga
@endfor
VS
{{ $teamBName }}{{ (int) ($match->team_b_count ?? $teamB->count()) }}/{{ $gxTeamCapacity }}
@foreach($teamB as $player) @php $name = $player->nickname ?? 'Jogador'; @endphp
{{ $name }} {{ $name }}
@endforeach @for($i = $teamB->count(); $i < $gxTeamCapacity; $i++)
+Vaga
@endfor
@empty
Nenhuma partida disponível. Use JOGAR AGORA para entrar na Fila MIX.
@endforelse
@if($totalMatches > 12)
@endif
{{-- GIGAX_RANKING_MODALIDADES_V17 --}}
{{-- 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 --}} {{-- GIGAX_LOBBY_CLEAN_V45_BEGIN --}} {{-- GIGAX_LOBBY_CLEAN_V45_END --}} {{-- GIGAX_LOBBY_GRID_V52_BEGIN --}} {{-- GIGAX_LOBBY_GRID_V52_END --}} {{-- GIGAX_DIRECT_DELETE_V16_SCRIPT --}} @endsection @push('scripts') @endpush {{-- GIGAX_LOBBY_MODAL_RUNTIME_V3_BEGIN --}} {{-- GIGAX_LOBBY_MODAL_RUNTIME_V3_END --}} {{-- GIGAX_OPEN_MATCH_MODAL_CARD_V1_SCRIPT --}} {{-- GIGAX_RANKING_PUG_GREEN_VISIBLE_V2 --}} {{-- GIGAX_LOBBY_TOOLBAR_V34_BEGIN --}} {{-- GIGAX_LOBBY_TOOLBAR_V34_END --}} {{-- GIGAX_REPORTAR_UI_V21 --}}