We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | $totalShieldDamage = 0; |
| 55 | 55 | foreach ($attackers as $attacker) { |
| 56 | - $playerResults =& $attacker->shootPort($port); |
|
| 57 | - $results['Attackers']['Traders'][$attacker->getAccountID()] =& $playerResults; |
|
| 56 | + $playerResults = & $attacker->shootPort($port); |
|
| 57 | + $results['Attackers']['Traders'][$attacker->getAccountID()] = & $playerResults; |
|
| 58 | 58 | $results['Attackers']['TotalDamage'] += $playerResults['TotalDamage']; |
| 59 | 59 | foreach ($playerResults['Weapons'] as $weapon) { |
| 60 | 60 | if (isset($weapon['ActualDamage'])) { // Only set if the weapon hits |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $downgradeDamage = $results['Attackers']['TotalDamage'] - $totalShieldDamage; |
| 68 | 68 | $results['Attackers']['Downgrades'] = $port->checkForDowngrade($downgradeDamage); |
| 69 | 69 | |
| 70 | -$results['Port'] =& $port->shootPlayers($attackers); |
|
| 70 | +$results['Port'] = & $port->shootPlayers($attackers); |
|
| 71 | 71 | |
| 72 | 72 | $account->log(LOG_TYPE_PORT_RAIDING, 'Player attacks port, the port does ' . $results['Port']['TotalDamage'] . ', their team does ' . $results['Attackers']['TotalDamage'] . ' and downgrades ' . $results['Attackers']['Downgrades'] . ' levels.', $port->getSectorID()); |
| 73 | 73 | |
@@ -202,7 +202,7 @@ |
||
| 202 | 202 | AND receiver_delete = ' . $db->escapeBoolean(false) . ' |
| 203 | 203 | ORDER BY send_time DESC'); |
| 204 | 204 | while ($db->nextRecord()) { |
| 205 | - $groupBox =& $messageBox['GroupedMessages'][$db->getInt('sender_id')]; |
|
| 205 | + $groupBox = & $messageBox['GroupedMessages'][$db->getInt('sender_id')]; |
|
| 206 | 206 | // Limit the number of messages in each group |
| 207 | 207 | if (!isset($groupBox['Messages']) || count($groupBox['Messages']) < MESSAGE_SCOUT_GROUP_LIMIT) { |
| 208 | 208 | displayMessage($groupBox, $db->getInt('message_id'), $db->getInt('account_id'), $db->getInt('sender_id'), stripslashes($db->getField('message_text')), $db->getInt('send_time'), $db->getBoolean('msg_read'), MSG_SCOUT); |
@@ -1,91 +1,91 @@ |
||
| 1 | 1 | <?php declare(strict_types=1); |
| 2 | -$template->assign('PageTopic','Combat Simulator'); |
|
| 2 | +$template->assign('PageTopic', 'Combat Simulator'); |
|
| 3 | 3 | |
| 4 | -$template->assign('EditDummysLink',SmrSession::getNewHREF(create_container('skeleton.php','edit_dummys.php'))); |
|
| 4 | +$template->assign('EditDummysLink', SmrSession::getNewHREF(create_container('skeleton.php', 'edit_dummys.php'))); |
|
| 5 | 5 | $template->assign('DummyNames', DummyPlayer::getDummyPlayerNames()); |
| 6 | 6 | |
| 7 | 7 | $duplicates = false; |
| 8 | 8 | $usedNames = array(); |
| 9 | 9 | $realAttackers = array(); |
| 10 | 10 | $attackers = array(); |
| 11 | -$i=1; |
|
| 12 | -if(isset($_POST['attackers'])) |
|
| 13 | - foreach($_POST['attackers'] as $attackerName) { |
|
| 14 | - if($attackerName=='none') |
|
| 11 | +$i = 1; |
|
| 12 | +if (isset($_POST['attackers'])) |
|
| 13 | + foreach ($_POST['attackers'] as $attackerName) { |
|
| 14 | + if ($attackerName == 'none') |
|
| 15 | 15 | continue; |
| 16 | - if(isset($usedNames[$attackerName])) { |
|
| 16 | + if (isset($usedNames[$attackerName])) { |
|
| 17 | 17 | $duplicates = true; |
| 18 | 18 | continue; |
| 19 | 19 | } |
| 20 | 20 | $usedNames[$attackerName] = true; |
| 21 | - $attackers[$i] =& DummyPlayer::getCachedDummyPlayer($attackerName); |
|
| 21 | + $attackers[$i] = & DummyPlayer::getCachedDummyPlayer($attackerName); |
|
| 22 | 22 | $attackers[$i]->setAllianceID(1); |
| 23 | - $realAttackers[$i] =& $attackers[$i]; |
|
| 23 | + $realAttackers[$i] = & $attackers[$i]; |
|
| 24 | 24 | ++$i; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | -for(;$i<=10;++$i) |
|
| 27 | +for (;$i <= 10; ++$i) |
|
| 28 | 28 | $attackers[$i] = null; |
| 29 | -$template->assign('Attackers',$attackers); |
|
| 29 | +$template->assign('Attackers', $attackers); |
|
| 30 | 30 | |
| 31 | -$i=1; |
|
| 31 | +$i = 1; |
|
| 32 | 32 | $realDefenders = array(); |
| 33 | 33 | $defenders = array(); |
| 34 | -if(isset($_POST['defenders'])) |
|
| 35 | - foreach($_POST['defenders'] as $defenderName) { |
|
| 36 | - if($defenderName=='none') |
|
| 34 | +if (isset($_POST['defenders'])) |
|
| 35 | + foreach ($_POST['defenders'] as $defenderName) { |
|
| 36 | + if ($defenderName == 'none') |
|
| 37 | 37 | continue; |
| 38 | - if(isset($usedNames[$defenderName])) { |
|
| 38 | + if (isset($usedNames[$defenderName])) { |
|
| 39 | 39 | $duplicates = true; |
| 40 | 40 | continue; |
| 41 | 41 | } |
| 42 | 42 | $usedNames[$attackerName] = true; |
| 43 | - $defenders[$i] =& DummyPlayer::getCachedDummyPlayer($defenderName); |
|
| 43 | + $defenders[$i] = & DummyPlayer::getCachedDummyPlayer($defenderName); |
|
| 44 | 44 | $defenders[$i]->setAllianceID(2); |
| 45 | - $realDefenders[$i] =& $defenders[$i]; |
|
| 45 | + $realDefenders[$i] = & $defenders[$i]; |
|
| 46 | 46 | ++$i; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | -for(;$i<=10;++$i) |
|
| 49 | +for (;$i <= 10; ++$i) |
|
| 50 | 50 | $defenders[$i] = null; |
| 51 | -$template->assign('Defenders',$defenders); |
|
| 51 | +$template->assign('Defenders', $defenders); |
|
| 52 | 52 | |
| 53 | -$template->assign('Duplicates',$duplicates); |
|
| 53 | +$template->assign('Duplicates', $duplicates); |
|
| 54 | 54 | |
| 55 | -$template->assign('CombatSimHREF',SmrSession::getNewHREF(create_container('skeleton.php','combat_simulator.php'))); |
|
| 55 | +$template->assign('CombatSimHREF', SmrSession::getNewHREF(create_container('skeleton.php', 'combat_simulator.php'))); |
|
| 56 | 56 | |
| 57 | 57 | if (!empty($realAttackers) && !empty($realDefenders)) { |
| 58 | - if(isset($_REQUEST['run'])) { |
|
| 59 | - runAnAttack($realAttackers,$realDefenders); |
|
| 58 | + if (isset($_REQUEST['run'])) { |
|
| 59 | + runAnAttack($realAttackers, $realDefenders); |
|
| 60 | 60 | } |
| 61 | - if(isset($_REQUEST['death_run'])) { |
|
| 62 | - while(count($realAttackers)>0 && count($realDefenders)>0) { |
|
| 63 | - runAnAttack($realAttackers,$realDefenders); |
|
| 64 | - foreach($realAttackers as $key => &$teamPlayer) { |
|
| 65 | - if($teamPlayer->isDead()) |
|
| 61 | + if (isset($_REQUEST['death_run'])) { |
|
| 62 | + while (count($realAttackers) > 0 && count($realDefenders) > 0) { |
|
| 63 | + runAnAttack($realAttackers, $realDefenders); |
|
| 64 | + foreach ($realAttackers as $key => &$teamPlayer) { |
|
| 65 | + if ($teamPlayer->isDead()) |
|
| 66 | 66 | unset($realAttackers[$key]); |
| 67 | 67 | } unset($teamPlayer); |
| 68 | - foreach($realDefenders as $key => &$teamPlayer) { |
|
| 69 | - if($teamPlayer->isDead()) |
|
| 68 | + foreach ($realDefenders as $key => &$teamPlayer) { |
|
| 69 | + if ($teamPlayer->isDead()) |
|
| 70 | 70 | unset($realDefenders[$key]); |
| 71 | 71 | } unset($teamPlayer); |
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | -function runAnAttack($realAttackers,$realDefenders) { |
|
| 76 | +function runAnAttack($realAttackers, $realDefenders) { |
|
| 77 | 77 | global $template; |
| 78 | 78 | $results = array('Attackers' => array('Traders' => array(), 'TotalDamage' => 0), |
| 79 | 79 | 'Defenders' => array('Traders' => array(), 'TotalDamage' => 0)); |
| 80 | 80 | foreach ($realAttackers as $accountID => $teamPlayer) { |
| 81 | - $playerResults =& $teamPlayer->shootPlayers($realDefenders); |
|
| 82 | - $results['Attackers']['Traders'][] =& $playerResults; |
|
| 81 | + $playerResults = & $teamPlayer->shootPlayers($realDefenders); |
|
| 82 | + $results['Attackers']['Traders'][] = & $playerResults; |
|
| 83 | 83 | $results['Attackers']['TotalDamage'] += $playerResults['TotalDamage']; |
| 84 | 84 | } |
| 85 | 85 | foreach ($realDefenders as $accountID => $teamPlayer) { |
| 86 | - $playerResults =& $teamPlayer->shootPlayers($realAttackers); |
|
| 87 | - $results['Defenders']['Traders'][] =& $playerResults; |
|
| 86 | + $playerResults = & $teamPlayer->shootPlayers($realAttackers); |
|
| 87 | + $results['Defenders']['Traders'][] = & $playerResults; |
|
| 88 | 88 | $results['Defenders']['TotalDamage'] += $playerResults['TotalDamage']; |
| 89 | 89 | } |
| 90 | - $template->assign('TraderCombatResults',$results); |
|
| 90 | + $template->assign('TraderCombatResults', $results); |
|
| 91 | 91 | } |
@@ -10,22 +10,22 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | debug('Script started'); |
| 12 | 12 | define('SCRIPT_ID', $db->getInsertID()); |
| 13 | - $db->query('UPDATE npc_logs SET script_id='.SCRIPT_ID.' WHERE log_id='.SCRIPT_ID); |
|
| 13 | + $db->query('UPDATE npc_logs SET script_id=' . SCRIPT_ID . ' WHERE log_id=' . SCRIPT_ID); |
|
| 14 | 14 | |
| 15 | 15 | define('NPC_SCRIPT', true); |
| 16 | 16 | |
| 17 | 17 | $descriptorSpec = array( |
| 18 | - 0 => array("pipe", "r"), // stdin is a pipe that the child will read from |
|
| 18 | + 0 => array("pipe", "r"), // stdin is a pipe that the child will read from |
|
| 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; |
| 27 | 27 | stream_set_blocking($fromEngine, $block == true ? 1 : 0); |
| 28 | - while(($s = fgets($fromEngine)) !== false) { |
|
| 28 | + while (($s = fgets($fromEngine)) !== false) { |
|
| 29 | 29 | debug('<-- ' . trim($s)); |
| 30 | 30 | stream_set_blocking($fromEngine, 0); |
| 31 | 31 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | global $toEngine; |
| 35 | 35 | debug('--> ' . $s); |
| 36 | 36 | fputs($toEngine, $s . EOL); |
| 37 | - if($read === true) { |
|
| 37 | + if ($read === true) { |
|
| 38 | 38 | readFromEngine($block); |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | writeToEngine('isready'); |
| 46 | 46 | writeToEngine('ucinewgame', false); |
| 47 | 47 | |
| 48 | - while(true) { |
|
| 48 | + while (true) { |
|
| 49 | 49 | // The next "page request" must occur at an updated time. |
| 50 | 50 | SmrSession::updateTime(); |
| 51 | 51 | |
@@ -54,9 +54,9 @@ discard block |
||
| 54 | 54 | writeToEngine('position fen ' . $chessGame->getFENString(), false); |
| 55 | 55 | writeToEngine('go ' . ($chessGame->getCurrentTurnColour() == ChessGame::PLAYER_WHITE ? 'w' : 'b') . 'time ' . UCI_TIME_PER_MOVE_MS, true, false); |
| 56 | 56 | stream_set_blocking($fromEngine, 1); |
| 57 | - while(stripos($move = trim(fgets($fromEngine)), 'bestmove') !== 0) { |
|
| 57 | + while (stripos($move = trim(fgets($fromEngine)), 'bestmove') !== 0) { |
|
| 58 | 58 | debug('<-- ' . $move); |
| 59 | - if(stripos($move, 'Seg') === 0) { |
|
| 59 | + if (stripos($move, 'Seg') === 0) { |
|
| 60 | 60 | // Segfault |
| 61 | 61 | debug('UCI engine segfaulted?'); |
| 62 | 62 | exit; |
@@ -76,12 +76,12 @@ discard block |
||
| 76 | 76 | fclose($toEngine); |
| 77 | 77 | fclose($fromEngine); |
| 78 | 78 | proc_close($engine); |
| 79 | -} catch(Throwable $e) { |
|
| 79 | +} catch (Throwable $e) { |
|
| 80 | 80 | logException($e); |
| 81 | 81 | exit; |
| 82 | 82 | } |
| 83 | 83 | function debug($message, $debugObject = null) { |
| 84 | - global $account,$var,$db; |
|
| 85 | - echo date('Y-m-d H:i:s - ').$message.($debugObject!==null?EOL.var_export($debugObject,true):'').EOL; |
|
| 86 | - $db->query('INSERT INTO npc_logs (script_id, npc_id, time, message, debug_info, var) VALUES ('.(defined('SCRIPT_ID')?SCRIPT_ID:0).', '.(is_object($account)?$account->getAccountID():0).',NOW(),'.$db->escapeString($message).','.$db->escapeString(var_export($debugObject,true)).','.$db->escapeString(var_export($var,true)).')'); |
|
| 84 | + global $account, $var, $db; |
|
| 85 | + echo date('Y-m-d H:i:s - ') . $message . ($debugObject !== null ?EOL.var_export($debugObject, true) : '') . EOL; |
|
| 86 | + $db->query('INSERT INTO npc_logs (script_id, npc_id, time, message, debug_info, var) VALUES (' . (defined('SCRIPT_ID') ?SCRIPT_ID:0) . ', ' . (is_object($account) ? $account->getAccountID() : 0) . ',NOW(),' . $db->escapeString($message) . ',' . $db->escapeString(var_export($debugObject, true)) . ',' . $db->escapeString(var_export($var, true)) . ')'); |
|
| 87 | 87 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | try { |
| 122 | - $TRADE_ROUTE =& $GLOBALS['TRADE_ROUTE']; |
|
| 122 | + $TRADE_ROUTE = & $GLOBALS['TRADE_ROUTE']; |
|
| 123 | 123 | debug('Action #' . $actions); |
| 124 | 124 | |
| 125 | 125 | //We have to reload player on each loop |
@@ -138,14 +138,14 @@ discard block |
||
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | if (!isset($TRADE_ROUTE)) { //We only want to change trade route if there isn't already one set. |
| 141 | - $TRADE_ROUTES =& findRoutes($player); |
|
| 142 | - $TRADE_ROUTE =& changeRoute($TRADE_ROUTES); |
|
| 141 | + $TRADE_ROUTES = & findRoutes($player); |
|
| 142 | + $TRADE_ROUTE = & changeRoute($TRADE_ROUTES); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | if ($player->isDead()) { |
| 146 | 146 | debug('Some evil person killed us, let\'s move on now.'); |
| 147 | 147 | $previousContainer = null; //We died, we don't care what we were doing beforehand. |
| 148 | - $TRADE_ROUTE =& changeRoute($TRADE_ROUTES); //Change route |
|
| 148 | + $TRADE_ROUTE = & changeRoute($TRADE_ROUTES); //Change route |
|
| 149 | 149 | processContainer(create_container('death_processing.php')); |
| 150 | 150 | } |
| 151 | 151 | if ($player->getNewbieTurns() <= NEWBIE_TURNS_WARNING_LIMIT && $player->getNewbieWarning()) { |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | processContainer(tradeGoods($goodID, $player, $port)); |
| 228 | 228 | } else { |
| 229 | 229 | //Move to next route or fed. |
| 230 | - if (($TRADE_ROUTE =& changeRoute($TRADE_ROUTES)) === false) { |
|
| 230 | + if (($TRADE_ROUTE = & changeRoute($TRADE_ROUTES)) === false) { |
|
| 231 | 231 | debug('Changing Route Failed'); |
| 232 | 232 | processContainer(plotToFed($player)); |
| 233 | 233 | } else { |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | processContainer(tradeGoods($goodID, $player, $port)); |
| 255 | 255 | } else { |
| 256 | 256 | //Move to next route or fed. |
| 257 | - if (($TRADE_ROUTE =& changeRoute($TRADE_ROUTES)) === false) { |
|
| 257 | + if (($TRADE_ROUTE = & changeRoute($TRADE_ROUTES)) === false) { |
|
| 258 | 258 | debug('Changing Route Failed'); |
| 259 | 259 | processContainer(plotToFed($player)); |
| 260 | 260 | } else { |
@@ -586,9 +586,9 @@ discard block |
||
| 586 | 586 | return $false; |
| 587 | 587 | } |
| 588 | 588 | $routeKey = array_rand($tradeRoutes); |
| 589 | - $tradeRoute =& $tradeRoutes[$routeKey]; |
|
| 589 | + $tradeRoute = & $tradeRoutes[$routeKey]; |
|
| 590 | 590 | unset($tradeRoutes[$routeKey]); |
| 591 | - $GLOBALS['TRADE_ROUTE'] =& $tradeRoute; |
|
| 591 | + $GLOBALS['TRADE_ROUTE'] = & $tradeRoute; |
|
| 592 | 592 | debug('Switched route', $tradeRoute); |
| 593 | 593 | return $tradeRoute; |
| 594 | 594 | } |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | /** |
| 269 | 269 | * Insert a new player into the database. Returns the new player object. |
| 270 | 270 | */ |
| 271 | - public static function createPlayer($accountID, $gameID, $playerName, $raceID, $isNewbie, $npc=false) { |
|
| 271 | + public static function createPlayer($accountID, $gameID, $playerName, $raceID, $isNewbie, $npc = false) { |
|
| 272 | 272 | $db = MySqlDatabase::getInstance(); |
| 273 | 273 | $db->lockTable('player'); |
| 274 | 274 | |
@@ -1703,7 +1703,7 @@ discard block |
||
| 1703 | 1703 | create_error('The saved sector must be in the box!'); |
| 1704 | 1704 | } |
| 1705 | 1705 | |
| 1706 | - $storedDestinations =& $this->getStoredDestinations(); |
|
| 1706 | + $storedDestinations = & $this->getStoredDestinations(); |
|
| 1707 | 1707 | foreach ($storedDestinations as &$sd) { |
| 1708 | 1708 | if ($sd['SectorID'] == $sectorID) { |
| 1709 | 1709 | $sd['OffsetTop'] = $offsetTop; |
@@ -2030,13 +2030,13 @@ discard block |
||
| 2030 | 2030 | $this->db->query('SELECT type,amount FROM player_hof WHERE ' . $this->SQL); |
| 2031 | 2031 | $this->HOF = array(); |
| 2032 | 2032 | while ($this->db->nextRecord()) { |
| 2033 | - $hof =& $this->HOF; |
|
| 2033 | + $hof = & $this->HOF; |
|
| 2034 | 2034 | $typeList = explode(':', $this->db->getField('type')); |
| 2035 | 2035 | foreach ($typeList as $type) { |
| 2036 | 2036 | if (!isset($hof[$type])) { |
| 2037 | 2037 | $hof[$type] = array(); |
| 2038 | 2038 | } |
| 2039 | - $hof =& $hof[$type]; |
|
| 2039 | + $hof = & $hof[$type]; |
|
| 2040 | 2040 | } |
| 2041 | 2041 | $hof = $this->db->getFloat('amount'); |
| 2042 | 2042 | } |
@@ -2115,8 +2115,8 @@ discard block |
||
| 2115 | 2115 | } |
| 2116 | 2116 | self::$HOFVis[$hofType] = $visibility; |
| 2117 | 2117 | |
| 2118 | - $hof =& $this->HOF; |
|
| 2119 | - $hofChanged =& $this->hasHOFChanged; |
|
| 2118 | + $hof = & $this->HOF; |
|
| 2119 | + $hofChanged = & $this->hasHOFChanged; |
|
| 2120 | 2120 | $new = false; |
| 2121 | 2121 | foreach ($typeList as $type) { |
| 2122 | 2122 | if (!isset($hofChanged[$type])) { |
@@ -2126,8 +2126,8 @@ discard block |
||
| 2126 | 2126 | $hof[$type] = array(); |
| 2127 | 2127 | $new = true; |
| 2128 | 2128 | } |
| 2129 | - $hof =& $hof[$type]; |
|
| 2130 | - $hofChanged =& $hofChanged[$type]; |
|
| 2129 | + $hof = & $hof[$type]; |
|
| 2130 | + $hofChanged = & $hofChanged[$type]; |
|
| 2131 | 2131 | } |
| 2132 | 2132 | if ($hofChanged == null) { |
| 2133 | 2133 | $hofChanged = self::HOF_CHANGED; |
@@ -2730,7 +2730,7 @@ discard block |
||
| 2730 | 2730 | } |
| 2731 | 2731 | |
| 2732 | 2732 | private function setupMissionStep($missionID) { |
| 2733 | - $mission =& $this->missions[$missionID]; |
|
| 2733 | + $mission = & $this->missions[$missionID]; |
|
| 2734 | 2734 | if ($mission['On Step'] >= count(MISSIONS[$missionID]['Steps'])) { |
| 2735 | 2735 | // Nothing to do if this mission is already completed |
| 2736 | 2736 | return; |
@@ -2779,7 +2779,7 @@ discard block |
||
| 2779 | 2779 | 'Starting Sector' => $this->getSectorID() |
| 2780 | 2780 | ); |
| 2781 | 2781 | |
| 2782 | - $this->missions[$missionID] =& $mission; |
|
| 2782 | + $this->missions[$missionID] = & $mission; |
|
| 2783 | 2783 | $this->setupMissionStep($missionID); |
| 2784 | 2784 | $this->rebuildMission($missionID); |
| 2785 | 2785 | |
@@ -2829,7 +2829,7 @@ discard block |
||
| 2829 | 2829 | |
| 2830 | 2830 | public function claimMissionReward($missionID) { |
| 2831 | 2831 | $this->getMissions(); |
| 2832 | - $mission =& $this->missions[$missionID]; |
|
| 2832 | + $mission = & $this->missions[$missionID]; |
|
| 2833 | 2833 | if ($mission === false) { |
| 2834 | 2834 | throw new Exception('Unknown mission: ' . $missionID); |
| 2835 | 2835 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
| 198 | 198 | return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
| 199 | 199 | } |
| 200 | - $damage =& $this->getModifiedDamage(); |
|
| 200 | + $damage = & $this->getModifiedDamage(); |
|
| 201 | 201 | return $damage; |
| 202 | 202 | } |
| 203 | 203 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
| 207 | 207 | return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
| 208 | 208 | } |
| 209 | - $damage =& $this->getModifiedDamage(); |
|
| 209 | + $damage = & $this->getModifiedDamage(); |
|
| 210 | 210 | return $damage; |
| 211 | 211 | } |
| 212 | 212 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
| 216 | 216 | return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
| 217 | 217 | } |
| 218 | - $damage =& $this->getModifiedDamage(); |
|
| 218 | + $damage = & $this->getModifiedDamage(); |
|
| 219 | 219 | |
| 220 | 220 | $planetMod = self::PLANET_DAMAGE_MOD; |
| 221 | 221 | $damage['MaxDamage'] = ICeil($damage['MaxDamage'] * $planetMod); |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
| 236 | 236 | return $return; |
| 237 | 237 | } |
| 238 | - $damage =& $this->getModifiedDamage(); |
|
| 238 | + $damage = & $this->getModifiedDamage(); |
|
| 239 | 239 | return $damage; |
| 240 | 240 | } |
| 241 | 241 | |
@@ -361,26 +361,26 @@ |
||
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | public function isNPC() : bool { |
| 364 | - if(!isset($this->npc)) { |
|
| 365 | - $this->db->query('SELECT login FROM npc_logins WHERE login = '.$this->db->escapeString($this->getLogin()).' LIMIT 1;'); |
|
| 364 | + if (!isset($this->npc)) { |
|
| 365 | + $this->db->query('SELECT login FROM npc_logins WHERE login = ' . $this->db->escapeString($this->getLogin()) . ' LIMIT 1;'); |
|
| 366 | 366 | $this->npc = $this->db->nextRecord(); |
| 367 | 367 | } |
| 368 | 368 | return $this->npc; |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | protected function getHOFData() : void { |
| 372 | - if(!isset($this->HOF)) { |
|
| 372 | + if (!isset($this->HOF)) { |
|
| 373 | 373 | //Get Player HOF |
| 374 | 374 | $this->db->query('SELECT type,sum(amount) as amount FROM player_hof WHERE ' . $this->SQL . ' AND game_id IN (SELECT game_id FROM game WHERE ignore_stats = \'FALSE\') GROUP BY type'); |
| 375 | 375 | $this->HOF = array(); |
| 376 | - while($this->db->nextRecord()) { |
|
| 377 | - $hof =& $this->HOF; |
|
| 378 | - $typeList = explode(':',$this->db->getField('type')); |
|
| 379 | - foreach($typeList as $type) { |
|
| 380 | - if(!isset($hof[$type])) { |
|
| 376 | + while ($this->db->nextRecord()) { |
|
| 377 | + $hof = & $this->HOF; |
|
| 378 | + $typeList = explode(':', $this->db->getField('type')); |
|
| 379 | + foreach ($typeList as $type) { |
|
| 380 | + if (!isset($hof[$type])) { |
|
| 381 | 381 | $hof[$type] = array(); |
| 382 | 382 | } |
| 383 | - $hof =& $hof[$type]; |
|
| 383 | + $hof = & $hof[$type]; |
|
| 384 | 384 | } |
| 385 | 385 | $hof = $this->db->getFloat('amount'); |
| 386 | 386 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
| 133 | 133 | return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
| 134 | 134 | } |
| 135 | - $damage =& $this->getModifiedDamage(); |
|
| 135 | + $damage = & $this->getModifiedDamage(); |
|
| 136 | 136 | $damage['Launched'] = ICeil($this->getNumberOfCDs() * $this->getModifiedAccuracyAgainstForces($weaponPlayer, $forces) / 100); |
| 137 | 137 | $damage['Kamikaze'] = 0; |
| 138 | 138 | if ($weaponPlayer->isCombatDronesKamikazeOnMines()) { // If kamikaze then damage is same as MINE_ARMOUR |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
| 157 | 157 | return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
| 158 | 158 | } |
| 159 | - $damage =& $this->getModifiedDamage(); |
|
| 159 | + $damage = & $this->getModifiedDamage(); |
|
| 160 | 160 | $damage['Launched'] = ICeil($this->getNumberOfCDs() * $this->getModifiedAccuracyAgainstPort($weaponPlayer, $port) / 100); |
| 161 | 161 | $damage['MaxDamage'] = ICeil($damage['Launched'] * $damage['MaxDamage']); |
| 162 | 162 | $damage['Shield'] = ICeil($damage['Launched'] * $damage['Shield']); |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
| 171 | 171 | return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
| 172 | 172 | } |
| 173 | - $damage =& $this->getModifiedDamage(); |
|
| 173 | + $damage = & $this->getModifiedDamage(); |
|
| 174 | 174 | $damage['Launched'] = ICeil($this->getNumberOfCDs() * $this->getModifiedAccuracyAgainstPlanet($weaponPlayer, $planet) / 100); |
| 175 | 175 | $planetMod = self::PLANET_DAMAGE_MOD; |
| 176 | 176 | $damage['MaxDamage'] = ICeil($damage['Launched'] * $damage['MaxDamage'] * $planetMod); |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
| 186 | 186 | return $return; |
| 187 | 187 | } |
| 188 | - $damage =& $this->getModifiedDamage(); |
|
| 188 | + $damage = & $this->getModifiedDamage(); |
|
| 189 | 189 | if ($targetPlayer->getShip()->hasDCS()) { |
| 190 | 190 | $damage['MaxDamage'] *= DCS_PLAYER_DAMAGE_DECIMAL_PERCENT; |
| 191 | 191 | $damage['Shield'] *= DCS_PLAYER_DAMAGE_DECIMAL_PERCENT; |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
| 204 | 204 | return $return; |
| 205 | 205 | } |
| 206 | - $damage =& $this->getModifiedDamage(); |
|
| 206 | + $damage = & $this->getModifiedDamage(); |
|
| 207 | 207 | |
| 208 | 208 | if ($targetPlayer->getShip()->hasDCS()) { |
| 209 | 209 | $damage['MaxDamage'] *= DCS_FORCE_DAMAGE_DECIMAL_PERCENT; |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
| 224 | 224 | return $return; |
| 225 | 225 | } |
| 226 | - $damage =& $this->getModifiedDamage(); |
|
| 226 | + $damage = & $this->getModifiedDamage(); |
|
| 227 | 227 | |
| 228 | 228 | if ($targetPlayer->getShip()->hasDCS()) { |
| 229 | 229 | $damage['MaxDamage'] *= DCS_PORT_DAMAGE_DECIMAL_PERCENT; |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | $return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
| 243 | 243 | return $return; |
| 244 | 244 | } |
| 245 | - $damage =& $this->getModifiedDamage(); |
|
| 245 | + $damage = & $this->getModifiedDamage(); |
|
| 246 | 246 | |
| 247 | 247 | if ($targetPlayer->getShip()->hasDCS()) { |
| 248 | 248 | $damage['MaxDamage'] *= DCS_PLANET_DAMAGE_DECIMAL_PERCENT; |