Updated themes

Updated buildings
Updated shipyard page (ships & defense)
Added Buildings building queue display & cancel build action.
Added research lab
Added navigation block structure
Removed old code
Updated registration
Added files to .gitignore

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
This commit is contained in:
Gregory PLANCHAT 2011-09-13 12:54:03 +02:00
commit 8f0f7a4d46
147 changed files with 3488 additions and 2468 deletions

View file

@ -49,7 +49,9 @@ function bbcode($string) {
'/\[img](.*?)\[\/img\]/ise',
'/\[color=(.*?)\](.*?)\[\/color\]/is',
'/\[quote\](.*?)\[\/quote\]/ise',
'/\[code\](.*?)\[\/code\]/ise'
'/\[code\](.*?)\[\/code\]/ise',
'#\[youtube\]([^\]]+)\[/youtube\]#',
'#\[dailymotion\]([^\]]+)\[/dailymotion\]#'
);
$replace = array(
@ -62,12 +64,14 @@ function bbcode($string) {
'<span style="text-decoration: underline;">\1</span>',
'<span style="text-decoration: line-through;">\1</span>',
'<span style="text-decoration: line-through;">\1</span>',
'urlfix(\'\\1\',\'\\2\')',
'urlfix($1,$2)',
'<a href="mailto:\1" title="\1">\2</a>',
'imagefix(\'\\1\')',
'<span style="color: \1;">\2</span>',
'sQuote(\'\1\')',
'sCode(\'\1\')'
'sCode(\'\1\')',
'<iframe src="http://www.youtube.com/embed/\\1" width="640" height="385"></iframe>',
'<iframe frameborder="0" width="560" height="420" src="http://www.dailymotion.com/embed/video/\\1?width=560"></iframe>'
);
return preg_replace($pattern, $replace, nl2br(htmlspecialchars(stripslashes($string))));

View file

@ -1,199 +0,0 @@
<?php
/**
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/
*
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
* 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 <http://www.gnu.org/licenses/>.
*
* --> 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)
{
global $lang, $resource, $reslist, $dpath, $gameConfig;
// 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'] );
}
}
$Queue = ShowBuildingQueue ( $CurrentPlanet, $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<53>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'] = "<font color=#FF0000>". $lang['in_working'] ."</font>";
}
}
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'] = "<a href=\"?cmd=insert&building=". $Element ."\"><font color=#00FF00>". $lang['BuildFirstLevel'] ."</font></a>";
} else {
$parse['click'] = "<font color=#FF0000>". $lang['BuildFirstLevel'] ."</font>";
}
} else {
if ( $HaveRessources == true ) {
$parse['click'] = "<a href=\"?cmd=insert&building=". $Element ."\"><font color=#00FF00>". $lang['BuildNextLevel'] ." ". $NextBuildLevel ."</font></a>";
} else {
$parse['click'] = "<font color=#FF0000>". $lang['BuildNextLevel'] ." ". $NextBuildLevel ."</font>";
}
}
} else {
$parse['click'] = "<a href=\"?cmd=insert&building=". $Element ."\"><font color=#00FF00>". $lang['InBuildQueue'] ."</font></a>";
}
} elseif ($RoomIsOk && !$CanBuildElement) {
if ($NextBuildLevel == 1) {
$parse['click'] = "<font color=#FF0000>". $lang['BuildFirstLevel'] ."</font>";
} else {
$parse['click'] = "<font color=#FF0000>". $lang['BuildNextLevel'] ." ". $NextBuildLevel ."</font>";
}
} else {
$parse['click'] = "<font color=#FF0000>". $lang['NoMoreSpace'] ."</font>";
}
$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']);
}

View file

@ -1,62 +0,0 @@
<?php
/**
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/
*
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
* 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 <http://www.gnu.org/licenses/>.
*
* --> 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
*/
function CheckLabSettingsInQueue ( $CurrentPlanet ) {
global $lang, $gameConfig;
if ($CurrentPlanet['b_building_id'] != "0") {
$BuildQueue = $CurrentPlanet['b_building_id'];
if (strpos ($BuildQueue, ";")) {
$Queue = explode (";", $BuildQueue);
$CurrentBuilding = $Queue[0];
} else {
// Y a pas de queue de construction la liste n'a qu'un seul element
$CurrentBuilding = $BuildQueue;
}
if ($CurrentBuilding == 31 && $gameConfig['BuildLabWhileRun'] != 1) {
$return = false;
} else {
$return = true;
}
} else {
$return = true;
}
return $return;
}
?>

View file

@ -1,150 +0,0 @@
<?php
/**
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/
*
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
* 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 <http://www.gnu.org/licenses/>.
*
* --> 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 DefensesBuildingPage ( &$currentPlanet, $currentUser ) {
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);
$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 ...
$TabIndex = 0;
$PageTable = "";
$types = include ROOT_PATH . 'includes/data/types.php';
foreach ($types[Legacies_Empire::TYPE_DEFENSE] as $shipId) {
if ($shipyard->checkAvailability($shipId)) {
// Disponible à la construction
// 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<tr>";
// Imagette + Link vers la page d'info
$PageTable .= "<th class=l>";
$PageTable .= "<a href=infos.".PHPEXT."?gid=".$shipId.">";
$PageTable .= "<img border=0 src=\"".$dpath."gebaeude/".$shipId.".gif\" align=top width=120 height=120></a>";
$PageTable .= "</th>";
// Description
$PageTable .= "<td class=l>";
$PageTable .= "<a href=infos.".PHPEXT."?gid=".$shipId.">".$shipIdName."</a> ".$shipIdNbre."<br>";
$PageTable .= "".$lang['res']['descriptions'][$shipId]."<br>";
// 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 .= "</td>";
// Case nombre d'elements a construire
$PageTable .= "<td class=k>";
// Si ... Et Seulement si je peux construire je mets la p'tite zone de saisie
$maxElements = $shipyard->getMaximumBuildableElementsCount($shipId);
if (bccomp($maxElements, 0) > 0) {
$TabIndex++;
$PageTable .= "<input type=\"text\" id=\"fmenge:{$shipId}\" name=\"fmenge[".$shipId."]\" alt='".$lang['tech'][$shipId]."' size=5 maxlength=5 value=0 tabindex=".$TabIndex.">";
if (MAX_FLEET_OR_DEFS_PER_ROW > 0 && $maxElements > MAX_FLEET_OR_DEFS_PER_ROW) {
$maxElements = MAX_FLEET_OR_DEFS_PER_ROW;
}
$PageTable .= '<br /><a onclick="document.getElementById(\'fmenge:'.$shipId.'\').value=\''.strval($maxElements).'\';" style="cursor:pointer;">Nombre max ('.number_format($maxElements, 0, ',', '.').')</a>';
} else if (in_array($shipId, array(Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME, Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME))) {
$PageTable .= '<span style="color:red">Limite de construction atteinte.</span>';
} else if (in_array($shipId, array(Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME, Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME))) {
$PageTable .= '<span style="color:red">Silo plein.</span>';
}
$PageTable .= '</td>';
// Fin de ligne (les 3 cases sont construites !!
$PageTable .= "</tr>";
}
}
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;
// fragmento de template
$page .= parsetemplate(gettemplate('buildings_defense'), $parse);
display($page, $lang['Defense']);
}
// Version History
// - 1.0 Modularisation
// - 1.1 Correction mise en place d'une limite max d'elements constructibles par ligne
// - 1.2 Correction limitation bouclier meme si en queue de fabrication
//
?>

View file

@ -1,83 +0,0 @@
<?php
/**
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/
*
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
* 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 <http://www.gnu.org/licenses/>.
*
* --> 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 $CurrentUser
* @param unknown_type $CurrentPlanet
*/
function ElementBuildListQueue ( $CurrentUser, $CurrentPlanet ) {
// Jamais appelé pour le moment donc totalement modifiable !
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
/*
alter table `ogame`.`game_planets`
change `name` `name` varchar (255) NULL COLLATE latin1_general_ci,
change `b_building_id` `b_building_id` text NULL COLLATE latin1_general_ci,
change `b_tech_id` `b_tech_id` text NULL COLLATE latin1_general_ci,
change `b_hangar_id` `b_hangar_id` text NULL COLLATE latin1_general_ci,
change `image` `image` varchar (32) DEFAULT 'normaltempplanet01' NOT NULL COLLATE latin1_general_ci,
change `b_building_queue` `b_building_queue` text NULL COLLATE latin1_general_ci,
change `unbau` `unbau` varchar (100) NULL COLLATE latin1_general_ci;
*/
// global $lang, $pricelist;
//
// // Array del b_hangar_id
// $b_building_id = explode(';', $CurrentPlanet['b_building_queue']);
//
// $a = $b = $c = "";
// foreach($b_hangar_id as $n => $array) {
// if ($array != '') {
// $array = explode(',', $array);
// // calculamos el tiempo
// $time = GetBuildingTime($user, $CurrentPlanet, $array[0]);
// $totaltime += $time * $array[1];
// $c .= "$time,";
// $b .= "'{$lang['tech'][$array[0]]}',";
// $a .= "{$array[1]},";
// }
// }
//
// $parse = $lang;
// $parse['a'] = $a;
// $parse['b'] = $b;
// $parse['c'] = $c;
// $parse['b_hangar_id_plus'] = $CurrentPlanet['b_hangar'];
//
// $parse['pretty_time_b_hangar'] = pretty_time($totaltime - $CurrentPlanet['b_hangar']); // //$CurrentPlanet['last_update']
//
// $text .= parsetemplate(gettemplate('buildings_script'), $parse);
//
// return $text;
}
?>

View file

@ -1,149 +0,0 @@
<?php
/**
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/
*
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
* 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 <http://www.gnu.org/licenses/>.
*
* --> 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)
{
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<tr>";
// Imagette + Link vers la page d'info
$PageTable .= "<th class=l>";
$PageTable .= "<a href=infos.".PHPEXT."?gid=".$shipId.">";
$PageTable .= "<img border=0 src=\"".$dpath."gebaeude/".$shipId.".gif\" align=top width=120 height=120></a>";
$PageTable .= "</th>";
// Description
$PageTable .= "<td class=l>";
$PageTable .= "<a href=infos.".PHPEXT."?gid=".$shipId.">".$shipIdName."</a> ".$shipIdNbre."<br />";
$PageTable .= "".$lang['res']['descriptions'][$shipId]."<br />";
// 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 .= "</td>";
// Case nombre d'elements a construire
$PageTable .= "<th class=k>";
// Si ... Et Seulement si je peux construire je mets la p'tite zone de saisie
if ($CanBuildOne) {
$tableIndex++;
$PageTable .= "<input type=text id=\"fmenge:{$shipId}\" name=fmenge[".$shipId."] alt='".$lang['tech'][$shipId]."' value=0 tabindex=".$tableIndex.">";
}
$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 .= '<br /><a onclick="document.getElementById(\'fmenge:'.$shipId.'\').value=\''.strval($maxElements).'\';" style="cursor:pointer;">Nombre max ('.number_format($maxElements, 0, ',', '.').')</a>';
}
// Fin de ligne (les 3 cases sont construites !!
$PageTable .= "</tr>";
}
}
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']);
}

View file

@ -1,107 +0,0 @@
<?php
/**
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/
*
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
* 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 <http://www.gnu.org/licenses/>.
*
* --> 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 HandleTechnologieBuild ( &$CurrentPlanet, &$CurrentUser ) {
global $resource;
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
if ($CurrentUser['b_tech_planet'] != 0) {
// Y a une technologie en cours sur une de mes colonies
if ($CurrentUser['b_tech_planet'] != $CurrentPlanet['id']) {
// Et ce n'est pas sur celle ci !!
$WorkingPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '". $CurrentUser['b_tech_planet'] ."';", 'planets', true);
}
if ($WorkingPlanet) {
$ThePlanet = $WorkingPlanet;
} else {
$ThePlanet = $CurrentPlanet;
}
if ($ThePlanet['b_tech'] <= time() &&
$ThePlanet['b_tech_id'] != 0) {
// La recherche en cours est terminée ...
$CurrentUser[$resource[$ThePlanet['b_tech_id']]]++;
// Mise a jour de la planete sur laquelle la technologie a été recherchée
$QryUpdatePlanet = "UPDATE {{table}} SET ";
$QryUpdatePlanet .= "`b_tech` = '0', ";
$QryUpdatePlanet .= "`b_tech_id` = '0' ";
$QryUpdatePlanet .= "WHERE ";
$QryUpdatePlanet .= "`id` = '". $ThePlanet['id'] ."';";
doquery( $QryUpdatePlanet, 'planets');
// Mes a jour de la techno sur l'enregistrement Utilisateur
// Et tant qu'a faire des stats points
$QryUpdateUser = "UPDATE {{table}} SET ";
$QryUpdateUser .= "`".$resource[$ThePlanet['b_tech_id']]."` = '". $CurrentUser[$resource[$ThePlanet['b_tech_id']]] ."', ";
$QryUpdateUser .= "`b_tech_planet` = '0' ";
$QryUpdateUser .= "WHERE ";
$QryUpdateUser .= "`id` = '". $CurrentUser['id'] ."';";
doquery( $QryUpdateUser, 'users');
$ThePlanet["b_tech_id"] = 0;
if (isset($WorkingPlanet)) {
$WorkingPlanet = $ThePlanet;
} else {
$CurrentPlanet = $ThePlanet;
}
$Result['WorkOn'] = "";
$Result['OnWork'] = false;
} elseif ($ThePlanet["b_tech_id"] == 0) {
// Il n'y a rien a l'ouest ...
// Pas de Technologie en cours devait y avoir un bug lors de la derniere connexion
// On met l'enregistrement informant d'une techno en cours de recherche a jours
doquery("UPDATE {{table}} SET `b_tech_planet` = '0' WHERE `id` = '". $CurrentUser['id'] ."';", 'users');
$Result['WorkOn'] = "";
$Result['OnWork'] = false;
} else {
// Bin on bosse toujours ici ... Alors ne nous derangez pas !!!
$Result['WorkOn'] = $ThePlanet;
$Result['OnWork'] = true;
}
} else {
$Result['WorkOn'] = "";
$Result['OnWork'] = false;
}
return $Result;
}
// History revision
// 1.0 - mise en forme modularisation version initiale
// 1.1 - Correction retour de fonction (retourne un tableau a la place d'un flag)
?>

View file

@ -1,40 +0,0 @@
<?php
/**
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/
*
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
* 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 <http://www.gnu.org/licenses/>.
*
* --> 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 $CallProgram
*/
function InsertBuildListScript($CallProgram)
{
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
return null;
}

View file

@ -1,70 +0,0 @@
<?php
/**
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/
*
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
* 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 <http://www.gnu.org/licenses/>.
*
* --> 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
* @param unknown_type $QueueID
*/
function RemoveBuildingFromQueue ( &$CurrentPlanet, $CurrentUser, $QueueID ) {
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
if ($QueueID > 1) {
$CurrentQueue = $CurrentPlanet['b_building_id'];
if ($CurrentQueue != 0) {
$QueueArray = explode ( ";", $CurrentQueue );
$ActualCount = count ( $QueueArray );
$ListIDArray = explode ( ",", $QueueArray[$QueueID - 2] );
$BuildEndTime = $ListIDArray[3];
$ListIDArray = explode ( ",", $QueueArray[$QueueID - 1] );
$Element = $ListIDArray[0];
for ($ID = $QueueID; $ID < $ActualCount; $ID++ ) {
$ListIDArray = explode ( ",", $QueueArray[$ID] );
if ($Element == $ListIDArray[0])
{
$ListIDArray[1] -= 1;
$ListIDArray[2] = GetBuildingTimeLevel($CurrentUser, $CurrentPlanet, $ListIDArray[0], $ListIDArray[1]);
}
$BuildEndTime += $ListIDArray[2];
$ListIDArray[3] = $BuildEndTime;
$QueueArray[$ID - 1] = implode ( ",", $ListIDArray );
}
unset ($QueueArray[$ActualCount - 1]);
$NewQueue = implode ( ";", $QueueArray );
}
$CurrentPlanet['b_building_id'] = $NewQueue;
}
return $QueueID;
}
?>

View file

@ -1,218 +0,0 @@
<?php
/**
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/
*
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
* 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 <http://www.gnu.org/licenses/>.
*
* --> 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
* @param unknown_type $InResearch
* @param unknown_type $ThePlanet
*/
function ResearchBuildingPage (&$CurrentPlanet, $CurrentUser, $InResearch, $ThePlanet)
{
global $lang, $resource, $reslist, $dpath, $gameConfig, $_GET;
$NoResearchMessage = "";
$bContinue = true;
// Deja est qu'il y a un laboratoire sur la planete ???
if ($CurrentPlanet[$resource[31]] == 0) {
message($lang['no_laboratory'], $lang['Research']);
}
// Ensuite ... Est ce que la labo est en cours d'upgrade ?
if (!CheckLabSettingsInQueue ( $CurrentPlanet )) {
$NoResearchMessage = $lang['labo_on_update'];
$bContinue = false;
}
// Boucle d'interpretation des eventuelles commandes
if (isset($_GET['cmd'])) {
$TheCommand = $_GET['cmd'];
$Techno = $_GET['tech'];
if ( is_numeric($Techno) ) {
if ( in_array($Techno, $reslist['tech']) ) {
// Bon quand on arrive ici ... On sait deja qu'on a une technologie valide
if ( is_array ($ThePlanet) ) {
$WorkingPlanet = $ThePlanet;
} else {
$WorkingPlanet = $CurrentPlanet;
}
switch($TheCommand){
case 'cancel':
if ($ThePlanet['b_tech_id'] == $Techno) {
$costs = GetBuildingPrice($CurrentUser, $WorkingPlanet, $Techno);
$WorkingPlanet['metal'] += $costs['metal'];
$WorkingPlanet['crystal'] += $costs['crystal'];
$WorkingPlanet['deuterium'] += $costs['deuterium'];
$WorkingPlanet['b_tech_id'] = 0;
$WorkingPlanet["b_tech"] = 0;
$CurrentUser['b_tech_planet'] = 0;
$UpdateData = true;
$InResearch = false;
}
break;
case 'search':
if ( IsTechnologieAccessible($CurrentUser, $WorkingPlanet, $Techno) &&
IsElementBuyable($CurrentUser, $WorkingPlanet, $Techno) ) {
$costs = GetBuildingPrice($CurrentUser, $WorkingPlanet, $Techno);
$WorkingPlanet['metal'] -= $costs['metal'];
$WorkingPlanet['crystal'] -= $costs['crystal'];
$WorkingPlanet['deuterium'] -= $costs['deuterium'];
$WorkingPlanet["b_tech_id"] = $Techno;
$WorkingPlanet["b_tech"] = time() + GetBuildingTime($CurrentUser, $WorkingPlanet, $Techno);
$CurrentUser["b_tech_planet"] = $WorkingPlanet["id"];
$UpdateData = true;
$InResearch = true;
}
break;
}
if ($UpdateData == true) {
$QryUpdatePlanet = "UPDATE {{table}} SET ";
$QryUpdatePlanet .= "`b_tech_id` = '". $WorkingPlanet['b_tech_id'] ."', ";
$QryUpdatePlanet .= "`b_tech` = '". $WorkingPlanet['b_tech'] ."', ";
$QryUpdatePlanet .= "`metal` = '". $WorkingPlanet['metal'] ."', ";
$QryUpdatePlanet .= "`crystal` = '". $WorkingPlanet['crystal'] ."', ";
$QryUpdatePlanet .= "`deuterium` = '". $WorkingPlanet['deuterium'] ."' ";
$QryUpdatePlanet .= "WHERE ";
$QryUpdatePlanet .= "`id` = '". $WorkingPlanet['id'] ."';";
doquery( $QryUpdatePlanet, 'planets');
$QryUpdateUser = "UPDATE {{table}} SET ";
$QryUpdateUser .= "`b_tech_planet` = '". $CurrentUser['b_tech_planet'] ."' ";
$QryUpdateUser .= "WHERE ";
$QryUpdateUser .= "`id` = '". $CurrentUser['id'] ."';";
doquery( $QryUpdateUser, 'users');
}
if ( is_array ($ThePlanet) ) {
$ThePlanet = $WorkingPlanet;
} else {
$CurrentPlanet = $WorkingPlanet;
if ($TheCommand == 'search') {
$ThePlanet = $CurrentPlanet;
}
}
}
} else {
$bContinue = false;
}
}
$TechRowTPL = gettemplate('buildings_research_row');
$TechScrTPL = gettemplate('buildings_research_script');
foreach($lang['tech'] as $Tech => $TechName) {
if ($Tech > 105 && $Tech <= 199) {
if ( IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Tech)) {
$RowParse = $lang;
$RowParse['dpath'] = $dpath;
$RowParse['tech_id'] = $Tech;
$building_level = $CurrentUser[$resource[$Tech]];
$RowParse['tech_level'] = ($building_level == 0) ? "" : "( ". $lang['level']. " ".$building_level." )";
$RowParse['tech_name'] = $TechName;
$RowParse['tech_descr'] = $lang['res']['descriptions'][$Tech];
$RowParse['tech_price'] = GetElementPrice($CurrentUser, $CurrentPlanet, $Tech);
$SearchTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Tech);
$RowParse['search_time'] = ShowBuildTime($SearchTime);
$RowParse['tech_restp'] = $lang['Rest_ress'] ." ". GetRestPrice ($CurrentUser, $CurrentPlanet, $Tech, true);
$CanBeDone = IsElementBuyable($CurrentUser, $CurrentPlanet, $Tech);
// Arbre de decision de ce que l'on met dans la derniere case de la ligne
if (!$InResearch) {
$LevelToDo = 1 + $CurrentUser[$resource[$Tech]];
if ($CanBeDone) {
if (!CheckLabSettingsInQueue ( $CurrentPlanet )) {
// Le laboratoire est cours de construction ou d'evolution
// Et dans la config du systeme, on ne permet pas la recherche pendant
// que le labo est en construction ou evolution !
if ($LevelToDo == 1) {
$TechnoLink = "<font color=#FF0000>". $lang['Rechercher'] ."</font>";
} else {
$TechnoLink = "<font color=#FF0000>". $lang['Rechercher'] ."<br>".$lang['level']." ".$LevelToDo."</font>";
}
} else {
$TechnoLink = "<a href=\"buildings.php?mode=research&cmd=search&tech=".$Tech."\">";
if ($LevelToDo == 1) {
$TechnoLink .= "<font color=#00FF00>". $lang['Rechercher'] ."</font>";
} else {
$TechnoLink .= "<font color=#00FF00>". $lang['Rechercher'] ."<br>".$lang['level']." ".$LevelToDo."</font>";
}
$TechnoLink .= "</a>";
}
} else {
if ($LevelToDo == 1) {
$TechnoLink = "<font color=#FF0000>". $lang['Rechercher'] ."</font>";
} else {
$TechnoLink = "<font color=#FF0000>". $lang['Rechercher'] ."<br>".$lang['level']." ".$LevelToDo."</font>";
}
}
} else {
// Y a une construction en cours
if ($ThePlanet["b_tech_id"] == $Tech) {
// C'est le technologie en cours de recherche
$bloc = $lang;
if ($ThePlanet['id'] != $CurrentPlanet['id']) {
// Ca se passe sur une autre planete
$bloc['tech_time'] = $ThePlanet["b_tech"] - time();
$bloc['tech_name'] = $lang['on'] ."<br>". $ThePlanet["name"];
$bloc['tech_home'] = $ThePlanet["id"];
$bloc['tech_id'] = $ThePlanet["b_tech_id"];
} else {
// Ca se passe sur la planete actuelle
$bloc['tech_time'] = $CurrentPlanet["b_tech"] - time();
$bloc['tech_name'] = "";
$bloc['tech_home'] = $CurrentPlanet["id"];
$bloc['tech_id'] = $CurrentPlanet["b_tech_id"];
}
$TechnoLink = parsetemplate($TechScrTPL, $bloc);
} else {
// Technologie pas en cours recherche
$TechnoLink = "<center>-</center>";
}
}
$RowParse['tech_link'] = $TechnoLink;
$TechnoList .= parsetemplate($TechRowTPL, $RowParse);
}
}
}
$PageParse = $lang;
$PageParse['noresearch'] = $NoResearchMessage;
$PageParse['technolist'] = $TechnoList;
$Page .= parsetemplate(gettemplate('buildings_research'), $PageParse);
display( $Page, $lang['Research'] );
}
// History revision
// 1.0 - Release initiale / modularisation / Reecriture / Commentaire / Mise en forme
// 1.1 - BUG affichage de la techno en cours
// 1.2 - Restructuration modification pour permettre d'annuller proprement une techno en cours
?>

