Skip to content

Commit

Permalink
Added Quake Live support (A2S). Fixes #345
Browse files Browse the repository at this point in the history
  • Loading branch information
Austinb committed Nov 26, 2016
1 parent 4026e61 commit 6cc2125
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 0 deletions.
42 changes: 42 additions & 0 deletions src/GameQ/Protocols/Quakelive.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php
/**
* This file is part of GameQ.
*
* GameQ is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* GameQ is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

namespace GameQ\Protocols;

/**
* Class Quake Live
*
* @package GameQ\Protocols
* @author Austin Bischoff <[email protected]>
*/
class Quakelive extends Source
{
/**
* String name of this protocol class
*
* @type string
*/
protected $name = 'quakelive';

/**
* Longer string name of this protocol class
*
* @type string
*/
protected $name_long = "Quake Live";
}
Binary file not shown.
1 change: 1 addition & 0 deletions tests/Protocols/Providers/Quakelive/1_result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"64.74.97.106:27960":{"capturelimit":"8","dedicated":"d","dmflags":"0","fraglimit":"50","g_adCaptureScoreBonus":"3","g_adElimScoreBonus":"2","g_adTouchScoreBonus":"1","g_blueScore":"7","g_customSettings":"0","g_factory":"freeze","g_factoryTitle":"PILL FREEZE TAG","g_freezeRoundDelay":"0","g_gameState":"IN_PROGRESS","g_gametype":"9","g_gravity":"800","g_instaGib":"0","g_itemHeight":"35","g_itemTimers":"0","g_levelStartTime":"1480117693","g_loadout":"0","g_needpass":"0","g_overtime":"120","g_quadDamageFactor":"3","g_redScore":"4","g_roundWarmupDelay":"10000","g_startingHealth":"100","g_teamForceBalance":"0","g_teamSizeMin":"1","g_timeoutCount":"0","g_voteFlags":"13416","g_weaponRespawn":"5","game_descr":"Freeze Tag","game_dir":"baseq3","game_id":282440,"gq_address":"64.74.97.106","gq_joinlink":"steam:\/\/connect\/64.74.97.106:27960\/","gq_name":"Quake Live","gq_online":true,"gq_port_client":27960,"gq_port_query":27960,"gq_protocol":"source","gq_transport":"udp","gq_type":"quakelive","hostname":"PILL FREEZE TAG | CHICAGO","keywords":"freezetag,minqlx,freeze,ft,Chicago,pills,pill","map":"dredwerkz","mapname":"dredwerkz","max_players":28,"mercylimit":"0","num_bots":0,"num_players":17,"num_rules":42,"os":"l","password":0,"players":[{"id":0,"name":"AC!D","score":40,"time":4133.3115234375},{"id":0,"name":"^2lint","score":43,"time":4131.3125},{"id":0,"name":"^2Weed","score":43,"time":4130.978515625},{"id":0,"name":"^5ρṻ ^3^^0♥ ^5ЄЯɦ","score":17,"time":4128.0483398438},{"id":0,"name":"^7]^1SpB^7[ ph^11^7ldo","score":44,"time":3916.46484375},{"id":0,"name":"^4£ighter^3thieƒ","score":33,"time":3644.162109375},{"id":0,"name":"eXerguX","score":27,"time":3146.34765625},{"id":0,"name":"║▌║█║▌│║▌║","score":34,"time":2827.6049804688},{"id":0,"name":"stormy","score":44,"time":2769.97265625},{"id":0,"name":"minion","score":45,"time":2550.7478027344},{"id":0,"name":"DeMan_EM","score":16,"time":973.90362548828},{"id":0,"name":"soclose","score":18,"time":924.83319091797},{"id":0,"name":"^5Mithandirs^6Ghost","score":10,"time":612.466796875},{"id":0,"name":"Avatar","score":21,"time":537.2802734375},{"id":0,"name":"✿ⓏⓊⓇⒹⓄ™✿","score":19,"time":409.67333984375},{"id":0,"name":"alien","score":0,"time":343.43966674805},{"id":0,"name":"algerion","score":6,"time":239.77928161621}],"port":27960,"protocol":"91","roundlimit":"8","roundtimelimit":"0","scorelimit":"150","secure":1,"steam_id":90105407413101572,"steamappid":0,"sv_hostname":"PILL FREEZE TAG | CHICAGO","sv_maxclients":"28","sv_privateClients":"1","teamsize":"9","timelimit":"20","version":"1069 linux-x64 Jun 3 2016 20:53:50"}}
Binary file not shown.
1 change: 1 addition & 0 deletions tests/Protocols/Providers/Quakelive/2_result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"104.192.227.170:27960":{"capturelimit":"8","dedicated":"d","dmflags":"0","fraglimit":"50","g_adCaptureScoreBonus":"3","g_adElimScoreBonus":"2","g_adTouchScoreBonus":"1","g_blueScore":"12","g_customSettings":"0","g_factory":"ffa","g_factoryTitle":"Free For All","g_freezeRoundDelay":"4000","g_gameState":"IN_PROGRESS","g_gametype":"0","g_gravity":"800","g_instaGib":"0","g_itemHeight":"35","g_itemTimers":"0","g_levelStartTime":"1480118601","g_loadout":"0","g_needpass":"0","g_overtime":"0","g_quadDamageFactor":"3","g_redScore":"18","g_roundWarmupDelay":"10000","g_startingHealth":"100","g_teamForceBalance":"1","g_teamSizeMin":"1","g_timeoutCount":"0","g_voteFlags":"1288","g_weaponRespawn":"1","game_descr":"Free For All","game_dir":"baseq3","game_id":282440,"gq_address":"104.192.227.170","gq_joinlink":"steam:\/\/connect\/104.192.227.170:27960\/","gq_name":"Quake Live","gq_online":true,"gq_port_client":27960,"gq_port_query":27960,"gq_protocol":"source","gq_transport":"udp","gq_type":"quakelive","hostname":"|)ark Fiber FFA | Chicago ","keywords":"ffa,minqlx,DarkFiberQuake.com, Dedicated, Stats","map":"blackcathedral","mapname":"blackcathedral","max_players":32,"mercylimit":"0","num_bots":0,"num_players":14,"num_rules":42,"os":"l","password":0,"players":[{"id":0,"name":"petehaberkorn","score":0,"time":14434.790039062},{"id":0,"name":"[RIOT]HeLlSpAwN","score":0,"time":9717.986328125},{"id":0,"name":"HarryTurdKnocker","score":0,"time":4886.3173828125},{"id":0,"name":"^2PotHe4d","score":8,"time":1295.3927001953},{"id":0,"name":"0BigJimSlade0","score":3,"time":1049.2965087891},{"id":0,"name":"antman63","score":3,"time":1011.1903076172},{"id":0,"name":"CracKMonkey","score":12,"time":905.10412597656},{"id":0,"name":"cedde","score":7,"time":815.43988037109},{"id":0,"name":"Blue.Demon","score":3,"time":736.82592773438},{"id":0,"name":"_McCafe_","score":18,"time":695.35919189453},{"id":0,"name":"SubZero","score":4,"time":418.99301147461},{"id":0,"name":"boomstick","score":9,"time":358.4323425293},{"id":0,"name":"Species","score":9,"time":331.39785766602},{"id":0,"name":"kvn","score":6,"time":85.051734924316}],"port":27960,"protocol":"91","roundlimit":"10","roundtimelimit":"180","scorelimit":"150","secure":1,"steam_id":90105375025776647,"steamappid":0,"sv_hostname":"|)ark Fiber FFA | Chicago ","sv_maxclients":"32","sv_privateClients":"0","teamsize":"32","timelimit":"15","version":"1069 linux-x64 Jun 3 2016 20:53:50"}}
Binary file not shown.
1 change: 1 addition & 0 deletions tests/Protocols/Providers/Quakelive/3_result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"5.19.249.101:27961":{"capturelimit":"8","dedicated":"d","dmflags":"52","fraglimit":"50","g_adCaptureScoreBonus":"3","g_adElimScoreBonus":"2","g_adTouchScoreBonus":"1","g_blueScore":"0","g_customSettings":"0","g_factory":"instagib_ffa_pql","g_factoryTitle":"PQL Instagib FFA","g_freezeRoundDelay":"4000","g_gameState":"PRE_GAME","g_gametype":"0","g_gravity":"800","g_instaGib":"1","g_itemHeight":"35","g_itemTimers":"0","g_levelStartTime":"1480118939","g_loadout":"0","g_needpass":"0","g_overtime":"0","g_quadDamageFactor":"3","g_redScore":"0","g_roundWarmupDelay":"10000","g_startingHealth":"100","g_teamForceBalance":"1","g_teamSizeMin":"1","g_timeoutCount":"0","g_voteFlags":"30568","g_weaponRespawn":"5","game_descr":"Free For All","game_dir":"baseq3","game_id":282440,"gq_address":"5.19.249.101","gq_joinlink":"steam:\/\/connect\/5.19.249.101:27961\/","gq_name":"Quake Live","gq_online":true,"gq_port_client":27961,"gq_port_query":27961,"gq_protocol":"source","gq_transport":"udp","gq_type":"quakelive","hostname":"► [Instagib FFA PQL] RU Melodeiro Server","keywords":"ffa,instagib,minqlx,pql,b-rated,Melodeiro,Saint-Petersburg,RU","map":"skyward","mapname":"skyward","max_players":22,"mercylimit":"0","num_bots":0,"num_players":3,"num_rules":42,"os":"l","password":0,"players":[{"id":0,"name":"execgarret","score":0,"time":11382.264648438},{"id":0,"name":"yadohimikat","score":0,"time":1168.9237060547},{"id":0,"name":"RMRH","score":0,"time":31.532669067383}],"port":27961,"protocol":"91","roundlimit":"10","roundtimelimit":"180","scorelimit":"150","secure":1,"steam_id":90105393812024328,"steamappid":0,"sv_hostname":"► [Instagib FFA PQL] RU Melodeiro Server","sv_maxClients":"22","sv_privateClients":"1","teamsize":"16","timelimit":"15","version":"1069 linux-x64 Jun 3 2016 20:53:50"}}
50 changes: 50 additions & 0 deletions tests/Protocols/Quakelive.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php
/**
* This file is part of GameQ.
*
* GameQ is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* GameQ is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

namespace GameQ\Tests\Protocols;

/**
* Test Class for Quake Live
*
* @package GameQ\Tests\Protocols
*/
class Quakelive extends Base
{
/**
* Test responses for Quakelive
*
* @dataProvider loadData
*
* @param $responses
* @param $result
*/
public function testResponses($responses, $result)
{

// Pull the first key off the array this is the server ip:port
$server = key($result);

$testResult = $this->queryTest(
$server,
'quakelive',
$responses
);

$this->assertEquals($result[$server], $testResult, '', 0.000000001);
}
}

0 comments on commit 6cc2125

Please sign in to comment.