| 1: | <?php declare(strict_types=1); |
| 2: | |
| 3: | /** |
| 4: | * Clansuite Server Query |
| 5: | * |
| 6: | * SPDX-FileCopyrightText: 2003-2025 Jens A. Koch |
| 7: | * SPDX-License-Identifier: MIT |
| 8: | * |
| 9: | * For the full copyright and license information, please view |
| 10: | * the LICENSE file that was distributed with this source code. |
| 11: | */ |
| 12: | |
| 13: | namespace Clansuite\ServerQuery\ServerProtocols; |
| 14: | |
| 15: | use Override; |
| 16: | |
| 17: | /** |
| 18: | * Counter-Strike: Source protocol implementation. |
| 19: | * |
| 20: | * The Source engine uses the same A2S (Source) query protocol implemented |
| 21: | * in the `Steam` base class. This class exists to provide a distinct |
| 22: | * protocol entry for Counter-Strike: Source and to allow game-specific |
| 23: | * customizations in the future. |
| 24: | */ |
| 25: | class CounterStrikeSource extends Steam |
| 26: | { |
| 27: | /** |
| 28: | * Protocol name. |
| 29: | */ |
| 30: | public string $name = 'Counter-Strike: Source'; |
| 31: | |
| 32: | /** |
| 33: | * List of supported games. |
| 34: | * |
| 35: | * @var array<string> |
| 36: | */ |
| 37: | public array $supportedGames = ['Counter-Strike: Source']; |
| 38: | |
| 39: | /** |
| 40: | * Protocol identifier. |
| 41: | */ |
| 42: | public string $protocol = 'A2S'; |
| 43: | |
| 44: | /** |
| 45: | * Game series. |
| 46: | * |
| 47: | * @var array<string> |
| 48: | */ |
| 49: | public array $game_series_list = ['Counter-Strike']; |
| 50: | |
| 51: | /** |
| 52: | * CS:S specific port adjustment if needed (default 0). |
| 53: | */ |
| 54: | protected int $port_diff = 0; |
| 55: | |
| 56: | /** |
| 57: | * Returns a native join URI for Source games. |
| 58: | */ |
| 59: | #[Override] |
| 60: | public function getNativeJoinURI(): string |
| 61: | { |
| 62: | return 'steam://connect/' . $this->address . ':' . $this->hostport; |
| 63: | } |
| 64: | |
| 65: | /** |
| 66: | * Query server - delegate to Steam implementation (Source protocol). |
| 67: | */ |
| 68: | #[Override] |
| 69: | public function query_server(bool $getPlayers = true, bool $getRules = true): bool |
| 70: | { |
| 71: | return parent::query_server($getPlayers, $getRules); |
| 72: | } |
| 73: | } |
| 74: |