예제 #1
0
function FlightCons($fleet, $dist, $flighttime, $combustion, $impulse, $hyper, $speedfactor, $hours = 0)
{
    $cons = array('fleet' => 0, 'probes' => 0);
    foreach ($fleet as $id => $amount) {
        if ($amount > 0) {
            $spd = 35000 / ($flighttime * $speedfactor - 10) * sqrt($dist * 10 / FleetSpeed($id, $combustion, $impulse, $hyper));
            $basecons = $amount * FleetCons($id, $combustion, $impulse, $hyper);
            $consumption = $basecons * $dist / 35000 * ($spd / 10 + 1) * ($spd / 10 + 1);
            $consumption += $hours * $amount * FleetCons($id, $combustion, $impulse, $hyper) / 10;
            // затраты на удержание
            if ($id == 210) {
                $cons['probes'] += $consumption;
            } else {
                $cons['fleet'] += $consumption;
            }
        }
    }
    return $cons;
}
예제 #2
0
                                        $result = GetHoldingFleets($aktplanet['planet_id']);
                                        $rows = dbrows($result);
                                        $c = 1;
                                        while ($rows--) {
                                            $fleet_obj = dbarray($result);
                                            $queue = GetFleetQueue($fleet_obj['fleet_id']);
                                            $user = LoadUser($fleet_obj['owner_id']);
                                            $load = $queue['end'] - $now;
                                            echo "  <tr>\n";
                                            echo "    <th>Флот " . $user['oname'] . ":<br>";
                                            $cons = 0;
                                            foreach ($fmap as $i => $id) {
                                                $amount = $fleet_obj["ship" . $id];
                                                if ($amount > 0) {
                                                    echo loca("NAME_" . $id) . ":" . $amount . "<br>";
                                                    $cons += $amount * FleetCons($id, $user['r115'], $user['r117'], $user['r118']) / 10;
                                                }
                                            }
                                            echo "</th>\n";
                                            echo "    <th>\n";
                                            echo "      зарядка<br>{$load} сек<br>\n";
                                            echo "      <input tabindex='" . $c . "' type='text' name='c" . $c . "' size='5' maxlength='2' value='0' />ч<br>\n\n";
                                            echo "         Стоимость " . ceil($cons) . " / ч    </th>\n";
                                            echo "  </tr>\n";
                                            $c++;
                                        }
                                        ?>
  <tr><th colspan='2'><input type='submit' value='Запустить ракету со снабжением'></th>
</table>

</form>
예제 #3
0
   <tr height="20">

  <th>Тип корабля</th>
  <th>В наличии</th>
<!--    <th>Gesch.</th> -->
    <th>-</th>
    <th>-</th>
   </tr>

<?php 
foreach ($fleetmap as $i => $gid) {
    $amount = $aktplanet["f{$gid}"];
    if ($amount > 0) {
        $speed = FleetSpeed($gid, $GlobalUser['r115'], $GlobalUser['r117'], $GlobalUser['r118']);
        $cargo = FleetCargo($gid);
        $cons = FleetCons($gid, $GlobalUser['r115'], $GlobalUser['r117'], $GlobalUser['r118']);
        echo "   <tr height=\"20\">\n";
        echo "    <th><a title=\"Скорость: {$speed}\">" . loca("NAME_{$gid}") . "</a></th>\n";
        echo "    <th>{$amount}<input type=\"hidden\" name=\"maxship{$gid}\" value=\"{$amount}\"/></th>\n";
        echo "<!--    <th>{$speed} -->\n";
        echo "     <input type=\"hidden\" name=\"consumption{$gid}\" value=\"{$cons}\"/>\n";
        echo "     <input type=\"hidden\" name=\"speed{$gid}\" value=\"{$speed}\" /></th>\n";
        echo "     <input type=\"hidden\" name=\"capacity{$gid}\" value=\"{$cargo}\" /></th>\n";
        if ($speed) {
            echo "     <th><a href=\"javascript:maxShip('ship{$gid}');\" >все</a> </th>\n";
            echo "     <th><input name=\"ship{$gid}\" size=\"10\" value=\"0\" alt=\"" . loca("NAME_{$gid}") . " {$amount}\"/></th>\n";
        } else {
            echo "     <th></th>\n";
            echo "     <th></th>\n";
        }
        echo "   </tr>\n\n";