Пример #1
0
    }
} else {
    echo 'You have no fleets capable of reaching this planet for an attack. Someone might control a system between your fleets and this one.';
}
echo '</div>';
/***********
PRINT SPY
************/
echo '<div id="1" style="display:none">';
//Populate dropdown for spies
$first = true;
$query = "SELECT id,name,loc FROM fleet{$sid} WHERE ownerid={$id} AND destination=0 AND loc!={$pid} AND probes=0";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)) {
    $num = getSpyNum($sid, $row[id]);
    $traveltime = travelTime($sid, $row[loc], $pid, $id);
    if ($num > 0 && $traveltime > 0) {
        if ($first) {
            $first = false;
            echo '<form name="fleetdd" action="./planetdetails.php?id=' . $pid . '" method="post">
      <table cellspacing=5 align=center>
        <tr>
          <td><select name="spy">';
        }
        echo '<option value="' . $row[id] . '">' . $row[name] . ' [' . $num . '] ' . ($traveltime - time()) . '</option>';
    }
}
if (!$first) {
    echo '</td><td><input type="submit" name="thesubmit" value="Send Probes"></td></td></table></form>';
} else {
    echo 'You have no fleets capable of sending a probe to this planet.';
Пример #2
0
  <u>Merchant Port</u> [Level ' . getPlanetStat(merchant, $sid, $pid) . ']
  <br>
  <br>';
//Check if they have a merchant port
if (getPlanetStat(merchant, $sid, $pid) == 0) {
    echo 'You do not have a merchant port.';
} else {
    //Display the planets they can get
    //Populate dropdown only if a fleet exists
    $query = "SELECT name,id FROM planets{$sid} WHERE ownerid={$id} AND id!={$pid}";
    $result = mysql_query($query);
    $num = mysql_num_rows($result);
    if ($num > 0) {
        $first = true;
        while ($row = mysql_fetch_array($result)) {
            $traveltime = travelTime($sid, $row[id], $pid, $id);
            if ($traveltime > 0) {
                if ($first) {
                    $first = false;
                    echo '<br><u><b>Hire Merchants</b></u><br><br>
        <table cellspacing=5>
        <td></td>
              <td><select name="mpid" id="mpid" onChange="getText()">
          <option>Select Planet</option>';
                }
                echo '<option value="' . $row[id] . '">' . $row[name] . ' [' . floor($traveltime - time()) . ']</option>';
            }
        }
        if (!$first) {
            //Print the resources avail on the planet
            echo '</tr></table><span id="xhrPR">
Пример #3
0
function moveFleet($fid, $sid, $pid, $did)
{
    //Pid is the planet coming from
    //Did is the destination id
    //Make sure the fleet has size
    if (fleetSize($sid, $fid) == 0) {
        return -1;
    }
    //Make sure the travel time is not -1, which means cant be visited
    $travelTime = travelTime($sid, $pid, $did, getFleetStat(ownerid, $sid, $fid));
    if ($travelTime < 1) {
        return -2;
    }
    //Set variables
    setFleetStat(destination, $did, $sid, $fid);
    setFleetStat(destinationtime, $travelTime, $sid, $fid);
    setFleetStat(inport, 0, $sid, $fid);
    //Check if they are going to be in combat, change combat id
    if (getPlanetStat(ownerid, $sid, $did) > 0 && getPlanetStat(ownerid, $sid, $did) != getFleetStat(ownerid, $sid, $fid)) {
        setFleetStat(combatid, 1, $sid, $fid);
    }
    return 1;
}