We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -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,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 | } |
@@ -50,9 +50,9 @@ |
||
| 50 | 50 | //get base for ports that dont happen to trade that good |
| 51 | 51 | $GOODS = Globals::getGoods(); |
| 52 | 52 | $fine = $totalFine = $port->getLevel() * |
| 53 | - (($ship->getCargo(GOODS_SLAVES) * $GOODS[GOODS_SLAVES]['BasePrice']) + |
|
| 54 | - ($ship->getCargo(GOODS_WEAPONS) * $GOODS[GOODS_WEAPONS]['BasePrice']) + |
|
| 55 | - ($ship->getCargo(GOODS_NARCOTICS) * $GOODS[GOODS_NARCOTICS]['BasePrice'])); |
|
| 53 | + (($ship->getCargo(GOODS_SLAVES) * $GOODS[GOODS_SLAVES]['BasePrice']) + |
|
| 54 | + ($ship->getCargo(GOODS_WEAPONS) * $GOODS[GOODS_WEAPONS]['BasePrice']) + |
|
| 55 | + ($ship->getCargo(GOODS_NARCOTICS) * $GOODS[GOODS_NARCOTICS]['BasePrice'])); |
|
| 56 | 56 | $player->increaseHOF($ship->getCargo(GOODS_SLAVES) + $ship->getCargo(GOODS_WEAPONS) + $ship->getCargo(GOODS_NARCOTICS), array('Trade', 'Search', 'Caught', 'Goods Confiscated'), HOF_PUBLIC); |
| 57 | 57 | $player->increaseHOF($totalFine, array('Trade', 'Search', 'Caught', 'Amount Fined'), HOF_PUBLIC); |
| 58 | 58 | $template->assign('TotalFine', $totalFine); |
@@ -74,7 +74,7 @@ |
||
| 74 | 74 | </center><?php |
| 75 | 75 | |
| 76 | 76 | } elseif (in_array($type, ['search', 'alliance_ips', 'wild_log', 'wild_in', |
| 77 | - 'compare', 'compare_log', 'wild_ip', 'wild_host'])) { ?> |
|
| 77 | + 'compare', 'compare_log', 'wild_ip', 'wild_host'])) { ?> |
|
| 78 | 78 | |
| 79 | 79 | <center> |
| 80 | 80 | <?php echo $Summary; ?><br /><br /> |
@@ -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> |
@@ -337,8 +337,8 @@ |
||
| 337 | 337 | foreach (Globals::getAvailableTemplates() as $Template) { |
| 338 | 338 | foreach (Globals::getAvailableColourSchemes($Template) as $ColourScheme) { |
| 339 | 339 | $selected = ($ThisAccount->getTemplate() == $Template && |
| 340 | - $ThisAccount->getColourScheme() == $ColourScheme && |
|
| 341 | - $ThisAccount->isDefaultCSSEnabled()) ? 'selected' : ''; |
|
| 340 | + $ThisAccount->getColourScheme() == $ColourScheme && |
|
| 341 | + $ThisAccount->isDefaultCSSEnabled()) ? 'selected' : ''; |
|
| 342 | 342 | $name = $Template . ' - ' . $ColourScheme; |
| 343 | 343 | ?><option value="<?php echo $name; ?>" <?php echo $selected; ?>><?php echo $name; ?></option><?php |
| 344 | 344 | } |
@@ -68,8 +68,7 @@ |
||
| 68 | 68 | |
| 69 | 69 | </body> |
| 70 | 70 | </html><?php |
| 71 | -} |
|
| 72 | -catch (Throwable $e) { |
|
| 71 | +} catch (Throwable $e) { |
|
| 73 | 72 | handleException($e); |
| 74 | 73 | } |
| 75 | 74 | ?> |
@@ -69,7 +69,7 @@ |
||
| 69 | 69 | exit; |
| 70 | 70 | } |
| 71 | 71 | $account->addAuthMethod($_SESSION['socialLogin']->getLoginType(), |
| 72 | - $_SESSION['socialLogin']->getUserID()); |
|
| 72 | + $_SESSION['socialLogin']->getUserID()); |
|
| 73 | 73 | session_destroy(); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -150,7 +150,7 @@ |
||
| 150 | 150 | $account->increaseSmrRewardCredits(2 * CREDITS_PER_DOLLAR); // Give $2 worth of "reward" credits for joining. |
| 151 | 151 | if ($socialLogin) { |
| 152 | 152 | $account->addAuthMethod($_SESSION['socialLogin']->getLoginType(), |
| 153 | - $_SESSION['socialLogin']->getUserID()); |
|
| 153 | + $_SESSION['socialLogin']->getUserID()); |
|
| 154 | 154 | if ($validatedBySocial) { |
| 155 | 155 | $account->setValidated(true); |
| 156 | 156 | $account->update(); |