$defenders = array(); //built in players_init(); $players = players_init($attackers, $defenders); $weapons = build_weapons(players_build_hardware($players)); $fleets = build_fleets($players, $weapons, $attackers, $defenders); // Take off the 3 turns for attacking $player->take_turns(3); $player->update(); // Run the combat for ($i = 0; $i < 2; ++$i) { process_fleet($fleets[$i], $fleets[1 - $i], $players, $weapons); } // Build results and update $killed_ids = array(); $killer_ids = array(); $results = build_results($players, $fleets, $weapons, $killed_ids, $killer_ids); // TODO: Split this out into its own function if (count($killed_ids)) { // These will get used for each alliances' kill/death results $fleets[0] = $fleets[1] = array(0, 0); foreach ($killed_ids as $account_id) { $ships[] = $players[$account_id][SHIP_ID]; $hqs[] = $players[$account_id][RACE_ID]; if ($players[$account_id][ALLIANCE_ID] == $player->alliance_id) { ++$fleets[0][1]; ++$fleets[1][0]; } else { ++$fleets[1][1]; ++$fleets[0][0]; } }
} function build_results(&$header) { // Builds HTML table to display ALL headers; echo "<p><h3>Full header results</h3>"; echo "<table><tr><th>Name</th><th>Value</th>"; foreach ($header as $headerValue) { $headerSplit = explode(": ", $headerValue); echo "<tr><td>" . $headerSplit[0] . "</td>"; echo "<td>" . $headerSplit[1] . "</td></tr>"; } echo "</table>"; } get_results(); secure_header($header); build_results($header); ?> <p> <form action="headers.php" method="POST"> <input class="btn" type="submit" name="reset" value="reset"> </form> <?php } else { ?> <!-- This will display upon initial load or resetting page. --> <h2>Enter domain:</h2> <form action="headers.php" method="POST"> <input type="text" name="domain"> <input class="btn" type="submit" name="submit" value="submit"> </form> <?php