Beispiel #1
0
         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 == 2) {
         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_crys($aktplanet['b' . $gid], 1);
         $cons_now = -cons_crys($aktplanet['b' . $gid]);
         for ($i = $level; $i < $level + 15; $i++) {
             $prod = prod_crys($i, 1) * $speed;
             $cons = -cons_crys($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 == 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";
?>
</th>
        </tr>

 
        <tr height="20">
            <th width="75"><?php 
echo loca("EMPIRE_K");
?>
</th>
 
<?php 
$total = 0;
$avg_prod = 0;
foreach ($plist as $i => $planet) {
    $res_hourly = prod_crys($planet['b2'], $planet['kprod']) * $planet['factor'] * $speed + 10 * $speed;
    $res = ceil($planet['k']);
    $total += $res;
    $avg_prod += $res_hourly;
    echo "             <th width=\"75\" >\n";
    echo "                <a href=\"index.php?page=resources&session={$session}&cp=" . $planet['planet_id'] . "&planettype={$planettype}\">\n";
    echo "                        " . nicenum($res) . " \n";
    echo "                </a>\n";
    echo "                / \n";
    echo "                " . nicenum($res_hourly) . "           </th>\n";
}
$avg_prod = $num ? ceil($avg_prod / $num) : 0;
?>

            <th width="75"><?php 
echo nicenum($total);
Beispiel #3
0
function ProdResources($planet, $time_from, $time_to)
{
    global $db_prefix, $GlobalUni;
    if (!($planet['type'] > 0 && $planet['type'] < 10000)) {
        return $planet;
    }
    // НЕ планета
    $user = LoadUser($planet['owner_id']);
    if ($user['player_id'] == 99999) {
        return $planet;
    }
    // технический аккаунт space
    $diff = $time_to - $time_from;
    $unitab = $GlobalUni;
    $speed = $unitab['speed'];
    $prem = PremiumStatus($user);
    if ($prem['geologist']) {
        $g_factor = 1.1;
    } else {
        $g_factor = 1.0;
    }
    $hourly = prod_metal($planet['b1'], $planet['mprod']) * $planet['factor'] * $speed * $g_factor + 20 * $speed;
    // Металл
    if ($planet['m'] < $planet['mmax']) {
        $planet['m'] += $hourly * $diff / 3600;
        if ($planet['m'] >= $planet['mmax']) {
            $planet['m'] = $planet['mmax'];
        }
    }
    $hourly = prod_crys($planet['b2'], $planet['kprod']) * $planet['factor'] * $speed * $g_factor + 10 * $speed;
    // Кристалл
    if ($planet['k'] < $planet['kmax']) {
        $planet['k'] += $hourly * $diff / 3600;
        if ($planet['k'] >= $planet['kmax']) {
            $planet['k'] = $planet['kmax'];
        }
    }
    $hourly = prod_deut($planet['b3'], $planet['temp'] + 40, $planet['dprod']) * $planet['factor'] * $speed * $g_factor;
    // Дейтерий
    $hourly -= cons_fusion($planet['b12'], $planet['fprod']) * $speed;
    // термояд
    if ($planet['d'] < $planet['dmax']) {
        $planet['d'] += $hourly * $diff / 3600;
        if ($planet['d'] >= $planet['dmax']) {
            $planet['d'] = $planet['dmax'];
        }
    }
    $planet_id = $planet['planet_id'];
    $query = "UPDATE " . $db_prefix . "planets SET m = '" . $planet['m'] . "', k = '" . $planet['k'] . "', d = '" . $planet['d'] . "', lastpeek = '" . $time_to . "' WHERE planet_id = {$planet_id}";
    dbquery($query);
    $planet['lastpeek'] = $time_to;
    return $planet;
}
Beispiel #4
0
    //return $num;
}
function rgnum($num)
{
    if ($num > 0) {
        return "<font color=\"#00ff00\">" . nicenum2($num) . "</font>";
    } else {
        return "<font color=\"#ff0000\">" . nicenum2($num) . "</font>";
    }
}
$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;