@extends('layouts.app')
@push('styles')
@endpush
@section('title','Meu Perfil - GIGAX ARENA')
@section('page_title','Meu Perfil')
@section('content')
@php
$gigaxPublicNumber = (int) (\Illuminate\Support\Facades\DB::table('users')
->where('id', (int) ($userId ?? session('user_id')))
->value('gigax_id') ?? ($userId ?? session('user_id')));
$gigaxPublicCode = 'GX-' . str_pad((string) $gigaxPublicNumber, 6, '0', STR_PAD_LEFT);
// O ProfileController já envia o usuário autenticado pela sessão GIGAX.
// Não sobrescrever com auth()->user(), pois o projeto usa Session::get('user_id').
$user = $user ?? auth()->user();
$nickname = data_get($user, 'nickname')
?: data_get($user, 'name')
?: 'Jogador';
$level = (int) (
data_get($user, 'level')
?: data_get($user, 'skill_level')
?: 1
);
$xp = (int) (
data_get($user, 'xp')
?: data_get($user, 'current_xp')
?: 0
);
$xpNext = max(100, (($level + 1) * 100));
$userEmail = data_get($user, 'email') ?: 'Não informado';
$userId = (int) (data_get($user, 'id') ?: 0);
$createdAt = data_get($user, 'created_at');
$createdAtText = $createdAt
? \Illuminate\Support\Carbon::parse($createdAt)->format('d/m/Y H:i')
: 'Não informado';
// PlayerVerificationController grava o Discord validado em users.discord_username.
$discordName = data_get($user, 'discord_username') ?: 'Não vinculado';
$discordVerified = data_get($user, 'discord_verification_status') === 'verified';
// Mesma origem de avatar usada pelo restante da GIGAX Arena.
$avatarRaw = data_get($user, 'avatar_url') ?: data_get($user, 'avatar') ?: session('user_avatar');
$avatarRaw = is_string($avatarRaw) ? trim($avatarRaw) : null;
$avatarUrl = null;
if ($avatarRaw && !in_array(strtolower($avatarRaw), ['null', 'undefined', '#'], true)) {
$avatarUrl = (str_starts_with($avatarRaw, 'http://') || str_starts_with($avatarRaw, 'https://') || str_starts_with($avatarRaw, 'data:image/'))
? $avatarRaw
: asset(ltrim($avatarRaw, '/'));
}
$avatarInitial = mb_strtoupper(mb_substr(trim((string) $nickname), 0, 1));
$realTotalMatches = (int) ($totalMatches ?? ($ranking->matches_played ?? 0));
$realWins = (int) ($wins ?? ($ranking->wins ?? 0));
$realLosses = (int) ($losses ?? ($ranking->losses ?? 0));
$realKd = $realTotalMatches > 0 ? (float) ($ranking->kd_ratio ?? 0) : 0.0;
$realPosition = $realTotalMatches > 0 ? (int) ($ranking->position ?? 0) : 0;
$hasRealMatches = $realTotalMatches > 0;
$realWinRate = $realTotalMatches > 0 ? round(($realWins / $realTotalMatches) * 100, 1) : 0;
$realLossRate = $realTotalMatches > 0 ? round(($realLosses / $realTotalMatches) * 100, 1) : 0;
@endphp
Geral
Troféus
Conquistas
Histórico
Atividade
Configurações
@if($avatarUrl)
{{ $avatarInitial }}
@else
{{ $avatarInitial }}
@endif
{{ $nickname }}
●
Nível {{ $level }} • GIGAX desde {{ $createdAt ? \Illuminate\Support\Carbon::parse($createdAt)->format('Y') : '—' }}
{{ number_format($xp,0,',','.') }} / {{ number_format($xpNext,0,',','.') }} XP
Nível {{ $level + 1 }}
Status
Online
Última conexão: agora
Posição global
{{ $realPosition > 0 ? '#'.number_format($realPosition,0,',','.') : '—' }}
{{ $hasRealMatches ? 'Classificação pelas partidas oficiais' : 'Sem partidas disputadas' }}
Partidas {{ $realTotalMatches }} {{ $hasRealMatches ? 'Partidas oficiais' : 'Nenhuma realizada' }}
Vitórias {{ $realWins }} {{ number_format($realWinRate,1,',','.') }}% de taxa
Derrotas {{ $realLosses }} {{ number_format($realLossRate,1,',','.') }}% de taxa
K/D {{ number_format($realKd,2,',','.') }} {{ $hasRealMatches ? 'Taxa oficial' : 'Sem estatística' }}
Headshots 0 Sem estatística
Win streak 0 Melhor: 0
Informações pessoais
Nome de usuário {{ $nickname }}
Email {{ $userEmail }}
ID GIGAX #{{ $gigaxPublicCode }}
País / Região 🇧🇷 Brasil
Data de cadastro {{ $createdAtText }}
Verificação ● Verificado
Discord {{ $discordName }}
Editar perfil
Armas mais utilizadas
Nenhuma estatística de arma
Os dados aparecerão após a primeira partida oficial com estatísticas registradas.
Modo favorito
{{ $hasRealMatches ? 'Em cálculo' : 'Nenhum modo definido' }}
{{ $hasRealMatches ? 'O modo favorito será calculado com base no histórico oficial.' : 'Jogue partidas oficiais para gerar essa estatística.' }}
Data
Modo
Mapa
Resultado
K/D/A
Pontos
Detalhes
@forelse(collect($recentMatches ?? []) as $match)
@php
$kills = (int) ($match->kills ?? 0);
$deaths = (int) ($match->deaths ?? 0);
$assists = (int) ($match->assists ?? 0);
$result = strtolower((string) ($match->result ?? ''));
$dateRaw = $match->completed_at ?? null;
@endphp
{{ $dateRaw ? \Illuminate\Support\Carbon::parse($dateRaw)->format('d/m/Y H:i') : '—' }}
{{ $match->mode_label ?? 'Competitivo' }}
{{ $match->map_played ?? '—' }}
{{ $result === 'win' ? 'Vitória' : ($result === 'loss' ? 'Derrota' : '—') }}
{{ $kills }} / {{ $deaths }} / {{ $assists }}
@if(isset($match->points_delta) && $match->points_delta !== null)
{{ (int)$match->points_delta >= 0 ? '+' : '' }}{{ (int)$match->points_delta }}
@else
—
@endif
{{ $match->details ?? ('#'.($match->match_id ?? '—')) }}
@empty
Nenhuma partida oficial registrada.
@endforelse
{{-- GIGAX_PROFILE_SETUP_FALLBACK_V2 --}}
@php
$gxSettings = is_array($settings ?? null)
? $settings
: (is_string($settings ?? null) ? (json_decode($settings, true) ?: []) : []);
if (empty($gxSettings) && !empty($user->settings ?? null)) {
$gxSettings = json_decode((string) $user->settings, true) ?: [];
}
$gxDevice = data_get($acData ?? [], 'activeDevice');
$gxDeviceArray = $gxDevice ? (array) $gxDevice : [];
foreach (['hardware_json','hardware','peripherals_json','peripherals','device_info','system_info'] as $gxJsonField) {
$gxRaw = $gxDeviceArray[$gxJsonField] ?? null;
if (is_string($gxRaw) && trim($gxRaw) !== '') {
$gxDecoded = json_decode($gxRaw, true);
if (is_array($gxDecoded)) {
$gxDeviceArray = array_replace_recursive($gxDeviceArray, $gxDecoded);
}
} elseif (is_array($gxRaw)) {
$gxDeviceArray = array_replace_recursive($gxDeviceArray, $gxRaw);
}
}
$gxPickCaptured = function(array $keys) use ($gxDeviceArray) {
foreach ($keys as $key) {
$value = data_get($gxDeviceArray, $key);
if ($value !== null && trim((string) $value) !== '') {
return trim((string) $value);
}
}
return '';
};
$gxCaptured = [
'mouse' => $gxPickCaptured(['mouse','mouse_model','mouse_name','peripherals.mouse','hardware.mouse']),
'dpi' => $gxPickCaptured(['dpi','mouse_dpi','peripherals.dpi','peripherals.mouse_dpi','hardware.dpi']),
'polling_rate' => $gxPickCaptured(['polling_rate','mouse_polling_rate','polling_hz','peripherals.polling_rate','peripherals.mouse_polling_rate']),
'resolution' => $gxPickCaptured(['resolution','screen_resolution','display_resolution','monitor_resolution','hardware.resolution']),
'monitor' => $gxPickCaptured(['monitor','monitor_name','monitor_model','display_name','hardware.monitor']),
'keyboard' => $gxPickCaptured(['keyboard','keyboard_name','keyboard_model','peripherals.keyboard','hardware.keyboard']),
'headset' => $gxPickCaptured(['headset','headset_name','headset_model','audio_device','peripherals.headset','hardware.headset']),
];
$gxManual = [
'mouse' => (string) ($gxSettings['mouse'] ?? $gxSettings['mouse_model'] ?? ''),
'dpi' => (string) ($gxSettings['dpi'] ?? ''),
'sensitivity' => (string) ($gxSettings['sensitivity'] ?? $gxSettings['game_sensitivity'] ?? ''),
'polling_rate' => (string) ($gxSettings['polling_rate'] ?? ''),
'mousepad' => (string) ($gxSettings['mousepad'] ?? ''),
'resolution' => (string) ($gxSettings['resolution'] ?? ''),
'monitor' => (string) ($gxSettings['monitor'] ?? ''),
'keyboard' => (string) ($gxSettings['keyboard'] ?? ''),
'headset' => (string) ($gxSettings['headset'] ?? ''),
'crosshair' => (string) ($gxSettings['crosshair'] ?? ''),
];
@endphp
SETUP PÚBLICO
Editar perfil e equipamentos
Dados capturados pelo AC têm prioridade. Complete manualmente somente o que não chegou no heartbeat.
×
{{-- /GIGAX_PROFILE_SETUP_FALLBACK_V2 --}}
@endsection