We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -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; |
@@ -446,20 +446,20 @@ |
||
| 446 | 446 | |
| 447 | 447 | if ($this->hasMines()) { |
| 448 | 448 | $thisMines = new SmrMines($this->getGameID(), $this->getMines()); |
| 449 | - $results['Results']['Mines'] =& $thisMines->shootPlayerAsForce($this, $targetPlayers[array_rand($targetPlayers)], $minesAreAttacker); |
|
| 449 | + $results['Results']['Mines'] = & $thisMines->shootPlayerAsForce($this, $targetPlayers[array_rand($targetPlayers)], $minesAreAttacker); |
|
| 450 | 450 | $results['TotalDamage'] += $results['Results']['Mines']['ActualDamage']['TotalDamage']; |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | if ($this->hasCDs()) { |
| 454 | 454 | $thisCDs = new SmrCombatDrones($this->getGameID(), $this->getCDs()); |
| 455 | - $results['Results']['Drones'] =& $thisCDs->shootPlayerAsForce($this, $targetPlayers[array_rand($targetPlayers)]); |
|
| 455 | + $results['Results']['Drones'] = & $thisCDs->shootPlayerAsForce($this, $targetPlayers[array_rand($targetPlayers)]); |
|
| 456 | 456 | $results['TotalDamage'] += $results['Results']['Drones']['ActualDamage']['TotalDamage']; |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | if (!$minesAreAttacker) { |
| 460 | 460 | if ($this->hasSDs()) { |
| 461 | 461 | $thisSDs = new SmrScoutDrones($this->getGameID(), $this->getSDs()); |
| 462 | - $results['Results']['Scouts'] =& $thisSDs->shootPlayerAsForce($this, $targetPlayers[array_rand($targetPlayers)]); |
|
| 462 | + $results['Results']['Scouts'] = & $thisSDs->shootPlayerAsForce($this, $targetPlayers[array_rand($targetPlayers)]); |
|
| 463 | 463 | $results['TotalDamage'] += $results['Results']['Scouts']['ActualDamage']['TotalDamage']; |
| 464 | 464 | } |
| 465 | 465 | } |
@@ -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 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -$CombatPort =& $PortCombatResults['Port']; |
|
| 2 | +$CombatPort = & $PortCombatResults['Port']; |
|
| 3 | 3 | $TotalDamage = $PortCombatResults['TotalDamage']; |
| 4 | 4 | if ($MinimalDisplay) { |
| 5 | 5 | echo $CombatPort->getDisplayName(); |
@@ -12,13 +12,13 @@ discard block |
||
| 12 | 12 | } |
| 13 | 13 | if (isset($PortCombatResults['Weapons']) && is_array($PortCombatResults['Weapons'])) { |
| 14 | 14 | foreach ($PortCombatResults['Weapons'] as $WeaponResults) { |
| 15 | - $ShootingWeapon =& $WeaponResults['Weapon']; |
|
| 16 | - $ShotHit =& $WeaponResults['Hit']; |
|
| 17 | - $ActualDamage =& $WeaponResults['ActualDamage']; |
|
| 18 | - $WeaponDamage =& $WeaponResults['WeaponDamage']; |
|
| 19 | - $TargetPlayer =& $WeaponResults['TargetPlayer']; |
|
| 15 | + $ShootingWeapon = & $WeaponResults['Weapon']; |
|
| 16 | + $ShotHit = & $WeaponResults['Hit']; |
|
| 17 | + $ActualDamage = & $WeaponResults['ActualDamage']; |
|
| 18 | + $WeaponDamage = & $WeaponResults['WeaponDamage']; |
|
| 19 | + $TargetPlayer = & $WeaponResults['TargetPlayer']; |
|
| 20 | 20 | |
| 21 | - echo $CombatPort->getDisplayName() ?> fires an <?php echo $ShootingWeapon->getName() ?> at <?php if ($ShotHit && $ActualDamage['TargetAlreadyDead']){ ?> the debris that was once <?php } echo $TargetPlayer->getDisplayName(); |
|
| 21 | + echo $CombatPort->getDisplayName() ?> fires an <?php echo $ShootingWeapon->getName() ?> at <?php if ($ShotHit && $ActualDamage['TargetAlreadyDead']) { ?> the debris that was once <?php } echo $TargetPlayer->getDisplayName(); |
|
| 22 | 22 | if (!$ShotHit || !$ActualDamage['TargetAlreadyDead']) { |
| 23 | 23 | if (!$ShotHit) { |
| 24 | 24 | ?> and misses<?php |
@@ -37,9 +37,9 @@ discard block |
||
| 37 | 37 | } else { |
| 38 | 38 | ?> destroying <?php |
| 39 | 39 | $DamageTypes = 0; |
| 40 | - if ($ActualDamage['Shield'] > 0){ $DamageTypes = $DamageTypes+1; } |
|
| 41 | - if ($ActualDamage['NumCDs'] > 0){ $DamageTypes = $DamageTypes+1; } |
|
| 42 | - if ($ActualDamage['Armour'] > 0){ $DamageTypes = $DamageTypes+1; } |
|
| 40 | + if ($ActualDamage['Shield'] > 0) { $DamageTypes = $DamageTypes + 1; } |
|
| 41 | + if ($ActualDamage['NumCDs'] > 0) { $DamageTypes = $DamageTypes + 1; } |
|
| 42 | + if ($ActualDamage['Armour'] > 0) { $DamageTypes = $DamageTypes + 1; } |
|
| 43 | 43 | |
| 44 | 44 | if ($ActualDamage['Shield'] > 0) { |
| 45 | 45 | ?><span class="shields"><?php echo number_format($ActualDamage['Shield']) ?></span> shields<?php |
@@ -56,21 +56,21 @@ discard block |
||
| 56 | 56 | } ?>. |
| 57 | 57 | <br /><?php |
| 58 | 58 | if ($ShotHit && $ActualDamage['KillingShot']) { |
| 59 | - $this->includeTemplate('includes/TraderCombatKillMessage.inc.php',array('KillResults'=>$WeaponResults['KillResults'],'TargetPlayer'=>$TargetPlayer)); |
|
| 59 | + $this->includeTemplate('includes/TraderCombatKillMessage.inc.php', array('KillResults'=>$WeaponResults['KillResults'], 'TargetPlayer'=>$TargetPlayer)); |
|
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | if (isset($PortCombatResults['Drones'])) { |
| 64 | - $Drones =& $PortCombatResults['Drones']; |
|
| 65 | - $ActualDamage =& $Drones['ActualDamage']; |
|
| 66 | - $WeaponDamage =& $Drones['WeaponDamage']; |
|
| 67 | - $TargetPlayer =& $Drones['TargetPlayer']; |
|
| 64 | + $Drones = & $PortCombatResults['Drones']; |
|
| 65 | + $ActualDamage = & $Drones['ActualDamage']; |
|
| 66 | + $WeaponDamage = & $Drones['WeaponDamage']; |
|
| 67 | + $TargetPlayer = & $Drones['TargetPlayer']; |
|
| 68 | 68 | |
| 69 | 69 | echo $CombatPort->getDisplayName(); |
| 70 | 70 | if ($WeaponDamage['Launched'] == 0) { |
| 71 | 71 | ?> fails to launch it's combat drones<?php |
| 72 | 72 | } else { |
| 73 | - ?> launches <span class="cds"><?php echo $WeaponDamage['Launched'] ?></span> combat drones at <?php if ($ActualDamage['TargetAlreadyDead']){ ?>the debris that was once <?php } echo $TargetPlayer->getDisplayName(); |
|
| 73 | + ?> launches <span class="cds"><?php echo $WeaponDamage['Launched'] ?></span> combat drones at <?php if ($ActualDamage['TargetAlreadyDead']) { ?>the debris that was once <?php } echo $TargetPlayer->getDisplayName(); |
|
| 74 | 74 | if (!$ActualDamage['TargetAlreadyDead']) { |
| 75 | 75 | if ($ActualDamage['TotalDamage'] == 0) { |
| 76 | 76 | if ($WeaponDamage['Shield'] > 0) { |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | foreach ($TraderTeamCombatResults['Traders'] as $AccountID => $TraderResults) { |
| 3 | - $ShootingPlayer =& $TraderResults['Player']; |
|
| 4 | - $TotalDamage =& $TraderResults['TotalDamage']; |
|
| 3 | + $ShootingPlayer = & $TraderResults['Player']; |
|
| 4 | + $TotalDamage = & $TraderResults['TotalDamage']; |
|
| 5 | 5 | if ($MinimalDisplay && !$ThisPlayer->equals($ShootingPlayer)) { |
| 6 | 6 | echo $ShootingPlayer->getDisplayName(); |
| 7 | 7 | if ($TotalDamage > 0) { |
@@ -17,13 +17,13 @@ discard block |
||
| 17 | 17 | } else { |
| 18 | 18 | if (isset($TraderResults['Weapons']) && is_array($TraderResults['Weapons'])) { |
| 19 | 19 | foreach ($TraderResults['Weapons'] as $WeaponResults) { |
| 20 | - $ShootingWeapon =& $WeaponResults['Weapon']; |
|
| 21 | - $ShotHit =& $WeaponResults['Hit']; |
|
| 22 | - $ActualDamage =& $WeaponResults['ActualDamage']; |
|
| 23 | - $WeaponDamage =& $WeaponResults['WeaponDamage']; |
|
| 24 | - $TargetPort =& $WeaponResults['TargetPort']; |
|
| 20 | + $ShootingWeapon = & $WeaponResults['Weapon']; |
|
| 21 | + $ShotHit = & $WeaponResults['Hit']; |
|
| 22 | + $ActualDamage = & $WeaponResults['ActualDamage']; |
|
| 23 | + $WeaponDamage = & $WeaponResults['WeaponDamage']; |
|
| 24 | + $TargetPort = & $WeaponResults['TargetPort']; |
|
| 25 | 25 | |
| 26 | - echo $ShootingPlayer->getDisplayName() ?> fires their <?php echo $ShootingWeapon->getName() ?> at <?php if ($ShotHit && $ActualDamage['TargetAlreadyDead']){ ?>the remnants of <?php } echo $TargetPort->getDisplayName(); |
|
| 26 | + echo $ShootingPlayer->getDisplayName() ?> fires their <?php echo $ShootingWeapon->getName() ?> at <?php if ($ShotHit && $ActualDamage['TargetAlreadyDead']) { ?>the remnants of <?php } echo $TargetPort->getDisplayName(); |
|
| 27 | 27 | if (!$ShotHit || !$ActualDamage['TargetAlreadyDead']) { |
| 28 | 28 | if (!$ShotHit) { |
| 29 | 29 | ?> and misses every critical system<?php |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | } else { |
| 43 | 43 | ?> destroying <?php |
| 44 | 44 | $DamageTypes = 0; |
| 45 | - if ($ActualDamage['Shield'] > 0){ $DamageTypes = $DamageTypes+1; } |
|
| 46 | - if ($ActualDamage['NumCDs'] > 0){ $DamageTypes = $DamageTypes+1; } |
|
| 47 | - if ($ActualDamage['Armour'] > 0){ $DamageTypes = $DamageTypes+1; } |
|
| 45 | + if ($ActualDamage['Shield'] > 0) { $DamageTypes = $DamageTypes + 1; } |
|
| 46 | + if ($ActualDamage['NumCDs'] > 0) { $DamageTypes = $DamageTypes + 1; } |
|
| 47 | + if ($ActualDamage['Armour'] > 0) { $DamageTypes = $DamageTypes + 1; } |
|
| 48 | 48 | |
| 49 | 49 | if ($ActualDamage['Shield'] > 0) { |
| 50 | 50 | ?><span class="shields"><?php echo number_format($ActualDamage['Shield']) ?></span> shields<?php |
@@ -61,15 +61,15 @@ discard block |
||
| 61 | 61 | } ?>. |
| 62 | 62 | <br /><?php |
| 63 | 63 | if ($ShotHit && $ActualDamage['KillingShot']) { |
| 64 | - $this->includeTemplate('includes/PortKillMessage.inc.php',array('KillResults'=>$WeaponResults['KillResults'],'TargetPort'=>$TargetPort,'ShootingPlayer'=>$ShootingPlayer)); |
|
| 64 | + $this->includeTemplate('includes/PortKillMessage.inc.php', array('KillResults'=>$WeaponResults['KillResults'], 'TargetPort'=>$TargetPort, 'ShootingPlayer'=>$ShootingPlayer)); |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | if (isset($TraderResults['Drones'])) { |
| 69 | - $Drones =& $TraderResults['Drones']; |
|
| 70 | - $ActualDamage =& $Drones['ActualDamage']; |
|
| 71 | - $WeaponDamage =& $Drones['WeaponDamage']; |
|
| 72 | - $TargetPort =& $Drones['TargetPort']; |
|
| 69 | + $Drones = & $TraderResults['Drones']; |
|
| 70 | + $ActualDamage = & $Drones['ActualDamage']; |
|
| 71 | + $WeaponDamage = & $Drones['WeaponDamage']; |
|
| 72 | + $TargetPort = & $Drones['TargetPort']; |
|
| 73 | 73 | |
| 74 | 74 | echo $ShootingPlayer->getDisplayName(); |
| 75 | 75 | if ($WeaponDamage['Launched'] == 0) { |