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, $UNI, $resource, $reslist, $CONF, $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 'insert': $this->AddBuildingToQueue($Element, true); break; } $this->redirectTo('game.php?page=dmbuild'); } $premium_stage = 0; if ($USER['premium_reward_stage'] > 0 && $USER['premium_reward_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') == 0 || $QueueCount < Config::get('max_elements_build') + $premium_stage; $CurrentMaxFields = CalculateMaxPlanetFields($PLANET); $RoomIsOk = $PLANET['field_current'] < $CurrentMaxFields - $QueueCount; $BuildEnergy = $USER[$resource[113]]; $BuildLevelFactor = 10; $BuildTemp = $PLANET['temp_max']; $BuildInfoList = array(); if ($PLANET['planet_type'] == 1) { $Elements = $reslist['allow'][$PLANET['planet_type']]; } elseif ($PLANET['planet_type'] == 3) { $Elements = array(14, 15, 21, 22, 23, 24, 41, 42, 43); } foreach ($Elements as $ID => $Element) { if (!BuildFunctions::isBusyToBuild($USER, $PLANET, $Element)) { continue; } $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'])) { $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; $peacefull_resource = 0; if ($USER['experience_peace_level'] > 0) { $peacefull_resource = $USER['experience_peace_level']; } $peacefull_resource = $peacefull_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 = round(max(1, ($pricelist[$Element]['cost']['901'] + $pricelist[$Element]['cost']['902'] + $pricelist[$Element]['cost']['903']) * pow($pricelist[$Element]['factor'], $PLANET[$resource[$Element]]) / 5000)); $elementTime = 0; $BuildInfoList[$Element] = array('level' => $PLANET[$resource[$Element]], 'maxLevel' => $pricelist[$Element]['max'], 'infoEnergy' => $infoEnergy, 'costRessources' => pretty_number($costRessources), 'techacc' => BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element), 'elementTime' => $elementTime, 'levelToBuild' => $levelToBuild, 'AllTech' => $AllTech); } $this->tplObj->loadscript('buildlist.js'); $this->tplObj->assign_vars(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]], '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.dmbuild.default.tpl'); }
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 $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'); }