Exemplo n.º 1
0
 function show()
 {
     global $USER, $PLANET, $LNG, $UNI, $CONF, $resource, $pricelist, $reslist, $CONF;
     if ($CONF['dmenabled'] == 0) {
         $this->printMessage("This add-on is disabled", true, array('game.php?page=overview', 2));
         die;
     }
     $this->tplObj->loadscript("dmfleet.js");
     if ($PLANET[$resource[21]] == 0) {
         $this->printMessage($LNG['bd_shipyard_required']);
     }
     if ($CONF['fleetconf'] > TIMESTAMP) {
         $elementIDs = array(401, 402, 403, 404, 405, 406, 410, 412, 413, 414, 416, 417, 418, 419, 420, 421, 422);
     } else {
         $elementIDs = array(401, 402, 403, 404, 405, 406, 410, 412, 413, 414, 416, 417, 418, 419);
     }
     foreach ($elementIDs as $Element) {
         if (!BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element)) {
             continue;
         }
         $elementList[$Element] = array('id' => $Element, 'available' => $PLANET[$resource[$Element]]);
     }
     $this->tplObj->assign_vars(array('elementList' => $elementList, 'ChargeDM' => self::$ChargeDM['defence'], 'ChargeDN' => self::$ChargeDN['fleets']));
     $this->display("page.dmdeff.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');
 }
Exemplo n.º 3
0
 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);
     }
 }
Exemplo n.º 4
0
 public function show()
 {
     global $PLANET, $USER, $UNI, $LNG, $resource, $reslist, $CONF, $pricelist;
     if ($PLANET[$resource[31]] == 0) {
         $this->printMessage($LNG['bd_lab_required']);
     }
     $TheCommand = HTTP::_GP('cmd', '');
     $Element = 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 'insert':
                 $this->AddBuildingToQueue($Element, true);
                 break;
         }
         $this->redirectTo('game.php?page=dmtech');
     }
     $bContinue = $this->CheckLabSettingsInQueue($PLANET);
     $queueData = $this->getQueueData();
     $TechQueue = $queueData['queue'];
     $QueueCount = count($TechQueue);
     $ResearchList = array();
     $Elements = array(106, 108, 109, 110, 111, 113, 114, 115, 117, 118, 120, 121, 122, 123, 124, 131, 132, 133);
     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;
             }
         }
         if (isset($queueData['quickinfo'][$Element])) {
             $levelToBuild = $queueData['quickinfo'][$Element];
         } else {
             $levelToBuild = $USER[$resource[$Element]];
         }
         $costRessources = max(1, ($pricelist[$Element]['cost']['901'] + $pricelist[$Element]['cost']['902'] * 2 + $pricelist[$Element]['cost']['903'] * 4) * pow($pricelist[$Element]['factor'], $USER[$resource[$Element]]) / 2500);
         $elementTime = 0;
         $ResearchList[$Element] = array('id' => $Element, 'level' => $USER[$resource[$Element]], 'maxLevel' => $pricelist[$Element]['max'], 'costRessources' => pretty_number($costRessources), 'levelToBuild' => $levelToBuild, 'techacc' => BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element), 'AllTech' => $AllTech);
     }
     $premium_stage = 0;
     if ($USER['premium_reward_stage'] > 0 && $USER['premium_reward_days'] > TIMESTAMP) {
         $premium_stage = $USER['premium_reward_stage'];
     }
     $this->tplObj->assign_vars(array('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.dmtech.default.tpl');
 }
