We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -3,11 +3,11 @@ discard block |
||
| 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 $user; // Discord user associated with the message |
|
| 8 | - public $account; // SmrAccount instance |
|
| 9 | - public $alliance; // SmrAlliance instance |
|
| 10 | - public $player; // SmrPlayer instance |
|
| 6 | + public $valid = false; // identifies if the message is linked to game data |
|
| 7 | + public $user; // Discord user associated with the message |
|
| 8 | + public $account; // SmrAccount instance |
|
| 9 | + public $alliance; // SmrAlliance instance |
|
| 10 | + public $player; // SmrPlayer instance |
|
| 11 | 11 | |
| 12 | 12 | // Takes the following arguments: |
| 13 | 13 | // channel = Discord\Parts\Channel\Channel instance |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | $this->player = SmrPlayer::getPlayer($this->account->getAccountID(), $this->alliance->getGameID(), true); |
| 62 | 62 | if ($this->player->getAllianceID() != $this->alliance->getAllianceID()) { |
| 63 | - $channel->sendMessage("Player `".$this->player->getPlayerName()."` is not a member of alliance `".$this->alliance->getAllianceName()."`"); |
|
| 63 | + $channel->sendMessage("Player `" . $this->player->getPlayerName() . "` is not a member of alliance `" . $this->alliance->getAllianceName() . "`"); |
|
| 64 | 64 | return; |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -79,8 +79,7 @@ |
||
| 79 | 79 | fclose($toEngine); |
| 80 | 80 | fclose($fromEngine); |
| 81 | 81 | proc_close($engine); |
| 82 | -} |
|
| 83 | -catch(Throwable $e) { |
|
| 82 | +} catch(Throwable $e) { |
|
| 84 | 83 | logException($e); |
| 85 | 84 | exit; |
| 86 | 85 | } |
@@ -10,22 +10,22 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | debug('Script started'); |
| 12 | 12 | define('SCRIPT_ID', $db->getInsertID()); |
| 13 | - $db->query('UPDATE npc_logs SET script_id='.SCRIPT_ID.' WHERE log_id='.SCRIPT_ID); |
|
| 13 | + $db->query('UPDATE npc_logs SET script_id=' . SCRIPT_ID . ' WHERE log_id=' . SCRIPT_ID); |
|
| 14 | 14 | |
| 15 | 15 | define('NPC_SCRIPT', true); |
| 16 | 16 | |
| 17 | 17 | $descriptorSpec = array( |
| 18 | - 0 => array("pipe", "r"), // stdin is a pipe that the child will read from |
|
| 18 | + 0 => array("pipe", "r"), // stdin is a pipe that the child will read from |
|
| 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; |
| 27 | 27 | stream_set_blocking($fromEngine, $block == true ? 1 : 0); |
| 28 | - while(($s = fgets($fromEngine)) !== false) { |
|
| 28 | + while (($s = fgets($fromEngine)) !== false) { |
|
| 29 | 29 | debug('<-- ' . trim($s)); |
| 30 | 30 | stream_set_blocking($fromEngine, 0); |
| 31 | 31 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | global $toEngine; |
| 35 | 35 | debug('--> ' . $s); |
| 36 | 36 | fputs($toEngine, $s . EOL); |
| 37 | - if($read === true) { |
|
| 37 | + if ($read === true) { |
|
| 38 | 38 | readFromEngine($block); |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | writeToEngine('isready'); |
| 46 | 46 | writeToEngine('ucinewgame', false); |
| 47 | 47 | |
| 48 | - while(true) { |
|
| 48 | + while (true) { |
|
| 49 | 49 | //Redefine MICRO_TIME and TIME, the rest of the game expects them to be the single point in time that the script is executing, with it being redefined for each page load - unfortunately NPCs are one consistent script so we have to do a hack and redefine it (or change every instance of the TIME constant). |
| 50 | 50 | runkit_constant_redefine('MICRO_TIME', microtime(true)); |
| 51 | 51 | runkit_constant_redefine('TIME', IFloor(MICRO_TIME)); |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | writeToEngine('position fen ' . $chessGame->getFENString(), false); |
| 56 | 56 | writeToEngine('go ' . ($chessGame->getCurrentTurnColour() == ChessGame::PLAYER_WHITE ? 'w' : 'b') . 'time ' . UCI_TIME_PER_MOVE_MS, true, false); |
| 57 | 57 | stream_set_blocking($fromEngine, 1); |
| 58 | - while(stripos($move = trim(fgets($fromEngine)), 'bestmove') !== 0) { |
|
| 58 | + while (stripos($move = trim(fgets($fromEngine)), 'bestmove') !== 0) { |
|
| 59 | 59 | debug('<-- ' . $move); |
| 60 | - if(stripos($move, 'Seg') === 0) { |
|
| 60 | + if (stripos($move, 'Seg') === 0) { |
|
| 61 | 61 | // Segfault |
| 62 | 62 | debug('UCI engine segfaulted?'); |
| 63 | 63 | exit; |
@@ -78,12 +78,12 @@ discard block |
||
| 78 | 78 | fclose($fromEngine); |
| 79 | 79 | proc_close($engine); |
| 80 | 80 | } |
| 81 | -catch(Throwable $e) { |
|
| 81 | +catch (Throwable $e) { |
|
| 82 | 82 | logException($e); |
| 83 | 83 | exit; |
| 84 | 84 | } |
| 85 | 85 | function debug($message, $debugObject = null) { |
| 86 | - global $account,$var,$db; |
|
| 87 | - echo date('Y-m-d H:i:s - ').$message.($debugObject!==null?EOL.var_export($debugObject,true):'').EOL; |
|
| 88 | - $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)).')'); |
|
| 86 | + global $account, $var, $db; |
|
| 87 | + echo date('Y-m-d H:i:s - ') . $message . ($debugObject !== null ?EOL.var_export($debugObject, true) : '') . EOL; |
|
| 88 | + $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)) . ')'); |
|
| 89 | 89 | } |
@@ -21,6 +21,6 @@ |
||
| 21 | 21 | //} |
| 22 | 22 | |
| 23 | 23 | $db->query('SELECT result,log_id FROM combat_logs'); |
| 24 | -while($db->nextRecord()) { |
|
| 25 | - $db2->query('UPDATE combat_logs SET result='.$db2->escapeBinary(gzcompress(serialize(unserialize(gzuncompress($db->getField('result')))))).' WHERE log_id='.$db->getField('log_id')); |
|
| 24 | +while ($db->nextRecord()) { |
|
| 25 | + $db2->query('UPDATE combat_logs SET result=' . $db2->escapeBinary(gzcompress(serialize(unserialize(gzuncompress($db->getField('result')))))) . ' WHERE log_id=' . $db->getField('log_id')); |
|
| 26 | 26 | } |
@@ -33,12 +33,24 @@ |
||
| 33 | 33 | $template->assign('HardwareHREF', SmrSession::getNewHREF($container)); |
| 34 | 34 | |
| 35 | 35 | $hardware = []; |
| 36 | -if ($ship->canHaveScanner()) $hardware[] = 'Scanner'; |
|
| 37 | -if ($ship->canHaveIllusion()) $hardware[] = 'Illusion Generator'; |
|
| 38 | -if ($ship->canHaveCloak()) $hardware[] = 'Cloaking Device'; |
|
| 39 | -if ($ship->canHaveJump()) $hardware[] = 'Jump Drive'; |
|
| 40 | -if ($ship->canHaveDCS()) $hardware[] = 'Drone Scrambler'; |
|
| 41 | -if (empty($hardware)) $hardware[] = 'none'; |
|
| 36 | +if ($ship->canHaveScanner()) { |
|
| 37 | + $hardware[] = 'Scanner'; |
|
| 38 | +} |
|
| 39 | +if ($ship->canHaveIllusion()) { |
|
| 40 | + $hardware[] = 'Illusion Generator'; |
|
| 41 | +} |
|
| 42 | +if ($ship->canHaveCloak()) { |
|
| 43 | + $hardware[] = 'Cloaking Device'; |
|
| 44 | +} |
|
| 45 | +if ($ship->canHaveJump()) { |
|
| 46 | + $hardware[] = 'Jump Drive'; |
|
| 47 | +} |
|
| 48 | +if ($ship->canHaveDCS()) { |
|
| 49 | + $hardware[] = 'Drone Scrambler'; |
|
| 50 | +} |
|
| 51 | +if (empty($hardware)) { |
|
| 52 | + $hardware[] = 'none'; |
|
| 53 | +} |
|
| 42 | 54 | $template->assign('Hardware', $hardware); |
| 43 | 55 | |
| 44 | 56 | $db->query('SELECT level_name,requirement FROM level WHERE requirement>' . $db->escapeNumber($player->getExperience()) . ' ORDER BY requirement ASC LIMIT 1'); |
@@ -17,21 +17,23 @@ discard block |
||
| 17 | 17 | // iterate over all forces in the target sector |
| 18 | 18 | foreach ($scanSector->getForces() as $scanSectorForces) { |
| 19 | 19 | // decide if it's a friendly or enemy stack |
| 20 | - if ($player->sameAlliance($scanSectorForces->getOwner())) |
|
| 21 | - $friendly_forces += $scanSectorForces->getMines() * 3 + $scanSectorForces->getCDs() * 2 + $scanSectorForces->getSDs(); |
|
| 22 | - else |
|
| 23 | - $enemy_forces += $scanSectorForces->getMines() * 3 + $scanSectorForces->getCDs() * 2 + $scanSectorForces->getSDs(); |
|
| 24 | -} |
|
| 20 | + if ($player->sameAlliance($scanSectorForces->getOwner())) { |
|
| 21 | + $friendly_forces += $scanSectorForces->getMines() * 3 + $scanSectorForces->getCDs() * 2 + $scanSectorForces->getSDs(); |
|
| 22 | + } else { |
|
| 23 | + $enemy_forces += $scanSectorForces->getMines() * 3 + $scanSectorForces->getCDs() * 2 + $scanSectorForces->getSDs(); |
|
| 24 | + } |
|
| 25 | + } |
|
| 25 | 26 | |
| 26 | 27 | foreach ($scanSector->getOtherTraders($player) as $scanSectorPlayer) { |
| 27 | 28 | $scanSectorShip = $scanSectorPlayer->getShip(); |
| 28 | 29 | |
| 29 | 30 | // he's a friend if he's in our alliance (and we are not in a 0 alliance |
| 30 | - if ($player->traderMAPAlliance($scanSectorPlayer)) |
|
| 31 | - $friendly_vessel += $scanSectorShip->getAttackRating(); |
|
| 32 | - else |
|
| 33 | - $enemy_vessel += $scanSectorShip->getDefenseRating() * 10; |
|
| 34 | -} |
|
| 31 | + if ($player->traderMAPAlliance($scanSectorPlayer)) { |
|
| 32 | + $friendly_vessel += $scanSectorShip->getAttackRating(); |
|
| 33 | + } else { |
|
| 34 | + $enemy_vessel += $scanSectorShip->getDefenseRating() * 10; |
|
| 35 | + } |
|
| 36 | + } |
|
| 35 | 37 | |
| 36 | 38 | $template->assign('FriendlyVessel', $friendly_vessel); |
| 37 | 39 | $template->assign('FriendlyForces', $friendly_forces); |
@@ -39,10 +41,11 @@ discard block |
||
| 39 | 41 | $template->assign('EnemyForces', $enemy_forces); |
| 40 | 42 | |
| 41 | 43 | // is it a warp or a normal move? |
| 42 | -if ($sector->getWarp() == $var['target_sector']) |
|
| 44 | +if ($sector->getWarp() == $var['target_sector']) { |
|
| 43 | 45 | $turns = TURNS_PER_WARP; |
| 44 | -else |
|
| 46 | +} else { |
|
| 45 | 47 | $turns = TURNS_PER_SECTOR; |
| 48 | +} |
|
| 46 | 49 | |
| 47 | 50 | $template->assign('ScanSector', $scanSector); |
| 48 | 51 | $template->assign('Turns', $turns); |
@@ -9,10 +9,11 @@ discard block |
||
| 9 | 9 | $realAttackers = array(); |
| 10 | 10 | $attackers = array(); |
| 11 | 11 | $i=1; |
| 12 | -if(isset($_POST['attackers'])) |
|
| 12 | +if(isset($_POST['attackers'])) { |
|
| 13 | 13 | foreach($_POST['attackers'] as $attackerName) { |
| 14 | 14 | if($attackerName=='none') |
| 15 | 15 | continue; |
| 16 | +} |
|
| 16 | 17 | if(isset($usedNames[$attackerName])) { |
| 17 | 18 | $duplicates = true; |
| 18 | 19 | continue; |
@@ -24,17 +25,19 @@ discard block |
||
| 24 | 25 | ++$i; |
| 25 | 26 | } |
| 26 | 27 | |
| 27 | -for(;$i<=10;++$i) |
|
| 28 | +for(;$i<=10;++$i) { |
|
| 28 | 29 | $attackers[$i] = null; |
| 30 | +} |
|
| 29 | 31 | $template->assign('Attackers',$attackers); |
| 30 | 32 | |
| 31 | 33 | $i=1; |
| 32 | 34 | $realDefenders = array(); |
| 33 | 35 | $defenders = array(); |
| 34 | -if(isset($_POST['defenders'])) |
|
| 36 | +if(isset($_POST['defenders'])) { |
|
| 35 | 37 | foreach($_POST['defenders'] as $defenderName) { |
| 36 | 38 | if($defenderName=='none') |
| 37 | 39 | continue; |
| 40 | +} |
|
| 38 | 41 | if(isset($usedNames[$defenderName])) { |
| 39 | 42 | $duplicates = true; |
| 40 | 43 | continue; |
@@ -46,8 +49,9 @@ discard block |
||
| 46 | 49 | ++$i; |
| 47 | 50 | } |
| 48 | 51 | |
| 49 | -for(;$i<=10;++$i) |
|
| 52 | +for(;$i<=10;++$i) { |
|
| 50 | 53 | $defenders[$i] = null; |
| 54 | +} |
|
| 51 | 55 | $template->assign('Defenders',$defenders); |
| 52 | 56 | |
| 53 | 57 | $template->assign('Duplicates',$duplicates); |
@@ -62,12 +66,14 @@ discard block |
||
| 62 | 66 | while(count($realAttackers)>0 && count($realDefenders)>0) { |
| 63 | 67 | runAnAttack($realAttackers,$realDefenders); |
| 64 | 68 | foreach($realAttackers as $key => &$teamPlayer) { |
| 65 | - if($teamPlayer->isDead()) |
|
| 66 | - unset($realAttackers[$key]); |
|
| 69 | + if($teamPlayer->isDead()) { |
|
| 70 | + unset($realAttackers[$key]); |
|
| 71 | + } |
|
| 67 | 72 | } unset($teamPlayer); |
| 68 | 73 | foreach($realDefenders as $key => &$teamPlayer) { |
| 69 | - if($teamPlayer->isDead()) |
|
| 70 | - unset($realDefenders[$key]); |
|
| 74 | + if($teamPlayer->isDead()) { |
|
| 75 | + unset($realDefenders[$key]); |
|
| 76 | + } |
|
| 71 | 77 | } unset($teamPlayer); |
| 72 | 78 | } |
| 73 | 79 | } |
@@ -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 | } |
@@ -2,8 +2,8 @@ |
||
| 2 | 2 | trait SmrMySqlSecrets { |
| 3 | 3 | protected static $databaseName = 'smr_live'; |
| 4 | 4 | private static $host = 'smr-mysql'; // must match MYSQL_HOST in .env |
| 5 | - private static $user = 'smr'; // must match MYSQL_USER in .env |
|
| 6 | - private static $password = 'smr'; // must match MYSQL_PASSWORD in .env |
|
| 5 | + private static $user = 'smr'; // must match MYSQL_USER in .env |
|
| 6 | + private static $password = 'smr'; // must match MYSQL_PASSWORD in .env |
|
| 7 | 7 | |
| 8 | 8 | // Set to null to use defaults |
| 9 | 9 | private static $port = null; |
@@ -44,7 +44,10 @@ |
||
| 44 | 44 | <td> |
| 45 | 45 | <select name="game_type" class="InputFields"><?php |
| 46 | 46 | foreach (SmrGame::GAME_TYPES as $GameTypeID => $GameType) { |
| 47 | - ?><option value="<?php echo $GameTypeID; ?>" <?php if ($GameType == $Game['gameType']) echo 'selected'; ?>><?php echo $GameType; ?></option><?php |
|
| 47 | + ?><option value="<?php echo $GameTypeID; ?>" <?php if ($GameType == $Game['gameType']) { |
|
| 48 | + echo 'selected'; |
|
| 49 | + } |
|
| 50 | + ?>><?php echo $GameType; ?></option><?php |
|
| 48 | 51 | } ?> |
| 49 | 52 | </select> |
| 50 | 53 | </td> |
@@ -1,10 +1,10 @@ |
||
| 1 | -<?php if(isset($Preview)) { ?><table class="standard"><tr><td><?php echo bbifyMessage($Preview); ?></td></tr></table><?php } ?> |
|
| 1 | +<?php if (isset($Preview)) { ?><table class="standard"><tr><td><?php echo bbifyMessage($Preview); ?></td></tr></table><?php } ?> |
|
| 2 | 2 | <form name="MessageSendForm" method="POST" action="<?php echo $MessageSendFormHref; ?>"> |
| 3 | 3 | <p> |
| 4 | 4 | <b>From: </b><?php echo $ThisPlayer->getDisplayName(); ?><br /> |
| 5 | - <b>To: </b><?php if(isset($Receiver) && is_object($Receiver)) { echo $Receiver->getDisplayName(); } else { echo $Receiver; } ?> |
|
| 5 | + <b>To: </b><?php if (isset($Receiver) && is_object($Receiver)) { echo $Receiver->getDisplayName(); } else { echo $Receiver; } ?> |
|
| 6 | 6 | </p> |
| 7 | - <textarea spellcheck="true" name="message" class="InputFields"><?php if(isset($Preview)) { echo $Preview; } ?></textarea><br /> |
|
| 7 | + <textarea spellcheck="true" name="message" class="InputFields"><?php if (isset($Preview)) { echo $Preview; } ?></textarea><br /> |
|
| 8 | 8 | <br /> |
| 9 | 9 | <input type="submit" name="action" value="Send message" class="InputFields" /> <input type="submit" name="action" value="Preview message" class="InputFields" /> |
| 10 | 10 | </form> |