* All rights reserved. * * 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 . * * --> NOTICE <-- * This file is part of the core development branch, changing its contents will * make you unable to use the automatic updates manager. Please refer to the * documentation for further information about customizing XNova. * */ /** * * @deprecated * @param unknown_type $currentPlanet * @param unknown_type $currentUser */ function FleetBuildingPage(&$currentPlanet, &$currentUser) { trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED); global $lang, $resource, $dpath; // S'il n'y a pas de Chantier if (!isset($currentPlanet[$resource[Legacies_Empire::ID_BUILDING_SHIPYARD]]) || $currentPlanet[$resource[Legacies_Empire::ID_BUILDING_SHIPYARD]] == 0) { message($lang['need_hangar'], $lang['tech'][Legacies_Empire::ID_BUILDING_SHIPYARD]); return; } $shipyard = Legacies_Empire_Model_Planet_Building_Shipyard::factory($currentPlanet, $currentUser); if (isset($_POST['fmenge']) && is_array($_POST['fmenge'])) { foreach ($_POST['fmenge'] as $shipId => $count) { $shipId = intval($shipId); if (in_array($shipId, $resource)) { continue; } $count = intval($count); if ($count <= 0) { continue; } if ($shipId == Legacies_Empire::ID_SHIP_DEATH_STAR && $currentUser['rpg_destructeur'] == 1) { // FIXME: Officers $count = $count * 2; } $shipyard->appendQueue($shipId, $count); } $currentPlanet = $shipyard->save(); } // ------------------------------------------------------------------------------------------------------- // Construction de la page du Chantier (car si j'arrive ici ... c'est que j'ai tout ce qu'il faut pour ... $tableIndex = 0; $types = include ROOT_PATH . 'includes/data/types.php'; foreach ($types[Legacies_Empire::TYPE_SHIP] as $shipId) { if ($shipyard->checkAvailability($shipId)) { // Disponible à la construction // On regarde si on peut en acheter au moins 1 $CanBuildOne = IsElementBuyable($currentUser, $currentPlanet, $shipId, false); // On regarde combien de temps il faut pour construire l'element $BuildOneElementTime = $shipyard->getBuildTime($shipId, 1); // Disponibilité actuelle $shipIdCount = $currentPlanet[$resource[$shipId]]; $shipIdNbre = ($shipIdCount == 0) ? "" : " (".$lang['dispo'].": " . pretty_number($shipIdCount) . ")"; // Construction des 3 cases de la ligne d'un element dans la page d'achat ! // Début de ligne $PageTable .= "\n"; // Imagette + Link vers la page d'info $PageTable .= ""; $PageTable .= ""; $PageTable .= ""; $PageTable .= ""; // Description $PageTable .= ""; $PageTable .= "".$shipIdName." ".$shipIdNbre."
"; $PageTable .= "".$lang['res']['descriptions'][$shipId]."
"; // On affiche le 'prix' avec eventuellement ce qui manque en ressource $PageTable .= GetElementPrice($currentUser, $currentPlanet, $shipId, false); // On affiche le temps de construction (c'est toujours tellement plus joli) $PageTable .= ShowBuildTime($BuildOneElementTime); $PageTable .= ""; // Case nombre d'elements a construire $PageTable .= ""; // Si ... Et Seulement si je peux construire je mets la p'tite zone de saisie if ($CanBuildOne) { $tableIndex++; $PageTable .= ""; } $maxElements = $shipyard->getMaximumBuildableElementsCount($shipId); if (MAX_FLEET_OR_DEFS_PER_ROW > 0 && $maxElements > MAX_FLEET_OR_DEFS_PER_ROW) { $maxElements = MAX_FLEET_OR_DEFS_PER_ROW; } if ($CanBuildOne) { $PageTable .= '
Nombre max ('.number_format($maxElements, 0, ',', '.').')'; } // Fin de ligne (les 3 cases sont construites !! $PageTable .= ""; } } if (!empty($currentPlanet['b_hangar_id'])) { $data = array(); foreach ($shipyard->getQueue() as $item) { $data[] = array_merge($item, array( 'label' => $lang['tech'][$item['ship_id']], 'speed' => $shipyard->getBuildTime($item['ship_id'], 1) )); } $parse = array( 'data' => json_encode($data) ); $BuildQueue = parsetemplate(gettemplate('buildings_script'), $parse); } $parse = $lang; // La page se trouve dans $PageTable; $parse['buildlist'] = $PageTable; // Et la liste de constructions en cours dans $BuildQueue; $parse['buildinglist'] = $BuildQueue; $page .= parsetemplate(gettemplate('buildings_fleet'), $parse); display($page, $lang['Fleet']); }