We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | <tr> |
| 5 | 5 | <td align="right" class="bold">Account ID:</td> |
| 6 | 6 | <td><?php |
| 7 | - if(isset($EditingAccount)) { |
|
| 7 | + if (isset($EditingAccount)) { |
|
| 8 | 8 | echo $EditingAccount->getAccountID(); |
| 9 | 9 | } |
| 10 | 10 | else { ?> |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | <tr> |
| 16 | 16 | <td align="right" class="bold">Login:</td> |
| 17 | 17 | <td><?php |
| 18 | - if(isset($EditingAccount)) { |
|
| 18 | + if (isset($EditingAccount)) { |
|
| 19 | 19 | echo $EditingAccount->getLogin(); |
| 20 | 20 | } |
| 21 | 21 | else { ?> |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | <tr> |
| 27 | 27 | <td align="right" class="bold">Validation Code:</td> |
| 28 | 28 | <td><?php |
| 29 | - if(isset($EditingAccount)) { |
|
| 29 | + if (isset($EditingAccount)) { |
|
| 30 | 30 | echo $EditingAccount->getValidationCode(); |
| 31 | 31 | } |
| 32 | 32 | else { ?> |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | <tr> |
| 38 | 38 | <td align="right" class="bold">Email:</td> |
| 39 | 39 | <td><?php |
| 40 | - if(isset($EditingAccount)) { |
|
| 40 | + if (isset($EditingAccount)) { |
|
| 41 | 41 | echo $EditingAccount->getEmail(); |
| 42 | 42 | } |
| 43 | 43 | else { ?> |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | <tr> |
| 49 | 49 | <td align="right" class="bold">HoF Name:</td> |
| 50 | 50 | <td><?php |
| 51 | - if(isset($EditingAccount)) { |
|
| 51 | + if (isset($EditingAccount)) { |
|
| 52 | 52 | echo $EditingAccount->getHofName(); |
| 53 | 53 | } |
| 54 | 54 | else { ?> |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | </td> |
| 58 | 58 | </tr><?php |
| 59 | 59 | |
| 60 | - if(isset($EditingAccount)) { ?> |
|
| 60 | + if (isset($EditingAccount)) { ?> |
|
| 61 | 61 | <tr> |
| 62 | 62 | <td align="right" class="bold">Points:</td> |
| 63 | 63 | <td><?php echo $EditingAccount->getPoints(); ?></td> |
@@ -84,15 +84,15 @@ discard block |
||
| 84 | 84 | <td colspan="2"> </td> |
| 85 | 85 | </tr><?php |
| 86 | 86 | |
| 87 | - if(isset($EditingAccount)) { ?> |
|
| 87 | + if (isset($EditingAccount)) { ?> |
|
| 88 | 88 | <tr> |
| 89 | 89 | <td align="right" valign="top" class="bold">Player:</td> |
| 90 | 90 | <td><?php |
| 91 | - if(count($EditingPlayers)) { ?> |
|
| 91 | + if (count($EditingPlayers)) { ?> |
|
| 92 | 92 | <a onclick="$('#accountPlayers').fadeToggle(600);">Show/Hide</a> |
| 93 | 93 | <table id="accountPlayers" style="display:none"><?php |
| 94 | - foreach($EditingPlayers as &$CurrentPlayer) { |
|
| 95 | - $CurrentShip =& $CurrentPlayer->getShip(); ?> |
|
| 94 | + foreach ($EditingPlayers as &$CurrentPlayer) { |
|
| 95 | + $CurrentShip = & $CurrentPlayer->getShip(); ?> |
|
| 96 | 96 | <tr> |
| 97 | 97 | <td align="right">Game ID:</td> |
| 98 | 98 | <td><?php echo $CurrentPlayer->getGameID(); ?></td> |
@@ -200,8 +200,8 @@ discard block |
||
| 200 | 200 | <input type="radio" name="choise" value="pre_select"> |
| 201 | 201 | Existing Reason: <select name="reason_pre_select" onchange="go()"> |
| 202 | 202 | <option value="0">[Please Select]</option><?php |
| 203 | - foreach($BanReasons as $ReasonID => $BanReason) { ?> |
|
| 204 | - <option value="<?php echo $ReasonID; ?>"<?php if($Disabled !== false && $ReasonID == $Disabled['ReasonID']) { ?> selected="selected"<?php } ?>><?php echo $BanReason; ?></option><?php |
|
| 203 | + foreach ($BanReasons as $ReasonID => $BanReason) { ?> |
|
| 204 | + <option value="<?php echo $ReasonID; ?>"<?php if ($Disabled !== false && $ReasonID == $Disabled['ReasonID']) { ?> selected="selected"<?php } ?>><?php echo $BanReason; ?></option><?php |
|
| 205 | 205 | } ?> |
| 206 | 206 | </select> |
| 207 | 207 | </p> |
@@ -245,8 +245,8 @@ discard block |
||
| 245 | 245 | <tr> |
| 246 | 246 | <td align="right" valign="top" class="bold">Closing History:</td> |
| 247 | 247 | <td><?php |
| 248 | - if(count($ClosingHistory) > 0) { |
|
| 249 | - foreach($ClosingHistory as $Action) { |
|
| 248 | + if (count($ClosingHistory) > 0) { |
|
| 249 | + foreach ($ClosingHistory as $Action) { |
|
| 250 | 250 | echo date(DATE_FULL_SHORT, $Action['Time']); ?> - <?php echo $Action['Action']; ?> by <?php echo $Action['AdminName']; ?><br /><?php |
| 251 | 251 | } |
| 252 | 252 | } |
@@ -280,11 +280,11 @@ discard block |
||
| 280 | 280 | |
| 281 | 281 | <tr> |
| 282 | 282 | <td align="right" valign="top" class="bold">Forced Veteran:</td> |
| 283 | - <td><input type="radio" name="veteran_status" value="TRUE"<?php if($EditingAccount->isVeteranForced()) { ?> checked="checked"<?php } ?>>Yes</td> |
|
| 283 | + <td><input type="radio" name="veteran_status" value="TRUE"<?php if ($EditingAccount->isVeteranForced()) { ?> checked="checked"<?php } ?>>Yes</td> |
|
| 284 | 284 | </tr> |
| 285 | 285 | <tr> |
| 286 | 286 | <td> </td> |
| 287 | - <td><input type="radio" name="veteran_status" value="FALSE"<?php if(!$EditingAccount->isVeteranForced()) { ?> checked="checked"<?php } ?>>No</td> |
|
| 287 | + <td><input type="radio" name="veteran_status" value="FALSE"<?php if (!$EditingAccount->isVeteranForced()) { ?> checked="checked"<?php } ?>>No</td> |
|
| 288 | 288 | </tr> |
| 289 | 289 | |
| 290 | 290 | <tr> |
@@ -294,11 +294,11 @@ discard block |
||
| 294 | 294 | |
| 295 | 295 | <tr> |
| 296 | 296 | <td align="right" valign="top" class="bold">Logging:</td> |
| 297 | - <td><input type="radio" name="logging_status" value="TRUE"<?php if($EditingAccount->isLoggingEnabled()) { ?> checked="checked"<?php } ?>>Yes</td> |
|
| 297 | + <td><input type="radio" name="logging_status" value="TRUE"<?php if ($EditingAccount->isLoggingEnabled()) { ?> checked="checked"<?php } ?>>Yes</td> |
|
| 298 | 298 | </tr> |
| 299 | 299 | <tr> |
| 300 | 300 | <td> </td> |
| 301 | - <td><input type="radio" name="logging_status" value="FALSE"<?php if(!$EditingAccount->isLoggingEnabled()) { ?> checked="checked"<?php } ?>>No</td> |
|
| 301 | + <td><input type="radio" name="logging_status" value="FALSE"<?php if (!$EditingAccount->isLoggingEnabled()) { ?> checked="checked"<?php } ?>>No</td> |
|
| 302 | 302 | </tr> |
| 303 | 303 | |
| 304 | 304 | <tr> |
@@ -309,10 +309,10 @@ discard block |
||
| 309 | 309 | <tr> |
| 310 | 310 | <td align="right" valign="top" class="bold">Last IP's:</td> |
| 311 | 311 | <td><?php |
| 312 | - if(count($RecentIPs) > 0) { ?> |
|
| 312 | + if (count($RecentIPs) > 0) { ?> |
|
| 313 | 313 | <a onclick="$('#recentIPs').fadeToggle(600);">Show/Hide</a> |
| 314 | 314 | <table id="recentIPs" style="display:none"><?php |
| 315 | - foreach($RecentIPs as $RecentIP) { ?> |
|
| 315 | + foreach ($RecentIPs as $RecentIP) { ?> |
|
| 316 | 316 | <tr> |
| 317 | 317 | <td><?php echo date(DATE_FULL_SHORT, $RecentIP['Time']); ?></td> |
| 318 | 318 | <td> </td> |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | <table> |
| 351 | 351 | <tr> |
| 352 | 352 | <td><?php |
| 353 | - if(isset($EditingAccount)) { ?> |
|
| 353 | + if (isset($EditingAccount)) { ?> |
|
| 354 | 354 | <input type="submit" name="action" value="Edit Account" id="InputFields" /><?php |
| 355 | 355 | } |
| 356 | 356 | else { ?> |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | } ?> |
| 359 | 359 | </td><?php |
| 360 | 360 | |
| 361 | - if(isset($EditingAccount)) { ?> |
|
| 361 | + if (isset($EditingAccount)) { ?> |
|
| 362 | 362 | <td> |
| 363 | 363 | <div class="buttonA"><a class="buttonA" href="<?php echo $ResetFormHREF; ?>">Reset Form</a></div> |
| 364 | 364 | </td><?php |
@@ -366,9 +366,9 @@ discard block |
||
| 366 | 366 | </table> |
| 367 | 367 | </form><?php |
| 368 | 368 | |
| 369 | -if(isset($ErrorMessage)) { ?> |
|
| 369 | +if (isset($ErrorMessage)) { ?> |
|
| 370 | 370 | <div class="center red"><?php echo $ErrorMessage; ?></div><?php |
| 371 | 371 | } |
| 372 | -if(isset($Message)) { ?> |
|
| 372 | +if (isset($Message)) { ?> |
|
| 373 | 373 | <div class="center"><?php echo $Message; ?></div><?php |
| 374 | 374 | } ?> |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> |
| 2 | -<title><?php echo PAGE_TITLE; ?><?php if(isset($GameName)) echo ": $GameName"; ?></title> |
|
| 2 | +<title><?php echo PAGE_TITLE; ?><?php if (isset($GameName)) echo ": $GameName"; ?></title> |
|
| 3 | 3 | <meta http-equiv="pragma" content="no-cache" /><?php |
| 4 | -if(!is_object($ThisAccount) || $ThisAccount->isDefaultCSSEnabled()) { ?> |
|
| 4 | +if (!is_object($ThisAccount) || $ThisAccount->isDefaultCSSEnabled()) { ?> |
|
| 5 | 5 | <link rel="stylesheet" type="text/css" href="<?php echo $CSSLink; ?>" /> |
| 6 | 6 | <link rel="stylesheet" type="text/css" href="<?php echo $CSSColourLink; ?>" /><?php |
| 7 | 7 | } |
| 8 | -if(isset($ExtraCSSLink)) { |
|
| 8 | +if (isset($ExtraCSSLink)) { |
|
| 9 | 9 | ?><link rel="stylesheet" type="text/css" href="<?php echo $ExtraCSSLink; ?>" /><?php |
| 10 | 10 | } ?> |
| 11 | 11 | <style type="text/css"> |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | }<?php |
| 38 | 38 | } ?> |
| 39 | 39 | </style><?php |
| 40 | -if(isset($HeaderTemplateInclude)) { |
|
| 40 | +if (isset($HeaderTemplateInclude)) { |
|
| 41 | 41 | $this->includeTemplate($HeaderTemplateInclude); |
| 42 | 42 | } ?> |
| 43 | 43 | <link rel="stylesheet" href="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> |
@@ -1,5 +1,8 @@ |
||
| 1 | 1 | <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> |
| 2 | -<title><?php echo PAGE_TITLE; ?><?php if(isset($GameName)) echo ": $GameName"; ?></title> |
|
| 2 | +<title><?php echo PAGE_TITLE; ?><?php if(isset($GameName)) { |
|
| 3 | + echo ": $GameName"; |
|
| 4 | +} |
|
| 5 | +?></title> |
|
| 3 | 6 | <meta http-equiv="pragma" content="no-cache" /><?php |
| 4 | 7 | if(!is_object($ThisAccount) || $ThisAccount->isDefaultCSSEnabled()) { ?> |
| 5 | 8 | <link rel="stylesheet" type="text/css" href="<?php echo $CSSLink; ?>" /> |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -$template->assign('PageTopic','Edit Account'); |
|
| 3 | +$template->assign('PageTopic', 'Edit Account'); |
|
| 4 | 4 | |
| 5 | 5 | $account_id = SmrSession::getRequestVar('account_id', ''); |
| 6 | 6 | $player_name = SmrSession::getRequestVar('player_name', ''); |
@@ -8,10 +8,10 @@ discard block |
||
| 8 | 8 | SmrSession::getRequestVar('val_code', ''); |
| 9 | 9 | SmrSession::getRequestVar('email', ''); |
| 10 | 10 | SmrSession::getRequestVar('hofname', ''); |
| 11 | -if(isset($_REQUEST['game_id'])) { |
|
| 12 | - SmrSession::updateVar('SearchGameID',$_REQUEST['game_id']); |
|
| 11 | +if (isset($_REQUEST['game_id'])) { |
|
| 12 | + SmrSession::updateVar('SearchGameID', $_REQUEST['game_id']); |
|
| 13 | 13 | } |
| 14 | -elseif(!isset($var['SearchGameID'])) { |
|
| 14 | +elseif (!isset($var['SearchGameID'])) { |
|
| 15 | 15 | SmrSession::updateVar('SearchGameID', 0); |
| 16 | 16 | } |
| 17 | 17 | $action = SmrSession::getRequestVar('action', false); |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | if ($action == "Search") { |
| 23 | 23 | if (!empty($player_name)) { |
| 24 | - $gameIDClause = $var['SearchGameID'] != 0 ? ' AND game_id = ' . $db->escapeNumber($var['SearchGameID']) . ' ': ''; |
|
| 24 | + $gameIDClause = $var['SearchGameID'] != 0 ? ' AND game_id = ' . $db->escapeNumber($var['SearchGameID']) . ' ' : ''; |
|
| 25 | 25 | $db->query('SELECT account_id FROM player |
| 26 | 26 | WHERE player_name = ' . $db->escapeString($player_name) . $gameIDClause . ' |
| 27 | 27 | ORDER BY game_id DESC LIMIT 1'); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | // get account from db |
| 45 | - $db->query('SELECT account_id FROM account WHERE account_id = '.$db->escapeNumber($account_id).' OR ' . |
|
| 45 | + $db->query('SELECT account_id FROM account WHERE account_id = ' . $db->escapeNumber($account_id) . ' OR ' . |
|
| 46 | 46 | 'login LIKE ' . $db->escapeString($var['login']) . ' OR ' . |
| 47 | 47 | 'email LIKE ' . $db->escapeString($var['email']) . ' OR ' . |
| 48 | 48 | 'hof_name LIKE ' . $db->escapeString($var['hofname']) . ' OR ' . |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | |
| 58 | -if ($curr_account===false) { |
|
| 58 | +if ($curr_account === false) { |
|
| 59 | 59 | $games = array(); |
| 60 | 60 | $db->query('SELECT game_id FROM game ORDER BY end_date DESC'); |
| 61 | 61 | while ($db->nextRecord()) { |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | 'Host' => $db->getField('host') |
| 123 | 123 | ); |
| 124 | 124 | } |
| 125 | - $template->assign('RecentIPs',$recentIPs); |
|
| 125 | + $template->assign('RecentIPs', $recentIPs); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | |
@@ -10,8 +10,7 @@ discard block |
||
| 10 | 10 | SmrSession::getRequestVar('hofname', ''); |
| 11 | 11 | if(isset($_REQUEST['game_id'])) { |
| 12 | 12 | SmrSession::updateVar('SearchGameID',$_REQUEST['game_id']); |
| 13 | -} |
|
| 14 | -elseif(!isset($var['SearchGameID'])) { |
|
| 13 | +} elseif(!isset($var['SearchGameID'])) { |
|
| 15 | 14 | SmrSession::updateVar('SearchGameID', 0); |
| 16 | 15 | } |
| 17 | 16 | $action = SmrSession::getRequestVar('action', false); |
@@ -27,8 +26,7 @@ discard block |
||
| 27 | 26 | ORDER BY game_id DESC LIMIT 1'); |
| 28 | 27 | if ($db->nextRecord()) { |
| 29 | 28 | $account_id = $db->getInt('account_id'); |
| 30 | - } |
|
| 31 | - else { |
|
| 29 | + } else { |
|
| 32 | 30 | $db->query('SELECT * FROM player |
| 33 | 31 | WHERE player_name LIKE ' . $db->escapeString($player_name . '%') . $gameIDClause); |
| 34 | 32 | if ($db->nextRecord()) { |
@@ -63,8 +61,7 @@ discard block |
||
| 63 | 61 | } |
| 64 | 62 | $template->assign('Games', $games); |
| 65 | 63 | $template->assign('EditFormHREF', SmrSession::getNewHREF(create_container('skeleton.php', 'account_edit.php'))); |
| 66 | -} |
|
| 67 | -else { |
|
| 64 | +} else { |
|
| 68 | 65 | $template->assign('EditingAccount', $curr_account); |
| 69 | 66 | $template->assign('EditFormHREF', SmrSession::getNewHREF(create_container('account_edit_processing.php', '', array('account_id' => $curr_account->getAccountID())))); |
| 70 | 67 | $template->assign('ResetFormHREF', SmrSession::getNewHREF(create_container('skeleton.php', 'account_edit.php'))); |
@@ -96,8 +93,7 @@ discard block |
||
| 96 | 93 | $admin_id = $db->getInt('admin_id'); |
| 97 | 94 | if ($admin_id > 0) { |
| 98 | 95 | $admin = SmrAccount::getAccount($admin_id)->getLogin(); |
| 99 | - } |
|
| 100 | - else { |
|
| 96 | + } else { |
|
| 101 | 97 | $admin = 'System'; |
| 102 | 98 | } |
| 103 | 99 | $closingHistory[] = array( |
@@ -1,44 +1,44 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | function logException(Throwable $e) { |
| 3 | - global $account,$var,$player,$db; |
|
| 3 | + global $account, $var, $player, $db; |
|
| 4 | 4 | $errorType = 'Unexpected Game Error!'; |
| 5 | - $message=''; |
|
| 6 | - $currMySQLError=''; |
|
| 5 | + $message = ''; |
|
| 6 | + $currMySQLError = ''; |
|
| 7 | 7 | |
| 8 | - if(is_object($account)) { |
|
| 9 | - $message .= 'Login: '.$account->getLogin().EOL.EOL.'-----------'.EOL.EOL. |
|
| 10 | - 'Account ID: '.$account->getAccountID().EOL.EOL.'-----------'.EOL.EOL. |
|
| 11 | - 'E-Mail: '.$account->getEmail().EOL.EOL.'-----------'.EOL.EOL; |
|
| 8 | + if (is_object($account)) { |
|
| 9 | + $message .= 'Login: ' . $account->getLogin() . EOL . EOL . '-----------' . EOL . EOL . |
|
| 10 | + 'Account ID: ' . $account->getAccountID() . EOL . EOL . '-----------' . EOL . EOL . |
|
| 11 | + 'E-Mail: ' . $account->getEmail() . EOL . EOL . '-----------' . EOL . EOL; |
|
| 12 | 12 | } |
| 13 | - $message .= 'Error Message: '. $e .EOL.EOL.'-----------'.EOL.EOL; |
|
| 13 | + $message .= 'Error Message: ' . $e . EOL . EOL . '-----------' . EOL . EOL; |
|
| 14 | 14 | |
| 15 | 15 | // Only check database if it was already loaded (do not try to autoload) |
| 16 | 16 | if (class_exists('MySqlDatabase', false) && ($db instanceof MySqlDatabase)) { |
| 17 | - if($currMySQLError = $db->getError()) { |
|
| 17 | + if ($currMySQLError = $db->getError()) { |
|
| 18 | 18 | $errorType = 'Database Error'; |
| 19 | - $message .= 'MySQL Error MSG: '.$db->getError().EOL.EOL.'-----------'.EOL.EOL; |
|
| 19 | + $message .= 'MySQL Error MSG: ' . $db->getError() . EOL . EOL . '-----------' . EOL . EOL; |
|
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | $message .= |
| 24 | - '$var: '.var_export($var,true).EOL.EOL.'-----------'.EOL.EOL. |
|
| 25 | - 'USING_AJAX: '.(defined('USING_AJAX')?var_export(USING_AJAX,true):'undefined'); |
|
| 24 | + '$var: ' . var_export($var, true) . EOL . EOL . '-----------' . EOL . EOL . |
|
| 25 | + 'USING_AJAX: ' . (defined('USING_AJAX') ?var_export(USING_AJAX, true) : 'undefined'); |
|
| 26 | 26 | |
| 27 | 27 | try { |
| 28 | - if(function_exists('release_lock')) |
|
| 28 | + if (function_exists('release_lock')) |
|
| 29 | 29 | release_lock(); //Try to release lock so they can carry on normally |
| 30 | 30 | } |
| 31 | - catch(Throwable $ee) { |
|
| 32 | - $message .= EOL.EOL.'-----------'.EOL.EOL. |
|
| 33 | - 'Releasing Lock Failed' .EOL. |
|
| 34 | - 'Message: ' . $ee .EOL.EOL; |
|
| 35 | - if($currMySQLError!=$db->getError()) { |
|
| 36 | - $message .= 'MySQL Error MSG: '.$db->getError().EOL.EOL; |
|
| 31 | + catch (Throwable $ee) { |
|
| 32 | + $message .= EOL . EOL . '-----------' . EOL . EOL . |
|
| 33 | + 'Releasing Lock Failed' . EOL . |
|
| 34 | + 'Message: ' . $ee . EOL . EOL; |
|
| 35 | + if ($currMySQLError != $db->getError()) { |
|
| 36 | + $message .= 'MySQL Error MSG: ' . $db->getError() . EOL . EOL; |
|
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | if (defined('NPC_SCRIPT')) { |
| 41 | - $message = 'Script: '.SCRIPT_ID.EOL.EOL.'-----------'.EOL.EOL.$message; |
|
| 41 | + $message = 'Script: ' . SCRIPT_ID . EOL . EOL . '-----------' . EOL . EOL . $message; |
|
| 42 | 42 | var_dump($message); |
| 43 | 43 | return; |
| 44 | 44 | } |
@@ -46,16 +46,16 @@ discard block |
||
| 46 | 46 | // Unconditionally send error message to the log |
| 47 | 47 | error_log($message); |
| 48 | 48 | |
| 49 | - if(ENABLE_DEBUG) { |
|
| 49 | + if (ENABLE_DEBUG) { |
|
| 50 | 50 | // Display error message on the page and then exit |
| 51 | 51 | echo nl2br($message); |
| 52 | 52 | exit; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | // Send error message to the in-game auto bugs mailbox |
| 56 | - if (is_object($player) && method_exists($player,'sendMessageToBox')) { |
|
| 56 | + if (is_object($player) && method_exists($player, 'sendMessageToBox')) { |
|
| 57 | 57 | $player->sendMessageToBox(BOX_BUGS_AUTO, $message); |
| 58 | - } elseif (is_object($account) && method_exists($account,'sendMessageToBox')) { |
|
| 58 | + } elseif (is_object($account) && method_exists($account, 'sendMessageToBox')) { |
|
| 59 | 59 | // Will be logged without a game_id |
| 60 | 60 | $account->sendMessageToBox(BOX_BUGS_AUTO, $message); |
| 61 | 61 | } else { |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | // If this is an ajax update, we don't really have a way to redirect |
| 92 | 92 | // to an error page at this time, so we just quit. |
| 93 | - if(!defined('USING_AJAX')||!USING_AJAX) |
|
| 94 | - header('location: /error.php?msg='.urlencode($errorType)); |
|
| 93 | + if (!defined('USING_AJAX') || !USING_AJAX) |
|
| 94 | + header('location: /error.php?msg=' . urlencode($errorType)); |
|
| 95 | 95 | exit; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -123,5 +123,5 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | // Initialize the template |
| 125 | 125 | $template = new Template(); |
| 126 | -$GLOBALS['template'] =& $template; |
|
| 126 | +$GLOBALS['template'] = & $template; |
|
| 127 | 127 | |
@@ -5,14 +5,14 @@ discard block |
||
| 5 | 5 | define('TIME', intval(MICRO_TIME)); |
| 6 | 6 | |
| 7 | 7 | // Repository paths |
| 8 | -const ROOT = __DIR__ . '/../'; |
|
| 9 | -const LIB = ROOT.'lib/'; |
|
| 10 | -const ENGINE = ROOT.'engine/'; |
|
| 11 | -const WWW = ROOT.'htdocs/'; |
|
| 12 | -const UPLOAD = WWW.'upload/'; |
|
| 13 | -const ADMIN = ROOT.'admin/'; |
|
| 14 | -const TOOLS = ROOT.'tools/'; |
|
| 15 | -const CONFIG = ROOT.'config/'; |
|
| 8 | +const ROOT = __DIR__ . '/../'; |
|
| 9 | +const LIB = ROOT . 'lib/'; |
|
| 10 | +const ENGINE = ROOT . 'engine/'; |
|
| 11 | +const WWW = ROOT . 'htdocs/'; |
|
| 12 | +const UPLOAD = WWW . 'upload/'; |
|
| 13 | +const ADMIN = ROOT . 'admin/'; |
|
| 14 | +const TOOLS = ROOT . 'tools/'; |
|
| 15 | +const CONFIG = ROOT . 'config/'; |
|
| 16 | 16 | const TEMPLATES_DIR = ROOT . 'templates/'; |
| 17 | 17 | |
| 18 | 18 | // Define server-specific constants |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | if (ENABLE_DEBUG) { |
| 22 | 22 | // Warn about everything when in debug mode |
| 23 | - error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); |
|
| 23 | + error_reporting(E_ERROR|E_WARNING|E_PARSE|E_NOTICE); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | // Change the browser title based on the server config |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | const DEFAULT_DATE_DATE_SHORT = 'j/n/Y'; |
| 63 | 63 | const DEFAULT_DATE_TIME_SHORT = 'g:i:s A'; |
| 64 | -const DEFAULT_DATE_FULL_SHORT = DEFAULT_DATE_DATE_SHORT.' '.DEFAULT_DATE_TIME_SHORT; |
|
| 65 | -const DEFAULT_DATE_FULL_SHORT_SPLIT = DEFAULT_DATE_DATE_SHORT.'\<b\r /\>'.DEFAULT_DATE_TIME_SHORT; |
|
| 66 | -const DEFAULT_DATE_FULL_LONG = 'l jS F '.DEFAULT_DATE_TIME_SHORT; |
|
| 64 | +const DEFAULT_DATE_FULL_SHORT = DEFAULT_DATE_DATE_SHORT . ' ' . DEFAULT_DATE_TIME_SHORT; |
|
| 65 | +const DEFAULT_DATE_FULL_SHORT_SPLIT = DEFAULT_DATE_DATE_SHORT . '\<b\r /\>' . DEFAULT_DATE_TIME_SHORT; |
|
| 66 | +const DEFAULT_DATE_FULL_LONG = 'l jS F ' . DEFAULT_DATE_TIME_SHORT; |
|
| 67 | 67 | |
| 68 | 68 | /* |
| 69 | 69 | * Buyer restrictions for ships and weapons |
@@ -419,4 +419,4 @@ discard block |
||
| 419 | 419 | const LOCK_DURATION = 10; // The max time for a lock to last before timing out. |
| 420 | 420 | const LOCK_BUFFER = 3; // The minimum time that must be remaining on the lock duration for the lock to be valid. |
| 421 | 421 | |
| 422 | -define('USING_AJAX',isset($_REQUEST['ajax'])&&$_REQUEST['ajax']==1); |
|
| 422 | +define('USING_AJAX', isset($_REQUEST['ajax']) && $_REQUEST['ajax'] == 1); |
|
@@ -23,12 +23,12 @@ discard block |
||
| 23 | 23 | protected $hasChangedCargo = false; |
| 24 | 24 | protected $hasChangedHardware = array(); |
| 25 | 25 | |
| 26 | - public static function &getBaseShip($gameTypeID,$shipTypeID,$forceUpdate = false) { |
|
| 27 | - if($forceUpdate || !isset(self::$CACHE_BASE_SHIPS[$gameTypeID][$shipTypeID])) { |
|
| 26 | + public static function &getBaseShip($gameTypeID, $shipTypeID, $forceUpdate = false) { |
|
| 27 | + if ($forceUpdate || !isset(self::$CACHE_BASE_SHIPS[$gameTypeID][$shipTypeID])) { |
|
| 28 | 28 | // determine ship |
| 29 | 29 | $db = new SmrMySqlDatabase(); |
| 30 | - $db->query('SELECT * FROM ship_type WHERE ship_type_id = '.$db->escapeNumber($shipTypeID).' LIMIT 1'); //TODO add game type id |
|
| 31 | - if($db->nextRecord()) |
|
| 30 | + $db->query('SELECT * FROM ship_type WHERE ship_type_id = ' . $db->escapeNumber($shipTypeID) . ' LIMIT 1'); //TODO add game type id |
|
| 31 | + if ($db->nextRecord()) |
|
| 32 | 32 | self::$CACHE_BASE_SHIPS[$gameTypeID][$shipTypeID] = self::buildBaseShip($db); |
| 33 | 33 | else |
| 34 | 34 | self::$CACHE_BASE_SHIPS[$gameTypeID][$shipTypeID] = false; |
@@ -40,40 +40,40 @@ discard block |
||
| 40 | 40 | $ship = array(); |
| 41 | 41 | $ship['Type'] = 'Ship'; |
| 42 | 42 | $ship['Name'] = $db->getField('ship_name'); |
| 43 | - $ship['ShipTypeID'] = $db->getField('ship_type_id'); |
|
| 44 | - $ship['RaceID'] = $db->getField('race_id'); |
|
| 45 | - $ship['Hardpoint'] = $db->getField('hardpoint'); |
|
| 43 | + $ship['ShipTypeID'] = $db->getField('ship_type_id'); |
|
| 44 | + $ship['RaceID'] = $db->getField('race_id'); |
|
| 45 | + $ship['Hardpoint'] = $db->getField('hardpoint'); |
|
| 46 | 46 | $ship['Speed'] = $db->getField('speed'); |
| 47 | - $ship['Cost'] = $db->getField('cost'); |
|
| 48 | - $ship['AlignRestriction'] = $db->getField('buyer_restriction'); |
|
| 47 | + $ship['Cost'] = $db->getField('cost'); |
|
| 48 | + $ship['AlignRestriction'] = $db->getField('buyer_restriction'); |
|
| 49 | 49 | $ship['Level'] = $db->getField('lvl_needed'); |
| 50 | 50 | |
| 51 | 51 | $maxPower = 0; |
| 52 | - switch($ship['Hardpoint']) { |
|
| 52 | + switch ($ship['Hardpoint']) { |
|
| 53 | 53 | default: |
| 54 | - $maxPower+=1*$ship['Hardpoint']-10; |
|
| 54 | + $maxPower += 1 * $ship['Hardpoint'] - 10; |
|
| 55 | 55 | case 10: |
| 56 | - $maxPower+=2; |
|
| 56 | + $maxPower += 2; |
|
| 57 | 57 | case 9: |
| 58 | - $maxPower+=2; |
|
| 58 | + $maxPower += 2; |
|
| 59 | 59 | case 8: |
| 60 | - $maxPower+=2; |
|
| 60 | + $maxPower += 2; |
|
| 61 | 61 | case 7: |
| 62 | - $maxPower+=2; |
|
| 62 | + $maxPower += 2; |
|
| 63 | 63 | case 6: |
| 64 | - $maxPower+=3; |
|
| 64 | + $maxPower += 3; |
|
| 65 | 65 | case 5: |
| 66 | - $maxPower+=3; |
|
| 66 | + $maxPower += 3; |
|
| 67 | 67 | case 4: |
| 68 | - $maxPower+=3; |
|
| 68 | + $maxPower += 3; |
|
| 69 | 69 | case 3: |
| 70 | - $maxPower+=4; |
|
| 70 | + $maxPower += 4; |
|
| 71 | 71 | case 2: |
| 72 | - $maxPower+=4; |
|
| 72 | + $maxPower += 4; |
|
| 73 | 73 | case 1: |
| 74 | - $maxPower+=5; |
|
| 74 | + $maxPower += 5; |
|
| 75 | 75 | case 0: |
| 76 | - $maxPower+=0; |
|
| 76 | + $maxPower += 0; |
|
| 77 | 77 | } |
| 78 | 78 | $ship['MaxPower'] = $maxPower; |
| 79 | 79 | |
@@ -81,38 +81,38 @@ discard block |
||
| 81 | 81 | // get supported hardware from db |
| 82 | 82 | $db2 = new SmrMySqlDatabase(); |
| 83 | 83 | $db2->query('SELECT hardware_type_id, max_amount FROM ship_type_support_hardware ' . |
| 84 | - 'WHERE ship_type_id = '.$db2->escapeNumber($ship['ShipTypeID']).' ORDER BY hardware_type_id'); |
|
| 84 | + 'WHERE ship_type_id = ' . $db2->escapeNumber($ship['ShipTypeID']) . ' ORDER BY hardware_type_id'); |
|
| 85 | 85 | |
| 86 | 86 | while ($db2->nextRecord()) { |
| 87 | 87 | // adding hardware to array |
| 88 | 88 | $ship['MaxHardware'][$db2->getField('hardware_type_id')] = $db2->getField('max_amount'); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - $ship['BaseMR'] = round( |
|
| 91 | + $ship['BaseMR'] = round( |
|
| 92 | 92 | 700 - |
| 93 | 93 | ( |
| 94 | 94 | ( |
| 95 | 95 | $ship['MaxHardware'][HARDWARE_SHIELDS] |
| 96 | 96 | +$ship['MaxHardware'][HARDWARE_ARMOUR] |
| 97 | - +$ship['MaxHardware'][HARDWARE_COMBAT]*3 |
|
| 98 | - )/25 |
|
| 97 | + +$ship['MaxHardware'][HARDWARE_COMBAT] * 3 |
|
| 98 | + ) / 25 |
|
| 99 | 99 | +( |
| 100 | - $ship['MaxHardware'][HARDWARE_CARGO]/100 |
|
| 101 | - -$ship['Speed']*5 |
|
| 102 | - +$ship['Hardpoint']*5 |
|
| 103 | - +$ship['MaxHardware'][HARDWARE_COMBAT]/5 |
|
| 100 | + $ship['MaxHardware'][HARDWARE_CARGO] / 100 |
|
| 101 | + -$ship['Speed'] * 5 |
|
| 102 | + +$ship['Hardpoint'] * 5 |
|
| 103 | + +$ship['MaxHardware'][HARDWARE_COMBAT] / 5 |
|
| 104 | 104 | ) |
| 105 | 105 | ) |
| 106 | 106 | ); |
| 107 | 107 | return $ship; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - public static function &getAllBaseShips($gameTypeID,$forceUpdate = false) { |
|
| 110 | + public static function &getAllBaseShips($gameTypeID, $forceUpdate = false) { |
|
| 111 | 111 | // determine ship |
| 112 | 112 | $db = new SmrMySqlDatabase(); |
| 113 | 113 | $db->query('SELECT * FROM ship_type ORDER BY ship_type_id ASC'); //TODO add game type id |
| 114 | - while($db->nextRecord()) { |
|
| 115 | - if(!isset(self::$CACHE_BASE_SHIPS[$gameTypeID][$db->getInt('ship_type_id')])) { |
|
| 114 | + while ($db->nextRecord()) { |
|
| 115 | + if (!isset(self::$CACHE_BASE_SHIPS[$gameTypeID][$db->getInt('ship_type_id')])) { |
|
| 116 | 116 | self::$CACHE_BASE_SHIPS[$gameTypeID][$db->getInt('ship_type_id')] = self::buildBaseShip($db); |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | protected function regenerateBaseShip() { |
| 129 | - $this->baseShip = AbstractSmrShip::getBaseShip(Globals::getGameType($this->gameID),$this->player->getShipTypeID()); |
|
| 129 | + $this->baseShip = AbstractSmrShip::getBaseShip(Globals::getGameType($this->gameID), $this->player->getShipTypeID()); |
|
| 130 | 130 | $this->checkForExcess(); |
| 131 | 131 | } |
| 132 | 132 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | public function checkForExcessCargo() { |
| 147 | - if($this->hasCargo()) { |
|
| 147 | + if ($this->hasCargo()) { |
|
| 148 | 148 | $excess = array_sum($this->getCargo()) - $this->getCargoHolds(); |
| 149 | 149 | foreach ($this->getCargo() as $goodID => $amount) { |
| 150 | 150 | if ($excess > 0) { |
@@ -161,28 +161,28 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | public function checkForExcessHardware() { |
| 163 | 163 | //check hardware to see if anything needs to be removed |
| 164 | - if(is_array($hardware = $this->getHardware())) |
|
| 164 | + if (is_array($hardware = $this->getHardware())) |
|
| 165 | 165 | foreach ($hardware as $hardwareTypeID => $amount) { |
| 166 | - if ($amount > ($max=$this->getMaxHardware($hardwareTypeID))) { |
|
| 167 | - $this->setHardware($hardwareTypeID,$max,true); |
|
| 166 | + if ($amount > ($max = $this->getMaxHardware($hardwareTypeID))) { |
|
| 167 | + $this->setHardware($hardwareTypeID, $max, true); |
|
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | public function getPowerUsed() { |
| 173 | 173 | $power = 0; |
| 174 | - if($this->getNumWeapons()>0) |
|
| 174 | + if ($this->getNumWeapons() > 0) |
|
| 175 | 175 | foreach ($this->weapons as $weapon) |
| 176 | 176 | $power += $weapon->getPowerLevel(); |
| 177 | 177 | return $power; |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | public function getRemainingPower() { |
| 181 | - return $this->getMaxPower()-$this->getPowerUsed(); |
|
| 181 | + return $this->getMaxPower() - $this->getPowerUsed(); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | public function hasRemainingPower() { |
| 185 | - return $this->getRemainingPower()>0; |
|
| 185 | + return $this->getRemainingPower() > 0; |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | public function getMaxPower() { |
@@ -194,14 +194,14 @@ discard block |
||
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | public function getDisplayAttackRating(AbstractSmrPlayer $player) { |
| 197 | - if($this->hasActiveIllusion()) |
|
| 197 | + if ($this->hasActiveIllusion()) |
|
| 198 | 198 | return $this->getIllusionAttack(); |
| 199 | 199 | else |
| 200 | 200 | return $this->getAttackRating(); |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | public function getDisplayDefenseRating() { |
| 204 | - if($this->hasActiveIllusion()) |
|
| 204 | + if ($this->hasActiveIllusion()) |
|
| 205 | 205 | return $this->getIllusionDefense(); |
| 206 | 206 | else |
| 207 | 207 | return $this->getDefenseRating(); |
@@ -233,9 +233,9 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | |
| 235 | 235 | public function &addWeapon($weaponTypeID) { |
| 236 | - if($this->hasOpenWeaponSlots() && $this->hasRemainingPower()) { |
|
| 236 | + if ($this->hasOpenWeaponSlots() && $this->hasRemainingPower()) { |
|
| 237 | 237 | $weapon = SmrWeapon::getWeapon($weaponTypeID); |
| 238 | - if($this->getRemainingPower()>=$weapon->getPowerLevel()) { |
|
| 238 | + if ($this->getRemainingPower() >= $weapon->getPowerLevel()) { |
|
| 239 | 239 | $this->weapons[count($this->weapons)] = $weapon; |
| 240 | 240 | $this->hasChangedWeapons = true; |
| 241 | 241 | return $weapon; |
@@ -247,13 +247,13 @@ discard block |
||
| 247 | 247 | |
| 248 | 248 | public function moveWeaponUp($orderID) { |
| 249 | 249 | $replacement = $orderID - 1; |
| 250 | - if($replacement < 0) { |
|
| 250 | + if ($replacement < 0) { |
|
| 251 | 251 | // Shift everything up by one and put the selected weapon at the bottom |
| 252 | - $temp =& $this->weapons[$orderID]; |
|
| 253 | - for($i=1;$i<count($this->weapons);++$i) { |
|
| 254 | - $this->weapons[$i-1] =& $this->weapons[$i]; //If we go above the bounds of the array it will keep on going due to assign by ref. Hence $i-1 =& $i not $i =& $i+1 |
|
| 252 | + $temp = & $this->weapons[$orderID]; |
|
| 253 | + for ($i = 1; $i < count($this->weapons); ++$i) { |
|
| 254 | + $this->weapons[$i - 1] = & $this->weapons[$i]; //If we go above the bounds of the array it will keep on going due to assign by ref. Hence $i-1 =& $i not $i =& $i+1 |
|
| 255 | 255 | } |
| 256 | - $this->weapons[count($this->weapons)-1] =& $temp; |
|
| 256 | + $this->weapons[count($this->weapons) - 1] = & $temp; |
|
| 257 | 257 | } |
| 258 | 258 | else { |
| 259 | 259 | $temp = $this->weapons[$replacement]; |
@@ -265,13 +265,13 @@ discard block |
||
| 265 | 265 | |
| 266 | 266 | public function moveWeaponDown($orderID) { |
| 267 | 267 | $replacement = $orderID + 1; |
| 268 | - if($replacement >= count($this->weapons)) { |
|
| 268 | + if ($replacement >= count($this->weapons)) { |
|
| 269 | 269 | // Shift everything down by one and put the selected weapon at the top |
| 270 | - $temp =& $this->weapons[count($this->weapons)-1]; |
|
| 271 | - for($i=count($this->weapons)-1;$i>0;--$i) { |
|
| 272 | - $this->weapons[$i] =& $this->weapons[$i-1]; |
|
| 270 | + $temp = & $this->weapons[count($this->weapons) - 1]; |
|
| 271 | + for ($i = count($this->weapons) - 1; $i > 0; --$i) { |
|
| 272 | + $this->weapons[$i] = & $this->weapons[$i - 1]; |
|
| 273 | 273 | } |
| 274 | - $this->weapons[0] =& $temp; |
|
| 274 | + $this->weapons[0] = & $temp; |
|
| 275 | 275 | } |
| 276 | 276 | else { |
| 277 | 277 | $temp = $this->weapons[$replacement]; |
@@ -282,22 +282,22 @@ discard block |
||
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | public function setWeaponLocations(array $orderArray) { |
| 285 | - $weapons=$this->weapons; |
|
| 286 | - foreach($orderArray as $newOrder => $oldOrder) { |
|
| 287 | - $this->weapons[$newOrder] =& $weapons[$oldOrder]; |
|
| 285 | + $weapons = $this->weapons; |
|
| 286 | + foreach ($orderArray as $newOrder => $oldOrder) { |
|
| 287 | + $this->weapons[$newOrder] = & $weapons[$oldOrder]; |
|
| 288 | 288 | } |
| 289 | 289 | $this->hasChangedWeapons = true; |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | public function removeLastWeapon() { |
| 293 | - $this->removeWeapon($this->getNumWeapons()-1); |
|
| 293 | + $this->removeWeapon($this->getNumWeapons() - 1); |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | public function removeWeapon($orderID) { |
| 297 | 297 | // Shift everything after the removed weapon up by one and put the selected weapon at the bottom |
| 298 | - for($i=$orderID+1;$i<count($this->weapons);++$i) { |
|
| 299 | - $this->weapons[$i-1] =& $this->weapons[$i]; //If we go above the bounds of the array it will keep on going due to assign by ref. Hence $i-1 =& $i not $i =& $i+1 |
|
| 300 | - } unset($this->weapons[count($this->weapons)-1]); |
|
| 298 | + for ($i = $orderID + 1; $i < count($this->weapons); ++$i) { |
|
| 299 | + $this->weapons[$i - 1] = & $this->weapons[$i]; //If we go above the bounds of the array it will keep on going due to assign by ref. Hence $i-1 =& $i not $i =& $i+1 |
|
| 300 | + } unset($this->weapons[count($this->weapons) - 1]); |
|
| 301 | 301 | $this->hasChangedWeapons = true; |
| 302 | 302 | } |
| 303 | 303 | |
@@ -307,9 +307,9 @@ discard block |
||
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | public function removeAllCargo() { |
| 310 | - if(is_array($this->cargo)) { |
|
| 311 | - foreach($this->cargo as $goodID => $amount) { |
|
| 312 | - $this->setCargo($goodID,0); |
|
| 310 | + if (is_array($this->cargo)) { |
|
| 311 | + foreach ($this->cargo as $goodID => $amount) { |
|
| 312 | + $this->setCargo($goodID, 0); |
|
| 313 | 313 | } |
| 314 | 314 | } |
| 315 | 315 | } |
@@ -327,15 +327,15 @@ discard block |
||
| 327 | 327 | $this->removeAllCargo(); |
| 328 | 328 | $this->removeAllHardware(); |
| 329 | 329 | |
| 330 | - if($isNewbie) { |
|
| 331 | - $this->setShields(75,true); |
|
| 332 | - $this->setArmour(150,true); |
|
| 330 | + if ($isNewbie) { |
|
| 331 | + $this->setShields(75, true); |
|
| 332 | + $this->setArmour(150, true); |
|
| 333 | 333 | $this->setCargoHolds(40); |
| 334 | 334 | $this->setShipTypeID(SHIP_TYPE_NEWBIE_MERCHANT_VESSEL); |
| 335 | 335 | } |
| 336 | 336 | else { |
| 337 | - $this->setShields(50,true); |
|
| 338 | - $this->setArmour(50,true); |
|
| 337 | + $this->setShields(50, true); |
|
| 338 | + $this->setArmour(50, true); |
|
| 339 | 339 | $this->setCargoHolds(5); |
| 340 | 340 | $this->setShipTypeID(SHIP_TYPE_ESCAPE_POD); |
| 341 | 341 | } |
@@ -353,9 +353,9 @@ discard block |
||
| 353 | 353 | |
| 354 | 354 | |
| 355 | 355 | public function hasActiveIllusion() { |
| 356 | - if(!$this->hasIllusion()) |
|
| 356 | + if (!$this->hasIllusion()) |
|
| 357 | 357 | return false; |
| 358 | - return $this->getIllusionShip()!==false; |
|
| 358 | + return $this->getIllusionShip() !== false; |
|
| 359 | 359 | |
| 360 | 360 | } |
| 361 | 361 | |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | } |
| 448 | 448 | |
| 449 | 449 | public function getCostToUpgrade($upgradeShipID) { |
| 450 | - $upgadeBaseShip = AbstractSmrShip::getBaseShip(Globals::getGameType($this->getGameID()),$upgradeShipID); |
|
| 450 | + $upgadeBaseShip = AbstractSmrShip::getBaseShip(Globals::getGameType($this->getGameID()), $upgradeShipID); |
|
| 451 | 451 | return $upgadeBaseShip['Cost'] - floor($this->getCost() * SHIP_REFUND_PERCENT); |
| 452 | 452 | } |
| 453 | 453 | |
@@ -456,11 +456,11 @@ discard block |
||
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | protected function getCostToUNOAgainstShip($shipID) { |
| 459 | - $baseShip = AbstractSmrShip::getBaseShip(Globals::getGameType($this->getGameID()),$shipID); |
|
| 459 | + $baseShip = AbstractSmrShip::getBaseShip(Globals::getGameType($this->getGameID()), $shipID); |
|
| 460 | 460 | $cost = 0; |
| 461 | 461 | $hardwareTypes = array(HARDWARE_SHIELDS, HARDWARE_ARMOUR, HARDWARE_CARGO); |
| 462 | - foreach($hardwareTypes as $hardwareTypeID) { |
|
| 463 | - $cost += max(0,$baseShip['MaxHardware'][$hardwareTypeID]-$this->getHardware($hardwareTypeID))*Globals::getHardwareCost($hardwareTypeID); |
|
| 462 | + foreach ($hardwareTypes as $hardwareTypeID) { |
|
| 463 | + $cost += max(0, $baseShip['MaxHardware'][$hardwareTypeID] - $this->getHardware($hardwareTypeID)) * Globals::getHardwareCost($hardwareTypeID); |
|
| 464 | 464 | } |
| 465 | 465 | return $cost; |
| 466 | 466 | } |
@@ -478,41 +478,41 @@ discard block |
||
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | public function getHardware($hardwareTypeID = false) { |
| 481 | - if($hardwareTypeID === false) |
|
| 481 | + if ($hardwareTypeID === false) |
|
| 482 | 482 | return $this->hardware; |
| 483 | 483 | return isset($this->hardware[$hardwareTypeID]) ? $this->hardware[$hardwareTypeID] : 0; |
| 484 | 484 | } |
| 485 | 485 | |
| 486 | - public function setHardware($hardwareTypeID,$amount) { |
|
| 487 | - if($this->getHardware($hardwareTypeID) == $amount) |
|
| 486 | + public function setHardware($hardwareTypeID, $amount) { |
|
| 487 | + if ($this->getHardware($hardwareTypeID) == $amount) |
|
| 488 | 488 | return; |
| 489 | 489 | $this->hardware[$hardwareTypeID] = $amount; |
| 490 | 490 | $this->hasChangedHardware[$hardwareTypeID] = true; |
| 491 | 491 | } |
| 492 | 492 | |
| 493 | - public function increaseHardware($hardwareTypeID,$amount) { |
|
| 494 | - $this->setHardware($hardwareTypeID,$this->getHardware($hardwareTypeID)+$amount); |
|
| 493 | + public function increaseHardware($hardwareTypeID, $amount) { |
|
| 494 | + $this->setHardware($hardwareTypeID, $this->getHardware($hardwareTypeID) + $amount); |
|
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | public function getOldHardware($hardwareTypeID = false) { |
| 498 | - if($hardwareTypeID === false) |
|
| 498 | + if ($hardwareTypeID === false) |
|
| 499 | 499 | return $this->oldHardware; |
| 500 | 500 | return isset($this->oldHardware[$hardwareTypeID]) ? $this->oldHardware[$hardwareTypeID] : 0; |
| 501 | 501 | } |
| 502 | 502 | |
| 503 | - public function setOldHardware($hardwareTypeID,$amount) { |
|
| 504 | - if($this->getOldHardware($hardwareTypeID) == $amount) |
|
| 503 | + public function setOldHardware($hardwareTypeID, $amount) { |
|
| 504 | + if ($this->getOldHardware($hardwareTypeID) == $amount) |
|
| 505 | 505 | return; |
| 506 | 506 | $this->oldHardware[$hardwareTypeID] = $amount; |
| 507 | 507 | $this->hasChangedHardware[$hardwareTypeID] = true; |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | 510 | public function hasMaxHardware($hardwareTypeID) { |
| 511 | - return $this->getHardware($hardwareTypeID)==$this->getMaxHardware($hardwareTypeID); |
|
| 511 | + return $this->getHardware($hardwareTypeID) == $this->getMaxHardware($hardwareTypeID); |
|
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | public function getMaxHardware($hardwareTypeID = false) { |
| 515 | - if($hardwareTypeID === false) |
|
| 515 | + if ($hardwareTypeID === false) |
|
| 516 | 516 | return $this->baseShip['MaxHardware']; |
| 517 | 517 | return $this->baseShip['MaxHardware'][$hardwareTypeID]; |
| 518 | 518 | } |
@@ -521,18 +521,18 @@ discard block |
||
| 521 | 521 | return $this->getHardware(HARDWARE_SHIELDS); |
| 522 | 522 | } |
| 523 | 523 | |
| 524 | - public function setShields($amount,$updateOldAmount=false) { |
|
| 525 | - if($updateOldAmount && !$this->hasLostShields()) |
|
| 526 | - $this->setOldHardware(HARDWARE_SHIELDS,$amount); |
|
| 527 | - $this->setHardware(HARDWARE_SHIELDS,$amount); |
|
| 524 | + public function setShields($amount, $updateOldAmount = false) { |
|
| 525 | + if ($updateOldAmount && !$this->hasLostShields()) |
|
| 526 | + $this->setOldHardware(HARDWARE_SHIELDS, $amount); |
|
| 527 | + $this->setHardware(HARDWARE_SHIELDS, $amount); |
|
| 528 | 528 | } |
| 529 | 529 | |
| 530 | 530 | public function decreaseShields($amount) { |
| 531 | - $this->setShields($this->getShields()-$amount); |
|
| 531 | + $this->setShields($this->getShields() - $amount); |
|
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | public function increaseShields($amount) { |
| 535 | - $this->setShields($this->getShields()+$amount); |
|
| 535 | + $this->setShields($this->getShields() + $amount); |
|
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | public function getOldShields() { |
@@ -540,19 +540,19 @@ discard block |
||
| 540 | 540 | } |
| 541 | 541 | |
| 542 | 542 | public function setOldShields($amount) { |
| 543 | - $this->setOldHardware(HARDWARE_SHIELDS,$amount); |
|
| 543 | + $this->setOldHardware(HARDWARE_SHIELDS, $amount); |
|
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | public function hasShields() { |
| 547 | - return $this->getShields()>0; |
|
| 547 | + return $this->getShields() > 0; |
|
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | public function hasLostShields() { |
| 551 | - return $this->getShields()<$this->getOldShields(); |
|
| 551 | + return $this->getShields() < $this->getOldShields(); |
|
| 552 | 552 | } |
| 553 | 553 | |
| 554 | 554 | public function hasMaxShields() { |
| 555 | - return $this->getShields()==$this->getMaxShields(); |
|
| 555 | + return $this->getShields() == $this->getMaxShields(); |
|
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | public function getMaxShields() { |
@@ -563,18 +563,18 @@ discard block |
||
| 563 | 563 | return $this->getHardware(HARDWARE_ARMOUR); |
| 564 | 564 | } |
| 565 | 565 | |
| 566 | - public function setArmour($amount,$updateOldAmount=false) { |
|
| 567 | - if($updateOldAmount && !$this->hasLostArmour()) |
|
| 568 | - $this->setOldHardware(HARDWARE_ARMOUR,$amount); |
|
| 569 | - $this->setHardware(HARDWARE_ARMOUR,$amount); |
|
| 566 | + public function setArmour($amount, $updateOldAmount = false) { |
|
| 567 | + if ($updateOldAmount && !$this->hasLostArmour()) |
|
| 568 | + $this->setOldHardware(HARDWARE_ARMOUR, $amount); |
|
| 569 | + $this->setHardware(HARDWARE_ARMOUR, $amount); |
|
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | public function decreaseArmour($amount) { |
| 573 | - $this->setArmour($this->getArmour()-$amount); |
|
| 573 | + $this->setArmour($this->getArmour() - $amount); |
|
| 574 | 574 | } |
| 575 | 575 | |
| 576 | 576 | public function increaseArmour($amount) { |
| 577 | - $this->setArmour($this->getArmour()+$amount); |
|
| 577 | + $this->setArmour($this->getArmour() + $amount); |
|
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | public function getOldArmour() { |
@@ -582,19 +582,19 @@ discard block |
||
| 582 | 582 | } |
| 583 | 583 | |
| 584 | 584 | public function setOldArmour($amount) { |
| 585 | - $this->setOldHardware(HARDWARE_ARMOUR,$amount); |
|
| 585 | + $this->setOldHardware(HARDWARE_ARMOUR, $amount); |
|
| 586 | 586 | } |
| 587 | 587 | |
| 588 | 588 | public function hasArmour() { |
| 589 | - return $this->getArmour()>0; |
|
| 589 | + return $this->getArmour() > 0; |
|
| 590 | 590 | } |
| 591 | 591 | |
| 592 | 592 | public function hasLostArmour() { |
| 593 | - return $this->getArmour()<$this->getOldArmour(); |
|
| 593 | + return $this->getArmour() < $this->getOldArmour(); |
|
| 594 | 594 | } |
| 595 | 595 | |
| 596 | 596 | public function hasMaxArmour() { |
| 597 | - return $this->getArmour()==$this->getMaxArmour(); |
|
| 597 | + return $this->getArmour() == $this->getMaxArmour(); |
|
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | public function getMaxArmour() { |
@@ -602,53 +602,53 @@ discard block |
||
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | public function isDead() { |
| 605 | - return !$this->hasArmour()&&!$this->hasShields(); |
|
| 605 | + return !$this->hasArmour() && !$this->hasShields(); |
|
| 606 | 606 | } |
| 607 | 607 | |
| 608 | 608 | public function canAcceptCDs() { |
| 609 | - return $this->getCDs()<$this->getMaxCDs(); |
|
| 609 | + return $this->getCDs() < $this->getMaxCDs(); |
|
| 610 | 610 | } |
| 611 | 611 | |
| 612 | 612 | public function canAcceptSDs() { |
| 613 | - return $this->getSDs()<$this->getMaxSDs(); |
|
| 613 | + return $this->getSDs() < $this->getMaxSDs(); |
|
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | public function canAcceptMines() { |
| 617 | - return $this->getMines()<$this->getMaxMines(); |
|
| 617 | + return $this->getMines() < $this->getMaxMines(); |
|
| 618 | 618 | } |
| 619 | 619 | |
| 620 | 620 | public function hasCDs() { |
| 621 | - return $this->getCDs()>0; |
|
| 621 | + return $this->getCDs() > 0; |
|
| 622 | 622 | } |
| 623 | 623 | |
| 624 | 624 | public function hasSDs() { |
| 625 | - return $this->getSDs()>0; |
|
| 625 | + return $this->getSDs() > 0; |
|
| 626 | 626 | } |
| 627 | 627 | |
| 628 | 628 | public function hasMines() { |
| 629 | - return $this->getMines()>0; |
|
| 629 | + return $this->getMines() > 0; |
|
| 630 | 630 | } |
| 631 | 631 | |
| 632 | 632 | public function getCDs() { |
| 633 | 633 | return $this->getHardware(HARDWARE_COMBAT); |
| 634 | 634 | } |
| 635 | 635 | |
| 636 | - public function setCDs($amount,$updateOldAmount=false) { |
|
| 637 | - if($updateOldAmount && !$this->hasLostCDs()) |
|
| 638 | - $this->setOldHardware(HARDWARE_COMBAT,$amount); |
|
| 639 | - $this->setHardware(HARDWARE_COMBAT,$amount); |
|
| 636 | + public function setCDs($amount, $updateOldAmount = false) { |
|
| 637 | + if ($updateOldAmount && !$this->hasLostCDs()) |
|
| 638 | + $this->setOldHardware(HARDWARE_COMBAT, $amount); |
|
| 639 | + $this->setHardware(HARDWARE_COMBAT, $amount); |
|
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | /** |
| 643 | 643 | * Decreases the ship CDs. Use $updateOldAmount=true to prevent |
| 644 | 644 | * this change from triggering `isUnderAttack`. |
| 645 | 645 | */ |
| 646 | - public function decreaseCDs($amount,$updateOldAmount=false) { |
|
| 647 | - $this->setCDs($this->getCDs()-$amount,$updateOldAmount); |
|
| 646 | + public function decreaseCDs($amount, $updateOldAmount = false) { |
|
| 647 | + $this->setCDs($this->getCDs() - $amount, $updateOldAmount); |
|
| 648 | 648 | } |
| 649 | 649 | |
| 650 | 650 | public function increaseCDs($amount) { |
| 651 | - $this->setCDs($this->getCDs()+$amount); |
|
| 651 | + $this->setCDs($this->getCDs() + $amount); |
|
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 | public function getOldCDs() { |
@@ -656,11 +656,11 @@ discard block |
||
| 656 | 656 | } |
| 657 | 657 | |
| 658 | 658 | public function setOldCDs($amount) { |
| 659 | - $this->setOldHardware(HARDWARE_COMBAT,$amount); |
|
| 659 | + $this->setOldHardware(HARDWARE_COMBAT, $amount); |
|
| 660 | 660 | } |
| 661 | 661 | |
| 662 | 662 | public function hasLostCDs() { |
| 663 | - return $this->getCDs()<$this->getOldCDs(); |
|
| 663 | + return $this->getCDs() < $this->getOldCDs(); |
|
| 664 | 664 | } |
| 665 | 665 | |
| 666 | 666 | public function getMaxCDs() { |
@@ -672,15 +672,15 @@ discard block |
||
| 672 | 672 | } |
| 673 | 673 | |
| 674 | 674 | public function setSDs($amount) { |
| 675 | - $this->setHardware(HARDWARE_SCOUT,$amount); |
|
| 675 | + $this->setHardware(HARDWARE_SCOUT, $amount); |
|
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | public function decreaseSDs($amount) { |
| 679 | - $this->setSDs($this->getSDs()-$amount); |
|
| 679 | + $this->setSDs($this->getSDs() - $amount); |
|
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | public function increaseSDs($amount) { |
| 683 | - $this->setSDs($this->getSDs()+$amount); |
|
| 683 | + $this->setSDs($this->getSDs() + $amount); |
|
| 684 | 684 | } |
| 685 | 685 | |
| 686 | 686 | public function getMaxSDs() { |
@@ -692,15 +692,15 @@ discard block |
||
| 692 | 692 | } |
| 693 | 693 | |
| 694 | 694 | public function setMines($amount) { |
| 695 | - $this->setHardware(HARDWARE_MINE,$amount); |
|
| 695 | + $this->setHardware(HARDWARE_MINE, $amount); |
|
| 696 | 696 | } |
| 697 | 697 | |
| 698 | 698 | public function decreaseMines($amount) { |
| 699 | - $this->setMines($this->getMines()-$amount); |
|
| 699 | + $this->setMines($this->getMines() - $amount); |
|
| 700 | 700 | } |
| 701 | 701 | |
| 702 | 702 | public function increaseMines($amount) { |
| 703 | - $this->setMines($this->getMines()+$amount); |
|
| 703 | + $this->setMines($this->getMines() + $amount); |
|
| 704 | 704 | } |
| 705 | 705 | |
| 706 | 706 | public function getMaxMines() { |
@@ -712,12 +712,12 @@ discard block |
||
| 712 | 712 | } |
| 713 | 713 | |
| 714 | 714 | public function setCargoHolds($amount) { |
| 715 | - $this->setHardware(HARDWARE_CARGO,$amount); |
|
| 715 | + $this->setHardware(HARDWARE_CARGO, $amount); |
|
| 716 | 716 | } |
| 717 | 717 | |
| 718 | - public function &getCargo($goodID=false) { |
|
| 719 | - if($goodID!==false) { |
|
| 720 | - if(isset($this->cargo[$goodID])) |
|
| 718 | + public function &getCargo($goodID = false) { |
|
| 719 | + if ($goodID !== false) { |
|
| 720 | + if (isset($this->cargo[$goodID])) |
|
| 721 | 721 | return $this->cargo[$goodID]; |
| 722 | 722 | $cargo = 0; |
| 723 | 723 | return $cargo; |
@@ -725,16 +725,16 @@ discard block |
||
| 725 | 725 | return $this->cargo; |
| 726 | 726 | } |
| 727 | 727 | |
| 728 | - public function hasCargo($goodID=false) { |
|
| 729 | - if($goodID!==false) |
|
| 730 | - return $this->getCargo($goodID)>0; |
|
| 731 | - if(is_array($cargo = $this->getCargo())) |
|
| 732 | - return array_sum($cargo)>0; |
|
| 728 | + public function hasCargo($goodID = false) { |
|
| 729 | + if ($goodID !== false) |
|
| 730 | + return $this->getCargo($goodID) > 0; |
|
| 731 | + if (is_array($cargo = $this->getCargo())) |
|
| 732 | + return array_sum($cargo) > 0; |
|
| 733 | 733 | return false; |
| 734 | 734 | } |
| 735 | 735 | |
| 736 | - public function setCargo($goodID,$amount) { |
|
| 737 | - if($this->getCargo($goodID) == $amount) |
|
| 736 | + public function setCargo($goodID, $amount) { |
|
| 737 | + if ($this->getCargo($goodID) == $amount) |
|
| 738 | 738 | return; |
| 739 | 739 | $this->cargo[$goodID] = $amount; |
| 740 | 740 | $this->hasChangedCargo = true; |
@@ -743,20 +743,20 @@ discard block |
||
| 743 | 743 | ksort($this->cargo); |
| 744 | 744 | } |
| 745 | 745 | |
| 746 | - public function decreaseCargo($goodID,$amount) { |
|
| 747 | - if($amount < 0) |
|
| 746 | + public function decreaseCargo($goodID, $amount) { |
|
| 747 | + if ($amount < 0) |
|
| 748 | 748 | throw new Exception('Trying to decrease negative cargo.'); |
| 749 | - $this->setCargo($goodID,$this->getCargo($goodID)-$amount); |
|
| 749 | + $this->setCargo($goodID, $this->getCargo($goodID) - $amount); |
|
| 750 | 750 | } |
| 751 | 751 | |
| 752 | - public function increaseCargo($goodID,$amount) { |
|
| 753 | - if($amount < 0) |
|
| 752 | + public function increaseCargo($goodID, $amount) { |
|
| 753 | + if ($amount < 0) |
|
| 754 | 754 | throw new Exception('Trying to increase negative cargo.'); |
| 755 | - $this->setCargo($goodID,$this->getCargo($goodID)+$amount); |
|
| 755 | + $this->setCargo($goodID, $this->getCargo($goodID) + $amount); |
|
| 756 | 756 | } |
| 757 | 757 | |
| 758 | 758 | public function getEmptyHolds() { |
| 759 | - return $this->getCargoHolds()-$this->getUsedHolds(); |
|
| 759 | + return $this->getCargoHolds() - $this->getUsedHolds(); |
|
| 760 | 760 | } |
| 761 | 761 | |
| 762 | 762 | public function getUsedHolds() { |
@@ -764,7 +764,7 @@ discard block |
||
| 764 | 764 | } |
| 765 | 765 | |
| 766 | 766 | public function hasMaxCargoHolds() { |
| 767 | - return $this->getCargoHolds()==$this->getMaxCargoHolds(); |
|
| 767 | + return $this->getCargoHolds() == $this->getMaxCargoHolds(); |
|
| 768 | 768 | } |
| 769 | 769 | |
| 770 | 770 | public function getMaxCargoHolds() { |
@@ -781,16 +781,16 @@ discard block |
||
| 781 | 781 | $this->setOldShields($this->getShields()); |
| 782 | 782 | $this->setOldCDs($this->getCDs()); |
| 783 | 783 | $this->setOldArmour($this->getArmour()); |
| 784 | - if(isset($var['UnderAttack'])) |
|
| 784 | + if (isset($var['UnderAttack'])) |
|
| 785 | 785 | return $var['UnderAttack']; |
| 786 | - if($underAttack && !USING_AJAX) { |
|
| 787 | - SmrSession::updateVar('UnderAttack',$underAttack); //Remember we are under attack for AJAX |
|
| 786 | + if ($underAttack && !USING_AJAX) { |
|
| 787 | + SmrSession::updateVar('UnderAttack', $underAttack); //Remember we are under attack for AJAX |
|
| 788 | 788 | } |
| 789 | 789 | return $underAttack; |
| 790 | 790 | } |
| 791 | 791 | |
| 792 | 792 | public function hasWeapons() { |
| 793 | - return $this->getNumWeapons()>0; |
|
| 793 | + return $this->getNumWeapons() > 0; |
|
| 794 | 794 | } |
| 795 | 795 | |
| 796 | 796 | public function &getWeapons() { |
@@ -806,11 +806,11 @@ discard block |
||
| 806 | 806 | } |
| 807 | 807 | |
| 808 | 808 | public function getOpenWeaponSlots() { |
| 809 | - return $this->getHardpoints()-$this->getNumWeapons(); |
|
| 809 | + return $this->getHardpoints() - $this->getNumWeapons(); |
|
| 810 | 810 | } |
| 811 | 811 | |
| 812 | 812 | public function hasOpenWeaponSlots() { |
| 813 | - return $this->getOpenWeaponSlots()>0; |
|
| 813 | + return $this->getOpenWeaponSlots() > 0; |
|
| 814 | 814 | } |
| 815 | 815 | |
| 816 | 816 | public function getHardpoints() { |
@@ -820,8 +820,8 @@ discard block |
||
| 820 | 820 | public function getTotalShieldDamage() { |
| 821 | 821 | $weapons = $this->getWeapons(); |
| 822 | 822 | $shieldDamage = 0; |
| 823 | - foreach($weapons as $weapon) { |
|
| 824 | - $shieldDamage+=$weapon->getShieldDamage(); |
|
| 823 | + foreach ($weapons as $weapon) { |
|
| 824 | + $shieldDamage += $weapon->getShieldDamage(); |
|
| 825 | 825 | } |
| 826 | 826 | return $shieldDamage; |
| 827 | 827 | } |
@@ -829,8 +829,8 @@ discard block |
||
| 829 | 829 | public function getTotalArmourDamage() { |
| 830 | 830 | $weapons = $this->getWeapons(); |
| 831 | 831 | $armourDamage = 0; |
| 832 | - foreach($weapons as $weapon) { |
|
| 833 | - $armourDamage+=$weapon->getArmourDamage(); |
|
| 832 | + foreach ($weapons as $weapon) { |
|
| 833 | + $armourDamage += $weapon->getArmourDamage(); |
|
| 834 | 834 | } |
| 835 | 835 | return $armourDamage; |
| 836 | 836 | } |
@@ -850,86 +850,86 @@ discard block |
||
| 850 | 850 | public function &shootPlayers(array $targetPlayers) { |
| 851 | 851 | $thisPlayer = $this->getPlayer(); |
| 852 | 852 | $results = array('Player' => $thisPlayer, 'TotalDamage' => 0); |
| 853 | - if($thisPlayer->isDead()) { |
|
| 853 | + if ($thisPlayer->isDead()) { |
|
| 854 | 854 | $results['DeadBeforeShot'] = true; |
| 855 | 855 | return $results; |
| 856 | 856 | } |
| 857 | 857 | $results['DeadBeforeShot'] = false; |
| 858 | - foreach($this->weapons as $orderID => $weapon) { |
|
| 859 | - $results['Weapons'][$orderID] =& $weapon->shootPlayer($thisPlayer, $targetPlayers[array_rand($targetPlayers)]); |
|
| 860 | - if($results['Weapons'][$orderID]['Hit']) |
|
| 858 | + foreach ($this->weapons as $orderID => $weapon) { |
|
| 859 | + $results['Weapons'][$orderID] = & $weapon->shootPlayer($thisPlayer, $targetPlayers[array_rand($targetPlayers)]); |
|
| 860 | + if ($results['Weapons'][$orderID]['Hit']) |
|
| 861 | 861 | $results['TotalDamage'] += $results['Weapons'][$orderID]['ActualDamage']['TotalDamage']; |
| 862 | 862 | } |
| 863 | - if($this->hasCDs()) { |
|
| 864 | - $thisCDs = new SmrCombatDrones($this->getGameID(),$this->getCDs()); |
|
| 865 | - $results['Drones'] =& $thisCDs->shootPlayer($thisPlayer, $targetPlayers[array_rand($targetPlayers)]); |
|
| 863 | + if ($this->hasCDs()) { |
|
| 864 | + $thisCDs = new SmrCombatDrones($this->getGameID(), $this->getCDs()); |
|
| 865 | + $results['Drones'] = & $thisCDs->shootPlayer($thisPlayer, $targetPlayers[array_rand($targetPlayers)]); |
|
| 866 | 866 | $results['TotalDamage'] += $results['Drones']['ActualDamage']['TotalDamage']; |
| 867 | 867 | } |
| 868 | - $thisPlayer->increaseExperience(round($results['TotalDamage']/4)); // 1/4 weapon damage to exp. |
|
| 869 | - $thisPlayer->increaseHOF($results['TotalDamage'],array('Combat','Player','Damage Done'), HOF_PUBLIC); |
|
| 870 | - $thisPlayer->increaseHOF(1,array('Combat','Player','Shots'), HOF_PUBLIC); |
|
| 868 | + $thisPlayer->increaseExperience(round($results['TotalDamage'] / 4)); // 1/4 weapon damage to exp. |
|
| 869 | + $thisPlayer->increaseHOF($results['TotalDamage'], array('Combat', 'Player', 'Damage Done'), HOF_PUBLIC); |
|
| 870 | + $thisPlayer->increaseHOF(1, array('Combat', 'Player', 'Shots'), HOF_PUBLIC); |
|
| 871 | 871 | return $results; |
| 872 | 872 | } |
| 873 | 873 | |
| 874 | 874 | public function &shootForces(SmrForce $forces) { |
| 875 | 875 | $thisPlayer = $this->getPlayer(); |
| 876 | 876 | $results = array('Player' => $thisPlayer, 'TotalDamage' => 0); |
| 877 | - if($thisPlayer->isDead()) { |
|
| 877 | + if ($thisPlayer->isDead()) { |
|
| 878 | 878 | $results['DeadBeforeShot'] = true; |
| 879 | 879 | return $results; |
| 880 | 880 | } |
| 881 | 881 | $results['DeadBeforeShot'] = false; |
| 882 | - foreach($this->weapons as $orderID => $weapon) { |
|
| 883 | - $results['Weapons'][$orderID] =& $weapon->shootForces($thisPlayer, $forces); |
|
| 884 | - if($results['Weapons'][$orderID]['Hit']) { |
|
| 882 | + foreach ($this->weapons as $orderID => $weapon) { |
|
| 883 | + $results['Weapons'][$orderID] = & $weapon->shootForces($thisPlayer, $forces); |
|
| 884 | + if ($results['Weapons'][$orderID]['Hit']) { |
|
| 885 | 885 | $results['TotalDamage'] += $results['Weapons'][$orderID]['ActualDamage']['TotalDamage']; |
| 886 | - $thisPlayer->increaseHOF($results['Weapons'][$orderID]['ActualDamage']['NumMines'],array('Combat','Forces','Mines','Killed'), HOF_PUBLIC); |
|
| 887 | - $thisPlayer->increaseHOF($results['Weapons'][$orderID]['ActualDamage']['Mines'],array('Combat','Forces','Mines','Damage Done'), HOF_PUBLIC); |
|
| 888 | - $thisPlayer->increaseHOF($results['Weapons'][$orderID]['ActualDamage']['NumCDs'],array('Combat','Forces','Combat Drones','Killed'), HOF_PUBLIC); |
|
| 889 | - $thisPlayer->increaseHOF($results['Weapons'][$orderID]['ActualDamage']['CDs'],array('Combat','Forces','Combat Drones','Damage Done'), HOF_PUBLIC); |
|
| 890 | - $thisPlayer->increaseHOF($results['Weapons'][$orderID]['ActualDamage']['NumSDs'],array('Combat','Forces','Scout Drones','Killed'), HOF_PUBLIC); |
|
| 891 | - $thisPlayer->increaseHOF($results['Weapons'][$orderID]['ActualDamage']['SDs'],array('Combat','Forces','Scout Drones','Damage Done'), HOF_PUBLIC); |
|
| 892 | - $thisPlayer->increaseHOF($results['Weapons'][$orderID]['ActualDamage']['NumMines']+$results['Weapons'][$orderID]['ActualDamage']['NumCDs']+$results['Weapons'][$orderID]['ActualDamage']['NumSDs'],array('Combat','Forces','Killed'), HOF_PUBLIC); |
|
| 886 | + $thisPlayer->increaseHOF($results['Weapons'][$orderID]['ActualDamage']['NumMines'], array('Combat', 'Forces', 'Mines', 'Killed'), HOF_PUBLIC); |
|
| 887 | + $thisPlayer->increaseHOF($results['Weapons'][$orderID]['ActualDamage']['Mines'], array('Combat', 'Forces', 'Mines', 'Damage Done'), HOF_PUBLIC); |
|
| 888 | + $thisPlayer->increaseHOF($results['Weapons'][$orderID]['ActualDamage']['NumCDs'], array('Combat', 'Forces', 'Combat Drones', 'Killed'), HOF_PUBLIC); |
|
| 889 | + $thisPlayer->increaseHOF($results['Weapons'][$orderID]['ActualDamage']['CDs'], array('Combat', 'Forces', 'Combat Drones', 'Damage Done'), HOF_PUBLIC); |
|
| 890 | + $thisPlayer->increaseHOF($results['Weapons'][$orderID]['ActualDamage']['NumSDs'], array('Combat', 'Forces', 'Scout Drones', 'Killed'), HOF_PUBLIC); |
|
| 891 | + $thisPlayer->increaseHOF($results['Weapons'][$orderID]['ActualDamage']['SDs'], array('Combat', 'Forces', 'Scout Drones', 'Damage Done'), HOF_PUBLIC); |
|
| 892 | + $thisPlayer->increaseHOF($results['Weapons'][$orderID]['ActualDamage']['NumMines'] + $results['Weapons'][$orderID]['ActualDamage']['NumCDs'] + $results['Weapons'][$orderID]['ActualDamage']['NumSDs'], array('Combat', 'Forces', 'Killed'), HOF_PUBLIC); |
|
| 893 | 893 | } |
| 894 | 894 | } |
| 895 | - if($this->hasCDs()) { |
|
| 896 | - $thisCDs = new SmrCombatDrones($this->getGameID(),$this->getCDs()); |
|
| 897 | - $results['Drones'] =& $thisCDs->shootForces($thisPlayer, $forces); |
|
| 895 | + if ($this->hasCDs()) { |
|
| 896 | + $thisCDs = new SmrCombatDrones($this->getGameID(), $this->getCDs()); |
|
| 897 | + $results['Drones'] = & $thisCDs->shootForces($thisPlayer, $forces); |
|
| 898 | 898 | $results['TotalDamage'] += $results['Drones']['ActualDamage']['TotalDamage']; |
| 899 | - $thisPlayer->increaseHOF($results['Drones']['ActualDamage']['NumMines'],array('Combat','Forces','Mines','Killed'), HOF_PUBLIC); |
|
| 900 | - $thisPlayer->increaseHOF($results['Drones']['ActualDamage']['Mines'],array('Combat','Forces','Mines','Damage Done'), HOF_PUBLIC); |
|
| 901 | - $thisPlayer->increaseHOF($results['Drones']['ActualDamage']['NumCDs'],array('Combat','Forces','Combat Drones','Killed'), HOF_PUBLIC); |
|
| 902 | - $thisPlayer->increaseHOF($results['Drones']['ActualDamage']['CDs'],array('Combat','Forces','Combat Drones','Damage Done'), HOF_PUBLIC); |
|
| 903 | - $thisPlayer->increaseHOF($results['Drones']['ActualDamage']['NumSDs'],array('Combat','Forces','Scout Drones','Killed'), HOF_PUBLIC); |
|
| 904 | - $thisPlayer->increaseHOF($results['Drones']['ActualDamage']['SDs'],array('Combat','Forces','Scout Drones','Damage Done'), HOF_PUBLIC); |
|
| 905 | - $thisPlayer->increaseHOF($results['Drones']['ActualDamage']['NumMines']+$results['Drones']['ActualDamage']['NumCDs']+$results['Drones']['ActualDamage']['NumSDs'],array('Combat','Forces','Killed'), HOF_PUBLIC); |
|
| 899 | + $thisPlayer->increaseHOF($results['Drones']['ActualDamage']['NumMines'], array('Combat', 'Forces', 'Mines', 'Killed'), HOF_PUBLIC); |
|
| 900 | + $thisPlayer->increaseHOF($results['Drones']['ActualDamage']['Mines'], array('Combat', 'Forces', 'Mines', 'Damage Done'), HOF_PUBLIC); |
|
| 901 | + $thisPlayer->increaseHOF($results['Drones']['ActualDamage']['NumCDs'], array('Combat', 'Forces', 'Combat Drones', 'Killed'), HOF_PUBLIC); |
|
| 902 | + $thisPlayer->increaseHOF($results['Drones']['ActualDamage']['CDs'], array('Combat', 'Forces', 'Combat Drones', 'Damage Done'), HOF_PUBLIC); |
|
| 903 | + $thisPlayer->increaseHOF($results['Drones']['ActualDamage']['NumSDs'], array('Combat', 'Forces', 'Scout Drones', 'Killed'), HOF_PUBLIC); |
|
| 904 | + $thisPlayer->increaseHOF($results['Drones']['ActualDamage']['SDs'], array('Combat', 'Forces', 'Scout Drones', 'Damage Done'), HOF_PUBLIC); |
|
| 905 | + $thisPlayer->increaseHOF($results['Drones']['ActualDamage']['NumMines'] + $results['Drones']['ActualDamage']['NumCDs'] + $results['Drones']['ActualDamage']['NumSDs'], array('Combat', 'Forces', 'Killed'), HOF_PUBLIC); |
|
| 906 | 906 | } |
| 907 | - $thisPlayer->increaseExperience(round($results['TotalDamage']/20)); // 1/20 weapon damage to exp. |
|
| 908 | - $thisPlayer->increaseHOF($results['TotalDamage'],array('Combat','Forces','Damage Done'), HOF_PUBLIC); |
|
| 909 | - $thisPlayer->increaseHOF(1,array('Combat','Forces','Shots'), HOF_PUBLIC); |
|
| 907 | + $thisPlayer->increaseExperience(round($results['TotalDamage'] / 20)); // 1/20 weapon damage to exp. |
|
| 908 | + $thisPlayer->increaseHOF($results['TotalDamage'], array('Combat', 'Forces', 'Damage Done'), HOF_PUBLIC); |
|
| 909 | + $thisPlayer->increaseHOF(1, array('Combat', 'Forces', 'Shots'), HOF_PUBLIC); |
|
| 910 | 910 | return $results; |
| 911 | 911 | } |
| 912 | 912 | |
| 913 | 913 | public function &shootPort(SmrPort $port) { |
| 914 | 914 | $thisPlayer = $this->getPlayer(); |
| 915 | 915 | $results = array('Player' => $thisPlayer, 'TotalDamage' => 0); |
| 916 | - if($thisPlayer->isDead()) { |
|
| 916 | + if ($thisPlayer->isDead()) { |
|
| 917 | 917 | $results['DeadBeforeShot'] = true; |
| 918 | 918 | return $results; |
| 919 | 919 | } |
| 920 | 920 | $results['DeadBeforeShot'] = false; |
| 921 | - foreach($this->weapons as $orderID => $weapon) { |
|
| 922 | - $results['Weapons'][$orderID] =& $weapon->shootPort($thisPlayer, $port); |
|
| 923 | - if($results['Weapons'][$orderID]['Hit']) |
|
| 921 | + foreach ($this->weapons as $orderID => $weapon) { |
|
| 922 | + $results['Weapons'][$orderID] = & $weapon->shootPort($thisPlayer, $port); |
|
| 923 | + if ($results['Weapons'][$orderID]['Hit']) |
|
| 924 | 924 | $results['TotalDamage'] += $results['Weapons'][$orderID]['ActualDamage']['TotalDamage']; |
| 925 | 925 | } |
| 926 | - if($this->hasCDs()) { |
|
| 927 | - $thisCDs = new SmrCombatDrones($this->getGameID(),$this->getCDs()); |
|
| 928 | - $results['Drones'] =& $thisCDs->shootPort($thisPlayer, $port); |
|
| 926 | + if ($this->hasCDs()) { |
|
| 927 | + $thisCDs = new SmrCombatDrones($this->getGameID(), $this->getCDs()); |
|
| 928 | + $results['Drones'] = & $thisCDs->shootPort($thisPlayer, $port); |
|
| 929 | 929 | $results['TotalDamage'] += $results['Drones']['ActualDamage']['TotalDamage']; |
| 930 | 930 | } |
| 931 | - $thisPlayer->increaseExperience(round($results['TotalDamage']/20)); // 1/20 weapon damage to exp. |
|
| 932 | - $thisPlayer->increaseHOF($results['TotalDamage'],array('Combat','Port','Damage Done'), HOF_PUBLIC); |
|
| 931 | + $thisPlayer->increaseExperience(round($results['TotalDamage'] / 20)); // 1/20 weapon damage to exp. |
|
| 932 | + $thisPlayer->increaseHOF($results['TotalDamage'], array('Combat', 'Port', 'Damage Done'), HOF_PUBLIC); |
|
| 933 | 933 | // $thisPlayer->increaseHOF(1,array('Combat','Port','Shots')); //in SmrPortt::attackedBy() |
| 934 | 934 | |
| 935 | 935 | // Change alignment if we reach a damage threshold. |
@@ -938,10 +938,10 @@ discard block |
||
| 938 | 938 | $relations = Globals::getRaceRelations($thisPlayer->getGameID(), $thisPlayer->getRaceID()); |
| 939 | 939 | if ($relations[$port->getRaceID()] <= RELATIONS_WAR) { |
| 940 | 940 | $thisPlayer->increaseAlignment(1); |
| 941 | - $thisPlayer->increaseHOF(1, array('Combat','Port','Alignment','Gain'), HOF_PUBLIC); |
|
| 941 | + $thisPlayer->increaseHOF(1, array('Combat', 'Port', 'Alignment', 'Gain'), HOF_PUBLIC); |
|
| 942 | 942 | } else { |
| 943 | 943 | $thisPlayer->decreaseAlignment(1); |
| 944 | - $thisPlayer->increaseHOF(1, array('Combat','Port','Alignment','Loss'), HOF_PUBLIC); |
|
| 944 | + $thisPlayer->increaseHOF(1, array('Combat', 'Port', 'Alignment', 'Loss'), HOF_PUBLIC); |
|
| 945 | 945 | } |
| 946 | 946 | } |
| 947 | 947 | return $results; |
@@ -950,23 +950,23 @@ discard block |
||
| 950 | 950 | public function &shootPlanet(SmrPlanet $planet, $delayed) { |
| 951 | 951 | $thisPlayer = $this->getPlayer(); |
| 952 | 952 | $results = array('Player' => $thisPlayer, 'TotalDamage' => 0); |
| 953 | - if($thisPlayer->isDead()) { |
|
| 953 | + if ($thisPlayer->isDead()) { |
|
| 954 | 954 | $results['DeadBeforeShot'] = true; |
| 955 | 955 | return $results; |
| 956 | 956 | } |
| 957 | 957 | $results['DeadBeforeShot'] = false; |
| 958 | - foreach($this->weapons as $orderID => $weapon) { |
|
| 959 | - $results['Weapons'][$orderID] =& $weapon->shootPlanet($thisPlayer, $planet, $delayed); |
|
| 960 | - if($results['Weapons'][$orderID]['Hit']) |
|
| 958 | + foreach ($this->weapons as $orderID => $weapon) { |
|
| 959 | + $results['Weapons'][$orderID] = & $weapon->shootPlanet($thisPlayer, $planet, $delayed); |
|
| 960 | + if ($results['Weapons'][$orderID]['Hit']) |
|
| 961 | 961 | $results['TotalDamage'] += $results['Weapons'][$orderID]['ActualDamage']['TotalDamage']; |
| 962 | 962 | } |
| 963 | - if($this->hasCDs()) { |
|
| 964 | - $thisCDs = new SmrCombatDrones($this->getGameID(),$this->getCDs()); |
|
| 965 | - $results['Drones'] =& $thisCDs->shootPlanet($thisPlayer, $planet, $delayed); |
|
| 963 | + if ($this->hasCDs()) { |
|
| 964 | + $thisCDs = new SmrCombatDrones($this->getGameID(), $this->getCDs()); |
|
| 965 | + $results['Drones'] = & $thisCDs->shootPlanet($thisPlayer, $planet, $delayed); |
|
| 966 | 966 | $results['TotalDamage'] += $results['Drones']['ActualDamage']['TotalDamage']; |
| 967 | 967 | } |
| 968 | - $thisPlayer->increaseExperience(round($results['TotalDamage']/20)); // 1/20 weapon damage to exp. |
|
| 969 | - $thisPlayer->increaseHOF($results['TotalDamage'],array('Combat','Planet','Damage Done'), HOF_PUBLIC); |
|
| 968 | + $thisPlayer->increaseExperience(round($results['TotalDamage'] / 20)); // 1/20 weapon damage to exp. |
|
| 969 | + $thisPlayer->increaseHOF($results['TotalDamage'], array('Combat', 'Planet', 'Damage Done'), HOF_PUBLIC); |
|
| 970 | 970 | // $thisPlayer->increaseHOF(1,array('Combat','Planet','Shots')); //in SmrPlanet::attackedBy() |
| 971 | 971 | return $results; |
| 972 | 972 | } |
@@ -976,15 +976,15 @@ discard block |
||
| 976 | 976 | $armourDamage = 0; |
| 977 | 977 | $cdDamage = 0; |
| 978 | 978 | $shieldDamage = 0; |
| 979 | - if(!$alreadyDead) { |
|
| 980 | - $shieldDamage = $this->doShieldDamage(min($damage['MaxDamage'],$damage['Shield'])); |
|
| 979 | + if (!$alreadyDead) { |
|
| 980 | + $shieldDamage = $this->doShieldDamage(min($damage['MaxDamage'], $damage['Shield'])); |
|
| 981 | 981 | $damage['MaxDamage'] -= $shieldDamage; |
| 982 | - if(!$this->hasShields() && ($shieldDamage == 0 || $damage['Rollover'])) { |
|
| 983 | - $cdDamage = $this->doCDDamage(min($damage['MaxDamage'],$damage['Armour'])); |
|
| 982 | + if (!$this->hasShields() && ($shieldDamage == 0 || $damage['Rollover'])) { |
|
| 983 | + $cdDamage = $this->doCDDamage(min($damage['MaxDamage'], $damage['Armour'])); |
|
| 984 | 984 | $damage['Armour'] -= $cdDamage; |
| 985 | 985 | $damage['MaxDamage'] -= $cdDamage; |
| 986 | - if(!$this->hasCDs() && ($cdDamage == 0 || $damage['Rollover'])) |
|
| 987 | - $armourDamage = $this->doArmourDamage(min($damage['MaxDamage'],$damage['Armour'])); |
|
| 986 | + if (!$this->hasCDs() && ($cdDamage == 0 || $damage['Rollover'])) |
|
| 987 | + $armourDamage = $this->doArmourDamage(min($damage['MaxDamage'], $damage['Armour'])); |
|
| 988 | 988 | } |
| 989 | 989 | } |
| 990 | 990 | $return = array( |
@@ -992,10 +992,10 @@ discard block |
||
| 992 | 992 | 'TargetAlreadyDead' => $alreadyDead, |
| 993 | 993 | 'Shield' => $shieldDamage, |
| 994 | 994 | 'CDs' => $cdDamage, |
| 995 | - 'NumCDs' => $cdDamage/CD_ARMOUR, |
|
| 995 | + 'NumCDs' => $cdDamage / CD_ARMOUR, |
|
| 996 | 996 | 'Armour' => $armourDamage, |
| 997 | 997 | 'HasCDs' => $this->hasCDs(), |
| 998 | - 'TotalDamage' => $shieldDamage+$cdDamage+$armourDamage |
|
| 998 | + 'TotalDamage' => $shieldDamage + $cdDamage + $armourDamage |
|
| 999 | 999 | ); |
| 1000 | 1000 | return $return; |
| 1001 | 1001 | } |
@@ -1005,11 +1005,11 @@ discard block |
||
| 1005 | 1005 | $armourDamage = 0; |
| 1006 | 1006 | $cdDamage = 0; |
| 1007 | 1007 | $shieldDamage = 0; |
| 1008 | - if(!$alreadyDead) { |
|
| 1009 | - $shieldDamage = $this->doShieldDamage(min($damage['MaxDamage'],$damage['Shield'])); |
|
| 1008 | + if (!$alreadyDead) { |
|
| 1009 | + $shieldDamage = $this->doShieldDamage(min($damage['MaxDamage'], $damage['Shield'])); |
|
| 1010 | 1010 | $damage['MaxDamage'] -= $shieldDamage; |
| 1011 | - if(!$this->hasShields() && ($shieldDamage == 0 || $damage['Rollover'])) { //skip CDs if it's mines |
|
| 1012 | - $armourDamage = $this->doArmourDamage(min($damage['MaxDamage'],$damage['Armour'])); |
|
| 1011 | + if (!$this->hasShields() && ($shieldDamage == 0 || $damage['Rollover'])) { //skip CDs if it's mines |
|
| 1012 | + $armourDamage = $this->doArmourDamage(min($damage['MaxDamage'], $damage['Armour'])); |
|
| 1013 | 1013 | } |
| 1014 | 1014 | } |
| 1015 | 1015 | $return = array( |
@@ -1017,28 +1017,28 @@ discard block |
||
| 1017 | 1017 | 'TargetAlreadyDead' => $alreadyDead, |
| 1018 | 1018 | 'Shield' => $shieldDamage, |
| 1019 | 1019 | 'CDs' => $cdDamage, |
| 1020 | - 'NumCDs' => $cdDamage/CD_ARMOUR, |
|
| 1020 | + 'NumCDs' => $cdDamage / CD_ARMOUR, |
|
| 1021 | 1021 | 'Armour' => $armourDamage, |
| 1022 | 1022 | 'HasCDs' => $this->hasCDs(), |
| 1023 | - 'TotalDamage' => $shieldDamage+$cdDamage+$armourDamage |
|
| 1023 | + 'TotalDamage' => $shieldDamage + $cdDamage + $armourDamage |
|
| 1024 | 1024 | ); |
| 1025 | 1025 | return $return; |
| 1026 | 1026 | } |
| 1027 | 1027 | |
| 1028 | 1028 | protected function doShieldDamage($damage) { |
| 1029 | - $actualDamage = min($this->getShields(),$damage); |
|
| 1029 | + $actualDamage = min($this->getShields(), $damage); |
|
| 1030 | 1030 | $this->decreaseShields($actualDamage); |
| 1031 | 1031 | return $actualDamage; |
| 1032 | 1032 | } |
| 1033 | 1033 | |
| 1034 | 1034 | protected function doCDDamage($damage) { |
| 1035 | - $actualDamage = min($this->getCDs(),floor($damage/CD_ARMOUR)); |
|
| 1035 | + $actualDamage = min($this->getCDs(), floor($damage / CD_ARMOUR)); |
|
| 1036 | 1036 | $this->decreaseCDs($actualDamage); |
| 1037 | - return $actualDamage*CD_ARMOUR; |
|
| 1037 | + return $actualDamage * CD_ARMOUR; |
|
| 1038 | 1038 | } |
| 1039 | 1039 | |
| 1040 | 1040 | protected function doArmourDamage($damage) { |
| 1041 | - $actualDamage = min($this->getArmour(),$damage); |
|
| 1041 | + $actualDamage = min($this->getArmour(), $damage); |
|
| 1042 | 1042 | $this->decreaseArmour($actualDamage); |
| 1043 | 1043 | return $actualDamage; |
| 1044 | 1044 | } |
@@ -1050,17 +1050,17 @@ discard block |
||
| 1050 | 1050 | ( |
| 1051 | 1051 | $this->getShields() |
| 1052 | 1052 | +$this->getArmour() |
| 1053 | - +$this->getCDs()*3 |
|
| 1054 | - )/25 |
|
| 1053 | + +$this->getCDs() * 3 |
|
| 1054 | + ) / 25 |
|
| 1055 | 1055 | +( |
| 1056 | - $this->getCargoHolds()/100 |
|
| 1057 | - -$this->getSpeed()*5 |
|
| 1058 | - +($this->getHardpoints()/*+$ship['Increases']['Ship Power']*/)*5 |
|
| 1056 | + $this->getCargoHolds() / 100 |
|
| 1057 | + -$this->getSpeed() * 5 |
|
| 1058 | + +($this->getHardpoints()/*+$ship['Increases']['Ship Power']*/) * 5 |
|
| 1059 | 1059 | /*+( |
| 1060 | 1060 | $ship['Increases']['Mines'] |
| 1061 | 1061 | +$ship['Increases']['Scout Drones'] |
| 1062 | 1062 | )/12*/ |
| 1063 | - +$this->getCDs()/5 |
|
| 1063 | + +$this->getCDs() / 5 |
|
| 1064 | 1064 | ) |
| 1065 | 1065 | ) |
| 1066 | 1066 | ); |