From 6cc21259a078690d2adaeea3c054aec9cd7fe200 Mon Sep 17 00:00:00 2001 From: Austinb Date: Fri, 25 Nov 2016 18:10:14 -0600 Subject: [PATCH] Added Quake Live support (A2S). Fixes #345 --- src/GameQ/Protocols/Quakelive.php | 42 +++++++++++++++ .../Providers/Quakelive/1_response.txt | Bin 0 -> 1308 bytes .../Providers/Quakelive/1_result.json | 1 + .../Providers/Quakelive/2_response.txt | Bin 0 -> 1221 bytes .../Providers/Quakelive/2_result.json | 1 + .../Providers/Quakelive/3_response.txt | Bin 0 -> 1048 bytes .../Providers/Quakelive/3_result.json | 1 + tests/Protocols/Quakelive.php | 50 ++++++++++++++++++ 8 files changed, 95 insertions(+) create mode 100644 src/GameQ/Protocols/Quakelive.php create mode 100644 tests/Protocols/Providers/Quakelive/1_response.txt create mode 100644 tests/Protocols/Providers/Quakelive/1_result.json create mode 100644 tests/Protocols/Providers/Quakelive/2_response.txt create mode 100644 tests/Protocols/Providers/Quakelive/2_result.json create mode 100644 tests/Protocols/Providers/Quakelive/3_response.txt create mode 100644 tests/Protocols/Providers/Quakelive/3_result.json create mode 100644 tests/Protocols/Quakelive.php diff --git a/src/GameQ/Protocols/Quakelive.php b/src/GameQ/Protocols/Quakelive.php new file mode 100644 index 00000000..d5df3501 --- /dev/null +++ b/src/GameQ/Protocols/Quakelive.php @@ -0,0 +1,42 @@ +. + */ + +namespace GameQ\Protocols; + +/** + * Class Quake Live + * + * @package GameQ\Protocols + * @author Austin Bischoff + */ +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"; +} diff --git a/tests/Protocols/Providers/Quakelive/1_response.txt b/tests/Protocols/Providers/Quakelive/1_response.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fdded73598a205f94b296d289a9deddb84f764d GIT binary patch literal 1308 zcmZ8h&ub(_6n=qa4>=h{#Gl(M9%P+B_x#SDOlEo}k&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wmWLM)8^@o&y_LWKtzC|4o1JJQ=42bs zm(RaBg3nryj2loVgI5{+`uA^R2zxSrAd6ICMj^b!@Y9_yVnFQ*)CcVb+534FL*Jq} zIW>AtOL(1W&yq#tvL$B@>O zkH{MELf`rPmp)94DJmz$9A0DS@%umYAuUNrsv6*r=il{VzR>Urd!N4jtoP4sj@|=- zrK>F|Sx5(6$cm}Lyn+y>7V{0dA3{FHtiNHV!dU7VU02X<@FQkj0b30?GPRgpK_f;d zEUtkd@+47L&J-y*Cv{UXA5T#@W0$~h&V;Qsl1|aTmxX=2J5Ok6YMsTTa0#6-^lj!? zklzD>u%!?XLtqcq*(ZdnowW0J*%bW7+qAyQWk@5@Q!l8%Z2$$aLZz0Xu{k7PmC zk0c)}T9D%W)_D-3PB)CA?m_6~DTA4*UBlBvS&7vq$SlY@Pxl$lYs_LSFsGyu+YHfC zwjE5DDb}lcjJBxDjkbuj`B?6g6X|?FsN4(~X3!B9d_;nJs89=TY73_F37ty4vAI0= z*5}Nd1{cOr(!6xk>iVJ=gr(6#s!F`@F$I>IXZhdLA5x7}{}xYEi6zi@vGhTum~v0CrH pQgk19@Rj6S^8b`TNnKywzC7pz4{99*?VuG#2mHCa-@eNY{S8)-iSPgb literal 0 HcmV?d00001 diff --git a/tests/Protocols/Providers/Quakelive/2_result.json b/tests/Protocols/Providers/Quakelive/2_result.json new file mode 100644 index 00000000..91df583b --- /dev/null +++ b/tests/Protocols/Providers/Quakelive/2_result.json @@ -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"}} \ No newline at end of file diff --git a/tests/Protocols/Providers/Quakelive/3_response.txt b/tests/Protocols/Providers/Quakelive/3_response.txt new file mode 100644 index 0000000000000000000000000000000000000000..ede5886cd5ee2549f23968cb22e7fdbe8282156e GIT binary patch literal 1048 zcmb7D!EVz)5S^+VP%nrJH;~WBmF%R6lAcJLrYRz#B&|3g6ejk>S#`bZ?5@+K>WvRT z;=q4!-E{w-`{?CAI_9@n23qj>vg>IcW*v= z!%J^KQpY5W_C{nDWWZjnuF=FWK}+*G^bC>L)5hya2>`p#AeOKb2F*5nZ>Nv_&p$uC zc(pT~qAxb|ek#;lF8ypS{mH&TN3nn3#UG(iZvUJd89T{M;twyO|Mn461MJ=2?y=l; zcNb_$QG&*hD>F}ig*{kdtY;z>S6G2xo`3Daa4_tbC4Y|ocJ2sHUP6SK%MD4cchG`3 zok~nBG-@z4m{f2hfMksEaaB5sw4o!datrkmKjEq^uvUT>I*(>sXvpY9=2SvZ5JtIm zIvtU7LUG3enquU%S;3t}WA4GdS6RZk18lG%>gkZUwEfzHEIeCQt|#j?zAfWagmW*u)ni<&~5#B`ruY zxp4&u;Xx}1!&bZA=2EG73%M)n6j7X^tsZGU9#@nX>gGAdT}&~dUO9T{sG<15B~wiF z9!;8O)m$OZRXpVzWgeCE38k9>!wfpYl#ei?Bb2Bj*0cdf;)Vu7RWWyGX~)c5>04+= zy>jjKpwVpclWW3Et0CD8uN5>P#Z0l0_eakbM62pJ0?3SZI?@u_A(V2fL>N?2G3*9u z1z?No*@S#ob}^o5>q_$f`S}*(6qm. + */ + +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); + } +}