Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| Kf2 | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
| query_server | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
| 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 | * Killing Floor 2 protocol implementation. |
| 19 | * |
| 20 | * Extends Steam protocol with Killing Floor 2 specific port calculation. |
| 21 | * Query port = host port + 19238 |
| 22 | */ |
| 23 | class Kf2 extends Steam |
| 24 | { |
| 25 | /** |
| 26 | * Protocol name. |
| 27 | */ |
| 28 | public string $name = 'Killing Floor 2'; |
| 29 | |
| 30 | /** |
| 31 | * List of supported games. |
| 32 | * |
| 33 | * @var array<string> |
| 34 | */ |
| 35 | public array $supportedGames = ['Killing Floor 2']; |
| 36 | |
| 37 | /** |
| 38 | * Protocol identifier. |
| 39 | */ |
| 40 | public string $protocol = 'A2S'; |
| 41 | |
| 42 | /** |
| 43 | * Query server information. |
| 44 | * |
| 45 | * @return bool True on success, false on failure |
| 46 | */ |
| 47 | #[Override] |
| 48 | public function query_server(bool $getPlayers = true, bool $getRules = true): bool |
| 49 | { |
| 50 | $result = parent::query_server($getPlayers, $getRules); |
| 51 | |
| 52 | if ($result) { |
| 53 | // For Killing Floor 2: query_port = host_port + 19238 |
| 54 | // So host_port = query_port - 19238 |
| 55 | $this->hostport = ($this->queryport ?? 0) - 19238; |
| 56 | } |
| 57 | |
| 58 | return $result; |
| 59 | } |
| 60 | } |