diff --git a/lib/SteamCondenser/Servers/Packets/A2SINFOPacket.php b/lib/SteamCondenser/Servers/Packets/A2SINFOPacket.php index f6315c9..6568abb 100644 --- a/lib/SteamCondenser/Servers/Packets/A2SINFOPacket.php +++ b/lib/SteamCondenser/Servers/Packets/A2SINFOPacket.php @@ -3,7 +3,7 @@ * This code is free software; you can redistribute it and/or modify it under * the terms of the new BSD License. * - * Copyright (c) 2008-2014, Sebastian Staudt + * Copyright (c) 2008-2020, Sebastian Staudt * * @license http://www.opensource.org/licenses/bsd-license.php New BSD License */ @@ -21,7 +21,7 @@ * @subpackage packets * @see GameServer::updateServerInfo() */ -class A2SINFOPacket extends SteamPacket { +class A2SINFOPacket extends QueryPacket { /** * Creates a new A2S_INFO request object diff --git a/lib/SteamCondenser/Servers/Packets/A2SPLAYERPacket.php b/lib/SteamCondenser/Servers/Packets/A2SPLAYERPacket.php index 1be71b2..0a59b5e 100644 --- a/lib/SteamCondenser/Servers/Packets/A2SPLAYERPacket.php +++ b/lib/SteamCondenser/Servers/Packets/A2SPLAYERPacket.php @@ -3,7 +3,7 @@ * This code is free software; you can redistribute it and/or modify it under * the terms of the new BSD License. * - * Copyright (c) 2008-2014, Sebastian Staudt + * Copyright (c) 2008-2020, Sebastian Staudt * * @license http://www.opensource.org/licenses/bsd-license.php New BSD License */ @@ -23,7 +23,7 @@ * @subpackage packets * @see GameServer::updatePlayerInfo() */ -class A2SPLAYERPacket extends RequestPacketWithChallenge { +class A2SPLAYERPacket extends QueryPacket { /** * Creates a new A2S_PLAYER request object including the challenge number @@ -32,6 +32,6 @@ class A2SPLAYERPacket extends RequestPacketWithChallenge { * server */ public function __construct($challengeNumber = 0xFFFFFFFF) { - parent::__construct(SteamPacket::A2S_PLAYER_HEADER, $challengeNumber); + parent::__construct(SteamPacket::A2S_PLAYER_HEADER, pack('V', $challengeNumber)); } } diff --git a/lib/SteamCondenser/Servers/Packets/A2SRULESPacket.php b/lib/SteamCondenser/Servers/Packets/A2SRULESPacket.php index f99b5f4..64eeaa7 100644 --- a/lib/SteamCondenser/Servers/Packets/A2SRULESPacket.php +++ b/lib/SteamCondenser/Servers/Packets/A2SRULESPacket.php @@ -3,7 +3,7 @@ * This code is free software; you can redistribute it and/or modify it under * the terms of the new BSD License. * - * Copyright (c) 2008-2014, Sebastian Staudt + * Copyright (c) 2008-2020, Sebastian Staudt * * @license http://www.opensource.org/licenses/bsd-license.php New BSD License */ @@ -24,7 +24,7 @@ * @subpackage packets * @see GameServer::updateRulesInfo() */ -class A2SRULESPacket extends RequestPacketWithChallenge { +class A2SRULESPacket extends QueryPacket { /** * Creates a new A2S_RULES request object including the challenge number * @@ -33,6 +33,6 @@ class A2SRULESPacket extends RequestPacketWithChallenge { */ public function __construct($challengeNumber = 0xFFFFFFFF) { - parent::__construct(SteamPacket::A2S_RULES_HEADER, $challengeNumber); + parent::__construct(SteamPacket::A2S_RULES_HEADER, pack('V', $challengeNumber)); } } diff --git a/lib/SteamCondenser/Servers/Packets/QueryPacket.php b/lib/SteamCondenser/Servers/Packets/QueryPacket.php new file mode 100644 index 0000000..f421dbc --- /dev/null +++ b/lib/SteamCondenser/Servers/Packets/QueryPacket.php @@ -0,0 +1,35 @@ +headerData, $this->contentData->_array()); - } -} diff --git a/tests/SteamCondenser/servers/packets/QueryPacketTest.php b/tests/SteamCondenser/servers/packets/QueryPacketTest.php new file mode 100644 index 0000000..fa294ce --- /dev/null +++ b/tests/SteamCondenser/servers/packets/QueryPacketTest.php @@ -0,0 +1,21 @@ +packet = $this->getMockForAbstractClass('\SteamCondenser\Servers\Packets\QueryPacket', array(0x61, 'test')); + } + + public function testPadding() { + $this->assertEquals(str_pad("\xFF\xFF\xFF\xFFatest", 1200, "\0"), $this->packet->__toString()); + } + +}