View file

@ -1,130 +0,0 @@
<?php
/**
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/
*
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
* 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 <http://www.gnu.org/licenses/>.
*
* --> 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 SetNextQueueElementOnTop ( &$CurrentPlanet, $CurrentUser ) {
global $lang, $resource;
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
// Garde fou ... Si le temps de construction n'est pas 0 on ne fait rien !!!
if ($CurrentPlanet['b_building'] == 0) {
$CurrentQueue = $CurrentPlanet['b_building_id'];
if ($CurrentQueue != 0) {
$QueueArray = explode ( ";", $CurrentQueue );
$Loop = true;
while ($Loop == true) {
$ListIDArray = explode ( ",", $QueueArray[0] );
$Element = $ListIDArray[0];
$Level = $ListIDArray[1];
$BuildTime = $ListIDArray[2];
$BuildEndTime = $ListIDArray[3];
$BuildMode = $ListIDArray[4]; // pour savoir si on construit ou detruit
$HaveNoMoreLevel = false;
if ($BuildMode == 'destroy') {
$ForDestroy = true;
} else {
$ForDestroy = false;
}
$HaveRessources = IsElementBuyable ($CurrentUser, $CurrentPlanet, $Element, true, $ForDestroy);
if ($ForDestroy) {
if ($CurrentPlanet[$resource[$Element]] == 0) {
$HaveRessources = false;
$HaveNoMoreLevel = true;
}
}
if ( $HaveRessources == true ) {
$Needed = GetBuildingPrice ($CurrentUser, $CurrentPlanet, $Element, true, $ForDestroy);
$CurrentPlanet['metal'] -= $Needed['metal'];
$CurrentPlanet['crystal'] -= $Needed['crystal'];
$CurrentPlanet['deuterium'] -= $Needed['deuterium'];
$CurrentTime = time();
$BuildEndTime = $BuildEndTime;
$NewQueue = implode ( ";", $QueueArray );
if ($NewQueue == "") {
$NewQueue = '0';
}
$Loop = false;
} else {
$ElementName = $lang['tech'][$Element];
if ($HaveNoMoreLevel == true) {
$Message = sprintf ($lang['sys_nomore_level'], $ElementName );
} else {
$Needed = GetBuildingPrice ($CurrentUser, $CurrentPlanet, $Element, true, $ForDestroy);
$Message = sprintf ($lang['sys_notenough_money'], $ElementName,
pretty_number ($CurrentPlanet['metal']), $lang['Metal'],
pretty_number ($CurrentPlanet['crystal']), $lang['Crystal'],
pretty_number ($CurrentPlanet['deuterium']), $lang['Deuterium'],
pretty_number ($Needed['metal']), $lang['Metal'],
pretty_number ($Needed['crystal']), $lang['Crystal'],
pretty_number ($Needed['deuterium']), $lang['Deuterium']);
}
SendSimpleMessage ( $CurrentUser['id'], '', '', 99, $lang['sys_buildlist'], $lang['sys_buildlist_fail'], $Message);
array_shift( $QueueArray );
$ActualCount = count ( $QueueArray );
if ( $ActualCount == 0 ) {
$BuildEndTime = '0';
$NewQueue = '0';
$Loop = false;
}
}
} // while
} else {
$BuildEndTime = '0';
$NewQueue = '0';
}
// Ecriture de la mise a jour dans la BDD
$CurrentPlanet['b_building'] = $BuildEndTime;
$CurrentPlanet['b_building_id'] = $NewQueue;
$QryUpdatePlanet = "UPDATE {{table}} SET ";
$QryUpdatePlanet .= "`metal` = '". $CurrentPlanet['metal'] ."' , ";
$QryUpdatePlanet .= "`crystal` = '". $CurrentPlanet['crystal'] ."' , ";
$QryUpdatePlanet .= "`deuterium` = '". $CurrentPlanet['deuterium'] ."' , ";
$QryUpdatePlanet .= "`b_building` = '". $CurrentPlanet['b_building'] ."' , ";
$QryUpdatePlanet .= "`b_building_id` = '". $CurrentPlanet['b_building_id'] ."' ";
$QryUpdatePlanet .= "WHERE ";
$QryUpdatePlanet .= "`id` = '" . $CurrentPlanet['id'] . "';";
doquery( $QryUpdatePlanet, 'planets');
}
return;
}
?>

View file

@ -1,59 +0,0 @@
<?php
/**
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/
*
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
* 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 <http://www.gnu.org/licenses/>.
*
* --> 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 $CurrentUser
*/
function SetSelectedPlanet ( &$CurrentUser )
{
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
if (!isset($_GET['cp']) || !isset($_GET['re'])) {
return;
}
$SelectPlanet = $_GET['cp'];
$RestorePlanet = $_GET['re'];
if (isset($SelectPlanet) &&
is_numeric($SelectPlanet) &&
isset($RestorePlanet) &&
$RestorePlanet == 0) {
$IsPlanetMine = doquery("SELECT `id` FROM {{table}} WHERE `id` = '". $SelectPlanet ."' AND `id_owner` = '". $CurrentUser['id'] ."';", 'planets', true);
if ($IsPlanetMine) {
// Ouaip elle est a moi ... Donc ... on met la met comme planete courrante
$CurrentUser['current_planet'] = $SelectPlanet;
// Puis tant qu'a faire ... On l'enregistre aussi sait on jamais
doquery("UPDATE {{table}} SET `current_planet` = '". $SelectPlanet ."' WHERE `id` = '".$CurrentUser['id']."';", 'users');
}
}
}
?>

