public function show()
 {
     global $USER, $PLANET, $resource, $pricelist, $reslist, $LNG;
     $targetGalaxy = HTTP::_GP('galaxy', (int) $PLANET['galaxy']);
     $targetSystem = HTTP::_GP('system', (int) $PLANET['system']);
     $targetPlanet = HTTP::_GP('planet', (int) $PLANET['planet']);
     $targetType = HTTP::_GP('type', (int) $PLANET['planet_type']);
     $mission = HTTP::_GP('target_mission', 0);
     $Fleet = array();
     $FleetRoom = 0;
     $allyInfo = $GLOBALS['DATABASE']->query("SELECT FleetCapa FROM `uni1_alliance` WHERE id = " . $USER['ally_id'] . ";");
     $allyInfo = $GLOBALS['DATABASE']->fetch_array($allyInfo);
     $listorder = array(210, 212, 202, 203, 204, 205, 229, 209, 206, 207, 208, 217, 215, 213, 211, 220, 224, 219, 223, 225, 226, 214, 216, 230, 227, 228, 222, 218, 221);
     foreach ($listorder as $id => $ShipID) {
         $amount = max(0, round(HTTP::_GP('ship' . $ShipID, 0.0, 0.0)));
         if ($amount < 1 || $ShipID == 212) {
             continue;
         }
         $Fleet[$ShipID] = $amount;
         $FleetRoom += $pricelist[$ShipID]['capacity'] * $amount;
         $FleetRoom += $FleetRoom / 100 * getbonusOneBis(1207, $USER['academy_1207']) + $FleetRoom / 100 * $allyInfo['FleetCapa'];
     }
     foreach ($Fleet as $Ship => $Count) {
         if ($Count > $PLANET[$resource[$Ship]]) {
             $this->printMessage($LNG['fl_not_all_ship_avalible']);
         }
     }
     $FleetRoom *= 1 + $USER['factor']['ShipStorage'];
     if (empty($Fleet)) {
         FleetFunctions::GotoFleetPage();
     }
     $FleetData = array('fleetroom' => floattostring($FleetRoom), 'gamespeed' => FleetFunctions::GetGameSpeedFactor(), 'fleetspeedfactor' => max(0, 1 + $USER['factor']['FlyTime']), 'planet' => array('galaxy' => $PLANET['galaxy'], 'system' => $PLANET['system'], 'planet' => $PLANET['planet'], 'planet_type' => $PLANET['planet_type']), 'maxspeed' => FleetFunctions::GetFleetMaxSpeed($Fleet, $USER), 'ships' => FleetFunctions::GetFleetShipInfo($Fleet, $USER), 'fleetMinDuration' => MIN_FLEET_TIME);
     $token = getRandomString();
     $_SESSION['fleet'][$token] = array('time' => TIMESTAMP, 'fleet' => $Fleet, 'fleetRoom' => $FleetRoom);
     $shortcutList = $this->GetUserShotcut();
     $colonyList = $this->GetColonyList();
     $ACSList = $this->GetAvalibleACS();
     if (!empty($shortcutList)) {
         $shortcutAmount = max(array_keys($shortcutList));
     } else {
         $shortcutAmount = 0;
     }
     $this->tplObj->loadscript('flotten.js');
     $this->tplObj->execscript('updateVars();FleetTime();window.setInterval("FleetTime()", 1000);');
     $this->tplObj->assign_vars(array('token' => $token, 'mission' => $mission, 'shortcutList' => $shortcutList, 'shortcutMax' => $shortcutAmount, 'colonyList' => $colonyList, 'ACSList' => $ACSList, 'galaxy' => $targetGalaxy, 'system' => $targetSystem, 'planet' => $targetPlanet, 'type' => $targetType, 'speedSelect' => FleetFunctions::$allowedSpeed, 'typeSelect' => array(1 => $LNG['type_planet'][1], 2 => $LNG['type_planet'][2], 3 => $LNG['type_planet'][3], 4 => $LNG['type_planet'][4]), 'fleetdata' => $FleetData));
     $this->display('page.fleetStep1.default.tpl');
 }
 public function show()
 {
     global $ProdGrid, $LNG, $resource, $reslist, $CONF, $PLANET, $USER, $pricelist;
     $buscarTick = $GLOBALS['DATABASE']->query("SELECT tick FROM " . CONFIG . "");
     $tickinicial = $GLOBALS['DATABASE']->fetch_array($buscarTick);
     $tickinicial = $tickinicial['tick'];
     $TheCommand = HTTP::_GP('cmd', '');
     // wellformed buildURLs
     if (!empty($TheCommand) && $_SERVER['REQUEST_METHOD'] === 'POST' && $USER['urlaubs_modus'] == 0) {
         $Element = HTTP::_GP('building', 0);
         $ListID = HTTP::_GP('listid', 0);
         $lvlup1 = HTTP::_GP('lvlup1', 0);
         switch ($TheCommand) {
             case 'cancel':
                 $this->CancelBuildingFromQueue();
                 break;
             case 'remove':
                 $this->RemoveBuildingFromQueue($ListID);
                 break;
             case 'insert':
                 $this->AddBuildingToQueue($Element, $lvlup1, true);
                 break;
             case 'destroy':
                 $this->DoAddBuildingToQueue($Element, false);
                 break;
         }
         $this->redirectTo('game.php?page=buildings');
     }
     $premium_stage = 0;
     if ($USER['premium_reward_stage'] > 0 && $USER['premium_reward_stage_days'] > TIMESTAMP) {
         $premium_stage = $USER['premium_reward_stage'];
     }
     $queueData = $this->getQueueData();
     $Queue = $queueData['queue'];
     $QueueCount = count($Queue);
     $CanBuildElement = isVacationMode($USER) || Config::get('max_elements_build') - 1 == 0 || $QueueCount < Config::get('max_elements_build') - 1 + $premium_stage;
     $CurrentMaxFields = CalculateMaxPlanetFields($PLANET);
     $RoomIsOk = $PLANET['field_current'] < $CurrentMaxFields - $QueueCount;
     $BuildEnergy = $USER[$resource[113]];
     $BuildLevelFactor = 10;
     $BuildTemp = $PLANET['temp_max'];
     $BuildInfoList = array();
     $Elements = $reslist['allow'][$PLANET['planet_type']];
     foreach ($Elements as $ID => $Element) {
         $AllTech = array();
         $GetAll = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_vars_requriements` WHERE elementID = " . $Element . " ;");
         if ($GLOBALS['DATABASE']->numRows($GetAll) > 0) {
             while ($x = $GLOBALS['DATABASE']->fetch_array($GetAll)) {
                 $AllTech[] = $x;
             }
         }
         $infoEnergy = "";
         if (isset($queueData['quickinfo'][$Element])) {
             $levelToBuild = $queueData['quickinfo'][$Element];
         } else {
             $levelToBuild = $PLANET[$resource[$Element]];
         }
         if (in_array($Element, $reslist['prod'])) {
             $peacefull_resource = 0;
             if ($USER['experience_peace_level'] > 0) {
                 $peacefull_resource = $USER['experience_peace_level'];
             }
             $peacefull_resource = $peacefull_resource;
             $premium_resource = 0;
             if ($USER['premium_reward_extraction'] > 0 && $USER['premium_reward_extraction_days'] > TIMESTAMP) {
                 $premium_resource = $USER['premium_reward_extraction'];
             }
             $premium_resource = $premium_resource;
             $combat_collider = 0;
             if ($USER['combat_reward_collider'] > 0) {
                 $combat_collider = $USER['combat_reward_collider'];
             }
             $combat_collider = $combat_collider;
             $academy_mines = 0;
             if ($USER['academy_1201'] > 0) {
                 $academy_mines = getbonusOneBis(1201, $USER['academy_1201']);
             }
             $academy_mines = $academy_mines;
             $daily_prod_bonus = 0;
             if ($USER['daily_produ'] > TIMESTAMP) {
                 $daily_prod_bonus = 30;
             }
             $daily_prod_bonus = $daily_prod_bonus;
             $academy_energy = 0;
             if ($USER['academy_1202'] > 0) {
                 $academy_energy = getbonusOneBis(1202, $USER['academy_1202']);
             }
             $academy_energy = $academy_energy;
             $academy_fusion = 0;
             if ($USER['academy_1209'] > 0) {
                 $academy_fusion = getbonusOneBis(1209, $USER['academy_1209']);
             }
             $academy_fusion = $academy_fusion;
             $academy_solar = 0;
             if ($USER['academy_1210'] > 0) {
                 $academy_solar = getbonusOneBis(1210, $USER['academy_1210']);
             }
             $academy_solar = $academy_solar;
             $allyInfo = $GLOBALS['DATABASE']->query("SELECT alliance_prod FROM `uni1_alliance` WHERE id = " . $USER['ally_id'] . ";");
             $allyInfo = $GLOBALS['DATABASE']->fetch_array($allyInfo);
             $alliance_prod = 0;
             if ($allyInfo['alliance_prod'] > 0) {
                 $alliance_prod = $allyInfo['alliance_prod'];
             }
             $alliance_prod = $alliance_prod;
             $BuildLevel = $PLANET[$resource[$Element]];
             $Need = round(eval(ResourceUpdate::getProd($ProdGrid[$Element]['production'][911])));
             $BuildLevel = $levelToBuild + 1;
             $Prod = round(eval(ResourceUpdate::getProd($ProdGrid[$Element]['production'][911])));
             $requireEnergy = $Prod - $Need;
             if ($requireEnergy < 0) {
                 $infoEnergy = sprintf($LNG['bd_need_engine'], pretty_number(abs($requireEnergy)), $LNG['tech'][911]);
             } else {
                 $infoEnergy = sprintf($LNG['bd_more_engine'], pretty_number(abs($requireEnergy)), $LNG['tech'][911]);
             }
         }
         $costRessources = BuildFunctions::getElementPrice($USER, $PLANET, $Element, false, $levelToBuild);
         $costOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $costRessources);
         $elementTime = BuildFunctions::getBuildingTime($USER, $PLANET, $Element, $costRessources);
         $destroyRessources = BuildFunctions::getElementPrice($USER, $PLANET, $Element, true);
         $destroyTime = BuildFunctions::getBuildingTime($USER, $PLANET, $Element, $destroyRessources);
         $destroyOverflow = BuildFunctions::getRestPrice($USER, $PLANET, $Element, $destroyRessources);
         $buyable = $QueueCount != 0 || BuildFunctions::isElementBuyable($USER, $PLANET, $Element, $costRessources);
         $BuildInfoList[$Element] = array('level' => $PLANET[$resource[$Element]], 'maxLevel' => $pricelist[$Element]['max'], 'factor' => $pricelist[$Element]['factor'], 'infoEnergy' => $infoEnergy, 'costRessources' => $costRessources, 'costOverflow' => $costOverflow, 'elementTime' => $elementTime, 'destroyRessources' => $destroyRessources, 'destroyTime' => $destroyTime, 'destroyOverflow' => $destroyOverflow, 'buyable' => $buyable, 'levelToBuild' => $levelToBuild, 'AllTech' => $AllTech, 'techacc' => BuildFunctions::isTechnologieAccessible($USER, $PLANET, $Element));
     }
     $this->tplObj->loadscript('buildlist.js');
     $manual_step_2 = 1;
     if ($USER['training'] == 0 && $USER['training_step'] == 2 && $PLANET['solar_plant'] < 1) {
         $manual_step_2 = 0;
     }
     $manual_step_2_1 = 1;
     if ($USER['training'] == 0 && $PLANET['solar_plant'] >= 1 && $USER['training_step'] == 2 && ($PLANET['metal_mine'] < 3 || $PLANET['crystal_mine'] < 2 || $PLANET['deuterium_sintetizer'] < 1)) {
         $manual_step_2_1 = 0;
     }
     $manual_step_2_2 = 1;
     if ($USER['training'] == 0 && $USER['training_step'] == 2 && $PLANET['metal_mine'] >= 3 && $PLANET['crystal_mine'] >= 2 && $PLANET['deuterium_sintetizer'] >= 1 && $PLANET['solar_plant'] < 4) {
         $manual_step_2_2 = 0;
     }
     $manual_step_2_3 = 1;
     if ($USER['training'] == 0 && $USER['training_step'] == 2 && $PLANET['metal_mine'] >= 3 && $PLANET['crystal_mine'] >= 2 && $PLANET['deuterium_sintetizer'] >= 1 && $PLANET['solar_plant'] >= 4) {
         $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET `training_step` = '3' WHERE `id` = " . $USER['id'] . ";");
         $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET `experience_peace` = `experience_peace` + '650' WHERE `id` = " . $USER['id'] . ";");
         $GLOBALS['DATABASE']->query("UPDATE " . PLANETS . " SET spy_sonde = spy_sonde + 5 WHERE id = 1;");
         // SEND PROBES FUNCTION HERE
         $rawfleetarray = array(210 => 5);
         $fleetRessource = array(901 => 0, 902 => 0, 903 => 0);
         if (1 == $PLANET['system']) {
             $tickfinal = $tickinicial + 9;
         } else {
             $tickfinal = $tickinicial + 11;
         }
         FleetFunctions::sendFleet($rawfleetarray, '6', 1, 1, 1, 1, 1, 1, $PLANET['id_owner'], $PLANET['id'], $PLANET['galaxy'], $PLANET['system'], $PLANET['planet'], $PLANET['planet_type'], $fleetRessource, TIMESTAMP + 40, TIMESTAMP + 40, TIMESTAMP + 80, $tickinicial, $tickfinal, 0);
         $manual_step_2_3 = 0;
     }
     $manual_step_5 = 1;
     if ($USER['training'] == 0 && $USER['training_step'] == 5) {
         $manual_step_5 = 0;
     }
     $manual_step_9 = 1;
     if ($USER['training'] == 0 && $USER['training_step'] == 9) {
         $manual_step_9 = 0;
     }
     $manual_step_16 = 1;
     if ($USER['training'] == 0 && $USER['training_step'] == 16) {
         $manual_step_16 = 0;
     }
     if ($USER['training'] == 0 && $USER['training_step'] == 5 && $PLANET['laboratory'] >= 3) {
         $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET `training_step` = '6' WHERE `id` = " . $USER['id'] . ";");
     }
     $this->tplObj->assign_vars(array('manual_step_16' => $manual_step_16, 'manual_step_9' => $manual_step_9, 'manual_step_2' => $manual_step_2, 'manual_step_2_1' => $manual_step_2_1, 'manual_step_2_2' => $manual_step_2_2, 'manual_step_2_3' => $manual_step_2_3, 'manual_step_5' => $manual_step_5, 'BuildInfoList' => $BuildInfoList, 'CanBuildElement' => $CanBuildElement, 'RoomIsOk' => $RoomIsOk, 'Planetas' => $PLANET, 'Queue' => $Queue, 'isBusy' => array('shipyard' => !empty($PLANET['b_hangar_id']), 'research' => $USER['b_tech_planet'] != 0), 'HaveMissiles' => (bool) $PLANET[$resource[503]] + $PLANET[$resource[502]], 'HaveMissiles' => (bool) $PLANET[$resource[503]] + $PLANET[$resource[502]], 'field_used' => $PLANET['field_current'], 'field_max' => CalculateMaxPlanetFields($PLANET), 'field_left' => CalculateMaxPlanetFields($PLANET) - $PLANET['field_current'], 'field_percent' => $PLANET['field_current'] * 100 / CalculateMaxPlanetFields($PLANET)));
     $this->display('page.buildings.default.tpl');
 }
示例#3
0
 static function maxPlanetCount($USER)
 {
     global $resource;
     $CONF = Config::getAll('universe', $USER['universe']);
     $planetPerTech = $CONF['planets_tech'];
     $planetPerBonus = $CONF['planets_officier'];
     if ($CONF['min_player_planets'] == 0) {
         $planetPerTech = 999;
     }
     if ($CONF['min_player_planets'] == 0) {
         $planetPerBonus = 999;
     }
     // http://owiki.de/index.php/Astrophysik#.C3.9Cbersicht
     return (int) ceil($CONF['min_player_planets'] + min($planetPerTech, $USER[$resource[124]] * $CONF['planets_per_tech']) + min($planetPerBonus, $USER['factor']['Planets'])) + getbonusOneBis(1206, $USER['academy_1206']) + $USER['extra_palnet'];
     //return (int) ceil($CONF['min_player_planets'] + min($planetPerTech, $USER[$resource[124]] * $CONF['planets_per_tech']) + min($planetPerBonus, $USER['factor']['Planets']) + $USER['academy_level_2_10']);
 }
 function show()
 {
     global $LNG, $UNI, $ProdGrid, $resource, $reslist, $CONF, $pricelist, $USER, $PLANET;
     $PlanetRess = new ResourceUpdate();
     $PlanetRess->CalcResource();
     $PlanetRess->SavePlanetToDb();
     if ($USER['urlaubs_modus'] == 1) {
         $basicIncome[901] = 0;
         $basicIncome[902] = 0;
         $basicIncome[903] = 0;
         $basicIncome[911] = 0;
     } else {
         $basicIncome[901] = Config::get($resource[901] . '_basic_income');
         $basicIncome[902] = Config::get($resource[902] . '_basic_income');
         $basicIncome[903] = Config::get($resource[903] . '_basic_income');
         $basicIncome[911] = Config::get($resource[911] . '_basic_income');
     }
     $temp = array(901 => array('plus' => 0, 'minus' => 0), 902 => array('plus' => 0, 'minus' => 0), 903 => array('plus' => 0, 'minus' => 0), 911 => array('plus' => 0, 'minus' => 0));
     $BuildTemp = $PLANET['temp_max'];
     $BuildEnergy = $USER[$resource[113]];
     $ressIDs = array_merge(array(), $reslist['resstype'][1], $reslist['resstype'][2]);
     if ($PLANET['energy_used'] != 0) {
         $prodLevel = min(1, $PLANET['energy'] / abs($PLANET['energy_used']));
     } else {
         $prodLevel = 0;
     }
     foreach ($reslist['prod'] as $ProdID) {
         $BuildLevelFactor = $PLANET[$resource[$ProdID] . '_porcent'];
         $BuildLevel = $PLANET[$resource[$ProdID]];
         $premium_resource = 0;
         $peacefull_resource = 0;
         if ($USER['premium_reward_extraction'] > 0 && $USER['premium_reward_extraction_days'] > TIMESTAMP) {
             $premium_resource = $USER['premium_reward_extraction'];
         }
         $premium_resource = $premium_resource;
         if ($USER['experience_peace_level'] > 0) {
             $peacefull_resource = $USER['experience_peace_level'];
         }
         $peacefull_resource = $peacefull_resource;
         $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;
         $combat_collider = 0;
         if ($USER['combat_reward_collider'] > 0) {
             $combat_collider = $USER['combat_reward_collider'];
         }
         $combat_collider = $combat_collider;
         $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;
         $productionList[$ProdID] = array('production' => array(901 => 0, 902 => 0, 903 => 0, 911 => 0), 'elementLevel' => $PLANET[$resource[$ProdID]], 'prodLevel' => $PLANET[$resource[$ProdID] . '_porcent']);
         foreach ($ressIDs as $ID) {
             if (!isset($ProdGrid[$ProdID]['production'][$ID])) {
                 continue;
             }
             $Production = eval(ResourceUpdate::getProd($ProdGrid[$ProdID]['production'][$ID]));
             if ($ID != 911) {
                 $Production *= $prodLevel * Config::get('resource_multiplier');
             } else {
                 $Production *= Config::get('energySpeed');
             }
             $productionList[$ProdID]['production'][$ID] = $Production;
             if ($Production > 0) {
                 if ($PLANET[$resource[$ID]] == 0) {
                     continue;
                 }
                 $temp[$ID]['plus'] += $Production;
             } else {
                 $temp[$ID]['minus'] += $Production;
             }
         }
     }
     $storage = array(901 => shortly_number($PLANET[$resource[901] . '_max']), 902 => shortly_number($PLANET[$resource[902] . '_max']), 903 => shortly_number($PLANET[$resource[903] . '_max']));
     $basicProduction = array(901 => $basicIncome[901] * Config::get('resource_multiplier'), 902 => $basicIncome[902] * Config::get('resource_multiplier'), 903 => $basicIncome[903] * Config::get('resource_multiplier'), 911 => $basicIncome[911] * Config::get('energySpeed'));
     $totalProduction = array(901 => $PLANET[$resource[901] . '_perhour'] + $basicProduction[901], 902 => $PLANET[$resource[902] . '_perhour'] + $basicProduction[902], 903 => $PLANET[$resource[903] . '_perhour'] + $basicProduction[903], 911 => $PLANET[$resource[911]] + $basicProduction[911] + $PLANET[$resource[911] . '_used']);
     $bonusProduction = array(901 => $temp[901]['plus'] * ($USER['factor']['Resource'] + 0.05 * $USER[$resource[131]]), 902 => $temp[902]['plus'] * ($USER['factor']['Resource'] + 0.05 * $USER[$resource[132]]), 903 => $temp[903]['plus'] * ($USER['factor']['Resource'] + 0.05 * $USER[$resource[133]]), 911 => $temp[911]['plus'] * $USER['factor']['Energy']);
     $dailyProduction = array(901 => $totalProduction[901] * 24, 902 => $totalProduction[902] * 24, 903 => $totalProduction[903] * 24, 911 => $totalProduction[911]);
     $weeklyProduction = array(901 => $totalProduction[901] * 168, 902 => $totalProduction[902] * 168, 903 => $totalProduction[903] * 168, 911 => $totalProduction[911]);
     $prodSelector = array();
     foreach (range(0, 10) as $procent) {
         $prodSelector[$procent] = $procent * 10 . '%';
     }
     $this->tplObj->assign_vars(array('header' => sprintf($LNG['rs_production_on_planet'], $PLANET['name']), 'prodSelector' => $prodSelector, 'productionList' => $productionList, 'basicProduction' => $basicProduction, 'totalProduction' => $totalProduction, 'bonusProduction' => $bonusProduction, 'dailyProduction' => $dailyProduction, 'weeklyProduction' => $weeklyProduction, 'storage' => $storage));
     $this->display('page.resources.default.tpl');
 }
示例#5
0
/**
 *  2Moons
 *  Copyright (C) 2012 Jan Kröpke
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @package 2Moons
 * @author Jan Kröpke <*****@*****.**>
 * @copyright 2012 Jan Kröpke <*****@*****.**>
 * @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License
 * @version 1.7.3 (2013-05-19)
 * @info $Id: calculateAttack.php 2632 2013-03-18 19:05:14Z slaver7 $
 * @link http://2moons.cc/
 */
function calculateAttack(&$attackers, &$defenders, $FleetTF, $DefTF)
{
    global $pricelist, $CombatCaps, $resource;
    $TRES = array('attacker' => 0, 'defender' => 0);
    $ARES = $DRES = array('metal' => 0, 'crystal' => 0);
    $ROUND = array();
    $RF = array();
    foreach ($attackers as $fleetID => $attacker) {
        foreach ($attacker['unit'] as $element => $amount) {
            $ARES['metal'] += $pricelist[$element]['cost'][901] * $amount;
            $ARES['crystal'] += $pricelist[$element]['cost'][902] * $amount;
        }
    }
    foreach ($CombatCaps as $e => $arr) {
        if (!isset($arr['sd'])) {
            continue;
        }
        foreach ($arr['sd'] as $t => $sd) {
            if ($sd == 0) {
                continue;
            }
            $RF[$t][$e] = $sd;
        }
    }
    $TRES['attacker'] = $ARES['metal'] + $ARES['crystal'];
    foreach ($defenders as $fleetID => $defender) {
        foreach ($defender['unit'] as $element => $amount) {
            if ($element < 300) {
                $DRES['metal'] += $pricelist[$element]['cost'][901] * $amount;
                $DRES['crystal'] += $pricelist[$element]['cost'][902] * $amount;
                $TRES['defender'] += $pricelist[$element]['cost'][901] * $amount;
                $TRES['defender'] += $pricelist[$element]['cost'][902] * $amount;
            } else {
                if (!isset($STARTDEF[$element])) {
                    $STARTDEF[$element] = 0;
                }
                $STARTDEF[$element] += $amount;
                $TRES['defender'] += $pricelist[$element]['cost'][901] * $amount;
                $TRES['defender'] += $pricelist[$element]['cost'][902] * $amount;
            }
        }
    }
    for ($ROUNDC = 0; $ROUNDC <= MAX_ATTACK_ROUNDS; $ROUNDC++) {
        $attackDamage = array('total' => 0);
        $attackShield = array('total' => 0);
        $attackAmount = array('total' => 0);
        $defenseDamage = array('total' => 0);
        $defenseShield = array('total' => 0);
        $defenseAmount = array('total' => 0);
        $attArray = array();
        $defArray = array();
        $KritAttacker = array();
        $KritDefender = array();
        $attackShoting = array('light' => 0, 'medium' => 0, 'heavy' => 0);
        $defenseShoting = array('light' => 0, 'medium' => 0, 'heavy' => 0);
        foreach ($attackers as $fleetID => $attacker) {
            $attackDamage[$fleetID] = 0;
            $attackShield[$fleetID] = 0;
            $attackAmount[$fleetID] = 0;
            $KritAttacker['DK'][$fleetID] = 0;
            $KritAttacker['SK'][$fleetID] = 0;
            $attTech = getbonusOneBis(1101, $attacker['player']['academy_1101']) + getbonusOneBis(1102, $attacker['player']['academy_1102']) + $attacker['player']['factor']['Attack'] * 100;
            //attaque
            $defTech = getbonusOneBis(1301, $attacker['player']['academy_1301']) + getbonusOneBis(1302, $attacker['player']['academy_1302']) + $attacker['player']['factor']['Defensive'] * 100;
            //bouclier
            $shieldTech = getbonusOneBis(1301, $attacker['player']['academy_1301']) + getbonusOneBis(1302, $attacker['player']['academy_1302']) + $attacker['player']['factor']['Shield'] * 100;
            //coque
            $attackers[$fleetID]['techs'] = array(max(0, $attTech), max(0, $defTech), max(0, $shieldTech));
            if ($shieldTech == 0) {
                $shieldTech = 1;
            }
            if ($defTech == 0) {
                $defTech = 1;
            }
            if ($attTech == 0) {
                $attTech = 1;
            }
            foreach ($attacker['unit'] as $element => $amount) {
                $thisAtt = $amount * ($CombatCaps[$element]['attack'] * $attTech);
                //attaque
                $thisShield = $amount * ($CombatCaps[$element]['shield'] * $shieldTech);
                // escudo
                $structure = $pricelist[$element]['cost'][902];
                $thisDef = $amount * $structure;
                //estrutura
                //------Ataques criticos e escudo
                $DK = 1;
                $SK = 1;
                if ($attacker['player']['academy_1103'] == 0) {
                    $procen_DK = 0;
                } else {
                    $procen_DK = 2 * $attacker['player']['academy_1103'];
                }
                if ($attacker['player']['academy_1303'] == 0) {
                    $procen_SK = 0;
                } else {
                    $procen_SK = 2 * $attacker['player']['academy_1303'];
                }
                if ($attacker['player']['academy_1311'] == 0) {
                    $power_SK = 0;
                } else {
                    $power_SK = getbonusOneBis(1311, $attacker['player']['academy_1311']);
                }
                if (rand(1, 100) <= $procen_DK) {
                    $DK = 2;
                }
                if (rand(1, 100) <= $procen_SK) {
                    $SK = 2;
                }
                //---------------------------------------------------------------------
                $thisAtt *= $DK;
                $thisShield *= $SK;
                $KritAttacker['DK'][$fleetID] = $DK;
                $KritAttacker['SK'][$fleetID] = $SK;
                $attArray[$fleetID][$element] = array('def' => $thisDef, 'shield' => $thisShield, 'att' => $thisAtt);
                $attackDamage[$fleetID] += $thisAtt;
                $attackDamage['total'] += $thisAtt;
                $attackShield[$fleetID] += $thisDef;
                $attackShield['total'] += $thisDef;
                $attackAmount[$fleetID] += $amount;
                $attackAmount['total'] += $amount;
            }
            //$temp1	= $attacker['unit'];
        }
        foreach ($defenders as $fleetID => $defender) {
            $defenseDamage[$fleetID] = 0;
            $defenseShield[$fleetID] = 0;
            $defenseAmount[$fleetID] = 0;
            $KritDefender['DK'][$fleetID] = 0;
            $KritDefender['SK'][$fleetID] = 0;
            //-----DEFENDER bonus
            if (empty($defender['player']['academy_1306'])) {
                $OB = 0;
            } else {
                $OB = $defender['player']['academy_1306'];
            }
            if (empty($defender['player']['academy_1305'])) {
                $OS = 0;
            } else {
                $OS = $defender['player']['academy_1305'];
            }
            //---------------------------------------------------------------------------------------------
            $attTech = getbonusOneBis(1101, $defender['player']['academy_1101']) + getbonusOneBis(1102, $defender['player']['academy_1102']) + $defender['player']['factor']['Attack'] * 100;
            //attaque
            $defTech = $OB + getbonusOneBis(1301, $defender['player']['academy_1301']) + getbonusOneBis(1302, $defender['player']['academy_1302']) + $defender['player']['factor']['Defensive'] * 100;
            //bouclier
            $shieldTech = $OS + getbonusOneBis(1301, $defender['player']['academy_1301']) + getbonusOneBis(1302, $defender['player']['academy_1302']) + $defender['player']['factor']['Shield'] * 100;
            //coque
            $defenders[$fleetID]['techs'] = array(max(0, $attTech), max(0, $defTech), max(0, $shieldTech));
            if ($shieldTech == 0) {
                $shieldTech = 1;
            }
            if ($defTech == 0) {
                $defTech = 1;
            }
            if ($attTech == 0) {
                $attTech = 1;
            }
            foreach ($defender['unit'] as $element => $amount) {
                //------Крит атаки и щитов
                $DK = 1;
                $SK = 1;
                if ($defender['player']['academy_1103'] == 0) {
                    $procen_DK = 0;
                } else {
                    $procen_DK = 2 * $defender['player']['academy_1103'];
                }
                if ($defender['player']['academy_1303'] == 0) {
                    $procen_SK = 0;
                } else {
                    $procen_SK = 2 * $defender['player']['academy_1303'];
                }
                if ($defender['player']['academy_1311'] == 0) {
                    $power_SK = 0;
                } else {
                    $power_SK = getbonusOneBis(1311, $defender['player']['academy_1311']);
                }
                if (rand(1, 100) <= $procen_DK) {
                    $DK = 2;
                }
                if (rand(1, 100) <= $procen_SK) {
                    $SK = 2;
                }
                //---------------------------------------------------------------------
                $thisAtt = $amount * ($CombatCaps[$element]['attack'] * $attTech);
                //attaque
                $thisShield = $amount * ($CombatCaps[$element]['shield'] * $shieldTech);
                // прощет щитов
                $structure = $pricelist[$element]['cost'][902];
                $thisDef = $amount * $structure;
                //прощет брони
                $thisAtt *= $DK;
                $thisShield *= $SK;
                $KritDefender['DK'][$fleetID] = $DK;
                $KritDefender['SK'][$fleetID] = $SK;
                if ($element == 407 || $element == 408 || $element == 409 || $element == 411) {
                    $thisAtt = 0;
                }
                $defArray[$fleetID][$element] = array('def' => $thisDef, 'shield' => $thisShield, 'att' => $thisAtt);
                $defenseDamage[$fleetID] += $thisAtt;
                $defenseDamage['total'] += $thisAtt;
                $defenseShield[$fleetID] += $thisDef;
                $defenseShield['total'] += $thisDef;
                $defenseAmount[$fleetID] += $amount;
                $defenseAmount['total'] += $amount;
            }
            //$temp2	= $defender['unit'];
        }
        $ROUND[$ROUNDC] = array('attackers' => $attackers, 'defenders' => $defenders, 'attackA' => $attackAmount, 'defenseA' => $defenseAmount, 'infoA' => $attArray, 'infoD' => $defArray, 'kA' => $KritAttacker, 'kD' => $KritDefender);
        if ($ROUNDC >= MAX_ATTACK_ROUNDS || $defenseAmount['total'] <= 0 || $attackAmount['total'] <= 0) {
            break;
        }
        // Calculate hit percentages (ACS only but ok)
        $attackPct = array();
        foreach ($attackAmount as $fleetID => $amount) {
            if (!is_numeric($fleetID)) {
                continue;
            }
            $attackPct[$fleetID] = $amount / $attackAmount['total'];
        }
        $defensePct = array();
        foreach ($defenseAmount as $fleetID => $amount) {
            if (!is_numeric($fleetID)) {
                continue;
            }
            $defensePct[$fleetID] = $amount / $defenseAmount['total'];
        }
        // CALCUL DES PERTES !!!
        $attacker_n = array();
        $attacker_shield = 0;
        $defenderAttack = 0;
        foreach ($attackers as $fleetID => $attacker) {
            $attacker_n[$fleetID] = array();
            foreach ($attacker['unit'] as $element => $amount) {
                if ($amount <= 0) {
                    $attacker_n[$fleetID][$element] = 0;
                    continue;
                }
                $defender_moc = $amount * ($defenseDamage['total'] * $attackPct[$fleetID]) / $attackAmount[$fleetID];
                if (isset($RF[$element])) {
                    foreach ($RF[$element] as $shooter => $shots) {
                        foreach ($defArray as $fID => $rfdef) {
                            if (empty($rfdef[$shooter]['att']) || $attackAmount[$fleetID] <= 0) {
                                continue;
                            }
                            $defender_moc += $rfdef[$shooter]['att'] * $shots / ($amount / $attackAmount[$fleetID] * $attackPct[$fleetID]);
                            $defenseAmount['total'] += $defenders[$fID]['unit'][$shooter] * $shots;
                        }
                    }
                }
                $CV = 0;
                $CR = 0;
                $Max_dex = 1.0;
                $Fcus = 1.0;
                foreach ($defArray as $fID => $rfatt) {
                    if ($defenseAmount[$fID] <= 0) {
                        continue;
                    }
                    //------CV
                    if (empty($defenders[$fID]['academy_1109'])) {
                        $CV = 0;
                    } else {
                        $CV += $defensePct[$fID] + getbonusOneBis(1109, $defenders['academy_1109']);
                    }
                    //------CR
                    if (empty($defenders[$fID]['academy_1110'])) {
                        $CR += 1;
                    } else {
                        $CR += $defensePct[$fID] * rand(1, getbonusOneBis(1110, $defenders['academy_1110']));
                    }
                    //------max destruction
                    if (empty($defenders[$fID]['academy_1108'])) {
                        $Max_dex += 0;
                    } else {
                        $Max_dex += $defensePct[$fID] * getbonusOneBis(1108, $defenders['academy_1108']);
                    }
                    //------skil_fcus
                    if (empty($defenders[$fID]['skil_fcus'])) {
                        $Fcus -= 0;
                    } else {
                        $Fcus -= $defensePct[$fID] * getbonusOneBis(1111, $defenders['academy_1111']);
                    }
                }
                $defenderAttack += $defender_moc;
                if ($attArray[$fleetID][$element]['def'] / $amount >= $defender_moc) {
                    $attacker_n[$fleetID][$element] = round($amount);
                    $attacker_shield += $defender_moc;
                    continue;
                }
                //------minimize RF
                if (empty($attacker['player']['academy_1308'])) {
                    $minimize_RF = 1;
                } else {
                    $minimize_RF = max(0, 1 - getbonusOneBis(1308, $attacker['player']['academy_1308']));
                }
                //----------------------------------------------------------------------------------------------------------
                $max_removePoints = floor($amount * $defenseAmount['total'] / $attackAmount[$fleetID] * $attackPct[$fleetID]);
                $attacker_shield += min($attArray[$fleetID][$element]['def'], $defender_moc);
                $defender_moc -= min($attArray[$fleetID][$element]['def'], $defender_moc);
                $ile_removePoints = max(min($max_removePoints, $amount * min($defender_moc / $attArray[$fleetID][$element]['shield'] * (rand(0, 200) / 100), 1)), 0);
                $attacker_n[$fleetID][$element] = max(ceil($amount - $ile_removePoints), 0);
            }
        }
        $defender_n = array();
        $defender_shield = 0;
        $attackerAttack = 0;
        foreach ($defenders as $fleetID => $defender) {
            $defender_n[$fleetID] = array();
            foreach ($defender['unit'] as $element => $amount) {
                if ($amount <= 0) {
                    $defender_n[$fleetID][$element] = 0;
                    continue;
                }
                $attacker_moc = $amount * ($attackDamage['total'] * $defensePct[$fleetID]) / $defenseAmount[$fleetID];
                if (isset($RF[$element])) {
                    foreach ($RF[$element] as $shooter => $shots) {
                        foreach ($attArray as $fID => $rfatt) {
                            if (empty($rfatt[$shooter]['att']) || $defenseAmount[$fleetID] <= 0) {
                                continue;
                            }
                            $attacker_moc += $rfatt[$shooter]['att'] * $shots / ($amount / $defenseAmount[$fleetID] * $defensePct[$fleetID]);
                            $attackAmount['total'] += $attackers[$fID]['unit'][$shooter] * $shots;
                        }
                    }
                }
                $CV = 0;
                $CR = 0;
                $Max_dex = 1.0;
                $Fcus = 1;
                foreach ($attArray as $fID => $rfatt) {
                    if ($attackAmount[$fID] <= 0) {
                        continue;
                    }
                    //------CV
                    if (empty($attackers[$fID]['academy_1109'])) {
                        $CV = 0;
                    } else {
                        $CV += $attackPct[$fID] + getbonusOneBis(1109, $attackers['academy_1109']);
                    }
                    //------CR
                    if (empty($attackers[$fID]['academy_1110'])) {
                        $CR += 1;
                    } else {
                        $CR += $attackPct[$fID] * rand(1, getbonusOneBis(1110, $attackers['academy_1110']));
                    }
                    //------max destruction
                    if (empty($attackers[$fID]['academy_1108'])) {
                        $Max_dex += 0;
                    } else {
                        $Max_dex += $attackPct[$fID] * getbonusOneBis(1108, $attackers['academy_1108']);
                    }
                    //------skil_fcus
                    if (empty($attackers[$fID]['skil_fcus'])) {
                        $Fcus -= 0;
                    } else {
                        $Fcus -= $attackPct[$fID] * getbonusOneBis(1111, $attackers['academy_1111']);
                    }
                }
                $attackerAttack += $attacker_moc;
                if ($defArray[$fleetID][$element]['def'] / $amount >= $attacker_moc) {
                    $defender_n[$fleetID][$element] = round($amount);
                    $defender_shield += $attacker_moc;
                    continue;
                }
                //------minimize RF
                if (empty($defender['player']['academy_1308'])) {
                    $minimize_RF = 1;
                } else {
                    $minimize_RF = max(0, 1 - getbonusOneBis(1308, $defender['player']['academy_1308']));
                }
                //---------------------------------------------------------------------------------------------------------- /
                $max_removePoints = floor($amount * $attackAmount['total'] / $defenseAmount[$fleetID] * $defensePct[$fleetID]);
                $defender_shield += min($defArray[$fleetID][$element]['def'], $attacker_moc);
                $attacker_moc -= min($defArray[$fleetID][$element]['def'], $attacker_moc);
                $ile_removePoints = max(min($max_removePoints, $amount * min($attacker_moc / $defArray[$fleetID][$element]['shield'] * (rand(0, 200) / 100), 1)), 0);
                $defender_n[$fleetID][$element] = max(ceil($amount - $ile_removePoints), 0);
            }
        }
        $ROUND[$ROUNDC]['attack'] = $attackerAttack;
        $ROUND[$ROUNDC]['defense'] = $defenderAttack;
        $ROUND[$ROUNDC]['attackShield'] = $attacker_shield;
        $ROUND[$ROUNDC]['defShield'] = $defender_shield;
        foreach ($attackers as $fleetID => $attacker) {
            $attackers[$fleetID]['unit'] = array_map('round', $attacker_n[$fleetID]);
        }
        foreach ($defenders as $fleetID => $defender) {
            $defenders[$fleetID]['unit'] = array_map('round', $defender_n[$fleetID]);
        }
    }
    if ($attackAmount['total'] <= 0 && $defenseAmount['total'] > 0) {
        $won = "r";
        // defender
    } elseif ($attackAmount['total'] > 0 && $defenseAmount['total'] <= 0) {
        $won = "a";
        // attacker
    } else {
        $won = "w";
        // draw
    }
    // CDR
    foreach ($attackers as $fleetID => $attacker) {
        // flotte attaquant en CDR
        foreach ($attacker['unit'] as $element => $amount) {
            $TRES['attacker'] -= $pricelist[$element]['cost'][901] * $amount;
            $TRES['attacker'] -= $pricelist[$element]['cost'][902] * $amount;
            $ARES['metal'] -= $pricelist[$element]['cost'][901] * $amount;
            $ARES['crystal'] -= $pricelist[$element]['cost'][902] * $amount;
        }
    }
    $DRESDefs = array('metal' => 0, 'crystal' => 0);
    //------Reductin defender
    $RD = 1;
    if (empty($defender['player']['academy_1313'])) {
        $RD = 0;
    } else {
        $RD = getbonusOneBis(1313, $defender['player']['academy_1313']);
    }
    //---------------------------------------------------------------------
    $defs_point = 0;
    foreach ($defenders as $fleetID => $defender) {
        foreach ($defender['unit'] as $element => $amount) {
            if ($element < 300) {
                // flotte defenseur en CDR
                $DRES['metal'] -= $pricelist[$element]['cost'][901] * $amount;
                $DRES['crystal'] -= $pricelist[$element]['cost'][902] * $amount;
                $TRES['defender'] -= $pricelist[$element]['cost'][901] * $amount;
                $TRES['defender'] -= $pricelist[$element]['cost'][902] * $amount;
            } else {
                // defs defenseur en CDR + reconstruction
                $TRES['defender'] -= $pricelist[$element]['cost'][901] * $amount;
                $TRES['defender'] -= $pricelist[$element]['cost'][902] * $amount;
                $lost = $STARTDEF[$element] - $amount;
                //$giveback = round($lost * (rand(56, 84) / 100));
                $giveback = round($lost * min(1, rand(56 + $RD, 70 + $RD) / 100));
                $defenders[$fleetID]['unit'][$element] += $giveback;
                $DRESDefs['metal'] += $pricelist[$element]['cost'][901] * ($lost - $giveback);
                $DRESDefs['crystal'] += $pricelist[$element]['cost'][902] * ($lost - $giveback);
                $defs_point += $pricelist[$element]['cost'][901] * $amount + $pricelist[$element]['cost'][901] * ($lost - $giveback);
                // очки оборонки
                $defs_point += $pricelist[$element]['cost'][902] * $amount + $pricelist[$element]['cost'][902] * ($lost - $giveback);
                // очки оборонки
            }
        }
    }
    $ARES['metal'] = max($ARES['metal'], 0);
    $ARES['crystal'] = max($ARES['crystal'], 0);
    $DRES['metal'] = max($DRES['metal'], 0);
    $DRES['crystal'] = max($DRES['crystal'], 0);
    $TRES['attacker'] = max($TRES['attacker'], 0);
    $TRES['defender'] = max($TRES['defender'], 0);
    $totalLost = array('attacker' => $TRES['attacker'], 'defender' => $TRES['defender'], 'dp' => $defs_point);
    $debAttMet = $ARES['metal'] * ($FleetTF / 100);
    $debAttCry = $ARES['crystal'] * ($FleetTF / 100);
    $debDefMet = $DRES['metal'] * ($FleetTF / 100) + $DRESDefs['metal'] * ($DefTF / 100);
    $debDefCry = $DRES['crystal'] * ($FleetTF / 100) + $DRESDefs['crystal'] * ($DefTF / 100);
    return array('won' => $won, 'debris' => array('attacker' => array(901 => $debAttMet, 902 => $debAttCry), 'defender' => array(901 => $debDefMet, 902 => $debDefCry)), 'rw' => $ROUND, 'unitLost' => $totalLost);
}
示例#6
0
 public static function GetFleetRoom($Fleet, $Player)
 {
     global $pricelist;
     $FleetRoom = 0;
     $allyInfo = $GLOBALS['DATABASE']->query("SELECT FleetCapa FROM `uni1_alliance` WHERE id = " . $Player['ally_id'] . ";");
     $allyInfo = $GLOBALS['DATABASE']->fetch_array($allyInfo);
     foreach ($Fleet as $ShipID => $amount) {
         $FleetRoom += $pricelist[$ShipID]['capacity'] * $amount;
         $FleetRoom += $FleetRoom / 100 * getbonusOneBis(1207, $Player['academy_1207']) + $FleetRoom / 100 * $allyInfo['FleetCapa'];
     }
     return $FleetRoom;
 }
 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');
 }
示例#8
0
 public static function getMaxConstructibleOrbits($USER, $PLANET, $Orbits = NULL)
 {
     global $resource, $reslist;
     if (!isset($Orbits)) {
         $Orbits = array();
         foreach ($Orbits as $elementID) {
             $Orbits[$elementID] = $PLANET[$resource[$elementID]];
         }
     }
     $BuildArray = !empty($PLANET['b_hangar_id']) ? unserialize($PLANET['b_hangar_id']) : array();
     $MaxOrbits = 250 + getbonusOneBis(1309, $USER['academy_1309']);
     foreach ($BuildArray as $ElementArray) {
         if (isset($Orbits[$ElementArray[0]])) {
             $Orbits[$ElementArray[0]] += $ElementArray[1];
         }
     }
     $ActuOrbits = max(0, $MaxOrbits - $Orbits[411]);
     return array(411 => $ActuOrbits);
 }
 public function ReBuildCache()
 {
     global $ProdGrid, $resource, $reslist, $pricelist, $ALLIANCE;
     if ($this->PLANET['planet_type'] == 3) {
         $this->CONF['metal_basic_income'] = 0;
         $this->CONF['crystal_basic_income'] = 0;
         $this->CONF['deuterium_basic_income'] = 0;
     }
     $temp = array(901 => array('max' => 0, 'plus' => 0, 'minus' => 0), 902 => array('max' => 0, 'plus' => 0, 'minus' => 0), 903 => array('max' => 0, 'plus' => 0, 'minus' => 0), 911 => array('plus' => 0, 'minus' => 0), 921 => array('max' => 0, 'plus' => 0, 'minus' => 0));
     $BuildTemp = $this->PLANET['temp_max'];
     $BuildEnergy = $this->USER[$resource[113]];
     foreach ($reslist['storage'] as $ProdID) {
         foreach ($reslist['resstype'][1] as $ID) {
             if (!isset($ProdGrid[$ProdID]['storage'][$ID])) {
                 continue;
             }
             $premium_storage = 1;
             if ($this->USER['premium_reward_storing'] > 0 && $this->USER['premium_reward_storing_days'] > TIMESTAMP) {
                 $premium_storage = $this->USER['premium_reward_storing'];
             }
             $premium_storage = $premium_storage;
             $academy_storage = 0;
             if ($this->USER['academy_1204'] > 0) {
                 $academy_storage = getbonusOneBis(1204, $this->USER['academy_1204']);
             }
             $academy_storage = $academy_storage;
             $BuildLevel = $this->PLANET[$resource[$ProdID]];
             $temp[$ID]['max'] += round(eval(self::getProd($ProdGrid[$ProdID]['storage'][$ID])));
         }
     }
     $ressIDs = array_merge(array(), $reslist['resstype'][1], $reslist['resstype'][2], $reslist['resstype'][3]);
     foreach ($reslist['prod'] as $ProdID) {
         $alliance_prod = 0;
         if ($ALLIANCE['alliance_prod'] > 0) {
             $alliance_prod = $ALLIANCE['alliance_prod'];
         }
         $alliance_prod = $alliance_prod;
         $BuildLevelFactor = $this->PLANET[$resource[$ProdID] . '_porcent'];
         $BuildLevel = $this->PLANET[$resource[$ProdID]];
         $premium_resource = 0;
         if ($this->USER['premium_reward_extraction'] > 0 && $this->USER['premium_reward_extraction_days'] > TIMESTAMP) {
             $premium_resource = $this->USER['premium_reward_extraction'];
         }
         $premium_resource = $premium_resource;
         $peacefull_resource = 0;
         if ($this->USER['experience_peace_level'] > 0) {
             $peacefull_resource = $this->USER['experience_peace_level'];
         }
         $peacefull_resource = $peacefull_resource;
         $academy_mines = 0;
         if ($this->USER['academy_1201'] > 0) {
             $academy_mines = getbonusOneBis(1201, $this->USER['academy_1201']);
         }
         $academy_mines = $academy_mines;
         $daily_prod_bonus = 0;
         if ($this->USER['daily_produ'] > TIMESTAMP) {
             $daily_prod_bonus = 30;
         }
         $daily_prod_bonus = $daily_prod_bonus;
         $combat_collider = 0;
         if ($this->USER['combat_reward_collider'] > 0) {
             $combat_collider = $this->USER['combat_reward_collider'];
         }
         $combat_collider = $combat_collider;
         $academy_energy = 0;
         if ($this->USER['academy_1202'] > 0) {
             $academy_energy = getbonusOneBis(1202, $this->USER['academy_1202']);
         }
         $academy_energy = $academy_energy;
         $academy_fusion = 0;
         if ($this->USER['academy_1209'] > 0) {
             $academy_fusion = getbonusOneBis(1209, $this->USER['academy_1209']);
         }
         $academy_fusion = $academy_fusion;
         $academy_solar = 0;
         if ($this->USER['academy_1210'] > 0) {
             $academy_solar = getbonusOneBis(1210, $this->USER['academy_1210']);
         }
         $academy_solar = $academy_solar;
         foreach ($ressIDs as $ID) {
             if (!isset($ProdGrid[$ProdID]['production'][$ID])) {
                 continue;
             }
             $Production = eval(self::getProd($ProdGrid[$ProdID]['production'][$ID]));
             if ($Production > 0) {
                 $temp[$ID]['plus'] += $Production;
             } else {
                 if (in_array($ID, $reslist['resstype'][1]) && $this->PLANET[$resource[$ID]] == 0) {
                     continue;
                 }
                 $temp[$ID]['minus'] += $Production;
             }
         }
     }
     $this->PLANET['metal_max'] = $temp[901]['max'] * $this->CONF['resource_multiplier'] * STORAGE_FACTOR * (1 + $this->USER['factor']['ResourceStorage']);
     $this->PLANET['crystal_max'] = $temp[902]['max'] * $this->CONF['resource_multiplier'] * STORAGE_FACTOR * (1 + $this->USER['factor']['ResourceStorage']);
     $this->PLANET['deuterium_max'] = $temp[903]['max'] * $this->CONF['resource_multiplier'] * STORAGE_FACTOR * (1 + $this->USER['factor']['ResourceStorage']);
     //$this->PLANET['darkmatter_max']		= $temp[921]['max'] * $this->CONF['resource_multiplier'] * STORAGE_FACTOR * (1 + $this->USER['factor']['ResourceStorage']);
     $this->PLANET['energy'] = round($temp[911]['plus'] * $this->CONF['energySpeed'] * (1 + $this->USER['factor']['Energy']));
     $this->PLANET['energy_used'] = $temp[911]['minus'];
     if ($this->PLANET['energy_used'] == 0) {
         $this->PLANET['metal_perhour'] = 0;
         $this->PLANET['crystal_perhour'] = 0;
         $this->PLANET['deuterium_perhour'] = 0;
         $this->PLANET['darkmatter_perhour'] = $temp[921]['plus'] + $temp[921]['minus'];
     } else {
         $prodLevel = min(1, $this->PLANET['energy'] / abs($this->PLANET['energy_used']));
         $premium_resource = 0;
         if ($this->USER['premium_reward_extraction'] > 0 && $this->USER['premium_reward_extraction_days'] > TIMESTAMP) {
             $premium_resource = $this->USER['premium_reward_extraction'];
         }
         $premium_resource = $premium_resource;
         $peacefull_resource = 0;
         if ($this->USER['experience_peace_level'] > 0) {
             $peacefull_resource = $this->USER['experience_peace_level'];
         }
         $peacefull_resource = $peacefull_resource;
         $academy_mines = 0;
         if ($this->USER['academy_1201'] > 0) {
             $academy_mines = getbonusOneBis(1201, $this->USER['academy_1201']);
         }
         $academy_mines = $academy_mines;
         $daily_prod_bonus = 0;
         if ($this->USER['daily_produ'] > TIMESTAMP) {
             $daily_prod_bonus = 30;
         }
         $daily_prod_bonus = $daily_prod_bonus;
         $this->PLANET['metal_perhour'] = ($temp[901]['plus'] * (1 + $this->USER['factor']['Resource'] + 0.02 * $this->USER[$resource[131]]) * $prodLevel + $temp[901]['minus']) * $this->CONF['resource_multiplier'] + ($temp[901]['plus'] * (1 + $this->USER['factor']['Resource'] + 0.02 * $this->USER[$resource[131]]) * $prodLevel + $temp[901]['minus']) * $this->CONF['resource_multiplier'] / 100 * $academy_mines + ($temp[901]['plus'] * (1 + $this->USER['factor']['Resource'] + 0.02 * $this->USER[$resource[131]]) * $prodLevel + $temp[901]['minus']) * $this->CONF['resource_multiplier'] / 100 * $peacefull_resource + ($temp[901]['plus'] * (1 + $this->USER['factor']['Resource'] + 0.02 * $this->USER[$resource[131]]) * $prodLevel + $temp[901]['minus']) * $this->CONF['resource_multiplier'] / 100 * $premium_resource + ($temp[901]['plus'] * (1 + $this->USER['factor']['Resource'] + 0.02 * $this->USER[$resource[131]]) * $prodLevel + $temp[901]['minus']) * $this->CONF['resource_multiplier'] / 100 * $daily_prod_bonus;
         $this->PLANET['crystal_perhour'] = ($temp[902]['plus'] * (1 + $this->USER['factor']['Resource'] + 0.02 * $this->USER[$resource[132]]) * $prodLevel + $temp[902]['minus']) * $this->CONF['resource_multiplier'] + ($temp[902]['plus'] * (1 + $this->USER['factor']['Resource'] + 0.02 * $this->USER[$resource[132]]) * $prodLevel + $temp[902]['minus']) * $this->CONF['resource_multiplier'] / 100 * $academy_mines + ($temp[902]['plus'] * (1 + $this->USER['factor']['Resource'] + 0.02 * $this->USER[$resource[132]]) * $prodLevel + $temp[902]['minus']) * $this->CONF['resource_multiplier'] / 100 * $peacefull_resource + ($temp[902]['plus'] * (1 + $this->USER['factor']['Resource'] + 0.02 * $this->USER[$resource[132]]) * $prodLevel + $temp[902]['minus']) * $this->CONF['resource_multiplier'] / 100 * $premium_resource + ($temp[902]['plus'] * (1 + $this->USER['factor']['Resource'] + 0.02 * $this->USER[$resource[132]]) * $prodLevel + $temp[902]['minus']) * $this->CONF['resource_multiplier'] / 100 * $daily_prod_bonus;
         $this->PLANET['deuterium_perhour'] = ($temp[903]['plus'] * (1 + $this->USER['factor']['Resource'] + 0.02 * $this->USER[$resource[133]]) * $prodLevel + $temp[903]['minus']) * $this->CONF['resource_multiplier'] + ($temp[903]['plus'] * (1 + $this->USER['factor']['Resource'] + 0.02 * $this->USER[$resource[133]]) * $prodLevel + $temp[903]['minus']) * $this->CONF['resource_multiplier'] / 100 * $academy_mines + ($temp[903]['plus'] * (1 + $this->USER['factor']['Resource'] + 0.02 * $this->USER[$resource[133]]) * $prodLevel + $temp[903]['minus']) * $this->CONF['resource_multiplier'] / 100 * $premium_resource + ($temp[903]['plus'] * (1 + $this->USER['factor']['Resource'] + 0.02 * $this->USER[$resource[133]]) * $prodLevel + $temp[903]['minus']) * $this->CONF['resource_multiplier'] / 100 * $peacefull_resource + ($temp[903]['plus'] * (1 + $this->USER['factor']['Resource'] + 0.02 * $this->USER[$resource[133]]) * $prodLevel + $temp[903]['minus']) * $this->CONF['resource_multiplier'] / 100 * $daily_prod_bonus;
         $this->PLANET['darkmatter_perhour'] = $temp[921]['plus'] + $temp[921]['minus'];
     }
 }
 public function show()
 {
     global $USER, $PLANET, $dpath, $LNG, $resource, $pricelist, $reslist, $CombatCaps, $ProdGrid, $CONF;
     $elementID = HTTP::_GP('id', 0);
     $this->setWindow('popup');
     $this->initTemplate();
     $productionTable = array();
     $FleetInfo = array();
     $MissileList = array();
     $gateData = array();
     $CurrentLevel = 0;
     $ressIDs = array_merge(array(), $reslist['resstype'][1], $reslist['resstype'][2], $reslist['resstype'][3]);
     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 - 2, 0);
         $premium_resource = 0;
         $peacefull_resource = 0;
         if ($USER['premium_reward_extraction'] > 0 && $USER['premium_reward_extraction_days'] > TIMESTAMP) {
             $premium_resource = $USER['premium_reward_extraction'];
         }
         $premium_resource = $premium_resource;
         if ($USER['experience_peace_level'] > 0) {
             $peacefull_resource = $USER['experience_peace_level'];
         }
         $peacefull_resource = $peacefull_resource;
         $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;
         $combat_collider = 0;
         if ($USER['combat_reward_collider'] > 0) {
             $combat_collider = $USER['combat_reward_collider'];
         }
         $combat_collider = $combat_collider;
         $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;
         for ($BuildLevel = $BuildStartLvl; $BuildLevel < $BuildStartLvl + 15; $BuildLevel++) {
             foreach ($ressIDs as $ID) {
                 if (!isset($ProdGrid[$elementID]['production'][$ID])) {
                     continue;
                 }
                 $Production = eval(ResourceUpdate::getProd($ProdGrid[$elementID]['production'][$ID]));
                 if ($ID != 911 && $ID != 921) {
                     $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 - 2, 0);
         $premium_storage = 1;
         if ($USER['premium_reward_storing'] > 0 && $USER['premium_reward_storing_days'] > TIMESTAMP) {
             $premium_storage = $USER['premium_reward_storing'];
         }
         $premium_storage = $premium_storage;
         $academy_storage = 0;
         if ($USER['academy_1204'] > 0) {
             $academy_storage = getbonusOneBis(1204, $USER['academy_1204']);
         }
         $academy_storage = $academy_storage;
         for ($BuildLevel = $BuildStartLvl; $BuildLevel < $BuildStartLvl + 15; $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'])) {
         $FleetInfo = array('structure' => $pricelist[$elementID]['cost'][901] + $pricelist[$elementID]['cost'][902], 'tech' => $pricelist[$elementID]['tech'], 'attack' => $CombatCaps[$elementID]['attack'], 'shield' => $CombatCaps[$elementID]['shield'], 'capacity' => $pricelist[$elementID]['capacity'], 'speed1' => $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], 'attack' => $CombatCaps[$elementID]['attack'], 'shield' => $CombatCaps[$elementID]['shield'], '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'], $PLANET['sprungtor']);
         $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]]);
     }
     $this->tplObj->assign_vars(array('elementID' => $elementID, 'productionTable' => $productionTable, 'CurrentLevel' => $CurrentLevel, 'MissileList' => $MissileList, 'Bonus' => BuildFunctions::getAvalibleBonus($elementID), 'FleetInfo' => $FleetInfo, 'gateData' => $gateData));
     $this->display('page.infomation.default.tpl');
 }