Exemplo n.º 5
0
 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 function show()
 {
     global $USER, $CONF, $PLANET, $resource, $reslist, $LNG, $pricelist;
     $updateID = HTTP::_GP('id', 0);
     if (!empty($updateID) && $_SERVER['REQUEST_METHOD'] === 'POST' && $USER['urlaubs_modus'] == 0) {
         if (isModulAvalible(MODULE_OFFICIER) && in_array($updateID, $reslist['officier'])) {
             $this->UpdateOfficier($updateID);
         } elseif (isModulAvalible(MODULE_DMEXTRAS) && in_array($updateID, $reslist['dmfunc'])) {
             $this->UpdateExtra($updateID);
         }
     }
     $this->tplObj->loadscript('officier.js');
     $darkmatterList = array();
     $officierList = array();
     if (isModulAvalible(MODULE_DMEXTRAS)) {
         foreach ($reslist['dmfunc'] as $Element) {
             if ($USER[$resource[$Element]] > TIMESTAMP) {
                 $this->tplObj->execscript("GetOfficerTime(" . $Element . ", " . ($USER[$resource[$Element]] - TIMESTAMP) . ");");
             }
             $costRessources = BuildFunctions::getElementPrice($USER, $PLANET, $Element);
             $buyable = BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costRessources);
             $costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costRessources);
             $elementBonus = BuildFunctions::getAvalibleBonus($Element);
             $darkmatterList[$Element] = array('timeLeft' => max($USER[$resource[$Element]] - TIMESTAMP, 0), 'costRessources' => $costRessources, 'buyable' => $buyable, 'time' => $pricelist[$Element]['time'], 'costOverflow' => $costOverflow, 'elementBonus' => $elementBonus);
         }
     }
     if (isModulAvalible(MODULE_OFFICIER)) {
         foreach ($reslist['officier'] 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);
             $buyable = BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costRessources);
             $costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costRessources);
             $elementBonus = BuildFunctions::getAvalibleBonus($Element);
             $officierList[$Element] = array('level' => $USER[$resource[$Element]], 'maxLevel' => $pricelist[$Element]['max'], 'costRessources' => $costRessources, 'buyable' => $buyable, 'costOverflow' => $costOverflow, 'elementBonus' => $elementBonus, 'AllTech' => $AllTech, 'techacc' => BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element));
         }
     }
     $close_to = 1;
     if ($USER['rpg_geologue'] >= 1 && $USER['rpg_amiral'] >= 1 && $USER['training_step'] == 23) {
         $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET `training_step` = '24' WHERE `id` = " . $USER['id'] . ";");
         $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET `experience_peace` = `experience_peace` + '24' WHERE `id` = " . $USER['id'] . ";");
         $close_to = 0;
     }
     $manual_23_step = 1;
     if ($USER['training'] == 0 && $USER['training_step'] == 23 && $close_to == 1) {
         $manual_23_step = 0;
     }
     $this->tplObj->assign_vars(array('manual_23_step' => $manual_23_step, 'close_to' => $close_to, 'officierList' => $officierList, 'darkmatterList' => $darkmatterList, 'of_dm_trade' => sprintf($LNG['of_dm_trade'], $LNG['tech'][921])));
     $this->display('page.officier.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');
 }
Exemplo n.º 8
0
 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');
 }
