-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provided by https://steamcommunity.com/id/0null1works/ (ဪTheLupi#5961)
- Loading branch information
Showing
46 changed files
with
1,567 additions
and
274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,24 +19,25 @@ | |
namespace GameQ\Protocols; | ||
|
||
/** | ||
* Class Aoc | ||
* Class Arma | ||
* | ||
* @package GameQ\Protocols | ||
* @author Austin Bischoff <[email protected]> | ||
* | ||
* @author Wilson Jesus <> | ||
*/ | ||
class Aoc extends Source | ||
class Arma extends Gamespy2 | ||
{ | ||
/** | ||
* String name of this protocol class | ||
* | ||
* @type string | ||
*/ | ||
protected $name = 'aoc'; | ||
protected $name = 'arma'; | ||
|
||
/** | ||
* Longer string name of this protocol class | ||
* | ||
* @type string | ||
*/ | ||
protected $name_long = "Age of Chivalry"; | ||
protected $name_long = "ArmA Armed Assault"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of GameQ. | ||
* | ||
|
@@ -18,35 +19,15 @@ | |
|
||
namespace GameQ\Protocols; | ||
|
||
use GameQ\Buffer; | ||
use GameQ\Result; | ||
|
||
/** | ||
* Class Armed Assault 3 | ||
* | ||
* Rules protocol reference: https://community.bistudio.com/wiki/Arma_3_ServerBrowserProtocol2 | ||
* Class Dayzmod | ||
* | ||
* @package GameQ\Protocols | ||
* @author Marcel Bößendörfer <[email protected]> | ||
* @author Austin Bischoff <[email protected]> | ||
* @author Memphis017 <https://github.com/Memphis017> | ||
*/ | ||
class Arma3 extends Source | ||
class Arma3 extends Armedassault2oa | ||
{ | ||
/** | ||
* Defines the names for the specific game DLCs | ||
* | ||
* @var array | ||
*/ | ||
protected $dlcNames = [ | ||
'Karts', | ||
'Marksmen', | ||
'Helicopters', | ||
'Apex', | ||
'Jets', | ||
'Laws of War', | ||
'Tac-Ops', | ||
'Tanks', | ||
]; | ||
|
||
/** | ||
* String name of this protocol class | ||
|
@@ -61,127 +42,4 @@ class Arma3 extends Source | |
* @type string | ||
*/ | ||
protected $name_long = "Arma3"; | ||
|
||
/** | ||
* Query port = client_port + 1 | ||
* | ||
* @type int | ||
*/ | ||
protected $port_diff = 1; | ||
|
||
/** | ||
* Process the rules since Arma3 changed their response for rules | ||
* | ||
* @param Buffer $buffer | ||
* | ||
* @return array | ||
* @throws \GameQ\Exception\Protocol | ||
*/ | ||
protected function processRules(Buffer $buffer) | ||
{ | ||
// Total number of packets, burn it | ||
$buffer->readInt16(); | ||
|
||
// Will hold the data string | ||
$data = ''; | ||
|
||
// Loop until we run out of strings | ||
while ($buffer->getLength()) { | ||
// Burn the delimiters (i.e. \x01\x04\x00) | ||
$buffer->readString(); | ||
|
||
// Add the data to the string, we are reassembling it | ||
$data .= $buffer->readString(); | ||
} | ||
|
||
// Restore escaped sequences | ||
$data = str_replace(["\x01\x01", "\x01\x02", "\x01\x03"], ["\x01", "\x00", "\xFF"], $data); | ||
|
||
// Make a new buffer with the reassembled data | ||
$responseBuffer = new Buffer($data); | ||
|
||
// Kill the old buffer, should be empty | ||
unset($buffer, $data); | ||
|
||
// Set the result to a new result instance | ||
$result = new Result(); | ||
|
||
// Get results | ||
$result->add('rules_protocol_version', $responseBuffer->readInt8()); | ||
$result->add('overflow', $responseBuffer->readInt8()); | ||
$dlcBit = $responseBuffer->readInt8(); // Grab DLC bit and use it later | ||
$responseBuffer->skip(); // Reserved, burn it | ||
// Grab difficulty so we can man handle it... | ||
$difficulty = $responseBuffer->readInt8(); | ||
|
||
// Process difficulty | ||
$result->add('3rd_person', $difficulty >> 7); | ||
$result->add('advanced_flight_mode', ($difficulty >> 6) & 1); | ||
$result->add('difficulty_ai', ($difficulty >> 3) & 3); | ||
$result->add('difficulty_level', $difficulty & 3); | ||
|
||
unset($difficulty); | ||
|
||
// Crosshair | ||
$result->add('crosshair', $responseBuffer->readInt8()); | ||
|
||
/* | ||
* Due to a bug in the DLC byte response from the ARMA servers we end here until the DLC byte bug can be fixed | ||
* or can code around the issue. | ||
* See https://github.com/Austinb/GameQ/issues/420 | ||
*/ | ||
unset($dlcBit); | ||
return $result->fetch(); | ||
|
||
//$dlcBit = 255; | ||
|
||
/*// Loop over the DLC bit so we can pull in the infor for the DLC (if enabled) | ||
for ($x = 0; $x < 8; $x++) { | ||
if (($dlcBit >> $x) & 1) { | ||
$result->addSub('dlcs', 'name', $this->dlcNames[$x]); | ||
$result->addSub('dlcs', 'hash', dechex($responseBuffer->readInt32())); | ||
} | ||
} | ||
// No longer needed | ||
unset($dlcBit); | ||
// Grab the mod count | ||
$modCount = $responseBuffer->readInt8(); | ||
// Add mod count | ||
$result->add('mod_count', $modCount); | ||
// Loop the mod count and add them | ||
for ($x = 0; $x < $modCount; $x++) { | ||
// Add the mod to the list | ||
$result->addSub('mods', 'hash', dechex($responseBuffer->readInt32())); | ||
$result->addSub('mods', 'steam_id', hexdec($responseBuffer->readPascalString(0, true))); | ||
$result->addSub('mods', 'name', $responseBuffer->readPascalString(0, true)); | ||
} | ||
unset($modCount, $x); | ||
// Burn the signatures count, we will just loop until we run out of strings | ||
$responseBuffer->read(); | ||
// Make signatures array | ||
$signatures = []; | ||
// Loop until we run out of strings | ||
while ($responseBuffer->getLength()) { | ||
//$result->addSub('signatures', 0, $responseBuffer->readPascalString(0, true)); | ||
$signatures[] = $responseBuffer->readPascalString(0, true); | ||
} | ||
// Add as a simple array | ||
$result->add('signatures', $signatures); | ||
// Add signatures count | ||
$result->add('signature_count', count($signatures)); | ||
unset($responseBuffer, $signatures); | ||
return $result->fetch();*/ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.