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'); }