View file

@ -1,109 +0,0 @@
<?php
/**
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/
*
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
* 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 <http://www.gnu.org/licenses/>.
*
* --> 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.
*
*/
/**
*
* @param unknown_type $CurrentPlanet
* @param unknown_type $CurrentUser
*/
function ShowBuildingQueue ( $CurrentPlanet, $CurrentUser ) {
global $lang;
$CurrentQueue = $CurrentPlanet['b_building_id'];
$QueueID = 0;
if ($CurrentQueue != 0) {
// Queue de fabrication documentée ... Y a au moins 1 element a construire !
$QueueArray = explode ( ";", $CurrentQueue );
// Compte le nombre d'elements
$ActualCount = count ( $QueueArray );
} else {
// Queue de fabrication vide
$QueueArray = "0";
$ActualCount = 0;
}
$ListIDRow = "";
if ($ActualCount != 0) {
$PlanetID = $CurrentPlanet['id'];
for ($QueueID = 0; $QueueID < $ActualCount; $QueueID++) {
// Chaque element de la liste de fabrication est un tableau de 5 données
// [0] -> Le batiment
// [1] -> Le niveau du batiment
// [2] -> La durée de construction
// [3] -> L'heure théorique de fin de construction
// [4] -> type d'action
$BuildArray = explode (",", $QueueArray[$QueueID]);
$BuildEndTime = floor($BuildArray[3]);
$CurrentTime = floor(time());
if ($BuildEndTime >= $CurrentTime) {
$ListID = $QueueID + 1;
$Element = $BuildArray[0];
$BuildLevel = $BuildArray[1];
$BuildMode = $BuildArray[4];
$BuildTime = $BuildEndTime - time();
$ElementTitle = $lang['tech'][$Element];
if ($ListID > 0) {
$ListIDRow .= "<tr>";
if ($BuildMode == 'build') {
$ListIDRow .= " <td class=\"l\" colspan=\"2\">". $ListID .".: ". $ElementTitle ." ". $BuildLevel ."</td>";
} else {
$ListIDRow .= " <td class=\"l\" colspan=\"2\">". $ListID .".: ". $ElementTitle ." ". $BuildLevel ." ". $lang['destroy'] ."</td>";
}
$ListIDRow .= " <td class=\"k\">";
if ($ListID == 1) {
$ListIDRow .= " <div id=\"blc\" class=\"z\">". $BuildTime ."<br>";
$ListIDRow .= " <a href=\"buildings.php?listid=". $ListID ."&amp;cmd=cancel&amp;planet=". $PlanetID ."\">". $lang['DelFirstQueue'] ."</a></div>";
$ListIDRow .= " <script language=\"JavaScript\">";
$ListIDRow .= " pp = \"". $BuildTime ."\";\n"; // temps necessaire (a compter de maintenant et sans ajouter time() )
$ListIDRow .= " pk = \"". $ListID ."\";\n"; // id index (dans la liste de construction)
$ListIDRow .= " pm = \"cancel\";\n"; // mot de controle
$ListIDRow .= " pl = \"". $PlanetID ."\";\n"; // id planete
$ListIDRow .= " t();\n";
$ListIDRow .= " </script>";
$ListIDRow .= " <strong color=\"lime\"><br><font color=\"lime\">". date("j/m H:i:s" ,$BuildEndTime) ."</font></strong>";
} else {
$ListIDRow .= " <font color=\"red\">";
$ListIDRow .= " <a href=\"buildings.php?listid=". $ListID ."&amp;cmd=remove&amp;planet=". $PlanetID ."\">". $lang['DelFromQueue'] ."</a></font>";
}
$ListIDRow .= " </td>";
$ListIDRow .= "</tr>";
}
}
}
}
$RetValue['lenght'] = $ActualCount;
$RetValue['buildlist'] = $ListIDRow;
return $RetValue;
}
?>

