We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -239,8 +239,7 @@ discard block |
||
| 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 | } |
@@ -262,8 +261,7 @@ discard block |
||
| 262 | 261 | 'Reason' => $this->db->getField('reason'), |
| 263 | 262 | 'ReasonID' => $this->db->getInt('reason_id') |
| 264 | 263 | ); |
| 265 | - } |
|
| 266 | - else { |
|
| 264 | + } else { |
|
| 267 | 265 | return false; |
| 268 | 266 | } |
| 269 | 267 | } |
@@ -319,7 +317,9 @@ discard block |
||
| 319 | 317 | if ($curr_ip != 'unknown' && $curr_ip != 'unknown...' && $curr_ip != 'unknown, unknown') { |
| 320 | 318 | $curr_ip = $fi.'.'.$se.'.'.$th.'.'.$fo; |
| 321 | 319 | $host = gethostbyaddr($curr_ip); |
| 322 | - } else $host = 'unknown'; |
|
| 320 | + } else { |
|
| 321 | + $host = 'unknown'; |
|
| 322 | + } |
|
| 323 | 323 | |
| 324 | 324 | // save...first make sure there isn't one for these keys (someone could double click and get error) |
| 325 | 325 | $this->db->query('REPLACE INTO account_has_ip (account_id, time, ip, host) VALUES ('.$this->db->escapeNumber($this->account_id).', '.$this->db->escapeNumber(TIME).', '.$this->db->escapeString($curr_ip).', '.$this->db->escapeString($host).')'); |
@@ -997,8 +997,7 @@ discard block |
||
| 997 | 997 | if($hotkeyType!==false) { |
| 998 | 998 | if(isset($this->hotkeys[$hotkeyType])) { |
| 999 | 999 | return $this->hotkeys[$hotkeyType]; |
| 1000 | - } |
|
| 1001 | - else { |
|
| 1000 | + } else { |
|
| 1002 | 1001 | return array(); |
| 1003 | 1002 | } |
| 1004 | 1003 | } |
@@ -1178,8 +1177,7 @@ discard block |
||
| 1178 | 1177 | |
| 1179 | 1178 | if($days==0) { |
| 1180 | 1179 | $expireTime = 0; |
| 1181 | - } |
|
| 1182 | - else { |
|
| 1180 | + } else { |
|
| 1183 | 1181 | $expireTime = TIME + $days * 86400; |
| 1184 | 1182 | } |
| 1185 | 1183 | $this->banAccount($expireTime,$admin,$reasonID,$suspicion); |
@@ -464,7 +464,9 @@ discard block |
||
| 464 | 464 | if ($this->level === null) { |
| 465 | 465 | $LEVELS_REQUIREMENTS = Globals::getLevelRequirements(); |
| 466 | 466 | foreach ($LEVELS_REQUIREMENTS as $level_id => $require) { |
| 467 | - if ($this->getExperience() >= $require['Requirement']) continue; |
|
| 467 | + if ($this->getExperience() >= $require['Requirement']) { |
|
| 468 | + continue; |
|
| 469 | + } |
|
| 468 | 470 | $this->level = $level_id - 1; |
| 469 | 471 | return $this->level; |
| 470 | 472 | } |
@@ -585,8 +587,7 @@ discard block |
||
| 585 | 587 | public function getAllianceDisplayName($linked = false, $includeAllianceID = false) { |
| 586 | 588 | if ($this->hasAlliance()) { |
| 587 | 589 | return $this->getAlliance()->getAllianceDisplayName($linked, $includeAllianceID); |
| 588 | - } |
|
| 589 | - else { |
|
| 590 | + } else { |
|
| 590 | 591 | return 'No Alliance'; |
| 591 | 592 | } |
| 592 | 593 | } |
@@ -923,8 +924,7 @@ discard block |
||
| 923 | 924 | $hofType = implode(':', $typeList); |
| 924 | 925 | if (!isset(self::$HOFVis[$hofType])) { |
| 925 | 926 | self::$hasHOFVisChanged[$hofType] = self::HOF_NEW; |
| 926 | - } |
|
| 927 | - else if (self::$HOFVis[$hofType] != $visibility) { |
|
| 927 | + } else if (self::$HOFVis[$hofType] != $visibility) { |
|
| 928 | 928 | self::$hasHOFVisChanged[$hofType] = self::HOF_CHANGED; |
| 929 | 929 | } |
| 930 | 930 | self::$HOFVis[$hofType] = $visibility; |
@@ -1159,8 +1159,7 @@ discard block |
||
| 1159 | 1159 | if ($mission['On Step'] >= count(MISSIONS[$missionID]['Steps'])) { |
| 1160 | 1160 | // If we have completed this mission just use false to indicate no current task. |
| 1161 | 1161 | $currentStep = false; |
| 1162 | - } |
|
| 1163 | - else { |
|
| 1162 | + } else { |
|
| 1164 | 1163 | $currentStep = MISSIONS[$missionID]['Steps'][$mission['On Step']]; |
| 1165 | 1164 | $currentStep['Text'] = str_replace(array('<Race>', '<Sector>', '<Starting Sector>', '<trader>'), array($this->getRaceID(), $mission['Sector'], $mission['Starting Sector'], $this->playerName), $currentStep['Text']); |
| 1166 | 1165 | if (isset($currentStep['Task'])) { |
@@ -1168,8 +1167,7 @@ discard block |
||
| 1168 | 1167 | } |
| 1169 | 1168 | if (isset($currentStep['Level'])) { |
| 1170 | 1169 | $currentStep['Level'] = str_replace('<Player Level>', $this->getLevelID(), $currentStep['Level']); |
| 1171 | - } |
|
| 1172 | - else { |
|
| 1170 | + } else { |
|
| 1173 | 1171 | $currentStep['Level'] = 0; |
| 1174 | 1172 | } |
| 1175 | 1173 | } |
@@ -1386,8 +1384,9 @@ discard block |
||
| 1386 | 1384 | if (!isset($this->visitedSectors)) { |
| 1387 | 1385 | $this->visitedSectors = array(); |
| 1388 | 1386 | $this->db->query('SELECT sector_id FROM player_visited_sector WHERE ' . $this->SQL); |
| 1389 | - while ($this->db->nextRecord()) |
|
| 1390 | - $this->visitedSectors[$this->db->getInt('sector_id')] = false; |
|
| 1387 | + while ($this->db->nextRecord()) { |
|
| 1388 | + $this->visitedSectors[$this->db->getInt('sector_id')] = false; |
|
| 1389 | + } |
|
| 1391 | 1390 | } |
| 1392 | 1391 | return !isset($this->visitedSectors[$sectorID]); |
| 1393 | 1392 | } |
@@ -139,8 +139,7 @@ |
||
| 139 | 139 | $news = 'The [race=' . $race_id_1 . '] have declared <span class="red">WAR</span> on the [race=' . $race_id_2 . ']'; |
| 140 | 140 | $db2->query('INSERT INTO news (game_id, time, news_message) VALUES ' . |
| 141 | 141 | '(' . $db2->escapeNumber($player->getGameID()) . ', ' . $db2->escapeNumber(TIME) . ', ' . $db2->escapeString($news) . ')'); |
| 142 | - } |
|
| 143 | - elseif ($type == 'PEACE') { |
|
| 142 | + } elseif ($type == 'PEACE') { |
|
| 144 | 143 | // get 'yes' votes |
| 145 | 144 | $db2->query('SELECT * FROM player_votes_pact |
| 146 | 145 | WHERE game_id = '.$db2->escapeNumber($player->getGameID()) . ' |
@@ -126,15 +126,13 @@ discard block |
||
| 126 | 126 | $this->links['Right'] = $db->getInt('link_right'); |
| 127 | 127 | } |
| 128 | 128 | $this->warp = $db->getInt('warp'); |
| 129 | - } |
|
| 130 | - else if ($create) { |
|
| 129 | + } else if ($create) { |
|
| 131 | 130 | $this->battles = 0; |
| 132 | 131 | $this->links = array(); |
| 133 | 132 | $this->warp = 0; |
| 134 | 133 | $this->isNew = true; |
| 135 | 134 | return; |
| 136 | - } |
|
| 137 | - else { |
|
| 135 | + } else { |
|
| 138 | 136 | throw new SectorNotFoundException('No sector ' . $sectorID . ' in game ' . $gameID); |
| 139 | 137 | } |
| 140 | 138 | } |
@@ -492,8 +490,7 @@ discard block |
||
| 492 | 490 | public function toggleLink($dir) { |
| 493 | 491 | if ($this->hasLink($dir)) { |
| 494 | 492 | $this->disableLink($dir); |
| 495 | - } |
|
| 496 | - else { |
|
| 493 | + } else { |
|
| 497 | 494 | $this->enableLink($dir); |
| 498 | 495 | } |
| 499 | 496 | } |
@@ -200,8 +200,7 @@ discard block |
||
| 200 | 200 | $this->newbieWarning = $db->getBoolean('newbie_warning'); |
| 201 | 201 | $this->nameChanged = $db->getBoolean('name_changed'); |
| 202 | 202 | $this->combatDronesKamikazeOnMines = $db->getBoolean('combat_drones_kamikaze_on_mines'); |
| 203 | - } |
|
| 204 | - else { |
|
| 203 | + } else { |
|
| 205 | 204 | throw new PlayerNotFoundException('Invalid accountID: ' . $accountID . ' OR gameID:' . $gameID); |
| 206 | 205 | } |
| 207 | 206 | } |
@@ -335,11 +334,9 @@ discard block |
||
| 335 | 334 | $kickedBy->sendMessage($this->getAccountID(), MSG_PLAYER, 'You were kicked out of the alliance!', false); |
| 336 | 335 | $this->actionTaken('PlayerKicked', array('Alliance' => $alliance, 'Player' => $kickedBy)); |
| 337 | 336 | $kickedBy->actionTaken('KickPlayer', array('Alliance' => $alliance, 'Player' => $this)); |
| 338 | - } |
|
| 339 | - else if ($this->isAllianceLeader()) { |
|
| 337 | + } else if ($this->isAllianceLeader()) { |
|
| 340 | 338 | $this->actionTaken('DisbandAlliance', array('Alliance' => $alliance)); |
| 341 | - } |
|
| 342 | - else { |
|
| 339 | + } else { |
|
| 343 | 340 | $this->actionTaken('LeaveAlliance', array('Alliance' => $alliance)); |
| 344 | 341 | if ($alliance->getLeaderID() != 0 && $alliance->getLeaderID() != ACCOUNT_ID_NHL) { |
| 345 | 342 | $this->sendMessage($alliance->getLeaderID(), MSG_PLAYER, 'I left your alliance!', false); |
@@ -367,7 +364,9 @@ discard block |
||
| 367 | 364 | try { |
| 368 | 365 | $this->sendMessage($alliance->getLeaderID(), MSG_PLAYER, 'I joined your alliance!', false); |
| 369 | 366 | } catch (AccountNotFoundException $e) { |
| 370 | - if ($alliance->getLeaderID() != ACCOUNT_ID_NHL) throw $e; |
|
| 367 | + if ($alliance->getLeaderID() != ACCOUNT_ID_NHL) { |
|
| 368 | + throw $e; |
|
| 369 | + } |
|
| 371 | 370 | } |
| 372 | 371 | |
| 373 | 372 | $roleID = ALLIANCE_ROLE_NEW_MEMBER; |
@@ -500,7 +499,9 @@ discard block |
||
| 500 | 499 | |
| 501 | 500 | public function updateTurns() { |
| 502 | 501 | // is account validated? |
| 503 | - if (!$this->getAccount()->isValidated()) return; |
|
| 502 | + if (!$this->getAccount()->isValidated()) { |
|
| 503 | + return; |
|
| 504 | + } |
|
| 504 | 505 | |
| 505 | 506 | // how many turns would he get right now? |
| 506 | 507 | $extraTurns = $this->getTurnsGained(TIME); |
@@ -712,8 +713,7 @@ discard block |
||
| 712 | 713 | $this->db->query('SELECT * FROM ship_has_name WHERE ' . $this->SQL . ' LIMIT 1'); |
| 713 | 714 | if ($this->db->nextRecord()) { |
| 714 | 715 | $this->customShipName = $this->db->getField('ship_name'); |
| 715 | - } |
|
| 716 | - else { |
|
| 716 | + } else { |
|
| 717 | 717 | $this->customShipName = false; |
| 718 | 718 | } |
| 719 | 719 | } |
@@ -731,8 +731,7 @@ discard block |
||
| 731 | 731 | $this->knowledge['Nyx'] = $this->db->getInt('nyx'); |
| 732 | 732 | $this->knowledge['Federation'] = 0; |
| 733 | 733 | $this->knowledge['Underground'] = 0; |
| 734 | - } |
|
| 735 | - else { |
|
| 734 | + } else { |
|
| 736 | 735 | $this->knowledge['Erebus'] = 0; |
| 737 | 736 | $this->knowledge['Aether'] = 0; |
| 738 | 737 | $this->knowledge['Tartarus'] = 0; |
@@ -859,8 +858,7 @@ discard block |
||
| 859 | 858 | $return['KillerAlign'] = -$relation * $alignChangePerRelation; //Lose relations when killing a peaceful race |
| 860 | 859 | if ($return['KillerAlign'] > 0) { |
| 861 | 860 | $killer->increaseAlignment($return['KillerAlign']); |
| 862 | - } |
|
| 863 | - else { |
|
| 861 | + } else { |
|
| 864 | 862 | $killer->decreaseAlignment(-$return['KillerAlign']); |
| 865 | 863 | } |
| 866 | 864 | // War setting gives them military pay |
@@ -894,8 +892,7 @@ discard block |
||
| 894 | 892 | // If the podded players alignment makes them deputy or member then set bounty |
| 895 | 893 | if ($this->getAlignment() >= 100) { |
| 896 | 894 | $return['BountyGained']['Type'] = 'HQ'; |
| 897 | - } |
|
| 898 | - else if ($this->getAlignment() <= 100) { |
|
| 895 | + } else if ($this->getAlignment() <= 100) { |
|
| 899 | 896 | $return['BountyGained']['Type'] = 'UG'; |
| 900 | 897 | } |
| 901 | 898 | |
@@ -917,16 +914,14 @@ discard block |
||
| 917 | 914 | |
| 918 | 915 | if ($return['KillerAlign'] > 0) { |
| 919 | 916 | $killer->increaseHOF($return['KillerAlign'], array('Killing', 'NPC', 'Alignment', 'Gain'), HOF_PUBLIC); |
| 920 | - } |
|
| 921 | - else { |
|
| 917 | + } else { |
|
| 922 | 918 | $killer->increaseHOF(-$return['KillerAlign'], array('Killing', 'NPC', 'Alignment', 'Loss'), HOF_PUBLIC); |
| 923 | 919 | } |
| 924 | 920 | |
| 925 | 921 | $killer->increaseHOF($return['BountyGained']['Amount'], array('Killing', 'NPC', 'Money', 'Bounty Gained'), HOF_PUBLIC); |
| 926 | 922 | |
| 927 | 923 | $killer->increaseHOF(1, array('Killing', 'NPC Kills'), HOF_PUBLIC); |
| 928 | - } |
|
| 929 | - else { |
|
| 924 | + } else { |
|
| 930 | 925 | $killer->increaseHOF($return['KillerExp'], array('Killing', 'Experience', 'Gained'), HOF_PUBLIC); |
| 931 | 926 | $killer->increaseHOF($this->getExperience(), array('Killing', 'Experience', 'Of Traders Killed'), HOF_PUBLIC); |
| 932 | 927 | |
@@ -938,8 +933,7 @@ discard block |
||
| 938 | 933 | |
| 939 | 934 | if ($return['KillerAlign'] > 0) { |
| 940 | 935 | $killer->increaseHOF($return['KillerAlign'], array('Killing', 'Alignment', 'Gain'), HOF_PUBLIC); |
| 941 | - } |
|
| 942 | - else { |
|
| 936 | + } else { |
|
| 943 | 937 | $killer->increaseHOF(-$return['KillerAlign'], array('Killing', 'Alignment', 'Loss'), HOF_PUBLIC); |
| 944 | 938 | } |
| 945 | 939 | |
@@ -947,8 +941,7 @@ discard block |
||
| 947 | 941 | |
| 948 | 942 | if ($this->getShip()->getAttackRatingWithMaxCDs() <= MAX_ATTACK_RATING_NEWBIE && $this->hasNewbieStatus() && !$killer->hasNewbieStatus()) { //Newbie kill |
| 949 | 943 | $killer->increaseHOF(1, array('Killing', 'Newbie Kills'), HOF_PUBLIC); |
| 950 | - } |
|
| 951 | - else { |
|
| 944 | + } else { |
|
| 952 | 945 | $killer->increaseKills(1); |
| 953 | 946 | $killer->increaseHOF(1, array('Killing', 'Kills'), HOF_PUBLIC); |
| 954 | 947 | |
@@ -1133,8 +1126,7 @@ discard block |
||
| 1133 | 1126 | if ($bounty['Amount'] > 0 || $bounty['SmrCredits'] > 0) { |
| 1134 | 1127 | $this->db->query('INSERT INTO bounty (account_id,game_id,type,amount,smr_credits,claimer_id,time) VALUES (' . $this->db->escapeNumber($this->getAccountID()) . ',' . $this->db->escapeNumber($this->getGameID()) . ',' . $this->db->escapeString($bounty['Type']) . ',' . $this->db->escapeNumber($bounty['Amount']) . ',' . $this->db->escapeNumber($bounty['SmrCredits']) . ',' . $this->db->escapeNumber($bounty['Claimer']) . ',' . $this->db->escapeNumber($bounty['Time']) . ')'); |
| 1135 | 1128 | } |
| 1136 | - } |
|
| 1137 | - else { |
|
| 1129 | + } else { |
|
| 1138 | 1130 | if ($bounty['Amount'] > 0 || $bounty['SmrCredits'] > 0) { |
| 1139 | 1131 | $this->db->query('UPDATE bounty |
| 1140 | 1132 | SET amount=' . $this->db->escapeNumber($bounty['Amount']) . ', |
@@ -1173,15 +1165,13 @@ discard block |
||
| 1173 | 1165 | $tempTypeList[] = $type; |
| 1174 | 1166 | if (is_array($hofChanged)) { |
| 1175 | 1167 | $this->doHOFSave($hofChanged, $tempTypeList); |
| 1176 | - } |
|
| 1177 | - else { |
|
| 1168 | + } else { |
|
| 1178 | 1169 | $amount = $this->getHOF($tempTypeList); |
| 1179 | 1170 | if ($hofChanged == self::HOF_NEW) { |
| 1180 | 1171 | if ($amount > 0) { |
| 1181 | 1172 | $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) . ')'); |
| 1182 | 1173 | } |
| 1183 | - } |
|
| 1184 | - else if ($hofChanged == self::HOF_CHANGED) { |
|
| 1174 | + } else if ($hofChanged == self::HOF_CHANGED) { |
|
| 1185 | 1175 | // if($amount > 0) |
| 1186 | 1176 | $this->db->query('UPDATE player_hof |
| 1187 | 1177 | SET amount=' . $this->db->escapeNumber($amount) . ' |
@@ -1292,11 +1282,12 @@ discard block |
||
| 1292 | 1282 | $this->tickers = array(); |
| 1293 | 1283 | //get ticker info |
| 1294 | 1284 | $this->db->query('SELECT type,time,expires,recent FROM player_has_ticker WHERE ' . $this->SQL . ' AND expires > ' . $this->db->escapeNumber(TIME)); |
| 1295 | - while ($this->db->nextRecord()) |
|
| 1296 | - $this->tickers[$this->db->getField('type')] = array('Type' => $this->db->getField('type'), |
|
| 1285 | + while ($this->db->nextRecord()) { |
|
| 1286 | + $this->tickers[$this->db->getField('type')] = array('Type' => $this->db->getField('type'), |
|
| 1297 | 1287 | 'Time' => $this->db->getInt('time'), |
| 1298 | 1288 | 'Expires' => $this->db->getInt('expires'), |
| 1299 | 1289 | 'Recent' => $this->db->getField('recent')); |
| 1290 | + } |
|
| 1300 | 1291 | } |
| 1301 | 1292 | return $this->tickers; |
| 1302 | 1293 | } |
@@ -1318,9 +1309,15 @@ discard block |
||
| 1318 | 1309 | } |
| 1319 | 1310 | |
| 1320 | 1311 | public function getTurnsLevel() { |
| 1321 | - if (!$this->hasTurns()) return 'NONE'; |
|
| 1322 | - if ($this->getTurns() <= 25) return 'LOW'; |
|
| 1323 | - if ($this->getTurns() <= 75) return 'MEDIUM'; |
|
| 1312 | + if (!$this->hasTurns()) { |
|
| 1313 | + return 'NONE'; |
|
| 1314 | + } |
|
| 1315 | + if ($this->getTurns() <= 25) { |
|
| 1316 | + return 'LOW'; |
|
| 1317 | + } |
|
| 1318 | + if ($this->getTurns() <= 75) { |
|
| 1319 | + return 'MEDIUM'; |
|
| 1320 | + } |
|
| 1324 | 1321 | return 'HIGH'; |
| 1325 | 1322 | } |
| 1326 | 1323 | |
@@ -97,8 +97,9 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | $distanceQ = array(); |
| 100 | - for ($i = 0; $i <= TURNS_WARP_SECTOR_EQUIVALENCE; $i++) |
|
| 101 | - $distanceQ[] = array(); |
|
| 100 | + for ($i = 0; $i <= TURNS_WARP_SECTOR_EQUIVALENCE; $i++) { |
|
| 101 | + $distanceQ[] = array(); |
|
| 102 | + } |
|
| 102 | 103 | //Warps first as a slight optimisation due to how visitedSectors is set. |
| 103 | 104 | if ($checkSector->hasWarp() === true) { |
| 104 | 105 | $d = new Distance($gameID, $checkSector->getSectorID()); |
@@ -136,8 +137,7 @@ discard block |
||
| 136 | 137 | $checkSector = SmrSector::getSector($gameID, $checkSectorID); |
| 137 | 138 | if ($x == 'Distance') { |
| 138 | 139 | $distances[$sectorsTravelled][$checkSector->getSectorID()] = $distance; |
| 139 | - } |
|
| 140 | - else if (($needsToHaveBeenExploredBy === null || $needsToHaveBeenExploredBy->hasVisitedSector($checkSector->getSectorID())) === true |
|
| 140 | + } else if (($needsToHaveBeenExploredBy === null || $needsToHaveBeenExploredBy->hasVisitedSector($checkSector->getSectorID())) === true |
|
| 141 | 141 | && $checkSector->hasX($x, $player) === true) { |
| 142 | 142 | if ($useFirst === true) { |
| 143 | 143 | return $distance; |
@@ -22,8 +22,7 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | if ($alliance_id) { |
| 24 | 24 | $in_alliance = ($alliance_id == $player->getAllianceID()); |
| 25 | - } |
|
| 26 | - else { |
|
| 25 | + } else { |
|
| 27 | 26 | $in_alliance = $player->hasAlliance(); |
| 28 | 27 | } |
| 29 | 28 | if (!$in_alliance) { |
@@ -36,8 +35,7 @@ discard block |
||
| 36 | 35 | $mbRead = $db->getBoolean('mb_read'); |
| 37 | 36 | $modRead = $db->getBoolean('mod_read'); |
| 38 | 37 | $planetLand = $db->getBoolean('planet_land'); |
| 39 | - } |
|
| 40 | - else { |
|
| 38 | + } else { |
|
| 41 | 39 | $mbRead = FALSE; |
| 42 | 40 | $modRead = FALSE; |
| 43 | 41 | $planetLand = FALSE; |
@@ -366,8 +364,7 @@ discard block |
||
| 366 | 364 | } |
| 367 | 365 | } |
| 368 | 366 | $return .= ('</small></td>'); |
| 369 | - } |
|
| 370 | - else { |
|
| 367 | + } else { |
|
| 371 | 368 | // if it's not the first entry we have to put |
| 372 | 369 | // additional empty cell for the spacer |
| 373 | 370 | //if ($number > 0) |
@@ -153,8 +153,7 @@ discard block |
||
| 153 | 153 | $this->checkDefenses(); |
| 154 | 154 | $this->getGoods(); |
| 155 | 155 | $this->checkForUpgrade(); |
| 156 | - } |
|
| 157 | - else { |
|
| 156 | + } else { |
|
| 158 | 157 | $this->shields = 0; |
| 159 | 158 | $this->combatDrones = 0; |
| 160 | 159 | $this->armour = 0; |
@@ -566,8 +565,7 @@ discard block |
||
| 566 | 565 | } |
| 567 | 566 | if (($key = array_search($goodID, $this->goodIDs['Buy'])) !== false) { |
| 568 | 567 | array_splice($this->goodIDs['Buy'], $key, 1); |
| 569 | - } |
|
| 570 | - elseif (($key = array_search($goodID, $this->goodIDs['Sell'])) !== false) { |
|
| 568 | + } elseif (($key = array_search($goodID, $this->goodIDs['Sell'])) !== false) { |
|
| 571 | 569 | array_splice($this->goodIDs['Sell'], $key, 1); |
| 572 | 570 | } |
| 573 | 571 | |
@@ -649,8 +647,7 @@ discard block |
||
| 649 | 647 | $newsMessage = '<span class="red bold">*MAYDAY* *MAYDAY*</span> A distress beacon has been activated by the port in sector ' . Globals::getSectorBBLink($this->getSectorID()) . '. It is under attack by '; |
| 650 | 648 | if ($trigger->hasAlliance()) { |
| 651 | 649 | $newsMessage .= 'members of ' . $trigger->getAllianceBBLink(); |
| 652 | - } |
|
| 653 | - else { |
|
| 650 | + } else { |
|
| 654 | 651 | $newsMessage .= $trigger->getBBLink(); |
| 655 | 652 | } |
| 656 | 653 | |
@@ -659,8 +656,7 @@ discard block |
||
| 659 | 656 | |
| 660 | 657 | if ($trigger->hasAlliance()) { |
| 661 | 658 | $newsMessage .= 'bounties of <span class="creds">' . $bounty . '</span> credits for the deaths of any raiding members of ' . $trigger->getAllianceBBLink(); |
| 662 | - } |
|
| 663 | - else { |
|
| 659 | + } else { |
|
| 664 | 660 | $newsMessage .= 'a bounty of <span class="creds">' . $bounty . '</span> credits for the death of ' . $trigger->getBBLink(); |
| 665 | 661 | } |
| 666 | 662 | $newsMessage .= ' prior to the destruction of the port, or until federal forces arrive to defend the port.'; |
@@ -1005,8 +1001,9 @@ discard block |
||
| 1005 | 1001 | if ($transactionType == 'Buy') { |
| 1006 | 1002 | $relationsEffect = 2 - $relationsEffect; |
| 1007 | 1003 | return max($idealPrice, IFloor($idealPrice * $relationsEffect)); |
| 1008 | - } else |
|
| 1009 | - return min($idealPrice, ICeil($idealPrice * $relationsEffect)); |
|
| 1004 | + } else { |
|
| 1005 | + return min($idealPrice, ICeil($idealPrice * $relationsEffect)); |
|
| 1006 | + } |
|
| 1010 | 1007 | } |
| 1011 | 1008 | // $range = .11 - .095; |
| 1012 | 1009 | // $rand = .095 + $range * mt_rand(0, 32767)/32767; |
@@ -1069,8 +1066,7 @@ discard block |
||
| 1069 | 1066 | if ($this->getCredits() > 0) { |
| 1070 | 1067 | $container = create_container('skeleton.php', 'port_payout_processing.php'); |
| 1071 | 1068 | $container['PayoutType'] = 'Loot'; |
| 1072 | - } |
|
| 1073 | - else { |
|
| 1069 | + } else { |
|
| 1074 | 1070 | $container = create_container('skeleton.php', 'current_sector.php'); |
| 1075 | 1071 | $container['msg'] = 'This port has already been looted.'; |
| 1076 | 1072 | } |
@@ -1141,9 +1137,9 @@ discard block |
||
| 1141 | 1137 | if ($db->nextRecord()) { |
| 1142 | 1138 | self::$CACHE_CACHED_PORTS[$gameID][$sectorID][$accountID] = unserialize(gzuncompress($db->getField('port_info'))); |
| 1143 | 1139 | self::$CACHE_CACHED_PORTS[$gameID][$sectorID][$accountID]->setCachedTime($db->getInt('visited')); |
| 1140 | + } else { |
|
| 1141 | + self::$CACHE_CACHED_PORTS[$gameID][$sectorID][$accountID] = false; |
|
| 1144 | 1142 | } |
| 1145 | - else |
|
| 1146 | - self::$CACHE_CACHED_PORTS[$gameID][$sectorID][$accountID] = false; |
|
| 1147 | 1143 | } |
| 1148 | 1144 | return self::$CACHE_CACHED_PORTS[$gameID][$sectorID][$accountID]; |
| 1149 | 1145 | } |
@@ -1189,8 +1185,7 @@ discard block |
||
| 1189 | 1185 | ', attack_started = ' . $this->db->escapeNumber($this->getAttackStarted()) . |
| 1190 | 1186 | ', race_id = ' . $this->db->escapeNumber($this->getRaceID()) . ' |
| 1191 | 1187 | WHERE ' . $this->SQL . ' LIMIT 1'); |
| 1192 | - } |
|
| 1193 | - else { |
|
| 1188 | + } else { |
|
| 1194 | 1189 | $this->db->query('INSERT INTO port (game_id,sector_id,experience,shields,armour,combat_drones,level,credits,upgrade,reinforce_time,attack_started,race_id) |
| 1195 | 1190 | values |
| 1196 | 1191 | (' . $this->db->escapeNumber($this->getGameID()) . |
@@ -1273,8 +1268,7 @@ discard block |
||
| 1273 | 1268 | $armourDamage = $this->doArmourDamage(min($damage['MaxDamage'], $damage['Armour'])); |
| 1274 | 1269 | } |
| 1275 | 1270 | } |
| 1276 | - } |
|
| 1277 | - else { //hit drones behind shields |
|
| 1271 | + } else { //hit drones behind shields |
|
| 1278 | 1272 | $cdDamage = $this->doCDDamage(IFloor(min($damage['MaxDamage'], $damage['Armour']) * DRONES_BEHIND_SHIELDS_DAMAGE_PERCENT)); |
| 1279 | 1273 | } |
| 1280 | 1274 | } |
@@ -1370,8 +1364,11 @@ discard block |
||
| 1370 | 1364 | |
| 1371 | 1365 | // News Entry |
| 1372 | 1366 | $news = $this->getDisplayName() . ' has been successfully raided by '; |
| 1373 | - if ($killer->hasAlliance()) $news .= 'the members of <span class="yellow">' . $killer->getAllianceBBLink() . '</span>'; |
|
| 1374 | - else $news .= $killer->getBBLink(); |
|
| 1367 | + if ($killer->hasAlliance()) { |
|
| 1368 | + $news .= 'the members of <span class="yellow">' . $killer->getAllianceBBLink() . '</span>'; |
|
| 1369 | + } else { |
|
| 1370 | + $news .= $killer->getBBLink(); |
|
| 1371 | + } |
|
| 1375 | 1372 | $this->db->query('INSERT INTO news (game_id, time, news_message, type,killer_id,killer_alliance,dead_id) VALUES (' . $this->db->escapeNumber($this->getGameID()) . ', ' . $this->db->escapeNumber(TIME) . ', ' . $this->db->escapeString($news) . ', \'REGULAR\',' . $this->db->escapeNumber($killer->getAccountID()) . ',' . $this->db->escapeNumber($killer->getAllianceID()) . ',' . $this->db->escapeNumber(ACCOUNT_ID_PORT) . ')'); |
| 1376 | 1373 | // Killer gets a relations change and a bounty if port is taken |
| 1377 | 1374 | $return['KillerBounty'] = $killer->getExperience() * $this->getLevel(); |
@@ -132,8 +132,7 @@ discard block |
||
| 132 | 132 | return '<div class="buttonA"><a class="buttonA" href="' . SmrSession::getNewHREF($container) . '">Join ' . $alliance->getAllianceDisplayName() . '</a></div>'; |
| 133 | 133 | break; |
| 134 | 134 | } |
| 135 | - } |
|
| 136 | - catch (Exception $e) { |
|
| 135 | + } catch (Exception $e) { |
|
| 137 | 136 | } |
| 138 | 137 | if ($action == \Nbbc\BBCode::BBCODE_CHECK) { |
| 139 | 138 | return false; |
@@ -186,8 +185,7 @@ discard block |
||
| 186 | 185 | if (strpos($message, '[') !== false) { //We have BBCode so let's do a full parse. |
| 187 | 186 | $message = $bbParser->parse($message); |
| 188 | 187 | $message = str_replace('<br />', '<br />', $message); |
| 189 | - } |
|
| 190 | - else { //Otherwise just convert newlines |
|
| 188 | + } else { //Otherwise just convert newlines |
|
| 191 | 189 | $message = nl2br($message, true); |
| 192 | 190 | } |
| 193 | 191 | return $message; |
@@ -227,8 +225,7 @@ discard block |
||
| 227 | 225 | |
| 228 | 226 | if (!is_array($actions)) { |
| 229 | 227 | $form['submit'] = '<input class="submit" type="submit" name="action" value="' . htmlspecialchars($actions) . '">'; |
| 230 | - } |
|
| 231 | - else { |
|
| 228 | + } else { |
|
| 232 | 229 | $form['submit'] = array(); |
| 233 | 230 | foreach ($actions as $action) { |
| 234 | 231 | $form['submit'][$action[0]] = '<input class="submit" type="submit" name="action" value="' . htmlspecialchars($action[1]) . '">'; |
@@ -319,8 +316,7 @@ discard block |
||
| 319 | 316 | } |
| 320 | 317 | if ($maxValue - $minValue == 0) { |
| 321 | 318 | return $text; |
| 322 | - } |
|
| 323 | - else { |
|
| 319 | + } else { |
|
| 324 | 320 | $normalisedValue = round(510 * max(0, min($maxValue, $value) - $minValue) / ($maxValue - $minValue)) - 255; |
| 325 | 321 | } |
| 326 | 322 | if ($type == 'Game') { |
@@ -330,28 +326,33 @@ discard block |
||
| 330 | 326 | if (strlen($g_component) == 1) { |
| 331 | 327 | $g_component = '0' . $g_component; |
| 332 | 328 | } |
| 333 | - } |
|
| 334 | - else if ($normalisedValue > 0) { |
|
| 329 | + } else if ($normalisedValue > 0) { |
|
| 335 | 330 | $g_component = 'ff'; |
| 336 | 331 | $r_component = dechex(255 - $normalisedValue); |
| 337 | 332 | if (strlen($r_component) == 1) { |
| 338 | 333 | $r_component = '0' . $r_component; |
| 339 | 334 | } |
| 340 | - } |
|
| 341 | - else { |
|
| 335 | + } else { |
|
| 342 | 336 | $r_component = 'ff'; |
| 343 | 337 | $g_component = 'ff'; |
| 344 | 338 | } |
| 345 | 339 | $colour = $r_component . $g_component . '00'; |
| 346 | - if ($return_type == 'Colour') return $colour; |
|
| 340 | + if ($return_type == 'Colour') { |
|
| 341 | + return $colour; |
|
| 342 | + } |
|
| 347 | 343 | return '<span style="color:#' . $colour . '">' . $text . '</span>'; |
| 348 | - } |
|
| 349 | - elseif ($type == 'IRC') { |
|
| 344 | + } elseif ($type == 'IRC') { |
|
| 350 | 345 | //IRC color codes |
| 351 | - if ($normalisedValue == 255) $colour = '[k03]'; |
|
| 352 | - elseif ($normalisedValue == -255) $colour = '[k04]'; |
|
| 353 | - else $colour = '[k08]'; |
|
| 354 | - if ($return_type == 'Colour') return $colour; |
|
| 346 | + if ($normalisedValue == 255) { |
|
| 347 | + $colour = '[k03]'; |
|
| 348 | + } elseif ($normalisedValue == -255) { |
|
| 349 | + $colour = '[k04]'; |
|
| 350 | + } else { |
|
| 351 | + $colour = '[k08]'; |
|
| 352 | + } |
|
| 353 | + if ($return_type == 'Colour') { |
|
| 354 | + return $colour; |
|
| 355 | + } |
|
| 355 | 356 | return $colour . $text; |
| 356 | 357 | } |
| 357 | 358 | } |
@@ -410,10 +411,18 @@ discard block |
||
| 410 | 411 | // create account object |
| 411 | 412 | $account = SmrSession::getAccount(); |
| 412 | 413 | |
| 413 | - if (!defined('DATE_DATE_SHORT')) define('DATE_DATE_SHORT', $account->getShortDateFormat()); |
|
| 414 | - if (!defined('DATE_TIME_SHORT')) define('DATE_TIME_SHORT', $account->getShortTimeFormat()); |
|
| 415 | - if (!defined('DATE_FULL_SHORT')) define('DATE_FULL_SHORT', DATE_DATE_SHORT . ' ' . DATE_TIME_SHORT); |
|
| 416 | - if (!defined('DATE_FULL_SHORT_SPLIT')) define('DATE_FULL_SHORT_SPLIT', DATE_DATE_SHORT . '\<b\r /\>' . DATE_TIME_SHORT); |
|
| 414 | + if (!defined('DATE_DATE_SHORT')) { |
|
| 415 | + define('DATE_DATE_SHORT', $account->getShortDateFormat()); |
|
| 416 | + } |
|
| 417 | + if (!defined('DATE_TIME_SHORT')) { |
|
| 418 | + define('DATE_TIME_SHORT', $account->getShortTimeFormat()); |
|
| 419 | + } |
|
| 420 | + if (!defined('DATE_FULL_SHORT')) { |
|
| 421 | + define('DATE_FULL_SHORT', DATE_DATE_SHORT . ' ' . DATE_TIME_SHORT); |
|
| 422 | + } |
|
| 423 | + if (!defined('DATE_FULL_SHORT_SPLIT')) { |
|
| 424 | + define('DATE_FULL_SHORT_SPLIT', DATE_DATE_SHORT . '\<b\r /\>' . DATE_TIME_SHORT); |
|
| 425 | + } |
|
| 417 | 426 | |
| 418 | 427 | // initialize objects we usually need, like player, ship |
| 419 | 428 | if (SmrSession::hasGame()) { |
@@ -460,8 +469,9 @@ discard block |
||
| 460 | 469 | |
| 461 | 470 | if (!$player->isDead() && $player->getNewbieTurns() <= NEWBIE_TURNS_WARNING_LIMIT && |
| 462 | 471 | $player->getNewbieWarning() && |
| 463 | - $var['url'] != 'newbie_warning_processing.php') |
|
| 464 | - forward(create_container('newbie_warning_processing.php')); |
|
| 472 | + $var['url'] != 'newbie_warning_processing.php') { |
|
| 473 | + forward(create_container('newbie_warning_processing.php')); |
|
| 474 | + } |
|
| 465 | 475 | } |
| 466 | 476 | |
| 467 | 477 | // Initialize the template |
@@ -567,8 +577,7 @@ discard block |
||
| 567 | 577 | |
| 568 | 578 | usleep(25000 * $locksInQueue); |
| 569 | 579 | continue; |
| 570 | - } |
|
| 571 | - else { |
|
| 580 | + } else { |
|
| 572 | 581 | return true; |
| 573 | 582 | } |
| 574 | 583 | } |
@@ -765,7 +774,9 @@ discard block |
||
| 765 | 774 | $container['player_id'] = $player->getPlayerID(); |
| 766 | 775 | $template->assign('PlayerNameLink', SmrSession::getNewHREF($container)); |
| 767 | 776 | |
| 768 | - if (is_array(Globals::getHiddenPlayers()) && in_array($player->getAccountID(), Globals::getHiddenPlayers())) $template->assign('PlayerInvisible', true); |
|
| 777 | + if (is_array(Globals::getHiddenPlayers()) && in_array($player->getAccountID(), Globals::getHiddenPlayers())) { |
|
| 778 | + $template->assign('PlayerInvisible', true); |
|
| 779 | + } |
|
| 769 | 780 | |
| 770 | 781 | // ******* Hardware ******* |
| 771 | 782 | $container = create_container('skeleton.php', 'configure_hardware.php'); |