本文整理汇总了PHP中ResourceUpdate::getProd方法的典型用法代码示例。如果您正苦于以下问题:PHP ResourceUpdate::getProd方法的具体用法?PHP ResourceUpdate::getProd怎么用?PHP ResourceUpdate::getProd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ResourceUpdate
的用法示例。
在下文中一共展示了ResourceUpdate::getProd方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
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');
}
示例2: show
public function show()
{
global $USER, $PLANET, $LNG, $resource, $pricelist, $reslist, $CombatCaps, $ProdGrid;
$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]);
if (in_array($elementID, $reslist['prod']) && in_array($elementID, $reslist['build'])) {
/* Data for eval */
$BuildEnergy = $USER[$resource[113]];
$BuildTemp = $PLANET['temp_max'];
$BuildLevelFactor = $PLANET[$resource[$elementID] . '_porcent'];
$CurrentLevel = $PLANET[$resource[$elementID]];
$BuildStartLvl = max($CurrentLevel - 2, 0);
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 (in_array($ID, $reslist['resstype'][2])) {
$Production *= Config::get()->energySpeed;
} else {
$Production *= Config::get()->resource_multiplier;
}
$productionTable['production'][$BuildLevel][$ID] = $Production;
}
}
$productionTable['usedResource'] = array_keys($productionTable['production'][$BuildStartLvl]);
} elseif (in_array($elementID, $reslist['storage'])) {
$CurrentLevel = $PLANET[$resource[$elementID]];
$BuildStartLvl = max($CurrentLevel - 2, 0);
for ($BuildLevel = $BuildStartLvl; $BuildLevel < $BuildStartLvl + 15; $BuildLevel++) {
foreach ($ressIDs as $ID) {
if (!isset($ProdGrid[$elementID]['storage'][$ID])) {
continue;
}
$production = round(eval(ResourceUpdate::getProd($ProdGrid[$elementID]['storage'][$ID])));
$production *= Config::get()->resource_multiplier;
$production *= STORAGE_FACTOR;
$productionTable['storage'][$BuildLevel][$ID] = $production;
}
}
$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']);
$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->getAvailableFleets());
} elseif ($elementID == 44 && $PLANET[$resource[44]] > 0) {
$MissileList = array(502 => $PLANET[$resource[502]], 503 => $PLANET[$resource[503]]);
}
$this->assign(array('elementID' => $elementID, 'productionTable' => $productionTable, 'CurrentLevel' => $CurrentLevel, 'MissileList' => $MissileList, 'Bonus' => BuildFunctions::getAvalibleBonus($elementID), 'FleetInfo' => $FleetInfo, 'gateData' => $gateData));
$this->display('page.information.default.tpl');
}
示例3: show
function show()
{
global $LNG, $ProdGrid, $resource, $reslist, $USER, $PLANET;
$config = Config::get();
if ($USER['urlaubs_modus'] == 1 || $PLANET['planet_type'] != 1) {
$basicIncome[901] = 0;
$basicIncome[902] = 0;
$basicIncome[903] = 0;
$basicIncome[911] = 0;
} else {
$basicIncome[901] = $config->{$resource[901] . '_basic_income'};
$basicIncome[902] = $config->{$resource[902] . '_basic_income'};
$basicIncome[903] = $config->{$resource[903] . '_basic_income'};
$basicIncome[911] = $config->{$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));
$ressIDs = array_merge(array(), $reslist['resstype'][1], $reslist['resstype'][2]);
$productionList = array();
if ($PLANET['energy_used'] != 0) {
$prodLevel = min(1, $PLANET['energy'] / abs($PLANET['energy_used']));
} else {
$prodLevel = 0;
}
/* Data for eval */
$BuildEnergy = $USER[$resource[113]];
$BuildTemp = $PLANET['temp_max'];
foreach ($reslist['prod'] as $ProdID) {
if (isset($PLANET[$resource[$ProdID]]) && $PLANET[$resource[$ProdID]] == 0) {
continue;
}
if (isset($USER[$resource[$ProdID]]) && $USER[$resource[$ProdID]] == 0) {
continue;
}
$productionList[$ProdID] = array('production' => array(901 => 0, 902 => 0, 903 => 0, 911 => 0), 'elementLevel' => $PLANET[$resource[$ProdID]], 'prodLevel' => $PLANET[$resource[$ProdID] . '_porcent']);
/* Data for eval */
$BuildLevel = $PLANET[$resource[$ProdID]];
$BuildLevelFactor = $PLANET[$resource[$ProdID] . '_porcent'];
foreach ($ressIDs as $ID) {
if (!isset($ProdGrid[$ProdID]['production'][$ID])) {
continue;
}
$Production = eval(ResourceUpdate::getProd($ProdGrid[$ProdID]['production'][$ID]));
if (in_array($ID, $reslist['resstype'][2])) {
$Production *= $config->energySpeed;
} else {
$Production *= $prodLevel * $config->resource_multiplier;
}
$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->resource_multiplier, 902 => $basicIncome[902] * $config->resource_multiplier, 903 => $basicIncome[903] * $config->resource_multiplier, 911 => $basicIncome[911] * $config->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.02 * $USER[$resource[131]]), 902 => $temp[902]['plus'] * ($USER['factor']['Resource'] + 0.02 * $USER[$resource[132]]), 903 => $temp[903]['plus'] * ($USER['factor']['Resource'] + 0.02 * $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(10, 0) as $percent) {
$prodSelector[$percent] = $percent * 10 . '%';
}
$this->assign(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');
}
示例4: show
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');
}
示例5: show
//.........这里部分代码省略.........
$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');
}
示例6: show
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'));
//.........这里部分代码省略.........
示例7: show
//.........这里部分代码省略.........
}
$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: show
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');
}
示例9: show
function show()
{
global $LNG, $ProdGrid, $resource, $reslist, $CONF, $pricelist, $USER, $PLANET;
//if($USER['id'] != 1){
//$this->printMessage("<span class='rouge'>This page is under maintenace, come back in some minutes</span>", true, array('game.php?page=overview', 2));
//}
if ($USER['urlaubs_modus'] == 1 || $PLANET['planet_type'] != 1) {
$basicIncome[901] = 0;
$basicIncome[902] = 0;
$basicIncome[903] = 0;
$basicIncome[904] = 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[904] = Config::get($resource[904] . '_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), 904 => 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;
}
$prodList = array(4, 10, 1, 2, 3, 48, 7, 8, 9, 11);
foreach ($prodList as $ProdID) {
$BuildLevelFactor = $PLANET[$resource[$ProdID] . '_porcent'];
$BuildLevel = $PLANET[$resource[$ProdID]];
$productionList[$ProdID] = array('production' => array(901 => 0, 902 => 0, 903 => 0, 904 => 0, 911 => 0), 'elementLevel' => $PLANET[$resource[$ProdID]], 'prodLevel' => $PLANET[$resource[$ProdID] . '_porcent'] * 10);
foreach ($ressIDs as $ID) {
if (!isset($ProdGrid[$ProdID]['production'][$ID])) {
continue;
}
$Production = eval(ResourceUpdate::getProd($ProdGrid[$ProdID]['production'][$ID]));
if ($ID != 911) {
$Production *= $prodLevel * 20;
} 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']), 904 => shortly_number($PLANET[$resource[904] . '_max']));
$basicProduction = array(901 => $basicIncome[901] * Config::get('resource_multiplier'), 902 => $basicIncome[902] * Config::get('resource_multiplier'), 903 => $basicIncome[903] * Config::get('resource_multiplier'), 904 => $basicIncome[904] * 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], 904 => $PLANET[$resource[904] . '_perhour'] + $basicProduction[904], 911 => $PLANET[$resource[911]] + $basicProduction[911] + $PLANET[$resource[911] . '_used']);
$bonusProduction = array(901 => $temp[901]['plus'] * ($USER['factor']['Resource'] + 0.02 * $USER[$resource[131]]), 902 => $temp[902]['plus'] * ($USER['factor']['Resource'] + 0.02 * $USER[$resource[132]]), 903 => $temp[903]['plus'] * ($USER['factor']['Resource'] + 0.02 * $USER[$resource[133]]), 904 => $temp[904]['plus'] * ($USER['factor']['Resource'] + 0.02 * $USER[$resource[133]]), 911 => $temp[911]['plus'] * $USER['factor']['Energy']);
$dailyProduction = array(901 => $totalProduction[901] * 24, 902 => $totalProduction[902] * 24, 903 => $totalProduction[903] * 24, 904 => $totalProduction[904] * 24, 911 => $totalProduction[911]);
$weeklyProduction = array(901 => $totalProduction[901] * 168, 902 => $totalProduction[902] * 168, 903 => $totalProduction[903] * 168, 904 => $totalProduction[904] * 168, 911 => $totalProduction[911]);
$CivilProduction = array(901 => $totalProduction[901] / 100 * 0.0002 * $PLANET['civil'], 902 => $totalProduction[902] / 100 * 0.0002 * $PLANET['civil'], 903 => $totalProduction[903] / 100 * 0.0002 * $PLANET['civil'], 904 => $totalProduction[904] / 100 * 0.0002 * $PLANET['civil'], 911 => 0);
$prodSelector = array();
foreach (range(0, 10) as $procent) {
$prodSelector[$procent] = $procent * 10 . '%';
}
$this->tplObj->loadscript('resource.js');
$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, 'CivilProduction' => $CivilProduction, 'storage' => $storage, 'colo_metal' => $PLANET['colo_metal'], 'colo_crystal' => $PLANET['colo_crystal'], 'colo_deut' => $PLANET['colo_deut'], 'colo_elyrium' => $PLANET['colo_elyrium'], 'metalprod' => $PLANET['metal_mine_porcent'] * 10, 'crystalprod' => $PLANET['crystal_mine_porcent'] * 10, 'deutprod' => $PLANET['deuterium_sintetizer_porcent'] * 10, 'elyriumprod' => $PLANET['elyrium_mine_porcent'] * 10));
$this->display('page.resources.default.tpl');
}
示例10: show
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;
//.........这里部分代码省略.........