View file

@ -1,124 +0,0 @@
<?php
/**
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/
*
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
* 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 <http://www.gnu.org/licenses/>.
*
* --> 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 $CurrentUser
* @param unknown_type $CurrentPlanet
*/
function ShowTopNavigationBar ( $CurrentUser, $CurrentPlanet ) {
global $lang, $_GET;
// debug_print_backtrace();
if ($CurrentUser) {
if ( !$CurrentPlanet ) {
$CurrentPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '". $CurrentUser['current_planet'] ."';", 'planets', true);
}
// Actualisation des ressources de la planete
$NavigationTPL = gettemplate('topnav');
$dpath = (!$CurrentUser["dpath"]) ? DEFAULT_SKINPATH : $CurrentUser["dpath"];
$parse = $lang;
$parse['dpath'] = $dpath;
$parse['image'] = $CurrentPlanet['image'];
// Genearation de la combo des planetes du joueur
$parse['planetlist'] = '';
$ThisUsersPlanets = SortUserPlanets ( $CurrentUser );
while ($CurPlanet = $ThisUsersPlanets->fetch(PDO::FETCH_BOTH)) {
if ($CurPlanet["destruyed"] == 0) {
$parse['planetlist'] .= "\n<option ";
if ($CurPlanet['id'] == $CurrentUser['current_planet']) {
// Bon puisque deja on s'y trouve autant le marquer
$parse['planetlist'] .= "selected=\"selected\" ";
}
$parse['planetlist'] .= "value=\"?cp=".$CurPlanet['id']."";
$parse['planetlist'] .= "&amp;mode=".$_GET['mode'];
$parse['planetlist'] .= "&amp;re=0\">";
// Nom et coordonnées de la planete
$parse['planetlist'] .= "".$CurPlanet['name'];
$parse['planetlist'] .= "&nbsp;[".$CurPlanet['galaxy'].":";
$parse['planetlist'] .= "".$CurPlanet['system'].":";
$parse['planetlist'] .= "".$CurPlanet['planet'];
$parse['planetlist'] .= "]&nbsp;&nbsp;</option>";
}
}
$energy = pretty_number($CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"]) . "/" . pretty_number($CurrentPlanet["energy_max"]);
// Energie
if (($CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"]) < 0) {
$parse['energy'] = colorRed($energy);
} else {
$parse['energy'] = $energy;
}
// Metal
$metal = pretty_number($CurrentPlanet["metal"]);
if (($CurrentPlanet["metal"] > $CurrentPlanet["metal_max"])) {
$parse['metal'] = colorRed($metal);
} else {
$parse['metal'] = $metal;
}
// Cristal
$crystal = pretty_number($CurrentPlanet["crystal"]);
if (($CurrentPlanet["crystal"] > $CurrentPlanet["crystal_max"])) {
$parse['crystal'] = colorRed($crystal);
} else {
$parse['crystal'] = $crystal;
}
// Deuterium
$deuterium = pretty_number($CurrentPlanet["deuterium"]);
if (($CurrentPlanet["deuterium"] > $CurrentPlanet["deuterium_max"])) {
$parse['deuterium'] = colorRed($deuterium);
} else {
$parse['deuterium'] = $deuterium;
}
// Message
if ($CurrentUser['new_message'] > 0) {
$parse['message'] = "<a href=\"messages.php\">[ ". $CurrentUser['new_message'] ." ]</a>";
} else {
$parse['message'] = "0";
}
// Le tout passe dans la template
$TopBar = parsetemplate( $NavigationTPL, $parse);
} else {
$TopBar = "";
}
return $TopBar;
}
?>