mirror of
https://github.com/Deathgarden-Rebirth/Deathgarden_Rebirth-Rewrite.git
synced 2026-09-11 04:35:23 -05:00
Adjusted how the in game palyers get counted, now it only counts usern in a created or closed game (not killed anymore)
This commit is contained in:
@@ -3,9 +3,11 @@
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Enums\Game\Matchmaking\MatchmakingSide;
|
||||
use App\Enums\Game\Matchmaking\MatchStatus;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Responses\Api\Statistics\OnlinePlayersResponse;
|
||||
use App\Models\Admin\LauncherMessage;
|
||||
use App\Models\Game\Matchmaking\Game;
|
||||
use App\Models\Game\Matchmaking\QueuedPlayer;
|
||||
use DB;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
@@ -19,7 +21,12 @@ public function getOnlinePlayers() {
|
||||
return Cache::remember(static::CACHE_KEY, 10, function () {
|
||||
$queuedHunters = QueuedPlayer::whereSide(MatchmakingSide::Hunter)->count();
|
||||
$queuedRunners = QueuedPlayer::whereSide(MatchmakingSide::Runner)->count();
|
||||
$inGamePlayers = DB::table('game_user')->count();
|
||||
$inGamePlayers = DB::table('game_user')
|
||||
->join('games', 'game_user.game_id', '=', 'games.id')
|
||||
->whereIn('games.status', [
|
||||
MatchStatus::Closed,
|
||||
MatchStatus::Created,
|
||||
])->count();
|
||||
|
||||
return Response::json(new OnlinePlayersResponse(
|
||||
$queuedRunners,
|
||||
|
||||
Reference in New Issue
Block a user