We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | try { |
| 122 | - $TRADE_ROUTE =& $GLOBALS['TRADE_ROUTE']; |
|
| 122 | + $TRADE_ROUTE = & $GLOBALS['TRADE_ROUTE']; |
|
| 123 | 123 | debug('Action #' . $actions); |
| 124 | 124 | |
| 125 | 125 | //We have to reload player on each loop |
@@ -138,14 +138,14 @@ discard block |
||
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | if (!isset($TRADE_ROUTE)) { //We only want to change trade route if there isn't already one set. |
| 141 | - $TRADE_ROUTES =& findRoutes($player); |
|
| 142 | - $TRADE_ROUTE =& changeRoute($TRADE_ROUTES); |
|
| 141 | + $TRADE_ROUTES = & findRoutes($player); |
|
| 142 | + $TRADE_ROUTE = & changeRoute($TRADE_ROUTES); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | if ($player->isDead()) { |
| 146 | 146 | debug('Some evil person killed us, let\'s move on now.'); |
| 147 | 147 | $previousContainer = null; //We died, we don't care what we were doing beforehand. |
| 148 | - $TRADE_ROUTE =& changeRoute($TRADE_ROUTES); //Change route |
|
| 148 | + $TRADE_ROUTE = & changeRoute($TRADE_ROUTES); //Change route |
|
| 149 | 149 | processContainer(create_container('death_processing.php')); |
| 150 | 150 | } |
| 151 | 151 | if ($player->getNewbieTurns() <= NEWBIE_TURNS_WARNING_LIMIT && $player->getNewbieWarning()) { |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | processContainer(tradeGoods($goodID, $player, $port)); |
| 228 | 228 | } else { |
| 229 | 229 | //Move to next route or fed. |
| 230 | - if (($TRADE_ROUTE =& changeRoute($TRADE_ROUTES)) === false) { |
|
| 230 | + if (($TRADE_ROUTE = & changeRoute($TRADE_ROUTES)) === false) { |
|
| 231 | 231 | debug('Changing Route Failed'); |
| 232 | 232 | processContainer(plotToFed($player)); |
| 233 | 233 | } else { |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | processContainer(tradeGoods($goodID, $player, $port)); |
| 255 | 255 | } else { |
| 256 | 256 | //Move to next route or fed. |
| 257 | - if (($TRADE_ROUTE =& changeRoute($TRADE_ROUTES)) === false) { |
|
| 257 | + if (($TRADE_ROUTE = & changeRoute($TRADE_ROUTES)) === false) { |
|
| 258 | 258 | debug('Changing Route Failed'); |
| 259 | 259 | processContainer(plotToFed($player)); |
| 260 | 260 | } else { |
@@ -586,9 +586,9 @@ discard block |
||
| 586 | 586 | return $false; |
| 587 | 587 | } |
| 588 | 588 | $routeKey = array_rand($tradeRoutes); |
| 589 | - $tradeRoute =& $tradeRoutes[$routeKey]; |
|
| 589 | + $tradeRoute = & $tradeRoutes[$routeKey]; |
|
| 590 | 590 | unset($tradeRoutes[$routeKey]); |
| 591 | - $GLOBALS['TRADE_ROUTE'] =& $tradeRoute; |
|
| 591 | + $GLOBALS['TRADE_ROUTE'] = & $tradeRoute; |
|
| 592 | 592 | debug('Switched route', $tradeRoute); |
| 593 | 593 | return $tradeRoute; |
| 594 | 594 | } |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | $menuItems[] = array('Link'=>Globals::getPlanetListHREF($alliance_id), 'Text'=>'Defense'); |
| 13 | 13 | $menuItems[] = array('Link'=>Globals::getPlanetListFinancialHREF($alliance_id), 'Text'=>'Financial'); |
| 14 | 14 | // make the selected index bold |
| 15 | - $boldItem =& $menuItems[$selected_index]['Text']; |
|
| 15 | + $boldItem = & $menuItems[$selected_index]['Text']; |
|
| 16 | 16 | $boldItem = '<span class="bold">' . $boldItem . '</span>'; |
| 17 | 17 | $template->assign('MenuItems', $menuItems); |
| 18 | 18 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $menuItems[] = ['Link' => SmrSession::getNewHREF($container), |
| 108 | 108 | 'Text' => 'Game News']; |
| 109 | 109 | // make the selected index bold |
| 110 | - $boldItem =& $menuItems[$selected_index]['Text']; |
|
| 110 | + $boldItem = & $menuItems[$selected_index]['Text']; |
|
| 111 | 111 | $boldItem = '<b>' . $boldItem . '</b>'; |
| 112 | 112 | $template->assign('MenuItems', $menuItems); |
| 113 | 113 | } |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public static function mysqliFactory(MySqlProperties $mysqlProperties): mysqli { |
| 41 | - if (!mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT)) { |
|
| 41 | + if (!mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT)) { |
|
| 42 | 42 | throw new RuntimeException('Failed to enable mysqli error reporting'); |
| 43 | 43 | } |
| 44 | 44 | $mysql = new mysqli( |
@@ -1,30 +1,30 @@ discard block |
||
| 1 | 1 | <?php declare(strict_types=1); |
| 2 | 2 | |
| 3 | 3 | class DummyPlayer extends AbstractSmrPlayer { |
| 4 | - public function __construct($gameID=0,$playerName='Dummy',$raceID=1,$experience=1000,$alignment=100,$allianceID=0,$shipTypeID=60) { |
|
| 4 | + public function __construct($gameID = 0, $playerName = 'Dummy', $raceID = 1, $experience = 1000, $alignment = 100, $allianceID = 0, $shipTypeID = 60) { |
|
| 5 | 5 | $this->accountID = 0; |
| 6 | - $this->gameID = (int) $gameID; |
|
| 7 | - $this->playerName = (string) $playerName; |
|
| 6 | + $this->gameID = (int)$gameID; |
|
| 7 | + $this->playerName = (string)$playerName; |
|
| 8 | 8 | $this->playerID = 0; |
| 9 | 9 | $this->sectorID = 0; |
| 10 | - $this->lastSectorID = 0; |
|
| 10 | + $this->lastSectorID = 0; |
|
| 11 | 11 | $this->turns = 1000; |
| 12 | - $this->newbieTurns = 0; |
|
| 12 | + $this->newbieTurns = 0; |
|
| 13 | 13 | $this->lastNewsUpdate = 0; |
| 14 | 14 | $this->dead = false; |
| 15 | 15 | $this->landedOnPlanet = false; |
| 16 | - $this->lastActive = 0; |
|
| 17 | - $this->lastCPLAction = 0; |
|
| 18 | - $this->raceID = (int) $raceID; |
|
| 19 | - $this->credits = 0; |
|
| 20 | - $this->experience = (int) $experience; |
|
| 21 | - $this->alignment = (int) $alignment; |
|
| 22 | - $this->militaryPayment = 0; |
|
| 23 | - $this->allianceID = (int) $allianceID; |
|
| 24 | - $this->shipID = (int) $shipTypeID; |
|
| 16 | + $this->lastActive = 0; |
|
| 17 | + $this->lastCPLAction = 0; |
|
| 18 | + $this->raceID = (int)$raceID; |
|
| 19 | + $this->credits = 0; |
|
| 20 | + $this->experience = (int)$experience; |
|
| 21 | + $this->alignment = (int)$alignment; |
|
| 22 | + $this->militaryPayment = 0; |
|
| 23 | + $this->allianceID = (int)$allianceID; |
|
| 24 | + $this->shipID = (int)$shipTypeID; |
|
| 25 | 25 | $this->kills = 0; |
| 26 | 26 | $this->deaths = 0; |
| 27 | - $this->lastPort = 0; |
|
| 27 | + $this->lastPort = 0; |
|
| 28 | 28 | $this->bank = 0; |
| 29 | 29 | $this->zoom = 0; |
| 30 | 30 | |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public function setAllianceID($ID) { |
| 51 | - if($this->allianceID == $ID) |
|
| 51 | + if ($this->allianceID == $ID) |
|
| 52 | 52 | return; |
| 53 | - $this->allianceID=$ID; |
|
| 53 | + $this->allianceID = $ID; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | public function &killPlayerByPlayer(AbstractSmrPlayer $killer) { |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $db = MySqlDatabase::getInstance(); |
| 77 | 77 | $db->query('REPLACE INTO cached_dummys ' . |
| 78 | 78 | '(type, id, info) ' . |
| 79 | - 'VALUES (\'DummyPlayer\', '.$db->escapeString($this->getPlayerName()).', '.$db->escapeString($cache).')'); |
|
| 79 | + 'VALUES (\'DummyPlayer\', ' . $db->escapeString($this->getPlayerName()) . ', ' . $db->escapeString($cache) . ')'); |
|
| 80 | 80 | unserialize($cache); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $db->query('SELECT info FROM cached_dummys |
| 86 | 86 | WHERE type = \'DummyPlayer\' |
| 87 | 87 | AND id = ' . $db->escapeString($name) . ' LIMIT 1'); |
| 88 | - if($db->nextRecord()) { |
|
| 88 | + if ($db->nextRecord()) { |
|
| 89 | 89 | $return = unserialize($db->getField('info')); |
| 90 | 90 | return $return; |
| 91 | 91 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $db->query('SELECT id FROM cached_dummys |
| 101 | 101 | WHERE type = \'DummyPlayer\''); |
| 102 | 102 | $dummyNames = array(); |
| 103 | - while($db->nextRecord()) { |
|
| 103 | + while ($db->nextRecord()) { |
|
| 104 | 104 | $dummyNames[] = $db->getField('id'); |
| 105 | 105 | } |
| 106 | 106 | return $dummyNames; |
@@ -3,10 +3,10 @@ |
||
| 3 | 3 | // Holds information linking the received message and the game data |
| 4 | 4 | class GameLink |
| 5 | 5 | { |
| 6 | - public $valid = false; // identifies if the message is linked to game data |
|
| 7 | - public $account; // SmrAccount instance |
|
| 8 | - public $alliance; // SmrAlliance instance |
|
| 9 | - public $player; // SmrPlayer instance |
|
| 6 | + public $valid = false; // identifies if the message is linked to game data |
|
| 7 | + public $account; // SmrAccount instance |
|
| 8 | + public $alliance; // SmrAlliance instance |
|
| 9 | + public $player; // SmrPlayer instance |
|
| 10 | 10 | |
| 11 | 11 | // $author can be either Discord\Parts\User\{User,Member} |
| 12 | 12 | function __construct(Discord\Parts\Channel\Channel $channel, $author) { |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | $db3 = MySqlDatabase::getInstance(); |
| 8 | 8 | |
| 9 | 9 | // get current entry |
| 10 | - $db->query('SELECT * FROM manual WHERE topic_id = '.$db->escapeNumber($topic_id)); |
|
| 10 | + $db->query('SELECT * FROM manual WHERE topic_id = ' . $db->escapeNumber($topic_id)); |
|
| 11 | 11 | if ($db->nextRecord()) { |
| 12 | 12 | $parent_topic_id = $db->getInt('parent_topic_id'); |
| 13 | 13 | $order_id = $db->getInt('order_id'); |
@@ -19,17 +19,17 @@ discard block |
||
| 19 | 19 | // ************************** |
| 20 | 20 | // ** PREVIOUS |
| 21 | 21 | // ************************** |
| 22 | - $db2->query('SELECT * FROM manual WHERE parent_topic_id = '.$db2->escapeNumber($parent_topic_id).' AND order_id = '.$db2->escapeNumber($order_id - 1)); |
|
| 22 | + $db2->query('SELECT * FROM manual WHERE parent_topic_id = ' . $db2->escapeNumber($parent_topic_id) . ' AND order_id = ' . $db2->escapeNumber($order_id - 1)); |
|
| 23 | 23 | |
| 24 | 24 | // no result? |
| 25 | 25 | if (!$db2->getNumRows()) |
| 26 | - $db2->query('SELECT * FROM manual WHERE topic_id = '.$db2->escapeNumber($parent_topic_id)); |
|
| 26 | + $db2->query('SELECT * FROM manual WHERE topic_id = ' . $db2->escapeNumber($parent_topic_id)); |
|
| 27 | 27 | |
| 28 | 28 | echo ('<th width="32">'); |
| 29 | 29 | if ($db2->nextRecord()) { |
| 30 | 30 | $previous_topic_id = $db2->getInt('topic_id'); |
| 31 | 31 | $previous_topic = stripslashes($db2->getField('topic')); |
| 32 | - echo ('<a href="/manual.php?'.$previous_topic_id.'"><img src="/images/help/previous.jpg" width="32" height="32" border="0"></a>'); |
|
| 32 | + echo ('<a href="/manual.php?' . $previous_topic_id . '"><img src="/images/help/previous.jpg" width="32" height="32" border="0"></a>'); |
|
| 33 | 33 | } else |
| 34 | 34 | echo ('<img src="/images/help/empty.jpg" width="32" height="32">'); |
| 35 | 35 | echo ('</th>'); |
@@ -37,12 +37,12 @@ discard block |
||
| 37 | 37 | // ************************** |
| 38 | 38 | // ** UP |
| 39 | 39 | // ************************** |
| 40 | - $db2->query('SELECT * FROM manual WHERE topic_id = '.$db2->escapeNumber($parent_topic_id)); |
|
| 40 | + $db2->query('SELECT * FROM manual WHERE topic_id = ' . $db2->escapeNumber($parent_topic_id)); |
|
| 41 | 41 | echo ('<th width="32">'); |
| 42 | 42 | if ($db2->nextRecord()) { |
| 43 | 43 | $up_topic_id = $db2->getInt('topic_id'); |
| 44 | 44 | $up_topic = stripslashes($db2->getField('topic')); |
| 45 | - echo ('<a href="/manual.php?'.$up_topic_id.'"><img src="/images/help/up.jpg" width="32" height="32" border="0"></a>'); |
|
| 45 | + echo ('<a href="/manual.php?' . $up_topic_id . '"><img src="/images/help/up.jpg" width="32" height="32" border="0"></a>'); |
|
| 46 | 46 | } else |
| 47 | 47 | echo ('<img src="/images/help/empty.jpg" width="32" height="32">'); |
| 48 | 48 | echo ('</th>'); |
@@ -50,35 +50,35 @@ discard block |
||
| 50 | 50 | // ************************** |
| 51 | 51 | // ** NEXT |
| 52 | 52 | // ************************** |
| 53 | - $db2->query('SELECT * FROM manual WHERE parent_topic_id = '.$db2->escapeNumber($topic_id).' AND order_id = 1'); |
|
| 53 | + $db2->query('SELECT * FROM manual WHERE parent_topic_id = ' . $db2->escapeNumber($topic_id) . ' AND order_id = 1'); |
|
| 54 | 54 | |
| 55 | 55 | if (!$db2->getNumRows()) |
| 56 | - $db2->query('SELECT * FROM manual WHERE parent_topic_id = '.$db2->escapeNumber($parent_topic_id).' AND order_id = '.$db2->escapeNumber($order_id + 1)); |
|
| 56 | + $db2->query('SELECT * FROM manual WHERE parent_topic_id = ' . $db2->escapeNumber($parent_topic_id) . ' AND order_id = ' . $db2->escapeNumber($order_id + 1)); |
|
| 57 | 57 | |
| 58 | 58 | $seenParentIDs = array(0); |
| 59 | 59 | $curr_parent_topic_id = $parent_topic_id; |
| 60 | 60 | while (!$db2->getNumRows() && !in_array($curr_parent_topic_id, $seenParentIDs)) { |
| 61 | 61 | $seenParentIDs[] = $curr_parent_topic_id; |
| 62 | - $db3->query('SELECT * FROM manual WHERE topic_id = '.$db3->escapeNumber($parent_topic_id)); |
|
| 62 | + $db3->query('SELECT * FROM manual WHERE topic_id = ' . $db3->escapeNumber($parent_topic_id)); |
|
| 63 | 63 | $db3->nextRecord(); |
| 64 | 64 | $curr_order_id = $db3->getInt('order_id'); |
| 65 | 65 | $curr_parent_topic_id = $db3->getInt('parent_topic_id'); |
| 66 | 66 | |
| 67 | - $db2->query('SELECT * FROM manual WHERE parent_topic_id = '.$db2->escapeNumber($parent_topic_id).' AND order_id = '.$db2->escapeNumber($curr_order_id + 1)); |
|
| 67 | + $db2->query('SELECT * FROM manual WHERE parent_topic_id = ' . $db2->escapeNumber($parent_topic_id) . ' AND order_id = ' . $db2->escapeNumber($curr_order_id + 1)); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | echo ('<th width="32">'); |
| 71 | 71 | if ($db2->nextRecord()) { |
| 72 | 72 | $next_topic_id = $db2->getInt('topic_id'); |
| 73 | 73 | $next_topic = stripslashes($db2->getField('topic')); |
| 74 | - echo ('<a href="/manual.php?'.$next_topic_id.'"><img src="/images/help/next.jpg" width="32" height="32" border="0"></a>'); |
|
| 74 | + echo ('<a href="/manual.php?' . $next_topic_id . '"><img src="/images/help/next.jpg" width="32" height="32" border="0"></a>'); |
|
| 75 | 75 | } |
| 76 | 76 | else { |
| 77 | 77 | echo ('<img src="/images/help/empty.jpg" width="32" height="32">'); |
| 78 | 78 | } |
| 79 | 79 | echo ('</th>'); |
| 80 | 80 | |
| 81 | - echo ('<th width="100%" class="center" validn="middle" style="font-size:18pt;font-weight:bold;">' . get_numbering($topic_id) . $topic.'</th>'); |
|
| 81 | + echo ('<th width="100%" class="center" validn="middle" style="font-size:18pt;font-weight:bold;">' . get_numbering($topic_id) . $topic . '</th>'); |
|
| 82 | 82 | echo ('<th width="32"><a href="/manual_toc.php"><img src="/images/help/contents.jpg" width="32" height="32" border="0"></a></th>'); |
| 83 | 83 | |
| 84 | 84 | echo ('</tr>'); |
@@ -86,11 +86,11 @@ discard block |
||
| 86 | 86 | echo ('<tr>'); |
| 87 | 87 | echo ('<td colspan="5">'); |
| 88 | 88 | if (isset($previous_topic_id) && $previous_topic_id > 0) |
| 89 | - echo ('<b>Previous:</b> <a href="/manual.php?'.$previous_topic_id.'">' . get_numbering($previous_topic_id) . $previous_topic.'</a> '); |
|
| 89 | + echo ('<b>Previous:</b> <a href="/manual.php?' . $previous_topic_id . '">' . get_numbering($previous_topic_id) . $previous_topic . '</a> '); |
|
| 90 | 90 | if (isset($up_topic_id) && $up_topic_id > 0) |
| 91 | - echo ('<b>Up:</b> <a href="/manual.php?'.$up_topic_id.'">' . get_numbering($up_topic_id) . $up_topic.'</a> '); |
|
| 91 | + echo ('<b>Up:</b> <a href="/manual.php?' . $up_topic_id . '">' . get_numbering($up_topic_id) . $up_topic . '</a> '); |
|
| 92 | 92 | if (isset($next_topic_id) && $next_topic_id > 0) |
| 93 | - echo ('<b>Next:</b> <a href="/manual.php?'.$next_topic_id.'">' . get_numbering($next_topic_id) . $next_topic.'</a>'); |
|
| 93 | + echo ('<b>Next:</b> <a href="/manual.php?' . $next_topic_id . '">' . get_numbering($next_topic_id) . $next_topic . '</a>'); |
|
| 94 | 94 | echo ('</tr>'); |
| 95 | 95 | |
| 96 | 96 | echo ('</table>'); |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $db = MySqlDatabase::getInstance(); |
| 104 | 104 | |
| 105 | 105 | // get current entry |
| 106 | - $db->query('SELECT * FROM manual WHERE topic_id = '.$topic_id); |
|
| 106 | + $db->query('SELECT * FROM manual WHERE topic_id = ' . $topic_id); |
|
| 107 | 107 | if ($db->nextRecord()) { |
| 108 | 108 | $parent_topic_id = $db->getInt('parent_topic_id'); |
| 109 | 109 | $order_id = $db->getInt('order_id'); |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | $text = stripslashes($db->getField('text')); |
| 112 | 112 | |
| 113 | 113 | echo ('<div id="help_content">'); |
| 114 | - echo ('<h1>' . get_numbering($topic_id) . $topic.'</h1>'); |
|
| 115 | - echo ('<p>'.$text.'<p>'); |
|
| 114 | + echo ('<h1>' . get_numbering($topic_id) . $topic . '</h1>'); |
|
| 115 | + echo ('<p>' . $text . '<p>'); |
|
| 116 | 116 | echo ('</div>'); |
| 117 | 117 | } else |
| 118 | 118 | echo ('Invalid Topic!'); |
@@ -121,9 +121,9 @@ discard block |
||
| 121 | 121 | function echo_subsection($topic_id) { |
| 122 | 122 | // database object |
| 123 | 123 | $db = MySqlDatabase::getInstance(); |
| 124 | - $return=''; |
|
| 124 | + $return = ''; |
|
| 125 | 125 | // check if there are subsections |
| 126 | - $db->query('SELECT * FROM manual WHERE parent_topic_id = '.$db->escapeNumber($topic_id).' ORDER BY order_id'); |
|
| 126 | + $db->query('SELECT * FROM manual WHERE parent_topic_id = ' . $db->escapeNumber($topic_id) . ' ORDER BY order_id'); |
|
| 127 | 127 | if ($db->getNumRows()) { |
| 128 | 128 | echo ('<hr noshade width="75%" size="1" class="center"/>'); |
| 129 | 129 | echo ('<div id="help_menu">'); |
@@ -137,19 +137,19 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | function echo_menu($topic_id) { |
| 140 | - $return=''; |
|
| 140 | + $return = ''; |
|
| 141 | 141 | // database object |
| 142 | 142 | $db = MySqlDatabase::getInstance(); |
| 143 | 143 | |
| 144 | - $db->query('SELECT * FROM manual WHERE parent_topic_id = '.$db->escapeNumber($topic_id).' ORDER BY order_id'); |
|
| 144 | + $db->query('SELECT * FROM manual WHERE parent_topic_id = ' . $db->escapeNumber($topic_id) . ' ORDER BY order_id'); |
|
| 145 | 145 | if ($db->getNumRows()) { |
| 146 | 146 | echo ('<ul type="disc">'); |
| 147 | - while($db->nextRecord()) { |
|
| 147 | + while ($db->nextRecord()) { |
|
| 148 | 148 | $sub_topic_id = $db->getInt('topic_id'); |
| 149 | 149 | $order_id = $db->getInt('order_id'); |
| 150 | 150 | $sub_topic = stripslashes($db->getField('topic')); |
| 151 | 151 | |
| 152 | - echo ('<li><a href="/manual.php?'.$sub_topic_id.'">' . get_numbering($sub_topic_id) . $sub_topic.'</a></li>'); |
|
| 152 | + echo ('<li><a href="/manual.php?' . $sub_topic_id . '">' . get_numbering($sub_topic_id) . $sub_topic . '</a></li>'); |
|
| 153 | 153 | echo_menu($sub_topic_id); |
| 154 | 154 | } |
| 155 | 155 | echo ('</ul>'); |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | function get_numbering($topic_id) { |
| 161 | 161 | $db = MySqlDatabase::getInstance(); |
| 162 | 162 | |
| 163 | - $db->query('SELECT * FROM manual WHERE topic_id = '.$db->escapeNumber($topic_id)); |
|
| 163 | + $db->query('SELECT * FROM manual WHERE topic_id = ' . $db->escapeNumber($topic_id)); |
|
| 164 | 164 | if ($db->nextRecord()) { |
| 165 | 165 | $up_topic_id = $db->getInt('parent_topic_id'); |
| 166 | 166 | $order_id = $db->getInt('order_id'); |
@@ -1,91 +1,91 @@ |
||
| 1 | 1 | <?php declare(strict_types=1); |
| 2 | -$template->assign('PageTopic','Combat Simulator'); |
|
| 2 | +$template->assign('PageTopic', 'Combat Simulator'); |
|
| 3 | 3 | |
| 4 | -$template->assign('EditDummysLink',SmrSession::getNewHREF(create_container('skeleton.php','edit_dummys.php'))); |
|
| 4 | +$template->assign('EditDummysLink', SmrSession::getNewHREF(create_container('skeleton.php', 'edit_dummys.php'))); |
|
| 5 | 5 | $template->assign('DummyNames', DummyPlayer::getDummyPlayerNames()); |
| 6 | 6 | |
| 7 | 7 | $duplicates = false; |
| 8 | 8 | $usedNames = array(); |
| 9 | 9 | $realAttackers = array(); |
| 10 | 10 | $attackers = array(); |
| 11 | -$i=1; |
|
| 12 | -if(isset($_POST['attackers'])) |
|
| 13 | - foreach($_POST['attackers'] as $attackerName) { |
|
| 14 | - if($attackerName=='none') |
|
| 11 | +$i = 1; |
|
| 12 | +if (isset($_POST['attackers'])) |
|
| 13 | + foreach ($_POST['attackers'] as $attackerName) { |
|
| 14 | + if ($attackerName == 'none') |
|
| 15 | 15 | continue; |
| 16 | - if(isset($usedNames[$attackerName])) { |
|
| 16 | + if (isset($usedNames[$attackerName])) { |
|
| 17 | 17 | $duplicates = true; |
| 18 | 18 | continue; |
| 19 | 19 | } |
| 20 | 20 | $usedNames[$attackerName] = true; |
| 21 | - $attackers[$i] =& DummyPlayer::getCachedDummyPlayer($attackerName); |
|
| 21 | + $attackers[$i] = & DummyPlayer::getCachedDummyPlayer($attackerName); |
|
| 22 | 22 | $attackers[$i]->setAllianceID(1); |
| 23 | - $realAttackers[$i] =& $attackers[$i]; |
|
| 23 | + $realAttackers[$i] = & $attackers[$i]; |
|
| 24 | 24 | ++$i; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | -for(;$i<=10;++$i) |
|
| 27 | +for (;$i <= 10; ++$i) |
|
| 28 | 28 | $attackers[$i] = null; |
| 29 | -$template->assign('Attackers',$attackers); |
|
| 29 | +$template->assign('Attackers', $attackers); |
|
| 30 | 30 | |
| 31 | -$i=1; |
|
| 31 | +$i = 1; |
|
| 32 | 32 | $realDefenders = array(); |
| 33 | 33 | $defenders = array(); |
| 34 | -if(isset($_POST['defenders'])) |
|
| 35 | - foreach($_POST['defenders'] as $defenderName) { |
|
| 36 | - if($defenderName=='none') |
|
| 34 | +if (isset($_POST['defenders'])) |
|
| 35 | + foreach ($_POST['defenders'] as $defenderName) { |
|
| 36 | + if ($defenderName == 'none') |
|
| 37 | 37 | continue; |
| 38 | - if(isset($usedNames[$defenderName])) { |
|
| 38 | + if (isset($usedNames[$defenderName])) { |
|
| 39 | 39 | $duplicates = true; |
| 40 | 40 | continue; |
| 41 | 41 | } |
| 42 | 42 | $usedNames[$attackerName] = true; |
| 43 | - $defenders[$i] =& DummyPlayer::getCachedDummyPlayer($defenderName); |
|
| 43 | + $defenders[$i] = & DummyPlayer::getCachedDummyPlayer($defenderName); |
|
| 44 | 44 | $defenders[$i]->setAllianceID(2); |
| 45 | - $realDefenders[$i] =& $defenders[$i]; |
|
| 45 | + $realDefenders[$i] = & $defenders[$i]; |
|
| 46 | 46 | ++$i; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | -for(;$i<=10;++$i) |
|
| 49 | +for (;$i <= 10; ++$i) |
|
| 50 | 50 | $defenders[$i] = null; |
| 51 | -$template->assign('Defenders',$defenders); |
|
| 51 | +$template->assign('Defenders', $defenders); |
|
| 52 | 52 | |
| 53 | -$template->assign('Duplicates',$duplicates); |
|
| 53 | +$template->assign('Duplicates', $duplicates); |
|
| 54 | 54 | |
| 55 | -$template->assign('CombatSimHREF',SmrSession::getNewHREF(create_container('skeleton.php','combat_simulator.php'))); |
|
| 55 | +$template->assign('CombatSimHREF', SmrSession::getNewHREF(create_container('skeleton.php', 'combat_simulator.php'))); |
|
| 56 | 56 | |
| 57 | 57 | if (!empty($realAttackers) && !empty($realDefenders)) { |
| 58 | - if(isset($_REQUEST['run'])) { |
|
| 59 | - runAnAttack($realAttackers,$realDefenders); |
|
| 58 | + if (isset($_REQUEST['run'])) { |
|
| 59 | + runAnAttack($realAttackers, $realDefenders); |
|
| 60 | 60 | } |
| 61 | - if(isset($_REQUEST['death_run'])) { |
|
| 62 | - while(count($realAttackers)>0 && count($realDefenders)>0) { |
|
| 63 | - runAnAttack($realAttackers,$realDefenders); |
|
| 64 | - foreach($realAttackers as $key => &$teamPlayer) { |
|
| 65 | - if($teamPlayer->isDead()) |
|
| 61 | + if (isset($_REQUEST['death_run'])) { |
|
| 62 | + while (count($realAttackers) > 0 && count($realDefenders) > 0) { |
|
| 63 | + runAnAttack($realAttackers, $realDefenders); |
|
| 64 | + foreach ($realAttackers as $key => &$teamPlayer) { |
|
| 65 | + if ($teamPlayer->isDead()) |
|
| 66 | 66 | unset($realAttackers[$key]); |
| 67 | 67 | } unset($teamPlayer); |
| 68 | - foreach($realDefenders as $key => &$teamPlayer) { |
|
| 69 | - if($teamPlayer->isDead()) |
|
| 68 | + foreach ($realDefenders as $key => &$teamPlayer) { |
|
| 69 | + if ($teamPlayer->isDead()) |
|
| 70 | 70 | unset($realDefenders[$key]); |
| 71 | 71 | } unset($teamPlayer); |
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | -function runAnAttack($realAttackers,$realDefenders) { |
|
| 76 | +function runAnAttack($realAttackers, $realDefenders) { |
|
| 77 | 77 | global $template; |
| 78 | 78 | $results = array('Attackers' => array('Traders' => array(), 'TotalDamage' => 0), |
| 79 | 79 | 'Defenders' => array('Traders' => array(), 'TotalDamage' => 0)); |
| 80 | 80 | foreach ($realAttackers as $accountID => $teamPlayer) { |
| 81 | - $playerResults =& $teamPlayer->shootPlayers($realDefenders); |
|
| 82 | - $results['Attackers']['Traders'][] =& $playerResults; |
|
| 81 | + $playerResults = & $teamPlayer->shootPlayers($realDefenders); |
|
| 82 | + $results['Attackers']['Traders'][] = & $playerResults; |
|
| 83 | 83 | $results['Attackers']['TotalDamage'] += $playerResults['TotalDamage']; |
| 84 | 84 | } |
| 85 | 85 | foreach ($realDefenders as $accountID => $teamPlayer) { |
| 86 | - $playerResults =& $teamPlayer->shootPlayers($realAttackers); |
|
| 87 | - $results['Defenders']['Traders'][] =& $playerResults; |
|
| 86 | + $playerResults = & $teamPlayer->shootPlayers($realAttackers); |
|
| 87 | + $results['Defenders']['Traders'][] = & $playerResults; |
|
| 88 | 88 | $results['Defenders']['TotalDamage'] += $playerResults['TotalDamage']; |
| 89 | 89 | } |
| 90 | - $template->assign('TraderCombatResults',$results); |
|
| 90 | + $template->assign('TraderCombatResults', $results); |
|
| 91 | 91 | } |
@@ -18,8 +18,7 @@ |
||
| 18 | 18 | if ($join === false) { |
| 19 | 19 | create_error('Join Date is not valid!'); |
| 20 | 20 | } |
| 21 | -$start = empty(Request::get('game_start')) ? $join : |
|
| 22 | - DateTime::createFromFormat('d/m/Y|', Request::get('game_start')); |
|
| 21 | +$start = empty(Request::get('game_start')) ? $join : DateTime::createFromFormat('d/m/Y|', Request::get('game_start')); |
|
| 23 | 22 | if ($start === false) { |
| 24 | 23 | create_error('Start Date is not valid!'); |
| 25 | 24 | } |
@@ -19,8 +19,8 @@ discard block |
||
| 19 | 19 | 1 => array("pipe", "w") // stdout is a pipe that the child will write to |
| 20 | 20 | ); |
| 21 | 21 | $engine = proc_open(UCI_CHESS_ENGINE, $descriptorSpec, $pipes); |
| 22 | - $toEngine =& $pipes[0]; |
|
| 23 | - $fromEngine =& $pipes[1]; |
|
| 22 | + $toEngine = & $pipes[0]; |
|
| 23 | + $fromEngine = & $pipes[1]; |
|
| 24 | 24 | |
| 25 | 25 | function readFromEngine($block = true) { |
| 26 | 26 | global $fromEngine; |
@@ -84,5 +84,5 @@ discard block |
||
| 84 | 84 | function debug($message, $debugObject = null) { |
| 85 | 85 | global $account, $var, $db; |
| 86 | 86 | echo date('Y-m-d H:i:s - ') . $message . ($debugObject !== null ? EOL . var_export($debugObject, true) : '') . EOL; |
| 87 | - $db->query('INSERT INTO npc_logs (script_id, npc_id, time, message, debug_info, var) VALUES (' . (defined('SCRIPT_ID') ? SCRIPT_ID : 0) . ', ' . (is_object($account) ? $account->getAccountID() : 0) . ',NOW(),' . $db->escapeString($message) . ',' . $db->escapeString(var_export($debugObject,true)) . ',' . $db->escapeString(var_export($var, true)) . ')'); |
|
| 87 | + $db->query('INSERT INTO npc_logs (script_id, npc_id, time, message, debug_info, var) VALUES (' . (defined('SCRIPT_ID') ? SCRIPT_ID : 0) . ', ' . (is_object($account) ? $account->getAccountID() : 0) . ',NOW(),' . $db->escapeString($message) . ',' . $db->escapeString(var_export($debugObject, true)) . ',' . $db->escapeString(var_export($var, true)) . ')'); |
|
| 88 | 88 | } |