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; }
} echo "<th> " . nicenum($prod) . "</th> "; echo "<th> " . rgnum($prod - $prod_now) . "</th> </tr> \n"; } echo "</table></center></tr></th>"; } else { if ($gid == 12) { 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_fusion($aktplanet['b' . $gid], $GlobalUser['r113'], 1); $cons_now = -cons_fusion($aktplanet['b' . $gid], 1); for ($i = $level; $i < $level + 15; $i++) { $prod = prod_fusion($i, $GlobalUser['r113'], 1); $cons = -cons_fusion($i, 1) * $speed; 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> \n"; echo "<th> " . nicenum($cons) . "</th> "; echo "<th> " . rgnum($cons - $cons_now) . "</th> </tr> \n"; } echo "</table></center></tr></th>"; } else { if ($gid == 22 || $gid == 23 || $gid == 24) { echo "<tr><th><p><center><table border=1 ><tr><td class='c'>Уровень</td><td class='c'>Вместимость</td><td class='c'>Разница</td></tr>\n";
{ 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; echo "<center> \n"; echo "<br> \n"; echo "<br> \n";