Exemplo n.º 9
0
 public function show()
 {
     global $USER, $PLANET, $dpath, $LNG, $resource, $pricelist, $reslist, $CombatCaps, $ProdGrid, $CONF;
     $elementID = HTTP::_GP('id', 0);
     $AllTech = array();
     $GetAll = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_vars_requriements` WHERE elementID = " . $elementID . " ;");
     if ($GLOBALS['DATABASE']->numRows($GetAll) > 0) {
         while ($x = $GLOBALS['DATABASE']->fetch_array($GetAll)) {
             $AllTech[] = $x;
         }
     }
     $productionTable = array();
     $FleetInfo = array();
     $MissileList = array();
     $gateData = array();
     $CurrentLevel = 0;
     $ressIDs = array_merge(array(), $reslist['resstype'][1], $reslist['resstype'][2], $reslist['resstype'][4]);
     if (in_array($elementID, $reslist['prod']) && in_array($elementID, $reslist['build'])) {
         $BuildLevelFactor = 10;
         $BuildTemp = $PLANET['temp_max'];
         $CurrentLevel = $PLANET[$resource[$elementID]];
         $BuildEnergy = $USER[$resource[113]];
         $BuildLevel = max($CurrentLevel, 0);
         $BuildStartLvl = max($CurrentLevel - 0, 0);
         for ($BuildLevel = $BuildStartLvl; $BuildLevel < $BuildStartLvl + 8; $BuildLevel++) {
             foreach ($ressIDs as $ID) {
                 if (!isset($ProdGrid[$elementID]['production'][$ID])) {
                     continue;
                 }
                 $Production = eval(ResourceUpdate::getProd($ProdGrid[$elementID]['production'][$ID]));
                 if ($ID < 905) {
                     $Production *= Config::get('resource_multiplier');
                 }
                 $productionTable['production'][$BuildLevel][$ID] = $Production;
             }
         }
         $productionTable['usedResource'] = array_keys($productionTable['production'][$BuildStartLvl]);
     } elseif (in_array($elementID, $reslist['storage'])) {
         $BuildLevelFactor = 10;
         $BuildTemp = $PLANET['temp_max'];
         $CurrentLevel = $PLANET[$resource[$elementID]];
         $BuildEnergy = $USER[$resource[113]];
         $BuildLevel = max($CurrentLevel, 0);
         $BuildStartLvl = max($CurrentLevel - 0, 0);
         for ($BuildLevel = $BuildStartLvl; $BuildLevel < $BuildStartLvl + 8; $BuildLevel++) {
             foreach ($ressIDs as $ID) {
                 if (!isset($ProdGrid[$elementID]['storage'][$ID])) {
                     continue;
                 }
                 $productionTable['storage'][$BuildLevel][$ID] = round(eval(ResourceUpdate::getProd($ProdGrid[$elementID]['storage'][$ID]))) * Config::get('resource_multiplier') * STORAGE_FACTOR;
             }
         }
         $productionTable['usedResource'] = array_keys($productionTable['storage'][$BuildStartLvl]);
     } elseif (in_array($elementID, $reslist['fleet'])) {
         $MaxSpeed = 15000;
         $FleetInfo = array('structure' => ($pricelist[$elementID]['cost'][901] + $pricelist[$elementID]['cost'][902]) / 10, 'structureTech' => ($pricelist[$elementID]['cost'][901] + $pricelist[$elementID]['cost'][902]) / 10 * (1 + 0.1 * $USER['shield_tech'] + $USER['factor']['Shield']), 'tech' => $pricelist[$elementID]['tech'], 'attack' => $CombatCaps[$elementID]['attack'], 'attackTech' => $CombatCaps[$elementID]['attack'] * (1 + 0.1 * $USER['military_tech'] + $USER['factor']['Attack']) * (rand(80, 120) / 100), 'shield' => $CombatCaps[$elementID]['shield'], 'shieldTech' => $CombatCaps[$elementID]['shield'] * (1 + 0.1 * $USER['defence_tech'] + $USER['factor']['Defensive']), 'capacity' => $pricelist[$elementID]['capacity'], 'speed1' => 100 / 15000 * $pricelist[$elementID]['speed'], 'speed2' => $pricelist[$elementID]['speed2'], 'consumption1' => $pricelist[$elementID]['consumption'], 'consumption2' => $pricelist[$elementID]['consumption2'], 'rapidfire' => array('from' => array(), 'to' => array()));
         $fleetIDs = array_merge($reslist['fleet'], $reslist['defense']);
         foreach ($fleetIDs as $fleetID) {
             if (isset($CombatCaps[$elementID]['sd']) && !empty($CombatCaps[$elementID]['sd'][$fleetID])) {
                 $FleetInfo['rapidfire']['to'][$fleetID] = $CombatCaps[$elementID]['sd'][$fleetID];
             }
             if (isset($CombatCaps[$fleetID]['sd']) && !empty($CombatCaps[$fleetID]['sd'][$elementID])) {
                 $FleetInfo['rapidfire']['from'][$fleetID] = $CombatCaps[$fleetID]['sd'][$elementID];
             }
         }
     } elseif (in_array($elementID, $reslist['defense'])) {
         $FleetInfo = array('structure' => ($pricelist[$elementID]['cost'][901] + $pricelist[$elementID]['cost'][902]) / 10, 'structureTech' => ($pricelist[$elementID]['cost'][901] + $pricelist[$elementID]['cost'][902]) / 10 * (1 + 0.1 * $USER['shield_tech'] + $USER['factor']['Shield']), 'attack' => $CombatCaps[$elementID]['attack'], 'attackTech' => $CombatCaps[$elementID]['attack'] * (1 + 0.1 * $USER['military_tech'] + $USER['factor']['Attack']) * (rand(80, 120) / 100), 'shield' => $CombatCaps[$elementID]['shield'], 'shieldTech' => $CombatCaps[$elementID]['shield'] * (1 + 0.1 * $USER['defence_tech'] + $USER['factor']['Defensive']), 'capacity' => 0, 'speed1' => 0, 'rapidfire' => array('from' => array(), 'to' => array()));
         $fleetIDs = array_merge($reslist['fleet'], $reslist['defense']);
         foreach ($fleetIDs as $fleetID) {
             if (isset($CombatCaps[$elementID]['sd']) && !empty($CombatCaps[$elementID]['sd'][$fleetID])) {
                 $FleetInfo['rapidfire']['to'][$fleetID] = $CombatCaps[$elementID]['sd'][$fleetID];
             }
             if (isset($CombatCaps[$fleetID]['sd']) && !empty($CombatCaps[$fleetID]['sd'][$elementID])) {
                 $FleetInfo['rapidfire']['from'][$fleetID] = $CombatCaps[$fleetID]['sd'][$elementID];
             }
         }
     }
     if ($elementID == 43 && $PLANET[$resource[43]] > 0) {
         $this->tplObj->loadscript('gate.js');
         $nextTime = self::getNextJumpWaitTime($PLANET['last_jump_time']);
         $gateData = array('nextTime' => _date($LNG['php_tdformat'], $nextTime, $USER['timezone']), 'restTime' => max(0, $nextTime - TIMESTAMP), 'startLink' => $PLANET['name'] . ' ' . strip_tags(BuildPlanetAdressLink($PLANET)), 'gateList' => $this->getTargetGates(), 'fleetList' => $this->getAvalibleFleets());
     } elseif ($elementID == 44 && $PLANET[$resource[44]] > 0) {
         $MissileList = array(502 => $PLANET[$resource[502]], 503 => $PLANET[$resource[503]]);
     }
     $number = 1;
     $elementBonus = '';
     if ($LNG['gameeffect'][$elementID] != '') {
         $elementBonus = BuildFunctions::getAvalibleEffect($elementID);
     }
     if (!$elementBonus) {
         $number = 0;
     }
     $this->tplObj->assign_vars(array('planetinfo1' => $PLANET['metal_mine'], 'planetinfo2' => $PLANET['crystal_mine'], 'planetinfo3' => $PLANET['deuterium_sintetizer'], 'planetinfo4' => $PLANET['solar_plant'], 'planetinfo5' => $PLANET['headquarters_antaris'], 'planetinfo14' => $PLANET['robot_factory'], 'planetinfo21' => $PLANET['hangar'], 'planetinfo31' => $PLANET['laboratory'], 'planetinfo45' => $PLANET['barracks'], 'planetinfo46' => $PLANET['defense_base'], 'planetinfo48' => $PLANET['elyrium_mine'], 'planetinfo106' => $USER['spy_tech'], 'planetinfo109' => $USER['military_tech'], 'planetinfo110' => $USER['defence_tech'], 'planetinfo111' => $USER['shield_tech'], 'planetinfo113' => $USER['energy_tech'], 'planetinfo115' => $USER['combustion_tech'], 'planetinfo117' => $USER['impulse_motor_tech'], 'planetinfo118' => $USER['hyperspace_motor_tech'], 'planetinfo140' => $USER['extraction_tech'], 'planetinfo141' => $USER['control_room_tech'], 'planetinfo142' => $USER['subspace_tech'], 'planetinfo143' => $USER['particle_tech'], 'planetinfo144' => $USER['antaris_tech'], 'planetinfo145' => $USER['infrastructure_tech'], 'planetinfo146' => $USER['virus_tech'], 'number' => $number, 'elementBonus' => $elementBonus, 'elementID' => $elementID, 'productionTable' => $productionTable, 'CurrentLevel' => $CurrentLevel, 'MissileList' => $MissileList, 'Bonus' => BuildFunctions::getAvalibleBonus($elementID), 'FleetInfo' => $FleetInfo, 'gateData' => $gateData, 'AllTech' => $AllTech, 'techacc' => BuildFunctions::isTechnologieAccessible($USER, $PLANET, $elementID)));
     $this->display('page.infomation.default.tpl');
 }
Exemplo n.º 10
0
 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');
 }
Exemplo n.º 11
0
 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');
 }
Exemplo n.º 12
0
 function show()
 {
     global $USER, $PLANET, $LNG, $resource, $dpath, $reslist, $CONF;
     $elementIDs = $reslist['population'];
     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, false, false);
         $Produced = 0;
         $Cost = 0;
         if ($Element == 301) {
             $Cost = 1;
         } elseif ($Element == 302) {
             $Cost = 3;
         } elseif ($Element == 303) {
             $Cost = 4;
         } elseif ($Element == 304) {
             $Cost = 50;
         } elseif ($Element == 305) {
             $Cost = 20;
         } elseif ($Element == 306) {
             $Cost = 12;
         } elseif ($Element == 307) {
             $Cost = 44;
         } elseif ($Element == 308) {
             $Cost = 4;
         }
         if ($Element != 309) {
             $Produced = $PLANET[$resource[$Element] . '_prod'];
             $TotalCost = $Produced * $Cost;
         }
         $elementList[$Element] = array('amount' => pretty_number(round($PLANET[$resource[$Element]])), 'costRessources' => $costRessources, 'Produced' => $Produced, 'TotalCost' => $TotalCost, 'id' => $Element, 'AllTech' => $AllTech, 'techacc' => BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element));
     }
     $this->tplObj->loadscript("population.js");
     $this->tplObj->assign_vars(array('notused' => pretty_number($PLANET['formation'] - $PLANET['formation_used']), 'elementList' => $elementList, 'formation' => pretty_number($PLANET['formation']), 'formationBis' => $PLANET['formation']));
     $this->display('page.population.default.tpl');
 }
Exemplo n.º 13
0
 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');
 }
Exemplo n.º 14
0
 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');
 }
Exemplo n.º 15
0
 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');
 }
Exemplo n.º 16
0
 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');
 }
Exemplo n.º 17
0
 public function show()
 {
     global $USER, $PLANET, $resource, $reslist, $LNG, $pricelist;
     $updateID = HTTP::_GP('id', 0);
     if (!empty($updateID) && $_SERVER['REQUEST_METHOD'] === 'POST' && $USER['urlaubs_modus'] == 0) {
         if (isModulAvalible(MODULE_OFFICIER) && in_array($updateID, $reslist['officier'])) {
             $this->UpdateOfficier($updateID);
         } elseif (isModulAvalible(MODULE_DMEXTRAS) && in_array($updateID, $reslist['dmfunc'])) {
             $this->UpdateExtra($updateID);
         }
     }
     $darkmatterList = array();
     $officierList = array();
     if (isModulAvalible(MODULE_DMEXTRAS)) {
         foreach ($reslist['dmfunc'] as $Element) {
             if ($USER[$resource[$Element]] > TIMESTAMP) {
                 $this->tplObj->execscript("GetOfficerTime(" . $Element . ", " . ($USER[$resource[$Element]] - TIMESTAMP) . ");");
             }
             $costResources = BuildFunctions::getElementPrice($USER, $PLANET, $Element);
             $buyable = BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costResources);
             $costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costResources);
             $elementBonus = BuildFunctions::getAvalibleBonus($Element);
             $darkmatterList[$Element] = array('timeLeft' => max($USER[$resource[$Element]] - TIMESTAMP, 0), 'costResources' => $costResources, 'buyable' => $buyable, 'time' => $pricelist[$Element]['time'], 'costOverflow' => $costOverflow, 'elementBonus' => $elementBonus);
         }
     }
     if (isModulAvalible(MODULE_OFFICIER)) {
         foreach ($reslist['officier'] as $Element) {
             if (!BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element)) {
                 continue;
             }
             $costResources = BuildFunctions::getElementPrice($USER, $PLANET, $Element);
             $buyable = BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costResources);
             $costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costResources);
             $elementBonus = BuildFunctions::getAvalibleBonus($Element);
             $officierList[$Element] = array('level' => $USER[$resource[$Element]], 'maxLevel' => $pricelist[$Element]['max'], 'costResources' => $costResources, 'buyable' => $buyable, 'costOverflow' => $costOverflow, 'elementBonus' => $elementBonus);
         }
     }
     $this->assign(array('officierList' => $officierList, 'darkmatterList' => $darkmatterList, 'of_dm_trade' => sprintf($LNG['of_dm_trade'], $LNG['tech'][921])));
     $this->display('page.officier.default.tpl');
 }
Exemplo n.º 18
0
 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');
 }