Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| GtaMta | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 1 |
| query_server | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
12 | |||
| 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 | * GTA: Multi Theft Auto protocol implementation. |
| 19 | * |
| 20 | * Extends ASE protocol. |
| 21 | */ |
| 22 | class GtaMta extends Ase |
| 23 | { |
| 24 | /** |
| 25 | * Protocol name. |
| 26 | */ |
| 27 | public string $name = 'GTA: Multi Theft Auto'; |
| 28 | |
| 29 | /** |
| 30 | * List of supported games. |
| 31 | * |
| 32 | * @var array<string> |
| 33 | */ |
| 34 | public array $supportedGames = ['GTA: Multi Theft Auto']; |
| 35 | |
| 36 | /** |
| 37 | * Protocol identifier. |
| 38 | */ |
| 39 | public string $protocol = 'gta-san-andreas-mta'; |
| 40 | |
| 41 | /** |
| 42 | * Game series. |
| 43 | * |
| 44 | * @var array<string> |
| 45 | */ |
| 46 | public array $game_series_list = ['GTA: San Andreas - MTA']; |
| 47 | |
| 48 | /** |
| 49 | * Attempt query on given port and fallback to port+123 (ASE query port) when no reply. |
| 50 | */ |
| 51 | #[Override] |
| 52 | public function query_server(bool $getPlayers = true, bool $getRules = true): bool |
| 53 | { |
| 54 | // Try as provided first |
| 55 | if (parent::query_server($getPlayers, $getRules)) { |
| 56 | return true; |
| 57 | } |
| 58 | |
| 59 | // If no reply, try client port + 123 (ASE query offset) |
| 60 | $tryPort = ($this->queryport ?? 0) + 123; |
| 61 | |
| 62 | // avoid overflow |
| 63 | if ($tryPort <= 65535) { |
| 64 | $this->queryport = $tryPort; |
| 65 | |
| 66 | return parent::query_server($getPlayers, $getRules); |
| 67 | } |
| 68 | |
| 69 | return false; |
| 70 | } |
| 71 | } |