}
            if ($k) {
                $ck = floor($aktplanet['k'] / $k);
            } else {
                $ck = 1000;
            }
            if ($d) {
                $cd = floor($aktplanet['d'] / $d);
            } else {
                $cd = 1000;
            }
            $v = min($cm, min($ck, $cd));
            if ($value > $v) {
                $value = $v;
            }
            AddShipyard($GlobalUser['player_id'], $aktplanet['planet_id'], intval($gid), intval($value));
            $aktplanet = GetPlanet($GlobalUser['aktplanet']);
            // обновить состояние планеты.
        }
    }
}
// Обработка GET-запросов.
if (method() === "GET" && !$GlobalUser['vacation']) {
    if ($_GET['mode'] === "Forschung") {
        $result = GetResearchQueue($GlobalUser['player_id']);
        $resqueue = dbarray($result);
        if ($resqueue == null) {
            if (key_exists('bau', $_GET)) {
                StartResearch($GlobalUser['player_id'], $aktplanet['planet_id'], intval($_GET['bau']), $now);
            }
            $aktplanet = GetPlanet($GlobalUser['aktplanet']);
Example #2
0
function BotBuildFleet($obj_id, $n)
{
    global $db_prefix, $BotID, $BotNow, $GlobalUni;
    $user = LoadUser($BotID);
    $aktplanet = GetPlanet($user['aktplanet']);
    $text = AddShipyard($user['player_id'], $user['aktplanet'], $obj_id, $n, 0);
    if ($text === '') {
        $speed = $GlobalUni['speed'];
        $now = ShipyardLatestTime($aktplanet, $BotNow);
        $shipyard = $aktplanet["b21"];
        $nanits = $aktplanet["b15"];
        $seconds = ShipyardDuration($obj_id, $shipyard, $nanits, $speed);
        AddQueue($user['player_id'], "Shipyard", $aktplanet['planet_id'], $obj_id, $n, $now, $seconds);
        UpdatePlanetActivity($user['aktplanet'], $BotNow);
        return $seconds;
    } else {
        return 0;
    }
}