We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -100,7 +100,7 @@ |
||
| 100 | 100 | $ship = new AbstractSmrShip($this->player); |
| 101 | 101 | $this->expectException(\Exception::class); |
| 102 | 102 | $this->expectExceptionMessage('Ship does not have the supported hardware!'); |
| 103 | - $ship->setIllusion(SHIP_TYPE_THIEF, 12, 13);; |
|
| 103 | + $ship->setIllusion(SHIP_TYPE_THIEF, 12, 13); ; |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | public function test_hardware() { |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | try { |
| 119 | - $TRADE_ROUTE =& $GLOBALS['TRADE_ROUTE']; |
|
| 119 | + $TRADE_ROUTE = & $GLOBALS['TRADE_ROUTE']; |
|
| 120 | 120 | debug('Action #' . $actions); |
| 121 | 121 | |
| 122 | 122 | //We have to reload player on each loop |
@@ -140,14 +140,14 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | if (!isset($TRADE_ROUTE)) { //We only want to change trade route if there isn't already one set. |
| 143 | - $TRADE_ROUTES =& findRoutes($player); |
|
| 144 | - $TRADE_ROUTE =& changeRoute($TRADE_ROUTES); |
|
| 143 | + $TRADE_ROUTES = & findRoutes($player); |
|
| 144 | + $TRADE_ROUTE = & changeRoute($TRADE_ROUTES); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | if ($player->isDead()) { |
| 148 | 148 | debug('Some evil person killed us, let\'s move on now.'); |
| 149 | 149 | $previousContainer = null; //We died, we don't care what we were doing beforehand. |
| 150 | - $TRADE_ROUTE =& changeRoute($TRADE_ROUTES); //Change route |
|
| 150 | + $TRADE_ROUTE = & changeRoute($TRADE_ROUTES); //Change route |
|
| 151 | 151 | processContainer(Page::create('death_processing.php')); |
| 152 | 152 | } |
| 153 | 153 | if ($player->getNewbieTurns() <= NEWBIE_TURNS_WARNING_LIMIT && $player->getNewbieWarning()) { |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | processContainer(tradeGoods($goodID, $player, $port)); |
| 224 | 224 | } else { |
| 225 | 225 | //Move to next route or fed. |
| 226 | - if (($TRADE_ROUTE =& changeRoute($TRADE_ROUTES)) === false) { |
|
| 226 | + if (($TRADE_ROUTE = & changeRoute($TRADE_ROUTES)) === false) { |
|
| 227 | 227 | debug('Changing Route Failed'); |
| 228 | 228 | processContainer(plotToFed($player)); |
| 229 | 229 | } else { |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | processContainer(tradeGoods($goodID, $player, $port)); |
| 251 | 251 | } else { |
| 252 | 252 | //Move to next route or fed. |
| 253 | - if (($TRADE_ROUTE =& changeRoute($TRADE_ROUTES)) === false) { |
|
| 253 | + if (($TRADE_ROUTE = & changeRoute($TRADE_ROUTES)) === false) { |
|
| 254 | 254 | debug('Changing Route Failed'); |
| 255 | 255 | processContainer(plotToFed($player)); |
| 256 | 256 | } else { |
@@ -582,9 +582,9 @@ discard block |
||
| 582 | 582 | return $false; |
| 583 | 583 | } |
| 584 | 584 | $routeKey = array_rand($tradeRoutes); |
| 585 | - $tradeRoute =& $tradeRoutes[$routeKey]; |
|
| 585 | + $tradeRoute = & $tradeRoutes[$routeKey]; |
|
| 586 | 586 | unset($tradeRoutes[$routeKey]); |
| 587 | - $GLOBALS['TRADE_ROUTE'] =& $tradeRoute; |
|
| 587 | + $GLOBALS['TRADE_ROUTE'] = & $tradeRoute; |
|
| 588 | 588 | debug('Switched route', $tradeRoute); |
| 589 | 589 | return $tradeRoute; |
| 590 | 590 | } |
@@ -1,30 +1,30 @@ discard block |
||
| 1 | 1 | <?php declare(strict_types=1); |
| 2 | 2 | |
| 3 | 3 | class DummyPlayer extends AbstractSmrPlayer { |
| 4 | - public function __construct($gameID=0,$playerName='Dummy',$raceID=1,$experience=1000,$alignment=100,$allianceID=0,$shipTypeID=60) { |
|
| 4 | + public function __construct($gameID = 0, $playerName = 'Dummy', $raceID = 1, $experience = 1000, $alignment = 100, $allianceID = 0, $shipTypeID = 60) { |
|
| 5 | 5 | $this->accountID = 0; |
| 6 | - $this->gameID = (int) $gameID; |
|
| 7 | - $this->playerName = (string) $playerName; |
|
| 6 | + $this->gameID = (int)$gameID; |
|
| 7 | + $this->playerName = (string)$playerName; |
|
| 8 | 8 | $this->playerID = 0; |
| 9 | 9 | $this->sectorID = 0; |
| 10 | - $this->lastSectorID = 0; |
|
| 10 | + $this->lastSectorID = 0; |
|
| 11 | 11 | $this->turns = 1000; |
| 12 | - $this->newbieTurns = 0; |
|
| 12 | + $this->newbieTurns = 0; |
|
| 13 | 13 | $this->lastNewsUpdate = 0; |
| 14 | 14 | $this->dead = false; |
| 15 | 15 | $this->landedOnPlanet = false; |
| 16 | - $this->lastActive = 0; |
|
| 17 | - $this->lastCPLAction = 0; |
|
| 18 | - $this->raceID = (int) $raceID; |
|
| 19 | - $this->credits = 0; |
|
| 20 | - $this->experience = (int) $experience; |
|
| 21 | - $this->alignment = (int) $alignment; |
|
| 22 | - $this->militaryPayment = 0; |
|
| 23 | - $this->allianceID = (int) $allianceID; |
|
| 24 | - $this->shipID = (int) $shipTypeID; |
|
| 16 | + $this->lastActive = 0; |
|
| 17 | + $this->lastCPLAction = 0; |
|
| 18 | + $this->raceID = (int)$raceID; |
|
| 19 | + $this->credits = 0; |
|
| 20 | + $this->experience = (int)$experience; |
|
| 21 | + $this->alignment = (int)$alignment; |
|
| 22 | + $this->militaryPayment = 0; |
|
| 23 | + $this->allianceID = (int)$allianceID; |
|
| 24 | + $this->shipID = (int)$shipTypeID; |
|
| 25 | 25 | $this->kills = 0; |
| 26 | 26 | $this->deaths = 0; |
| 27 | - $this->lastPort = 0; |
|
| 27 | + $this->lastPort = 0; |
|
| 28 | 28 | $this->bank = 0; |
| 29 | 29 | $this->zoom = 0; |
| 30 | 30 | |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public function setAllianceID($ID) { |
| 51 | - if($this->allianceID == $ID) |
|
| 51 | + if ($this->allianceID == $ID) |
|
| 52 | 52 | return; |
| 53 | - $this->allianceID=$ID; |
|
| 53 | + $this->allianceID = $ID; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | public function killPlayerByPlayer(AbstractSmrPlayer $killer) { |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $db = Smr\Database::getInstance(); |
| 76 | 76 | $db->query('REPLACE INTO cached_dummys ' . |
| 77 | 77 | '(type, id, info) ' . |
| 78 | - 'VALUES (\'DummyPlayer\', '.$db->escapeString($this->getPlayerName()).', '.$db->escapeObject($this).')'); |
|
| 78 | + 'VALUES (\'DummyPlayer\', ' . $db->escapeString($this->getPlayerName()) . ', ' . $db->escapeObject($this) . ')'); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | public static function &getCachedDummyPlayer($name) { |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $db->query('SELECT info FROM cached_dummys |
| 84 | 84 | WHERE type = \'DummyPlayer\' |
| 85 | 85 | AND id = ' . $db->escapeString($name) . ' LIMIT 1'); |
| 86 | - if($db->nextRecord()) { |
|
| 86 | + if ($db->nextRecord()) { |
|
| 87 | 87 | $return = $db->getObject('info'); |
| 88 | 88 | return $return; |
| 89 | 89 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $db->query('SELECT id FROM cached_dummys |
| 99 | 99 | WHERE type = \'DummyPlayer\''); |
| 100 | 100 | $dummyNames = array(); |
| 101 | - while($db->nextRecord()) { |
|
| 101 | + while ($db->nextRecord()) { |
|
| 102 | 102 | $dummyNames[] = $db->getField('id'); |
| 103 | 103 | } |
| 104 | 104 | return $dummyNames; |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $menuItems[] = array('Link'=>Globals::getPlanetListHREF($alliance_id), 'Text'=>'Defense'); |
| 41 | 41 | $menuItems[] = array('Link'=>Globals::getPlanetListFinancialHREF($alliance_id), 'Text'=>'Financial'); |
| 42 | 42 | // make the selected index bold |
| 43 | - $boldItem =& $menuItems[$selected_index]['Text']; |
|
| 43 | + $boldItem = & $menuItems[$selected_index]['Text']; |
|
| 44 | 44 | $boldItem = '<span class="bold">' . $boldItem . '</span>'; |
| 45 | 45 | |
| 46 | 46 | $template = Smr\Template::getInstance(); |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | 'Text' => 'Game News', |
| 147 | 147 | ]; |
| 148 | 148 | // make the selected index bold |
| 149 | - $boldItem =& $menuItems[$selected_index]['Text']; |
|
| 149 | + $boldItem = & $menuItems[$selected_index]['Text']; |
|
| 150 | 150 | $boldItem = '<b>' . $boldItem . '</b>'; |
| 151 | 151 | |
| 152 | 152 | $template = Smr\Template::getInstance(); |
@@ -163,7 +163,7 @@ |
||
| 163 | 163 | |
| 164 | 164 | // transfer this value to next container |
| 165 | 165 | if (!isset($var[$source])) { |
| 166 | - throw new Exception('Could not find "' . $source. '" in var!'); |
|
| 166 | + throw new Exception('Could not find "' . $source . '" in var!'); |
|
| 167 | 167 | } |
| 168 | 168 | if ($dest === null) { |
| 169 | 169 | $dest = $source; |
@@ -130,7 +130,7 @@ |
||
| 130 | 130 | AND receiver_delete = ' . $db->escapeBoolean(false) . ' |
| 131 | 131 | ORDER BY send_time DESC'); |
| 132 | 132 | while ($db->nextRecord()) { |
| 133 | - $groupBox =& $messageBox['GroupedMessages'][$db->getInt('sender_id')]; |
|
| 133 | + $groupBox = & $messageBox['GroupedMessages'][$db->getInt('sender_id')]; |
|
| 134 | 134 | // Limit the number of messages in each group |
| 135 | 135 | if (!isset($groupBox['Messages']) || count($groupBox['Messages']) < MESSAGE_SCOUT_GROUP_LIMIT) { |
| 136 | 136 | displayMessage($groupBox, $db->getInt('message_id'), $db->getInt('account_id'), $db->getInt('sender_id'), $player->getGameID(), stripslashes($db->getField('message_text')), $db->getInt('send_time'), $db->getBoolean('msg_read'), MSG_SCOUT); |
@@ -2,81 +2,81 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | $template = Smr\Template::getInstance(); |
| 4 | 4 | |
| 5 | -$template->assign('PageTopic','Combat Simulator'); |
|
| 5 | +$template->assign('PageTopic', 'Combat Simulator'); |
|
| 6 | 6 | |
| 7 | -$template->assign('EditDummysLink', Page::create('skeleton.php','edit_dummys.php')->href()); |
|
| 7 | +$template->assign('EditDummysLink', Page::create('skeleton.php', 'edit_dummys.php')->href()); |
|
| 8 | 8 | $template->assign('DummyNames', DummyPlayer::getDummyPlayerNames()); |
| 9 | 9 | |
| 10 | 10 | $duplicates = false; |
| 11 | 11 | $usedNames = array(); |
| 12 | 12 | $realAttackers = array(); |
| 13 | 13 | $attackers = array(); |
| 14 | -$i=1; |
|
| 15 | -if(isset($_POST['attackers'])) |
|
| 16 | - foreach($_POST['attackers'] as $attackerName) { |
|
| 17 | - if($attackerName=='none') |
|
| 14 | +$i = 1; |
|
| 15 | +if (isset($_POST['attackers'])) |
|
| 16 | + foreach ($_POST['attackers'] as $attackerName) { |
|
| 17 | + if ($attackerName == 'none') |
|
| 18 | 18 | continue; |
| 19 | - if(isset($usedNames[$attackerName])) { |
|
| 19 | + if (isset($usedNames[$attackerName])) { |
|
| 20 | 20 | $duplicates = true; |
| 21 | 21 | continue; |
| 22 | 22 | } |
| 23 | 23 | $usedNames[$attackerName] = true; |
| 24 | - $attackers[$i] =& DummyPlayer::getCachedDummyPlayer($attackerName); |
|
| 24 | + $attackers[$i] = & DummyPlayer::getCachedDummyPlayer($attackerName); |
|
| 25 | 25 | $attackers[$i]->setAllianceID(1); |
| 26 | - $realAttackers[$i] =& $attackers[$i]; |
|
| 26 | + $realAttackers[$i] = & $attackers[$i]; |
|
| 27 | 27 | ++$i; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | -for(;$i<=10;++$i) |
|
| 30 | +for (;$i <= 10; ++$i) |
|
| 31 | 31 | $attackers[$i] = null; |
| 32 | -$template->assign('Attackers',$attackers); |
|
| 32 | +$template->assign('Attackers', $attackers); |
|
| 33 | 33 | |
| 34 | -$i=1; |
|
| 34 | +$i = 1; |
|
| 35 | 35 | $realDefenders = array(); |
| 36 | 36 | $defenders = array(); |
| 37 | -if(isset($_POST['defenders'])) |
|
| 38 | - foreach($_POST['defenders'] as $defenderName) { |
|
| 39 | - if($defenderName=='none') |
|
| 37 | +if (isset($_POST['defenders'])) |
|
| 38 | + foreach ($_POST['defenders'] as $defenderName) { |
|
| 39 | + if ($defenderName == 'none') |
|
| 40 | 40 | continue; |
| 41 | - if(isset($usedNames[$defenderName])) { |
|
| 41 | + if (isset($usedNames[$defenderName])) { |
|
| 42 | 42 | $duplicates = true; |
| 43 | 43 | continue; |
| 44 | 44 | } |
| 45 | 45 | $usedNames[$attackerName] = true; |
| 46 | - $defenders[$i] =& DummyPlayer::getCachedDummyPlayer($defenderName); |
|
| 46 | + $defenders[$i] = & DummyPlayer::getCachedDummyPlayer($defenderName); |
|
| 47 | 47 | $defenders[$i]->setAllianceID(2); |
| 48 | - $realDefenders[$i] =& $defenders[$i]; |
|
| 48 | + $realDefenders[$i] = & $defenders[$i]; |
|
| 49 | 49 | ++$i; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | -for(;$i<=10;++$i) |
|
| 52 | +for (;$i <= 10; ++$i) |
|
| 53 | 53 | $defenders[$i] = null; |
| 54 | -$template->assign('Defenders',$defenders); |
|
| 54 | +$template->assign('Defenders', $defenders); |
|
| 55 | 55 | |
| 56 | -$template->assign('Duplicates',$duplicates); |
|
| 56 | +$template->assign('Duplicates', $duplicates); |
|
| 57 | 57 | |
| 58 | -$template->assign('CombatSimHREF', Page::create('skeleton.php','combat_simulator.php')->href()); |
|
| 58 | +$template->assign('CombatSimHREF', Page::create('skeleton.php', 'combat_simulator.php')->href()); |
|
| 59 | 59 | |
| 60 | 60 | if (!empty($realAttackers) && !empty($realDefenders)) { |
| 61 | - if(isset($_REQUEST['run'])) { |
|
| 62 | - runAnAttack($realAttackers,$realDefenders); |
|
| 61 | + if (isset($_REQUEST['run'])) { |
|
| 62 | + runAnAttack($realAttackers, $realDefenders); |
|
| 63 | 63 | } |
| 64 | - if(isset($_REQUEST['death_run'])) { |
|
| 65 | - while(count($realAttackers)>0 && count($realDefenders)>0) { |
|
| 66 | - runAnAttack($realAttackers,$realDefenders); |
|
| 67 | - foreach($realAttackers as $key => &$teamPlayer) { |
|
| 68 | - if($teamPlayer->isDead()) |
|
| 64 | + if (isset($_REQUEST['death_run'])) { |
|
| 65 | + while (count($realAttackers) > 0 && count($realDefenders) > 0) { |
|
| 66 | + runAnAttack($realAttackers, $realDefenders); |
|
| 67 | + foreach ($realAttackers as $key => &$teamPlayer) { |
|
| 68 | + if ($teamPlayer->isDead()) |
|
| 69 | 69 | unset($realAttackers[$key]); |
| 70 | 70 | } unset($teamPlayer); |
| 71 | - foreach($realDefenders as $key => &$teamPlayer) { |
|
| 72 | - if($teamPlayer->isDead()) |
|
| 71 | + foreach ($realDefenders as $key => &$teamPlayer) { |
|
| 72 | + if ($teamPlayer->isDead()) |
|
| 73 | 73 | unset($realDefenders[$key]); |
| 74 | 74 | } unset($teamPlayer); |
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | -function runAnAttack($realAttackers,$realDefenders) { |
|
| 79 | +function runAnAttack($realAttackers, $realDefenders) { |
|
| 80 | 80 | $results = array('Attackers' => array('Traders' => array(), 'TotalDamage' => 0), |
| 81 | 81 | 'Defenders' => array('Traders' => array(), 'TotalDamage' => 0)); |
| 82 | 82 | foreach ($realAttackers as $accountID => $teamPlayer) { |
@@ -86,10 +86,10 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | foreach ($realDefenders as $accountID => $teamPlayer) { |
| 88 | 88 | $playerResults = $teamPlayer->shootPlayers($realAttackers); |
| 89 | - $results['Defenders']['Traders'][] = $playerResults; |
|
| 89 | + $results['Defenders']['Traders'][] = $playerResults; |
|
| 90 | 90 | $results['Defenders']['TotalDamage'] += $playerResults['TotalDamage']; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | $template = Smr\Template::getInstance(); |
| 94 | - $template->assign('TraderCombatResults',$results); |
|
| 94 | + $template->assign('TraderCombatResults', $results); |
|
| 95 | 95 | } |
@@ -19,8 +19,8 @@ discard block |
||
| 19 | 19 | 1 => array("pipe", "w") // stdout is a pipe that the child will write to |
| 20 | 20 | ); |
| 21 | 21 | $engine = proc_open(UCI_CHESS_ENGINE, $descriptorSpec, $pipes); |
| 22 | - $toEngine =& $pipes[0]; |
|
| 23 | - $fromEngine =& $pipes[1]; |
|
| 22 | + $toEngine = & $pipes[0]; |
|
| 23 | + $fromEngine = & $pipes[1]; |
|
| 24 | 24 | |
| 25 | 25 | function readFromEngine($block = true) { |
| 26 | 26 | global $fromEngine; |
@@ -84,5 +84,5 @@ discard block |
||
| 84 | 84 | function debug($message, $debugObject = null) { |
| 85 | 85 | echo date('Y-m-d H:i:s - ') . $message . ($debugObject !== null ? EOL . var_export($debugObject, true) : '') . EOL; |
| 86 | 86 | $db = Smr\Database::getInstance(); |
| 87 | - $db->query('INSERT INTO npc_logs (script_id, npc_id, time, message, debug_info, var) VALUES (' . (defined('SCRIPT_ID') ? SCRIPT_ID : 0) . ', 0, NOW(),' . $db->escapeString($message) . ',' . $db->escapeString(var_export($debugObject,true)) . ',' . $db->escapeString('') . ')'); |
|
| 87 | + $db->query('INSERT INTO npc_logs (script_id, npc_id, time, message, debug_info, var) VALUES (' . (defined('SCRIPT_ID') ? SCRIPT_ID : 0) . ', 0, NOW(),' . $db->escapeString($message) . ',' . $db->escapeString(var_export($debugObject, true)) . ',' . $db->escapeString('') . ')'); |
|
| 88 | 88 | } |