We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -32,11 +32,16 @@ discard block |
||
32 | 32 | $ship->increaseHardware($hardware_id, $amount); |
33 | 33 | |
34 | 34 | //HoF |
35 | - if ($hardware_id == HARDWARE_COMBAT) $player->increaseHOF($amount, array('Forces', 'Bought', 'Combat Drones'), HOF_ALLIANCE); |
|
36 | - if ($hardware_id == HARDWARE_SCOUT) $player->increaseHOF($amount, array('Forces', 'Bought', 'Scout Drones'), HOF_ALLIANCE); |
|
37 | - if ($hardware_id == HARDWARE_MINE) $player->increaseHOF($amount, array('Forces', 'Bought', 'Mines'), HOF_ALLIANCE); |
|
38 | -} |
|
39 | -else if ($action == 'Sell') { |
|
35 | + if ($hardware_id == HARDWARE_COMBAT) { |
|
36 | + $player->increaseHOF($amount, array('Forces', 'Bought', 'Combat Drones'), HOF_ALLIANCE); |
|
37 | + } |
|
38 | + if ($hardware_id == HARDWARE_SCOUT) { |
|
39 | + $player->increaseHOF($amount, array('Forces', 'Bought', 'Scout Drones'), HOF_ALLIANCE); |
|
40 | + } |
|
41 | + if ($hardware_id == HARDWARE_MINE) { |
|
42 | + $player->increaseHOF($amount, array('Forces', 'Bought', 'Mines'), HOF_ALLIANCE); |
|
43 | + } |
|
44 | + } else if ($action == 'Sell') { |
|
40 | 45 | // We only allow selling combat drones |
41 | 46 | if ($hardware_id != HARDWARE_COMBAT) { |
42 | 47 | throw new Exception('This item cannot be sold!'); |
@@ -49,8 +54,7 @@ discard block |
||
49 | 54 | |
50 | 55 | $player->increaseCredits(IRound($cost * CDS_REFUND_PERCENT) * $amount); |
51 | 56 | $ship->decreaseCDs($amount, true); // 2nd arg avoids under attack warning |
52 | -} |
|
53 | -else { |
|
57 | +} else { |
|
54 | 58 | throw new Exception('Action must be either Buy or Sell.'); |
55 | 59 | } |
56 | 60 |
@@ -28,8 +28,7 @@ |
||
28 | 28 | $player->decreaseCredits($amount); |
29 | 29 | $planet->increaseCredits($amount); |
30 | 30 | $account->log(LOG_TYPE_BANK, 'Player puts ' . $amount . ' credits on planet', $player->getSectorID()); |
31 | - } |
|
32 | - elseif ($action == 'Withdraw') { |
|
31 | + } elseif ($action == 'Withdraw') { |
|
33 | 32 | if ($planet->getCredits() < $amount) { |
34 | 33 | create_error('There are not enough credits in the planetary account!'); |
35 | 34 | } |
@@ -193,22 +193,28 @@ |
||
193 | 193 | } |
194 | 194 | |
195 | 195 | public function &getModifiedDamageAgainstForces(AbstractSmrPlayer $weaponPlayer, SmrForce $forces) { |
196 | - if (!$this->canShootForces()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
|
196 | + if (!$this->canShootForces()) { |
|
197 | + // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
|
197 | 198 | return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
199 | + } |
|
198 | 200 | $damage =& $this->getModifiedDamage(); |
199 | 201 | return $damage; |
200 | 202 | } |
201 | 203 | |
202 | 204 | public function &getModifiedDamageAgainstPort(AbstractSmrPlayer $weaponPlayer, SmrPort $port) { |
203 | - if (!$this->canShootPorts()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
|
205 | + if (!$this->canShootPorts()) { |
|
206 | + // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
|
204 | 207 | return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
208 | + } |
|
205 | 209 | $damage =& $this->getModifiedDamage(); |
206 | 210 | return $damage; |
207 | 211 | } |
208 | 212 | |
209 | 213 | public function &getModifiedDamageAgainstPlanet(AbstractSmrPlayer $weaponPlayer, SmrPlanet $planet) { |
210 | - if (!$this->canShootPlanets()) // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
|
214 | + if (!$this->canShootPlanets()) { |
|
215 | + // If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods. |
|
211 | 216 | return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover()); |
217 | + } |
|
212 | 218 | $damage =& $this->getModifiedDamage(); |
213 | 219 | |
214 | 220 | $planetMod = self::PLANET_DAMAGE_MOD; |
@@ -58,8 +58,7 @@ discard block |
||
58 | 58 | $mpr = new MultiplePortRoute($routeToContinue, $currentStepRoute); |
59 | 59 | self::addExpRoute($mpr); |
60 | 60 | self::addMoneyRoute($mpr); |
61 | - } |
|
62 | - else if ($maxNumPorts > 1 && !$routeToContinue->containsPort($currentStepBuySector)) { |
|
61 | + } else if ($maxNumPorts > 1 && !$routeToContinue->containsPort($currentStepBuySector)) { |
|
63 | 62 | $mpr = new MultiplePortRoute($routeToContinue, $currentStepRoute); |
64 | 63 | self::getContinueRoutes($maxNumPorts - 1, $startSectorId, $mpr, $routeLists[$currentStepBuySector], $routeLists, $lastGoodIsNothing); |
65 | 64 | } |
@@ -168,11 +167,9 @@ discard block |
||
168 | 167 | foreach (self::$expRoutes as $multi => $routesByMulti) { |
169 | 168 | if(count($routesByMulti)+$i < $trimToBestXRoutes) { |
170 | 169 | $i += count($routesByMulti); |
171 | - } |
|
172 | - else if($i > $trimToBestXRoutes) { |
|
170 | + } else if($i > $trimToBestXRoutes) { |
|
173 | 171 | unset(self::$expRoutes[$multi]); |
174 | - } |
|
175 | - else { |
|
172 | + } else { |
|
176 | 173 | foreach($routesByMulti as $key => $value) { |
177 | 174 | $i++; |
178 | 175 | if($i < $trimToBestXRoutes) { |
@@ -192,12 +189,10 @@ discard block |
||
192 | 189 | foreach (self::$moneyRoutes as $multi => $routesByMulti) { |
193 | 190 | if(count($routesByMulti)+$i < $trimToBestXRoutes) { |
194 | 191 | $i += count($routesByMulti); |
195 | - } |
|
196 | - else if($i > $trimToBestXRoutes) { |
|
192 | + } else if($i > $trimToBestXRoutes) { |
|
197 | 193 | unset(self::$moneyRoutes[$multi]); |
198 | 194 | continue; |
199 | - } |
|
200 | - else { |
|
195 | + } else { |
|
201 | 196 | foreach($routesByMulti as $key => $value) { |
202 | 197 | $i++; |
203 | 198 | if($i < $trimToBestXRoutes) { |
@@ -8,8 +8,7 @@ |
||
8 | 8 | foreach ($_REQUEST['message_id'] as $id) { |
9 | 9 | $db->query('DELETE FROM message_boxes WHERE message_id = ' . $db->escapeNumber($id)); |
10 | 10 | } |
11 | -} |
|
12 | -else if ($action == 'All Messages') { |
|
11 | +} else if ($action == 'All Messages') { |
|
13 | 12 | if (!isset($var['box_type_id'])) { |
14 | 13 | create_error('No box selected.'); |
15 | 14 | } |
@@ -74,9 +74,15 @@ discard block |
||
74 | 74 | // Must not call `get_file_loc` until after we have set $overrideGameID |
75 | 75 | // (unless we're exiting immediately with an error, as above). |
76 | 76 | $overrideGameID = 0; |
77 | - if (isset($var['game_id']) && is_numeric($var['game_id'])) $overrideGameID = $var['game_id']; |
|
78 | - if ($overrideGameID == 0 && isset($var['GameID']) && is_numeric($var['GameID'])) $overrideGameID = $var['GameID']; |
|
79 | - if ($overrideGameID == 0) $overrideGameID = SmrSession::getGameID(); |
|
77 | + if (isset($var['game_id']) && is_numeric($var['game_id'])) { |
|
78 | + $overrideGameID = $var['game_id']; |
|
79 | + } |
|
80 | + if ($overrideGameID == 0 && isset($var['GameID']) && is_numeric($var['GameID'])) { |
|
81 | + $overrideGameID = $var['GameID']; |
|
82 | + } |
|
83 | + if ($overrideGameID == 0) { |
|
84 | + $overrideGameID = SmrSession::getGameID(); |
|
85 | + } |
|
80 | 86 | |
81 | 87 | require_once(get_file_loc('smr.inc')); |
82 | 88 | |
@@ -92,22 +98,19 @@ discard block |
||
92 | 98 | } else { |
93 | 99 | forward(create_container('skeleton.php', 'invalid_email.php')); |
94 | 100 | } |
95 | - } |
|
96 | - else if ($disabled['Reason'] == CLOSE_ACCOUNT_BY_REQUEST_REASON) { |
|
101 | + } else if ($disabled['Reason'] == CLOSE_ACCOUNT_BY_REQUEST_REASON) { |
|
97 | 102 | if (isset($var['do_reopen_account'])) { |
98 | 103 | // The user has requested to reopen their account |
99 | 104 | $account->unbanAccount($account); |
100 | 105 | } else { |
101 | 106 | forward(create_container('skeleton.php', 'reopen_account.php')); |
102 | 107 | } |
103 | - } |
|
104 | - else { |
|
108 | + } else { |
|
105 | 109 | forward(create_container('disabled.php')); |
106 | 110 | } |
107 | 111 | } |
108 | 112 | |
109 | 113 | do_voodoo(); |
110 | -} |
|
111 | -catch (Throwable $e) { |
|
114 | +} catch (Throwable $e) { |
|
112 | 115 | handleException($e); |
113 | 116 | } |
@@ -104,13 +104,15 @@ |
||
104 | 104 | $numberOfPlanets = $_POST['type' . $planetTypeID]; |
105 | 105 | for ($i = 1; $i <= $numberOfPlanets; $i++) { |
106 | 106 | $galSector = $galSectors[array_rand($galSectors)]; |
107 | - while ($galSector->hasPlanet()) $galSector = $galSectors[array_rand($galSectors)]; //1 per sector |
|
107 | + while ($galSector->hasPlanet()) { |
|
108 | + $galSector = $galSectors[array_rand($galSectors)]; |
|
109 | + } |
|
110 | + //1 per sector |
|
108 | 111 | $galSector->createPlanet($planetTypeID); |
109 | 112 | } |
110 | 113 | } |
111 | 114 | $var['message'] = '<span class="green">Success</span> : Succesfully added planets.'; |
112 | -} |
|
113 | -elseif ($submit == 'Create Ports') { |
|
115 | +} elseif ($submit == 'Create Ports') { |
|
114 | 116 | $numLevelPorts = []; |
115 | 117 | for ($i = 1; $i <= SmrPort::MAX_LEVEL; $i++) { |
116 | 118 | $numLevelPorts[$i] = $_REQUEST['port' . $i] ?? 0; |
@@ -239,8 +239,7 @@ |
||
239 | 239 | if (empty($this->hofName)) { |
240 | 240 | $this->hofName = $this->login; |
241 | 241 | } |
242 | - } |
|
243 | - else { |
|
242 | + } else { |
|
244 | 243 | throw new AccountNotFoundException('Account ID ' . $accountID . ' does not exist!'); |
245 | 244 | } |
246 | 245 | } |
@@ -469,8 +469,9 @@ |
||
469 | 469 | |
470 | 470 | if (!$player->isDead() && $player->getNewbieTurns() <= NEWBIE_TURNS_WARNING_LIMIT && |
471 | 471 | $player->getNewbieWarning() && |
472 | - $var['url'] != 'newbie_warning_processing.php') |
|
473 | - forward(create_container('newbie_warning_processing.php')); |
|
472 | + $var['url'] != 'newbie_warning_processing.php') { |
|
473 | + forward(create_container('newbie_warning_processing.php')); |
|
474 | + } |
|
474 | 475 | } |
475 | 476 | |
476 | 477 | // Initialize the template |