-
-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
146 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?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 Battlefield 1942 | ||
* | ||
* @package GameQ\Protocols | ||
* @author Austin Bischoff <austin@codebeard.com> | ||
*/ | ||
class Bf1942 extends Gamespy | ||
{ | ||
|
||
/** | ||
* String name of this protocol class | ||
* | ||
* @type string | ||
*/ | ||
protected $name = 'bf1942'; | ||
|
||
/** | ||
* Longer string name of this protocol class | ||
* | ||
* @type string | ||
*/ | ||
protected $name_long = "Battlefield 1942"; | ||
|
||
/** | ||
* query_port = client_port + 8433 | ||
* 23000 = 14567 + 8433 | ||
* | ||
* @type int | ||
*/ | ||
protected $port_diff = 8433; | ||
|
||
/** | ||
* The client join link | ||
* | ||
* @type string | ||
*/ | ||
protected $join_link = "bf1942://%s:%d"; | ||
|
||
/** | ||
* Normalize settings for this protocol | ||
* | ||
* @type array | ||
*/ | ||
protected $normalize = [ | ||
// General | ||
'general' => [ | ||
// target => source | ||
'dedicated' => 'dedicated', | ||
'gametype' => 'gametype', | ||
'hostname' => 'hostname', | ||
'mapname' => 'mapname', | ||
'maxplayers' => 'maxplayers', | ||
'numplayers' => 'numplayers', | ||
'password' => 'password', | ||
], | ||
// Individual | ||
'player' => [ | ||
'name' => 'playername', | ||
'kills' => 'kills', | ||
'deaths' => 'deaths', | ||
'ping' => 'ping', | ||
'score' => 'score', | ||
], | ||
'team' => [ | ||
'name' => 'teamname', | ||
], | ||
]; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?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; | ||
|
||
class Bf1942 extends Base | ||
{ | ||
|
||
/** | ||
* Test responses for Battlefield 1942 | ||
* | ||
* @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, | ||
'bf1942', | ||
$responses | ||
); | ||
|
||
$this->assertEquals($result[$server], $testResult); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
\gamename\bfield1942\gamever\v1.612\averageFPS\0\content_check\1\dedicated\2\gameId\bf1942\gamemode\openplaying\gametype\conquest\hostname\SiMPLE | BF1942 [USA]\hostport\14567\mapId\BF1942\mapname\berlin\maxplayers\36\numplayers\17\password\0\reservedslots\0\roundTime\2040\roundTimeRemain\694\status\4\sv_punkbuster\0\tickets1\534\tickets2\239\unpure_mods\\version\v1.612\active_mods\bf1942\allied_team_ratio\1\allow_nose_cam\yes\auto_balance_teams\off\axis_team_ratio\1\bandwidth_choke_limit\0\content_check\1\cpu\3499\external_view\on\free_camera\off\game_start_delay\45s\hit_indicator\on\kickback\0%\kickback_on_splash\0%\name_tag_distance\600\name_tag_distance_scope\600\number_of_rounds\1\soldier_friendly_fire\100%\soldier_friendly_fire_on_splash\100%\spawn_delay\6s\spawn_wave_time\6s\sv_punkbuster\0\ticket_ratio\267%\time_limit\34\tk_mode\punish\unpure_mods\\vehicle_friendly_fire\100%\vehicle_friendly_fire_on_splash\100%\queryid\1142.1 | ||
|| | ||
\deaths_0\8\kills_0\13\ping_0\187\playername_0\FEDIYMAX\score_0\7\team_0\2\deaths_1\23\kills_1\87\ping_1\124\playername_1\[OYZ]Fake_Katczinsky\score_1\87\team_1\1\deaths_2\9\kills_2\57\ping_2\49\playername_2\�i��\score_2\39\team_2\2\deaths_3\28\kills_3\88\ping_3\216\playername_3\xXx TRexBrazil xXx\score_3\91\team_3\1\deaths_4\32\kills_4\30\ping_4\216\playername_4\MITOMANIACO_BR\score_4\24\team_4\2\deaths_5\19\kills_5\38\ping_5\120\playername_5\tanaka\score_5\32\team_5\1\deaths_6\23\kills_6\19\ping_6\83\playername_6\Legomanmd\score_6\10\team_6\2\deaths_7\13\kills_7\69\ping_7\232\playername_7\dark side of the moon\score_7\66\team_7\1\deaths_8\13\kills_8\42\ping_8\111\playername_8\DREAMS\score_8\54\team_8\1\deaths_9\25\kills_9\30\ping_9\216\playername_9\Skrym\score_9\30\team_9\2\deaths_10\9\kills_10\50\ping_10\231\playername_10\Turk\score_10\47\team_10\1\deaths_11\22\kills_11\18\ping_11\277\playername_11\Pocket Edition\score_11\12\team_11\2\deaths_12\14\kills_12\28\ping_12\205\playername_12\ Zong\score_12\22\team_12\2\deaths_13\4\kills_13\13\ping_13\93\playername_13\Nurse Kevorkian\score_13\10\team_13\1\deaths_14\1\kills_14\6\ping_14\207\playername_14\Calvin\score_14\9\team_14\2\deaths_15\0\kills_15\0\ping_15\260\playername_15\JLucas\score_15\0\team_15\1\deaths_16\0\kills_16\0\ping_16\0\playername_16\zDiogozCraftz\queryid\1142.2 | ||
|| | ||
\score_16\0\team_16\1\deaths_17\0\kills_17\0\ping_17\0\playername_17\Taxman\score_17\0\team_17\1\teamname_0\axis\teamname_1\allied\final\\queryid\1142.3 |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
{"168.235.75.198:14567":{"active_mods":"bf1942","allied_team_ratio":"1","allow_nose_cam":"yes","auto_balance_teams":"off","averageFPS":"0","axis_team_ratio":"1","bandwidth_choke_limit":"0","content_check":"1","cpu":"3499","dedicated":"2","external_view":"on","final":"","free_camera":"off","gameId":"bf1942","game_start_delay":"45s","gamemode":"openplaying","gamename":"bfield1942","gametype":"conquest","gamever":"v1.612","gq_address":"168.235.75.198","gq_joinlink":"bf1942:\/\/168.235.75.198:14567","gq_name":"Battlefield 1942","gq_online":true,"gq_port_client":14567,"gq_port_query":23000,"gq_protocol":"gamespy","gq_transport":"udp","gq_type":"bf1942","hit_indicator":"on","hostname":"SiMPLE | BF1942 [USA]","hostport":"14567","kickback":"0%","kickback_on_splash":"0%","mapId":"BF1942","mapname":"berlin","maxplayers":"36","name_tag_distance":"600","name_tag_distance_scope":"600","num_players":18,"num_teams":2,"number_of_rounds":"1","numplayers":"17","password":"0","players":[{"deaths":"8","kills":"13","ping":"187","playername":"FEDIYMAX","score":"7","team":"2"},{"deaths":"23","kills":"87","ping":"124","playername":"[OYZ]Fake_Katczinsky","score":"87","team":"1"},{"deaths":"9","kills":"57","ping":"49","playername":"Åiôñ","score":"39","team":"2"},{"deaths":"28","kills":"88","ping":"216","playername":"xXx TRexBrazil xXx","score":"91","team":"1"},{"deaths":"32","kills":"30","ping":"216","playername":"MITOMANIACO_BR","score":"24","team":"2"},{"deaths":"19","kills":"38","ping":"120","playername":"tanaka","score":"32","team":"1"},{"deaths":"23","kills":"19","ping":"83","playername":"Legomanmd","score":"10","team":"2"},{"deaths":"13","kills":"69","ping":"232","playername":"dark side of the moon","score":"66","team":"1"},{"deaths":"13","kills":"42","ping":"111","playername":"DREAMS","score":"54","team":"1"},{"deaths":"25","kills":"30","ping":"216","playername":"Skrym","score":"30","team":"2"},{"deaths":"9","kills":"50","ping":"231","playername":"Turk","score":"47","team":"1"},{"deaths":"22","kills":"18","ping":"277","playername":"Pocket Edition","score":"12","team":"2"},{"deaths":"14","kills":"28","ping":"205","playername":" Zong","score":"22","team":"2"},{"deaths":"4","kills":"13","ping":"93","playername":"Nurse Kevorkian","score":"10","team":"1"},{"deaths":"1","kills":"6","ping":"207","playername":"Calvin","score":"9","team":"2"},{"deaths":"0","kills":"0","ping":"260","playername":"JLucas","score":"0","team":"1"},{"deaths":"0","kills":"0","ping":"0","playername":"zDiogozCraftz","score":"0","team":"1"},{"deaths":"0","kills":"0","ping":"0","playername":"Taxman","score":"0","team":"1"}],"reservedslots":"0","roundTime":"2040","roundTimeRemain":"694","soldier_friendly_fire":"100%","soldier_friendly_fire_on_splash":"100%","spawn_delay":"6s","spawn_wave_time":"6s","status":"4","sv_punkbuster":"0","teams":[{"teamname":"axis"},{"teamname":"allied"}],"ticket_ratio":"267%","tickets1":"534","tickets2":"239","time_limit":"34","tk_mode":"punish","unpure_mods":"","vehicle_friendly_fire":"100%","vehicle_friendly_fire_on_splash":"100%","version":"v1.612"}} |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
\gamename\bfield1942\gamever\v1.612\language\English\location\1033\averageFPS\0\content_check\0\dedicated\1\gameId\bf1942\gamemode\openplaying\gametype\ctf\hostname\HKHP CTF Guadal Canal CD&ORIGIN\hostport\14567\mapId\BF1942\mapname\guadalcanal\maxplayers\50\numplayers\0\password\0\reservedslots\0\roundTime\3600\roundTimeRemain\2512\status\4\sv_punkbuster\0\tickets1\0\tickets2\0\unpure_mods\dcfinal, desertcombat, pirates\version\v1.612\active_mods\bf1942\allied_team_ratio\1\allow_nose_cam\yes\auto_balance_teams\off\axis_team_ratio\1\bandwidth_choke_limit\0\content_check\0\cpu\2960\external_view\on\free_camera\off\game_start_delay\20s\hit_indicator\on\kickback\0%\kickback_on_splash\0%\name_tag_distance\100\name_tag_distance_scope\300\number_of_rounds\1\soldier_friendly_fire\0%\soldier_friendly_fire_on_splash\0%\spawn_delay\2s\spawn_wave_time\3s\sv_punkbuster\0\ticket_ratio\100%\time_limit\60\tk_mode\forgive\unpure_mods\dcfinal, desertcombat, pirates\vehicle_friendly_fire\0%\vehicle_friendly_fire_on_splash\0%\teamname_0\axis\teamname_1\allied\final\\queryid\542.1 |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
{"173.236.29.178:14567":{"active_mods":"bf1942","allied_team_ratio":"1","allow_nose_cam":"yes","auto_balance_teams":"off","averageFPS":"0","axis_team_ratio":"1","bandwidth_choke_limit":"0","content_check":"0","cpu":"2960","dedicated":"1","external_view":"on","final":"","free_camera":"off","gameId":"bf1942","game_start_delay":"20s","gamemode":"openplaying","gamename":"bfield1942","gametype":"ctf","gamever":"v1.612","gq_address":"173.236.29.178","gq_joinlink":"bf1942:\/\/173.236.29.178:14567","gq_name":"Battlefield 1942","gq_online":true,"gq_port_client":14567,"gq_port_query":23000,"gq_protocol":"gamespy","gq_transport":"udp","gq_type":"bf1942","hit_indicator":"on","hostname":"HKHP CTF Guadal Canal CD&ORIGIN","hostport":"14567","kickback":"0%","kickback_on_splash":"0%","language":"English","location":"1033","mapId":"BF1942","mapname":"guadalcanal","maxplayers":"50","name_tag_distance":"100","name_tag_distance_scope":"300","num_players":0,"num_teams":2,"number_of_rounds":"1","numplayers":"0","password":"0","reservedslots":"0","roundTime":"3600","roundTimeRemain":"2512","soldier_friendly_fire":"0%","soldier_friendly_fire_on_splash":"0%","spawn_delay":"2s","spawn_wave_time":"3s","status":"4","sv_punkbuster":"0","teams":[{"teamname":"axis"},{"teamname":"allied"}],"ticket_ratio":"100%","tickets1":"0","tickets2":"0","time_limit":"60","tk_mode":"forgive","unpure_mods":"dcfinal, desertcombat, pirates","vehicle_friendly_fire":"0%","vehicle_friendly_fire_on_splash":"0%","version":"v1.612"}} |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
\gamename\bfield1942\gamever\v1.61\active_mods\,\averageFPS\0\content_check\1\dedicated\2\gameId\xpack2\gamemode\pre\gametype\conquest\hostname\SiMPLE | RtR+SW [FRA]\hostport\14568\mapId\XPack2\mapname\telemark\maxplayers\36\numplayers\14\password\0\reservedslots\0\roundTime\2520\roundTimeRemain\2520\status\4\sv_punkbuster\0\tickets1\720\tickets2\720\unpure_mods\\version\v1.61\active_mods\xpack1, xpack2\allied_team_ratio\1\allow_nose_cam\yes\auto_balance_teams\off\axis_team_ratio\1\bandwidth_choke_limit\0\content_check\1\cpu\2993\external_view\on\free_camera\off\game_start_delay\60s\hit_indicator\on\kickback\0%\kickback_on_splash\0%\name_tag_distance\600\name_tag_distance_scope\600\number_of_rounds\1\soldier_friendly_fire\100%\soldier_friendly_fire_on_splash\100%\spawn_delay\6s\spawn_wave_time\6s\sv_punkbuster\0\ticket_ratio\320%\time_limit\42\tk_mode\punish\unpure_mods\\vehicle_friendly_fire\100%\vehicle_friendly_fire_on_splash\100%\queryid\32.1 | ||
|| | ||
\deaths_0\0\kills_0\0\ping_0\51\playername_0\John Gult\score_0\0\team_0\2\deaths_1\0\kills_1\0\ping_1\19\playername_1\Dr-Duke\score_1\0\team_1\1\deaths_2\0\kills_2\0\ping_2\163\playername_2\Lt Joe\score_2\0\team_2\2\deaths_3\0\kills_3\0\ping_3\45\playername_3\ICEKILLER\score_3\0\team_3\1\deaths_4\0\kills_4\0\ping_4\51\playername_4\TURPIN \score_4\0\team_4\1\deaths_5\0\kills_5\0\ping_5\50\playername_5\BFSoldier\score_5\0\team_5\2\deaths_6\0\kills_6\0\ping_6\86\playername_6\Sarg.Richardista Waffen\score_6\0\team_6\2\deaths_7\0\kills_7\0\ping_7\27\playername_7\Maersk Pembroke\score_7\0\team_7\1\deaths_8\0\kills_8\0\ping_8\67\playername_8\Satana\score_8\0\team_8\1\deaths_9\0\kills_9\0\ping_9\42\playername_9\IBOOxD\score_9\0\team_9\2\deaths_10\0\kills_10\0\ping_10\50\playername_10\WaRRior:3\score_10\0\team_10\1\deaths_11\0\kills_11\0\ping_11\39\playername_11\ROGER THAT\score_11\0\team_11\2\deaths_12\0\kills_12\0\ping_12\0\playername_12\krieg\score_12\0\team_12\1\deaths_13\0\kills_13\0\ping_13\0\playername_13\Bear Cat \score_13\0\team_13\2\teamname_0\axis\teamname_1\allied\final\\queryid\32.2 |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
{"188.165.220.115:14568":{"active_mods":"xpack1, xpack2","allied_team_ratio":"1","allow_nose_cam":"yes","auto_balance_teams":"off","averageFPS":"0","axis_team_ratio":"1","bandwidth_choke_limit":"0","content_check":"1","cpu":"2993","dedicated":"2","external_view":"on","final":"","free_camera":"off","gameId":"xpack2","game_start_delay":"60s","gamemode":"pre","gamename":"bfield1942","gametype":"conquest","gamever":"v1.61","gq_address":"188.165.220.115","gq_joinlink":"bf1942:\/\/188.165.220.115:14568","gq_name":"Battlefield 1942","gq_online":true,"gq_port_client":14568,"gq_port_query":23001,"gq_protocol":"gamespy","gq_transport":"udp","gq_type":"bf1942","hit_indicator":"on","hostname":"SiMPLE | RtR+SW [FRA]","hostport":"14568","kickback":"0%","kickback_on_splash":"0%","mapId":"XPack2","mapname":"telemark","maxplayers":"36","name_tag_distance":"600","name_tag_distance_scope":"600","num_players":14,"num_teams":2,"number_of_rounds":"1","numplayers":"14","password":"0","players":[{"deaths":"0","kills":"0","ping":"51","playername":"John Gult","score":"0","team":"2"},{"deaths":"0","kills":"0","ping":"19","playername":"Dr-Duke","score":"0","team":"1"},{"deaths":"0","kills":"0","ping":"163","playername":"Lt Joe","score":"0","team":"2"},{"deaths":"0","kills":"0","ping":"45","playername":"ICEKILLER","score":"0","team":"1"},{"deaths":"0","kills":"0","ping":"51","playername":"TURPIN ","score":"0","team":"1"},{"deaths":"0","kills":"0","ping":"50","playername":"BFSoldier","score":"0","team":"2"},{"deaths":"0","kills":"0","ping":"86","playername":"Sarg.Richardista Waffen","score":"0","team":"2"},{"deaths":"0","kills":"0","ping":"27","playername":"Maersk Pembroke","score":"0","team":"1"},{"deaths":"0","kills":"0","ping":"67","playername":"Satana","score":"0","team":"1"},{"deaths":"0","kills":"0","ping":"42","playername":"IBOOxD","score":"0","team":"2"},{"deaths":"0","kills":"0","ping":"50","playername":"WaRRior:3","score":"0","team":"1"},{"deaths":"0","kills":"0","ping":"39","playername":"ROGER THAT","score":"0","team":"2"},{"deaths":"0","kills":"0","ping":"0","playername":"krieg","score":"0","team":"1"},{"deaths":"0","kills":"0","ping":"0","playername":"Bear Cat ","score":"0","team":"2"}],"reservedslots":"0","roundTime":"2520","roundTimeRemain":"2520","soldier_friendly_fire":"100%","soldier_friendly_fire_on_splash":"100%","spawn_delay":"6s","spawn_wave_time":"6s","status":"4","sv_punkbuster":"0","teams":[{"teamname":"axis"},{"teamname":"allied"}],"ticket_ratio":"320%","tickets1":"720","tickets2":"720","time_limit":"42","tk_mode":"punish","unpure_mods":"","vehicle_friendly_fire":"100%","vehicle_friendly_fire_on_splash":"100%","version":"v1.61"}} |