| 1: | <?php declare(strict_types=1); |
| 2: | |
| 3: | |
| 4: | |
| 5: | |
| 6: | |
| 7: | |
| 8: | |
| 9: | |
| 10: | |
| 11: | |
| 12: | |
| 13: | namespace Clansuite\ServerQuery\ServerProtocols; |
| 14: | |
| 15: | use function is_int; |
| 16: | use function is_string; |
| 17: | use Override; |
| 18: | |
| 19: | |
| 20: | |
| 21: | |
| 22: | |
| 23: | class Cs2 extends Steam |
| 24: | { |
| 25: | |
| 26: | |
| 27: | |
| 28: | public string $name = 'Counter-Strike 2'; |
| 29: | |
| 30: | |
| 31: | |
| 32: | |
| 33: | |
| 34: | |
| 35: | public array $supportedGames = ['Counter-Strike 2']; |
| 36: | |
| 37: | |
| 38: | |
| 39: | |
| 40: | public string $protocol = 'A2S'; |
| 41: | |
| 42: | |
| 43: | |
| 44: | |
| 45: | |
| 46: | |
| 47: | public array $game_series_list = ['Counter-Strike']; |
| 48: | |
| 49: | |
| 50: | |
| 51: | |
| 52: | |
| 53: | protected int $port_diff = 0; |
| 54: | |
| 55: | |
| 56: | |
| 57: | |
| 58: | public function __construct(mixed $address = null, mixed $queryport = null) |
| 59: | { |
| 60: | $address = $address === null ? null : (is_string($address) ? $address : null); |
| 61: | $queryport = $queryport === null ? null : (is_int($queryport) ? $queryport : null); |
| 62: | parent::__construct($address, $queryport); |
| 63: | |
| 64: | |
| 65: | if ($queryport !== null) { |
| 66: | $this->queryport = $queryport + $this->port_diff; |
| 67: | } |
| 68: | } |
| 69: | |
| 70: | |
| 71: | |
| 72: | |
| 73: | #[Override] |
| 74: | public function getNativeJoinURI(): string |
| 75: | { |
| 76: | return 'steam://connect/' . $this->address . ':' . $this->hostport; |
| 77: | } |
| 78: | |
| 79: | |
| 80: | |
| 81: | |
| 82: | #[Override] |
| 83: | public function query_server(bool $getPlayers = true, bool $getRules = true): bool |
| 84: | { |
| 85: | |
| 86: | return parent::query_server($getPlayers, false); |
| 87: | } |
| 88: | } |
| 89: | |