Exemplo n.º 1
0
function GetPlanet($planet_id)
{
    global $db_prefix;
    $query = "SELECT * FROM " . $db_prefix . "planets WHERE planet_id = '" . $planet_id . "' LIMIT 1";
    $result = dbquery($query);
    if (dbrows($result) == 0) {
        return NULL;
    }
    $planet = dbarray($result);
    $user = LoadUser($planet['owner_id']);
    $prem = PremiumStatus($user);
    if ($prem['engineer']) {
        $e_factor = 1.1;
    } else {
        $e_factor = 1.0;
    }
    $planet['mmax'] = store_capacity($planet['b22']);
    $planet['kmax'] = store_capacity($planet['b23']);
    $planet['dmax'] = store_capacity($planet['b24']);
    $planet['emax'] = prod_solar($planet['b4'], $planet['sprod']) * $e_factor + prod_fusion($planet['b12'], $user['r113'], $planet['fprod']) * $e_factor + prod_sat($planet['temp'] + 40) * $planet['f212'] * $planet['ssprod'] * $e_factor;
    $planet['econs'] = cons_metal($planet['b1']) * $planet['mprod'] + cons_crys($planet['b2']) * $planet['kprod'] + cons_deut($planet['b3']) * $planet['dprod'];
    $planet['e'] = floor($planet['emax'] - $planet['econs']);
    $planet['factor'] = 1;
    if ($planet['e'] < 0) {
        $planet['factor'] = max(0, 1 - abs($planet['e']) / $planet['econs']);
    }
    return $planet;
}
Exemplo n.º 2
0
         echo "<th> " . nicenum($cons) . "</th> ";
         echo "<th> " . rgnum($cons - $cons_now) . " </th> </tr> \n";
     }
     echo "</table></center></tr></th>";
 } else {
     if ($gid == 3) {
         echo "<tr><th><p><center><table border=1 ><tr><td class='c'>Уровень</td><td class='c'>Производство в час</td><td class='c'>Разница</td><td class='c'>Энергетический баланс</td><td class='c'>Разница</td> \n";
         $level = $aktplanet['b' . $gid] - 2;
         if ($level <= 0) {
             $level = 1;
         }
         $prod_now = prod_deut($aktplanet['b' . $gid], $aktplanet['temp'] + 40, 1);
         $cons_now = -cons_deut($aktplanet['b' . $gid]);
         for ($i = $level; $i < $level + 15; $i++) {
             $prod = prod_deut($i, $aktplanet['temp'] + 40, 1) * $speed;
             $cons = -cons_deut($i);
             if ($i == $aktplanet['b' . $gid]) {
                 echo "<tr> <th> <font color=#FF0000>{$i}</font></th> ";
             } else {
                 echo "<tr> <th> {$i}</th> ";
             }
             echo "<th> " . nicenum($prod) . "</th> ";
             echo "<th> " . rgnum($prod - $prod_now) . "</th> ";
             echo "<th> " . nicenum($cons) . "</th> ";
             echo "<th> " . rgnum($cons - $cons_now) . " </th> </tr> \n";
         }
         echo "</table></center></tr></th>";
     } else {
         if ($gid == 4) {
             echo "<tr><th><p><center><table border=1 ><tr><td class='c'>Уровень</td><td class='c'>Энергетический баланс</td><td class='c'>Разница</td>\n";
             $level = $aktplanet['b' . $gid] - 2;
Exemplo n.º 3
0
$unitab = LoadUniverse();
$speed = $unitab['speed'];
$planet = $aktplanet;
// Производство.
$m_hourly = prod_metal($planet['b1'], $planet['mprod']) * $planet['factor'] * $speed * $g_factor;
$k_hourly = prod_crys($planet['b2'], $planet['kprod']) * $planet['factor'] * $speed * $g_factor;
$d_hourly = prod_deut($planet['b3'], $planet['temp'] + 40, $planet['dprod']) * $planet['factor'] * $speed * $g_factor;
$s_prod = prod_solar($planet['b4'], $planet['sprod']) * $e_factor;
$f_prod = prod_fusion($planet['b12'], $GlobalUser['r113'], $planet['fprod']) * $e_factor;
$ss_prod = prod_sat($planet['temp'] + 40) * $planet['f212'] * $planet['ssprod'] * $e_factor;
// Потребление.
$m_cons = cons_metal($planet['b1']) * $planet['mprod'];
$m_cons0 = round($m_cons * $planet['factor']);
$k_cons = cons_crys($planet['b2']) * $planet['kprod'];
$k_cons0 = round($k_cons * $planet['factor']);
$d_cons = cons_deut($planet['b3']) * $planet['dprod'];
$d_cons0 = round($d_cons * $planet['factor']);
$f_cons = -cons_fusion($planet['b12'], $planet['fprod']) * $speed;
$m_total = $m_hourly + 20 * $speed;
$k_total = $k_hourly + 10 * $speed;
$d_total = $d_hourly + $f_cons;
echo "<center> \n";
echo "<br> \n";
echo "<br> \n";
echo va(loca("RES_FACTOR") . " ", round($aktplanet['factor'], 2)) . "\n";
// Не известно для чего, но это есть в оригинальной игре.
$count = 0;
$result = EnumPlanets();
$rows = dbrows($result);
while ($rows--) {
    $pl = dbarray($result);