We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -2,8 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | // Get the dates ("|" sets hr/min/sec to 0) |
| 4 | 4 | $join = DateTime::createFromFormat('d/m/Y|', Request::get('game_join')); |
| 5 | -$start = empty(Request::get('game_start')) ? $join : |
|
| 6 | - DateTime::createFromFormat('d/m/Y|', Request::get('game_start')); |
|
| 5 | +$start = empty(Request::get('game_start')) ? $join : DateTime::createFromFormat('d/m/Y|', Request::get('game_start')); |
|
| 7 | 6 | $end = DateTime::createFromFormat('d/m/Y|', Request::get('game_end')); |
| 8 | 7 | |
| 9 | 8 | $game = SmrGame::getGame($var['game_id']); |
@@ -20,13 +20,13 @@ |
||
| 20 | 20 | const USER_SCORE_NAME = 'User Score'; |
| 21 | 21 | $hofTypes = array(DONATION_NAME=>true, USER_SCORE_NAME=>true); |
| 22 | 22 | while ($db->nextRecord()) { |
| 23 | - $hof =& $hofTypes; |
|
| 23 | + $hof = & $hofTypes; |
|
| 24 | 24 | $typeList = explode(':', $db->getField('type')); |
| 25 | 25 | foreach ($typeList as $type) { |
| 26 | 26 | if (!isset($hof[$type])) { |
| 27 | 27 | $hof[$type] = array(); |
| 28 | 28 | } |
| 29 | - $hof =& $hof[$type]; |
|
| 29 | + $hof = & $hof[$type]; |
|
| 30 | 30 | } |
| 31 | 31 | $hof = true; |
| 32 | 32 | } |
@@ -19,8 +19,7 @@ discard block |
||
| 19 | 19 | $shareFrom[$fromAccountId] = array( |
| 20 | 20 | 'Player ID' => $otherPlayer == null ? '-' : $otherPlayer->getPlayerID(), |
| 21 | 21 | 'Player Name' => $otherPlayer == null ? |
| 22 | - '<b>Account</b>: ' . SmrAccount::getAccount($fromAccountId)->getHofDisplayName() : |
|
| 23 | - $otherPlayer->getDisplayName(), |
|
| 22 | + '<b>Account</b>: ' . SmrAccount::getAccount($fromAccountId)->getHofDisplayName() : $otherPlayer->getDisplayName(), |
|
| 24 | 23 | 'All Games' => $gameId == 0 ? '<span class="green">YES</span>' : '<span class="red">NO</span>', |
| 25 | 24 | 'Game ID' => $gameId, |
| 26 | 25 | ); |
@@ -40,8 +39,7 @@ discard block |
||
| 40 | 39 | $shareTo[$toAccountId] = array( |
| 41 | 40 | 'Player ID' => $otherPlayer == null ? '-' : $otherPlayer->getPlayerID(), |
| 42 | 41 | 'Player Name' => $otherPlayer == null ? |
| 43 | - '<b>Account</b>: ' . SmrAccount::getAccount($toAccountId)->getHofDisplayName() : |
|
| 44 | - $otherPlayer->getDisplayName(), |
|
| 42 | + '<b>Account</b>: ' . SmrAccount::getAccount($toAccountId)->getHofDisplayName() : $otherPlayer->getDisplayName(), |
|
| 45 | 43 | 'All Games' => $gameId == 0 ? '<span class="green">YES</span>' : '<span class="red">NO</span>', |
| 46 | 44 | 'Game ID' => $gameId, |
| 47 | 45 | ); |
@@ -20,13 +20,13 @@ |
||
| 20 | 20 | const USER_SCORE_NAME = 'User Score'; |
| 21 | 21 | $hofTypes = array(DONATION_NAME=>true, USER_SCORE_NAME=>true); |
| 22 | 22 | while ($db->nextRecord()) { |
| 23 | - $hof =& $hofTypes; |
|
| 23 | + $hof = & $hofTypes; |
|
| 24 | 24 | $typeList = explode(':', $db->getField('type')); |
| 25 | 25 | foreach ($typeList as $type) { |
| 26 | 26 | if (!isset($hof[$type])) { |
| 27 | 27 | $hof[$type] = array(); |
| 28 | 28 | } |
| 29 | - $hof =& $hof[$type]; |
|
| 29 | + $hof = & $hof[$type]; |
|
| 30 | 30 | } |
| 31 | 31 | $hof = true; |
| 32 | 32 | } |
@@ -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); |
@@ -9,10 +9,11 @@ discard block |
||
| 9 | 9 | $realAttackers = array(); |
| 10 | 10 | $attackers = array(); |
| 11 | 11 | $i=1; |
| 12 | -if(isset($_POST['attackers'])) |
|
| 12 | +if(isset($_POST['attackers'])) { |
|
| 13 | 13 | foreach($_POST['attackers'] as $attackerName) { |
| 14 | 14 | if($attackerName=='none') |
| 15 | 15 | continue; |
| 16 | +} |
|
| 16 | 17 | if(isset($usedNames[$attackerName])) { |
| 17 | 18 | $duplicates = true; |
| 18 | 19 | continue; |
@@ -24,17 +25,19 @@ discard block |
||
| 24 | 25 | ++$i; |
| 25 | 26 | } |
| 26 | 27 | |
| 27 | -for(;$i<=10;++$i) |
|
| 28 | +for(;$i<=10;++$i) { |
|
| 28 | 29 | $attackers[$i] = null; |
| 30 | +} |
|
| 29 | 31 | $template->assign('Attackers',$attackers); |
| 30 | 32 | |
| 31 | 33 | $i=1; |
| 32 | 34 | $realDefenders = array(); |
| 33 | 35 | $defenders = array(); |
| 34 | -if(isset($_POST['defenders'])) |
|
| 36 | +if(isset($_POST['defenders'])) { |
|
| 35 | 37 | foreach($_POST['defenders'] as $defenderName) { |
| 36 | 38 | if($defenderName=='none') |
| 37 | 39 | continue; |
| 40 | +} |
|
| 38 | 41 | if(isset($usedNames[$defenderName])) { |
| 39 | 42 | $duplicates = true; |
| 40 | 43 | continue; |
@@ -46,8 +49,9 @@ discard block |
||
| 46 | 49 | ++$i; |
| 47 | 50 | } |
| 48 | 51 | |
| 49 | -for(;$i<=10;++$i) |
|
| 52 | +for(;$i<=10;++$i) { |
|
| 50 | 53 | $defenders[$i] = null; |
| 54 | +} |
|
| 51 | 55 | $template->assign('Defenders',$defenders); |
| 52 | 56 | |
| 53 | 57 | $template->assign('Duplicates',$duplicates); |
@@ -62,12 +66,14 @@ discard block |
||
| 62 | 66 | while(count($realAttackers)>0 && count($realDefenders)>0) { |
| 63 | 67 | runAnAttack($realAttackers,$realDefenders); |
| 64 | 68 | foreach($realAttackers as $key => &$teamPlayer) { |
| 65 | - if($teamPlayer->isDead()) |
|
| 66 | - unset($realAttackers[$key]); |
|
| 69 | + if($teamPlayer->isDead()) { |
|
| 70 | + unset($realAttackers[$key]); |
|
| 71 | + } |
|
| 67 | 72 | } unset($teamPlayer); |
| 68 | 73 | foreach($realDefenders as $key => &$teamPlayer) { |
| 69 | - if($teamPlayer->isDead()) |
|
| 70 | - unset($realDefenders[$key]); |
|
| 74 | + if($teamPlayer->isDead()) { |
|
| 75 | + unset($realDefenders[$key]); |
|
| 76 | + } |
|
| 71 | 77 | } unset($teamPlayer); |
| 72 | 78 | } |
| 73 | 79 | } |
@@ -1,79 +1,79 @@ discard block |
||
| 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)); |
@@ -84,8 +84,8 @@ discard block |
||
| 84 | 84 | } |
| 85 | 85 | foreach ($realDefenders as $accountID => $teamPlayer) { |
| 86 | 86 | $playerResults = $teamPlayer->shootPlayers($realAttackers); |
| 87 | - $results['Defenders']['Traders'][] = $playerResults; |
|
| 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 | } |
@@ -76,8 +76,13 @@ discard block |
||
| 76 | 76 | <input type="number" name="amount" value="0" min="<?php echo MIN_GLOBAL_RELATIONS; ?>" max="<?php echo MAX_GLOBAL_RELATIONS; ?>" style="width:75px" /> |
| 77 | 77 | <select name="race"><?php |
| 78 | 78 | foreach (Globals::getRaces() as $race) { |
| 79 | - if ($race['Race ID'] == $ThisPlayer->getRaceID()) continue; |
|
| 80 | - if ($race['Race ID'] == RACE_NEUTRAL) continue; ?> |
|
| 79 | + if ($race['Race ID'] == $ThisPlayer->getRaceID()) { |
|
| 80 | + continue; |
|
| 81 | + } |
|
| 82 | + if ($race['Race ID'] == RACE_NEUTRAL) { |
|
| 83 | + continue; |
|
| 84 | + } |
|
| 85 | + ?> |
|
| 81 | 86 | <option value="<?php echo $race['Race ID']; ?>"><?php echo $race['Race Name']; ?></option><?php |
| 82 | 87 | } ?> |
| 83 | 88 | </select> |
@@ -88,8 +93,13 @@ discard block |
||
| 88 | 93 | <form method="POST" action="<?php echo $ChangeRaceHREF; ?>"> |
| 89 | 94 | <select name="race"><?php |
| 90 | 95 | foreach (Globals::getRaces() as $race) { |
| 91 | - if ($race['Race ID'] == $ThisPlayer->getRaceID()) continue; |
|
| 92 | - if ($race['Race ID'] == RACE_NEUTRAL) continue; ?> |
|
| 96 | + if ($race['Race ID'] == $ThisPlayer->getRaceID()) { |
|
| 97 | + continue; |
|
| 98 | + } |
|
| 99 | + if ($race['Race ID'] == RACE_NEUTRAL) { |
|
| 100 | + continue; |
|
| 101 | + } |
|
| 102 | + ?> |
|
| 93 | 103 | <option value="<?php echo $race['Race ID']; ?>"><?php echo $race['Race Name']; ?></option><?php |
| 94 | 104 | } ?> |
| 95 | 105 | </select> |
@@ -10,7 +10,10 @@ |
||
| 10 | 10 | <td style="width: 80%" class="center"> |
| 11 | 11 | Local Map of the Known <span class="big bold"><?php echo $GalaxyName ?></span> Galaxy |
| 12 | 12 | <br /><br /> |
| 13 | - <?php if (isset($Error)) echo $Error; ?> |
|
| 13 | + <?php if (isset($Error)) { |
|
| 14 | + echo $Error; |
|
| 15 | +} |
|
| 16 | +?> |
|
| 14 | 17 | </td> |
| 15 | 18 | <td style="width: 10%"></td> |
| 16 | 19 | </tr> |
@@ -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 | } |