Beispiel #1
0
function StartResearch($player_id, $planet_id, $id, $now)
{
    global $db_prefix, $GlobalUni;
    $uni = $GlobalUni;
    $planet = GetPlanet($planet_id);
    UserLog($player_id, "RESEARCH", "Запустить исследование " . loca("NAME_{$id}") . " на планете {$planet_id}");
    // Получить уровень исследования.
    $user = LoadUser($player_id);
    $level = $user['r' . $id] + 1;
    $prem = PremiumStatus($user);
    if ($prem['technocrat']) {
        $r_factor = 1.1;
    } else {
        $r_factor = 1.0;
    }
    // Проверить условия.
    $text = CanResearch($user, $planet, $id, $level);
    if ($text === "") {
        $speed = $uni['speed'];
        if ($now == 0) {
            $now = time();
        }
        $reslab = ResearchNetwork($planet['planet_id'], $id);
        $seconds = ResearchDuration($id, $level, $reslab, $speed * $r_factor);
        // Списать ресурсы.
        $res = ResearchPrice($id, $level);
        AdjustResources($res['m'], $res['k'], $res['d'], $planet_id, '-');
        //echo "--------------------- Запустить исследование $id на планете $planet_id игрока $player_id, уровень $level, продолжительность $seconds" ;
        AddQueue($player_id, "Research", $planet_id, $id, $level, $now, $seconds);
    }
}
     echo "<table width=\"530\">\n";
 } else {
     echo "<table width=\"468\">\n";
 }
 echo "          <tr> \n";
 echo "          <td class=l colspan=\"2\">Описание</td> \n";
 echo "          <td class=l><b>Кол-во</b></td> \n";
 echo "          </tr> \n\n";
 // Проверить есть ли лаборатория на планете.
 if ($aktplanet['b31']) {
     // Вывести список доступных исследований.
     foreach ($resmap as $i => $id) {
         if (!ResearchMeetRequirement($GlobalUser, $aktplanet, $id)) {
             continue;
         }
         $reslab = ResearchNetwork($aktplanet['planet_id'], $id);
         $level = $GlobalUser['r' . $id] + 1;
         echo "<tr>             ";
         if ($GlobalUser['useskin']) {
             echo "                <td class=l>\n";
             echo "    \t\t\t<a href=index.php?page=infos&session={$session}&gid={$id}>\n";
             echo "    \t\t\t<img border='0' src=\"" . UserSkin() . "gebaeude/{$id}.gif\" align='top' width='120' height='120'>\n";
             echo "    \t\t\t</a>\n";
             echo "    \t\t\t</td>\n";
             echo "        <td class=l >";
         } else {
             echo "        <td class=l colspan=2>";
         }
         echo "<a href=index.php?page=infos&session={$session}&gid={$id}>" . loca("NAME_{$id}") . "</a>";
         if ($GlobalUser['r' . $id]) {
             echo "</a> (уровень " . $GlobalUser['r' . $id];
Beispiel #3
0
function BotResearch($obj_id)
{
    global $BotID, $BotNow, $GlobalUni;
    $user = LoadUser($BotID);
    $aktplanet = GetPlanet($user['aktplanet']);
    $level = $aktplanet['r' . $obj_id] + 1;
    $text = StartResearch($user[player_id], $user[aktplanet], $obj_id, 0);
    if ($text === '') {
        $speed = $uni['speed'];
        if ($now == 0) {
            $now = time();
        }
        $reslab = ResearchNetwork($user['planet_id'], $obj_id);
        $prem = PremiumStatus($user);
        if ($prem['technocrat']) {
            $r_factor = 1.1;
        } else {
            $r_factor = 1.0;
        }
        $seconds = ResearchDuration($obj_id, $level, $reslab, $speed * $r_factor);
        UpdatePlanetActivity($user['aktplanet'], $BotNow);
        return $seconds;
    } else {
        return 0;
    }
}