function show() { global $USER, $PLANET, $LNG, $UNI, $CONF, $resource, $pricelist; $GetAll = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_planets` WHERE id_owner = " . $USER['id'] . " AND destruyed = '0' ORDER by ordernumber ASC;"); $number = 1; if ($GLOBALS['DATABASE']->numRows($GetAll) > 0) { while ($messageRow = $GLOBALS['DATABASE']->fetch_array($GetAll)) { if ($messageRow['b_building'] - TIMESTAMP > 0) { $Queue = unserialize($messageRow['b_building_id']); $buildInfo['buildings'] = array('id' => $Queue[0][0], 'level' => $Queue[0][1], 'timeleft' => $messageRow['b_building'] - TIMESTAMP, 'time' => $messageRow['b_building'], 'starttime' => pretty_time($messageRow['b_building'] - TIMESTAMP)); } else { $buildInfo['buildings'] = false; } /* As FR#206 (http://tracker.2moons.cc/view.php?id=206), i added the shipyard and research status here, but i add not them the template. */ if (!empty($messageRow['b_hangar_id'])) { $Queue = unserialize($messageRow['b_hangar_id']); //$time = BuildFunctions::getBuildingTime($USER, $messageRow['id'], $Queue[0][0]) * $Queue[0][1]; $time = BuildFunctions::getBuildingTime($USER, 1, $Queue[0][0]) * $Queue[0][1]; $buildInfo['fleet'] = array('id' => $Queue[0][0], 'level' => $Queue[0][1], 'timeleft' => $time - $messageRow['b_hangar'], 'time' => $time, 'starttime' => pretty_time($time - $messageRow['b_hangar'])); } else { $buildInfo['fleet'] = false; } if (!empty($messageRow['b_defense_id'])) { $Queue = unserialize($messageRow['b_defense_id']); //$time = BuildFunctions::getBuildingTime($USER, $messageRow['id'], $Queue[0][0]) * $Queue[0][1]; $time = BuildFunctions::getBuildingTime($USER, 1, $Queue[0][0]) * $Queue[0][1]; $buildInfo['defense'] = array('id' => $Queue[0][0], 'level' => $Queue[0][1], 'timeleft' => $time - $messageRow['b_defense'], 'time' => $time, 'starttime' => pretty_time($time - $messageRow['b_defense'])); } else { $buildInfo['defense'] = false; } if ($USER['b_tech'] - TIMESTAMP > 0) { $Queue = unserialize($USER['b_tech_queue']); $buildInfo['tech'] = array('id' => $Queue[0][0], 'level' => $Queue[0][1], 'timeleft' => $USER['b_tech'] - TIMESTAMP, 'time' => $USER['b_tech'], 'starttime' => pretty_time($USER['b_tech'] - TIMESTAMP)); } else { $buildInfo['tech'] = false; } $messageList[$messageRow['id']] = array('buildInfo' => $buildInfo, 'name' => $messageRow['name'], 'galaxy' => $messageRow['galaxy'], 'system' => $messageRow['system'], 'planet' => $messageRow['planet'], 'plid' => $messageRow['id'], 'gmetal' => pretty_number($messageRow['metal']), 'gcrystal' => pretty_number($messageRow['crystal']), 'gdeuterium' => pretty_number($messageRow['deuterium']), 'gelyrium' => pretty_number($messageRow['elyrium']), 'gmetalpircent' => round($messageRow['metal'] * 100 / $messageRow['metal_max']), 'gcrystalpircent' => round($messageRow['crystal'] * 100 / $messageRow['crystal_max']), 'gdeuteriumpircent' => round($messageRow['deuterium'] * 100 / $messageRow['deuterium_max']), 'gelyriumpircent' => round($messageRow['elyrium'] * 100 / $messageRow['elyrium_max']), 'energypircent' => round(abs($messageRow['energy'] * ($messageRow['energy'] - abs($messageRow['energy_used'])) / 2)), 'field_current' => $messageRow['field_current'], 'field_max' => $messageRow['field_max'], 'teleport_portal' => $messageRow['teleport_portal'], 'image' => $messageRow['image'], 'force_field_timer' => $messageRow['force_field_timer'], 'energy' => $messageRow['energy'], 'energy_used' => $messageRow['energy_used'], 'metal_mine_porcent' => $messageRow['metal_mine_porcent'] * 10, 'crystal_mine_porcent' => $messageRow['crystal_mine_porcent'] * 10, 'deuterium_sintetizer_porcent' => $messageRow['deuterium_sintetizer_porcent'] * 10, 'elyrium_mine_porcent' => $messageRow['elyrium_mine_porcent'] * 10, 'number' => $number++); } } $this->tplObj->assign_vars(array('messageList' => $messageList, 'timinger' => TIMESTAMP)); $this->display("page.gestion.default.tpl"); }
public function show() { global $USER, $PLANET, $LNG, $resource, $dpath, $reslist, $requeriments, $CONF; $fmenge = isset($_POST['fmenge']) ? $_POST['fmenge'] : array(); $action = HTTP::_GP('action', ''); $NotBuilding = true; if (!empty($PLANET['b_building_id'])) { $CurrentQueue = unserialize($PLANET['b_building_id']); foreach ($CurrentQueue as $ElementArray) { if ($ElementArray[0] == 21 || $ElementArray[0] == 15) { $NotBuilding = false; break; } } } $ElementQueue = unserialize($PLANET['b_hangar_id']); if (empty($ElementQueue)) { $Count = 0; } else { $Count = count($ElementQueue); } if ($USER['urlaubs_modus'] == 0) { if (!empty($fmenge) && $NotBuilding == true) { if (Config::get('max_elements_ships') != 0 && $Count >= Config::get('max_elements_ships')) { $this->printMessage(sprintf($LNG['bd_max_builds'], Config::get('max_elements_ships'))); exit; } $this->BuildAuftr($fmenge); } if ($action == "delete") { $this->CancelAuftr(); } } $elementInQueue = array(); $ElementQueue = unserialize($PLANET['b_hangar_id']); $Buildlist = array(); if (!empty($ElementQueue)) { $Shipyard = array(); $QueueTime = 0; foreach ($ElementQueue as $Element) { if (empty($Element)) { continue; } $elementInQueue[$Element[0]] = true; $ElementTime = BuildFunctions::getBuildingTime($USER, $PLANET, $Element[0]); $QueueTime += $ElementTime * $Element[1]; $Shipyard[] = array($LNG['tech'][$Element[0]], $Element[1], $ElementTime, $Element[0]); } $this->tplObj->loadscript('bcmath.js'); $this->tplObj->execscript('ShipyardInit();'); $Buildlist = array('Queue' => $Shipyard, 'b_hangar_id_plus' => $PLANET['b_hangar'], 'pretty_time_b_hangar' => pretty_time(max($QueueTime - $PLANET['b_hangar'], 0))); } $mode = HTTP::_GP('mode', 'fleet'); if ($mode != 'defense' && $PLANET['planet_type'] == 4) { $this->printMessage("You cant acces this page on a fortress"); } if ($mode == 'defense' && $CONF['fleetconf'] == 1 && $CONF['purchase_bonus_timer'] > TIMESTAMP) { $elementALL = array(401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 416, 417, 418, 419, 420, 421, 422, 502, 503); $elementIDs = array(407, 408, 409, 411, 502, 503); $elementIDd = array(401, 402, 403, 420); $elementIDa = array(405, 404, 406, 416, 417, 421); $elementIDq = array(418, 412, 410, 413, 419, 414, 422, 415); } elseif ($mode == 'defense') { $elementALL = array(401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 416, 417, 418, 419, 420, 421, 422, 502, 503); $elementIDs = array(407, 408, 409, 411, 502, 503); $elementIDd = array(401, 402, 403); $elementIDa = array(405, 404, 406, 416, 417); $elementIDq = array(418, 412, 410, 413, 419, 414, 415); } elseif ($mode == 'fleet' && $CONF['fleetconf'] == 1 && $CONF['purchase_bonus_timer'] > TIMESTAMP) { $elementALL = array(202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230); $elementIDs = array(208, 210, 220, 223); $elementIDd = array(212, 202, 203, 204, 205, 229); $elementIDa = array(209, 206, 207, 217, 215, 213, 211, 219, 224); $elementIDq = array(225, 226, 214, 216, 230, 227, 228, 222, 218, 221); } elseif ($mode == 'fleet') { $elementALL = array(202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230); $elementIDs = array(208, 210, 220, 223); $elementIDd = array(212, 202, 203, 204, 205); $elementIDa = array(209, 206, 207, 217, 215, 213, 211, 219); $elementIDq = array(225, 226, 214, 216, 227, 228, 222, 218, 221); } $Missiles = array(); $Domes = array(); $Orbits = array(); foreach ($reslist['missile'] as $elementID) { $Missiles[$elementID] = $PLANET[$resource[$elementID]]; } foreach ($reslist['defense'] as $elementID) { $Domes[$elementID] = $PLANET[$resource[$elementID]]; $Orbits[$elementID] = $PLANET[$resource[$elementID]]; } $MaxMissiles = BuildFunctions::getMaxConstructibleRockets($USER, $PLANET, $Missiles); $MaxDomes = BuildFunctions::getMaxConstructibleDomes($USER, $PLANET, $Domes); $MaxOrbits = BuildFunctions::getMaxConstructibleOrbits($USER, $PLANET, $Orbits); foreach ($elementALL as $Element) { $costRessources = BuildFunctions::getElementPrice($USER, $PLANET, $Element); $costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costRessources); $elementTime = BuildFunctions::getBuildingTime($USER, $PLANET, $Element, $costRessources); $buyable = BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costRessources); $maxBuildable = BuildFunctions::getMaxConstructibleElements($USER, $PLANET, $Element, $costRessources); if (isset($MaxMissiles[$Element])) { $maxBuildable = min($maxBuildable, $MaxMissiles[$Element]); } if (isset($MaxDomes[$Element])) { $maxBuildable = min($maxBuildable, $MaxDomes[$Element]); } if (isset($MaxOrbits[$Element])) { $maxBuildable = min($maxBuildable, $MaxOrbits[$Element]); } $AlreadyBuild = in_array($Element, $reslist['one']) && (isset($elementInQueue[$Element]) || $PLANET[$resource[$Element]] != 0); $elementListall[$Element] = array('id' => $Element, 'available' => $PLANET[$resource[$Element]], 'costRessources' => $costRessources, 'costOverflow' => $costOverflow, 'elementTime' => $elementTime, 'buyable' => $buyable, 'maxBuildable' => floattostring($maxBuildable), 'AlreadyBuild' => $AlreadyBuild, 'techacc' => BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element)); } foreach ($elementIDs as $Element) { $AllTech = array(); $GetAll = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_vars_requriements` WHERE elementID = " . $Element . " ;"); if ($GLOBALS['DATABASE']->numRows($GetAll) > 0) { while ($x = $GLOBALS['DATABASE']->fetch_array($GetAll)) { $AllTech[] = $x; } } $costRessources = BuildFunctions::getElementPrice($USER, $PLANET, $Element); $costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costRessources); $elementTime = BuildFunctions::getBuildingTime($USER, $PLANET, $Element, $costRessources); $buyable = BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costRessources); $maxBuildable = BuildFunctions::getMaxConstructibleElements($USER, $PLANET, $Element, $costRessources); if (isset($MaxMissiles[$Element])) { $maxBuildable = min($maxBuildable, $MaxMissiles[$Element]); } if (isset($MaxDomes[$Element])) { $maxBuildable = min($maxBuildable, $MaxDomes[$Element]); } if (isset($MaxOrbits[$Element])) { $maxBuildable = min($maxBuildable, $MaxOrbits[$Element]); } $AlreadyBuild = in_array($Element, $reslist['one']) && (isset($elementInQueue[$Element]) || $PLANET[$resource[$Element]] != 0); $elementList[$Element] = array('id' => $Element, 'available' => $PLANET[$resource[$Element]], 'costRessources' => $costRessources, 'costOverflow' => $costOverflow, 'elementTime' => $elementTime, 'buyable' => $buyable, 'maxBuildable' => floattostring($maxBuildable), 'AlreadyBuild' => $AlreadyBuild, 'AllTech' => $AllTech, 'techacc' => BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element)); } foreach ($elementIDq as $Element) { $AllTech = array(); $GetAll = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_vars_requriements` WHERE elementID = " . $Element . " ;"); if ($GLOBALS['DATABASE']->numRows($GetAll) > 0) { while ($x = $GLOBALS['DATABASE']->fetch_array($GetAll)) { $AllTech[] = $x; } } $costRessources = BuildFunctions::getElementPrice($USER, $PLANET, $Element); $costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costRessources); $elementTime = BuildFunctions::getBuildingTime($USER, $PLANET, $Element, $costRessources); $buyable = BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costRessources); $maxBuildable = BuildFunctions::getMaxConstructibleElements($USER, $PLANET, $Element, $costRessources); if (isset($MaxMissiles[$Element])) { $maxBuildable = min($maxBuildable, $MaxMissiles[$Element]); } if (isset($MaxDomes[$Element])) { $maxBuildable = min($maxBuildable, $MaxDomes[$Element]); } if (isset($MaxOrbits[$Element])) { $maxBuildable = min($maxBuildable, $MaxOrbits[$Element]); } $AlreadyBuild = in_array($Element, $reslist['one']) && (isset($elementInQueue[$Element]) || $PLANET[$resource[$Element]] != 0); $elementListq[$Element] = array('id' => $Element, 'available' => $PLANET[$resource[$Element]], 'costRessources' => $costRessources, 'costOverflow' => $costOverflow, 'elementTime' => $elementTime, 'buyable' => $buyable, 'maxBuildable' => floattostring($maxBuildable), 'AlreadyBuild' => $AlreadyBuild, 'AllTech' => $AllTech, 'techacc' => BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element)); } foreach ($elementIDa as $Element) { $AllTech = array(); $GetAll = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_vars_requriements` WHERE elementID = " . $Element . " ;"); if ($GLOBALS['DATABASE']->numRows($GetAll) > 0) { while ($x = $GLOBALS['DATABASE']->fetch_array($GetAll)) { $AllTech[] = $x; } } $costRessources = BuildFunctions::getElementPrice($USER, $PLANET, $Element); $costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costRessources); $elementTime = BuildFunctions::getBuildingTime($USER, $PLANET, $Element, $costRessources); $buyable = BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costRessources); $maxBuildable = BuildFunctions::getMaxConstructibleElements($USER, $PLANET, $Element, $costRessources); if (isset($MaxMissiles[$Element])) { $maxBuildable = min($maxBuildable, $MaxMissiles[$Element]); } if (isset($MaxDomes[$Element])) { $maxBuildable = min($maxBuildable, $MaxDomes[$Element]); } if (isset($MaxOrbits[$Element])) { $maxBuildable = min($maxBuildable, $MaxOrbits[$Element]); } $AlreadyBuild = in_array($Element, $reslist['one']) && (isset($elementInQueue[$Element]) || $PLANET[$resource[$Element]] != 0); $elementLista[$Element] = array('id' => $Element, 'available' => $PLANET[$resource[$Element]], 'costRessources' => $costRessources, 'costOverflow' => $costOverflow, 'elementTime' => $elementTime, 'buyable' => $buyable, 'maxBuildable' => floattostring($maxBuildable), 'AlreadyBuild' => $AlreadyBuild, 'AllTech' => $AllTech, 'techacc' => BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element)); } foreach ($elementIDd as $Element) { $AllTech = array(); $GetAll = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_vars_requriements` WHERE elementID = " . $Element . " ;"); if ($GLOBALS['DATABASE']->numRows($GetAll) > 0) { while ($x = $GLOBALS['DATABASE']->fetch_array($GetAll)) { $AllTech[] = $x; } } $costRessources = BuildFunctions::getElementPrice($USER, $PLANET, $Element); $costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costRessources); $elementTime = BuildFunctions::getBuildingTime($USER, $PLANET, $Element, $costRessources); $buyable = BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costRessources); $maxBuildable = BuildFunctions::getMaxConstructibleElements($USER, $PLANET, $Element, $costRessources); if (isset($MaxMissiles[$Element])) { $maxBuildable = min($maxBuildable, $MaxMissiles[$Element]); } if (isset($MaxDomes[$Element])) { $maxBuildable = min($maxBuildable, $MaxDomes[$Element]); } if (isset($MaxOrbits[$Element])) { $maxBuildable = min($maxBuildable, $MaxOrbits[$Element]); } $AlreadyBuild = in_array($Element, $reslist['one']) && (isset($elementInQueue[$Element]) || $PLANET[$resource[$Element]] != 0); $elementListd[$Element] = array('id' => $Element, 'available' => $PLANET[$resource[$Element]], 'costRessources' => $costRessources, 'costOverflow' => $costOverflow, 'elementTime' => $elementTime, 'buyable' => $buyable, 'maxBuildable' => floattostring($maxBuildable), 'AlreadyBuild' => $AlreadyBuild, 'AllTech' => $AllTech, 'techacc' => BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element)); } $manual_step_9 = 1; if ($USER['training'] == 0 && $USER['training_step'] == 9 && ($PLANET['misil_launcher'] < 25 || $PLANET['small_laser'] < 10)) { $manual_step_9 = 0; } $manual_step_10 = 1; if ($USER['training'] == 0 && $USER['training_step'] == 9 && $PLANET['misil_launcher'] >= 25 && $PLANET['small_laser'] >= 10) { $manual_step_10 = 0; $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET `training_step` = '11' WHERE `id` = " . $USER['id'] . ";"); $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET `experience_peace` = `experience_peace` + '650' WHERE `id` = '" . $USER['id'] . "';"); require_once 'includes/classes/class.FleetFunctions.php'; $rawfleetarray = array(204 => 8, 205 => 5, 206 => 3); $fleetRessource = array(901 => 0, 902 => 0, 903 => 0); FleetFunctions::sendFleet($rawfleetarray, '1', 1, 1, 1, 1, 1, 1, $PLANET['id_owner'], $PLANET['id'], $PLANET['galaxy'], $PLANET['system'], $PLANET['planet'], $PLANET['planet_type'], $fleetRessource, TIMESTAMP + 58, TIMESTAMP + 58, TIMESTAMP + 116, 0); } $manual_step_16 = 1; if ($USER['training'] == 0 && $USER['training_step'] == 16) { $manual_step_16 = 0; } if ($USER['training'] == 0 && $USER['training_step'] == 16 && $PLANET['recycler'] >= 5) { $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET `training_step` = '17' WHERE `id` = " . $USER['id'] . ";"); } $this->tplObj->loadscript('shipyard.js'); $this->tplObj->assign_vars(array('manual_step_16' => $manual_step_16, 'manual_step_10' => $manual_step_10, 'manual_step_9' => $manual_step_9, 'elementListall' => $elementListall, 'elementList' => $elementList, 'elementListd' => $elementListd, 'elementLista' => $elementLista, 'elementListq' => $elementListq, 'NotBuilding' => $NotBuilding, 'BuildList' => $Buildlist, 'maxlength' => strlen(Config::get('max_fleet_per_build')), 'mode' => $mode)); $this->display('page.shipyard.default.tpl'); }
function show() { global $CONF, $LNG, $PLANET, $USER, $resource, $UNI; if ($CONF['treasure_event'] < TIMESTAMP) { $cautare = $GLOBALS['DATABASE']->query("SELECT * FROM " . PLANETS . " p INNER JOIN " . USERS . " u ON p.id_owner = u.id WHERE p.universe = " . $UNI . " AND u.universe = " . $UNI . " AND u.onlinetime < " . (TIMESTAMP - 60 * 60 * 24 * 7) . " AND u.urlaubs_modus = 0 AND p.planet_type = 1 ORDER BY RAND() LIMIT 20;"); while ($xys = $GLOBALS['DATABASE']->fetch_array($cautare)) { $metal = 500000000000; $crystal = 400000000000; $deuterium = 300000000000; $GLOBALS['DATABASE']->query("UPDATE " . PLANETS . " SET `metal` = " . $metal . ", `crystal` = " . $crystal . ", `deuterium` = " . $deuterium . " WHERE id = " . $xys['id'] . ";"); } $totalPremiums = $GLOBALS['DATABASE']->query("SELECT DISTINCT `id` FROM " . USERS . " WHERE universe = " . $UNI . ";"); while ($xy = $GLOBALS['DATABASE']->fetch_array($totalPremiums)) { $message = "<span class='admin'>Treasure Hunt has started.<br>\n20 Inactive planets have big amounts of resources.<br>\nSearch for it, and steal it.<br>\nHappy Hunting !!!<br><br>\nLa chasse au tresor a commencer.<br>\n20 planets inactive sont rempli de resource.<br>\nChercher les, et vider les tous.<br>\nHappy Hunting !!!<br><br>\nSchatzJagd Hat Begonnen<br>\n20 inaktiver Planeten, ist voll mit vielen Rohstoffen<br>\nDu musst ihn finden, und hol dir die Rohstoffe<br>\nViel Spass beim Suchen !!! \n\t</span>"; SendSimpleMessage($xy['id'], 1, TIMESTAMP, 50, "Event System", "Treasure Event", $message); } $new_event = $CONF['treasure_event'] + 60 * 60 * 24; $GLOBALS['DATABASE']->query("UPDATE " . CONFIG . " SET treasure_event = '" . $new_event . "' where `uni` = '" . $UNI . "';"); } if ($CONF['treasure_event_1'] < TIMESTAMP) { $cautare = $GLOBALS['DATABASE']->query("SELECT * FROM " . PLANETS . " p INNER JOIN " . USERS . " u ON p.id_owner = u.id WHERE p.universe = " . $UNI . " AND u.universe = " . $UNI . " AND u.onlinetime < " . (TIMESTAMP - 60 * 60 * 24 * 7) . " AND u.urlaubs_modus = 0 AND p.planet_type = 1 AND p.universe = " . $UNI . " ORDER BY RAND() LIMIT 20;"); while ($xys = $GLOBALS['DATABASE']->fetch_array($cautare)) { $metal = 500000000000; $crystal = 400000000000; $deuterium = 300000000000; $GLOBALS['DATABASE']->query("UPDATE " . PLANETS . " SET `metal` = " . $metal . ", `crystal` = " . $crystal . ", `deuterium` = " . $deuterium . " WHERE id = " . $xys['id'] . ";"); } $totalPremiums = $GLOBALS['DATABASE']->query("SELECT DISTINCT `id` FROM " . USERS . " WHERE universe = " . $UNI . ";"); while ($xy = $GLOBALS['DATABASE']->fetch_array($totalPremiums)) { $message = "<span class='admin'>Treasure Hunt has started.<br>\n20 Inactive planets have big amounts of resources.<br>\nSearch for it, and steal it.<br>\nHappy Hunting !!!<br><br>\nLa chasse au tresor a commencer.<br>\n20 planets inactive sont rempli de resource.<br>\nChercher les, et vider les tous.<br>\nHappy Hunting !!!<br><br>\nSchatzJagd Hat Begonnen<br>\n20 inaktiver Planeten, ist voll mit vielen Rohstoffen<br>\nDu musst ihn finden, und hol dir die Rohstoffe<br>\nViel Spass beim Suchen !!! \n\t</span>"; SendSimpleMessage($xy['id'], 1, TIMESTAMP, 50, "Event System", "Treasure Event", $message); } $new_event = $CONF['treasure_event_1'] + 60 * 60 * 24; $GLOBALS['DATABASE']->query("UPDATE " . CONFIG . " SET treasure_event_1 = '" . $new_event . "' where `uni` = '" . $UNI . "';"); } if ($CONF['social_message'] < TIMESTAMP) { $query = $GLOBALS['DATABASE']->query("SELECT DISTINCT id FROM uni1_users;"); while ($x = $GLOBALS['DATABASE']->fetch_array($query)) { $msg = '<span class="admin">"Like" & "Share" for the chance to win 50k darkmatter: Every 30 combined likes & shares will equal to one winner: <a href="https://www.facebook.com/pages/Dark-Space-Empire/1490309864518434">Dark-Space: Empire ! Social Page</a><br><br> "Aime" & "Partage" pour avoir la chance de gagner 50K matiere noire: tout les 30ieme aime & partage combinee recevera 50k de matiere noir: <a href="https://www.facebook.com/pages/Dark-Space-Empire/1490309864518434">Dark-Space: Empire ! Social Page</a><br><br> "Like" & "Teilen" für die Chance, 50k darkmatter gewinnen: Alle 30 kombiniert Vorlieben und Aktien werden gleich einen Gewinner: <a href="https://www.facebook.com/pages/Dark-Space-Empire/1490309864518434">Dark-Space: Empire ! Sozial Seite</a></span>'; SendSimpleMessage($x['id'], '', TIMESTAMP, 50, 'System', 'Questions', $msg); } $GLOBALS['DATABASE']->query("UPDATE uni1_config SET social_message = '" . (TIMESTAMP + 2 * 24 * 60 * 60) . "';"); } //END GLOBAL MESSAGES //BEGIN ASTEROID EVENT if ($CONF['asteroid_event'] < TIMESTAMP) { $GLOBALS['DATABASE']->query("DELETE FROM " . PLANETS . " where `id_owner` = '" . Asteroid_Id . "' ;"); $galaxy = $this->randRange(1, 5, 5); foreach ($galaxy as $Element) { $system = $this->randRange(1, 200, 70); foreach ($system as $System_Element) { $planets = rand(1, 15); $cautare = $GLOBALS['DATABASE']->query("SELECT *FROM " . PLANETS . " where `galaxy` = '" . $Element . "' and `system` = '" . $System_Element . "' and `planet` = '" . $planets . "' AND `universe` = '" . $UNI . "';"); if ($GLOBALS['DATABASE']->numRows($cautare) == 0) { $metal_rand = Config::get('asteroid_metal'); $crystal_rand = Config::get('asteroid_crystal'); $deuterium_rand = Config::get('asteroid_deuterium'); $GLOBALS['DATABASE']->query("INSERT INTO " . PLANETS . "(`name`,`id_owner`,`universe`,`galaxy`,`system`,`planet`,`planet_type`,`image`,`diameter`,`metal`,`crystal`,`deuterium`,`last_update`) \n\tVALUES('Asteroid','" . Asteroid_Id . "','" . $UNI . "','" . $Element . "','" . $System_Element . "','" . $planets . "','1','asteroid','9800','" . $metal_rand . "','" . $crystal_rand . "','" . $deuterium_rand . "','" . TIMESTAMP . "');"); } } } $totalPremiums = $GLOBALS['DATABASE']->query("SELECT DISTINCT `id` FROM " . USERS . ";"); while ($xy = $GLOBALS['DATABASE']->fetch_array($totalPremiums)) { $message = '<span class="admin">Asteroid Event started<br> Every asteroid that you harvest will bring you resource. <a href="http://forum.dark-space.org/index.php?/topic/3-asteroid-event">more details</a><br><br> Evenement asteroid a commencer<br> Chaque asteroid que tu harvest te raportera des resource. <a href="http://forum.dark-space.org/index.php?/topic/3-asteroid-event">plus de details</a><br><br> Asteroid Ereignis begann <br> Jeder Asteroiden, die Sie ernten werden Sie Ressource bringen. <a href="http://forum.dark-space.org/index.php?/topic/3-asteroid-event">weitere Informationen</a> </span>'; SendSimpleMessage($xy['id'], 1, TIMESTAMP, 50, "Event System", "Event Info", $message); } $newevkaka = $CONF['asteroid_event'] + 60 * 60 * 24; $GLOBALS['DATABASE']->query("UPDATE " . CONFIG . " SET asteroid_event = '" . $newevkaka . "' where `uni` = '" . $UNI . "';"); } //END ASTEROID EVENT //BEGIN ASTEROID EVENT if ($CONF['asteroid_event_1'] < TIMESTAMP) { $GLOBALS['DATABASE']->query("DELETE FROM " . PLANETS . " where `id_owner` = '" . Asteroid_Id . "' ;"); $galaxy = $this->randRange(1, 5, 5); foreach ($galaxy as $Element) { $system = $this->randRange(1, 200, 70); foreach ($system as $System_Element) { $planets = rand(1, 15); $cautare = $GLOBALS['DATABASE']->query("SELECT *FROM " . PLANETS . " where `galaxy` = '" . $Element . "' and `system` = '" . $System_Element . "' and `planet` = '" . $planets . "' AND `universe` = '" . $UNI . "';"); if ($GLOBALS['DATABASE']->numRows($cautare) == 0) { $metal_rand = Config::get('asteroid_metal'); $crystal_rand = Config::get('asteroid_crystal'); $deuterium_rand = Config::get('asteroid_deuterium'); $GLOBALS['DATABASE']->query("INSERT INTO " . PLANETS . "(`name`,`id_owner`,`universe`,`galaxy`,`system`,`planet`,`planet_type`,`image`,`diameter`,`metal`,`crystal`,`deuterium`,`last_update`) \n\tVALUES('Asteroid','" . Asteroid_Id . "','" . $UNI . "','" . $Element . "','" . $System_Element . "','" . $planets . "','1','asteroid','9800','" . $metal_rand . "','" . $crystal_rand . "','" . $deuterium_rand . "','" . TIMESTAMP . "');"); } } } $totalPremiums = $GLOBALS['DATABASE']->query("SELECT DISTINCT `id` FROM " . USERS . ";"); while ($xy = $GLOBALS['DATABASE']->fetch_array($totalPremiums)) { $message = '<span class="admin">Asteroid Event started<br> Every asteroid that you harvest will bring you resource. <a href="http://forum.dark-space.org/index.php?/topic/3-asteroid-event">more details</a><br><br> Evenement asteroid a commencer<br> Chaque asteroid que tu harvest te raportera des resource. <a href="http://forum.dark-space.org/index.php?/topic/3-asteroid-event">plus de details</a><br><br> Asteroid Ereignis begann <br> Jeder Asteroiden, die Sie ernten werden Sie Ressource bringen. <a href="http://forum.dark-space.org/index.php?/topic/3-asteroid-event">weitere Informationen</a> </span>'; SendSimpleMessage($xy['id'], 1, TIMESTAMP, 50, "Event System", "Event Info", $message); } $newevkaka = $CONF['asteroid_event_1'] + 60 * 60 * 24; $GLOBALS['DATABASE']->query("UPDATE " . CONFIG . " SET asteroid_event_1 = '" . $newevkaka . "' where `uni` = '" . $UNI . "';"); } //END ASTEROID EVENT /* //BEGIN FORTRESS EVENT if($CONF['fortress_event'] < TIMESTAMP){ $GLOBALS['DATABASE']->query("DELETE FROM ".PLANETS." where `planet_type` = '4' ;"); $galaxy = $this->randRange(1,5,5); foreach($galaxy as $Element){ $system = $this->randRange(1,200,15); foreach($system as $System_Element){ $planets = rand(1,15); $timerforall = TIMESTAMP + 60*60*6; $cautare = $GLOBALS['DATABASE']->query("SELECT *FROM ".PLANETS." where `galaxy` = '".$Element."' and `system` = '".$System_Element."' and `planet` = '".$planets."' AND `universe` = '".$UNI."';"); if($GLOBALS['DATABASE']->numRows($cautare)==0){ $metal_rand = Config::get('asteroid_metal'); $crystal_rand = Config::get('asteroid_crystal'); $deuterium_rand= Config::get('asteroid_deuterium'); $max_field= mt_rand(69,176); $GLOBALS['DATABASE']->query("INSERT INTO ".PLANETS."(`name`,`id_owner`,`universe`,`galaxy`,`system`,`planet`,`planet_type`,`image`,`diameter`,`field_current`,`field_max`,`metal`,`crystal`,`deuterium`,`last_update`,`capture_not`) VALUES('Fortress Planet','".Fortress_Id."','".$UNI."','".$Element."','".$System_Element."','".$planets."','4','fortress','9800','0','".$max_field."','".$metal_rand."','".$crystal_rand."','".$deuterium_rand."','".TIMESTAMP."','".$timerforall."');"); } } } $totalPremiums = $GLOBALS['DATABASE']->query("SELECT DISTINCT `id` FROM ".USERS.";"); while($xy = $GLOBALS['DATABASE']->fetch_array($totalPremiums)){ $message = "<span class='admin'>Fortress Event started<br> Capture your fortress and take advantage of the profits they offer you !<br><br> Evenement Fortress a commencer<br> Capturez votre forteresse et profiter des multiple avantage qu\'elles peuvent vous offrir ! </span>"; SendSimpleMessage($xy['id'], 1, TIMESTAMP, 50, "Event System", "Event Info", $message); } $newevkaka = $timerforall + 10; $GLOBALS['DATABASE']->query("UPDATE ".CONFIG." SET fortress_event = '".$newevkaka."' where `uni` = '".$UNI."';"); } //END FORTRESS EVENT */ //if($CONF['end_game'] < TIMESTAMP){ //$GLOBALS['DATABASE']->query("UPDATE uni1_config SET game_disable = '0', close_reason = 'The first season of the game cames to hes end. the entire game will be reseted today at 20h' WHERE uni = ".$UNI.";"); //} if ($CONF['question_message'] < TIMESTAMP) { $query = $GLOBALS['DATABASE']->query("SELECT DISTINCT id FROM uni1_users WHERE universe = " . $UNI . ";"); while ($x = $GLOBALS['DATABASE']->fetch_array($query)) { $msg = '<span class="admin">If you have questions about the game: <a href="?page=ticket">Write them here</a><br> Si vous avez dues question sur le jeu: <a href="?page=ticket">Posez les ici</a><br> Falls du fragen über das Spiel hast: <a href="?page=ticket">Schreibe sie hier</a></span>'; SendSimpleMessage($x['id'], '', TIMESTAMP, 50, 'System', 'Questions', $msg); } $GLOBALS['DATABASE']->query("UPDATE uni1_config SET question_message = '" . (TIMESTAMP + 3 * 24 * 60 * 60) . "' WHERE uni = " . $UNI . ";"); } if ($CONF['referal_message'] < TIMESTAMP) { $query = $GLOBALS['DATABASE']->query("SELECT DISTINCT id FROM uni1_users WHERE universe = " . $UNI . ";"); while ($x = $GLOBALS['DATABASE']->fetch_array($query)) { $msg = '<span class="admin"> Invite new players with your referral link and get for every new player 5,000,000 Dark Matter and 10.000 Antimatter: <a href="?page=Refystem">Referal System</a><br> Lade neue Spieler mit deinem Referral Link ein und bekomme 5.000.000 Dunkle Materie und 10.000 Anti Materie: <a href="?page=Refystem">Referal System</a></span>'; SendSimpleMessage($x['id'], '', TIMESTAMP, 50, 'System', 'Referal', $msg); } $GLOBALS['DATABASE']->query("UPDATE uni1_config SET referal_message = '" . (TIMESTAMP + 7 * 24 * 60 * 60) . "' WHERE uni = " . $UNI . ";"); } if ($CONF['fleet_event_active_1'] < TIMESTAMP) { $totalPremiums = $GLOBALS['DATABASE']->query("SELECT DISTINCT `id` FROM " . USERS . " where `universe` = '" . $UNI . "';"); while ($x = $GLOBALS['DATABASE']->fetch_array($totalPremiums)) { $message = '<span class="admin">Friendly fleets landed on all your planets<br> Des vaisseaux allies ont atteris sur toutes vos planetes<br> Freundliche Flotten landen auf deinen Planeten</span>'; SendSimpleMessage($x['id'], 1, TIMESTAMP, 50, "Event System", "Event Info", $message); } $GLOBALS['DATABASE']->query("UPDATE " . PLANETS . " p INNER JOIN " . USERS . " u ON p.id_owner = u.id SET \n `light_hunter` = `light_hunter` + 500000000,\n `bs_class_oneil` = `bs_class_oneil` + 20000,\n\t\t`frigate` = `frigate` + 50000\n WHERE p.universe = '" . $UNI . "' AND u.urlaubs_modus = 0 AND p.planet_type = 1 AND u.onlinetime > " . (TIMESTAMP - 60 * 60 * 24 * 7) . ";"); $newevent3 = $CONF['fleet_event_active_1'] + 2 * 60 * 60 * 24; $GLOBALS['DATABASE']->query("UPDATE " . CONFIG . " SET fleet_event_active_1 = '" . $newevent3 . "' where `uni` = '" . $UNI . "';"); } if ($CONF['fleet_event_active_2'] < TIMESTAMP) { $totalPremiums = $GLOBALS['DATABASE']->query("SELECT DISTINCT `id` FROM " . USERS . " where `universe` = '" . $UNI . "';"); while ($xy = $GLOBALS['DATABASE']->fetch_array($totalPremiums)) { $message = '<span class="admin">Friendly fleets landed on your home planet<br> Des vaisseaux allies ont atteris sur votre planete mere<br> Freundliche Flotten landen auf deinen Planeten</span> '; SendSimpleMessage($xy['id'], 1, TIMESTAMP, 50, "Event System", "Event Info", $message); } $totalPremiums1 = $GLOBALS['DATABASE']->query("SELECT DISTINCT `id_planet` FROM " . USERS . " where `universe` = '" . $UNI . "';"); while ($omt = $GLOBALS['DATABASE']->fetch_array($totalPremiums1)) { $GLOBALS['DATABASE']->query("UPDATE " . PLANETS . " p INNER JOIN " . USERS . " u ON p.id_owner = u.id SET \n `light_hunter` = `light_hunter` + 500000000,\n `bs_class_oneil` = `bs_class_oneil` + 20000,\n\t\t`frigate` = `frigate` + 50000\n WHERE p.universe = '" . $UNI . "' AND p.id = " . $omt['id_planet'] . " AND u.urlaubs_modus = 0 AND p.planet_type = 1 AND u.onlinetime > " . (TIMESTAMP - 60 * 60 * 24 * 7) . ";"); $newevent2 = $CONF['fleet_event_active_2'] + 2 * 60 * 60 * 24; $GLOBALS['DATABASE']->query("UPDATE " . CONFIG . " SET fleet_event_active_2 = '" . $newevent2 . "' where `uni` = '" . $UNI . "';"); } } if ($CONF['fleet_event_inactive_1'] < TIMESTAMP) { $totalPremiums = $GLOBALS['DATABASE']->query("SELECT DISTINCT `id` FROM " . USERS . " where `universe` = '" . $UNI . "';"); while ($xy = $GLOBALS['DATABASE']->fetch_array($totalPremiums)) { $message = '<span class="admin">All inactive planets are full of resources and fleets<br> All inactive moons are full of resources<br> Toutes les planetes inactive sont remplis de vaisseaux et de resources<br> Toutes les lunes inactives sont remplis de resources<br> Alle inaktiven Planeten sind voll mit Resourcen und Flotten<br> Alle inaktiven Monde sind voll mit Resourcen</span>'; SendSimpleMessage($xy['id'], 1, TIMESTAMP, 50, "Event System", "Event Info", $message); } $newevent = $CONF['fleet_event_inactive_1'] + 60 * 60 * 24; $GLOBALS['DATABASE']->query("UPDATE " . CONFIG . " SET fleet_event_inactive_1 = '" . $newevent . "' where `uni` = '" . $UNI . "';"); } if ($CONF['fleet_event_inactive_2'] < TIMESTAMP) { $totalPremiums = $GLOBALS['DATABASE']->query("SELECT DISTINCT `id` FROM " . USERS . " where `universe` = '" . $UNI . "';"); while ($xy = $GLOBALS['DATABASE']->fetch_array($totalPremiums)) { $message = '<span class="admin">All inactive planets are full of resources and fleets<br> All inactive moons are full of resources<br> Toutes les planetes inactive sont remplis de vaisseaux et de resources<br> Toutes les lunes inactives sont remplis de resources<br> Alle inaktiven Planeten sind voll mit Resourcen und Flotten<br> Alle inaktiven Monde sind voll mit Resourcen</span>'; SendSimpleMessage($xy['id'], 1, TIMESTAMP, 50, "Event System", "Event Info", $message); } $newevent = $CONF['fleet_event_inactive_2'] + 60 * 60 * 24; $GLOBALS['DATABASE']->query("UPDATE " . CONFIG . " SET fleet_event_inactive_2 = '" . $newevent . "' where `uni` = '" . $UNI . "';"); } if ($CONF['fleet_event_inactive_3'] < TIMESTAMP) { $totalPremiums = $GLOBALS['DATABASE']->query("SELECT DISTINCT `id` FROM " . USERS . " where `universe` = '" . $UNI . "';"); while ($xy = $GLOBALS['DATABASE']->fetch_array($totalPremiums)) { $message = '<span class="admin">All inactive planets are full of resources and fleets<br> All inactive moons are full of resources<br> Toutes les planetes inactive sont remplis de vaisseaux et de resources<br> Toutes les lunes inactives sont remplis de resources<br> Alle inaktiven Planeten sind voll mit Resourcen und Flotten<br> Alle inaktiven Monde sind voll mit Resourcen</span>'; SendSimpleMessage($xy['id'], 1, TIMESTAMP, 50, "Event System", "Event Info", $message); } $newevent = $CONF['fleet_event_inactive_3'] + 60 * 60 * 24; $GLOBALS['DATABASE']->query("UPDATE " . CONFIG . " SET fleet_event_inactive_3 = '" . $newevent . "' where `uni` = '" . $UNI . "';"); } $AdminsOnline = array(); $chatOnline = array(); $AllPlanets = array(); $Moon = array(); $RefLinks = array(); $Buildtime = 0; foreach ($USER['PLANETS'] as $ID => $CPLANET) { if ($ID == $PLANET['id'] || $CPLANET['planet_type'] == 3) { continue; } if (!empty($CPLANET['b_building']) && $CPLANET['b_building'] > TIMESTAMP) { $Queue = unserialize($CPLANET['b_building_id']); $BuildPlanet = $LNG['tech'][$Queue[0][0]] . " (" . $Queue[0][1] . ")<br><span style=\"color:#7F7F7F;\">(" . pretty_time($Queue[0][3] - TIMESTAMP) . ")</span>"; } else { $BuildPlanet = $LNG['ov_free']; } $AllPlanets[] = array('id' => $CPLANET['id'], 'name' => $CPLANET['name'], 'image' => $CPLANET['image'], 'build' => $BuildPlanet); } if ($PLANET['id_luna'] != 0) { $Moon = $GLOBALS['DATABASE']->getFirstRow("SELECT id, name FROM " . PLANETS . " WHERE id = '" . $PLANET['id_luna'] . "';"); } if ($PLANET['b_building'] - TIMESTAMP > 0) { $Queue = unserialize($PLANET['b_building_id']); $buildInfo['buildings'] = array('id' => $Queue[0][0], 'level' => $Queue[0][1], 'timeleft' => $PLANET['b_building'] - TIMESTAMP, 'time' => $PLANET['b_building'], 'starttime' => pretty_time($PLANET['b_building'] - TIMESTAMP)); } else { $buildInfo['buildings'] = false; } /* As FR#206 (http://tracker.2moons.cc/view.php?id=206), i added the shipyard and research status here, but i add not them the template. */ if (!empty($PLANET['b_hangar_id'])) { $Queue = unserialize($PLANET['b_hangar_id']); $time = BuildFunctions::getBuildingTime($USER, $PLANET, $Queue[0][0]) * $Queue[0][1]; $buildInfo['fleet'] = array('id' => $Queue[0][0], 'level' => $Queue[0][1], 'timeleft' => $time - $PLANET['b_hangar'], 'time' => $time, 'starttime' => pretty_time($time - $PLANET['b_hangar'])); } else { $buildInfo['fleet'] = false; } if ($USER['b_tech'] - TIMESTAMP > 0) { $Queue = unserialize($USER['b_tech_queue']); $buildInfo['tech'] = array('id' => $Queue[0][0], 'level' => $Queue[0][1], 'timeleft' => $USER['b_tech'] - TIMESTAMP, 'time' => $USER['b_tech'], 'starttime' => pretty_time($USER['b_tech'] - TIMESTAMP)); } else { $buildInfo['tech'] = false; } $OnlineAdmins = $GLOBALS['DATABASE']->query("SELECT id,username FROM " . USERS . " WHERE universe = " . $UNI . " AND onlinetime >= " . (TIMESTAMP - 10 * 60) . " AND authlevel > '" . AUTH_USR . "';"); while ($AdminRow = $GLOBALS['DATABASE']->fetch_array($OnlineAdmins)) { $AdminsOnline[$AdminRow['id']] = $AdminRow['username']; } $GLOBALS['DATABASE']->free_result($OnlineAdmins); $balken = $GLOBALS['DATABASE']->countquery("SELECT COUNT(*) FROM " . USERS . " WHERE universe = " . $UNI . " AND onlinetime > '" . (TIMESTAMP - 15 * 60) . "';"); $länge2 = 365 / $CONF['users_amount']; $länge = $balken * $länge2; $chatUsers = $GLOBALS['DATABASE']->query("SELECT userName FROM " . CHAT_ON . " WHERE dateTime > DATE_SUB(NOW(), interval 2 MINUTE) AND channel = 0"); while ($chatRow = $GLOBALS['DATABASE']->fetch_array($chatUsers)) { $chatOnline[] = $chatRow['userName']; } $GLOBALS['DATABASE']->free_result($chatUsers); //$this->tplObj->loadscript('overview.js'); $Messages = $USER['messages']; // Fehler: Wenn Spieler gelöscht werden, werden sie nicht mehr in der Tabelle angezeigt. $RefLinksRAW = $GLOBALS['DATABASE']->query("SELECT u.id, u.username, s.total_points FROM " . USERS . " as u LEFT JOIN " . STATPOINTS . " as s ON s.id_owner = u.id AND s.stat_type = '1' WHERE ref_id = " . $USER['id'] . ";"); if (Config::get('ref_active')) { while ($RefRow = $GLOBALS['DATABASE']->fetch_array($RefLinksRAW)) { $RefLinks[$RefRow['id']] = array('username' => $RefRow['username'], 'points' => min($RefRow['total_points'], Config::get('ref_minpoints'))); } } $statinfo = $GLOBALS['DATABASE']->query("SELECT s.total_old_rank, s.total_rank FROM " . USERS . " as u LEFT JOIN " . STATPOINTS . " as s ON s.id_owner = u.id AND s.stat_type = '1' WHERE id = " . $USER['id'] . ";"); while ($game = $GLOBALS['DATABASE']->fetch_array($statinfo)) { $ranking = $game['total_old_rank'] - $game['total_rank']; if ($ranking == 0) { $position = "<span style='color:#87CEEB'>(*)</span>"; } elseif ($ranking < 0) { $position = "<span style='color:red'>(" . $ranking . ")</span>"; } elseif ($ranking > 0) { $position = "<span style='color:green'>(+" . $ranking . ")</span>"; } } if ($USER['total_rank'] == 0) { $rankInfo = "-"; } else { $rankInfo = sprintf($LNG['ov_userrank_info'], pretty_number($USER['total_points']), $LNG['ov_place'], $USER['total_rank'], $USER['total_rank'], $position, $LNG['ov_of'], Config::get('users_amount')); } $manual_start = 1; if ($USER['training'] == 0 && $USER['training_step'] == 0) { $manual_start = 0; $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET training_step = '1' WHERE id = " . $USER['id'] . ";"); } $manual_12 = 1; if ($USER['training'] == 0 && $USER['training_step'] == 12) { $manual_12 = 0; $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET training_step = '13' WHERE id = " . $USER['id'] . ";"); } $manual_20 = 1; if ($USER['training'] == 0 && $USER['training_step'] == 20) { $manual_20 = 0; $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET experience_peace = experience_peace + '650' WHERE id = " . $USER['id'] . ";"); } $facebook_unliked = 1; if ($USER['training'] == 1 && $USER['facebook_liked'] == 0) { $facebook_unliked = 0; } $this->tplObj->loadscript("countdown.js"); $this->tplObj->assign_vars(array('competition_active' => !empty($CONF['end_game']) && $CONF['end_game'] > TIMESTAMP ? $CONF['end_game'] - TIMESTAMP : 0, 'rankInfo' => $rankInfo, 'facebook_unliked' => $facebook_unliked, 'planet_protections' => $USER['immunity_until'] > TIMESTAMP ? $USER['immunity_until'] - TIMESTAMP : 0, 'planet_protectionbis' => $USER['immunity_until'], 'manual_12' => $manual_12, 'manual_20' => $manual_20, 'is_news' => Config::get('OverviewNewsFrame'), 'news' => makebr(Config::get('OverviewNewsText')), 'planetname' => $PLANET['name'], 'planetimage' => $PLANET['image'], 'galaxy' => $PLANET['galaxy'], 'system' => $PLANET['system'], 'planet' => $PLANET['planet'], 'planet_type' => $PLANET['planet_type'], 'username' => $USER['username'], 'training' => $manual_start, 'userid' => $USER['id'], 'buildInfo' => $buildInfo, 'Moon' => $Moon, 'fleets' => $this->GetFleets(), 'AllPlanets' => $AllPlanets, 'AdminsOnline' => $AdminsOnline, 'teamspeakData' => $this->GetTeamspeakData(), 'messages' => $Messages > 0 ? $Messages == 1 ? $LNG['ov_have_new_message'] : sprintf($LNG['ov_have_new_messages'], pretty_number($Messages)) : false, 'planet_diameter' => pretty_number($PLANET['diameter']), 'planet_field_current' => $PLANET['field_current'], 'planet_field_max' => CalculateMaxPlanetFields($PLANET), 'planet_temp_min' => $PLANET['temp_min'], 'planet_temp_max' => $PLANET['temp_max'], 'ref_active' => Config::get('ref_active'), 'ref_minpoints' => Config::get('ref_minpoints'), 'RefLinks' => $RefLinks, 'chatOnline' => $chatOnline, 'servertime' => _date("M D d H:i:s", TIMESTAMP, $USER['timezone']), 'path' => HTTP_PATH, 'online_users' => $balken, 'balken')); $this->display('page.overview.default.tpl'); }
public function SetNextQueueTechOnTop() { global $resource, $LNG; if (empty($this->USER['b_tech_queue'])) { $this->USER['b_tech'] = 0; $this->USER['b_tech_id'] = 0; $this->USER['b_tech_planet'] = 0; $this->USER['b_tech_queue'] = ''; return false; } $CurrentQueue = unserialize($this->USER['b_tech_queue']); $Loop = true; while ($Loop == true) { $ListIDArray = $CurrentQueue[0]; $isAnotherPlanet = $ListIDArray[4] != $this->PLANET['id']; if ($isAnotherPlanet) { $sql = 'SELECT * FROM %%PLANETS%% WHERE id = :planetId;'; $PLANET = Database::get()->selectSingle($sql, array(':planetId' => $ListIDArray[4])); $RPLANET = new ResourceUpdate(true, false); list(, $PLANET) = $RPLANET->CalcResource($this->USER, $PLANET, false, $this->USER['b_tech']); } else { $PLANET = $this->PLANET; } $PLANET[$resource[31] . '_inter'] = self::getNetworkLevel($this->USER, $PLANET); $Element = $ListIDArray[0]; $Level = $ListIDArray[1]; $costResources = BuildFunctions::getElementPrice($this->USER, $PLANET, $Element); $BuildTime = BuildFunctions::getBuildingTime($this->USER, $PLANET, $Element, $costResources); $HaveResources = BuildFunctions::isElementBuyable($this->USER, $PLANET, $Element, $costResources); $BuildEndTime = $this->USER['b_tech'] + $BuildTime; $CurrentQueue[0] = array($Element, $Level, $BuildTime, $BuildEndTime, $PLANET['id']); if ($HaveResources == true) { if (isset($costResources[901])) { $PLANET[$resource[901]] -= $costResources[901]; } if (isset($costResources[902])) { $PLANET[$resource[902]] -= $costResources[902]; } if (isset($costResources[903])) { $PLANET[$resource[903]] -= $costResources[903]; } if (isset($costResources[921])) { $this->USER[$resource[921]] -= $costResources[921]; } $this->USER['b_tech_id'] = $Element; $this->USER['b_tech'] = $BuildEndTime; $this->USER['b_tech_planet'] = $PLANET['id']; $this->USER['b_tech_queue'] = serialize($CurrentQueue); $Loop = false; } else { if ($this->USER['hof'] == 1) { if (!isset($costResources[901])) { $costResources[901] = 0; } if (!isset($costResources[902])) { $costResources[902] = 0; } if (!isset($costResources[903])) { $costResources[903] = 0; } $Message = sprintf($LNG['sys_notenough_money'], $PLANET['name'], $PLANET['id'], $PLANET['galaxy'], $PLANET['system'], $PLANET['planet'], $LNG['tech'][$Element], pretty_number($PLANET['metal']), $LNG['tech'][901], pretty_number($PLANET['crystal']), $LNG['tech'][902], pretty_number($PLANET['deuterium']), $LNG['tech'][903], pretty_number($costResources[901]), $LNG['tech'][901], pretty_number($costResources[902]), $LNG['tech'][902], pretty_number($costResources[903]), $LNG['tech'][903]); PlayerUtil::sendMessage($this->USER['id'], 0, $this->USER['b_tech'], 99, $LNG['sys_techlist'], $LNG['sys_buildlist_fail'], $Message); } array_shift($CurrentQueue); if (count($CurrentQueue) == 0) { $this->USER['b_tech'] = 0; $this->USER['b_tech_id'] = 0; $this->USER['b_tech_planet'] = 0; $this->USER['b_tech_queue'] = ''; $Loop = false; } else { $BaseTime = $BuildEndTime - $BuildTime; $NewQueue = array(); foreach ($CurrentQueue as $ListIDArray) { $ListIDArray[2] = BuildFunctions::getBuildingTime($this->USER, $PLANET, $ListIDArray[0]); $BaseTime += $ListIDArray[2]; $ListIDArray[3] = $BaseTime; $NewQueue[] = $ListIDArray; } $CurrentQueue = $NewQueue; } } if ($isAnotherPlanet) { $RPLANET->SavePlanetToDB($this->USER, $PLANET); $RPLANET = NULL; unset($RPLANET); } else { $this->PLANET = $PLANET; } } return true; }
public function show() { global $PLANET, $USER, $LNG, $resource, $reslist, $pricelist; if ($PLANET[$resource[31]] == 0) { $this->printMessage($LNG['bd_lab_required']); } $TheCommand = HTTP::_GP('cmd', ''); $elementId = HTTP::_GP('tech', 0); $ListID = HTTP::_GP('listid', 0); $PLANET[$resource[31] . '_inter'] = ResourceUpdate::getNetworkLevel($USER, $PLANET); if (!empty($TheCommand) && $_SERVER['REQUEST_METHOD'] === 'POST' && $USER['urlaubs_modus'] == 0) { switch ($TheCommand) { case 'cancel': $this->CancelBuildingFromQueue(); break; case 'remove': $this->RemoveBuildingFromQueue($ListID); break; case 'insert': $this->AddBuildingToQueue($elementId, true); break; case 'destroy': $this->AddBuildingToQueue($elementId, false); break; } $this->redirectTo('game.php?page=research'); } $bContinue = $this->CheckLabSettingsInQueue($PLANET); $queueData = $this->getQueueData(); $TechQueue = $queueData['queue']; $QueueCount = count($TechQueue); $ResearchList = array(); foreach ($reslist['tech'] as $elementId) { if (!BuildFunctions::isTechnologieAccessible($USER, $PLANET, $elementId)) { continue; } if (isset($queueData['quickinfo'][$elementId])) { $levelToBuild = $queueData['quickinfo'][$elementId]; } else { $levelToBuild = $USER[$resource[$elementId]]; } $costResources = BuildFunctions::getElementPrice($USER, $PLANET, $elementId, false, $levelToBuild); $costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $elementId, $costResources); $elementTime = BuildFunctions::getBuildingTime($USER, $PLANET, $elementId, $costResources); $buyable = $QueueCount != 0 || BuildFunctions::isElementBuyable($USER, $PLANET, $elementId, $costResources); $ResearchList[$elementId] = array('id' => $elementId, 'level' => $USER[$resource[$elementId]], 'maxLevel' => $pricelist[$elementId]['max'], 'costResources' => $costResources, 'costOverflow' => $costOverflow, 'elementTime' => $elementTime, 'buyable' => $buyable, 'levelToBuild' => $levelToBuild); } $this->assign(array('ResearchList' => $ResearchList, 'IsLabinBuild' => !$bContinue, 'IsFullQueue' => Config::get()->max_elements_tech == 0 || Config::get()->max_elements_tech == count($TechQueue), 'Queue' => $TechQueue)); $this->display('page.research.default.tpl'); }
public static function addResearchToQueue($Element, $AddMode = true) { global $PLANET, $USER, $resource, $CONF, $reslist, $pricelist; $PLANET[$resource[31] . '_inter'] = ResourceUpdate::getNetworkLevel($USER, $PLANET); if (!in_array($Element, $reslist['tech']) || !BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element) || !BuildFunctions::CheckLabSettingsInQueue($PLANET)) { return; } $CurrentQueue = unserialize($USER['b_tech_queue']); if (!empty($CurrentQueue)) { $ActualCount = count($CurrentQueue); } else { $CurrentQueue = array(); $ActualCount = 0; } if (Config::get('max_elements_tech') != 0 && Config::get('max_elements_tech') <= $ActualCount) { return false; } $BuildLevel = $USER[$resource[$Element]] + 1; if ($ActualCount == 0) { if ($pricelist[$Element]['max'] < $BuildLevel) { return; } $costRessources = BuildFunctions::getElementPrice($USER, $PLANET, $Element, !$AddMode); if (!BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costRessources)) { return; } if (isset($costRessources[901])) { $PLANET[$resource[901]] -= $costRessources[901]; } if (isset($costRessources[902])) { $PLANET[$resource[902]] -= $costRessources[902]; } if (isset($costRessources[903])) { $PLANET[$resource[903]] -= $costRessources[903]; } if (isset($costRessources[921])) { $USER[$resource[921]] -= $costRessources[921]; } $elementTime = BuildFunctions::getBuildingTime($USER, $PLANET, $Element, $costRessources); $BuildEndTime = TIMESTAMP + $elementTime; $USER['b_tech_queue'] = serialize(array(array($Element, $BuildLevel, $elementTime, $BuildEndTime, $PLANET['id']))); $USER['b_tech'] = $BuildEndTime; $USER['b_tech_id'] = $Element; $USER['b_tech_planet'] = $PLANET['id']; } else { $addLevel = 0; foreach ($CurrentQueue as $QueueSubArray) { if ($QueueSubArray[0] != $Element) { continue; } $addLevel++; } $BuildLevel += $addLevel; if ($pricelist[$Element]['max'] < $BuildLevel) { return; } $elementTime = BuildFunctions::getBuildingTime($USER, $PLANET, $Element, NULL, !$AddMode, $BuildLevel); $BuildEndTime = $CurrentQueue[$ActualCount - 1][3] + $elementTime; $CurrentQueue[] = array($Element, $BuildLevel, $elementTime, $BuildEndTime, $PLANET['id']); $USER['b_tech_queue'] = serialize($CurrentQueue); } }
public function show() { global $ProdGrid, $LNG, $resource, $reslist, $CONF, $PLANET, $USER, $pricelist; $buscarTick = $GLOBALS['DATABASE']->query("SELECT tick FROM " . CONFIG . ""); $tickinicial = $GLOBALS['DATABASE']->fetch_array($buscarTick); $tickinicial = $tickinicial['tick']; $TheCommand = HTTP::_GP('cmd', ''); // wellformed buildURLs if (!empty($TheCommand) && $_SERVER['REQUEST_METHOD'] === 'POST' && $USER['urlaubs_modus'] == 0) { $Element = HTTP::_GP('building', 0); $ListID = HTTP::_GP('listid', 0); $lvlup1 = HTTP::_GP('lvlup1', 0); switch ($TheCommand) { case 'cancel': $this->CancelBuildingFromQueue(); break; case 'remove': $this->RemoveBuildingFromQueue($ListID); break; case 'insert': $this->AddBuildingToQueue($Element, $lvlup1, true); break; case 'destroy': $this->DoAddBuildingToQueue($Element, false); break; } $this->redirectTo('game.php?page=buildings'); } $premium_stage = 0; if ($USER['premium_reward_stage'] > 0 && $USER['premium_reward_stage_days'] > TIMESTAMP) { $premium_stage = $USER['premium_reward_stage']; } $queueData = $this->getQueueData(); $Queue = $queueData['queue']; $QueueCount = count($Queue); $CanBuildElement = isVacationMode($USER) || Config::get('max_elements_build') - 1 == 0 || $QueueCount < Config::get('max_elements_build') - 1 + $premium_stage; $CurrentMaxFields = CalculateMaxPlanetFields($PLANET); $RoomIsOk = $PLANET['field_current'] < $CurrentMaxFields - $QueueCount; $BuildEnergy = $USER[$resource[113]]; $BuildLevelFactor = 10; $BuildTemp = $PLANET['temp_max']; $BuildInfoList = array(); $Elements = $reslist['allow'][$PLANET['planet_type']]; foreach ($Elements as $ID => $Element) { $AllTech = array(); $GetAll = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_vars_requriements` WHERE elementID = " . $Element . " ;"); if ($GLOBALS['DATABASE']->numRows($GetAll) > 0) { while ($x = $GLOBALS['DATABASE']->fetch_array($GetAll)) { $AllTech[] = $x; } } $infoEnergy = ""; if (isset($queueData['quickinfo'][$Element])) { $levelToBuild = $queueData['quickinfo'][$Element]; } else { $levelToBuild = $PLANET[$resource[$Element]]; } if (in_array($Element, $reslist['prod'])) { $peacefull_resource = 0; if ($USER['experience_peace_level'] > 0) { $peacefull_resource = $USER['experience_peace_level']; } $peacefull_resource = $peacefull_resource; $premium_resource = 0; if ($USER['premium_reward_extraction'] > 0 && $USER['premium_reward_extraction_days'] > TIMESTAMP) { $premium_resource = $USER['premium_reward_extraction']; } $premium_resource = $premium_resource; $combat_collider = 0; if ($USER['combat_reward_collider'] > 0) { $combat_collider = $USER['combat_reward_collider']; } $combat_collider = $combat_collider; $academy_mines = 0; if ($USER['academy_1201'] > 0) { $academy_mines = getbonusOneBis(1201, $USER['academy_1201']); } $academy_mines = $academy_mines; $daily_prod_bonus = 0; if ($USER['daily_produ'] > TIMESTAMP) { $daily_prod_bonus = 30; } $daily_prod_bonus = $daily_prod_bonus; $academy_energy = 0; if ($USER['academy_1202'] > 0) { $academy_energy = getbonusOneBis(1202, $USER['academy_1202']); } $academy_energy = $academy_energy; $academy_fusion = 0; if ($USER['academy_1209'] > 0) { $academy_fusion = getbonusOneBis(1209, $USER['academy_1209']); } $academy_fusion = $academy_fusion; $academy_solar = 0; if ($USER['academy_1210'] > 0) { $academy_solar = getbonusOneBis(1210, $USER['academy_1210']); } $academy_solar = $academy_solar; $allyInfo = $GLOBALS['DATABASE']->query("SELECT alliance_prod FROM `uni1_alliance` WHERE id = " . $USER['ally_id'] . ";"); $allyInfo = $GLOBALS['DATABASE']->fetch_array($allyInfo); $alliance_prod = 0; if ($allyInfo['alliance_prod'] > 0) { $alliance_prod = $allyInfo['alliance_prod']; } $alliance_prod = $alliance_prod; $BuildLevel = $PLANET[$resource[$Element]]; $Need = round(eval(ResourceUpdate::getProd($ProdGrid[$Element]['production'][911]))); $BuildLevel = $levelToBuild + 1; $Prod = round(eval(ResourceUpdate::getProd($ProdGrid[$Element]['production'][911]))); $requireEnergy = $Prod - $Need; if ($requireEnergy < 0) { $infoEnergy = sprintf($LNG['bd_need_engine'], pretty_number(abs($requireEnergy)), $LNG['tech'][911]); } else { $infoEnergy = sprintf($LNG['bd_more_engine'], pretty_number(abs($requireEnergy)), $LNG['tech'][911]); } } $costRessources = BuildFunctions::getElementPrice($USER, $PLANET, $Element, false, $levelToBuild); $costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costRessources); $elementTime = BuildFunctions::getBuildingTime($USER, $PLANET, $Element, $costRessources); $destroyRessources = BuildFunctions::getElementPrice($USER, $PLANET, $Element, true); $destroyTime = BuildFunctions::getBuildingTime($USER, $PLANET, $Element, $destroyRessources); $destroyOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $destroyRessources); $buyable = $QueueCount != 0 || BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costRessources); $BuildInfoList[$Element] = array('level' => $PLANET[$resource[$Element]], 'maxLevel' => $pricelist[$Element]['max'], 'factor' => $pricelist[$Element]['factor'], 'infoEnergy' => $infoEnergy, 'costRessources' => $costRessources, 'costOverflow' => $costOverflow, 'elementTime' => $elementTime, 'destroyRessources' => $destroyRessources, 'destroyTime' => $destroyTime, 'destroyOverflow' => $destroyOverflow, 'buyable' => $buyable, 'levelToBuild' => $levelToBuild, 'AllTech' => $AllTech, 'techacc' => BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element)); } $this->tplObj->loadscript('buildlist.js'); $manual_step_2 = 1; if ($USER['training'] == 0 && $USER['training_step'] == 2 && $PLANET['solar_plant'] < 1) { $manual_step_2 = 0; } $manual_step_2_1 = 1; if ($USER['training'] == 0 && $PLANET['solar_plant'] >= 1 && $USER['training_step'] == 2 && ($PLANET['metal_mine'] < 3 || $PLANET['crystal_mine'] < 2 || $PLANET['deuterium_sintetizer'] < 1)) { $manual_step_2_1 = 0; } $manual_step_2_2 = 1; if ($USER['training'] == 0 && $USER['training_step'] == 2 && $PLANET['metal_mine'] >= 3 && $PLANET['crystal_mine'] >= 2 && $PLANET['deuterium_sintetizer'] >= 1 && $PLANET['solar_plant'] < 4) { $manual_step_2_2 = 0; } $manual_step_2_3 = 1; if ($USER['training'] == 0 && $USER['training_step'] == 2 && $PLANET['metal_mine'] >= 3 && $PLANET['crystal_mine'] >= 2 && $PLANET['deuterium_sintetizer'] >= 1 && $PLANET['solar_plant'] >= 4) { $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET `training_step` = '3' WHERE `id` = " . $USER['id'] . ";"); $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET `experience_peace` = `experience_peace` + '650' WHERE `id` = " . $USER['id'] . ";"); $GLOBALS['DATABASE']->query("UPDATE " . PLANETS . " SET spy_sonde = spy_sonde + 5 WHERE id = 1;"); // SEND PROBES FUNCTION HERE $rawfleetarray = array(210 => 5); $fleetRessource = array(901 => 0, 902 => 0, 903 => 0); if (1 == $PLANET['system']) { $tickfinal = $tickinicial + 9; } else { $tickfinal = $tickinicial + 11; } FleetFunctions::sendFleet($rawfleetarray, '6', 1, 1, 1, 1, 1, 1, $PLANET['id_owner'], $PLANET['id'], $PLANET['galaxy'], $PLANET['system'], $PLANET['planet'], $PLANET['planet_type'], $fleetRessource, TIMESTAMP + 40, TIMESTAMP + 40, TIMESTAMP + 80, $tickinicial, $tickfinal, 0); $manual_step_2_3 = 0; } $manual_step_5 = 1; if ($USER['training'] == 0 && $USER['training_step'] == 5) { $manual_step_5 = 0; } $manual_step_9 = 1; if ($USER['training'] == 0 && $USER['training_step'] == 9) { $manual_step_9 = 0; } $manual_step_16 = 1; if ($USER['training'] == 0 && $USER['training_step'] == 16) { $manual_step_16 = 0; } if ($USER['training'] == 0 && $USER['training_step'] == 5 && $PLANET['laboratory'] >= 3) { $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET `training_step` = '6' WHERE `id` = " . $USER['id'] . ";"); } $this->tplObj->assign_vars(array('manual_step_16' => $manual_step_16, 'manual_step_9' => $manual_step_9, 'manual_step_2' => $manual_step_2, 'manual_step_2_1' => $manual_step_2_1, 'manual_step_2_2' => $manual_step_2_2, 'manual_step_2_3' => $manual_step_2_3, 'manual_step_5' => $manual_step_5, 'BuildInfoList' => $BuildInfoList, 'CanBuildElement' => $CanBuildElement, 'RoomIsOk' => $RoomIsOk, 'Planetas' => $PLANET, 'Queue' => $Queue, 'isBusy' => array('shipyard' => !empty($PLANET['b_hangar_id']), 'research' => $USER['b_tech_planet'] != 0), 'HaveMissiles' => (bool) $PLANET[$resource[503]] + $PLANET[$resource[502]], 'HaveMissiles' => (bool) $PLANET[$resource[503]] + $PLANET[$resource[502]], 'field_used' => $PLANET['field_current'], 'field_max' => CalculateMaxPlanetFields($PLANET), 'field_left' => CalculateMaxPlanetFields($PLANET) - $PLANET['field_current'], 'field_percent' => $PLANET['field_current'] * 100 / CalculateMaxPlanetFields($PLANET))); $this->display('page.buildings.default.tpl'); }
public function show() { global $PLANET, $USER, $LNG, $resource, $reslist, $CONF, $pricelist; $TheCommand = HTTP::_GP('cmd', ''); $Element = HTTP::_GP('tech', 0); $ListID = HTTP::_GP('listid', 0); $mode = HTTP::_GP('cmdd', 'physik'); $PLANET[$resource[31] . '_inter'] = ResourceUpdate::getNetworkLevel($USER, $PLANET); if (!empty($TheCommand) && $_SERVER['REQUEST_METHOD'] === 'POST' && $USER['urlaubs_modus'] == 0) { switch ($TheCommand) { case 'cancel': $this->CancelBuildingFromQueue(); break; case 'remove': $this->RemoveBuildingFromQueue($ListID); break; case 'insert': $this->AddBuildingToQueue($Element, true); break; case 'destroy': $this->AddBuildingToQueue($Element, false); break; } $this->redirectTo('game.php?page=research&cmdd=' . $mode . ''); } $bContinue = $this->CheckLabSettingsInQueue($PLANET); $queueData = $this->getQueueData(); $TechQueue = $queueData['queue']; $QueueCount = count($TechQueue); $ResearchList = array(); if ($mode == 'space') { $elementIDs = array(109, 110, 111, 115, 117, 118); } elseif ($mode == 'militar') { $elementIDs = array(145, 106, 146, 147, 148, 149); } else { $elementIDs = array(113, 140, 141, 142, 143, 144); } foreach ($elementIDs as $ID => $Element) { $AllTech = array(); $GetAll = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_vars_requriements` WHERE elementID = " . $Element . " ;"); if ($GLOBALS['DATABASE']->numRows($GetAll) > 0) { while ($x = $GLOBALS['DATABASE']->fetch_array($GetAll)) { $AllTech[] = $x; } } if (isset($queueData['quickinfo'][$Element])) { $levelToBuild = $queueData['quickinfo'][$Element]; } else { $levelToBuild = $USER[$resource[$Element]]; } $costRessources = BuildFunctions::getElementPrice($USER, $PLANET, $Element, false, $levelToBuild); $costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costRessources); $elementTime = BuildFunctions::getBuildingTime($USER, $PLANET, $Element, $costRessources); $buyable = $QueueCount != 0 || BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costRessources); $ResearchList[$Element] = array('id' => $Element, 'level' => $USER[$resource[$Element]], 'maxLevel' => $pricelist[$Element]['max'], 'costRessources' => $costRessources, 'costOverflow' => $costOverflow, 'elementTime' => $elementTime, 'buyable' => $buyable, 'levelToBuild' => $levelToBuild, 'AllTech' => $AllTech, 'techacc' => BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element)); } if ($USER['b_tech_id'] != 0) { $this->tplObj->loadscript('research.js'); } $max_build = Config::get('max_elements_tech'); if ($USER['mode_chaine'] > TIMESTAMP) { $max_build += 2; } if ($mode == 'space') { $Tab = 'Space research'; } elseif ($mode == 'militar') { $Tab = 'Military research'; } else { $Tab = 'Theoretical Physics'; } $this->tplObj->assign_vars(array('Tab' => $Tab, 'ResearchList' => $ResearchList, 'IsLabinBuild' => !$bContinue, 'IsFullQueue' => $max_build == 0 || $max_build == count($TechQueue), 'Queue' => $TechQueue, 'mode' => $mode)); $this->display('page.research.default.tpl'); }
public function SetNextQueueTechOnTop() { global $resource, $LNG; if (empty($this->USER['b_tech_queue'])) { $this->USER['b_tech'] = 0; $this->USER['b_tech_id'] = 0; $this->USER['b_tech_planet'] = 0; $this->USER['b_tech_queue'] = ''; return false; } $CurrentQueue = unserialize($this->USER['b_tech_queue']); $Loop = true; while ($Loop == true) { $ListIDArray = $CurrentQueue[0]; if ($ListIDArray[4] != $this->PLANET['id']) { $PLANET = $GLOBALS['DATABASE']->getFirstRow("SELECT * FROM " . PLANETS . " WHERE id = '" . $ListIDArray[4] . "';"); } else { $PLANET = $this->PLANET; } $PLANET[$resource[31] . '_inter'] = self::getNetworkLevel($this->USER, $PLANET); $Element = $ListIDArray[0]; $Level = $ListIDArray[1]; $costRessources = BuildFunctions::getElementPrice($this->USER, $PLANET, $Element); $BuildTime = BuildFunctions::getBuildingTime($this->USER, $PLANET, $Element, $costRessources); $HaveRessources = BuildFunctions::isElementBuyable($this->USER, $PLANET, $Element, $costRessources); $BuildEndTime = $this->USER['b_tech'] + $BuildTime; $CurrentQueue[0] = array($Element, $Level, $BuildTime, $BuildEndTime, $PLANET['id']); $isAnotherPlanet = $ListIDArray[4] != $this->PLANET['id']; if ($isAnotherPlanet) { $IsHash = !in_array($Element, array(131, 132, 133)); $RPLANET = new ResourceUpdate(true, false); list(, $PLANET) = $RPLANET->CalcResource($this->USER, $PLANET, false, $this->USER['b_tech'], $IsHash); } if ($HaveRessources == true) { if (isset($costRessources[901])) { $PLANET[$resource[901]] -= $costRessources[901]; } if (isset($costRessources[902])) { $PLANET[$resource[902]] -= $costRessources[902]; } if (isset($costRessources[903])) { $PLANET[$resource[903]] -= $costRessources[903]; } if (isset($costRessources[904])) { $PLANET[$resource[904]] -= $costRessources[904]; } if (isset($costRessources[921])) { $this->USER[$resource[921]] -= $costRessources[921]; } $this->USER['b_tech_id'] = $Element; $this->USER['b_tech'] = $BuildEndTime; $this->USER['b_tech_planet'] = $PLANET['id']; $this->USER['b_tech_queue'] = serialize($CurrentQueue); $Loop = false; } else { if ($this->USER['hof'] == 1) { if (!isset($costRessources[901])) { $costRessources[901] = 0; } if (!isset($costRessources[902])) { $costRessources[902] = 0; } if (!isset($costRessources[903])) { $costRessources[903] = 0; } if (!isset($costRessources[904])) { $costRessources[904] = 0; } $Message = sprintf($LNG['sys_notenough_money'], $PLANET['name'], $PLANET['id'], $PLANET['galaxy'], $PLANET['system'], $PLANET['planet'], $LNG['tech'][$Element], pretty_number($PLANET['metal']), $LNG['tech'][901], pretty_number($PLANET['crystal']), $LNG['tech'][902], pretty_number($PLANET['deuterium']), $LNG['tech'][903], pretty_number($costRessources[901]), $LNG['tech'][901], pretty_number($costRessources[902]), $LNG['tech'][902], pretty_number($costRessources[903]), $LNG['tech'][903], pretty_number($costRessources[904]), $LNG['tech'][904]); SendSimpleMessage($this->USER['id'], 0, $this->USER['b_tech'], 99, $LNG['sys_techlist'], $LNG['sys_buildlist_fail'], $Message); } array_shift($CurrentQueue); if (count($CurrentQueue) == 0) { $this->USER['b_tech'] = 0; $this->USER['b_tech_id'] = 0; $this->USER['b_tech_planet'] = 0; $this->USER['b_tech_queue'] = ''; $Loop = false; } else { $BaseTime = $BuildEndTime - $BuildTime; $NewQueue = array(); foreach ($CurrentQueue as $ListIDArray) { $ListIDArray[2] = BuildFunctions::getBuildingTime($this->USER, $PLANET, $ListIDArray[0]); $BaseTime += $ListIDArray[2]; $ListIDArray[3] = $BaseTime; $NewQueue[] = $ListIDArray; } $CurrentQueue = $NewQueue; } } if ($isAnotherPlanet) { $RPLANET->SavePlanetToDB($this->USER, $PLANET); } else { $this->PLANET = $PLANET; } } }
public function show() { global $USER, $PLANET, $LNG, $resource, $reslist; if ($PLANET[$resource[21]] == 0) { $this->printMessage($LNG['bd_shipyard_required']); } $buildTodo = HTTP::_GP('fmenge', array()); $action = HTTP::_GP('action', ''); $NotBuilding = true; if (!empty($PLANET['b_building_id'])) { $CurrentQueue = unserialize($PLANET['b_building_id']); foreach ($CurrentQueue as $ElementArray) { if ($ElementArray[0] == 21 || $ElementArray[0] == 15) { $NotBuilding = false; break; } } } $ElementQueue = unserialize($PLANET['b_hangar_id']); if (empty($ElementQueue)) { $Count = 0; } else { $Count = count($ElementQueue); } if ($USER['urlaubs_modus'] == 0 && $NotBuilding == true) { if (!empty($buildTodo)) { $maxBuildQueue = Config::get()->max_elements_ships; if ($maxBuildQueue != 0 && $Count >= $maxBuildQueue) { $this->printMessage(sprintf($LNG['bd_max_builds'], $maxBuildQueue)); } $this->BuildAuftr($buildTodo); $ElementQueue = unserialize($PLANET['b_hangar_id']); } if ($action == "delete") { $this->CancelAuftr(); } } $elementInQueue = array(); $buildList = array(); $elementList = array(); if (!empty($ElementQueue)) { $Shipyard = array(); $QueueTime = 0; foreach ($ElementQueue as $Element) { if (empty($Element)) { continue; } $elementInQueue[$Element[0]] = true; $ElementTime = BuildFunctions::getBuildingTime($USER, $PLANET, $Element[0]); $QueueTime += $ElementTime * $Element[1]; $Shipyard[] = array($LNG['tech'][$Element[0]], $Element[1], $ElementTime, $Element[0]); } $buildList = array('Queue' => $Shipyard, 'b_hangar_id_plus' => $PLANET['b_hangar'], 'pretty_time_b_hangar' => pretty_time(max($QueueTime - $PLANET['b_hangar'], 0))); } $mode = HTTP::_GP('mode', 'fleet'); if ($mode == 'defense') { $elementIDs = array_merge($reslist['defense'], $reslist['missile']); } else { $elementIDs = $reslist['fleet']; } $Missiles = array(); foreach ($reslist['missile'] as $elementID) { $Missiles[$elementID] = $PLANET[$resource[$elementID]]; } $MaxMissiles = BuildFunctions::getMaxConstructibleRockets($USER, $PLANET, $Missiles); foreach ($elementIDs as $Element) { if (!BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element)) { continue; } $costResources = BuildFunctions::getElementPrice($USER, $PLANET, $Element); $costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costResources); $elementTime = BuildFunctions::getBuildingTime($USER, $PLANET, $Element, $costResources); $buyable = BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costResources); $maxBuildable = BuildFunctions::getMaxConstructibleElements($USER, $PLANET, $Element, $costResources); if (isset($MaxMissiles[$Element])) { $maxBuildable = min($maxBuildable, $MaxMissiles[$Element]); } $AlreadyBuild = in_array($Element, $reslist['one']) && (isset($elementInQueue[$Element]) || $PLANET[$resource[$Element]] != 0); $elementList[$Element] = array('id' => $Element, 'available' => $PLANET[$resource[$Element]], 'costResources' => $costResources, 'costOverflow' => $costOverflow, 'elementTime' => $elementTime, 'buyable' => $buyable, 'maxBuildable' => floattostring($maxBuildable), 'AlreadyBuild' => $AlreadyBuild); } $this->assign(array('elementList' => $elementList, 'NotBuilding' => $NotBuilding, 'BuildList' => $buildList, 'maxlength' => strlen(Config::get()->max_fleet_per_build), 'mode' => $mode)); $this->display('page.shipyard.default.tpl'); }
public function show() { global $USER, $UNI, $PLANET, $LNG, $resource, $dpath, $reslist, $pricelist, $requeriments, $CONF; if ($CONF['dmenabled'] == 0) { $this->printMessage("This add-on is disabled", true, array('game.php?page=overview', 2)); die; } $fmenge = isset($_POST['fmenge']) ? $_POST['fmenge'] : array(); $action = HTTP::_GP('action', ''); $NotBuilding = true; if (!empty($PLANET['b_building_id'])) { $CurrentQueue = unserialize($PLANET['b_building_id']); foreach ($CurrentQueue as $ElementArray) { if ($ElementArray[0] == 21 || $ElementArray[0] == 15) { $NotBuilding = false; break; } } } $ElementQueue = unserialize($PLANET['b_hangar_id']); if (empty($ElementQueue)) { $Count = 0; } else { $Count = count($ElementQueue); } if ($USER['urlaubs_modus'] == 0) { if (!empty($fmenge) && $NotBuilding == true) { if (Config::get('max_elements_ships') != 0 && $Count >= Config::get('max_elements_ships')) { $this->printMessage(sprintf($LNG['bd_max_builds'], Config::get('max_elements_ships'))); exit; } $this->BuildAuftr($fmenge); } if ($action == "delete") { $this->CancelAuftr(); } } $elementInQueue = array(); $ElementQueue = unserialize($PLANET['b_hangar_id']); $Buildlist = array(); if (!empty($ElementQueue)) { $Shipyard = array(); $QueueTime = 0; foreach ($ElementQueue as $Element) { if (empty($Element)) { continue; } $elementInQueue[$Element[0]] = true; $ElementTime = BuildFunctions::getBuildingTime($USER, $PLANET, $Element[0]); $QueueTime += $ElementTime * $Element[1]; $Shipyard[] = array($LNG['tech'][$Element[0]], $Element[1], $ElementTime, $Element[0]); } $this->tplObj->loadscript('bcmath.js'); $this->tplObj->execscript('ShipyardInit();'); $Buildlist = array('Queue' => $Shipyard, 'b_hangar_id_plus' => $PLANET['b_hangar'], 'pretty_time_b_hangar' => pretty_time(max($QueueTime - $PLANET['b_hangar'], 0))); } $mode = HTTP::_GP('mode', 'fleet'); if ($mode == 'defense' && $CONF['fleetconf'] > TIMESTAMP) { $elementALL = array(401, 402, 403, 404, 405, 406, 410, 412, 413, 414, 416, 417, 418, 419, 420, 421, 422); $elementIDs = array(411, 502, 503); $elementIDd = array(401, 402, 403, 420); $elementIDa = array(405, 404, 406, 416, 417, 421); $elementIDq = array(418, 412, 410, 413, 419, 414); } elseif ($mode == 'defense' && $CONF['fleetconf'] < TIMESTAMP) { $elementALL = array(401, 402, 403, 404, 405, 406, 410, 412, 413, 414, 416, 417, 418, 419, 420, 421, 422); $elementIDs = array(411, 502, 503); $elementIDd = array(401, 402, 403); $elementIDa = array(405, 404, 406, 416, 417); $elementIDq = array(418, 412, 410, 413, 422, 419, 414, 422); } elseif ($mode == 'fleet' && $CONF['fleetconf'] > TIMESTAMP) { $elementALL = array(202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230); $elementIDs = array(208, 210, 223); $elementIDd = array(212, 202, 203, 204, 205, 229); $elementIDa = array(209, 206, 207, 217, 215, 213, 211, 219, 224); $elementIDq = array(225, 226, 214, 216, 230, 227, 228, 222, 218, 221); } elseif ($mode == 'fleet' && $CONF['fleetconf'] < TIMESTAMP) { $elementALL = array(202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230); $elementIDs = array(208, 210, 223); $elementIDd = array(212, 202, 203, 204, 205); $elementIDa = array(209, 206, 207, 217, 215, 213, 211, 219); $elementIDq = array(225, 226, 214, 216, 230, 227, 228, 222, 218, 221); } foreach ($elementALL as $Element) { $AllPrice = array(); $GetAllPrice = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_vars` WHERE elementID = " . $Element . " ;"); if ($GLOBALS['DATABASE']->numRows($GetAllPrice) > 0) { while ($k = $GLOBALS['DATABASE']->fetch_array($GetAllPrice)) { $AllPrice[] = $k; } } $costRessources = $k; $costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costRessources); $elementTime = 0; $buyable = BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costRessources); $maxBuildable = BuildFunctions::getMaxConstructibleElementsDM($USER, $PLANET, $Element, $costRessources); $elementListall[$Element] = array('id' => $Element, 'available' => $PLANET[$resource[$Element]], 'costRessources' => $costRessources, 'costOverflow' => $costOverflow, 'elementTime' => $elementTime, 'buyable' => $buyable, 'maxBuildable' => floattostring($maxBuildable), 'AllPrice' => $AllPrice, 'techacc' => BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element)); } foreach ($elementIDs as $Element) { $AllTech = array(); $GetAll = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_vars_requriements` WHERE elementID = " . $Element . " ;"); if ($GLOBALS['DATABASE']->numRows($GetAll) > 0) { while ($x = $GLOBALS['DATABASE']->fetch_array($GetAll)) { $AllTech[] = $x; } } $AllPrice = array(); $GetAllPrice = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_vars` WHERE elementID = " . $Element . " ;"); if ($GLOBALS['DATABASE']->numRows($GetAllPrice) > 0) { while ($k = $GLOBALS['DATABASE']->fetch_array($GetAllPrice)) { $AllPrice[] = $k; } } $costRessources = $k; $costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costRessources); $elementTime = 0; $buyable = BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costRessources); $maxBuildable = BuildFunctions::getMaxConstructibleElementsDM($USER, $PLANET, $Element, $costRessources); $elementList[$Element] = array('id' => $Element, 'available' => $PLANET[$resource[$Element]], 'costRessources' => $costRessources, 'costOverflow' => $costOverflow, 'elementTime' => $elementTime, 'buyable' => $buyable, 'maxBuildable' => floattostring($maxBuildable), 'AllPrice' => $AllPrice, 'AllTech' => $AllTech, 'AllPrice' => $AllPrice, 'techacc' => BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element)); } foreach ($elementIDq as $Element) { $AllTech = array(); $GetAll = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_vars_requriements` WHERE elementID = " . $Element . " ;"); if ($GLOBALS['DATABASE']->numRows($GetAll) > 0) { while ($x = $GLOBALS['DATABASE']->fetch_array($GetAll)) { $AllTech[] = $x; } } $AllPrice = array(); $GetAllPrice = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_vars` WHERE elementID = " . $Element . " ;"); if ($GLOBALS['DATABASE']->numRows($GetAllPrice) > 0) { while ($k = $GLOBALS['DATABASE']->fetch_array($GetAllPrice)) { $AllPrice[] = $k; } } $costRessources = $k; $costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costRessources); $elementTime = 0; $buyable = BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costRessources); $maxBuildable = BuildFunctions::getMaxConstructibleElementsDM($USER, $PLANET, $Element, $costRessources); $elementListq[$Element] = array('id' => $Element, 'available' => $PLANET[$resource[$Element]], 'costRessources' => $costRessources, 'costOverflow' => $costOverflow, 'elementTime' => $elementTime, 'buyable' => $buyable, 'maxBuildable' => floattostring($maxBuildable), 'AllTech' => $AllTech, 'AllPrice' => $AllPrice, 'techacc' => BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element)); } foreach ($elementIDa as $Element) { $AllTech = array(); $GetAll = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_vars_requriements` WHERE elementID = " . $Element . " ;"); if ($GLOBALS['DATABASE']->numRows($GetAll) > 0) { while ($x = $GLOBALS['DATABASE']->fetch_array($GetAll)) { $AllTech[] = $x; } } $AllPrice = array(); $GetAllPrice = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_vars` WHERE elementID = " . $Element . " ;"); if ($GLOBALS['DATABASE']->numRows($GetAllPrice) > 0) { while ($k = $GLOBALS['DATABASE']->fetch_array($GetAllPrice)) { $AllPrice[] = $k; } } $costRessources = $k; $costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costRessources); $elementTime = 0; $buyable = BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costRessources); $maxBuildable = BuildFunctions::getMaxConstructibleElementsDM($USER, $PLANET, $Element, $costRessources); $elementLista[$Element] = array('id' => $Element, 'available' => $PLANET[$resource[$Element]], 'costRessources' => $costRessources, 'costOverflow' => $costOverflow, 'elementTime' => $elementTime, 'buyable' => $buyable, 'maxBuildable' => floattostring($maxBuildable), 'AllTech' => $AllTech, 'AllPrice' => $AllPrice, 'techacc' => BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element)); } foreach ($elementIDd as $Element) { $AllTech = array(); $GetAll = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_vars_requriements` WHERE elementID = " . $Element . " ;"); if ($GLOBALS['DATABASE']->numRows($GetAll) > 0) { while ($x = $GLOBALS['DATABASE']->fetch_array($GetAll)) { $AllTech[] = $x; } } $AllPrice = array(); $GetAllPrice = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_vars` WHERE elementID = " . $Element . " ;"); if ($GLOBALS['DATABASE']->numRows($GetAllPrice) > 0) { while ($k = $GLOBALS['DATABASE']->fetch_array($GetAllPrice)) { $AllPrice[] = $k; } } $costRessources = $k; $costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costRessources); $elementTime = 0; $buyable = BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costRessources); $maxBuildable = BuildFunctions::getMaxConstructibleElementsDM($USER, $PLANET, $Element, $costRessources); $elementListd[$Element] = array('id' => $Element, 'available' => $PLANET[$resource[$Element]], 'costRessources' => $costRessources, 'costOverflow' => $costOverflow, 'elementTime' => $elementTime, 'buyable' => $buyable, 'maxBuildable' => floattostring($maxBuildable), 'AllTech' => $AllTech, 'AllPrice' => $AllPrice, 'techacc' => BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element)); } $this->tplObj->loadscript('shipyard.js'); $this->tplObj->assign_vars(array('elementListall' => $elementListall, 'elementList' => $elementList, 'elementListd' => $elementListd, 'elementLista' => $elementLista, 'elementListq' => $elementListq, 'NotBuilding' => $NotBuilding, 'BuildList' => $Buildlist, 'maxlength' => strlen(Config::get('max_fleet_per_build')), 'mode' => $mode, 'instant_fleet' => pretty_number(40000000 - $USER['instant_fleet']))); $this->display('page.dmship.default.tpl'); }
public function show() { global $USER, $PLANET, $LNG, $resource, $dpath, $reslist, $CONF; $fmenge = isset($_POST['fmenge']) ? $_POST['fmenge'] : array(); $action = HTTP::_GP('action', ''); $NotBuilding = true; if (!empty($PLANET['b_building_id'])) { $CurrentQueue = unserialize($PLANET['b_building_id']); foreach ($CurrentQueue as $ElementArray) { if ($ElementArray[0] == 21 || $ElementArray[0] == 15) { $NotBuilding = false; break; } } } $ElementQueue = unserialize($PLANET['b_hangar_id']); if (empty($ElementQueue)) { $Count = 0; } else { $Count = count($ElementQueue); } if ($USER['urlaubs_modus'] == 0) { if (!empty($fmenge) && $NotBuilding == true) { if (Config::get('max_elements_ships') != 0 && $Count >= Config::get('max_elements_ships')) { $this->printMessage(sprintf($LNG['bd_max_builds'], Config::get('max_elements_ships'))); exit; } $this->BuildAuftr($fmenge); } if ($action == "delete") { $this->CancelAuftr(); } } $elementInQueue = array(); $ElementQueue = unserialize($PLANET['b_hangar_id']); $Buildlist = array(); if (!empty($ElementQueue)) { $Shipyard = array(); $QueueTime = 0; foreach ($ElementQueue as $Element) { if (empty($Element)) { continue; } $elementInQueue[$Element[0]] = true; $ElementTime = BuildFunctions::getBuildingTime($USER, $PLANET, $Element[0]); $QueueTime += $ElementTime * $Element[1]; $Shipyard[] = array($LNG['tech'][$Element[0]], $Element[1], $ElementTime, $Element[0]); } $this->tplObj->loadscript('bcmath.js'); $this->tplObj->loadscript('shipyard.js'); $this->tplObj->execscript('ShipyardInit();'); $Buildlist = array('Queue' => $Shipyard, 'b_hangar_id_plus' => $PLANET['b_hangar'], 'pretty_time_b_hangar' => pretty_time(max($QueueTime - $PLANET['b_hangar'], 0))); } $mode = HTTP::_GP('mode', 'fleet'); if ($mode == 'defense') { $elementIDs = array(401, 402, 403, 404, 405, 406); } elseif ($mode == 'orbit') { $elementIDs = array(407, 408); } elseif ($mode == 'recy') { $elementIDs = array(209, 223, 219); } elseif ($mode == 'energy') { $elementIDs = array(221, 222); } elseif ($mode == 'combat') { $elementIDs = array(204, 205, 206, 207, 211, 214, 215, 216); } else { $elementIDs = array(202, 203, 210, 224); } $inmode = 0; if ($mode == 'recy' || $mode == 'energy' || $mode == 'combat' || $mode == 'fleet') { $inmode = 1; } $Missiles = array(); foreach ($reslist['missile'] as $elementID) { $Missiles[$elementID] = $PLANET[$resource[$elementID]]; } $MaxMissiles = BuildFunctions::getMaxConstructibleRockets($USER, $PLANET, $Missiles); foreach ($elementIDs as $Element) { $AllTech = array(); $GetAll = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_vars_requriements` WHERE elementID = " . $Element . " ;"); if ($GLOBALS['DATABASE']->numRows($GetAll) > 0) { while ($x = $GLOBALS['DATABASE']->fetch_array($GetAll)) { $AllTech[] = $x; } } $costRessources = BuildFunctions::getElementPrice($USER, $PLANET, $Element); $costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costRessources); $elementTime = BuildFunctions::getBuildingTime($USER, $PLANET, $Element, $costRessources); $buyable = BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costRessources); $maxBuildable = BuildFunctions::getMaxConstructibleElements($USER, $PLANET, $Element, $costRessources); if (isset($MaxMissiles[$Element])) { $maxBuildable = min($maxBuildable, $MaxMissiles[$Element]); } $AlreadyBuild = in_array($Element, $reslist['one']) && (isset($elementInQueue[$Element]) || $PLANET[$resource[$Element]] != 0); $elementList[$Element] = array('id' => $Element, 'available' => $PLANET[$resource[$Element]], 'costRessources' => $costRessources, 'costOverflow' => $costOverflow, 'elementTime' => $elementTime, 'buyable' => $buyable, 'maxBuildable' => floattostring($maxBuildable), 'AlreadyBuild' => $AlreadyBuild, 'AllTech' => $AllTech, 'techacc' => BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element)); } $this->tplObj->assign_vars(array('inmode' => $inmode, 'elementList' => $elementList, 'NotBuilding' => $NotBuilding, 'BuildList' => $Buildlist, 'maxlength' => strlen(Config::get('max_fleet_per_build')), 'mode' => $mode)); $this->display('page.shipyard.default.tpl'); }
function show() { global $CONF, $LNG, $PLANET, $USER, $resource, $UNI, $ALLIANCE; $AdminsOnline = array(); $chatOnline = array(); $AllPlanets = array(); $Moon = array(); $RefLinks = array(); $Buildtime = 0; foreach ($USER['PLANETS'] as $ID => $CPLANET) { if ($ID == $PLANET['id'] || $CPLANET['planet_type'] == 3) { continue; } if (!empty($CPLANET['b_building']) && $CPLANET['b_building'] > TIMESTAMP) { $Queue = unserialize($CPLANET['b_building_id']); $BuildPlanet = $LNG['tech'][$Queue[0][0]] . " (" . $Queue[0][1] . ")<br><span style=\"color:#7F7F7F;\">(" . pretty_time($Queue[0][3] - TIMESTAMP) . ")</span>"; } else { $BuildPlanet = $LNG['ov_free']; } $AllPlanets[] = array('id' => $CPLANET['id'], 'name' => $CPLANET['name'], 'image' => $CPLANET['image'], 'build' => $BuildPlanet); } if ($PLANET['id_luna'] != 0) { $Moon = $GLOBALS['DATABASE']->getFirstRow("SELECT id, name FROM " . PLANETS . " WHERE id = '" . $PLANET['id_luna'] . "';"); } $overmessage = 0; if ($PLANET['b_building'] - TIMESTAMP > 0) { $Queue = unserialize($PLANET['b_building_id']); $temp_total = BuildFunctions::getBuildingTime($USER, $PLANET, $Queue[0][0], BuildFunctions::getElementPrice($USER, $PLANET, $Queue[0][0], false, $Queue[0][1] - 1)); $temps_rest = $PLANET['b_building'] - TIMESTAMP; $pourc = 100 - 100 / $temp_total * $temps_rest; $buildInfo['buildings'] = array('price' => BuildFunctions::getElementPrice($USER, $PLANET, $Queue[0][0], false, $Queue[0][1] - 1), 'elementime' => pretty_time(BuildFunctions::getBuildingTime($USER, $PLANET, $Queue[0][0], BuildFunctions::getElementPrice($USER, $PLANET, $Queue[0][0], false, $Queue[0][1] - 1))), 'id' => $Queue[0][0], 'level' => $Queue[0][1], 'timeleft' => $PLANET['b_building'] - TIMESTAMP, 'time' => $PLANET['b_building'], 'endtime' => date('d/m/Y H:i:s', $PLANET['b_building']), 'percenting' => round($pourc), 'starttime' => pretty_time($PLANET['b_building'] - TIMESTAMP), 'starttimeego' => date('d/m/Y H:i:s', $PLANET['b_building'] - BuildFunctions::getBuildingTime($USER, $PLANET, $Queue[0][0], BuildFunctions::getElementPrice($USER, $PLANET, $Queue[0][0], false, $Queue[0][1] - 1)))); $overmessage = 1; } else { $buildInfo['buildings'] = false; } /* As FR#206 (http://tracker.2moons.cc/view.php?id=206), i added the shipyard and research status here, but i add not them the template. */ if (!empty($PLANET['b_hangar_id'])) { $Queue = unserialize($PLANET['b_hangar_id']); $time = BuildFunctions::getBuildingTime($USER, $PLANET, $Queue[0][0]) * $Queue[0][1]; $times = BuildFunctions::getBuildingTime($USER, $PLANET, $Queue[0][0]); $buildInfo['fleet'] = array('price' => BuildFunctions::getElementPrice($USER, $PLANET, $Queue[0][0]), 'id' => $Queue[0][0], 'level' => $Queue[0][1], 'timeleft' => $time - $PLANET['b_hangar'], 'timelefts' => date('d/m/Y H:i:s', TIMESTAMP + ($times - $PLANET['b_hangar'])), 'time' => $time, 'starttime' => pretty_time($time - $PLANET['b_hangar']), 'endtime' => date('d/m/Y H:i:s', TIMESTAMP + $time - $PLANET['b_hangar'])); $overmessage = 1; } else { $buildInfo['fleet'] = false; } if (!empty($PLANET['b_defense_id'])) { $Queue = unserialize($PLANET['b_defense_id']); $time = BuildFunctions::getBuildingTime($USER, $PLANET, $Queue[0][0]) * $Queue[0][1]; $times = BuildFunctions::getBuildingTime($USER, $PLANET, $Queue[0][0]); $buildInfo['defense'] = array('price' => BuildFunctions::getElementPrice($USER, $PLANET, $Queue[0][0]), 'id' => $Queue[0][0], 'level' => $Queue[0][1], 'timeleft' => $time - $PLANET['b_defense'], 'timelefts' => date('d/m/Y H:i:s', TIMESTAMP + ($times - $PLANET['b_defense'])), 'time' => $time, 'starttime' => pretty_time($time - $PLANET['b_defense']), 'endtime' => date('d/m/Y H:i:s', TIMESTAMP + $time - $PLANET['b_defense'])); $overmessage = 1; } else { $buildInfo['defense'] = false; } if ($USER['b_tech'] - TIMESTAMP > 0) { $Queue = unserialize($USER['b_tech_queue']); $temp_total = BuildFunctions::getBuildingTime($USER, $PLANET, $Queue[0][0], BuildFunctions::getElementPrice($USER, $PLANET, $Queue[0][0], false, $Queue[0][1] - 1)); $temps_rest = $PLANET['b_building'] - TIMESTAMP; $pourc = 100 - 100 / $temp_total * $temps_rest; $buildInfo['tech'] = array('price' => BuildFunctions::getElementPrice($USER, $PLANET, $Queue[0][0], false, $Queue[0][1] - 1), 'elementime' => pretty_time(BuildFunctions::getBuildingTime($USER, $PLANET, $Queue[0][0], BuildFunctions::getElementPrice($USER, $PLANET, $Queue[0][0], false, $Queue[0][1] - 1))), 'id' => $Queue[0][0], 'level' => $Queue[0][1], 'timeleft' => $USER['b_tech'] - TIMESTAMP, 'endtime' => date('d/m/Y H:i:s', $USER['b_tech']), 'percenting' => round($pourc), 'starttime' => pretty_time($USER['b_tech'] - TIMESTAMP), 'starttimeego' => date('d/m/Y H:i:s', $USER['b_tech'] - BuildFunctions::getBuildingTime($USER, $PLANET, $Queue[0][0], BuildFunctions::getElementPrice($USER, $PLANET, $Queue[0][0], false, $Queue[0][1] - 1)))); $overmessage = 1; } else { $buildInfo['tech'] = false; } $OnlineAdmins = $GLOBALS['DATABASE']->query("SELECT id,username FROM " . USERS . " WHERE universe = " . $UNI . " AND onlinetime >= " . (TIMESTAMP - 10 * 60) . " AND authlevel > '" . AUTH_USR . "';"); while ($AdminRow = $GLOBALS['DATABASE']->fetch_array($OnlineAdmins)) { $AdminsOnline[$AdminRow['id']] = $AdminRow['username']; } $GLOBALS['DATABASE']->free_result($OnlineAdmins); $Messages = $USER['messages']; // Fehler: Wenn Spieler gelöscht werden, werden sie nicht mehr in der Tabelle angezeigt. $RefLinksRAW = $GLOBALS['DATABASE']->query("SELECT u.id, u.username, s.total_points FROM " . USERS . " as u LEFT JOIN " . STATPOINTS . " as s ON s.id_owner = u.id AND s.stat_type = '1' WHERE ref_id = " . $USER['id'] . ";"); if (Config::get('ref_active')) { while ($RefRow = $GLOBALS['DATABASE']->fetch_array($RefLinksRAW)) { $RefLinks[$RefRow['id']] = array('username' => $RefRow['username'], 'points' => min($RefRow['total_points'], Config::get('ref_minpoints'))); } } if ($USER['total_rank'] == 0) { $rankInfo = "-"; } else { $rankInfo = sprintf($LNG['ov_userrank_info'], pretty_number($USER['total_points']), $LNG['ov_place'], $USER['total_rank'], $USER['total_rank'], $LNG['ov_of'], Config::get('users_amount')); } if ($USER['total_rank'] == 0) { $userRank = "-"; $userTotal = Config::get('users_amount'); } else { $userRank = $USER['total_rank']; $userTotal = Config::get('users_amount'); } $AllFeeds = array(); $GetAll = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_newsfeed` WHERE accepted = '1' AND valid_until > " . TIMESTAMP . " ORDER BY date DESC LIMIT 6;"); if ($GLOBALS['DATABASE']->numRows($GetAll) > 0) { while ($x = $GLOBALS['DATABASE']->fetch_array($GetAll)) { $AllFeeds[] = $x; } } $allianceData = $GLOBALS['DATABASE']->query("SELECT DISTINCT a.*, s.total_rank, s.total_points FROM " . ALLIANCE . " as a\n INNER JOIN " . STATPOINTS . " as s ON a.id = s.id_owner\n WHERE `universe` = 1 AND `id` = " . $USER['ally_id'] . ";"); $Total_alliance = $GLOBALS['DATABASE']->query("SELECT COUNT(id) FROM " . ALLIANCE . ";"); $Total_alliance = $GLOBALS['DATABASE']->fetch_array($Total_alliance); $ally_tag = $this->getAllianceTag($USER['ally_id']); $ally_name = $this->getAllianceName($USER['ally_id']); $ally_members = ''; $ally_points = ''; $ally_rank = ''; if ($GLOBALS['DATABASE']->numRows($allianceData) > 0) { while ($as = $GLOBALS['DATABASE']->fetch_array($allianceData)) { $ally_members = $as['ally_members']; $ally_points = pretty_number($as['total_points']); $ally_rank = $as['total_rank']; } } $statinfo = $GLOBALS['DATABASE']->query("SELECT s.total_points, s.popu_points, s.defs_points, s.build_points, s.fleet_points, s.tech_points, s.total_old_rank, s.total_rank, h.history_total_points FROM " . USERS . " as u \n\t\t\tLEFT JOIN " . STATPOINTS . " as s ON s.id_owner = u.id AND s.stat_type = '1'\n\t\t\tLEFT JOIN " . STATHISTORY . " as h ON h.id_owner = u.id WHERE id = " . $USER['id'] . ";"); while ($game = $GLOBALS['DATABASE']->fetch_array($statinfo)) { $ranking = $game['total_old_rank'] - $game['total_rank']; $totalo = $game['total_points'] - $game['history_total_points']; $totalP = $game['total_points']; $totalBuild = $game['build_points']; $totalResearch = $game['tech_points']; $totalFleet = $game['fleet_points']; $totalDefense = $game['defs_points']; $totalPopu = $game['popu_points']; if ($ranking == 0) { $position = "<span style='color:orange'>0"; } elseif ($ranking < 0) { $position = "<img src='media/ingame/image/diminue.png' /><span style='color:rouge'>(" . $ranking . ")"; } elseif ($ranking > 0) { $position = "<img src='media/ingame/image/augmente.png' /><span style='color:vert'>(+" . $ranking . ")"; } if ($totalo == 0) { $positionP = "<span style='color:orange'>0"; } elseif ($totalo < 0) { $positionP = "<img src='media/ingame/image/diminue.png' /><span style='color:rouge'> (" . pretty_number($totalo) . ")"; } elseif ($totalo > 0) { $positionP = "<img src='media/ingame/image/augmente.png' /><span style='color:vert'> (+" . pretty_number($totalo) . ")"; } } $post = $position; $postP = $positionP; $GetAll99 = $GLOBALS['DATABASE']->query("SELECT id FROM " . PLANETS . " WHERE id != " . $PLANET['id'] . " AND id_owner = " . $USER['id'] . " AND destruyed = '0' ;"); $GetAll99 = $GLOBALS['DATABASE']->numRows($GetAll99); $fleetCount = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . FLEETS . " WHERE fleet_owner = '" . $USER['id'] . "' OR fleet_target_owner = '" . $USER['id'] . "' AND hasCanceled = '0' AND fleet_mess = '0' AND fleet_mission != '8';"); $defcontext = ''; $defcon = ''; if ($USER['ally_id'] != 0) { $textar = $GLOBALS['DATABASE']->query("SELECT defcon FROM " . ALLIANCE . " WHERE id = " . $USER['ally_id'] . " ;"); while ($x = $GLOBALS['DATABASE']->fetch_array($textar)) { $defcontext = ''; $defcon = $x['defcon']; if ($x['defcon'] == 5) { $defcontext = 'Normal preparation in peacetime'; } elseif ($x['defcon'] == 4) { $defcontext = 'Normal preparation, but increased and enhanced information security measures'; //vert } elseif ($x['defcon'] == 3) { $defcontext = 'Increased preparation of forces beyond the normal preparation'; //jaune } elseif ($x['defcon'] == 2) { $defcontext = 'Further increase in the preparation of forces, but less than the maximum preparation'; //oramnge } elseif ($x['defcon'] == 1) { $defcontext = 'State of War: Maximum forces Preparation'; //rouge } } } $GeTransportCount = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM `uni1_transport_player` WHERE senderID = " . $USER['id'] . " AND legal = '1' OR receiverID = " . $USER['id'] . " AND legal = '1';"); //Bank Config if ($CONF['newbank'] < TIMESTAMP) { $Info = $GLOBALS['DATABASE']->query("SELECT taxe_metal, new_taxe_metal, taxe_crystal, new_taxe_crystal, taxe_deuterium, new_taxe_deuterium, taxe_elyrium, new_taxe_elyrium FROM `uni1_config` WHERE uni = '1';"); $Info = $GLOBALS['DATABASE']->fetch_array($Info); $NewMet = $Info['taxe_metal'] + $Info['new_taxe_metal']; $NewCryt = $Info['taxe_crystal'] + $Info['new_taxe_crystal']; $NewDeut = $Info['taxe_deuterium'] + $Info['new_taxe_deuterium']; $NewElyr = $Info['taxe_elyrium'] + $Info['new_taxe_elyrium']; $GLOBALS['DATABASE']->query("UPDATE " . CONFIG . " SET taxe_metal = '" . $NewMet . "', taxe_crystal = '" . $NewCryt . "', taxe_deuterium = '" . $NewDeut . "', taxe_elyrium = '" . $NewElyr . "', new_taxe_metal = '0', new_taxe_crystal = '0', new_taxe_deuterium = '0', new_taxe_elyrium = '0', newbank = newbank + '" . (TIMESTAMP + 3600 * 24) . "';"); } $this->tplObj->assign_vars(array('avatar' => $USER['avatar'], 'totalP' => pretty_number($totalP), 'totalBuild' => pretty_number($totalBuild), 'totalResearch' => pretty_number($totalResearch), 'totalFleet' => pretty_number($totalFleet), 'totalDefense' => pretty_number($totalDefense), 'totalPopu' => pretty_number($totalPopu), 'GetAll99' => $GetAll99, 'fleetCount' => $fleetCount, 'defcontext' => $defcontext, 'defcon' => $defcon, 'overmessage' => $overmessage, 'postal' => $post, 'postalP' => $postP, 'userRank' => $userRank, 'GeTransportCount' => $GeTransportCount, 'userTotal' => $userTotal, 'Total_alliance' => (int) $Total_alliance, 'ally_tag' => $ally_tag, 'ally_rank' => $ally_rank, 'ally_points' => $ally_points, 'ally_members' => $ally_members, 'ally_name' => $ally_name, 'rankInfo' => $rankInfo, 'userally' => $USER['ally_id'], 'AllFeeds' => $AllFeeds, 'is_news' => Config::get('OverviewNewsFrame'), 'news' => makebr(Config::get('OverviewNewsText')), 'planetname' => $PLANET['name'], 'planetimage' => $PLANET['image'], 'cokies' => isset($_COOKIE['salle_de_controle-detail_statistique']) ? $_COOKIE['salle_de_controle-detail_statistique'] : 'false', 'galaxy' => $PLANET['galaxy'], 'system' => $PLANET['system'], 'planet' => $PLANET['planet'], 'planet_type' => $PLANET['planet_type'], 'username' => $USER['username'], 'userid' => $USER['id'], 'allyID' => $USER['ally_id'], 'buildInfo' => $buildInfo, 'Moon' => $Moon, 'fleets' => $this->GetFleets(), 'AllPlanets' => $AllPlanets, 'AdminsOnline' => $AdminsOnline, 'teamspeakData' => $this->GetTeamspeakData(), 'messages' => $Messages > 0 ? $Messages == 1 ? $LNG['ov_have_new_message'] : sprintf($LNG['ov_have_new_messages'], pretty_number($Messages)) : false, 'planet_diameter' => pretty_number($PLANET['diameter']), 'teleport_portal' => $PLANET['teleport_portal'], 'force_field' => $PLANET['force_field_timer'], 'siege_active' => $PLANET['siege_on'], 'planet_field_current' => $PLANET['field_current'], 'planet_field_max' => CalculateMaxPlanetFields($PLANET), 'planet_temp_min' => $PLANET['temp_min'], 'planet_temp_max' => $PLANET['temp_max'], 'ref_active' => Config::get('ref_active'), 'ref_minpoints' => Config::get('ref_minpoints'), 'RefLinks' => $RefLinks, 'path' => HTTP_PATH, 'trem' => TIMESTAMP, 'taxe_metal' => $CONF['taxe_metal'], 'taxe_crystal' => $CONF['taxe_crystal'], 'taxe_deuterium' => $CONF['taxe_deuterium'], 'taxe_elyrium' => $CONF['taxe_elyrium'])); $this->display('page.overview.default.tpl'); }
function show() { global $LNG, $PLANET, $USER; $AdminsOnline = array(); $chatOnline = array(); $AllPlanets = array(); $Moon = array(); $RefLinks = array(); $db = Database::get(); foreach ($USER['PLANETS'] as $ID => $CPLANET) { if ($ID == $PLANET['id'] || $CPLANET['planet_type'] == 3) { continue; } if (!empty($CPLANET['b_building']) && $CPLANET['b_building'] > TIMESTAMP) { $Queue = unserialize($CPLANET['b_building_id']); $BuildPlanet = $LNG['tech'][$Queue[0][0]] . " (" . $Queue[0][1] . ")<br><span style=\"color:#7F7F7F;\">(" . pretty_time($Queue[0][3] - TIMESTAMP) . ")</span>"; } else { $BuildPlanet = $LNG['ov_free']; } $AllPlanets[] = array('id' => $CPLANET['id'], 'name' => $CPLANET['name'], 'image' => $CPLANET['image'], 'build' => $BuildPlanet); } if ($PLANET['id_luna'] != 0) { $sql = "SELECT id, name FROM %%PLANETS%% WHERE id = :lunaID;"; $Moon = $db->selectSingle($sql, array(':lunaID' => $PLANET['id_luna'])); } if ($PLANET['b_building'] - TIMESTAMP > 0) { $Queue = unserialize($PLANET['b_building_id']); $buildInfo['buildings'] = array('id' => $Queue[0][0], 'level' => $Queue[0][1], 'timeleft' => $PLANET['b_building'] - TIMESTAMP, 'time' => $PLANET['b_building'], 'starttime' => pretty_time($PLANET['b_building'] - TIMESTAMP)); } else { $buildInfo['buildings'] = false; } /* As FR#206 (http://tracker.2moons.cc/view.php?id=206), i added the shipyard and research status here, but i add not them the template. */ if (!empty($PLANET['b_hangar_id'])) { $Queue = unserialize($PLANET['b_hangar_id']); $time = BuildFunctions::getBuildingTime($USER, $PLANET, $Queue[0][0]) * $Queue[0][1]; $buildInfo['fleet'] = array('id' => $Queue[0][0], 'level' => $Queue[0][1], 'timeleft' => $time - $PLANET['b_hangar'], 'time' => $time, 'starttime' => pretty_time($time - $PLANET['b_hangar'])); } else { $buildInfo['fleet'] = false; } if ($USER['b_tech'] - TIMESTAMP > 0) { $Queue = unserialize($USER['b_tech_queue']); $buildInfo['tech'] = array('id' => $Queue[0][0], 'level' => $Queue[0][1], 'timeleft' => $USER['b_tech'] - TIMESTAMP, 'time' => $USER['b_tech'], 'starttime' => pretty_time($USER['b_tech'] - TIMESTAMP)); } else { $buildInfo['tech'] = false; } $sql = "SELECT id,username FROM %%USERS%% WHERE universe = :universe AND onlinetime >= :onlinetime AND authlevel > :authlevel;"; $onlineAdmins = $db->select($sql, array(':universe' => Universe::current(), ':onlinetime' => TIMESTAMP - 10 * 60, ':authlevel' => AUTH_USR)); foreach ($onlineAdmins as $AdminRow) { $AdminsOnline[$AdminRow['id']] = $AdminRow['username']; } $sql = "SELECT userName FROM %%CHAT_ON%% WHERE dateTime > DATE_SUB(NOW(), interval 2 MINUTE) AND channel = 0"; $chatUsers = $db->select($sql); foreach ($chatUsers as $chatRow) { $chatOnline[] = $chatRow['userName']; } $Messages = $USER['messages']; // Fehler: Wenn Spieler gelöscht werden, werden sie nicht mehr in der Tabelle angezeigt. $sql = "SELECT u.id, u.username, s.total_points FROM %%USERS%% as u\n\t\tLEFT JOIN %%STATPOINTS%% as s ON s.id_owner = u.id AND s.stat_type = '1' WHERE ref_id = :userID;"; $RefLinksRAW = $db->select($sql, array(':userID' => $USER['id'])); $config = Config::get(); if ($config->ref_active) { foreach ($RefLinksRAW as $RefRow) { $RefLinks[$RefRow['id']] = array('username' => $RefRow['username'], 'points' => min($RefRow['total_points'], $config->ref_minpoints)); } } $sql = 'SELECT total_points, total_rank FROM %%STATPOINTS%% WHERE id_owner = :userId AND stat_type = :statType'; $statData = Database::get()->selectSingle($sql, array(':userId' => $USER['id'], ':statType' => 1)); if ($statData['total_rank'] == 0) { $rankInfo = "-"; } else { $rankInfo = sprintf($LNG['ov_userrank_info'], pretty_number($statData['total_points']), $LNG['ov_place'], $statData['total_rank'], $statData['total_rank'], $LNG['ov_of'], $config->users_amount); } $this->assign(array('rankInfo' => $rankInfo, 'is_news' => $config->OverviewNewsFrame, 'news' => makebr($config->OverviewNewsText), 'planetname' => $PLANET['name'], 'planetimage' => $PLANET['image'], 'galaxy' => $PLANET['galaxy'], 'system' => $PLANET['system'], 'planet' => $PLANET['planet'], 'planet_type' => $PLANET['planet_type'], 'username' => $USER['username'], 'userid' => $USER['id'], 'buildInfo' => $buildInfo, 'Moon' => $Moon, 'fleets' => $this->GetFleets(), 'AllPlanets' => $AllPlanets, 'AdminsOnline' => $AdminsOnline, 'teamspeakData' => $this->GetTeamspeakData(), 'messages' => $Messages > 0 ? $Messages == 1 ? $LNG['ov_have_new_message'] : sprintf($LNG['ov_have_new_messages'], pretty_number($Messages)) : false, 'planet_diameter' => pretty_number($PLANET['diameter']), 'planet_field_current' => $PLANET['field_current'], 'planet_field_max' => CalculateMaxPlanetFields($PLANET), 'planet_temp_min' => $PLANET['temp_min'], 'planet_temp_max' => $PLANET['temp_max'], 'ref_active' => $config->ref_active, 'ref_minpoints' => $config->ref_minpoints, 'RefLinks' => $RefLinks, 'chatOnline' => $chatOnline, 'servertime' => _date("M D d H:i:s", TIMESTAMP, $USER['timezone']), 'path' => HTTP_PATH)); $this->display('page.overview.default.tpl'); }
public function show() { global $PLANET, $USER, $LNG, $resource, $reslist, $CONF, $pricelist; $TheCommand = HTTP::_GP('cmd', ''); $Element = HTTP::_GP('tech', 0); $ListID = HTTP::_GP('listid', 0); $lvlup1 = HTTP::_GP('lvlup1', 0); $PLANET[$resource[31] . '_inter'] = ResourceUpdate::getNetworkLevel($USER, $PLANET); if (!empty($TheCommand) && $_SERVER['REQUEST_METHOD'] === 'POST' && $USER['urlaubs_modus'] == 0) { switch ($TheCommand) { case 'cancel': $this->CancelBuildingFromQueue(); break; case 'remove': $this->RemoveBuildingFromQueue($ListID); break; case 'instant': $this->InstantBuildingFromQueue(); break; case 'insert': $this->AddBuildingToQueue($Element, $lvlup1, true); break; case 'destroy': $this->DoAddBuildingToQueue($Element, false); break; } $this->redirectTo('game.php?page=research'); } $bContinue = $this->CheckLabSettingsInQueue($PLANET); $queueData = $this->getQueueData(); $TechQueue = $queueData['queue']; $QueueCount = count($TechQueue); $ResearchList = array(); foreach ($reslist['tech'] as $ID => $Element) { $AllTech = array(); $GetAll = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_vars_requriements` WHERE elementID = " . $Element . " ;"); if ($GLOBALS['DATABASE']->numRows($GetAll) > 0) { while ($x = $GLOBALS['DATABASE']->fetch_array($GetAll)) { $AllTech[] = $x; } } if (isset($queueData['quickinfo'][$Element])) { $levelToBuild = $queueData['quickinfo'][$Element]; } else { $levelToBuild = $USER[$resource[$Element]]; } $costRessources = BuildFunctions::getElementPrice($USER, $PLANET, $Element, false, $levelToBuild); $costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costRessources); $elementTime = BuildFunctions::getBuildingTime($USER, $PLANET, $Element, $costRessources); $buyable = $QueueCount != 0 || BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costRessources); $ResearchList[$Element] = array('id' => $Element, 'level' => $USER[$resource[$Element]], 'factor' => $pricelist[$Element]['factor'], 'maxLevel' => $pricelist[$Element]['max'], 'costRessources' => $costRessources, 'costOverflow' => $costOverflow, 'elementTime' => $elementTime, 'buyable' => $buyable, 'levelToBuild' => $levelToBuild, 'AllTech' => $AllTech, 'techacc' => BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element)); } $this->tplObj->loadscript('research.js'); $premium_stage = 0; if ($USER['premium_reward_stage'] > 0 && $USER['premium_reward_stage_days'] > TIMESTAMP) { $premium_stage = $USER['premium_reward_stage']; } $manual_step_5 = 1; if ($USER['training'] == 0 && $USER['training_step'] == 5 && $PLANET['laboratory'] < 3) { $manual_step_5 = 0; } $manual_step_5_1 = 1; if ($USER['training'] == 0 && $USER['training_step'] == 5 && $PLANET['laboratory'] >= 3) { $manual_step_5_1 = 0; } $manual_step_6 = 1; if ($USER['training'] == 0 && $USER['training_step'] == 6) { $manual_step_6 = 0; } $manual_step_6_1 = 1; $manual_step_7 = 1; if ($USER['training'] == 0 && $USER['training_step'] == 6 && $USER['spy_tech'] >= 3) { $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET `training_step` = '8' WHERE `id` = " . $USER['id'] . ";"); $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET `experience_peace` = `experience_peace` + '650' WHERE `id` = " . $USER['id'] . ";"); $manual_step_7 = 0; } $manual_step_9 = 1; if ($USER['training'] == 0 && $USER['training_step'] == 9) { $manual_step_9 = 0; } $manual_step_16 = 1; if ($USER['training'] == 0 && $USER['training_step'] == 16) { $manual_step_16 = 0; } $this->tplObj->assign_vars(array('manual_step_5_1' => $manual_step_5_1, 'manual_step_16' => $manual_step_16, 'manual_step_5' => $manual_step_5, 'manual_step_9' => $manual_step_9, 'manual_step_6' => $manual_step_6, 'dmavaible' => $USER['darkmatter'], 'modinstant' => $CONF['modinstant'], 'mod_research_cost' => $CONF['modinstantresearch'], 'modinstantresen' => $CONF['modinstantresen'], 'manual_step_7' => $manual_step_7, 'ResearchList' => $ResearchList, 'IsLabinBuild' => !$bContinue, 'IsFullQueue' => Config::get('max_elements_tech') == 0 || Config::get('max_elements_tech') + $premium_stage == count($TechQueue), 'Queue' => $TechQueue)); $this->display('page.research.default.tpl'); }
public function show() { global $ProdGrid, $LNG, $resource, $reslist, $PLANET, $USER, $pricelist; $TheCommand = HTTP::_GP('cmd', ''); // wellformed buildURLs if (!empty($TheCommand) && $_SERVER['REQUEST_METHOD'] === 'POST' && $USER['urlaubs_modus'] == 0) { $Element = HTTP::_GP('building', 0); $ListID = HTTP::_GP('listid', 0); switch ($TheCommand) { case 'cancel': $this->CancelBuildingFromQueue(); break; case 'remove': $this->RemoveBuildingFromQueue($ListID); break; case 'insert': $this->AddBuildingToQueue($Element, true); break; case 'destroy': $this->AddBuildingToQueue($Element, false); break; } $this->redirectTo('game.php?page=buildings'); } $config = Config::get(); $queueData = $this->getQueueData(); $Queue = $queueData['queue']; $QueueCount = count($Queue); $CanBuildElement = isVacationMode($USER) || $config->max_elements_build == 0 || $QueueCount < $config->max_elements_build; $CurrentMaxFields = CalculateMaxPlanetFields($PLANET); $RoomIsOk = $PLANET['field_current'] < $CurrentMaxFields - $QueueCount; $BuildEnergy = $USER[$resource[113]]; $BuildLevelFactor = 10; $BuildTemp = $PLANET['temp_max']; $BuildInfoList = array(); $Elements = $reslist['allow'][$PLANET['planet_type']]; foreach ($Elements as $Element) { if (!BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element)) { continue; } $infoEnergy = ""; if (isset($queueData['quickinfo'][$Element])) { $levelToBuild = $queueData['quickinfo'][$Element]; } else { $levelToBuild = $PLANET[$resource[$Element]]; } if (in_array($Element, $reslist['prod'])) { $BuildLevel = $PLANET[$resource[$Element]]; $Need = eval(ResourceUpdate::getProd($ProdGrid[$Element]['production'][911])); $BuildLevel = $levelToBuild + 1; $Prod = eval(ResourceUpdate::getProd($ProdGrid[$Element]['production'][911])); $requireEnergy = $Prod - $Need; $requireEnergy = round($requireEnergy * $config->energySpeed); if ($requireEnergy < 0) { $infoEnergy = sprintf($LNG['bd_need_engine'], pretty_number(abs($requireEnergy)), $LNG['tech'][911]); } else { $infoEnergy = sprintf($LNG['bd_more_engine'], pretty_number(abs($requireEnergy)), $LNG['tech'][911]); } } $costResources = BuildFunctions::getElementPrice($USER, $PLANET, $Element, false, $levelToBuild); $costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costResources); $elementTime = BuildFunctions::getBuildingTime($USER, $PLANET, $Element, $costResources); $destroyResources = BuildFunctions::getElementPrice($USER, $PLANET, $Element, true); $destroyTime = BuildFunctions::getBuildingTime($USER, $PLANET, $Element, $destroyResources); $destroyOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $destroyResources); $buyable = $QueueCount != 0 || BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costResources); $BuildInfoList[$Element] = array('level' => $PLANET[$resource[$Element]], 'maxLevel' => $pricelist[$Element]['max'], 'infoEnergy' => $infoEnergy, 'costResources' => $costResources, 'costOverflow' => $costOverflow, 'elementTime' => $elementTime, 'destroyResources' => $destroyResources, 'destroyTime' => $destroyTime, 'destroyOverflow' => $destroyOverflow, 'buyable' => $buyable, 'levelToBuild' => $levelToBuild); } if ($QueueCount != 0) { $this->tplObj->loadscript('buildlist.js'); } $this->assign(array('BuildInfoList' => $BuildInfoList, 'CanBuildElement' => $CanBuildElement, 'RoomIsOk' => $RoomIsOk, 'Queue' => $Queue, 'isBusy' => array('shipyard' => !empty($PLANET['b_hangar_id']), 'research' => $USER['b_tech_planet'] != 0), 'HaveMissiles' => (bool) $PLANET[$resource[503]] + $PLANET[$resource[502]])); $this->display('page.buildings.default.tpl'); }
public function show() { global $ProdGrid, $LNG, $resource, $reslist, $CONF, $PLANET, $USER, $pricelist; $TheCommand = HTTP::_GP('cmd', ''); $mode = HTTP::_GP('cmdd', 'build'); // wellformed buildURLs if (!empty($TheCommand) && $_SERVER['REQUEST_METHOD'] === 'POST' && $USER['urlaubs_modus'] == 0) { $Element = HTTP::_GP('building', 0); $ListID = HTTP::_GP('listid', 0); switch ($TheCommand) { case 'cancel': $this->CancelBuildingFromQueue(); break; case 'remove': $this->RemoveBuildingFromQueue($ListID); break; case 'insert': $this->AddBuildingToQueue($Element, true); break; case 'destroy': $this->AddBuildingToQueue($Element, false); break; } $this->redirectTo('game.php?page=buildings&cmdd=' . $mode . ''); } $queueData = $this->getQueueData(); $Queue = $queueData['queue']; $QueueCount = count($Queue); $max_build = Config::get('max_elements_build'); if ($USER['mode_chaine'] > TIMESTAMP) { $max_build += 2; } $CanBuildElement = isVacationMode($USER) || $max_build == 0 || $QueueCount < $max_build; $CurrentMaxFields = CalculateMaxPlanetFields($PLANET); $RoomIsOk = $PLANET['field_current'] < $CurrentMaxFields - $QueueCount; $BuildEnergy = $USER[$resource[113]]; $BuildLevelFactor = 10; $BuildTemp = $PLANET['temp_max']; $BuildInfoList = array(); if ($mode == 'hangars') { $Elements = array(22, 23, 24, 25); } elseif ($mode == 'militar') { $Elements = array(45, 21, 46, 14, 31, 5, 33, 47); } else { $Elements = array(4, 10, 1, 2, 3, 48, 7, 8, 9, 11); } foreach ($Elements as $ID => $Element) { $AllTech = array(); $GetAll = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_vars_requriements` WHERE elementID = " . $Element . " ;"); if ($GLOBALS['DATABASE']->numRows($GetAll) > 0) { while ($x = $GLOBALS['DATABASE']->fetch_array($GetAll)) { $AllTech[] = $x; } } $infoEnergy = ""; if (isset($queueData['quickinfo'][$Element])) { $levelToBuild = $queueData['quickinfo'][$Element]; } else { $levelToBuild = $PLANET[$resource[$Element]]; } if (in_array($Element, $reslist['prod'])) { $BuildLevel = $PLANET[$resource[$Element]]; $Need = round(eval(ResourceUpdate::getProd($ProdGrid[$Element]['production'][911]))); $BuildLevel = $levelToBuild + 1; $Prod = round(eval(ResourceUpdate::getProd($ProdGrid[$Element]['production'][911]))); $requireEnergy = $Prod - $Need; if ($requireEnergy < 0) { $infoEnergy = sprintf($LNG['bd_need_engine'], pretty_number(abs($requireEnergy)), $LNG['tech'][911]); } else { $infoEnergy = sprintf($LNG['bd_more_engine'], pretty_number(abs($requireEnergy)), $LNG['tech'][911]); } } $costRessources = BuildFunctions::getElementPrice($USER, $PLANET, $Element, false, $levelToBuild); $costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costRessources); $elementTime = BuildFunctions::getBuildingTime($USER, $PLANET, $Element, $costRessources); $destroyRessources = BuildFunctions::getElementPrice($USER, $PLANET, $Element, true); $destroyTime = BuildFunctions::getBuildingTime($USER, $PLANET, $Element, $destroyRessources); $destroyOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $destroyRessources); $buyable = $QueueCount != 0 || BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costRessources); $BuildInfoList[$Element] = array('level' => $PLANET[$resource[$Element]], 'maxLevel' => $pricelist[$Element]['max'], 'infoEnergy' => $infoEnergy, 'costRessources' => $costRessources, 'costOverflow' => $costOverflow, 'elementTime' => $elementTime, 'destroyRessources' => $destroyRessources, 'destroyTime' => $destroyTime, 'destroyOverflow' => $destroyOverflow, 'buyable' => $buyable, 'levelToBuild' => $levelToBuild, 'AllTech' => $AllTech, 'techacc' => BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element)); } if ($QueueCount != 0) { $this->tplObj->loadscript('buildlist.js'); } $Tab = 'Energy & resources'; if ($mode == 'build') { $Tab = 'Energy & resources'; } elseif ($mode == 'hangars') { $Tab = 'Storages'; } elseif ($mode == 'militar') { $Tab = 'Military & science'; } $this->tplObj->assign_vars(array('Tab' => $Tab, 'BuildInfoList' => $BuildInfoList, 'CanBuildElement' => $CanBuildElement, 'RoomIsOk' => $RoomIsOk, 'Queue' => $Queue, 'isBusy' => array('shipyard' => !empty($PLANET['b_hangar_id']), 'research' => $USER['b_tech_planet'] != 0), 'HaveMissiles' => (bool) $PLANET[$resource[503]] + $PLANET[$resource[502]], 'mode' => $mode)); $this->display('page.buildings.default.tpl'); }