We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | while ($this->db->nextRecord()) { |
308 | 308 | try { |
309 | 309 | $otherPlayer = SmrPlayer::getPlayer($this->db->getInt('from_account_id'), //TODO |
310 | - $this->getGameID(), $forceUpdate); |
|
310 | + $this->getGameID(), $forceUpdate); |
|
311 | 311 | } catch (PlayerNotFoundException $e) { |
312 | 312 | // Skip players that have not joined this game |
313 | 313 | continue; |
@@ -879,9 +879,9 @@ discard block |
||
879 | 879 | */ |
880 | 880 | public function canFight() { |
881 | 881 | return !($this->hasNewbieTurns() || |
882 | - $this->isDead() || |
|
883 | - $this->isLandedOnPlanet() || |
|
884 | - $this->hasFederalProtection()); |
|
882 | + $this->isDead() || |
|
883 | + $this->isLandedOnPlanet() || |
|
884 | + $this->hasFederalProtection()); |
|
885 | 885 | } |
886 | 886 | |
887 | 887 | public function setDead($bool) { |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | /** |
260 | 260 | * Insert a new player into the database. Returns the new player object. |
261 | 261 | */ |
262 | - public static function createPlayer($accountID, $gameID, $playerName, $raceID, $isNewbie, $npc=false) { |
|
262 | + public static function createPlayer($accountID, $gameID, $playerName, $raceID, $isNewbie, $npc = false) { |
|
263 | 263 | $db = new SmrMySqlDatabase(); |
264 | 264 | $db->lockTable('player'); |
265 | 265 | |
@@ -1694,7 +1694,7 @@ discard block |
||
1694 | 1694 | create_error('The saved sector must be in the box!'); |
1695 | 1695 | } |
1696 | 1696 | |
1697 | - $storedDestinations =& $this->getStoredDestinations(); |
|
1697 | + $storedDestinations = & $this->getStoredDestinations(); |
|
1698 | 1698 | foreach ($storedDestinations as &$sd) { |
1699 | 1699 | if ($sd['SectorID'] == $sectorID) { |
1700 | 1700 | $sd['OffsetTop'] = $offsetTop; |
@@ -2021,13 +2021,13 @@ discard block |
||
2021 | 2021 | $this->db->query('SELECT type,amount FROM player_hof WHERE ' . $this->SQL); |
2022 | 2022 | $this->HOF = array(); |
2023 | 2023 | while ($this->db->nextRecord()) { |
2024 | - $hof =& $this->HOF; |
|
2024 | + $hof = & $this->HOF; |
|
2025 | 2025 | $typeList = explode(':', $this->db->getField('type')); |
2026 | 2026 | foreach ($typeList as $type) { |
2027 | 2027 | if (!isset($hof[$type])) { |
2028 | 2028 | $hof[$type] = array(); |
2029 | 2029 | } |
2030 | - $hof =& $hof[$type]; |
|
2030 | + $hof = & $hof[$type]; |
|
2031 | 2031 | } |
2032 | 2032 | $hof = $this->db->getFloat('amount'); |
2033 | 2033 | } |
@@ -2106,8 +2106,8 @@ discard block |
||
2106 | 2106 | } |
2107 | 2107 | self::$HOFVis[$hofType] = $visibility; |
2108 | 2108 | |
2109 | - $hof =& $this->HOF; |
|
2110 | - $hofChanged =& $this->hasHOFChanged; |
|
2109 | + $hof = & $this->HOF; |
|
2110 | + $hofChanged = & $this->hasHOFChanged; |
|
2111 | 2111 | $new = false; |
2112 | 2112 | foreach ($typeList as $type) { |
2113 | 2113 | if (!isset($hofChanged[$type])) { |
@@ -2117,8 +2117,8 @@ discard block |
||
2117 | 2117 | $hof[$type] = array(); |
2118 | 2118 | $new = true; |
2119 | 2119 | } |
2120 | - $hof =& $hof[$type]; |
|
2121 | - $hofChanged =& $hofChanged[$type]; |
|
2120 | + $hof = & $hof[$type]; |
|
2121 | + $hofChanged = & $hofChanged[$type]; |
|
2122 | 2122 | } |
2123 | 2123 | if ($hofChanged == null) { |
2124 | 2124 | $hofChanged = self::HOF_CHANGED; |
@@ -2721,7 +2721,7 @@ discard block |
||
2721 | 2721 | } |
2722 | 2722 | |
2723 | 2723 | private function setupMissionStep($missionID) { |
2724 | - $mission =& $this->missions[$missionID]; |
|
2724 | + $mission = & $this->missions[$missionID]; |
|
2725 | 2725 | if ($mission['On Step'] >= count(MISSIONS[$missionID]['Steps'])) { |
2726 | 2726 | // Nothing to do if this mission is already completed |
2727 | 2727 | return; |
@@ -2770,7 +2770,7 @@ discard block |
||
2770 | 2770 | 'Starting Sector' => $this->getSectorID() |
2771 | 2771 | ); |
2772 | 2772 | |
2773 | - $this->missions[$missionID] =& $mission; |
|
2773 | + $this->missions[$missionID] = & $mission; |
|
2774 | 2774 | $this->setupMissionStep($missionID); |
2775 | 2775 | $this->rebuildMission($missionID); |
2776 | 2776 | |
@@ -2820,7 +2820,7 @@ discard block |
||
2820 | 2820 | |
2821 | 2821 | public function claimMissionReward($missionID) { |
2822 | 2822 | $this->getMissions(); |
2823 | - $mission =& $this->missions[$missionID]; |
|
2823 | + $mission = & $this->missions[$missionID]; |
|
2824 | 2824 | if ($mission === false) { |
2825 | 2825 | throw new Exception('Unknown mission: ' . $missionID); |
2826 | 2826 | } |
@@ -3176,7 +3176,7 @@ discard block |
||
3176 | 3176 | $amount = $this->getHOF($tempTypeList); |
3177 | 3177 | if ($hofChanged == self::HOF_NEW) { |
3178 | 3178 | if ($amount > 0) { |
3179 | - $this->db->query('INSERT INTO player_hof (account_id,game_id,type,amount) VALUES (' . $this->db->escapeNumber($this->getAccountID()) . ',' . $this->db->escapeNumber($this->getGameID()) . ',' . $this->db->escapeArray($tempTypeList, false, true, ':', false) . ',' . $this->db->escapeNumber($amount) . ')'); //TODO |
|
3179 | + $this->db->query('INSERT INTO player_hof (account_id,game_id,type,amount) VALUES (' . $this->db->escapeNumber($this->getAccountID()) . ',' . $this->db->escapeNumber($this->getGameID()) . ',' . $this->db->escapeArray($tempTypeList, false, true, ':', false) . ',' . $this->db->escapeNumber($amount) . ')'); //TODO |
|
3180 | 3180 | } |
3181 | 3181 | } elseif ($hofChanged == self::HOF_CHANGED) { |
3182 | 3182 | $this->db->query('UPDATE player_hof |
@@ -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 $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 $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 | } |
@@ -81,18 +81,18 @@ |
||
81 | 81 | |
82 | 82 | // If mines are bumped, the forces shoot first. Otherwise player shoots first. |
83 | 83 | if ($bump) { |
84 | - $results['Forces'] =& $forces->shootPlayers($attackers, $bump); |
|
84 | + $results['Forces'] = & $forces->shootPlayers($attackers, $bump); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | $results['Attackers'] = array('TotalDamage' => 0); |
88 | 88 | foreach ($attackers as $attacker) { |
89 | - $playerResults =& $attacker->shootForces($forces); |
|
90 | - $results['Attackers']['Traders'][$attacker->getPlayerID()] =& $playerResults; |
|
89 | + $playerResults = & $attacker->shootForces($forces); |
|
90 | + $results['Attackers']['Traders'][$attacker->getPlayerID()] = & $playerResults; |
|
91 | 91 | $results['Attackers']['TotalDamage'] += $playerResults['TotalDamage']; |
92 | 92 | } |
93 | 93 | |
94 | 94 | if (!$bump) { |
95 | - $results['Forces'] =& $forces->shootPlayers($attackers, $bump); |
|
95 | + $results['Forces'] = & $forces->shootPlayers($attackers, $bump); |
|
96 | 96 | $forces->updateExpire(); |
97 | 97 | } |
98 | 98 |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | // Send vote announcement to members of the player's council (war votes) |
40 | 40 | // or both races' councils (peace votes). |
41 | 41 | $councilMembers = Council::getRaceCouncil($player->getGameID(), |
42 | - $player->getRaceID()); |
|
42 | + $player->getRaceID()); |
|
43 | 43 | if ($type == 'PEACE') { |
44 | 44 | $otherCouncil = Council::getRaceCouncil($player->getGameID(), $race_id); |
45 | 45 | $councilMembers = array_merge($councilMembers, $otherCouncil); |
@@ -49,16 +49,16 @@ discard block |
||
49 | 49 | $color = ($type == 'PEACE' ? 'dgreen' : 'red'); |
50 | 50 | $type_fancy = "<span class=\"$color\">$type</span>"; |
51 | 51 | $message = $player->getLevelName() . " " . $player->getBBLink() |
52 | - . " has initiated a vote for $type_fancy with the " |
|
53 | - . Globals::getRaceName($race_id) |
|
54 | - . "! You have " . format_time(TIME_FOR_COUNCIL_VOTE) |
|
55 | - . " to cast your vote."; |
|
52 | + . " has initiated a vote for $type_fancy with the " |
|
53 | + . Globals::getRaceName($race_id) |
|
54 | + . "! You have " . format_time(TIME_FOR_COUNCIL_VOTE) |
|
55 | + . " to cast your vote."; |
|
56 | 56 | |
57 | 57 | foreach ($councilMembers as $playerID) { |
58 | 58 | // don't send to the player who started the vote |
59 | 59 | if ($player->getPlayerID() != $playerID) { |
60 | 60 | SmrPlayer::sendMessageFromRace($player->getRaceID(), $player->getGameID(), |
61 | - $playerID, $message, $time); |
|
61 | + $playerID, $message, $time); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 |
@@ -52,12 +52,12 @@ |
||
52 | 52 | } |
53 | 53 | |
54 | 54 | foreach ($attackers as $attacker) { |
55 | - $playerResults =& $attacker->shootPort($port); |
|
56 | - $results['Attackers']['Traders'][$attacker->getPlayerID()] =& $playerResults; |
|
55 | + $playerResults = & $attacker->shootPort($port); |
|
56 | + $results['Attackers']['Traders'][$attacker->getPlayerID()] = & $playerResults; |
|
57 | 57 | $results['Attackers']['TotalDamage'] += $playerResults['TotalDamage']; |
58 | 58 | } |
59 | 59 | $results['Attackers']['Downgrades'] = $port->checkForDowngrade($results['Attackers']['TotalDamage']); |
60 | -$results['Port'] =& $port->shootPlayers($attackers); |
|
60 | +$results['Port'] = & $port->shootPlayers($attackers); |
|
61 | 61 | |
62 | 62 | $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()); |
63 | 63 |
@@ -47,8 +47,8 @@ |
||
47 | 47 | |
48 | 48 | function teamAttack(&$results, $fightingPlayers, $attack, $defend) { |
49 | 49 | foreach ($fightingPlayers[$attack] as $playerID => $teamPlayer) { |
50 | - $playerResults =& $teamPlayer->shootPlayers($fightingPlayers[$defend]); |
|
51 | - $results[$attack]['Traders'][$teamPlayer->getPlayerID()] =& $playerResults; |
|
50 | + $playerResults = & $teamPlayer->shootPlayers($fightingPlayers[$defend]); |
|
51 | + $results[$attack]['Traders'][$teamPlayer->getPlayerID()] = & $playerResults; |
|
52 | 52 | $results[$attack]['TotalDamage'] += $playerResults['TotalDamage']; |
53 | 53 | |
54 | 54 | // Award assists (if there are multiple attackers) |
@@ -122,7 +122,7 @@ |
||
122 | 122 | AND receiver_delete = ' . $db->escapeBoolean(false) . ' |
123 | 123 | ORDER BY send_time DESC'); |
124 | 124 | while ($db->nextRecord()) { |
125 | - $groupBox =& $messageBox['GroupedMessages'][$db->getInt('sender_player_id')]; |
|
125 | + $groupBox = & $messageBox['GroupedMessages'][$db->getInt('sender_player_id')]; |
|
126 | 126 | // Limit the number of messages in each group |
127 | 127 | if (!isset($groupBox['Messages']) || count($groupBox['Messages']) < MESSAGE_SCOUT_GROUP_LIMIT) { |
128 | 128 | displayMessage($groupBox, $db->getInt('message_id'), $db->getInt('player_id'), $db->getInt('sender_player_id'), stripslashes($db->getField('message_text')), $db->getInt('send_time'), $db->getBoolean('msg_read'), MSG_SCOUT); |
@@ -57,12 +57,12 @@ |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | foreach ($attackers as $attacker) { |
60 | - $playerResults =& $attacker->shootPlanet($planet, false); |
|
61 | - $results['Attackers']['Traders'][$attacker->getPlayerID()] =& $playerResults; |
|
60 | + $playerResults = & $attacker->shootPlanet($planet, false); |
|
61 | + $results['Attackers']['Traders'][$attacker->getPlayerID()] = & $playerResults; |
|
62 | 62 | $results['Attackers']['TotalDamage'] += $playerResults['TotalDamage']; |
63 | 63 | } |
64 | 64 | $results['Attackers']['Downgrades'] = $planet->checkForDowngrade($results['Attackers']['TotalDamage']); |
65 | -$results['Planet'] =& $planet->shootPlayers($attackers); |
|
65 | +$results['Planet'] = & $planet->shootPlayers($attackers); |
|
66 | 66 | |
67 | 67 | $account->log(LOG_TYPE_PLANET_BUSTING, 'Player attacks planet, the planet does ' . $results['Planet']['TotalDamage'] . ', their team does ' . $results['Attackers']['TotalDamage'] . ' and downgrades: ' . var_export($results['Attackers']['Downgrades'], true), $planet->getSectorID()); |
68 | 68 |
@@ -15,11 +15,11 @@ |
||
15 | 15 | // Special case for leaders who haven't made their own alliance yet, |
16 | 16 | // or are still in the Newbie Help Alliance. |
17 | 17 | $teams[$leader->getPlayerID()] = array('Leader' => $leader, |
18 | - 'Size' => 0); |
|
18 | + 'Size' => 0); |
|
19 | 19 | } else { |
20 | 20 | $teams[$leader->getPlayerID()] = array('Leader' => $leader, |
21 | - 'Alliance' => $alliance, |
|
22 | - 'Size' => $alliance->getNumMembers()); |
|
21 | + 'Alliance' => $alliance, |
|
22 | + 'Size' => $alliance->getNumMembers()); |
|
23 | 23 | } |
24 | 24 | } |
25 | 25 |