| 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 Override; |
| 16: | |
| 17: | |
| 18: | |
| 19: | |
| 20: | |
| 21: | class ArkSurvivalEvolved extends Steam |
| 22: | { |
| 23: | |
| 24: | |
| 25: | |
| 26: | public string $name = 'Ark: Survival Evolved'; |
| 27: | |
| 28: | |
| 29: | |
| 30: | |
| 31: | |
| 32: | |
| 33: | public array $supportedGames = ['Ark: Survival Evolved']; |
| 34: | |
| 35: | |
| 36: | |
| 37: | |
| 38: | public string $protocol = 'A2S'; |
| 39: | |
| 40: | |
| 41: | |
| 42: | |
| 43: | |
| 44: | |
| 45: | public array $game_series_list = ['Ark: Survival Evolved']; |
| 46: | protected int $port_diff = 19238; |
| 47: | |
| 48: | |
| 49: | |
| 50: | |
| 51: | |
| 52: | |
| 53: | |
| 54: | |
| 55: | public function __construct(string $address, int $port, protected bool $autoCalculateQueryPort = true) |
| 56: | { |
| 57: | parent::__construct($address, $port); |
| 58: | } |
| 59: | |
| 60: | |
| 61: | |
| 62: | |
| 63: | #[Override] |
| 64: | public function getNativeJoinURI(): string |
| 65: | { |
| 66: | return 'steam://connect/' . $this->address . ':' . $this->hostport; |
| 67: | } |
| 68: | |
| 69: | |
| 70: | |
| 71: | |
| 72: | #[Override] |
| 73: | public function query_server(bool $getPlayers = true, bool $getRules = true): bool |
| 74: | { |
| 75: | if ($this->autoCalculateQueryPort) { |
| 76: | |
| 77: | |
| 78: | $originalQueryPort = $this->queryport; |
| 79: | $this->queryport = ($this->queryport ?? 0) + $this->port_diff; |
| 80: | |
| 81: | $result = parent::query_server($getPlayers, $getRules); |
| 82: | |
| 83: | |
| 84: | $this->queryport = $originalQueryPort; |
| 85: | |
| 86: | return $result; |
| 87: | } |
| 88: | |
| 89: | |
| 90: | return parent::query_server($getPlayers, $getRules); |
| 91: | } |
| 92: | } |
| 93: | |