* 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 BatimentBuildingPage (&$CurrentPlanet, $CurrentUser) { trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED); global $lang, $resource, $reslist, $dpath, $gameConfig, $_GET; CheckPlanetUsedFields ( $CurrentPlanet ); // Tables des batiments possibles par type de planete $Allowed['1'] = array( 1, 2, 3, 4, 12, 14, 15, 21, 22, 23, 24, 31, 33, 34, 44); $Allowed['3'] = array( 12, 14, 21, 22, 23, 24, 34, 41, 42, 43); // Boucle d'interpretation des eventuelles commandes if (isset($_GET['cmd'])) { // On passe une commande $bThisIsCheated = false; $bDoItNow = false; $TheCommand = $_GET['cmd']; $Element = $_GET['building']; $ListID = $_GET['listid']; if ( isset ( $Element )) { if ( !strchr ( $Element, " ") ) { if ( !strchr ( $Element, ",") ) { if ( !strchr ( $Element, ";") ) { if (in_array( trim($Element), $Allowed[$CurrentPlanet['planet_type']])) { $bDoItNow = true; } else { $bThisIsCheated = true; } } else { $bThisIsCheated = true; } } else { $bThisIsCheated = true; } } else { $bThisIsCheated = true; } } elseif ( isset ( $ListID )) { $bDoItNow = true; } if ($bDoItNow == true) { switch($TheCommand){ case 'cancel': // Interrompre le premier batiment de la queue CancelBuildingFromQueue ( $CurrentPlanet, $CurrentUser ); break; case 'remove': // Supprimer un element de la queue (mais pas le premier) // $RemID -> element de la liste a supprimer RemoveBuildingFromQueue ( $CurrentPlanet, $CurrentUser, $ListID ); break; case 'insert': // Insere un element dans la queue AddBuildingToQueue ( $CurrentPlanet, $CurrentUser, $Element, true ); break; case 'destroy': // Detruit un batiment deja construit sur la planete ! AddBuildingToQueue ( $CurrentPlanet, $CurrentUser, $Element, false ); break; default: break; } // switch } elseif ($bThisIsCheated == true) { ResetThisFuckingCheater ( $CurrentUser['id'] ); } } SetNextQueueElementOnTop ( $CurrentPlanet, $CurrentUser ); $Queue = ShowBuildingQueue ( $CurrentPlanet, $CurrentUser ); // On enregistre ce que l'on a modifi� dans planet ! BuildingSavePlanetRecord ( $CurrentPlanet ); // On enregistre ce que l'on a eventuellement modifi� dans users BuildingSaveUserRecord ( $CurrentUser ); if ($Queue['lenght'] < MAX_BUILDING_QUEUE_SIZE) { $CanBuildElement = true; } else { $CanBuildElement = false; } $SubTemplate = gettemplate('buildings_builds_row'); $BuildingPage = ""; foreach($lang['tech'] as $Element => $ElementName) { if (in_array($Element, $Allowed[$CurrentPlanet['planet_type']])) { $CurrentMaxFields = CalculateMaxPlanetFields($CurrentPlanet); if ($CurrentPlanet["field_current"] < ($CurrentMaxFields - $Queue['lenght'])) { $RoomIsOk = true; } else { $RoomIsOk = false; } if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) { $HaveRessources = IsElementBuyable ($CurrentUser, $CurrentPlanet, $Element, true, false); $parse = array(); $parse['dpath'] = $dpath; $parse['i'] = $Element; $BuildingLevel = $CurrentPlanet[$resource[$Element]]; $parse['nivel'] = ($BuildingLevel == 0) ? "" : " (". $lang['level'] ." ". $BuildingLevel .")"; $parse['n'] = $ElementName; $parse['descriptions'] = $lang['res']['descriptions'][$Element]; $ElementBuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element); $parse['time'] = ShowBuildTime($ElementBuildTime); $parse['price'] = GetElementPrice($CurrentUser, $CurrentPlanet, $Element); $parse['rest_price'] = GetRestPrice($CurrentUser, $CurrentPlanet, $Element); $parse['click'] = ''; $NextBuildLevel = $CurrentPlanet[$resource[$Element]] + 1; if ($Element == 31) { // Sp�cial Laboratoire if ($CurrentUser["b_tech_planet"] != 0 && // Si pas 0 y a une recherche en cours $gameConfig['BuildLabWhileRun'] != 1) { // Variable qui contient le parametre // On verifie si on a le droit d'evoluer pendant les recherches (Setting dans config) $parse['click'] = "". $lang['in_working'] .""; } } if ($parse['click'] != '') { // Bin on ne fait rien, vu que l'on l'a deja fait au dessus !! } elseif ($RoomIsOk && $CanBuildElement) { if ($Queue['lenght'] == 0) { if ($NextBuildLevel == 1) { if ( $HaveRessources == true ) { $parse['click'] = "". $lang['BuildFirstLevel'] .""; } else { $parse['click'] = "". $lang['BuildFirstLevel'] .""; } } else { if ( $HaveRessources == true ) { $parse['click'] = "". $lang['BuildNextLevel'] ." ". $NextBuildLevel .""; } else { $parse['click'] = "". $lang['BuildNextLevel'] ." ". $NextBuildLevel .""; } } } else { $parse['click'] = "". $lang['InBuildQueue'] .""; } } elseif ($RoomIsOk && !$CanBuildElement) { if ($NextBuildLevel == 1) { $parse['click'] = "". $lang['BuildFirstLevel'] .""; } else { $parse['click'] = "". $lang['BuildNextLevel'] ." ". $NextBuildLevel .""; } } else { $parse['click'] = "". $lang['NoMoreSpace'] .""; } $BuildingPage .= parsetemplate($SubTemplate, $parse); } } } $parse = $lang; // Faut il afficher la liste de construction ?? if ($Queue['lenght'] > 0) { $parse['BuildListScript'] = InsertBuildListScript ( "buildings" ); $parse['BuildList'] = $Queue['buildlist']; } else { $parse['BuildListScript'] = ""; $parse['BuildList'] = ""; } $parse['planet_field_current'] = $CurrentPlanet["field_current"]; $parse['planet_field_max'] = $CurrentPlanet['field_max'] + ($CurrentPlanet[$resource[33]] * 5); $parse['field_libre'] = $parse['planet_field_max'] - $CurrentPlanet['field_current']; $parse['BuildingsList'] = $BuildingPage; $page .= parsetemplate(gettemplate('buildings_builds'), $parse); display($page, $lang['Builds']); } ?>