We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -79,8 +79,7 @@ |
||
79 | 79 | fclose($toEngine); |
80 | 80 | fclose($fromEngine); |
81 | 81 | proc_close($engine); |
82 | -} |
|
83 | -catch(Throwable $e) { |
|
82 | +} catch(Throwable $e) { |
|
84 | 83 | logException($e); |
85 | 84 | exit; |
86 | 85 | } |
@@ -33,12 +33,24 @@ |
||
33 | 33 | $template->assign('HardwareHREF', SmrSession::getNewHREF($container)); |
34 | 34 | |
35 | 35 | $hardware = []; |
36 | -if ($ship->canHaveScanner()) $hardware[] = 'Scanner'; |
|
37 | -if ($ship->canHaveIllusion()) $hardware[] = 'Illusion Generator'; |
|
38 | -if ($ship->canHaveCloak()) $hardware[] = 'Cloaking Device'; |
|
39 | -if ($ship->canHaveJump()) $hardware[] = 'Jump Drive'; |
|
40 | -if ($ship->canHaveDCS()) $hardware[] = 'Drone Scrambler'; |
|
41 | -if (empty($hardware)) $hardware[] = 'none'; |
|
36 | +if ($ship->canHaveScanner()) { |
|
37 | + $hardware[] = 'Scanner'; |
|
38 | +} |
|
39 | +if ($ship->canHaveIllusion()) { |
|
40 | + $hardware[] = 'Illusion Generator'; |
|
41 | +} |
|
42 | +if ($ship->canHaveCloak()) { |
|
43 | + $hardware[] = 'Cloaking Device'; |
|
44 | +} |
|
45 | +if ($ship->canHaveJump()) { |
|
46 | + $hardware[] = 'Jump Drive'; |
|
47 | +} |
|
48 | +if ($ship->canHaveDCS()) { |
|
49 | + $hardware[] = 'Drone Scrambler'; |
|
50 | +} |
|
51 | +if (empty($hardware)) { |
|
52 | + $hardware[] = 'none'; |
|
53 | +} |
|
42 | 54 | $template->assign('Hardware', $hardware); |
43 | 55 | |
44 | 56 | $db->query('SELECT level_name,requirement FROM level WHERE requirement>' . $db->escapeNumber($player->getExperience()) . ' ORDER BY requirement ASC LIMIT 1'); |
@@ -17,21 +17,23 @@ discard block |
||
17 | 17 | // iterate over all forces in the target sector |
18 | 18 | foreach ($scanSector->getForces() as $scanSectorForces) { |
19 | 19 | // decide if it's a friendly or enemy stack |
20 | - if ($player->sameAlliance($scanSectorForces->getOwner())) |
|
21 | - $friendly_forces += $scanSectorForces->getMines() * 3 + $scanSectorForces->getCDs() * 2 + $scanSectorForces->getSDs(); |
|
22 | - else |
|
23 | - $enemy_forces += $scanSectorForces->getMines() * 3 + $scanSectorForces->getCDs() * 2 + $scanSectorForces->getSDs(); |
|
24 | -} |
|
20 | + if ($player->sameAlliance($scanSectorForces->getOwner())) { |
|
21 | + $friendly_forces += $scanSectorForces->getMines() * 3 + $scanSectorForces->getCDs() * 2 + $scanSectorForces->getSDs(); |
|
22 | + } else { |
|
23 | + $enemy_forces += $scanSectorForces->getMines() * 3 + $scanSectorForces->getCDs() * 2 + $scanSectorForces->getSDs(); |
|
24 | + } |
|
25 | + } |
|
25 | 26 | |
26 | 27 | foreach ($scanSector->getOtherTraders($player) as $scanSectorPlayer) { |
27 | 28 | $scanSectorShip = $scanSectorPlayer->getShip(); |
28 | 29 | |
29 | 30 | // he's a friend if he's in our alliance (and we are not in a 0 alliance |
30 | - if ($player->traderMAPAlliance($scanSectorPlayer)) |
|
31 | - $friendly_vessel += $scanSectorShip->getAttackRating(); |
|
32 | - else |
|
33 | - $enemy_vessel += $scanSectorShip->getDefenseRating() * 10; |
|
34 | -} |
|
31 | + if ($player->traderMAPAlliance($scanSectorPlayer)) { |
|
32 | + $friendly_vessel += $scanSectorShip->getAttackRating(); |
|
33 | + } else { |
|
34 | + $enemy_vessel += $scanSectorShip->getDefenseRating() * 10; |
|
35 | + } |
|
36 | + } |
|
35 | 37 | |
36 | 38 | $template->assign('FriendlyVessel', $friendly_vessel); |
37 | 39 | $template->assign('FriendlyForces', $friendly_forces); |
@@ -39,10 +41,11 @@ discard block |
||
39 | 41 | $template->assign('EnemyForces', $enemy_forces); |
40 | 42 | |
41 | 43 | // is it a warp or a normal move? |
42 | -if ($sector->getWarp() == $var['target_sector']) |
|
44 | +if ($sector->getWarp() == $var['target_sector']) { |
|
43 | 45 | $turns = TURNS_PER_WARP; |
44 | -else |
|
46 | +} else { |
|
45 | 47 | $turns = TURNS_PER_SECTOR; |
48 | +} |
|
46 | 49 | |
47 | 50 | $template->assign('ScanSector', $scanSector); |
48 | 51 | $template->assign('Turns', $turns); |
@@ -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 | } |
@@ -44,7 +44,10 @@ |
||
44 | 44 | <td> |
45 | 45 | <select name="game_type" class="InputFields"><?php |
46 | 46 | foreach (SmrGame::GAME_TYPES as $GameTypeID => $GameType) { |
47 | - ?><option value="<?php echo $GameTypeID; ?>" <?php if ($GameType == $Game['gameType']) echo 'selected'; ?>><?php echo $GameType; ?></option><?php |
|
47 | + ?><option value="<?php echo $GameTypeID; ?>" <?php if ($GameType == $Game['gameType']) { |
|
48 | + echo 'selected'; |
|
49 | + } |
|
50 | + ?>><?php echo $GameType; ?></option><?php |
|
48 | 51 | } ?> |
49 | 52 | </select> |
50 | 53 | </td> |
@@ -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" class="InputFields"><?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" class="InputFields"><?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> |
@@ -47,8 +47,7 @@ discard block |
||
47 | 47 | // get smr player |
48 | 48 | try { |
49 | 49 | $player = SmrPlayer::getPlayer($account->getAccountID(), $alliance->getGameId(), true); |
50 | - } |
|
51 | - catch (PlayerNotFoundException $e) { |
|
50 | + } catch (PlayerNotFoundException $e) { |
|
52 | 51 | if ($validationMessages === true) { |
53 | 52 | fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', you have not joined the game that this channel belongs to.' . EOL); |
54 | 53 | } |
@@ -85,36 +84,50 @@ discard block |
||
85 | 84 | return true; |
86 | 85 | } |
87 | 86 | |
88 | - if (channel_msg_money($fp, $rdata, $account, $player)) |
|
89 | - return true; |
|
90 | - if (channel_msg_forces($fp, $rdata, $account, $player)) |
|
91 | - return true; |
|
87 | + if (channel_msg_money($fp, $rdata, $account, $player)) { |
|
88 | + return true; |
|
89 | + } |
|
90 | + if (channel_msg_forces($fp, $rdata, $account, $player)) { |
|
91 | + return true; |
|
92 | + } |
|
92 | 93 | |
93 | - if (channel_msg_seed($fp, $rdata, $account, $player)) |
|
94 | - return true; |
|
95 | - if (channel_msg_seedlist_add($fp, $rdata, $account, $player)) |
|
96 | - return true; |
|
97 | - if (channel_msg_seedlist_del($fp, $rdata, $account, $player)) |
|
98 | - return true; |
|
94 | + if (channel_msg_seed($fp, $rdata, $account, $player)) { |
|
95 | + return true; |
|
96 | + } |
|
97 | + if (channel_msg_seedlist_add($fp, $rdata, $account, $player)) { |
|
98 | + return true; |
|
99 | + } |
|
100 | + if (channel_msg_seedlist_del($fp, $rdata, $account, $player)) { |
|
101 | + return true; |
|
102 | + } |
|
99 | 103 | |
100 | - if (channel_msg_op_info($fp, $rdata, $account, $player)) |
|
101 | - return true; |
|
102 | - if (channel_msg_op_cancel($fp, $rdata, $account, $player)) |
|
103 | - return true; |
|
104 | - if (channel_msg_op_set($fp, $rdata, $account, $player)) |
|
105 | - return true; |
|
106 | - if (channel_msg_op_turns($fp, $rdata, $account, $player)) |
|
107 | - return true; |
|
108 | - if (channel_msg_op_response($fp, $rdata, $account, $player)) |
|
109 | - return true; |
|
110 | - if (channel_msg_op_list($fp, $rdata, $account, $player)) |
|
111 | - return true; |
|
112 | - if (channel_msg_sd_set($fp, $rdata, $account, $player)) |
|
113 | - return true; |
|
114 | - if (channel_msg_sd_del($fp, $rdata, $account, $player)) |
|
115 | - return true; |
|
116 | - if (channel_msg_sd_list($fp, $rdata, $account, $player)) |
|
117 | - return true; |
|
104 | + if (channel_msg_op_info($fp, $rdata, $account, $player)) { |
|
105 | + return true; |
|
106 | + } |
|
107 | + if (channel_msg_op_cancel($fp, $rdata, $account, $player)) { |
|
108 | + return true; |
|
109 | + } |
|
110 | + if (channel_msg_op_set($fp, $rdata, $account, $player)) { |
|
111 | + return true; |
|
112 | + } |
|
113 | + if (channel_msg_op_turns($fp, $rdata, $account, $player)) { |
|
114 | + return true; |
|
115 | + } |
|
116 | + if (channel_msg_op_response($fp, $rdata, $account, $player)) { |
|
117 | + return true; |
|
118 | + } |
|
119 | + if (channel_msg_op_list($fp, $rdata, $account, $player)) { |
|
120 | + return true; |
|
121 | + } |
|
122 | + if (channel_msg_sd_set($fp, $rdata, $account, $player)) { |
|
123 | + return true; |
|
124 | + } |
|
125 | + if (channel_msg_sd_del($fp, $rdata, $account, $player)) { |
|
126 | + return true; |
|
127 | + } |
|
128 | + if (channel_msg_sd_list($fp, $rdata, $account, $player)) { |
|
129 | + return true; |
|
130 | + } |
|
118 | 131 | |
119 | 132 | } |
120 | 133 | |
@@ -253,8 +266,9 @@ discard block |
||
253 | 266 | $countdown = intval($msg[5]); |
254 | 267 | $message = 'ALERT! ALERT! ALERT!'; |
255 | 268 | |
256 | - if (isset($msg[6])) |
|
257 | - $message .= ' ' . $msg[6]; |
|
269 | + if (isset($msg[6])) { |
|
270 | + $message .= ' ' . $msg[6]; |
|
271 | + } |
|
258 | 272 | |
259 | 273 | echo_r('[TIMER] ' . $nick . ' started a timer with ' . $countdown . ' minute(s) (' . $message . ') in ' . $channel); |
260 | 274 | |
@@ -364,8 +378,9 @@ discard block |
||
364 | 378 | if ($topic == 'seen') { |
365 | 379 | fputs($fp, 'NOTICE ' . $nick . ' :Syntax !seen <nickname>' . EOL); |
366 | 380 | fputs($fp, 'NOTICE ' . $nick . ' : Displays the last time <nickname> was seen' . EOL); |
367 | - } else |
|
368 | - fputs($fp, 'NOTICE ' . $nick . ' :There is no help available for this command! Try !help' . EOL); |
|
381 | + } else { |
|
382 | + fputs($fp, 'NOTICE ' . $nick . ' :There is no help available for this command! Try !help' . EOL); |
|
383 | + } |
|
369 | 384 | |
370 | 385 | // if ($topic == 'login') |
371 | 386 | // fputs($fp, 'NOTICE '.$nick.' :No help available yet! Ask MrSpock!'.EOL); |
@@ -4,7 +4,9 @@ |
||
4 | 4 | |
5 | 5 | $fn_seed = function($message) { |
6 | 6 | $link = new GameLink($message->channel, $message->author); |
7 | - if (!$link->valid) return; |
|
7 | + if (!$link->valid) { |
|
8 | + return; |
|
9 | + } |
|
8 | 10 | |
9 | 11 | $result = shared_channel_msg_seed($link->player); |
10 | 12 | $message->channel->sendMessage(join(EOL, $result)); |
@@ -17,7 +17,9 @@ discard block |
||
17 | 17 | |
18 | 18 | $fn_turns = function($message) { |
19 | 19 | $link = new GameLink($message->channel, $message->author); |
20 | - if (!$link->valid) return; |
|
20 | + if (!$link->valid) { |
|
21 | + return; |
|
22 | + } |
|
21 | 23 | |
22 | 24 | $msg = get_turns_message($link->player); |
23 | 25 | $message->channel->sendMessage($msg); |
@@ -25,7 +27,9 @@ discard block |
||
25 | 27 | |
26 | 28 | $fn_turns_all = function($message) { |
27 | 29 | $link = new GameLink($message->channel, $message->author); |
28 | - if (!$link->valid) return; |
|
30 | + if (!$link->valid) { |
|
31 | + return; |
|
32 | + } |
|
29 | 33 | $player = $link->player; |
30 | 34 | |
31 | 35 | $results = array_map('get_turns_message', $player->getSharingPlayers(true)); |