Initial commit

This commit is contained in:
Gregory PLANCHAT 2011-06-07 09:23:48 +02:00
commit d7619777af
915 changed files with 59386 additions and 0 deletions

View file

@ -0,0 +1,122 @@
<?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 $user
* @param unknown_type $planetrow
*/
function AbandonColony($user,$planetrow) {
$destruyed = time() + 3600; //Temps avant la suppression dans la galaxie
$DeleteMoon = false;
if ($planetrow["planet_type"]==1){
//Selectionne si il y a une lune sur la colonie a supprim<69>e
$QryWithMoon = "SELECT * FROM {{table}} ";
$QryWithMoon .= "WHERE ";
$QryWithMoon .= "`destruyed` = '0' AND ";
$QryWithMoon .= "`galaxy` = '". $planetrow['galaxy'] ."' AND ";
$QryWithMoon .= "`system` = '". $planetrow['system'] ."' AND ";
$QryWithMoon .= "`lunapos` = '". $planetrow['planet'] ."' AND ";
$QryWithMoon .= "`id_owner` = '". $user['id'] ."' ;";
$IsMoon = doquery( $QryWithMoon , 'lunas',true);
if($IsMoon){
//Envoi la demande de suppression de la lune associ<63> a la colonie
$DeleteMoon = true; // borrar luna
}
//Mise en mode destruction d ela colonie
$QryUpdatePlanet = "UPDATE {{table}} SET ";
$QryUpdatePlanet .= "`destruyed` = '" . $destruyed . "', ";
$QryUpdatePlanet .= "`id_owner` = '0' ";
$QryUpdatePlanet .= "WHERE ";
$QryUpdatePlanet .= "`id` = '" . $user['current_planet'] . "' LIMIT 1;";
doquery($QryUpdatePlanet , 'planets');
//Si on veut supprimer une lune
}elseif($planetrow["planet_type"]==3){
$DeleteMoon = true; //borrar luna
}
if ($DeleteMoon){
$QryDeleteMoon = "DELETE FROM {{table}} ";
$QryDeleteMoon .= "WHERE ";
$QryDeleteMoon .= "`galaxy` = '". $planetrow['galaxy'] ."' AND ";
$QryDeleteMoon .= "`system` = '". $planetrow['system'] ."' AND ";
$QryDeleteMoon .= "`planet` = '". $planetrow['planet'] ."' AND ";
$QryDeleteMoon .= "`planet_type` = '3' AND ";
$QryDeleteMoon .= "`id_owner` = '". $user['id'] ."' ;";
doquery($QryDeleteMoon , 'planets');
$Qrydestructionlune = "DELETE FROM {{table}} ";
$Qrydestructionlune .= "WHERE ";
$Qrydestructionlune .= "`galaxy` = '". $planetrow['galaxy'] ."' AND ";
$Qrydestructionlune .= "`system` = '". $planetrow['system'] ."' AND ";
$Qrydestructionlune .= "`lunapos` = '". $planetrow['planet'] ."' AND ";
$Qrydestructionlune .= "`id_owner` = '". $user['id'] ."' ;";
doquery( $Qrydestructionlune , 'lunas');
$Qrydestructionlune2 = "UPDATE {{table}} SET ";
$Qrydestructionlune2 .= "`id_luna` = '0' ";
$Qrydestructionlune2 .= "WHERE ";
$Qrydestructionlune2 .= "`galaxy` = '". $planetrow['galaxy'] ."' AND ";
$Qrydestructionlune2 .= "`system` = '". $planetrow['system'] ."' AND ";
$Qrydestructionlune2 .= "`planet` = '". $planetrow['planet'] ."' ;";
doquery( $Qrydestructionlune2 , 'galaxy');
}
}
function CheckFleets($planetrow){
$QryFleet = "SELECT * FROM {{table}} WHERE ";
$QryFleet .= "(`fleet_start_galaxy` = '".$planetrow["galaxy"]."' AND ";
$QryFleet .= "`fleet_start_system` = '".$planetrow["system"]."' AND ";
$QryFleet .= "`fleet_start_planet` = '".$planetrow["planet"]."'";
if ($planetrow["planet_type"]==3){
$QryFleet .= " AND `fleet_start_type` = '3'";
}
$QryFleet .= ") OR ";
$QryFleet .= "(`fleet_end_galaxy` = '".$planetrow["galaxy"]."' AND ";
$QryFleet .= "`fleet_end_system` = '".$planetrow["system"]."' AND ";
$QryFleet .= "`fleet_end_planet` = '".$planetrow["planet"]."'";
if ($planetrow["planet_type"]==3){
$QryFleet .= " AND `fleet_end_type` = '3'";
}
$QryFleet .= " AND `fleet_mess` <> 1 ); ";
$fleets = doquery($QryFleet, 'fleets',true);
if($fleets){
return true;
}
return false;
}
?>

View file

@ -0,0 +1,114 @@
<?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 $Element
* @param unknown_type $AddMode
*/
function AddBuildingToQueue ( &$CurrentPlanet, $CurrentUser, $Element, $AddMode = true) {
global $lang, $resource;
$CurrentQueue = $CurrentPlanet['b_building_id'];
if ($CurrentQueue != 0) {
$QueueArray = explode ( ";", $CurrentQueue );
$ActualCount = count ( $QueueArray );
} else {
$QueueArray = "";
$ActualCount = 0;
}
if ($AddMode == true) {
$BuildMode = 'build';
} else {
$BuildMode = 'destroy';
}
if ( $ActualCount < MAX_BUILDING_QUEUE_SIZE ) {
$QueueID = $ActualCount + 1;
} else {
$QueueID = false;
}
if ( $QueueID != false ) {
// Faut verifier si l'Element que l'on veut integrer est deja dans le tableau !
if ($QueueID > 1) {
$InArray = 0;
for ( $QueueElement = 0; $QueueElement < $ActualCount; $QueueElement++ ) {
$QueueSubArray = explode ( ",", $QueueArray[$QueueElement] );
if ($QueueSubArray[0] == $Element) {
$InArray++;
}
}
} else {
$InArray = 0;
}
if ($InArray != 0) {
$ActualLevel = $CurrentPlanet[$resource[$Element]];
if ($AddMode == true) {
$BuildLevel = $ActualLevel + 1 + $InArray;
$CurrentPlanet[$resource[$Element]] += $InArray;
$BuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
$CurrentPlanet[$resource[$Element]] -= $InArray;
} else {
$BuildLevel = $ActualLevel - 1 + $InArray;
$CurrentPlanet[$resource[$Element]] -= $InArray;
$BuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element) / 2;
$CurrentPlanet[$resource[$Element]] += $InArray;
}
} else {
$ActualLevel = $CurrentPlanet[$resource[$Element]];
if ($AddMode == true) {
$BuildLevel = $ActualLevel + 1;
$BuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
} else {
$BuildLevel = $ActualLevel - 1;
$BuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element) / 2;
}
}
if ($QueueID == 1) {
$BuildEndTime = time() + $BuildTime;
} else {
$PrevBuild = explode (",", $QueueArray[$ActualCount - 1]);
$BuildEndTime = $PrevBuild[3] + $BuildTime;
}
$QueueArray[$ActualCount] = $Element .",". $BuildLevel .",". $BuildTime .",". $BuildEndTime .",". $BuildMode;
$NewQueue = implode ( ";", $QueueArray );
$CurrentPlanet['b_building_id'] = $NewQueue;
}
return $QueueID;
}
?>

View file

@ -0,0 +1,129 @@
<?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 $string
*/
function bbcode($string) {
$pattern = array(
'/\\n/',
'/\\r/',
'/\[list\](.*?)\[\/list\]/ise',
'/\[b\](.*?)\[\/b\]/is',
'/\[strong\](.*?)\[\/strong\]/is',
'/\[i\](.*?)\[\/i\]/is',
'/\[u\](.*?)\[\/u\]/is',
'/\[s\](.*?)\[\/s\]/is',
'/\[del\](.*?)\[\/del\]/is',
'/\[url=(.*?)\](.*?)\[\/url\]/ise',
'/\[email=(.*?)\](.*?)\[\/email\]/is',
'/\[img](.*?)\[\/img\]/ise',
'/\[color=(.*?)\](.*?)\[\/color\]/is',
'/\[quote\](.*?)\[\/quote\]/ise',
'/\[code\](.*?)\[\/code\]/ise'
);
$replace = array(
'',
'',
'sList(\'\\1\')',
'<b>\1</b>',
'<strong>\1</strong>',
'<i>\1</i>',
'<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\')',
'<a href="mailto:\1" title="\1">\2</a>',
'imagefix(\'\\1\')',
'<span style="color: \1;">\2</span>',
'sQuote(\'\1\')',
'sCode(\'\1\')'
);
return preg_replace($pattern, $replace, nl2br(htmlspecialchars(stripslashes($string))));
}
function image($string)
{
//On va pas se casser le fion a lire les accents quand meme !!!!!!!
$string = str_replace("&#39;", "'", $string);
//Emoticones.... COPIEZ COLLEZ CES LIGNES POUR RAJOUTER LES VOTRES !
$string = str_replace("Smile", "[img]../emoticones/Smile.png[/img]", $string);
$string = str_replace("cool", "[img]../emoticones/cool.png[/img]", $string);
$string = str_replace("grrr", "[img]../emoticones/grrr.png[/img]", $string);
$string = str_replace("love", "[img]../emoticones/love.png[/img]", $string);
$string = str_replace("msn", "[img]../emoticones/msn.png[/img]", $string);
$string = str_replace("Oo", "[img]../emoticones/Oo.png[/img]", $string);
$string = str_replace("perdu", "[img]../emoticones/perdu.png[/img]", $string);
$string = str_replace("wink", "[img]../emoticones/wink.png[/img]", $string);
$string = str_replace("wow", "[img]../emoticones/wow.png[/img]", $string);
return $string;
}
function sCode($string){
$pattern = '/\<img src=\\\"(.*?)img\/smilies\/(.*?).png\\\" alt=\\\"(.*?)\\\" \/>/s';
$string = preg_replace($pattern, '\3', $string);
return '<pre>' . trim($string) . '</pre>';
}
function sList($string) {
$tmp = explode('[*]', stripslashes($string));
$out = null;
foreach($tmp as $list) {
if(strlen(str_replace('', '', $list)) > 0) {
$out .= '<li>' . trim($list) . '</li>';
}
}
return '<ul>' . $out . '</ul>';
}
function imagefix($img) {
if(substr($img, 0, 7) != 'http://') {
$img = './images/' . $img;
}
return '<img src="' . $img . '" alt="' . $img . '" title="' . $img . '" />';
}
function urlfix($url, $title) {
$title = stripslashes($title);
return '<a href="' . $url . '" title="' . $title . '">' . $title . '</a>';
}
?>

View file

@ -0,0 +1,208 @@
<?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, $_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<66> dans planet !
BuildingSavePlanetRecord ( $CurrentPlanet );
// On enregistre ce que l'on a eventuellement modifi<66> 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<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

@ -0,0 +1,167 @@
<?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 $FleetRow
* @param unknown_type $Status
* @param unknown_type $Owner
* @param unknown_type $Label
* @param unknown_type $Record
*/
function BuildFleetEventTable ( $FleetRow, $Status, $Owner, $Label, $Record ) {
global $lang;
$FleetStyle = array (
1 => 'attack',
2 => 'federation',
3 => 'transport',
4 => 'deploy',
5 => 'hold',
6 => 'espionage',
7 => 'colony',
8 => 'harvest',
9 => 'destroy',
10 => 'missile',
15 => 'transport',
);
$FleetStatus = array ( 0 => 'flight', 1 => 'holding', 2 => 'return' );
if ( $Owner == true ) {
$FleetPrefix = 'own';
} else {
$FleetPrefix = '';
}
$RowsTPL = gettemplate ('overview_fleet_event');
$MissionType = $FleetRow['fleet_mission'];
$FleetContent = CreateFleetPopupedFleetLink ( $FleetRow, $lang['ov_fleet'], $FleetPrefix . $FleetStyle[ $MissionType ] );
$FleetCapacity = CreateFleetPopupedMissionLink ( $FleetRow, $lang['type_mission'][ $MissionType ], $FleetPrefix . $FleetStyle[ $MissionType ] );
$StartPlanet = doquery("SELECT `name` FROM {{table}} WHERE `galaxy` = '".$FleetRow['fleet_start_galaxy']."' AND `system` = '".$FleetRow['fleet_start_system']."' AND `planet` = '".$FleetRow['fleet_start_planet']."' AND `planet_type` = '".$FleetRow['fleet_start_type']."';", 'planets', true);
$StartType = $FleetRow['fleet_start_type'];
$TargetPlanet = doquery("SELECT `name` FROM {{table}} WHERE `galaxy` = '".$FleetRow['fleet_end_galaxy']."' AND `system` = '".$FleetRow['fleet_end_system']."' AND `planet` = '".$FleetRow['fleet_end_planet']."' AND `planet_type` = '".$FleetRow['fleet_end_type']."';", 'planets', true);
$TargetType = $FleetRow['fleet_end_type'];
if ($Status != 2) {
if ($StartType == 1) {
$StartID = $lang['ov_planet_to'];
} elseif ($StartType == 3) {
$StartID = $lang['ov_moon_to'];
}
$StartID .= $StartPlanet['name'] ." ";
$StartID .= GetStartAdressLink ( $FleetRow, $FleetPrefix . $FleetStyle[ $MissionType ] );
if ( $MissionType != 15 ) {
if ($TargetType == 1) {
$TargetID = $lang['ov_planet_to_target'];
} elseif ($TargetType == 2) {
$TargetID = $lang['ov_debris_to_target'];
} elseif ($TargetType == 3) {
$TargetID = $lang['ov_moon_to_target'];
}
} else {
$TargetID = $lang['ov_explo_to_target'];
}
$TargetID .= $TargetPlanet['name'] ." ";
$TargetID .= GetTargetAdressLink ( $FleetRow, $FleetPrefix . $FleetStyle[ $MissionType ] );
} else {
if ($StartType == 1) {
$StartID = $lang['ov_back_planet'];
} elseif ($StartType == 3) {
$StartID = $lang['ov_back_moon'];
}
$StartID .= $StartPlanet['name'] ." ";
$StartID .= GetStartAdressLink ( $FleetRow, $FleetPrefix . $FleetStyle[ $MissionType ] );
if ( $MissionType != 15 ) {
if ($TargetType == 1) {
$TargetID = $lang['ov_planet_from'];
} elseif ($TargetType == 2) {
$TargetID = $lang['ov_debris_from'];
} elseif ($TargetType == 3) {
$TargetID = $lang['ov_moon_from'];
}
} else {
$TargetID = $lang['ov_explo_from'];
}
$TargetID .= $TargetPlanet['name'] ." ";
$TargetID .= GetTargetAdressLink ( $FleetRow, $FleetPrefix . $FleetStyle[ $MissionType ] );
}
if ($Owner == true) {
$EventString = $lang['ov_une']; // 'Une de tes '
$EventString .= $FleetContent;
} else {
$EventString = $lang['ov_une_hostile']; // 'Une '
$EventString .= $FleetContent;
$EventString .= $lang['ov_hostile']; // ' hostile de '
$EventString .= BuildHostileFleetPlayerLink ( $FleetRow );
}
if ($Status == 0) {
$Time = $FleetRow['fleet_start_time'];
$Rest = $Time - time();
$EventString .= $lang['ov_vennant']; // ' venant '
$EventString .= $StartID;
$EventString .= $lang['ov_atteint']; // ' atteint '
$EventString .= $TargetID;
$EventString .= $lang['ov_mission']; // '. Elle avait pour mission: '
} elseif ($Status == 1) {
$Time = $FleetRow['fleet_end_stay'];
$Rest = $Time - time();
$EventString .= $lang['ov_vennant']; // ' venant '
$EventString .= $StartID;
$EventString .= $lang['ov_explo_stay']; // ' explore '
$EventString .= $TargetID;
$EventString .= $lang['ov_explo_mission']; // '. Elle a pour mission: '
} elseif ($Status == 2) {
$Time = $FleetRow['fleet_end_time'];
$Rest = $Time - time();
$EventString .= $lang['ov_rentrant'];// ' rentrant '
$EventString .= $TargetID;
$EventString .= $StartID;
$EventString .= $lang['ov_mission']; // '. Elle avait pour mission: '
}
$EventString .= $FleetCapacity;
$bloc['fleet_status'] = $FleetStatus[ $Status ];
$bloc['fleet_prefix'] = $FleetPrefix;
$bloc['fleet_style'] = $FleetStyle[ $MissionType ];
$bloc['fleet_javai'] = InsertJavaScriptChronoApplet ( $Label, $Record, $Rest, true );
$bloc['fleet_order'] = $Label . $Record;
$bloc['fleet_time'] = date("H:i:s", $Time);
$bloc['fleet_descr'] = $EventString;
$bloc['fleet_javas'] = InsertJavaScriptChronoApplet ( $Label, $Record, $Rest, false );
return parsetemplate($RowsTPL, $bloc);
}
?>

View file

@ -0,0 +1,70 @@
<?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
*/
function BuildFlyingFleetTable () {
global $lang;
$TableTPL = gettemplate('admin/fleet_rows');
$FlyingFleets = doquery ("SELECT * FROM {{table}} ORDER BY `fleet_end_time` ASC;", 'fleets');
while ( $CurrentFleet = mysql_fetch_assoc( $FlyingFleets ) ) {
$FleetOwner = doquery("SELECT `username` FROM {{table}} WHERE `id` = '". $CurrentFleet['fleet_owner'] ."';", 'users', true);
$TargetOwner = doquery("SELECT `username` FROM {{table}} WHERE `id` = '". $CurrentFleet['fleet_target_owner'] ."';", 'users', true);
$Bloc['Id'] = $CurrentFleet['fleet_id'];
$Bloc['Mission'] = CreateFleetPopupedMissionLink ( $CurrentFleet, $lang['type_mission'][ $CurrentFleet['fleet_mission'] ], '' );
$Bloc['Mission'] .= "<br>". (($CurrentFleet['fleet_mess'] == 1) ? "R" : "A" );
$Bloc['Fleet'] = CreateFleetPopupedFleetLink ( $CurrentFleet, $lang['tech'][200], '' );
$Bloc['St_Owner'] = "[". $CurrentFleet['fleet_owner'] ."]<br>". $FleetOwner['username'];
$Bloc['St_Posit'] = "[".$CurrentFleet['fleet_start_galaxy'] .":". $CurrentFleet['fleet_start_system'] .":". $CurrentFleet['fleet_start_planet'] ."]<br>". ( ($CurrentFleet['fleet_start_type'] == 1) ? "[P]": (($CurrentFleet['fleet_start_type'] == 2) ? "D" : "L" )) ."";
$Bloc['St_Time'] = date('G:i:s d/n/Y', $CurrentFleet['fleet_start_time']);
if (is_array($TargetOwner)) {
$Bloc['En_Owner'] = "[". $CurrentFleet['fleet_target_owner'] ."]<br>". $TargetOwner['username'];
} else {
$Bloc['En_Owner'] = "";
}
$Bloc['En_Posit'] = "[".$CurrentFleet['fleet_end_galaxy'] .":". $CurrentFleet['fleet_end_system'] .":". $CurrentFleet['fleet_end_planet'] ."]<br>". ( ($CurrentFleet['fleet_end_type'] == 1) ? "[P]": (($CurrentFleet['fleet_end_type'] == 2) ? "D" : "L" )) ."";
if ($CurrentFleet['fleet_mission'] == 15) {
$Bloc['Wa_Time'] = date('G:i:s d/n/Y', $CurrentFleet['fleet_stay_time']);
} else {
$Bloc['Wa_Time'] = "";
}
$Bloc['En_Time'] = date('G:i:s d/n/Y', $CurrentFleet['fleet_end_time']);
$table .= parsetemplate( $TableTPL, $Bloc );
}
return $table;
}
?>

View file

@ -0,0 +1,49 @@
<?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 BuildingSavePlanetRecord ( $CurrentPlanet ) {
// Enregistrement des divers changements dans les tables
$QryUpdatePlanet = "UPDATE {{table}} SET ";
$QryUpdatePlanet .= "`b_building_id` = '". $CurrentPlanet['b_building_id'] ."', ";
$QryUpdatePlanet .= "`b_building` = '". $CurrentPlanet['b_building'] ."' ";
$QryUpdatePlanet .= "WHERE ";
$QryUpdatePlanet .= "`id` = '". $CurrentPlanet['id'] ."';";
doquery( $QryUpdatePlanet, 'planets');
return;
}
?>

View file

@ -0,0 +1,47 @@
<?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 BuildingSaveUserRecord ( $CurrentUser ) {
$QryUpdateUser = "UPDATE {{table}} SET ";
$QryUpdateUser .= "`xpminier` = '". $CurrentUser['xpminier'] ."' ";
$QryUpdateUser .= "WHERE ";
$QryUpdateUser .= "`id` = '". $CurrentUser["id"] ."';";
doquery( $QryUpdateUser, 'users');
return;
}
?>

View file

@ -0,0 +1,114 @@
<?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 CancelBuildingFromQueue ( &$CurrentPlanet, &$CurrentUser ) {
$CurrentQueue = $CurrentPlanet['b_building_id'];
if ($CurrentQueue != 0) {
// Creation du tableau de la liste de construction
$QueueArray = explode ( ";", $CurrentQueue );
// Comptage du nombre d'elements dans la liste
$ActualCount = count ( $QueueArray );
// Stockage de l'element a 'interrompre'
$CanceledIDArray = explode ( ",", $QueueArray[0] );
$Element = $CanceledIDArray[0];
$BuildMode = $CanceledIDArray[4]; // pour savoir si on construit ou detruit
$nb_item = $Element;
if ($ActualCount > 1) {
array_shift( $QueueArray );
$NewCount = count( $QueueArray );
// Mise a jour de l'heure de fin de construction theorique du batiment
$BuildEndTime = time();
for ($ID = 0; $ID < $NewCount ; $ID++ ) {
$ListIDArray = explode ( ",", $QueueArray[$ID] );
// Pour diminuer le niveau et le temps de construction
// si le bâtiment qui est annulé se trouve plusieurs fois dans la queue
// Exemple de queue de construction :
// Mine de métal (Niveau 40) | Silo de missile (Niveau 30) | Silo de missiles (Niveau 31) | Mine de métal (Niveau 41)
// Si on supprime le premier bâtiment, on aura dans la queue de construction :
// Silo de missile (Niveau 30) | Silo de missiles (Niveau 31) | Mine de métal (Niveau 40)
if ( $nb_item == $ListIDArray[0])
{
$ListIDArray[1] -= 1;
$ListIDArray[2] = GetBuildingTimeLevel($CurrentUser, $CurrentPlanet, $ListIDArray[0], $ListIDArray[1]);
}
$BuildEndTime += $ListIDArray[2];
$ListIDArray[3] = $BuildEndTime;
$QueueArray[$ID] = implode ( ",", $ListIDArray );
}
$NewQueue = implode(";", $QueueArray );
$ReturnValue = true;
$BuildEndTime = '0';
} else {
$NewQueue = '0';
$ReturnValue = false;
$BuildEndTime = '0';
}
// Ici on va rembourser les ressources engagées ...
// Deja le mode (car quand on detruit ca ne coute que la moitié du prix de construction classique
if ($BuildMode == 'destroy') {
$ForDestroy = true;
} else {
$ForDestroy = false;
}
if ( $Element != false ) {
$Needed = GetBuildingPrice ($CurrentUser, $CurrentPlanet, $Element, true, $ForDestroy);
$CurrentPlanet['metal'] += $Needed['metal'];
$CurrentPlanet['crystal'] += $Needed['crystal'];
$CurrentPlanet['deuterium'] += $Needed['deuterium'];
}
} else {
$NewQueue = '0';
$BuildEndTime = '0';
$ReturnValue = false;
}
$CurrentPlanet['b_building_id'] = $NewQueue;
$CurrentPlanet['b_building'] = $BuildEndTime;
return $ReturnValue;
}
?>

View file

@ -0,0 +1,97 @@
<?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 $IsUserChecked
*/
function CheckCookies($IsUserChecked)
{
global $lang, $gameConfig;
includeLang('cookies');
$userData = array();
if (isset($_SESSION['user_id'])) {
$sql =<<<EOF
SELECT * FROM {{table}}
WHERE id={$_SESSION['user_id']}
LIMIT 1
EOF;
$userData = doquery($sql, 'users', true);
} else if (isset($_COOKIE['nova-cookie'])) {
$cookieData = unserialize(stripslashes($_COOKIE['nova-cookie']));
$cookieData = array(
'id' => (isset($cookieData['id']) ? (int) $cookieData['id'] : 0),
'key' => (isset($cookieData['key']) ? (string) $cookieData['key'] : null)
);
$sql =<<<EOF
SELECT * FROM {{table}} AS user
WHERE id={$cookieData['id']}
AND (@key:="{$cookieData['key']}")=CONCAT((@salt:=MID(@key, 0, 4)), SHA1(CONCAT(user.username, user.password, @salt)))
LIMIT 1
EOF;
$userData = doquery($sql, 'users', true);
$_SESSION['user_id'] = $userData['id'];
if (empty($userData)) {
message($lang['cookies']['Error2'] );
}
} else {
return array(
'state' => false,
'record' => array()
);
}
$sessionData = array(
'request_uri' => mysql_real_escape_string($_SERVER['REQUEST_URI']),
'remote_addr' => mysql_real_escape_string($_SERVER['REMOTE_ADDR']/* . (isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? '|' . $_SERVER['HTTP_X_FORWARDED_FOR'] : '')*/),
'user_agent' => mysql_real_escape_string($_SERVER['HTTP_USER_AGENT'])
);
$now = time();
$sql =<<<EOF
UPDATE {{table}}
SET `onlinetime` = "{$now}",
`current_page` = "{$sessionData['request_uri']}",
`user_lastip` = "{$sessionData['remote_addr']}",
`user_agent` = "{$sessionData['user_agent']}"
WHERE `id`={$_SESSION['user_id']}
LIMIT 1;
EOF;
doquery($sql, 'users');
$IsUserChecked = true;
return array(
'state' => $IsUserChecked,
'record' => $userData
);
}

View file

@ -0,0 +1,46 @@
<?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 $String
*/
function CheckInputStrings ( $String ) {
global $ListCensure;
$ValidString = $String;
for ($Mot = 0; $Mot < count($ListCensure); $Mot++) {
$ValidString = eregi_replace( "$ListCensure[$Mot]", "*", $ValidString );
}
return ($ValidString);
}
?>

View file

@ -0,0 +1,62 @@
<?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

@ -0,0 +1,156 @@
<?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 CheckPlanetBuildingQueue ( &$CurrentPlanet, &$CurrentUser ) {
global $lang, $resource;
// Table des batiments donnant droit de l'experience minier
$XPBuildings = array( 1, 2, 3, 22, 23, 24);
$RetValue = false;
if ($CurrentPlanet['b_building_id'] != 0) {
$CurrentQueue = $CurrentPlanet['b_building_id'];
if ($CurrentQueue != 0) {
$QueueArray = explode ( ";", $CurrentQueue );
$ActualCount = count ( $QueueArray );
}
$BuildArray = explode (",", $QueueArray[0]);
$BuildEndTime = floor($BuildArray[3]);
$BuildMode = $BuildArray[4];
$Element = $BuildArray[0];
array_shift ( $QueueArray );
if ($BuildMode == 'destroy') {
$ForDestroy = true;
} else {
$ForDestroy = false;
}
if ($BuildEndTime <= time()) {
// Mise a jours des points
$Needed = GetBuildingPrice ($CurrentUser, $CurrentPlanet, $Element, true, $ForDestroy);
$Units = $Needed['metal'] + $Needed['crystal'] + $Needed['deuterium'];
if ($ForDestroy == false) {
// Mise a jours de l'XP Minier
if (in_array($Element, $XPBuildings)) {
$AjoutXP = $Units / 1000;
$CurrentUser['xpminier'] += $AjoutXP;
}
} else {
// Mise a jours de l'XP Minier
if (in_array($Element, $XPBuildings)) {
$AjoutXP = ($Units * 3) / 1000;
$CurrentUser['xpminier'] -= $AjoutXP;
}
}
$current = intval($CurrentPlanet['field_current']);
$max = intval($CurrentPlanet['field_max']);
// Pour une lune
if ($CurrentPlanet['planet_type'] == 3) {
if ($Element == 41) {
// Base Lunaire
$current += 1;
$max += FIELDS_BY_MOONBASIS_LEVEL;
$CurrentPlanet[$resource[$Element]]++;
} elseif ($Element != 0) {
if ($ForDestroy == false) {
$current += 1;
$CurrentPlanet[$resource[$Element]]++;
} else {
$current -= 1;
$CurrentPlanet[$resource[$Element]]--;
}
}
} elseif ($CurrentPlanet['planet_type'] == 1) {
if ($ForDestroy == false) {
$current += 1;
$CurrentPlanet[$resource[$Element]]++;
} else {
$current -= 1;
$CurrentPlanet[$resource[$Element]]--;
}
}
if (count ( $QueueArray ) == 0) {
$NewQueue = 0;
} else {
$NewQueue = implode (";", $QueueArray );
}
$CurrentPlanet['b_building'] = 0;
$CurrentPlanet['b_building_id'] = $NewQueue;
$CurrentPlanet['field_current'] = $current;
$CurrentPlanet['field_max'] = $max;
$QryUpdatePlanet = "UPDATE {{table}} SET ";
$QryUpdatePlanet .= "`".$resource[$Element]."` = '".$CurrentPlanet[$resource[$Element]]."', ";
// Mise a 0 de l'heure de fin de construction ...
// Ca va activer la mise en place du batiment suivant de la queue
$QryUpdatePlanet .= "`b_building` = '". $CurrentPlanet['b_building'] ."' , ";
$QryUpdatePlanet .= "`b_building_id` = '". $CurrentPlanet['b_building_id'] ."' , ";
$QryUpdatePlanet .= "`field_current` = '" . $CurrentPlanet['field_current'] . "', ";
$QryUpdatePlanet .= "`field_max` = '" . $CurrentPlanet['field_max'] . "' ";
$QryUpdatePlanet .= "WHERE ";
$QryUpdatePlanet .= "`id` = '" . $CurrentPlanet['id'] . "';";
doquery( $QryUpdatePlanet, 'planets');
$QryUpdateUser = "UPDATE {{table}} SET ";
$QryUpdateUser .= "`xpminier` = '".$CurrentUser['xpminier']."' ";
$QryUpdateUser .= "WHERE ";
$QryUpdateUser .= "`id` = '" . $CurrentUser['id'] . "';";
doquery( $QryUpdateUser, 'users');
$RetValue = true;
} else {
$RetValue = false;
}
} else {
$CurrentPlanet['b_building'] = 0;
$CurrentPlanet['b_building_id'] = 0;
$QryUpdatePlanet = "UPDATE {{table}} SET ";
$QryUpdatePlanet .= "`b_building` = '". $CurrentPlanet['b_building'] ."' , ";
$QryUpdatePlanet .= "`b_building_id` = '". $CurrentPlanet['b_building_id'] ."' ";
$QryUpdatePlanet .= "WHERE ";
$QryUpdatePlanet .= "`id` = '" . $CurrentPlanet['id'] . "';";
doquery( $QryUpdatePlanet, 'planets');
$RetValue = false;
}
return $RetValue;
}
?>

View file

@ -0,0 +1,58 @@
<?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 $planet
*/
function CheckPlanetUsedFields ( &$planet ) {
global $resource;
// Tous les batiments
$cfc = $planet[$resource[1]] + $planet[$resource[2]] + $planet[$resource[3]] ;
$cfc += $planet[$resource[4]] + $planet[$resource[12]] + $planet[$resource[14]];
$cfc += $planet[$resource[15]] + $planet[$resource[21]] + $planet[$resource[22]];
$cfc += $planet[$resource[23]] + $planet[$resource[24]] + $planet[$resource[31]];
$cfc += $planet[$resource[33]] + $planet[$resource[34]] + $planet[$resource[44]];
// Si on se trouve sur une lune ... Y a des choses a ajouter aussi
if ($planet['planet_type'] == '3') {
$cfc += $planet[$resource[41]] + $planet[$resource[42]] + $planet[$resource[43]];
}
// Mise a jour du nombre de case dans la BDD si incorrect
if ($planet['field_current'] != $cfc) {
$planet['field_current'] = $cfc;
doquery("UPDATE {{table}} SET field_current=$cfc WHERE id={$planet['id']}", 'planets');
}
}
?>

View file

@ -0,0 +1,62 @@
<?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 $IsUserChecked
*/
function CheckTheUser($IsUserChecked)
{
global $user;
includeLang('admin');
$Result = CheckCookies( $IsUserChecked );
$IsUserChecked = $Result['state'];
if ($Result['record'] != false) {
$user = $Result['record'];
if ($user['bana'] == "1") {
die (
$page .= parsetemplate(gettemplate('usr_banned'), $lang)
);
}
$RetValue['record'] = $user;
$RetValue['state'] = $IsUserChecked;
} else {
$RetValue['record'] = array();
$RetValue['state'] = false;
}
return $RetValue;
}

View file

@ -0,0 +1,129 @@
<?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 $Galaxy
* @param unknown_type $System
* @param unknown_type $Planet
* @param unknown_type $Owner
* @param unknown_type $MoonID
* @param unknown_type $MoonName
* @param unknown_type $Chance
*/
function CreateOneMoonRecord ( $Galaxy, $System, $Planet, $Owner, $MoonID, $MoonName, $Chance ) {
global $lang;
$PlanetName = "";
$QryGetMoonPlanetData = "SELECT * FROM {{table}} ";
$QryGetMoonPlanetData .= "WHERE ";
$QryGetMoonPlanetData .= "`galaxy` = '". $Galaxy ."' AND ";
$QryGetMoonPlanetData .= "`system` = '". $System ."' AND ";
$QryGetMoonPlanetData .= "`planet` = '". $Planet ."';";
$MoonPlanet = doquery ( $QryGetMoonPlanetData, 'planets', true);
$QryGetMoonGalaxyData = "SELECT * FROM {{table}} ";
$QryGetMoonGalaxyData .= "WHERE ";
$QryGetMoonGalaxyData .= "`galaxy` = '". $Galaxy ."' AND ";
$QryGetMoonGalaxyData .= "`system` = '". $System ."' AND ";
$QryGetMoonGalaxyData .= "`planet` = '". $Planet ."';";
$MoonGalaxy = doquery ( $QryGetMoonGalaxyData, 'galaxy', true);
if ($MoonGalaxy['id_luna'] == 0) {
if ($MoonPlanet['id'] != 0) {
$SizeMin = 2000 + ( $Chance * 100 );
$SizeMax = 6000 + ( $Chance * 200 );
$PlanetName = $MoonPlanet['name'];
$maxtemp = $MoonPlanet['temp_max'] - rand(10, 45);
$mintemp = $MoonPlanet['temp_min'] - rand(10, 45);
$size = rand ($SizeMin, $SizeMax);
$QryInsertMoonInLunas = "INSERT INTO {{table}} SET ";
$QryInsertMoonInLunas .= "`name` = '". ( ($MoonName == '') ? $lang['sys_moon'] : $MoonName ) ."', ";
$QryInsertMoonInLunas .= "`galaxy` = '". $Galaxy ."', ";
$QryInsertMoonInLunas .= "`system` = '". $System ."', ";
$QryInsertMoonInLunas .= "`lunapos` = '". $Planet ."', ";
$QryInsertMoonInLunas .= "`id_owner` = '". $Owner ."', ";
$QryInsertMoonInLunas .= "`temp_max` = '". $maxtemp ."', ";
$QryInsertMoonInLunas .= "`temp_min` = '". $mintemp ."', ";
$QryInsertMoonInLunas .= "`diameter` = '". $size ."', ";
$QryInsertMoonInLunas .= "`id_luna` = '". $MoonID ."';";
doquery( $QryInsertMoonInLunas , 'lunas' );
$QryGetMoonIdFromLunas = "SELECT * FROM {{table}} ";
$QryGetMoonIdFromLunas .= "WHERE ";
$QryGetMoonIdFromLunas .= "`galaxy` = '". $Galaxy ."' AND ";
$QryGetMoonIdFromLunas .= "`system` = '". $System ."' AND ";
$QryGetMoonIdFromLunas .= "`lunapos` = '". $Planet ."';";
$lunarow = doquery( $QryGetMoonIdFromLunas , 'lunas', true);
$QryUpdateMoonInGalaxy = "UPDATE {{table}} SET ";
$QryUpdateMoonInGalaxy .= "`id_luna` = '". $lunarow['id'] ."', ";
$QryUpdateMoonInGalaxy .= "`luna` = '0' ";
$QryUpdateMoonInGalaxy .= "WHERE ";
$QryUpdateMoonInGalaxy .= "`galaxy` = '". $Galaxy ."' AND ";
$QryUpdateMoonInGalaxy .= "`system` = '". $System ."' AND ";
$QryUpdateMoonInGalaxy .= "`planet` = '". $Planet ."';";
doquery( $QryUpdateMoonInGalaxy , 'galaxy');
$QryInsertMoonInPlanet = "INSERT INTO {{table}} SET ";
$QryInsertMoonInPlanet .= "`name` = '" .$lang['sys_moon'] ."', ";
$QryInsertMoonInPlanet .= "`id_owner` = '". $Owner ."', ";
$QryInsertMoonInPlanet .= "`galaxy` = '". $Galaxy ."', ";
$QryInsertMoonInPlanet .= "`system` = '". $System ."', ";
$QryInsertMoonInPlanet .= "`planet` = '". $Planet ."', ";
$QryInsertMoonInPlanet .= "`last_update` = '". time() ."', ";
$QryInsertMoonInPlanet .= "`planet_type` = '3', ";
$QryInsertMoonInPlanet .= "`image` = 'mond', ";
$QryInsertMoonInPlanet .= "`diameter` = '". $size ."', ";
$QryInsertMoonInPlanet .= "`field_max` = '1', ";
$QryInsertMoonInPlanet .= "`temp_min` = '". $maxtemp ."', ";
$QryInsertMoonInPlanet .= "`temp_max` = '". $mintemp ."', ";
$QryInsertMoonInPlanet .= "`metal` = '0', ";
$QryInsertMoonInPlanet .= "`metal_perhour` = '0', ";
$QryInsertMoonInPlanet .= "`metal_max` = '".BASE_STORAGE_SIZE."', ";
$QryInsertMoonInPlanet .= "`crystal` = '0', ";
$QryInsertMoonInPlanet .= "`crystal_perhour` = '0', ";
$QryInsertMoonInPlanet .= "`crystal_max` = '".BASE_STORAGE_SIZE."', ";
$QryInsertMoonInPlanet .= "`deuterium` = '0', ";
$QryInsertMoonInPlanet .= "`deuterium_perhour` = '0', ";
$QryInsertMoonInPlanet .= "`deuterium_max` = '".BASE_STORAGE_SIZE."';";
doquery( $QryInsertMoonInPlanet , 'planets');
}
}
return $PlanetName;
}
?>

View file

@ -0,0 +1,227 @@
<?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 $Position
* @param unknown_type $HomeWorld
*/
function PlanetSizeRandomiser ($Position, $HomeWorld = false) {
global $gameConfig;
if (!$HomeWorld) {
$ClassicBase = 163;
$SettingSize = $gameConfig['initial_fields'];
$PlanetRatio = floor ( ($ClassicBase / $SettingSize) * 10000 ) / 100;
$RandomMin = array ( 40, 50, 55, 100, 95, 80, 115, 120, 125, 75, 80, 85, 60, 40, 50);
$RandomMax = array ( 90, 95, 95, 240, 240, 230, 180, 180, 190, 125, 120, 130, 160, 300, 150);
$CalculMin = floor ( $RandomMin[$Position - 1] + ( $RandomMin[$Position - 1] * $PlanetRatio ) / 100 );
$CalculMax = floor ( $RandomMax[$Position - 1] + ( $RandomMax[$Position - 1] * $PlanetRatio ) / 100 );
$RandomSize = mt_rand($CalculMin, $CalculMax);
$MaxAddon = mt_rand(0, 110);
$MinAddon = mt_rand(0, 100);
$Addon = ($MaxAddon - $MinAddon);
$PlanetFields = ($RandomSize + $abweichung);
} else {
$PlanetFields = $gameConfig['initial_fields'];
}
$PlanetSize = ($PlanetFields ^ (14 / 1.5)) * 75;
$return['diameter'] = $PlanetSize;
$return['field_max'] = $PlanetFields;
return $return;
}
/**
*
* @deprecated
* @param unknown_type $Galaxy
* @param unknown_type $System
* @param unknown_type $Position
* @param unknown_type $PlanetOwnerID
* @param unknown_type $PlanetName
* @param unknown_type $HomeWorld
*/
function CreateOnePlanetRecord($Galaxy, $System, $Position, $PlanetOwnerID, $PlanetName = '', $HomeWorld = false) {
global $lang;
// Avant tout, on verifie s'il existe deja une planete a cet endroit
$QrySelectPlanet = "SELECT `id` ";
$QrySelectPlanet .= "FROM {{table}} ";
$QrySelectPlanet .= "WHERE ";
$QrySelectPlanet .= "`galaxy` = '". $Galaxy ."' AND ";
$QrySelectPlanet .= "`system` = '". $System ."' AND ";
$QrySelectPlanet .= "`planet` = '". $Position ."';";
$PlanetExist = doquery( $QrySelectPlanet, 'planets', true);
// Si $PlanetExist est autre chose que false ... c'est qu'il y a quelque chose l<> bas ...
// C'est donc aussi que je ne peux pas m'y poser !!
if (!$PlanetExist) {
$planet = PlanetSizeRandomiser ($Position, $HomeWorld);
$planet['diameter'] = ($planet['field_max'] ^ (14 / 1.5)) * 75 ;
$planet['metal'] = BUILD_METAL;
$planet['crystal'] = BUILD_CRISTAL;
$planet['deuterium'] = BUILD_DEUTERIUM;
$planet['metal_perhour'] = $gameConfig['metal_basic_income'];
$planet['crystal_perhour'] = $gameConfig['crystal_basic_income'];
$planet['deuterium_perhour'] = $gameConfig['deuterium_basic_income'];
$planet['metal_max'] = BASE_STORAGE_SIZE;
$planet['crystal_max'] = BASE_STORAGE_SIZE;
$planet['deuterium_max'] = BASE_STORAGE_SIZE;
// Posistion 1 - 3: 80% entre 40 et 70 Cases ( 55+ / -15 )
// Posistion 4 - 6: 80% entre 120 et 310 Cases ( 215+ / -95 )
// Posistion 7 - 9: 80% entre 105 et 195 Cases ( 150+ / -45 )
// Posistion 10 - 12: 80% entre 75 et 125 Cases ( 100+ / -25 )
// Posistion 13 - 15: 80% entre 60 et 190 Cases ( 125+ / -65 )
$planet['galaxy'] = $Galaxy;
$planet['system'] = $System;
$planet['planet'] = $Position;
if ($Position == 1 || $Position == 2 || $Position == 3) {
$PlanetType = array('trocken');
$PlanetClass = array('planet');
$PlanetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10');
$planet['temp_min'] = rand(0, 100);
$planet['temp_max'] = $planet['temp_min'] + 40;
} elseif ($Position == 4 || $Position == 5 || $Position == 6) {
$PlanetType = array('dschjungel');
$PlanetClass = array('planet');
$PlanetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10');
$planet['temp_min'] = rand(-25, 75);
$planet['temp_max'] = $planet['temp_min'] + 40;
} elseif ($Position == 7 || $Position == 8 || $Position == 9) {
$PlanetType = array('normaltemp');
$PlanetClass = array('planet');
$PlanetDesign = array('01', '02', '03', '04', '05', '06', '07');
$planet['temp_min'] = rand(-50, 50);
$planet['temp_max'] = $planet['temp_min'] + 40;
} elseif ($Position == 10 || $Position == 11 || $Position == 12) {
$PlanetType = array('wasser');
$PlanetClass = array('planet');
$PlanetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09');
$planet['temp_min'] = rand(-75, 25);
$planet['temp_max'] = $planet['temp_min'] + 40;
} elseif ($Position == 13 || $Position == 14 || $Position == 15) {
$PlanetType = array('eis');
$PlanetClass = array('planet');
$PlanetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10');
$planet['temp_min'] = rand(-100, 10);
$planet['temp_max'] = $planet['temp_min'] + 40;
} else {
$PlanetType = array('dschjungel', 'gas', 'normaltemp', 'trocken', 'wasser', 'wuesten', 'eis');
$PlanetClass = array('planet');
$PlanetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '00',);
$planet['temp_min'] = rand(-120, 10);
$planet['temp_max'] = $planet['temp_min'] + 40;
}
$planet['image'] = $PlanetType[ rand( 0, count( $PlanetType ) -1 ) ];
$planet['image'] .= $PlanetClass[ rand( 0, count( $PlanetClass ) - 1 ) ];
$planet['image'] .= $PlanetDesign[ rand( 0, count( $PlanetDesign ) - 1 ) ];
$planet['planet_type'] = 1;
$planet['id_owner'] = $PlanetOwnerID;
$planet['last_update'] = time();
$planet['name'] = ($PlanetName == '') ? $lang['sys_colo_defaultname'] : $PlanetName;
$QryInsertPlanet = "INSERT INTO {{table}} SET ";
$QryInsertPlanet .= "`name` = '". $planet['name'] ."', ";
$QryInsertPlanet .= "`id_owner` = '". $planet['id_owner'] ."', ";
$QryInsertPlanet .= "`galaxy` = '". $planet['galaxy'] ."', ";
$QryInsertPlanet .= "`system` = '". $planet['system'] ."', ";
$QryInsertPlanet .= "`planet` = '". $planet['planet'] ."', ";
$QryInsertPlanet .= "`last_update` = '". $planet['last_update'] ."', ";
$QryInsertPlanet .= "`planet_type` = '". $planet['planet_type'] ."', ";
$QryInsertPlanet .= "`image` = '". $planet['image'] ."', ";
$QryInsertPlanet .= "`diameter` = '". $planet['diameter'] ."', ";
$QryInsertPlanet .= "`field_max` = '". $planet['field_max'] ."', ";
$QryInsertPlanet .= "`temp_min` = '". $planet['temp_min'] ."', ";
$QryInsertPlanet .= "`temp_max` = '". $planet['temp_max'] ."', ";
$QryInsertPlanet .= "`metal` = '". $planet['metal'] ."', ";
$QryInsertPlanet .= "`metal_perhour` = '". $planet['metal_perhour'] ."', ";
$QryInsertPlanet .= "`metal_max` = '". $planet['metal_max'] ."', ";
$QryInsertPlanet .= "`crystal` = '". $planet['crystal'] ."', ";
$QryInsertPlanet .= "`crystal_perhour` = '". $planet['crystal_perhour'] ."', ";
$QryInsertPlanet .= "`crystal_max` = '". $planet['crystal_max'] ."', ";
$QryInsertPlanet .= "`deuterium` = '". $planet['deuterium'] ."', ";
$QryInsertPlanet .= "`deuterium_perhour` = '". $planet['deuterium_perhour'] ."', ";
$QryInsertPlanet .= "`deuterium_max` = '". $planet['deuterium_max'] ."';";
doquery( $QryInsertPlanet, 'planets');
// On recupere l'id de planete nouvellement cr<63><72>
$QrySelectPlanet = "SELECT `id` ";
$QrySelectPlanet .= "FROM {{table}} ";
$QrySelectPlanet .= "WHERE ";
$QrySelectPlanet .= "`galaxy` = '". $planet['galaxy'] ."' AND ";
$QrySelectPlanet .= "`system` = '". $planet['system'] ."' AND ";
$QrySelectPlanet .= "`planet` = '". $planet['planet'] ."' AND ";
$QrySelectPlanet .= "`id_owner` = '". $planet['id_owner'] ."';";
$GetPlanetID = doquery( $QrySelectPlanet , 'planets', true);
// Testons s'il y a deja eu une planete ici
$QrySelectGalaxy = "SELECT * ";
$QrySelectGalaxy .= "FROM {{table}} ";
$QrySelectGalaxy .= "WHERE ";
$QrySelectGalaxy .= "`galaxy` = '". $planet['galaxy'] ."' AND ";
$QrySelectGalaxy .= "`system` = '". $planet['system'] ."' AND ";
$QrySelectGalaxy .= "`planet` = '". $planet['planet'] ."';";
$GetGalaxyID = doquery( $QrySelectGalaxy, 'galaxy', true);
if ($GetGalaxyID) {
// Ah ... Ce secteur de ce vaste monde a deja ete occup<75>
$QryUpdateGalaxy = "UPDATE {{table}} SET ";
$QryUpdateGalaxy .= "`id_planet` = '". $GetPlanetID['id'] ."' ";
$QryUpdateGalaxy .= "WHERE ";
$QryUpdateGalaxy .= "`galaxy` = '". $planet['galaxy'] ."' AND ";
$QryUpdateGalaxy .= "`system` = '". $planet['system'] ."' AND ";
$QryUpdateGalaxy .= "`planet` = '". $planet['planet'] ."';";
doquery( $QryUpdateGalaxy, 'galaxy');
} else {
// C'est tout vide ... y a que dalle ... j'm'y pose !!
$QryInsertGalaxy = "INSERT INTO {{table}} SET ";
$QryInsertGalaxy .= "`galaxy` = '". $planet['galaxy'] ."', ";
$QryInsertGalaxy .= "`system` = '". $planet['system'] ."', ";
$QryInsertGalaxy .= "`planet` = '". $planet['planet'] ."', ";
$QryInsertGalaxy .= "`id_planet` = '". $GetPlanetID['id'] ."';";
doquery( $QryInsertGalaxy, 'galaxy');
}
$RetValue = true;
} else {
$RetValue = false;
}
return $RetValue;
}
?>

View file

@ -0,0 +1,150 @@
<?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

@ -0,0 +1,73 @@
<?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 $UserID
*/
function DeleteSelectedUser ( $UserID ) {
$TheUser = doquery ( "SELECT * FROM {{table}} WHERE `id` = '" . $UserID . "';", 'users', true );
if ( $TheUser['ally_id'] != 0 ) {
$TheAlly = doquery ( "SELECT * FROM {{table}} WHERE `id` = '" . $TheUser['ally_id'] . "';", 'alliance', true );
$TheAlly['ally_members'] -= 1;
if ( $TheAlly['ally_members'] > 0 ) {
doquery ( "UPDATE {{table}} SET `ally_members` = '" . $TheAlly['ally_members'] . "' WHERE `id` = '" . $TheAlly['id'] . "';", 'alliance' );
} else {
doquery ( "DELETE FROM {{table}} WHERE `id` = '" . $TheAlly['id'] . "';", 'alliance' );
doquery ( "DELETE FROM {{table}} WHERE `stat_type` = '2' AND `id_owner` = '" . $TheAlly['id'] . "';", 'statpoints' );
}
}
doquery ( "DELETE FROM {{table}} WHERE `stat_type` = '1' AND `id_owner` = '" . $UserID . "';", 'statpoints' );
$ThePlanets = doquery ( "SELECT * FROM {{table}} WHERE `id_owner` = '" . $UserID . "';", 'planets' );
while ( $OnePlanet = mysql_fetch_assoc ( $ThePlanets ) ) {
if ( $OnePlanet['planet_type'] == 1 ) {
doquery ( "DELETE FROM {{table}} WHERE `galaxy` = '" . $OnePlanet['galaxy'] . "' AND `system` = '" . $OnePlanet['system'] . "' AND `planet` = '" . $OnePlanet['planet'] . "';", 'galaxy' );
} elseif ( $OnePlanet['planet_type'] == 3 ) {
doquery ( "DELETE FROM {{table}} WHERE `galaxy` = '" . $OnePlanet['galaxy'] . "' AND `system` = '" . $OnePlanet['system'] . "' AND `lunapos` = '" . $OnePlanet['planet'] . "';", 'lunas' );
}
doquery ( "DELETE FROM {{table}} WHERE `id` = '" . $OnePlanet['id'] . "';", 'planets' );
}
doquery ( "DELETE FROM {{table}} WHERE `message_sender` = '" . $UserID . "';", 'messages' );
doquery ( "DELETE FROM {{table}} WHERE `message_owner` = '" . $UserID . "';", 'messages' );
doquery ( "DELETE FROM {{table}} WHERE `owner` = '" . $UserID . "';", 'notes' );
doquery ( "DELETE FROM {{table}} WHERE `fleet_owner` = '" . $UserID . "';", 'fleets' );
doquery ( "DELETE FROM {{table}} WHERE `id_owner1` = '" . $UserID . "';", 'rw' );
doquery ( "DELETE FROM {{table}} WHERE `id_owner2` = '" . $UserID . "';", 'rw' );
doquery ( "DELETE FROM {{table}} WHERE `sender` = '" . $UserID . "';", 'buddy' );
doquery ( "DELETE FROM {{table}} WHERE `owner` = '" . $UserID . "';", 'buddy' );
doquery ( "DELETE FROM {{table}} WHERE `user` = '" . $UserID . "';", 'annonce' );
doquery ( "DELETE FROM {{table}} WHERE `id` = '" . $UserID . "';", 'users' );
}
?>

View file

@ -0,0 +1,70 @@
<?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 ElementBuildListBox ( $CurrentUser, $CurrentPlanet ) {
global $lang, $pricelist;
// // Array del b_hangar_id
// $ElementQueue = explode(';', $CurrentPlanet['b_hangar_id']);
// $NbrePerType = "";
// $NamePerType = "";
// $TimePerType = "";
//
// foreach($ElementQueue as $ElementLine => $Element) {
// if ($Element != '') {
// $Element = explode(',', $Element);
// $ElementTime = GetBuildingTime( $CurrentUser, $CurrentPlanet, $Element[0] );
// $QueueTime += $ElementTime * $Element[1];
// $TimePerType .= "".$ElementTime.",";
// $NamePerType .= "'". html_entity_decode($lang['tech'][$Element[0]]) ."',";
// $NbrePerType .= "".$Element[1].",";
// }
// }
//
// $parse = $lang;
// $parse['a'] = $NbrePerType;
// $parse['b'] = $NamePerType;
// $parse['c'] = $TimePerType;
// $parse['b_hangar_id_plus'] = $CurrentPlanet['b_hangar'];
//
// $parse['pretty_time_b_hangar'] = pretty_time($QueueTime - $CurrentPlanet['b_hangar']);
//
// $text .= parsetemplate(gettemplate('buildings_script'), $parse);
//
// return $text;
}
?>

View file

@ -0,0 +1,82 @@
<?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 !
/*
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

@ -0,0 +1,149 @@
<?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

@ -0,0 +1,122 @@
<?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 $planet
*/
function FlyingFleetHandler (&$planet) {
global $resource;
doquery("LOCK TABLE {{table}}lunas WRITE, {{table}}rw WRITE, {{table}}errors WRITE, {{table}}messages WRITE, {{table}}fleets WRITE, {{table}}planets WRITE, {{table}}galaxy WRITE ,{{table}}users WRITE", "");
$QryFleet = "SELECT * FROM {{table}} ";
$QryFleet .= "WHERE (";
$QryFleet .= "( ";
$QryFleet .= "`fleet_start_galaxy` = ". $planet['galaxy'] ." AND ";
$QryFleet .= "`fleet_start_system` = ". $planet['system'] ." AND ";
$QryFleet .= "`fleet_start_planet` = ". $planet['planet'] ." AND ";
$QryFleet .= "`fleet_start_type` = ". $planet['planet_type'] ." ";
$QryFleet .= ") OR ( ";
$QryFleet .= "`fleet_end_galaxy` = ". $planet['galaxy'] ." AND ";
$QryFleet .= "`fleet_end_system` = ". $planet['system'] ." AND ";
$QryFleet .= "`fleet_end_planet` = ". $planet['planet'] ." ) AND ";
$QryFleet .= "`fleet_end_type`= ". $planet['planet_type'] ." ) AND ";
$QryFleet .= "( `fleet_start_time` < '". time() ."' OR `fleet_end_time` < '". time() ."' );";
$fleetquery = doquery( $QryFleet, 'fleets' );
while ($CurrentFleet = mysql_fetch_array($fleetquery)) {
switch ($CurrentFleet["fleet_mission"]) {
case 1:
// Attaquer
MissionCaseAttack ( $CurrentFleet );
break;
case 2:
// Attaque groupée
doquery ("DELETE FROM {{table}} WHERE `fleet_id` = '". $CurrentFleet['fleet_id'] ."';", 'fleets');
break;
case 3:
// Transporter
MissionCaseTransport ( $CurrentFleet );
break;
case 4:
// Stationner
MissionCaseStay ( $CurrentFleet );
break;
case 5:
// Stationner chez un Allié
MissionCaseStayAlly ( $CurrentFleet );
break;
case 6:
// Flotte d'espionnage
MissionCaseSpy ( $CurrentFleet );
break;
case 7:
// Coloniser
MissionCaseColonisation ( $CurrentFleet );
break;
case 8:
// Recyclage
MissionCaseRecycling ( $CurrentFleet );
break;
case 9:
// Detruire ??? dans le code ogame c'est 9 !!
MissionCaseDestruction ( $CurrentFleet );
break;
case 10:
// Missiles !!
break;
case 15:
// Expeditions
MissionCaseExpedition ( $CurrentFleet );
break;
default: {
doquery("DELETE FROM {{table}} WHERE `fleet_id` = '". $CurrentFleet['fleet_id'] ."';", 'fleets');
}
}
}
doquery("UNLOCK TABLES", "");
}
?>

View file

@ -0,0 +1,56 @@
<?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 $lunarow
*/
function CheckAbandonMoonState ($lunarow) {
if (($lunarow['destruyed'] + 172800) <= time() && $lunarow['destruyed'] != 0) {
$query = doquery("DELETE FROM {{table}} WHERE id = '" . $lunarow['id'] . "'", "lunas");
}
}
/**
* Suppression complete d'une planete
*
* @deprecated
*/
function CheckAbandonPlanetState (&$planet) {
if ($planet['destruyed'] <= time()) {
$id = $planet['id'];
doquery("DELETE FROM {{table}} WHERE id={$id}", 'planets');
doquery("DELETE FROM {{table}} WHERE id_planet={$id}", 'galaxy');
}
}
?>

View file

@ -0,0 +1,69 @@
<?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
*/
function GalaxyLegendPopup () {
global $lang;
$Result = "<a href=# style=\"cursor: pointer;\"";
$Result .= " onmouseover='return overlib(\"";
$Result .= "<table width=240>";
$Result .= "<tr>";
$Result .= "<td class=c colspan=2>".$lang['Legend']."</td>";
$Result .= "</tr><tr>";
$Result .= "<td width=220>".$lang['Strong_player']."</td><td><span class=strong>".$lang['strong_player_shortcut']."</span></td>";
$Result .= "</tr><tr>";
$Result .= "<td width=220>".$lang['Weak_player']."</td><td><span class=noob>".$lang['weak_player_shortcut']."</span></td>";
$Result .= "</tr><tr>";
$Result .= "<td width=220>".$lang['Way_vacation']."</td><td><span class=vacation>".$lang['vacation_shortcut']."</span></td>";
$Result .= "</tr><tr>";
$Result .= "<td width=220>".$lang['Pendent_user']."</td><td><span class=banned>".$lang['banned_shortcut']."</span></td>";
$Result .= "</tr><tr>";
$Result .= "<td width=220>".$lang['Inactive_7_days']."</td><td><span class=inactive>".$lang['inactif_7_shortcut']."</span></td>";
$Result .= "</tr><tr>";
$Result .= "<td width=220>".$lang['Inactive_28_days']."</td><td><span class=longinactive>".$lang['inactif_28_shortcut']."</span></td>";
$Result .= "</tr><tr>";
$Result .= "<td width=220>Admin</td><td><font color=lime><blink>A</blink></font></td>";
$Result .= "</tr>";
$Result .= "</table>";
$Result .= "\");' onmouseout='return nd();'>";
$Result .= $lang['Legend']."</a>";
return $Result;
}
?>

View file

@ -0,0 +1,108 @@
<?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 $GalaxyRow
* @param unknown_type $GalaxyRowPlanet
* @param unknown_type $GalaxyRowPlayer
* @param unknown_type $Galaxy
* @param unknown_type $System
* @param unknown_type $Planet
* @param unknown_type $PlanetType
*/
function GalaxyRowActions ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowPlayer, $Galaxy, $System, $Planet, $PlanetType ) {
global $lang, $user, $dpath, $CurrentMIP, $CurrentSystem, $CurrentGalaxy;
// Icones action
$Result = "<th style=\"white-space: nowrap;\" width=125>";
if ($GalaxyRowPlayer['id'] != $user['id']) {
if ($CurrentMIP <> 0) {
if ($GalaxyRowUser['id'] != $user['id']) {
if ($GalaxyRowPlanet["galaxy"] == $CurrentGalaxy) {
$Range = GetMissileRange();
$SystemLimitMin = $CurrentSystem - $Range;
if ($SystemLimitMin < 1) {
$SystemLimitMin = 1;
}
$SystemLimitMax = $CurrentSystem + $Range;
if ($System <= $SystemLimitMax) {
if ($System >= $SystemLimitMin) {
$MissileBtn = true;
} else {
$MissileBtn = false;
}
} else {
$MissileBtn = false;
}
} else {
$MissileBtn = false;
}
} else {
$MissileBtn = false;
}
} else {
$MissileBtn = false;
}
if ($GalaxyRowPlayer && $GalaxyRowPlanet["destruyed"] == 0) {
if ($user["settings_esp"] == "1" &&
$GalaxyRowPlayer['id']) {
$Result .= "<a href=# onclick=\"javascript:doit(6, ".$Galaxy.", ".$System.", ".$Planet.", 1, ".$user["spio_anz"].");\" >";
$Result .= "<img src=". $dpath ."img/e.gif alt=\"".$lang['gl_espionner']."\" title=\"".$lang['gl_espionner']."\" border=0></a>";
$Result .= "&nbsp;";
}
if ($user["settings_wri"] == "1" &&
$GalaxyRowPlayer['id']) {
$Result .= "<a href=messages.php?mode=write&id=".$GalaxyRowPlayer["id"].">";
$Result .= "<img src=". $dpath ."img/m.gif alt=\"".$lang['gl_sendmess']."\" title=\"".$lang['gl_sendmess']."\" border=0></a>";
$Result .= "&nbsp;";
}
if ($user["settings_bud"] == "1" &&
$GalaxyRowPlayer['id']) {
$Result .= "<a href=buddy.php?a=2&amp;u=".$GalaxyRowPlayer['id']." >";
$Result .= "<img src=". $dpath ."img/b.gif alt=\"".$lang['gl_buddyreq']."\" title=\"".$lang['gl_buddyreq']."\" border=0></a>";
$Result .= "&nbsp;";
}
if ($user["settings_mis"] == "1" AND
$MissileBtn == true &&
$GalaxyRowPlayer['id']) {
$Result .= "<a href=galaxy.php?mode=2&galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&current=".$user['current_planet']." >";
$Result .= "<img src=". $dpath ."img/r.gif alt=\"".$lang['gl_mipattack']."\" title=\"".$lang['gl_mipattack']."\" border=0></a>";
}
}
}
$Result .= "</th>";
return $Result;
}
?>

View file

@ -0,0 +1,92 @@
<?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 $GalaxyRow
* @param unknown_type $GalaxyRowPlanet
* @param unknown_type $GalaxyRowUser
* @param unknown_type $Galaxy
* @param unknown_type $System
* @param unknown_type $Planet
* @param unknown_type $PlanetType
*/
function GalaxyRowAlly ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy, $System, $Planet, $PlanetType ) {
global $lang, $user;
// Alliances
$Result = "<th width=80>";
if ($GalaxyRowUser['ally_id'] && $GalaxyRowUser['ally_id'] != 0) {
$allyquery = doquery("SELECT * FROM {{table}} WHERE id=" . $GalaxyRowUser['ally_id'], "alliance", true);
if ($allyquery) {
$members_count = doquery("SELECT COUNT(DISTINCT(id)) FROM {{table}} WHERE ally_id=" . $allyquery['id'] . ";", "users", true);
if ($members_count[0] > 1) {
$add = "s";
} else {
$add = "";
}
$Result .= "<a style=\"cursor: pointer;\"";
$Result .= " onmouseover='return overlib(\"";
$Result .= "<table width=240>";
$Result .= "<tr>";
$Result .= "<td class=c>".$lang['Alliance']." ". $allyquery['ally_name'] ." ".$lang['gl_with']." ". $members_count[0] ." ". $lang['gl_membre'] . $add ."</td>";
$Result .= "</tr>";
$Result .= "<th>";
$Result .= "<table>";
$Result .= "<tr>";
$Result .= "<td><a href=alliance.php?mode=ainfo&a=". $allyquery['id'] .">".$lang['gl_ally_internal']."</a></td>";
$Result .= "</tr><tr>";
$Result .= "<td><a href=stat.php?start=101&who=ally>".$lang['gl_stats']."</a></td>";
if ($allyquery["ally_web"] != "") {
$Result .= "</tr><tr>";
$Result .= "<td><a href=". $allyquery["ally_web"] ." target=_new>".$lang['gl_ally_web']."</td>";
}
$Result .= "</tr>";
$Result .= "</table>";
$Result .= "</th>";
$Result .= "</table>\"";
$Result .= ", STICKY, MOUSEOFF, DELAY, 750, CENTER, OFFSETX, -40, OFFSETY, -40 );'";
$Result .= " onmouseout='return nd();'>";
if ($user['ally_id'] == $GalaxyRowPlayer['ally_id']) {
$Result .= "<span class=\"allymember\">". $allyquery['ally_tag'] ."</span></a>";
} else {
$Result .= $allyquery['ally_tag'] ."</a>";
}
}
}
$Result .= "</th>";
return $Result;
}
?>

View file

@ -0,0 +1,105 @@
<?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 $GalaxyRow
* @param unknown_type $GalaxyRowPlanet
* @param unknown_type $GalaxyRowUser
* @param unknown_type $Galaxy
* @param unknown_type $System
* @param unknown_type $Planet
* @param unknown_type $PlanetType
*/
function GalaxyRowDebris ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy, $System, $Planet, $PlanetType ) {
global $lang, $dpath, $CurrentRC, $user, $pricelist;
// Cdr
$Result = "<th style=\"white-space: nowrap;\" width=30>";
if ($GalaxyRow) {
if ($GalaxyRow["metal"] != 0 || $GalaxyRow["crystal"] != 0) {
$RecNeeded = ceil(($GalaxyRow["metal"] + $GalaxyRow["crystal"]) / $pricelist[209]['capacity']);
if ($RecNeeded < $CurrentRC) {
$RecSended = $RecNeeded;
} elseif ($RecNeeded >= $CurrentRC) {
$RecSended = $CurrentRC;
} else {
$RecSended = $RecyclerCount;
}
$Result = "<th style=\"";
if (($GalaxyRow["metal"] + $GalaxyRow["crystal"]) >= 10000000) {
$Result .= "background-color: rgb(100, 0, 0);";
} elseif (($GalaxyRow["metal"] + $GalaxyRow["crystal"]) >= 1000000) {
$Result .= "background-color: rgb(100, 100, 0);";
} elseif (($GalaxyRow["metal"] + $GalaxyRow["crystal"]) >= 100000) {
$Result .= "background-color: rgb(0, 100, 0);";
}
$Result .= "background-image: none;\" width=30>";
$Result .= "<a style=\"cursor: pointer;\"";
$Result .= " onmouseover='return overlib(\"";
$Result .= "<table width=240>";
$Result .= "<tr>";
$Result .= "<td class=c colspan=2>";
$Result .= $lang['Debris']." [".$Galaxy.":".$System.":".$Planet."]";
$Result .= "</td>";
$Result .= "</tr><tr>";
$Result .= "<th width=80>";
$Result .= "<img src=". $dpath ."planeten/debris.jpg height=75 width=75 />";
$Result .= "</th>";
$Result .= "<th>";
$Result .= "<table>";
$Result .= "<tr>";
$Result .= "<td class=c colspan=2>".$lang['gl_ressource']."</td>";
$Result .= "</tr><tr>";
$Result .= "<th>".$lang['Metal']." </th><th>". number_format( $GalaxyRow['metal'], 0, '', '.') ."</th>";
$Result .= "</tr><tr>";
$Result .= "<th>".$lang['Crystal']." </th><th>". number_format( $GalaxyRow['crystal'], 0, '', '.') ."</th>";
$Result .= "</tr><tr>";
$Result .= "<td class=c colspan=2>".$lang['gl_action']."</td>";
$Result .= "</tr><tr>";
$Result .= "<th colspan=2 align=left>";
$Result .= "<a href= # onclick=&#039javascript:doit (8, ".$Galaxy.", ".$System.", ".$Planet.", ".$PlanetType.", ".$RecSended.");&#039 >". $lang['type_mission'][8] ."</a>";
$Result .= "</tr>";
$Result .= "</table>";
$Result .= "</th>";
$Result .= "</tr>";
$Result .= "</table>\"";
// $Result .= ", STICKY, MOUSEOFF, DELAY, ". ($user["settings_tooltiptime"] * 1000) .", CENTER, OFFSETX, -40, OFFSETY, -40 );'";
$Result .= ", STICKY, MOUSEOFF, DELAY, 750, CENTER, OFFSETX, -40, OFFSETY, -40 );'";
$Result .= " onmouseout='return nd();'>";
$Result .= "<img src=". $dpath ."planeten/debris.jpg height=22 width=22></a>";
}
}
$Result .= "</th>";
return $Result;
}
?>

View file

@ -0,0 +1,128 @@
<?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 $GalaxyRow
* @param unknown_type $GalaxyRowPlanet
* @param unknown_type $GalaxyRowUser
* @param unknown_type $Galaxy
* @param unknown_type $System
* @param unknown_type $Planet
* @param unknown_type $PlanetType
*/
function GalaxyRowMoon ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy, $System, $Planet, $PlanetType ) {
global $lang, $user, $dpath, $HavePhalanx, $CurrentSystem, $CurrentGalaxy, $CanDestroy;
// Lune
$Result = "<th style=\"white-space: nowrap;\" width=30>";
if ($GalaxyRowUser['id'] != $user['id']) {
$MissionType6Link = "<a href=# onclick=&#039javascript:doit(6, ".$Galaxy.", ".$System.", ".$Planet.", ".$PlanetType.", ".$user["spio_anz"].");&#039 >". $lang['type_mission'][6] ."</a><br /><br />";
} elseif ($GalaxyRowUser['id'] == $user['id']) {
$MissionType6Link = "";
}
if ($GalaxyRowUser['id'] != $user['id']) {
$MissionType1Link = "<a href=fleet.php?galaxy=".$Galaxy."&amp;system=".$System."&amp;planet=".$Planet."&amp;planettype=".$PlanetType."&amp;target_mission=1>". $lang['type_mission'][1] ."</a><br />";
} elseif ($GalaxyRowUser['id'] == $user['id']) {
$MissionType1Link = "";
}
if ($GalaxyRowUser['id'] != $user['id']) {
$MissionType5Link = "<a href=fleet.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."&target_mission=5>". $lang['type_mission'][5] ."</a><br />";
} elseif ($GalaxyRowUser['id'] == $user['id']) {
$MissionType5Link = "";
}
if ($GalaxyRowUser['id'] == $user['id']) {
$MissionType4Link = "<a href=fleet.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."&target_mission=4>". $lang['type_mission'][4] ."</a><br />";
} elseif ($GalaxyRowUser['id'] != $user['id']) {
$MissionType4Link = "";
}
if ($GalaxyRowUser['id'] != $user['id']) {
if ($CanDestroy > 0) {
$MissionType9Link = "<a href=fleet.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."&target_mission=9>". $lang['type_mission'][9] ."</a>";
} else {
$MissionType9Link = "";
}
} elseif ($GalaxyRowUser['id'] == $user['id']) {
$MissionType9Link = "";
}
$MissionType3Link = "<a href=fleet.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."&target_mission=3>". $lang['type_mission'][3] ."</a><br />";
if ($GalaxyRow && $GalaxyRowPlanet["destruyed"] == 0 && $GalaxyRow["id_luna"] != 0) {
$Result .= "<a style=\"cursor: pointer;\"";
$Result .= " onmouseover='return overlib(\"";
$Result .= "<table width=240>";
$Result .= "<tr>";
$Result .= "<td class=c colspan=2>";
$Result .= $lang['Moon'].": ".$GalaxyRowPlanet["name"]." [".$Galaxy.":".$System.":".$Planet."]";
$Result .= "</td>";
$Result .= "</tr><tr>";
$Result .= "<th width=80>";
$Result .= "<img src=". $dpath ."planeten/mond.jpg height=75 width=75 />";
$Result .= "</th>";
$Result .= "<th>";
$Result .= "<table>";
$Result .= "<tr>";
$Result .= "<td class=c colspan=2>".$lang['caracters']."</td>";
$Result .= "</tr><tr>";
$Result .= "<th>".$lang['diameter']."</th>";
$Result .= "<th>". number_format($GalaxyRowPlanet['diameter'], 0, '', '.') ."</th>";
$Result .= "</tr><tr>";
$Result .= "<th>".$lang['temperature']."</th><th>". number_format($GalaxyRowPlanet['temp_min'], 0, '', '.') ."</th>";
$Result .= "</tr><tr>";
$Result .= "<td class=c colspan=2>".$lang['Actions']."</td>";
$Result .= "</tr><tr>";
$Result .= "<th colspan=2 align=center>";
$Result .= $MissionType6Link;
$Result .= $MissionType3Link;
$Result .= $MissionType4Link;
$Result .= $MissionType1Link;
$Result .= $MissionType5Link;
$Result .= $MissionType9Link;
$Result .= "</tr>";
$Result .= "</table>";
$Result .= "</th>";
$Result .= "</tr>";
$Result .= "</table>\"";
// $Result .= ", STICKY, MOUSEOFF, DELAY, ". ($user["settings_tooltiptime"] * 1000) .", CENTER, OFFSETX, -40, OFFSETY, -40 );'";
$Result .= ", STICKY, MOUSEOFF, DELAY, 750, CENTER, OFFSETX, -40, OFFSETY, -40 );'";
$Result .= " onmouseout='return nd();'>";
$Result .= "<img src=". $dpath ."planeten/small/s_mond.jpg height=22 width=22>";
$Result .= "</a>";
}
$Result .= "</th>";
return $Result;
}
?>

View file

@ -0,0 +1,133 @@
<?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 $GalaxyRow
* @param unknown_type $GalaxyRowPlanet
* @param unknown_type $GalaxyRowUser
* @param unknown_type $Galaxy
* @param unknown_type $System
* @param unknown_type $Planet
* @param unknown_type $PlanetType
*/
function GalaxyRowPlanet ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy, $System, $Planet, $PlanetType ) {
global $lang, $dpath, $user, $HavePhalanx, $CurrentSystem, $CurrentGalaxy;
// Planete (Image)
$Result = "<th width=30>";
$GalaxyRowUser = doquery("SELECT * FROM {{table}} WHERE id='".$GalaxyRowPlanet['id_owner']."';", 'users', true);
if ($GalaxyRow && $GalaxyRowPlanet["destruyed"] == 0 && $GalaxyRow["id_planet"] != 0) {
if ($HavePhalanx <> 0) {
if ($GalaxyRowUser['id'] != $user['id']) {
if ($GalaxyRowPlanet["galaxy"] == $CurrentGalaxy) {
$Range = GetPhalanxRange ( $HavePhalanx );
if ($SystemLimitMin < 1) {
$SystemLimitMin = 1;
}
$SystemLimitMax = $CurrentSystem + $Range;
if ($System <= $SystemLimitMax) {
if ($System >= $SystemLimitMin) {
$PhalanxTypeLink = "<a href=# onclick=fenster(&#039;phalanx.php?galaxy=".$Galaxy."&amp;system=".$System."&amp;planet=".$Planet."&amp;planettype=".$PlanetType."&#039;) >".$lang['gl_phalanx']."</a><br />";
} else {
$PhalanxTypeLink = "";
}
} else {
$PhalanxTypeLink = "";
}
} else {
$PhalanxTypeLink = "";
}
} else {
$PhalanxTypeLink = "";
}
} else {
$PhalanxTypeLink = "";
}
if ($GalaxyRowUser['id'] != $user['id']) {
$MissionType6Link = "<a href=# onclick=&#039javascript:doit(6, ".$Galaxy.", ".$System.", ".$Planet.", ".$PlanetType.", ".$user["spio_anz"].");&#039 >". $lang['type_mission'][6] ."</a><br /><br />";
} elseif ($GalaxyRowUser['id'] == $user['id']) {
$MissionType6Link = "";
}
if ($GalaxyRowUser['id'] != $user['id']) {
$MissionType1Link = "<a href=fleet.php?galaxy=".$Galaxy."&amp;system=".$System."&amp;planet=".$Planet."&amp;planettype=".$PlanetType."&amp;target_mission=1>". $lang['type_mission'][1] ."</a><br />";
} elseif ($GalaxyRowUser['id'] == $user['id']) {
$MissionType1Link = "";
}
if ($GalaxyRowUser['id'] != $user['id']) {
$MissionType5Link = "<a href=fleet.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."&target_mission=5>". $lang['type_mission'][5] ."</a><br />";
} elseif ($GalaxyRowUser['id'] == $user['id']) {
$MissionType5Link = "";
}
if ($GalaxyRowUser['id'] == $user['id']) {
$MissionType4Link = "<a href=fleet.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."&target_mission=4>". $lang['type_mission'][4] ."</a><br />";
} elseif ($GalaxyRowUser['id'] != $user['id']) {
$MissionType4Link = "";
}
$MissionType3Link = "<a href=fleet.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."&target_mission=3>". $lang['type_mission'][3] ."</a>";
$Result .= "<a style=\"cursor: pointer;\"";
$Result .= " onmouseover='return overlib(\"";
$Result .= "<table width=240>";
$Result .= "<tr>";
$Result .= "<td class=c colspan=2>";
$Result .= $lang['gl_planet'] ." ". stripslashes($GalaxyRowPlanet["name"]) ." [".$Galaxy.":".$System.":".$Planet."]";
$Result .= "</td>";
$Result .= "</tr>";
$Result .= "<tr>";
$Result .= "<th width=80>";
$Result .= "<img src=". $dpath ."planeten/small/s_". $GalaxyRowPlanet["image"] .".jpg height=75 width=75 />";
$Result .= "</th>";
$Result .= "<th align=left>";
$Result .= $MissionType6Link;
$Result .= $PhalanxTypeLink;
$Result .= $MissionType1Link;
$Result .= $MissionType5Link;
$Result .= $MissionType4Link;
$Result .= $MissionType3Link;
$Result .= "</th>";
$Result .= "</tr>";
$Result .= "</table>\"";
// $Result .= ", STICKY, MOUSEOFF, DELAY, ". ($user["settings_tooltiptime"] * 1000) .", CENTER, OFFSETX, -40, OFFSETY, -40 );'";
$Result .= ", STICKY, MOUSEOFF, DELAY, 750, CENTER, OFFSETX, -40, OFFSETY, -40 );'";
$Result .= " onmouseout='return nd();'>";
$Result .= "<img src=". $dpath ."planeten/small/s_". $GalaxyRowPlanet["image"] .".jpg height=30 width=30>";
// $Result .= $GalaxyRowPlanet["name"];
$Result .= "</a>";
}
$Result .= "</th>";
return $Result;
}
?>

View file

@ -0,0 +1,102 @@
<?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 $GalaxyRow
* @param unknown_type $GalaxyRowPlanet
* @param unknown_type $GalaxyRowUser
* @param unknown_type $Galaxy
* @param unknown_type $System
* @param unknown_type $Planet
* @param unknown_type $PlanetType
*/
function GalaxyRowPlanetName ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy, $System, $Planet, $PlanetType ) {
global $lang, $user, $HavePhalanx, $CurrentSystem, $CurrentGalaxy;
// Planete (Nom)
$Result = "<th style=\"white-space: nowrap;\" width=130>";
if ($GalaxyRowUser['ally_id'] == $user['ally_id'] AND
$GalaxyRowUser['id'] != $user['id'] AND
$user['ally_id'] != '') {
$TextColor = "<font color=\"green\">";
$EndColor = "</font>";
} elseif ($GalaxyRowUser['id'] == $user['id']) {
$TextColor = "<font color=\"red\">";
$EndColor = "</font>";
} else {
$TextColor = '';
$EndColor = "";
}
if ($GalaxyRowPlanet['last_update'] > (time()-59 * 60) AND
$GalaxyRowUser['id'] != $user['id']) {
$Inactivity = pretty_time_hour(time() - $GalaxyRowPlanet['last_update']);
}
if ($GalaxyRow && $GalaxyRowPlanet["destruyed"] == 0) {
if ($HavePhalanx <> 0) {
if ($GalaxyRowPlanet["galaxy"] == $CurrentGalaxy) {
$Range = GetPhalanxRange ( $HavePhalanx );
if ($CurrentGalaxy + $Range <= $CurrentSystem AND
$CurrentSystem >= $CurrentGalaxy - $Range) {
$PhalanxTypeLink = "<a href=# onclick=fenster('phalanx.php?galaxy=".$Galaxy."&amp;system=".$System."&amp;planet=".$Planet."&amp;planettype=".$PlanetType."') title=\"".$lang['gl_phalanx']."\">".$GalaxyRowPlanet['name']."</a><br />";
} else {
$PhalanxTypeLink = stripslashes($GalaxyRowPlanet['name']);
}
} else {
$PhalanxTypeLink = stripslashes($GalaxyRowPlanet['name']);
}
} else {
$PhalanxTypeLink = stripslashes($GalaxyRowPlanet['name']);
}
$Result .= $TextColor . $PhalanxTypeLink . $EndColor;
if ($GalaxyRowPlanet['last_update'] > (time()-59 * 60) AND
$GalaxyRowUser['id'] != $user['id']) {
if ($GalaxyRowPlanet['last_update'] > (time()-10 * 60) AND
$GalaxyRowUser['id'] != $user['id']) {
$Result .= "(*)";
} else {
$Result .= " (".$Inactivity.")";
}
}
} elseif ($GalaxyRowPlanet["destruyed"] != 0) {
$Result .= $lang['gl_destroyedplanet'];
}
$Result .= "</th>";
return $Result;
}
?>

View file

@ -0,0 +1,50 @@
<?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 $Planet
* @param unknown_type $GalaxyRow
*/
function GalaxyRowPos ( $Planet, $GalaxyRow ) {
// Pos
$Result = "<th width=30>";
$Result .= "<a href=\"#\"";
if ($GalaxyRow) {
$Result .= " tabindex=\"". ($Planet + 1) ."\"";
}
$Result .= ">". $Planet ."</a>";
$Result .= "</th>";
return $Result;
}
?>

View file

@ -0,0 +1,141 @@
<?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 $GalaxyRow
* @param unknown_type $GalaxyRowPlanet
* @param unknown_type $GalaxyRowUser
* @param unknown_type $Galaxy
* @param unknown_type $System
* @param unknown_type $Planet
* @param unknown_type $PlanetType
*/
function GalaxyRowUser ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy, $System, $Planet, $PlanetType ) {
global $lang, $user;
// Joueur
$Result = "<th width=150>";
if ($GalaxyRowUser && $GalaxyRowPlanet["destruyed"] == 0) {
$NoobProt = doquery("SELECT * FROM {{table}} WHERE `config_name` = 'noobprotection';", 'config', true);
$NoobTime = doquery("SELECT * FROM {{table}} WHERE `config_name` = 'noobprotectiontime';", 'config', true);
$NoobMulti = doquery("SELECT * FROM {{table}} WHERE `config_name` = 'noobprotectionmulti';", 'config', true);
$UserPoints = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '". $user['id'] ."';", 'statpoints', true);
$User2Points = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '". $GalaxyRowUser['id'] ."';", 'statpoints', true);
$CurrentPoints = $UserPoints['total_points'];
$RowUserPoints = $User2Points['total_points'];
$CurrentLevel = $CurrentPoints * $NoobMulti['config_value'];
$RowUserLevel = $RowUserPoints * $NoobMulti['config_value'];
if ($GalaxyRowUser['bana'] == 1 AND
$GalaxyRowUser['urlaubs_modus'] == 1) {
$Systemtatus2 = $lang['vacation_shortcut']." <a href=\"banned.php\"><span class=\"banned\">".$lang['banned_shortcut']."</span></a>";
$Systemtatus = "<span class=\"vacation\">";
} elseif ($GalaxyRowUser['bana'] == 1) {
$Systemtatus2 = "<a href=\"banned.php\"><span class=\"banned\">".$lang['banned_shortcut']."</span></a>";
$Systemtatus = "";
} elseif ($GalaxyRowUser['urlaubs_modus'] == 1) {
$Systemtatus2 = "<span class=\"vacation\">".$lang['vacation_shortcut']."</span>";
$Systemtatus = "<span class=\"vacation\">";
} elseif ($GalaxyRowUser['onlinetime'] < (time()-60 * 60 * 24 * 7) AND
$GalaxyRowUser['onlinetime'] > (time()-60 * 60 * 24 * 28)) {
$Systemtatus2 = "<span class=\"inactive\">".$lang['inactif_7_shortcut']."</span>";
$Systemtatus = "<span class=\"inactive\">";
} elseif ($GalaxyRowUser['onlinetime'] < (time()-60 * 60 * 24 * 28)) {
$Systemtatus2 = "<span class=\"inactive\">".$lang['inactif_7_shortcut']."</span><span class=\"longinactive\"> ".$lang['inactif_28_shortcut']."</span>";
$Systemtatus = "<span class=\"longinactive\">";
} elseif ($RowUserLevel < $CurrentPoints AND
$NoobProt['config_value'] == 1 AND
$NoobTime['config_value'] * 1000 > $RowUserPoints) {
$Systemtatus2 = "<span class=\"noob\">".$lang['weak_player_shortcut']."</span>";
$Systemtatus = "<span class=\"noob\">";
} elseif ($RowUserPoints > $CurrentLevel AND
$NoobProt['config_value'] == 1 AND
$NoobTime['config_value'] * 1000 > $CurrentPoints) {
$Systemtatus2 = $lang['strong_player_shortcut'];
$Systemtatus = "<span class=\"strong\">";
} else {
$Systemtatus2 = "";
$Systemtatus = "";
}
$Systemtatus4 = $User2Points['total_rank'];
if ($Systemtatus2 != '') {
$Systemtatus6 = "<font color=\"white\">(</font>";
$Systemtatus7 = "<font color=\"white\">)</font>";
}
if ($Systemtatus2 == '') {
$Systemtatus6 = "";
$Systemtatus7 = "";
}
$admin = "";
if ($GalaxyRowUser['authlevel'] == LEVEL_ADMIN) {
$admin = "<font color=\"red\"><blink>A</blink></font>";
} else if ($GalaxyRowUser['authlevel'] == LEVEL_OPERATOR) {
$admin = "<font color=\"lime\"><blink>O</blink></font>";
} else if ($GalaxyRowUser['authlevel'] == LEVEL_MODERATOR) {
$admin = "<font color=\"skyblue\"><blink>M</blink></font>";
}
$Systemtart = $User2Points['total_rank'];
if (strlen($Systemtart) < 3) {
$Systemtart = 1;
} else {
$Systemtart = (floor( $User2Points['total_rank'] / 100 ) * 100) + 1;
}
$Result .= "<a style=\"cursor: pointer;\"";
$Result .= " onmouseover='return overlib(\"";
$Result .= "<table width=190>";
$Result .= "<tr>";
$Result .= "<td class=c colspan=2>".$lang['Player']." ".$GalaxyRowUser['username']." ".$lang['Place']." ".$Systemtatus4."</td>";
$Result .= "</tr><tr>";
if ($GalaxyRowUser['id'] != $user['id']) {
$Result .= "<td><a href=messages.php?mode=write&id=".$GalaxyRowUser['id'].">".$lang['gl_sendmess']."</a></td>";
$Result .= "</tr><tr>";
$Result .= "<td><a href=buddy.php?a=2&u=".$GalaxyRowUser['id'].">".$lang['gl_buddyreq']."</a></td>";
$Result .= "</tr><tr>";
}
$Result .= "<td><a href=stat.php?who=player&start=".$Systemtart.">".$lang['gl_stats']."</a></td>";
$Result .= "</tr>";
$Result .= "</table>\"";
$Result .= ", STICKY, MOUSEOFF, DELAY, 750, CENTER, OFFSETX, -40, OFFSETY, -40 );'";
$Result .= " onmouseout='return nd();'>";
$Result .= $Systemtatus;
$Result .= $GalaxyRowUser["username"]."</span>";
$Result .= $Systemtatus6;
$Result .= $Systemtatus;
$Result .= $Systemtatus2;
$Result .= $Systemtatus7." ".$admin;
$Result .= "</span></a>";
}
$Result .= "</th>";
return $Result;
}
?>

View file

@ -0,0 +1,64 @@
<?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
* @param unknown_type $Element
* @param unknown_type $Incremental
* @param unknown_type $ForDestroy
*/
function GetBuildingPrice ($CurrentUser, $CurrentPlanet, $Element, $Incremental = true, $ForDestroy = false) {
global $pricelist, $resource;
if ($Incremental) {
$level = ($CurrentPlanet[$resource[$Element]]) ? $CurrentPlanet[$resource[$Element]] : $CurrentUser[$resource[$Element]];
}
$array = array('metal', 'crystal', 'deuterium', 'energy_max');
foreach ($array as $ResType) {
if ($Incremental) {
$cost[$ResType] = floor($pricelist[$Element][$ResType] * pow($pricelist[$Element]['factor'], $level));
} else {
$cost[$ResType] = floor($pricelist[$Element][$ResType]);
}
if ($ForDestroy == true) {
$cost[$ResType] = floor($cost[$ResType]) / 2;
$cost[$ResType] /= 2;
}
}
return $cost;
}
?>

View file

@ -0,0 +1,86 @@
<?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 $user
* @param unknown_type $planet
* @param unknown_type $Element
*/
function GetBuildingTime ($user, $planet, $Element) {
global $pricelist, $resource, $reslist, $gameConfig;
$level = ($planet[$resource[$Element]]) ? $planet[$resource[$Element]] : $user[$resource[$Element]];
if (in_array($Element, $reslist['build'])) {
// Pour un batiment ...
$cost_metal = floor($pricelist[$Element]['metal'] * pow($pricelist[$Element]['factor'], $level));
$cost_crystal = floor($pricelist[$Element]['crystal'] * pow($pricelist[$Element]['factor'], $level));
$time = ((($cost_crystal) + ($cost_metal)) / $gameConfig['game_speed']) * (1 / ($planet[$resource['14']] + 1)) * pow(0.5, $planet[$resource['15']]);
$time = floor(($time * 60 * 60) * (1 - (($user['rpg_constructeur']) * 0.1)));
} elseif (in_array($Element, $reslist['tech'])) {
// Pour une recherche
$cost_metal = floor($pricelist[$Element]['metal'] * pow($pricelist[$Element]['factor'], $level));
$cost_crystal = floor($pricelist[$Element]['crystal'] * pow($pricelist[$Element]['factor'], $level));
$intergal_lab = $user[$resource[123]];
if ( $intergal_lab < "1" ) {
$lablevel = $planet[$resource['31']];
} elseif ( $intergal_lab >= "1" ) {
$empire = doquery("SELECT * FROM {{table}} WHERE id_owner='". $user[id] ."';", 'planets');
$NbLabs = 0;
while ($colonie = mysql_fetch_array($empire)) {
$techlevel[$NbLabs] = $colonie[$resource['31']];
$NbLabs++;
}
if ($intergal_lab >= "1") {
$lablevel = 0;
for ($lab = 1; $lab <= $intergal_lab; $lab++) {
asort($techlevel);
$lablevel += $techlevel[$lab - 1];
}
}
}
$time = (($cost_metal + $cost_crystal) / $gameConfig['game_speed']) / (($lablevel + 1) * 2);
$time = floor(($time * 60 * 60) * (1 - (($user['rpg_scientifique']) * 0.1)));
} elseif (in_array($Element, $reslist['defense'])) {
// Pour les defenses ou la flotte 'tarif fixe' durée adaptée a u niveau nanite et usine robot
$time = (($pricelist[$Element]['metal'] + $pricelist[$Element]['crystal']) / $gameConfig['game_speed']) * (1 / ($planet[$resource['21']] + 1)) * pow(1 / 2, $planet[$resource['15']]);
$time = floor(($time * 60 * 60) * (1 - (($user['rpg_defenseur']) * 0.375)));
} elseif (in_array($Element, $reslist['fleet'])) {
$time = (($pricelist[$Element]['metal'] + $pricelist[$Element]['crystal']) / $gameConfig['game_speed']) * (1 / ($planet[$resource['21']] + 1)) * pow(1 / 2, $planet[$resource['15']]);
$time = floor(($time * 60 * 60) * (1 - ($user['rpg_technocrate'] * 0.05)));
}
return max(1, $time);
}
?>

View file

@ -0,0 +1,87 @@
<?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 $user
* @param unknown_type $planet
* @param unknown_type $Element
* @param unknown_type $level
*/
function GetBuildingTimeLevel ($user, $planet, $Element, $level) {
global $pricelist, $resource, $reslist, $gameConfig;
$level -= 1;
if (in_array($Element, $reslist['build'])) {
// Pour un batiment ...
$cost_metal = floor($pricelist[$Element]['metal'] * pow($pricelist[$Element]['factor'], $level));
$cost_crystal = floor($pricelist[$Element]['crystal'] * pow($pricelist[$Element]['factor'], $level));
$time = ((($cost_crystal) + ($cost_metal)) / $gameConfig['game_speed']) * (1 / ($planet[$resource['14']] + 1)) * pow(0.5, $planet[$resource['15']]);
$time = floor(($time * 60 * 60) * (1 - (($user['rpg_constructeur']) * 0.1)));
} elseif (in_array($Element, $reslist['tech'])) {
// Pour une recherche
$cost_metal = floor($pricelist[$Element]['metal'] * pow($pricelist[$Element]['factor'], $level));
$cost_crystal = floor($pricelist[$Element]['crystal'] * pow($pricelist[$Element]['factor'], $level));
$intergal_lab = $user[$resource[123]];
if ( $intergal_lab < "1" ) {
$lablevel = $planet[$resource['31']];
} elseif ( $intergal_lab >= "1" ) {
$empire = doquery("SELECT * FROM {{table}} WHERE id_owner='". $user[id] ."';", 'planets');
$NbLabs = 0;
while ($colonie = mysql_fetch_array($empire)) {
$techlevel[$NbLabs] = $colonie[$resource['31']];
$NbLabs++;
}
if ($intergal_lab >= "1") {
$lablevel = 0;
for ($lab = 1; $lab <= $intergal_lab; $lab++) {
asort($techlevel);
$lablevel += $techlevel[$lab - 1];
}
}
}
$time = (($cost_metal + $cost_crystal) / $gameConfig['game_speed']) / (($lablevel + 1) * 2);
$time = floor(($time * 60 * 60) * (1 - (($user['rpg_scientifique']) * 0.1)));
} elseif (in_array($Element, $reslist['defense'])) {
// Pour les defenses ou la flotte 'tarif fixe' dur<75>e adapt<70>e a u niveau nanite et usine robot
$time = (($pricelist[$Element]['metal'] + $pricelist[$Element]['crystal']) / $gameConfig['game_speed']) * (1 / ($planet[$resource['21']] + 1)) * pow(1 / 2, $planet[$resource['15']]);
$time = floor(($time * 60 * 60) * (1 - (($user['rpg_defenseur']) * 0.375)));
} elseif (in_array($Element, $reslist['fleet'])) {
$time = (($pricelist[$Element]['metal'] + $pricelist[$Element]['crystal']) / $gameConfig['game_speed']) * (1 / ($planet[$resource['21']] + 1)) * pow(1 / 2, $planet[$resource['15']]);
$time = floor(($time * 60 * 60) * (1 - (($user['rpg_technocrate']) * 0.05)));
}
return $time;
}
?>

View file

@ -0,0 +1,75 @@
<?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 $user
* @param unknown_type $planet
* @param unknown_type $Element
* @param unknown_type $userfactor
*/
function GetElementPrice ($user, $planet, $Element, $userfactor = true) {
global $pricelist, $resource, $lang;
if ($userfactor) {
$level = ($planet[$resource[$Element]]) ? $planet[$resource[$Element]] : $user[$resource[$Element]];
}
$is_buyeable = true;
$array = array(
'metal' => $lang["Metal"],
'crystal' => $lang["Crystal"],
'deuterium' => $lang["Deuterium"],
'energy_max' => $lang["Energy"]
);
$text = $lang['Requires'] . ": ";
foreach ($array as $ResType => $ResTitle) {
if ($pricelist[$Element][$ResType] != 0) {
$text .= $ResTitle . ": ";
if ($userfactor) {
$cost = floor($pricelist[$Element][$ResType] * pow($pricelist[$Element]['factor'], $level));
} else {
$cost = floor($pricelist[$Element][$ResType]);
}
if ($cost > $planet[$ResType]) {
$text .= "<b style=\"color:red;\"> <t title=\"-" . pretty_number ($cost - $planet[$ResType]) . "\">";
$text .= "<span class=\"noresources\">" . pretty_number($cost) . "</span></t></b> ";
$is_buyeable = false; //style="cursor: pointer;"
} else {
$text .= "<b style=\"color:lime;\"> <span class=\"noresources\">" . pretty_number($cost) . "</span></b> ";
}
}
}
return $text;
}
?>

View file

@ -0,0 +1,47 @@
<?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 $Element
* @param unknown_type $Count
*/
function GetElementRessources ( $Element, $Count ) {
global $pricelist;
$ResType['metal'] = ($pricelist[$Element]['metal'] * $Count);
$ResType['crystal'] = ($pricelist[$Element]['crystal'] * $Count);
$ResType['deuterium'] = ($pricelist[$Element]['deuterium'] * $Count);
return $ResType;
}
?>

View file

@ -0,0 +1,80 @@
<?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 $Element
* @param unknown_type $Ressources
*/
function GetMaxConstructibleElements ($Element, $Ressources) {
global $pricelist;
// On test les 4 Type de ressource pour voir si au moins on sait en construire 1
if ($pricelist[$Element]['metal'] != 0) {
$ResType_1_Needed = $pricelist[$Element]['metal'];
$Buildable = floor($Ressources["metal"] / $ResType_1_Needed);
$MaxElements = $Buildable;
}
if ($pricelist[$Element]['crystal'] != 0) {
$ResType_2_Needed = $pricelist[$Element]['crystal'];
$Buildable = floor($Ressources["crystal"] / $ResType_2_Needed);
}
if (!isset($MaxElements)) {
$MaxElements = $Buildable;
} elseif ($MaxElements > $Buildable) {
$MaxElements = $Buildable;
}
if ($pricelist[$Element]['deuterium'] != 0) {
$ResType_3_Needed = $pricelist[$Element]['deuterium'];
$Buildable = floor($Ressources["deuterium"] / $ResType_3_Needed);
}
if (!isset($MaxElements)) {
$MaxElements = $Buildable;
} elseif ($MaxElements > $Buildable) {
$MaxElements = $Buildable;
}
if ($pricelist[$Element]['energy'] != 0) {
$ResType_4_Needed = $pricelist[$Element]['energy'];
$Buildable = floor($Ressources["energy_max"] / $ResType_4_Needed);
}
if ($Buildable < 1) {
$MaxElements = 0;
}
return $MaxElements;
}
// Verion History
// - 1.0 Version initiale (creation)
// - 1.1 Correction bug ressources n<>gatives ...
// - 1.2 Correction bug quand pas de m<>tal
?>

View file

@ -0,0 +1,47 @@
<?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
*/
function GetMissileRange () {
global $resource, $user;
if ($user[$resource[117]] > 0) {
$MissileRange = ($user[$resource[117]] * 5) - 1;
} elseif ($user[$resource[117]] == 0) {
$MissileRange = 0;
}
return $MissileRange;
}
?>

View file

@ -0,0 +1,50 @@
<?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 $PhalanxLevel
*/
function GetPhalanxRange ( $PhalanxLevel ) {
// Niveau 1 2 3 4 5 6 7 = lvl
// Portée ajouté 0 3 5 7 9 11 13 = (lvl * 2) - 1
// Phalanx en nbre de systemes 0 3 8 15 24 35 48 =
$PhalanxRange = 0;
if ($PhalanxLevel > 1) {
for ($Level = 2; $Level < $PhalanxLevel + 1; $Level++) {
$lvl = ($Level * 2) - 1;
$PhalanxRange += $lvl;
}
}
return $PhalanxRange;
}
?>

View file

@ -0,0 +1,74 @@
<?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 $user
* @param unknown_type $planet
* @param unknown_type $Element
* @param unknown_type $userfactor
*/
function GetRestPrice ($user, $planet, $Element, $userfactor = true) {
global $pricelist, $resource, $lang;
if ($userfactor) {
$level = ($planet[$resource[$Element]]) ? $planet[$resource[$Element]] : $user[$resource[$Element]];
}
$array = array(
'metal' => $lang["Metal"],
'crystal' => $lang["Crystal"],
'deuterium' => $lang["Deuterium"],
'energy_max' => $lang["Energy"]
);
$text = "<br><font color=\"#7f7f7f\">". $lang['Rest_ress'] .": ";
foreach ($array as $ResType => $ResTitle) {
if ($pricelist[$Element][$ResType] != 0) {
$text .= $ResTitle . ": ";
if ($userfactor) {
$cost = floor($pricelist[$Element][$ResType] * pow($pricelist[$Element]['factor'], $level));
} else {
$cost = floor($pricelist[$Element][$ResType]);
}
if ($cost > $planet[$ResType]) {
$text .= "<b style=\"color: rgb(127, 95, 96);\">". pretty_number($planet[$ResType] - $cost) ."</b> ";
} else {
$text .= "<b style=\"color: rgb(95, 127, 108);\">". pretty_number($planet[$ResType] - $cost) ."</b> ";
}
}
}
$text .= "</font>";
return $text;
}
?>

View file

@ -0,0 +1,106 @@
<?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;
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

@ -0,0 +1,39 @@
<?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)
{
return null;
}

View file

@ -0,0 +1,137 @@
<?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 InsertGalaxyScripts ( $CurrentPlanet ) {
global $lang;
$Script = "<div style=\"top: 10px;\" id=\"content\">";
$Script .= "<script language=\"JavaScript\">\n";
$Script .= "function galaxy_submit(value) {\n";
$Script .= " document.getElementById('auto').name = value;\n";
$Script .= " document.getElementById('galaxy_form').submit();\n";
$Script .= "}\n\n";
$Script .= "function fenster(target_url,win_name) {\n";
$Script .= " var new_win = window.open(target_url,win_name,'resizable=yes,scrollbars=yes,menubar=no,toolbar=no,width=640,height=480,top=0,left=0');\n";
$Script .= " new_win.focus();\n";
$Script .= "}\n";
$Script .= "</script>\n";
$Script .= "<script language=\"JavaScript\" src=\"scripts/tw-sack.js\"></script>\n";
$Script .= "<script type=\"text/javascript\">\n\n";
$Script .= "var ajax = new sack();\n";
$Script .= "var strInfo = \"\";\n";
$Script .= "function whenResponse () {\n";
$Script .= " retVals = this.response.split(\"|\");\n";
$Script .= " Message = retVals[0];\n";
$Script .= " Infos = retVals[1];\n";
$Script .= " retVals = Infos.split(\" \");\n";
$Script .= " UsedSlots = retVals[0];\n";
$Script .= " SpyProbes = retVals[1];\n";
$Script .= " Recyclers = retVals[2];\n";
$Script .= " Missiles = retVals[3];\n";
$Script .= " retVals = Message.split(\";\");\n";
$Script .= " CmdCode = retVals[0];\n";
$Script .= " strInfo = retVals[1];\n";
$Script .= " addToTable(\"done\", \"success\");\n";
$Script .= " changeSlots( UsedSlots );\n";
$Script .= " setShips(\"probes\", SpyProbes );\n";
$Script .= " setShips(\"recyclers\", Recyclers );\n";
$Script .= " setShips(\"missiles\", Missiles );\n";
$Script .= "}\n\n";
$Script .= "function doit (order, galaxy, system, planet, planettype, shipcount) {\n";
$Script .= " ajax.requestFile = \"flotenajax.php?action=send\";\n";
$Script .= " ajax.runResponse = whenResponse;\n";
$Script .= " ajax.execute = true;\n\n";
$Script .= " ajax.setVar(\"thisgalaxy\", ". $CurrentPlanet["galaxy"] .");\n";
$Script .= " ajax.setVar(\"thissystem\", ". $CurrentPlanet["system"] .");\n";
$Script .= " ajax.setVar(\"thisplanet\", ". $CurrentPlanet["planet"] .");\n";
$Script .= " ajax.setVar(\"thisplanettype\", ". $CurrentPlanet["planet_type"] .");\n";
$Script .= " ajax.setVar(\"mission\", order);\n";
$Script .= " ajax.setVar(\"galaxy\", galaxy);\n";
$Script .= " ajax.setVar(\"system\", system);\n";
$Script .= " ajax.setVar(\"planet\", planet);\n";
$Script .= " ajax.setVar(\"planettype\", planettype);\n";
$Script .= " if (order == 6)\n";
$Script .= " ajax.setVar(\"ship210\", shipcount);\n";
$Script .= " if (order == 7) {\n";
$Script .= " ajax.setVar(\"ship208\", 1);\n\n";
$Script .= " ajax.setVar(\"ship203\", 2);\n\n";
$Script .= " }\n";
$Script .= " if (order == 8)\n";
$Script .= " ajax.setVar(\"ship209\", shipcount);\n\n";
$Script .= " ajax.runAJAX();\n";
$Script .= "}\n\n";
$Script .= "function addToTable(strDataResult, strClass) {\n";
$Script .= " var e = document.getElementById('fleetstatusrow');\n";
$Script .= " var e2 = document.getElementById('fleetstatustable');\n";
$Script .= " e.style.display = '';\n";
$Script .= " if(e2.rows.length > 2) {\n";
$Script .= " e2.deleteRow(2);\n";
$Script .= " }\n";
$Script .= " var row = e2.insertRow(0);\n";
$Script .= " var td1 = document.createElement(\"td\");\n";
$Script .= " var td1text = document.createTextNode(strInfo);\n";
$Script .= " td1.appendChild(td1text);\n";
$Script .= " var td2 = document.createElement(\"td\");\n";
$Script .= " var span = document.createElement(\"span\");\n";
$Script .= " var spantext = document.createTextNode(strDataResult);\n";
$Script .= " var spanclass = document.createAttribute(\"class\");\n";
$Script .= " spanclass.nodeValue = strClass;\n";
$Script .= " span.setAttributeNode(spanclass);\n";
$Script .= " span.appendChild(spantext);\n";
$Script .= " td2.appendChild(span);\n";
$Script .= " row.appendChild(td1);\n";
$Script .= " row.appendChild(td2);\n";
$Script .= "}\n\n";
$Script .= "function changeSlots(slotsInUse) {\n";
$Script .= " var e = document.getElementById('slots');\n";
$Script .= " e.innerHTML = slotsInUse;\n";
$Script .= "}\n\n";
$Script .= "function setShips(ship, count) {\n";
$Script .= " var e = document.getElementById(ship);\n";
$Script .= " e.innerHTML = count;\n";
$Script .= "}\n";
$Script .= "</script>\n";
return $Script;
}
?>

View file

@ -0,0 +1,83 @@
<?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 $Type
* @param unknown_type $Ref
* @param unknown_type $Value
* @param unknown_type $Init
*/
function InsertJavaScriptChronoApplet ( $Type, $Ref, $Value, $Init ) {
if ($Init == true) {
$JavaString = "<script type=\"text/javascript\">\n";
$JavaString .= "function t". $Type . $Ref ."() {\n";
$JavaString .= "v = new Date();\n";
$JavaString .= "var bxx". $Type . $Ref ." = document.getElementById('bxx". $Type . $Ref ."');\n";
$JavaString .= "n = new Date();\n";
$JavaString .= "ss". $Type . $Ref ." = pp". $Type . $Ref .";\n";
$JavaString .= "ss". $Type . $Ref ." = ss". $Type . $Ref ." - Math.round((n.getTime() - v.getTime()) / 1000.);\n";
$JavaString .= "m". $Type . $Ref ." = 0;\n";
$JavaString .= "h". $Type . $Ref ." = 0;\n";
$JavaString .= "if (ss". $Type . $Ref ." < 0) {\n";
$JavaString .= " bxx". $Type . $Ref .".innerHTML = \"-\";\n";
$JavaString .= "} else {\n";
$JavaString .= " if (ss". $Type . $Ref ." > 59) {\n";
$JavaString .= " m". $Type . $Ref ." = Math.floor(ss". $Type . $Ref ." / 60);\n";
$JavaString .= " ss". $Type . $Ref ." = ss". $Type . $Ref ." - m". $Type . $Ref ." * 60;\n";
$JavaString .= " }\n";
$JavaString .= " if (m". $Type . $Ref ." > 59) {\n";
$JavaString .= " h". $Type . $Ref ." = Math.floor(m". $Type . $Ref ." / 60);\n";
$JavaString .= " m". $Type . $Ref ." = m". $Type . $Ref ." - h". $Type . $Ref ." * 60;\n";
$JavaString .= " }\n";
$JavaString .= " if (ss". $Type . $Ref ." < 10) {\n";
$JavaString .= " ss". $Type . $Ref ." = \"0\" + ss". $Type . $Ref .";\n";
$JavaString .= " }\n";
$JavaString .= " if (m". $Type . $Ref ." < 10) {\n";
$JavaString .= " m". $Type . $Ref ." = \"0\" + m". $Type . $Ref .";\n";
$JavaString .= " }\n";
$JavaString .= " bxx". $Type . $Ref .".innerHTML = h". $Type . $Ref ." + \":\" + m". $Type . $Ref ." + \":\" + ss". $Type . $Ref .";\n";
$JavaString .= "}\n";
$JavaString .= "pp". $Type . $Ref ." = pp". $Type . $Ref ." - 1;\n";
$JavaString .= "window.setTimeout(\"t". $Type . $Ref ."();\", 999);\n";
$JavaString .= "}\n";
$JavaString .= "</script>\n";
} else {
$JavaString = "<script language=\"JavaScript\">\n";
$JavaString .= "pp". $Type . $Ref ." = ". $Value .";\n";
$JavaString .= "t". $Type . $Ref ."();\n";
$JavaString .= "</script>\n";
}
return $JavaString;
}
?>

View file

@ -0,0 +1,77 @@
<?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
* @param unknown_type $Element
* @param unknown_type $Incremental
* @param unknown_type $ForDestroy
*/
function IsElementBuyable ($CurrentUser, $CurrentPlanet, $Element, $Incremental = true, $ForDestroy = false) {
global $pricelist, $resource;
if (IsVacationMode($CurrentUser)) {
return false;
}
if ($Incremental) {
$level = ($CurrentPlanet[$resource[$Element]]) ? $CurrentPlanet[$resource[$Element]] : $CurrentUser[$resource[$Element]];
}
$array = array(
Legacies_Empire::RESOURCE_METAL,
Legacies_Empire::RESOURCE_CRISTAL,
Legacies_Empire::RESOURCE_DEUTERIUM,
'energy_max'
);
$cost = array();
foreach ($array as $ResType) {
if ($pricelist[$Element][$ResType] != 0) {
if ($Incremental) {
$cost[$ResType] = bcmul($pricelist[$Element][$ResType], bcpow($pricelist[$Element]['factor'], $level), 0);
} else {
$cost[$ResType] = $pricelist[$Element][$ResType];
}
if ($ForDestroy) {
$cost[$ResType] = bcdiv($cost[$ResType], 2, 0);
}
if (bccomp($cost[$ResType], $CurrentPlanet[$ResType]) > 0) {
return false;
}
}
}
return true;
}

View file

@ -0,0 +1,58 @@
<?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 $Officier
*/
function IsOfficierAccessible ($CurrentUser, $Officier) {
global $requirements, $resource, $pricelist;
if (isset($requirements[$Officier])) {
$enabled = true;
foreach($requirements[$Officier] as $ReqOfficier => $OfficierLevel) {
if ($CurrentUser[$resource[$ReqOfficier]] &&
$CurrentUser[$resource[$ReqOfficier]] >= $OfficierLevel) {
$enabled = 1;
} else {
return 0;
}
}
}
if ($CurrentUser[$resource[$Officier]] < $pricelist[$Officier]['max'] ) {
return 1;
} else {
return -1;
}
}
?>

View file

@ -0,0 +1,57 @@
<?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 $user
* @param unknown_type $planet
* @param unknown_type $element
*/
function IsTechnologieAccessible($user, $planet, $element)
{
global $requirements, $resource;
if (isset($requirements[$element])) {
$enabled = true;
foreach($requirements[$element] as $ReqElement => $EleLevel) {
if (@$user[$resource[$ReqElement]] && $user[$resource[$ReqElement]] >= $EleLevel) {
// break;
} elseif ($planet[$resource[$ReqElement]] && $planet[$resource[$ReqElement]] >= $EleLevel) {
$enabled = true;
} else {
return false;
}
}
return $enabled;
} else {
return true;
}
}

View file

@ -0,0 +1,58 @@
<?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 IsVacationMode($CurrentUser){
global $gameConfig;
if($CurrentUser['urlaubs_modus'] == 1){
$query = doquery("SELECT * FROM {{table}} WHERE id_owner = '{$CurrentUser['id']}'", 'planets');
while($id = mysql_fetch_array($query)){
doquery("UPDATE {{table}} SET
metal_perhour = '".$gameConfig['metal_basic_income']."',
crystal_perhour = '".$gameConfig['crystal_basic_income']."',
deuterium_perhour = '".$gameConfig['deuterium_basic_income']."',
metal_mine_porcent = '0',
crystal_mine_porcent = '0',
deuterium_sintetizer_porcent = '0',
solar_plant_porcent = '0',
fusion_plant_porcent = '0',
solar_satelit_porcent = '0'
WHERE id = '{$id['id']}' AND `planet_type` = '1' ", 'planets');
}
return true;
}
return false;
}
?>

View file

@ -0,0 +1,63 @@
<?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 $Title
* @param unknown_type $Message
* @param unknown_type $Goto
* @param unknown_type $Button
* @param unknown_type $TwoLines
*/
function MessageForm ($Title, $Message, $Goto = '', $Button = ' ok ', $TwoLines = false) {
$Form = "<center>";
$Form .= "<form action=\"". $Goto ."\" method=\"post\">";
$Form .= "<table width=\"519\">";
$Form .= "<tr>";
$Form .= "<td class=\"c\" colspan=\"2\">". $Title ."</td>";
$Form .= "</tr><tr>";
if ($TwoLines == true) {
$Form .= "<th colspan=\"2\">". $Message ."</th>";
$Form .= "</tr><tr>";
$Form .= "<th colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"". $Button ."\"></th>";
} else {
$Form .= "<th colspan=\"2\">". $Message ."<input type=\"submit\" value=\"". $Button ."\"></th>";
}
$Form .= "</tr>";
$Form .= "</table>";
$Form .= "</form>";
$Form .= "</center>";
return $Form;
}
// Release History
// - 1.0 Mise en fonction, Documentation
?>

View file

@ -0,0 +1,104 @@
<?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 $NbreMip
* @param unknown_type $IDAversaire
*/
function MipAttack ($NbreMip, $IDAversaire) {
$TechnoArme = doquery("SELECT * FROM {{table}} WHERE `id`='" . $user['id'] . "'", "users");
$InfoAdversaire = doquery("SELECT * FROM {{table}} WHERE `id`='" . $IDAversaire . "'", "planets", true);
$PuissanceAttaque = ($NbreMip * 12000) * (1.05 * $TechnoArme['military_tech']);
/*
401 => 'Lanceur de missiles',
402 => 'Artillerie laser l&eacute;g&egrave;re',
403 => 'Artillerie laser lourde',
404 => 'Canon de Gauss',
405 => 'Artillerie &agrave; ions',
406 => 'Lanceur de plasma',
407 => 'Petit bouclier',
408 => 'Grand bouclier',
*/
$TableauDeDefense = array(
401 => array ('shield' => 20),
402 => array ('shield' => 25),
403 => array ('shield' => 100),
404 => array ('shield' => 200),
405 => array ('shield' => 500),
406 => array ('shield' => 300),
407 => array ('shield' => 2000),
408 => array ('shield' => 2000)
);
$DefenseAdversaire = array(
401 => ($InfoAdversaire['misil_launcher']),
402 => ($InfoAdversaire['small_laser']),
403 => ($InfoAdversaire['big_laser']),
404 => ($InfoAdversaire['gauss_canyon']),
405 => ($InfoAdversaire['ionic_canyon']),
406 => ($InfoAdversaire['buster_canyon']),
407 => ($InfoAdversaire['small_protection_shield']),
408 => ($InfoAdversaire['big_protection_shield'])
);
while ($PuissanceAttaque > 20) {
$RandomDefense = rand(401, 408);
$SelectionDefense = $DefenseAdversaire[$RandomDefense];
if ($SelectionDefense > 0) {
if ($PuissanceAttaque > ($SelectionDefense * $TableauDeDefense[$RandomDefense])) {
$PuissanceAttaque = $PuissanceAttaque - ($SelectionDefense * $TableauDeDefense[$RandomDefense]);
$DefenseAdversaire[$RandomDefense] = $DefenseAdversaire[$RandomDefense] - 1;
}
}
}
$SqlDefenseur = "UPDATE {{table}} SET ";
$SqlDefenseur .= "`small_laser`='".$DefenseAdversaire[402]."', ";
$SqlDefenseur .= "`big_laser`='".$DefenseAdversaire[403]."', ";
$SqlDefenseur .= "`gauss_canyon`='".$DefenseAdversaire[404]."', ";
$SqlDefenseur .= "`ionic_canyon`='".$DefenseAdversaire[405]."', ";
$SqlDefenseur .= "`buster_canyon`='".$DefenseAdversaire[406]."', ";
$SqlDefenseur .= "`small_protection_shield`='".$DefenseAdversaire[407]."', ";
$SqlDefenseur .= "`big_protection_shield`='".$DefenseAdversaire[408]."' ";
$SqlDefenseur .= " WHERE `id`='".$IDAversaire."'";
doquery($SqlDefenseur, 'planets');
}
?>

View file

@ -0,0 +1,464 @@
<?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 $FleetRow
*/
function MissionCaseAttack($FleetRow)
{
global $lang;
$pricelist = Legacies_Empire_Model_Game_Prices::getSingleton();
$resource = Legacies_Empire_Model_Game_FieldsAlias::getSingleton();
$CombatCaps = Legacies_Empire_Model_Game_Combat::getSingleton();
if ($FleetRow['fleet_start_time'] <= time()) {
if ($FleetRow['fleet_mess'] == 0) {
if (!isset($CombatCaps[Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT]['sd'])) {
message("<font color=\"red\">" . $lang['sys_no_vars'] . "</font>", $lang['sys_error'], "fleet.php", 2);
}
// refactored parts
// {{{
$planetCollection = new Legacies_Core_Collection(array('planet' => 'planets'), 'Legacies_Empire_Model_Planet');
$planetCollection
->where('galaxy=:galaxy')
->where('system=:system')
->where('planet=:planet')
->where('type=:type')
->limit(1)
->load(array(
'galaxy' => $FleetRow['fleet_end_galaxy'],
'system' => $FleetRow['fleet_end_system'],
'planet' => $FleetRow['fleet_end_planet'],
'planet_type' => $FleetRow['fleet_end_type']
))
;
$TargetPlanet = $planetCollection->current();
/*
* Update planet resources and constructions
*/
Legacies::dispatchEvent('planet.update', array(
'planet' => $TargetPlanet
));
$TargetPlanet->save();
$TargetUser = $targetPlanet->getUser();
$CurrentUser = Legacies_Empire_Model_User::factory($FleetRow['fleet_owner']);
$TargetUserID = $TargetUser->getId();
$CurrentUserID = $CurrentUser->getId();
$TargetTechno = array(
'military_tech' => $TargetUser->getData('military_tech'),
'defence_tech' => $TargetUser->getData('defence_tech'),
'shield_tech' => $TargetUser->getData('shield_tech')
);
$CurrentTechno = array(
'military_tech' => $CurrentUser->getData('military_tech'),
'defence_tech' => $CurrentUser->getData('defence_tech'),
'shield_tech' => $CurrentUser->getData('shield_tech')
);
// }}}
for ($SetItem = 200; $SetItem < 500; $SetItem++) {
if ($TargetPlanet[$resource[$SetItem]] > 0) {
$TargetSet[$SetItem]['count'] = $TargetPlanet[$resource[$SetItem]];
}
}
$TheFleet = explode(";", $FleetRow['fleet_array']);
foreach($TheFleet as $a => $b) {
if ($b != '') {
$a = explode(",", $b);
$CurrentSet[$a[0]]['count'] = $a[1];
}
}
include_once($xnova_root_path . 'includes/ataki.' . PHPEXT);
// Calcul de la duree de traitement (initialisation)
$mtime = microtime();
$mtime = explode(" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;
$walka = walka($CurrentSet, $TargetSet, $CurrentTechno, $TargetTechno);
// Calcul de la duree de traitement (calcul)
$mtime = microtime();
$mtime = explode(" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;
$totaltime = ($endtime - $starttime);
// Ce qu'il reste de l'attaquant
$CurrentSet = $walka["atakujacy"];
// Ce qu'il reste de l'attaqué
$TargetSet = $walka["wrog"];
// Le resultat de la bataille
$FleetResult = $walka["wygrana"];
// Rapport long (rapport de bataille detaillé)
$dane_do_rw = $walka["dane_do_rw"];
// Rapport court (cdr + unitées perdues)
$zlom = $walka["zlom"];
$FleetArray = "";
$FleetAmount = 0;
$FleetStorage = 0;
foreach ($CurrentSet as $Ship => $Count) {
$FleetStorage += $pricelist[$Ship]["capacity"] * $Count['count'];
$FleetArray .= $Ship . "," . $Count['count'] . ";";
$FleetAmount += $Count['count'];
}
// Au cas ou le p'tit rigolo qu'a envoyé la flotte y avait mis des ressources ...
$FleetStorage -= $FleetRow["fleet_resource_metal"];
$FleetStorage -= $FleetRow["fleet_resource_crystal"];
$FleetStorage -= $FleetRow["fleet_resource_deuterium"];
$TargetPlanetUpd = "";
if (!is_null($TargetSet)) {
foreach($TargetSet as $Ship => $Count) {
$TargetPlanetUpd .= "`" . $resource[$Ship] . "` = '" . $Count['count'] . "', ";
}
}
// Determination des ressources pillées
$Mining['metal'] = 0;
$Mining['crystal'] = 0;
$Mining['deuter'] = 0;
if ($FleetResult == "a") {
if ($FleetStorage > 0) {
$metal = $TargetPlanet['metal'] / 2;
$crystal = $TargetPlanet['crystal'] / 2;
$deuter = $TargetPlanet["deuterium"] / 2;
if (($metal) > $FleetStorage / 3) {
$Mining['metal'] = $FleetStorage / 3;
$FleetStorage = $FleetStorage - $Mining['metal'];
} else {
$Mining['metal'] = $metal;
$FleetStorage = $FleetStorage - $Mining['metal'];
}
if (($crystal) > $FleetStorage / 2) {
$Mining['crystal'] = $FleetStorage / 2;
$FleetStorage = $FleetStorage - $Mining['crystal'];
} else {
$Mining['crystal'] = $crystal;
$FleetStorage = $FleetStorage - $Mining['crystal'];
}
if (($deuter) > $FleetStorage) {
$Mining['deuter'] = $FleetStorage;
$FleetStorage = $FleetStorage - $Mining['deuter'];
} else {
$Mining['deuter'] = $deuter;
$FleetStorage = $FleetStorage - $Mining['deuter'];
}
}
}
$Mining['metal'] = round($Mining['metal']);
$Mining['crystal'] = round($Mining['crystal']);
$Mining['deuter'] = round($Mining['deuter']);
// Mise a jour de l'enregistrement de la planete attaquée
$QryUpdateTarget = "UPDATE {{table}} SET ";
$QryUpdateTarget .= $TargetPlanetUpd;
$QryUpdateTarget .= "`metal` = `metal` - '" . $Mining['metal'] . "', ";
$QryUpdateTarget .= "`crystal` = `crystal` - '" . $Mining['crystal'] . "', ";
$QryUpdateTarget .= "`deuterium` = `deuterium` - '" . $Mining['deuter'] . "' ";
$QryUpdateTarget .= "WHERE ";
$QryUpdateTarget .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND ";
$QryUpdateTarget .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND ";
$QryUpdateTarget .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' AND ";
$QryUpdateTarget .= "`planet_type` = '" . $FleetRow['fleet_end_type'] . "' ";
$QryUpdateTarget .= "LIMIT 1;";
doquery($QryUpdateTarget , 'planets');
// Mise a jour du champ de ruine devant la planete attaquée
$QryUpdateGalaxy = "UPDATE {{table}} SET ";
$QryUpdateGalaxy .= "`metal` = `metal` + '" . $zlom['metal'] . "', ";
$QryUpdateGalaxy .= "`crystal` = `crystal` + '" . $zlom['crystal'] . "' ";
$QryUpdateGalaxy .= "WHERE ";
$QryUpdateGalaxy .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND ";
$QryUpdateGalaxy .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND ";
$QryUpdateGalaxy .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' ";
$QryUpdateGalaxy .= "LIMIT 1;";
doquery($QryUpdateGalaxy , 'galaxy');
// Là on va discuter le bout de gras pour voir s'il y a moyen d'avoir une Lune !
$FleetDebris = $zlom['metal'] + $zlom['crystal'];
$StrAttackerUnits = sprintf ($lang['sys_attacker_lostunits'], pretty_number ($zlom["atakujacy"]));
$StrDefenderUnits = sprintf ($lang['sys_defender_lostunits'], pretty_number ($zlom["wrog"]));
$StrRuins = sprintf ($lang['sys_gcdrunits'], pretty_number ($zlom["metal"]), $lang['Metal'], pretty_number ($zlom['crystal']), $lang['Crystal']);
$DebrisField = $StrAttackerUnits . "<br />" . $StrDefenderUnits . "<br />" . $StrRuins;
$MoonChance = $FleetDebris / 100000;
if ($FleetDebris > 2000000) {
$MoonChance = 20;
}
if ($FleetDebris < 100000) {
$UserChance = 0;
$ChanceMoon = "";
} elseif ($FleetDebris >= 100000) {
$UserChance = mt_rand(1, 100);
$ChanceMoon = sprintf ($lang['sys_moonproba'], $MoonChance);
}
if (($UserChance > 0) and ($UserChance <= $MoonChance) and $galenemyrow['id_luna'] == 0) {
$TargetPlanetName = CreateOneMoonRecord ($FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet'], $TargetUserID, $FleetRow['fleet_start_time'], '', $MoonChance);
$GottenMoon = sprintf ($lang['sys_moonbuilt'], $TargetPlanetName, $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
} elseif ($UserChance = 0 or $UserChance > $MoonChance) {
$GottenMoon = "";
}
$AttackDate = date("r", $FleetRow["fleet_start_time"]);
$title = sprintf ($lang['sys_attack_title'], $AttackDate);
$raport = "<center><table><tr><td>" . $title . "<br />";
$zniszczony = false;
$a_zestrzelona = 0;
$AttackTechon['A'] = $CurrentTechno["military_tech"] * 10;
$AttackTechon['B'] = $CurrentTechno["defence_tech"] * 10;
$AttackTechon['C'] = $CurrentTechno["shield_tech"] * 10;
$AttackerData = sprintf ($lang['sys_attack_attacker_pos'], $CurrentUser["username"], $FleetRow['fleet_start_galaxy'], $FleetRow['fleet_start_system'], $FleetRow['fleet_start_planet']);
$AttackerTech = sprintf ($lang['sys_attack_techologies'], $AttackTechon['A'], $AttackTechon['B'], $AttackTechon['C']);
$DefendTechon['A'] = $TargetTechno["military_tech"] * 10;
$DefendTechon['B'] = $TargetTechno["defence_tech"] * 10;
$DefendTechon['C'] = $TargetTechno["shield_tech"] * 10;
$DefenderData = sprintf ($lang['sys_attack_defender_pos'], $TargetUser["username"], $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
$DefenderTech = sprintf ($lang['sys_attack_techologies'], $DefendTechon['A'], $DefendTechon['B'], $DefendTechon['C']);
foreach ($dane_do_rw as $a => $b) {
$raport .= "<table border=1 width=100%><tr><th><br /><center>" . $AttackerData . "<br />" . $AttackerTech . "<table border=1>";
if ($b["atakujacy"]['count'] > 0) {
$raport1 = "<tr><th>" . $lang['sys_ship_type'] . "</th>";
$raport2 = "<tr><th>" . $lang['sys_ship_count'] . "</th>";
$raport3 = "<tr><th>" . $lang['sys_ship_weapon'] . "</th>";
$raport4 = "<tr><th>" . $lang['sys_ship_shield'] . "</th>";
$raport5 = "<tr><th>" . $lang['sys_ship_armour'] . "</th>";
foreach ($b["atakujacy"] as $Ship => $Data) {
if (is_numeric($Ship)) {
if ($Data['count'] > 0) {
$raport1 .= "<th>" . $lang["tech_rc"][$Ship] . "</th>";
$raport2 .= "<th>" . pretty_number ($Data['count']) . "</th>";
$raport3 .= "<th>" . pretty_number (round($Data["atak"] / $Data['count'])) . "</th>";
$raport4 .= "<th>" . pretty_number (round($Data["tarcza"] / $Data['count'])) . "</th>";
$raport5 .= "<th>" . pretty_number (round($Data["obrona"] / $Data['count'])) . "</th>";
}
}
}
$raport1 .= "</tr>";
$raport2 .= "</tr>";
$raport3 .= "</tr>";
$raport4 .= "</tr>";
$raport5 .= "</tr>";
$raport .= $raport1 . $raport2 . $raport3 . $raport4 . $raport5;
} else {
if ($a == 2) {
$a_zestrzelona = 1;
}
$zniszczony = true;
$raport .= "<br />" . $lang['sys_destroyed'];
}
$raport .= "</table></center></th></tr></table>";
$raport .= "<table border=1 width=100%><tr><th><br /><center>" . $DefenderData . "<br />" . $DefenderTech . "<table border=1>";
if ($b["wrog"]['count'] > 0) {
$raport1 = "<tr><th>" . $lang['sys_ship_type'] . "</th>";
$raport2 = "<tr><th>" . $lang['sys_ship_count'] . "</th>";
$raport3 = "<tr><th>" . $lang['sys_ship_weapon'] . "</th>";
$raport4 = "<tr><th>" . $lang['sys_ship_shield'] . "</th>";
$raport5 = "<tr><th>" . $lang['sys_ship_armour'] . "</th>";
foreach ($b["wrog"] as $Ship => $Data) {
if (is_numeric($Ship)) {
if ($Data['count'] > 0) {
$raport1 .= "<th>" . $lang["tech_rc"][$Ship] . "</th>";
$raport2 .= "<th>" . pretty_number ($Data['count']) . "</th>";
$raport3 .= "<th>" . pretty_number (round($Data["atak"] / $Data['count'])) . "</th>";
$raport4 .= "<th>" . pretty_number (round($Data["tarcza"] / $Data['count'])) . "</th>";
$raport5 .= "<th>" . pretty_number (round($Data["obrona"] / $Data['count'])) . "</th>";
}
}
}
$raport1 .= "</tr>";
$raport2 .= "</tr>";
$raport3 .= "</tr>";
$raport4 .= "</tr>";
$raport5 .= "</tr>";
$raport .= $raport1 . $raport2 . $raport3 . $raport4 . $raport5;
} else {
$zniszczony = true;
$raport .= "<br />" . $lang['sys_destroyed'];
}
$raport .= "</table></center></th></tr></table>";
if (($zniszczony == false) and !($a == 8)) {
$AttackWaveStat = sprintf ($lang['sys_attack_attack_wave'], pretty_number (floor($b["atakujacy"]["atak"])), pretty_number (floor($b["wrog"]["tarcza"])));
$DefendWavaStat = sprintf ($lang['sys_attack_defend_wave'], pretty_number (floor($b["wrog"]["atak"])), pretty_number (floor($b["atakujacy"]["tarcza"])));
$raport .= "<br /><center>" . $AttackWaveStat . "<br />" . $DefendWavaStat . "</center>";
}
}
switch ($FleetResult) {
case "a":
$Pillage = sprintf ($lang['sys_stealed_ressources'], pretty_number ($Mining['metal']), $lang['metal'], pretty_number ($Mining['crystal']), $lang['crystal'], pretty_number ($Mining['deuter']), $lang['Deuterium']);
$raport .= $lang['sys_attacker_won'] . "<br />" . $Pillage . "<br />";
$raport .= $DebrisField . "<br />";
$raport .= $ChanceMoon . "<br />";
$raport .= $GottenMoon . "<br />";
break;
case "r":
$raport .= $lang['sys_both_won'] . "<br />";
$raport .= $DebrisField . "<br />";
$raport .= $ChanceMoon . "<br />";
$raport .= $GottenMoon . "<br />";
break;
case "w":
$raport .= $lang['sys_defender_won'] . "<br />";
$raport .= $DebrisField . "<br />";
$raport .= $ChanceMoon . "<br />";
$raport .= $GottenMoon . "<br />";
doquery("DELETE FROM {{table}} WHERE `fleet_id` = '" . $FleetRow["fleet_id"] . "';", 'fleets');
break;
default:
break;
}
$SimMessage = sprintf ($lang['sys_rapport_build_time'], $totaltime);
$raport .= $SimMessage . "</table>";
$rid = md5($raport);
$QryInsertRapport = "INSERT INTO {{table}} SET ";
$QryInsertRapport .= "`time` = UNIX_TIMESTAMP(), ";
$QryInsertRapport .= "`id_owner1` = '" . $FleetRow['fleet_owner'] . "', ";
$QryInsertRapport .= "`id_owner2` = '" . $TargetUserID . "', ";
$QryInsertRapport .= "`rid` = '" . $rid . "', ";
$QryInsertRapport .= "`a_zestrzelona` = '" . $a_zestrzelona . "', ";
$QryInsertRapport .= "`raport` = '" . addslashes ($raport) . "';";
doquery($QryInsertRapport , 'rw');
// Colorisation du résumé de rapport pour l'attaquant
$raport = "<a href # OnClick=\"f( 'rw.php?raport=" . $rid . "', '');\" >";
$raport .= "<center>";
if ($FleetResult == "a") {
$raport .= "<font color=\"green\">";
} elseif ($FleetResult == "r") {
$raport .= "<font color=\"orange\">";
} elseif ($FleetResult == "w") {
$raport .= "<font color=\"red\">";
}
$raport .= $lang['sys_mess_attack_report'] . " [" . $FleetRow['fleet_end_galaxy'] . ":" . $FleetRow['fleet_end_system'] . ":" . $FleetRow['fleet_end_planet'] . "] </font></a><br /><br />";
$raport .= "<font color=\"red\">" . $lang['sys_perte_attaquant'] . ": " . pretty_number ($zlom["atakujacy"]) . "</font>";
$raport .= "<font color=\"green\"> " . $lang['sys_perte_defenseur'] . ":" . pretty_number ($zlom["wrog"]) . "</font><br />" ;
$raport .= $lang['sys_gain'] . " " . $lang['Metal'] . ":<font color=\"#adaead\">" . pretty_number ($Mining['metal']) . "</font> " . $lang['Crystal'] . ":<font color=\"#ef51ef\">" . pretty_number ($Mining['crystal']) . "</font> " . $lang['Deuterium'] . ":<font color=\"#f77542\">" . pretty_number ($Mining['deuter']) . "</font><br />";
$raport .= $lang['sys_debris'] . " " . $lang['Metal'] . ":<font color=\"#adaead\">" . pretty_number ($zlom['metal']) . "</font> " . $lang['Crystal'] . ":<font color=\"#ef51ef\">" . pretty_number ($zlom['crystal']) . "</font><br /></center>";
$Mining['metal'] = $Mining['metal'] + $FleetRow["fleet_resource_metal"];
$Mining['crystal'] = $Mining['crystal'] + $FleetRow["fleet_resource_crystal"];
$Mining['deuter'] = $Mining['deuter'] + $FleetRow["fleet_resource_deuterium"];
$QryUpdateFleet = "UPDATE {{table}} SET ";
$QryUpdateFleet .= "`fleet_amount` = '" . $FleetAmount . "', ";
$QryUpdateFleet .= "`fleet_array` = '" . $FleetArray . "', ";
$QryUpdateFleet .= "`fleet_mess` = '1', ";
$QryUpdateFleet .= "`fleet_resource_metal` = '" . $Mining['metal'] . "', ";
$QryUpdateFleet .= "`fleet_resource_crystal` = '" . $Mining['crystal'] . "', ";
$QryUpdateFleet .= "`fleet_resource_deuterium` = '" . $Mining['deuter'] . "' ";
$QryUpdateFleet .= "WHERE fleet_id = '" . $FleetRow['fleet_id'] . "' ";
$QryUpdateFleet .= "LIMIT 1 ;";
doquery($QryUpdateFleet , 'fleets');
SendSimpleMessage ($CurrentUserID, '', $FleetRow['fleet_start_time'], 3, $lang['sys_mess_tower'], $lang['sys_mess_attack_report'], $raport);
// Ajout du petit point raideur
$AddPoint = $CurrentUser['xpraid'] + 1;
$QryUpdateOfficier = "UPDATE {{table}} SET ";
$QryUpdateOfficier .= "`xpraid` = '" . $AddPoint . "' ";
$QryUpdateOfficier .= "WHERE id = '" . $CurrentUserID . "' ";
$QryUpdateOfficier .= "LIMIT 1 ;";
doquery($QryUpdateOfficier, 'users');
// Ajout d'un point au compteur de raids
$RaidsTotal = $CurrentUser['raids'] + 1;
if ($FleetResult == "a") {
$RaidsWin = $CurrentUser['raidswin'] + 1;
$QryUpdateRaidsCompteur = "UPDATE {{table}} SET ";
$QryUpdateRaidsCompteur .= "`raidswin` ='" . $RaidsWin . "', ";
$QryUpdateRaidsCompteur .= "`raids` ='" . $RaidsTotal . "' ";
$QryUpdateRaidsCompteur .= "WHERE id = '" . $CurrentUserID . "' ";
$QryUpdateRaidsCompteur .= "LIMIT 1 ;";
doquery($QryUpdateRaidsCompteur, 'users');
} elseif ($FleetResult == "r" || $FleetResult == "w") {
$RaidsLoose = $CurrentUser['raidsloose'] + 1;
$QryUpdateRaidsCompteur = "UPDATE {{table}} SET ";
$QryUpdateRaidsCompteur .= "`raidswin` ='" . $RaidsLoose . "', ";
$QryUpdateRaidsCompteur .= "`raids` ='" . $RaidsTotal . "' ";
$QryUpdateRaidsCompteur .= "WHERE id = '" . $CurrentUserID . "' ";
$QryUpdateRaidsCompteur .= "LIMIT 1 ;";
doquery($QryUpdateRaidsCompteur, 'users');
}
// Colorisation du résumé de rapport pour l'attaquant
$raport2 = "<a href # OnClick=\"f( 'rw.php?raport=" . $rid . "', '');\" >";
$raport2 .= "<center>";
if ($FleetResult == "a") {
$raport2 .= "<font color=\"green\">";
} elseif ($FleetResult == "r") {
$raport2 .= "<font color=\"orange\">";
} elseif ($FleetResult == "w") {
$raport2 .= "<font color=\"red\">";
}
$raport2 .= $lang['sys_mess_attack_report'] . " [" . $FleetRow['fleet_end_galaxy'] . ":" . $FleetRow['fleet_end_system'] . ":" . $FleetRow['fleet_end_planet'] . "] </font></a><br /><br />";
SendSimpleMessage ($TargetUserID, '', $FleetRow['fleet_start_time'], 3, $lang['sys_mess_tower'], $lang['sys_mess_attack_report'], $raport2);
}
// Retour de flotte (s'il en reste)
$fquery = "";
if ($FleetRow['fleet_end_time'] <= time()) {
if (!is_null($CurrentSet)) {
foreach($CurrentSet as $Ship => $Count) {
$fquery .= "`" . $resource[$Ship] . "` = `" . $resource[$Ship] . "` + '" . $Count['count'] . "', ";
}
} else {
$fleet = explode(";", $FleetRow['fleet_array']);
foreach($fleet as $a => $b) {
if ($b != '') {
$a = explode(",", $b);
$fquery .= "{$resource[$a[0]]}={$resource[$a[0]]} + {$a[1]}, \n";
}
}
}
doquery ("DELETE FROM {{table}} WHERE `fleet_id` = " . $FleetRow["fleet_id"], 'fleets');
if (!($FleetResult == "w")) {
$QryUpdatePlanet = "UPDATE {{table}} SET ";
$QryUpdatePlanet .= $fquery;
$QryUpdatePlanet .= "`metal` = `metal` + " . $FleetRow['fleet_resource_metal'] . ", ";
$QryUpdatePlanet .= "`crystal` = `crystal` + " . $FleetRow['fleet_resource_crystal'] . ", ";
$QryUpdatePlanet .= "`deuterium` = `deuterium` + " . $FleetRow['fleet_resource_deuterium'] . " ";
$QryUpdatePlanet .= "WHERE ";
$QryUpdatePlanet .= "`galaxy` = " . $FleetRow['fleet_start_galaxy'] . " AND ";
$QryUpdatePlanet .= "`system` = " . $FleetRow['fleet_start_system'] . " AND ";
$QryUpdatePlanet .= "`planet` = " . $FleetRow['fleet_start_planet'] . " AND ";
$QryUpdatePlanet .= "`planet_type` = " . $FleetRow['fleet_start_type'] . " LIMIT 1 ;";
doquery($QryUpdatePlanet, 'planets');
}
}
}
}

View file

@ -0,0 +1,105 @@
<?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 $FleetRow
*/
function MissionCaseColonisation ( $FleetRow ) {
global $lang, $resource;
$iPlanetCount = mysql_result(doquery ("SELECT count(*) FROM {{table}} WHERE `id_owner` = '". $FleetRow['fleet_owner'] ."' AND `planet_type` = '1'", 'planets'), 0);
if ($FleetRow['fleet_mess'] == 0) {
// Déjà, sommes nous a l'aller ??
$iGalaxyPlace = mysql_result(doquery ("SELECT count(*) FROM {{table}} WHERE `galaxy` = '". $FleetRow['fleet_end_galaxy']."' AND `system` = '". $FleetRow['fleet_end_system']."' AND `planet` = '". $FleetRow['fleet_end_planet']."';", 'galaxy'), 0);
$TargetAdress = sprintf ($lang['sys_adress_planet'], $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
if ($iGalaxyPlace == 0) {
// Y a personne qui s'y est mis avant que je ne debarque !
if ($iPlanetCount >= MAX_PLAYER_PLANETS && $user['authlevel'] != LEVEL_ADMIN) {
$TheMessage = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_maxcolo'] . MAX_PLAYER_PLANETS . $lang['sys_colo_planet'];
SendSimpleMessage ( $FleetRow['fleet_owner'], '', $FleetRow['fleet_start_time'], 0, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage);
doquery("UPDATE {{table}} SET `fleet_mess` = '1' WHERE `fleet_id` = ". $FleetRow["fleet_id"], 'fleets');
} else {
$NewOwnerPlanet = CreateOnePlanetRecord($FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet'], $FleetRow['fleet_owner'], $lang['sys_colo_defaultname'], false);
if ( $NewOwnerPlanet == true ) {
$TheMessage = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_allisok'];
SendSimpleMessage ( $FleetRow['fleet_owner'], '', $FleetRow['fleet_start_time'], 0, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage);
// Verifier ce que contient fleet_array (et le cas et cheant retirer un element '208'
if ($FleetRow['fleet_amount'] == 1) {
doquery("DELETE FROM {{table}} WHERE fleet_id=" . $FleetRow["fleet_id"], 'fleets');
} else {
$CurrentFleet = explode(";", $FleetRow['fleet_array']);
$NewFleet = "";
foreach ($CurrentFleet as $Item => $Group) {
if ($Group != '') {
$Class = explode (",", $Group);
if ($Class[0] == 208) {
if ($Class[1] > 1) {
$NewFleet .= $Class[0].",".($Class[1] - 1).";";
}
} else {
if ($Class[1] <> 0) {
$NewFleet .= $Class[0].",".$Class[1].";";
}
}
}
}
$QryUpdateFleet = "UPDATE {{table}} SET ";
$QryUpdateFleet .= "`fleet_array` = '". $NewFleet ."', ";
$QryUpdateFleet .= "`fleet_amount` = `fleet_amount` - 1, ";
$QryUpdateFleet .= "`fleet_mess` = '1' ";
$QryUpdateFleet .= "WHERE `fleet_id` = '". $FleetRow["fleet_id"] ."';";
doquery( $QryUpdateFleet, 'fleets');
}
} else {
$TheMessage = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_badpos'];
SendSimpleMessage ( $FleetRow['fleet_owner'], '', $FleetRow['fleet_start_time'], 0, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage);
doquery("UPDATE {{table}} SET `fleet_mess` = '1' WHERE `fleet_id` = ". $FleetRow["fleet_id"], 'fleets');
}
}
} else {
// Pas de bol coiffé sur le poteau !
$TheMessage = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_notfree'];
SendSimpleMessage ( $FleetRow['fleet_owner'], '', $FleetRow['fleet_end_time'], 0, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage);
// Mettre a jour la flotte pour qu'effectivement elle revienne !
doquery("UPDATE {{table}} SET `fleet_mess` = '1' WHERE `fleet_id` = ". $FleetRow["fleet_id"], 'fleets');
}
} else {
if ($FleetRow['fleet_end_time'] <= time()) {
// Retour de flotte
RestoreFleetToPlanet ( $FleetRow, true );
doquery("DELETE FROM {{table}} WHERE fleet_id=" . $FleetRow["fleet_id"], 'fleets');
}
}
}
?>

View file

@ -0,0 +1,644 @@
<?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 $FleetRow
*/
function MissionCaseDestruction($FleetRow)
{
global $user, $pricelist, $lang, $resource, $CombatCaps, $gameConfig;
includeLang('system');
if ($FleetRow['fleet_start_time'] <= time()) {
if ($FleetRow['fleet_mess'] == 0) {
if (!isset($CombatCaps[202]['sd'])) {
message("<font color=\"red\">". $lang['sys_no_vars'] ."</font>", $lang['sys_error'], "fleet." . PHPEXT, 2);
return;
}
$QryTargetPlanet = "SELECT * FROM {{table}} ";
$QryTargetPlanet .= "WHERE ";
$QryTargetPlanet .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
$QryTargetPlanet .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
$QryTargetPlanet .= "`planet` = '". $FleetRow['fleet_end_planet'] ."' AND ";
$QryTargetPlanet .= "`planet_type` = '". $FleetRow['fleet_end_type'] ."';";
$TargetPlanet = doquery( $QryTargetPlanet, 'planets', true);
$TargetUserID = $TargetPlanet['id_owner'];
$QryDepPlanet = "SELECT * FROM {{table}} ";
$QryDepPlanet .= "WHERE ";
$QryDepPlanet .= "`galaxy` = '". $FleetRow['fleet_start_galaxy'] ."' AND ";
$QryDepPlanet .= "`system` = '". $FleetRow['fleet_start_system'] ."' AND ";
$QryDepPlanet .= "`planet` = '". $FleetRow['fleet_start_planet'] ."' AND ";
$QryDepPlanet .= "`planet_type` = '". $FleetRow['fleet_start_type'] ."';";
$DepPlanet = doquery( $QryDepPlanet, 'planets', true);
$DepName = $DepPlanet['name'];
$QryCurrentUser = "SELECT * FROM {{table}} ";
$QryCurrentUser .= "WHERE ";
$QryCurrentUser .= "`id` = '". $FleetRow['fleet_owner'] ."';";
$CurrentUser = doquery($QryCurrentUser , 'users', true);
$CurrentUserID = $CurrentUser['id'];
$QryTargetUser = "SELECT * FROM {{table}} ";
$QryTargetUser .= "WHERE ";
$QryTargetUser .= "`id` = '". $TargetUserID ."';";
$TargetUser = doquery($QryTargetUser, 'users', true);
$QryTargetTech = "SELECT ";
$QryTargetTech .= "`military_tech`, `defence_tech`, `shield_tech` ";
$QryTargetTech .= "FROM {{table}} ";
$QryTargetTech .= "WHERE ";
$QryTargetTech .= "`id` = '". $TargetUserID ."';";
$TargetTechno = doquery($QryTargetTech, 'users', true);
$QryCurrentTech = "SELECT ";
$QryCurrentTech .= "`military_tech`, `defence_tech`, `shield_tech` ";
$QryCurrentTech .= "FROM {{table}} ";
$QryCurrentTech .= "WHERE ";
$QryCurrentTech .= "`id` = '". $CurrentUserID ."';";
$CurrentTechno = doquery($QryCurrentTech, 'users', true);
for ($SetItem = 200; $SetItem < 500; $SetItem++) {
if ($TargetPlanet[$resource[$SetItem]] > 0) {
$TargetSet[$SetItem]['count'] = $TargetPlanet[$resource[$SetItem]];
}
}
$TheFleet = explode(";", $FleetRow['fleet_array']);
foreach($TheFleet as $a => $b) {
if ($b != '') {
$a = explode(",", $b);
$CurrentSet[$a[0]]['count'] = $a[1];
}
}
include_once($ugamela_root_path . 'includes/ataki.' . PHPEXT);
// Calcul de la duree de traitement (initialisation)
$starttime = microtime(true);
$walka = walka($CurrentSet, $TargetSet, $CurrentTechno, $TargetTechno);
$totaltime = (microtime(true) - $starttime);
// Ce qu'il reste de l'attaquant
$CurrentSet = $walka["atakujacy"];
// Ce qu'il reste de l'attaqu<71>
$TargetSet = $walka["wrog"];
// Le resultat de la bataille
$FleetResult = $walka["wygrana"];
// Rapport long (rapport de bataille detaill<6C>)
$dane_do_rw = $walka["dane_do_rw"];
// Rapport court (cdr + unit<69>es perdues)
$zlom = $walka["zlom"];
$FleetArray = "";
$FleetAmount = 0;
$FleetStorage = 0;
foreach ($CurrentSet as $Ship => $Count) {
$FleetStorage += $pricelist[$Ship]["capacity"] * $Count['count'];
$FleetArray .= $Ship.",".$Count['count'].";";
$FleetAmount += $Count['count'];
}
$TargetPlanetUpd = "";
if (!is_null($TargetSet)) {
foreach($TargetSet as $Ship => $Count) {
$TargetPlanetUpd .= "`". $resource[$Ship] ."` = '". $Count['count'] ."', ";
}
}
if ($FleetResult == "a") {
$ripCount = 0.;
$supernovaCount = 0.;
$gravitonLevel = 0.;
if (isset($CurrentSet['214']) && isset($CurrentSet['214']['count'])) {
$ripCount = floatval($CurrentSet['214']['count']);
}
if (isset($CurrentSet['216']) && isset($CurrentSet['216']['count'])) {
$supernovaCount = floatval($CurrentSet['216']['count']);
}
if (isset($user[$resource[Legacies_Empire::ID_RESEARCH_GRAVITON_TECHNOLOGY]])) {
$gravitonLevel = floatval($user[$resource[Legacies_Empire::ID_RESEARCH_GRAVITON_TECHNOLOGY]]);
}
$destructionPower = $ripCount + ($supernovaCount * 4);
$gravitonPower = 1 + pow(1 - $gravitonLevel, 2);
$rawChances = pow(sqrt(1 / floatval($TargetPlanet['diameter'])) * $destructionPower * $gravitonPower, 2);
$chances = (1 - (1 / ((2500 / floatval($gameConfig['game_speed'])) * pow(1 + $rawChances, 2)))) * .5;
$tirage = mt_rand(0, 100000000);
$probalune = sprintf($lang['sys_destruc_lune'], (int) ($chances * 100));
if ($tirage <= ($chance * 1000000)) {
$resultat = '1';
$finmess = $lang['sys_destruc_reussi'];
//destruction de la lune dabord dans la liste des planetes puis dans la liste des lunes et enfin dans la galaxie
doquery("DELETE FROM {{table}} WHERE `id` = '". $TargetPlanet['id'] ."';", 'planets');
$Qrydestructionlune = "UPDATE {{table}} SET ";
$Qrydestructionlune .= "`destruyed` = '1' ";
$Qrydestructionlune .= "WHERE ";
$Qrydestructionlune .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
$Qrydestructionlune .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
$Qrydestructionlune .= "`lunapos` = '". $FleetRow['fleet_end_planet'] ."' ";
$Qrydestructionlune .= "LIMIT 1 ;";
doquery( $Qrydestructionlune , 'lunas');
$Qrydestructionlune2 = "UPDATE {{table}} SET ";
$Qrydestructionlune2 .= "`id_luna` = '0' ";
$Qrydestructionlune2 .= "WHERE ";
$Qrydestructionlune2 .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
$Qrydestructionlune2 .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
$Qrydestructionlune2 .= "`planet` = '". $FleetRow['fleet_end_planet'] ."' ";
$Qrydestructionlune2 .= "LIMIT 1 ;";
//$Qrydestructionlune2 .= ";";
doquery( $Qrydestructionlune2 , 'galaxy');
//la lune est detruite, alors on redirige les flottes sur la planete
$QryDetFleets1 = "UPDATE {{table}} SET ";
$QryDetFleets1 .= "`fleet_start_type` = '1' ";
$QryDetFleets1 .= "WHERE ";
$QryDetFleets1 .= "`fleet_start_galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
$QryDetFleets1 .= "`fleet_start_system` = '". $FleetRow['fleet_end_system'] ."' AND ";
$QryDetFleets1 .= "`fleet_start_planet` = '". $FleetRow['fleet_end_planet'] ."' ";
$QryDetFleets1 .= ";";
doquery( $QryDetFleets1 , 'fleets');
$QryDetFleets2 = "UPDATE {{table}} SET ";
$QryDetFleets2 .= "`fleet_end_type` = '1' ";
$QryDetFleets2 .= "WHERE ";
$QryDetFleets2 .= "`fleet_end_galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
$QryDetFleets2 .= "`fleet_end_system` = '". $FleetRow['fleet_end_system'] ."' AND ";
$QryDetFleets2 .= "`fleet_end_planet` = '". $FleetRow['fleet_end_planet'] ."' ";
$QryDetFleets2 .= ";";
doquery( $QryDetFleets2 , 'fleets');
//maintenant on va verifier si la vue du joueur n est pas calee sur la lune qui est detruite
if ($TargetUser['current_planet'] == $TargetPlanet['id']){
$QryPlanet = "SELECT * FROM {{table}} ";
$QryPlanet .= "WHERE ";
$QryPlanet .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
$QryPlanet .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
$QryPlanet .= "`planet` = '". $FleetRow['fleet_end_planet'] ."' AND ";
$QryPlanet .= "`planet_type` = '1';";
$Planet = doquery( $QryPlanet, 'planets', true);
$IDPlanet = $Planet['id'];
$Qryvue = "UPDATE {{table}} SET ";
$Qryvue .= "`current_planet` = '". $IDPlanet ."' ";
$Qryvue .= "WHERE ";
$Qryvue .= "`id` = '". $TargetUserID ."' ";
$Qryvue .= ";";
doquery( $Qryvue , 'users');
}
} else {
$resultat = '0';
}// la lune a resisté
// la lune a resiste, alors voyons les chances que les rip soient detruites
$destructionrip = (1 - (1 / pow($TargetPlanet['diameter'], 1 / 4))) * .5;
//maintenant qu on sait quelle chance tentons la destruction, allez roule croupier
$chance2 = round($destructionrip * 100); // En pourcentage
if ($resultat == 0) {
$tirage2 = mt_rand(0, 100);
$probarip = sprintf($lang['sys_destruc_rip'], $chance2);
if ($tirage2 <= $chance2) {
$resultat2 = ' detruite 1'; // RIP detruite
$finmess = $lang['sys_destruc_echec'];
doquery("DELETE FROM {{table}} WHERE `fleet_id` = '". $FleetRow["fleet_id"] ."';", 'fleets');
}
else {
$resultat2 = 'sauvees 0'; // les RIP sont saines et sauves
$finmess = $lang['sys_destruc_null'];
}}
//fin
}
$introdestruc = sprintf ($lang['sys_destruc_mess'], $DepName , $FleetRow['fleet_start_galaxy'], $FleetRow['fleet_start_system'], $FleetRow['fleet_start_planet'], $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
// Mise a jour de l'enregistrement de la planete attaqu<71>e
$QryUpdateTarget = "UPDATE {{table}} SET ";
$QryUpdateTarget .= $TargetPlanetUpd;
$QryUpdateTarget .= "`metal` = `metal` - '". $Mining['metal'] ."', ";
$QryUpdateTarget .= "`crystal` = `crystal` - '". $Mining['crystal'] ."', ";
$QryUpdateTarget .= "`deuterium` = `deuterium` - '". $Mining['deuter'] ."' ";
$QryUpdateTarget .= "WHERE ";
$QryUpdateTarget .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
$QryUpdateTarget .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
$QryUpdateTarget .= "`planet` = '". $FleetRow['fleet_end_planet'] ."' AND ";
$QryUpdateTarget .= "`planet_type` = '". $FleetRow['fleet_end_type'] ."' ";
$QryUpdateTarget .= "LIMIT 1;";
doquery( $QryUpdateTarget , 'planets');
// Mise a jour du champ de ruine devant la planete attaqu<71>e
$QryUpdateGalaxy = "UPDATE {{table}} SET ";
$QryUpdateGalaxy .= "`metal` = `metal` + '". $zlom['metal'] ."', ";
$QryUpdateGalaxy .= "`crystal` = `crystal` + '". $zlom['crystal'] ."' ";
$QryUpdateGalaxy .= "WHERE ";
$QryUpdateGalaxy .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
$QryUpdateGalaxy .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
$QryUpdateGalaxy .= "`planet` = '". $FleetRow['fleet_end_planet'] ."' ";
$QryUpdateGalaxy .= "LIMIT 1;";
doquery( $QryUpdateGalaxy , 'galaxy');
// L<> on va discuter le bout de gras pour voir s'il y a moyen d'avoir une Lune !
$FleetDebris = $zlom['metal'] + $zlom['crystal'];
$StrAttackerUnits = sprintf ($lang['sys_attacker_lostunits'], $zlom["atakujacy"]);
$StrDefenderUnits = sprintf ($lang['sys_defender_lostunits'], $zlom["wrog"]);
$StrRuins = sprintf ($lang['sys_gcdrunits'], $zlom["metal"], $lang['Metal'], $zlom['crystal'], $lang['Crystal']);
$DebrisField = $StrAttackerUnits ."<br />". $StrDefenderUnits ."<br />". $StrRuins;
$MoonChance = $FleetDebris / 100000;
if ($FleetDebris > 2000000) {
$MoonChance = 20;
}
if ($FleetDebris < 100000) {
$UserChance = 0;
$ChanceMoon = "";
} elseif ($FleetDebris >= 100000) {
$UserChance = mt_rand(1, 100);
$ChanceMoon = sprintf ($lang['sys_moonproba'], $MoonChance);
}
if (($UserChance > 0) and ($UserChance <= $MoonChance) and $galenemyrow['id_luna'] == 0) {
$TargetPlanetName = CreateOneMoonRecord ( $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet'], $TargetUserID, $FleetRow['fleet_start_time'], '', $MoonChance );
$GottenMoon = sprintf ($lang['sys_moonbuilt'], $TargetPlanetName, $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
} elseif ($UserChance = 0 or $UserChance > $MoonChance) {
$GottenMoon = "";
}
$AttackDate = date("r", $FleetRow["fleet_start_time"]);
$title = sprintf ($lang['sys_destruc_title'], $AttackDate);
$raport = "<center><table><tr><td>". $title ."<br />";
$zniszczony = false;
$a_zestrzelona = 0;
$AttackTechon['A'] = $CurrentTechno["military_tech"] * 10;
$AttackTechon['B'] = $CurrentTechno["defence_tech"] * 10;
$AttackTechon['C'] = $CurrentTechno["shield_tech"] * 10;
$AttackerData = sprintf ($lang['sys_attack_attacker_pos'], $CurrentUser["username"], $FleetRow['fleet_start_galaxy'], $FleetRow['fleet_start_system'], $FleetRow['fleet_start_planet'] );
$AttackerTech = sprintf ($lang['sys_attack_techologies'], $AttackTechon['A'], $AttackTechon['B'], $AttackTechon['C']);
$DefendTechon['A'] = $TargetTechno["military_tech"] * 10;
$DefendTechon['B'] = $TargetTechno["defence_tech"] * 10;
$DefendTechon['C'] = $TargetTechno["shield_tech"] * 10;
$DefenderData = sprintf ($lang['sys_attack_defender_pos'], $TargetUser["username"], $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet'] );
$DefenderTech = sprintf ($lang['sys_attack_techologies'], $DefendTechon['A'], $DefendTechon['B'], $DefendTechon['C']);
foreach ($dane_do_rw as $a => $b) {
$raport .= "<table border=1 width=100%><tr><th><br /><center>".$AttackerData."<br />".$AttackerTech."<table border=1>";
if ($b["atakujacy"]['count'] > 0) {
$raport1 = "<tr><th>".$lang['sys_ship_type']."</th>";
$raport2 = "<tr><th>".$lang['sys_ship_count']."</th>";
$raport3 = "<tr><th>".$lang['sys_ship_weapon']."</th>";
$raport4 = "<tr><th>".$lang['sys_ship_shield']."</th>";
$raport5 = "<tr><th>".$lang['sys_ship_armour']."</th>";
foreach ($b["atakujacy"] as $Ship => $Data) {
if (is_numeric($Ship)) {
if ($Data['count'] > 0) {
$raport1 .= "<th>". $lang["tech_rc"][$Ship] ."</th>";
$raport2 .= "<th>". $Data['count'] ."</th>";
$raport3 .= "<th>". round($Data["atak"] / $Data['count']) ."</th>";
$raport4 .= "<th>". round($Data["tarcza"] / $Data['count']) ."</th>";
$raport5 .= "<th>". round($Data["obrona"] / $Data['count']) ."</th>";
}
}
}
$raport1 .= "</tr>";
$raport2 .= "</tr>";
$raport3 .= "</tr>";
$raport4 .= "</tr>";
$raport5 .= "</tr>";
$raport .= $raport1 . $raport2 . $raport3 . $raport4 . $raport5;
} else {
if ($a == 2) {
$a_zestrzelona = 1;
}
$zniszczony = true;
$raport .= "<br />". $lang['sys_destroyed'];
}
$raport .= "</table></center></th></tr></table>";
$raport .= "<table border=1 width=100%><tr><th><br /><center>".$DefenderData."<br />".$DefenderTech."<table border=1>";
if ($b["wrog"]['count'] > 0) {
$raport1 = "<tr><th>".$lang['sys_ship_type']."</th>";
$raport2 = "<tr><th>".$lang['sys_ship_count']."</th>";
$raport3 = "<tr><th>".$lang['sys_ship_weapon']."</th>";
$raport4 = "<tr><th>".$lang['sys_ship_shield']."</th>";
$raport5 = "<tr><th>".$lang['sys_ship_armour']."</th>";
foreach ($b["wrog"] as $Ship => $Data) {
if (is_numeric($Ship)) {
if ($Data['count'] > 0) {
$raport1 .= "<th>". $lang["tech_rc"][$Ship] ."</th>";
$raport2 .= "<th>". $Data['count'] ."</th>";
$raport3 .= "<th>". round($Data["atak"] / $Data['count']) ."</th>";
$raport4 .= "<th>". round($Data["tarcza"] / $Data['count']) ."</th>";
$raport5 .= "<th>". round($Data["obrona"] / $Data['count']) ."</th>";
}
}
}
$raport1 .= "</tr>";
$raport2 .= "</tr>";
$raport3 .= "</tr>";
$raport4 .= "</tr>";
$raport5 .= "</tr>";
$raport .= $raport1 . $raport2 . $raport3 . $raport4 . $raport5;
} else {
$zniszczony = true;
$raport .= "<br />". $lang['sys_destroyed'];
}
$raport .= "</table></center></th></tr></table>";
if (($zniszczony == false) and !($a == 8)) {
$AttackWaveStat = sprintf ($lang['sys_attack_attack_wave'], floor($b["atakujacy"]["atak"]), floor($b["wrog"]["tarcza"]));
$DefendWavaStat = sprintf ($lang['sys_attack_defend_wave'], floor($b["wrog"]["atak"]), floor($b["atakujacy"]["tarcza"]));
$raport .= "<br /><center>".$AttackWaveStat."<br />".$DefendWavaStat."</center>";
}
}
switch ($FleetResult) {
case "a":
$raport .= $lang['sys_attacker_won'] ."<br />";
$raport .= $DebrisField ."<br />";
$raport .= $introdestruc ."<br />";
$raport .= $lang['sys_destruc_mess1'];
$raport .= $finmess ."<br />";
$raport .= $probalune ."<br />";
$raport .= $probarip ."<br />";
break;
case "r":
$raport .= $lang['sys_both_won'] ."<br />";
$raport .= $DebrisField ."<br />";
$raport .= $introdestruc ."<br />";
$raport .= $lang['sys_destruc_stop'] ."<br />";
break;
case "w":
$raport .= $lang['sys_defender_won'] ."<br />";
$raport .= $DebrisField ."<br />";
$raport .= $introdestruc ."<br />";
$raport .= $lang['sys_destruc_stop'] ."<br />";
doquery("DELETE FROM {{table}} WHERE `fleet_id` = '". $FleetRow["fleet_id"] ."';", 'fleets');
break;
default:
break;
}
$SimMessage = sprintf($lang['sys_rapport_build_time'], $totaltime);
$raport .= $SimMessage ."</table>";
$dpath = (!$user["dpath"]) ? DEFAULT_SKINPATH : $user["dpath"];
$rid = md5($raport);
$QryInsertRapport = "INSERT INTO {{table}} SET ";
$QryInsertRapport .= "`time` = UNIX_TIMESTAMP(), ";
$QryInsertRapport .= "`id_owner1` = '". $FleetRow['fleet_owner'] ."', ";
$QryInsertRapport .= "`id_owner2` = '". $TargetUserID ."', ";
$QryInsertRapport .= "`rid` = '". $rid ."', ";
$QryInsertRapport .= "`a_zestrzelona` = '". $a_zestrzelona ."', ";
$QryInsertRapport .= "`raport` = '". addslashes ( $raport ) ."';";
doquery( $QryInsertRapport , 'rw');
// Colorisation du r<>sum<75> de rapport pour l'attaquant
$raport = "<a href # OnClick=\"f( 'rw.php?raport=". $rid ."', '');\" >";
$raport .= "<center>";
if ($FleetResult == "a") {
$raport .= "<font color=\"green\">";
} elseif ($FleetResult == "r") {
$raport .= "<font color=\"orange\">";
} elseif ($FleetResult == "w") {
$raport .= "<font color=\"red\">";
}
$raport .= $lang['sys_mess_destruc_report'] ." [". $FleetRow['fleet_end_galaxy'] .":". $FleetRow['fleet_end_system'] .":". $FleetRow['fleet_end_planet'] ."] </font></a><br /><br />";
$raport .= "<font color=\"red\">". $lang['sys_perte_attaquant'] .": ". $zlom["atakujacy"] ."</font>";
$raport .= "<font color=\"green\"> ". $lang['sys_perte_defenseur'] .":". $zlom["wrog"] ."</font><br />" ;
$raport .= $lang['sys_debris'] ." ". $lang['Metal'] .":<font color=\"#adaead\">". $zlom['metal'] ."</font> ". $lang['Crystal'] .":<font color=\"#ef51ef\">". $zlom['crystal'] ."</font><br /></center>";
$QryUpdateFleet = "UPDATE {{table}} SET ";
$QryUpdateFleet .= "`fleet_amount` = '". $FleetAmount ."', ";
$QryUpdateFleet .= "`fleet_array` = '". $FleetArray ."', ";
$QryUpdateFleet .= "`fleet_mess` = '1' ";
$QryUpdateFleet .= "WHERE fleet_id = '". $FleetRow['fleet_id'] ."' ";
$QryUpdateFleet .= "LIMIT 1 ;";
doquery( $QryUpdateFleet , 'fleets');
SendSimpleMessage ( $CurrentUserID, '', $FleetRow['fleet_start_time'], 3, $lang['sys_mess_tower'], $lang['sys_mess_destruc_report'], $raport );
// Colorisation du r<>sum<75> de rapport pour le defenseur
$raport2 = "<a href # OnClick=\"f( 'rw.php?raport=". $rid ."', '');\" >";
$raport2 .= "<center>";
if ($FleetResult == "a") {
$raport2 .= "<font color=\"red\">";
} elseif ($FleetResult == "r") {
$raport2 .= "<font color=\"orange\">";
} elseif ($FleetResult == "w") {
$raport2 .= "<font color=\"green\">";
}
$raport2 .= $lang['sys_mess_destruc_report'] ." [". $FleetRow['fleet_end_galaxy'] .":". $FleetRow['fleet_end_system'] .":". $FleetRow['fleet_end_planet'] ."] </font></a><br /><br />";
SendSimpleMessage ( $TargetUserID, '', $FleetRow['fleet_start_time'], 3, $lang['sys_mess_tower'], $lang['sys_mess_destruc_report'], $raport2 );
}
// Retour de flotte (s'il en reste)
$fquery = "";
if ($FleetRow['fleet_end_time'] <= time()) {
if (!is_null($CurrentSet)) {
foreach($CurrentSet as $Ship => $Count) {
$fquery .= "`". $resource[$Ship] ."` = `". $resource[$Ship] ."` + '". $Count['count'] ."', ";
}
} else {
$fleet = explode(";", $FleetRow['fleet_array']);
foreach($fleet as $a => $b) {
if ($b != '') {
$a = explode(",", $b);
$fquery .= "{$resource[$a[0]]}={$resource[$a[0]]} + {$a[1]}, \n";
}
}
}
doquery ("DELETE FROM {{table}} WHERE `fleet_id` = " . $FleetRow["fleet_id"], 'fleets');
if (!($FleetResult == "w")) {
$QryUpdatePlanet = "UPDATE {{table}} SET ";
$QryUpdatePlanet .= $fquery;
$QryUpdatePlanet .= "`metal` = `metal` + ". $FleetRow['fleet_resource_metal'] .", ";
$QryUpdatePlanet .= "`crystal` = `crystal` + ". $FleetRow['fleet_resource_crystal'] .", ";
$QryUpdatePlanet .= "`deuterium` = `deuterium` + ". $FleetRow['fleet_resource_deuterium'] ." ";
$QryUpdatePlanet .= "WHERE ";
$QryUpdatePlanet .= "`galaxy` = ".$FleetRow['fleet_start_galaxy']." AND ";
$QryUpdatePlanet .= "`system` = ".$FleetRow['fleet_start_system']." AND ";
$QryUpdatePlanet .= "`planet` = ".$FleetRow['fleet_start_planet']." AND ";
$QryUpdatePlanet .= "`planet_type` = ".$FleetRow['fleet_start_type']." LIMIT 1 ;";
doquery( $QryUpdatePlanet, 'planets' );
}
}
}
}

View file

@ -0,0 +1,239 @@
<?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 $FleetRow
*/
function MissionCaseExpedition ( $FleetRow ) {
global $lang, $resource, $pricelist;
$FleetOwner = $FleetRow['fleet_owner'];
$MessSender = $lang['sys_mess_qg'];
$MessTitle = $lang['sys_expe_report'];
if ($FleetRow['fleet_mess'] == 0) {
// Flotte en vol aller
if ($FleetRow['fleet_end_stay'] < time()) {
// La Flotte vient de finir son exploration
// Table de ratio de points par type de vaisseau
$PointsFlotte = array(
202 => 1.0, // 'Petit transporteur'
203 => 1.5, // 'Grand transporteur'
204 => 0.5, // 'Chasseur léger'
205 => 1.5, // 'Chasseur lourd'
206 => 2.0, // 'Croiseur'
207 => 2.5, // 'Vaisseau de bataille'
208 => 0.5, // 'Vaisseau de colonisation'
209 => 1.0, // 'Recycleur'
210 => 0.01, // 'Sonde espionnage'
211 => 3.0, // 'Bombardier'
212 => 0.0, // 'Satellite solaire'
213 => 3.5, // 'Destructeur'
214 => 5.0, // 'Etoile de la mort'
215 => 3.2, // 'Traqueur'
);
// Table de ratio de gains en nombre par type de vaisseau
$RatioGain = array (
202 => 0.1, // 'Petit transporteur'
203 => 0.1, // 'Grand transporteur'
204 => 0.1, // 'Chasseur léger'
205 => 0.5, // 'Chasseur lourd'
206 => 0.25, // 'Croiseur'
207 => 0.125, // 'Vaisseau de bataille'
208 => 0.5, // 'Vaisseau de colonisation'
209 => 0.1, // 'Recycleur'
210 => 0.1, // 'Sonde espionnage'
211 => 0.0625, // 'Bombardier'
212 => 0.0, // 'Satellite solaire'
213 => 0.0625, // 'Destructeur'
214 => 0.03125, // 'Etoile de la mort'
215 => 0.0625, // 'Traqueur'
);
$FleetStayDuration = ($FleetRow['fleet_end_stay'] - $FleetRow['fleet_start_time']) / 3600;
// Initialisation du contenu de la Flotte
$farray = explode(";", $FleetRow['fleet_array']);
foreach ($farray as $Item => $Group) {
if ($Group != '') {
$Class = explode (",", $Group);
$TypeVaisseau = $Class[0];
$NbreVaisseau = $Class[1];
$LaFlotte[$TypeVaisseau] = $NbreVaisseau;
//On calcul les ressources maximum qui peuvent être récupéré
$FleetCapacity += $pricelist[$TypeVaisseau]['capacity'];
// Maintenant on calcul en points toute la flotte
$FleetPoints += ($NbreVaisseau * $PointsFlotte[$TypeVaisseau]);
}
}
// Espace deja occupé dans les soutes si ce devait etre le cas
$FleetUsedCapacity = $FleetRow['fleet_resource_metal'] + $FleetRow['fleet_resource_crystal'] + $FleetRow['fleet_resource_deuterium'];
$FleetCapacity -= $FleetUsedCapacity;
//On récupère le nombre total de vaisseaux
$FleetCount = $FleetRow['fleet_amount'];
// Bon on les mange comment ces explorateurs ???
$Hasard = rand(0, 10);
$MessSender = $lang['sys_mess_qg']. "(".$Hasard.")";
if ($Hasard < 3) {
// Pas de bol, on les mange tout crus
$Hasard += 1;
$LostAmount = (($Hasard * 33) + 1) / 100;
// Message pour annoncer la bonne mauvaise nouvelle
if ($LostAmount == 100) {
// Supprimer effectivement la flotte
SendSimpleMessage ( $FleetOwner, '', $FleetRow['fleet_end_stay'], 15, $MessSender, $MessTitle, $lang['sys_expe_blackholl_2'] );
doquery ("DELETE FROM {{table}} WHERE `fleet_id` = ". $FleetRow["fleet_id"], 'fleets');
} else {
foreach ($LaFlotte as $Ship => $Count) {
$LostShips[$Ship] = intval($Count * $LostAmount);
$NewFleetArray .= $Ship.",". ($Count - $LostShips[$Ship]) .";";
}
$QryUpdateFleet = "UPDATE {{table}} SET ";
$QryUpdateFleet .= "`fleet_array` = '". $NewFleetArray ."', ";
$QryUpdateFleet .= "`fleet_mess` = '1' ";
$QryUpdateFleet .= "WHERE ";
$QryUpdateFleet .= "`fleet_id` = '". $FleetRow["fleet_id"] ."';";
doquery( $QryUpdateFleet, 'fleets');
SendSimpleMessage ( $FleetOwner, '', $FleetRow['fleet_end_stay'], 15, $MessSender, $MessTitle, $lang['sys_expe_blackholl_1'] );
}
} elseif ($Hasard == 3) {
// Ah un tour pour rien
doquery("UPDATE {{table}} SET `fleet_mess` = '1' WHERE `fleet_id` = ". $FleetRow["fleet_id"], 'fleets');
SendSimpleMessage ( $FleetOwner, '', $FleetRow['fleet_end_stay'], 15, $MessSender, $MessTitle, $lang['sys_expe_nothing_1'] );
} elseif ($Hasard >= 4 && $Hasard < 7) {
// Gains de ressources
if ($FleetCapacity > 5000) {
$MinCapacity = $FleetCapacity - 5000;
$MaxCapacity = $FleetCapacity;
$FoundGoods = rand($MinCapacity, $MaxCapacity);
$FoundMetal = intval($FoundGoods / 2);
$FoundCrist = intval($FoundGoods / 4);
$FoundDeute = intval($FoundGoods / 6);
$QryUpdateFleet = "UPDATE {{table}} SET ";
$QryUpdateFleet .= "`fleet_resource_metal` = `fleet_resource_metal` + '". $FoundMetal ."', ";
$QryUpdateFleet .= "`fleet_resource_crystal` = `fleet_resource_crystal` + '". $FoundCrist ."', ";
$QryUpdateFleet .= "`fleet_resource_deuterium` = `fleet_resource_deuterium` + '". $FoundDeute ."', ";
$QryUpdateFleet .= "`fleet_mess` = '1' ";
$QryUpdateFleet .= "WHERE ";
$QryUpdateFleet .= "`fleet_id` = '". $FleetRow["fleet_id"] ."';";
doquery( $QryUpdateFleet, 'fleets');
$Message = sprintf($lang['sys_expe_found_goods'],
pretty_number($FoundMetal), $lang['Metal'],
pretty_number($FoundCrist), $lang['Crystal'],
pretty_number($FoundDeute), $lang['Deuterium']);
SendSimpleMessage ( $FleetOwner, '', $FleetRow['fleet_end_stay'], 15, $MessSender, $MessTitle, $Message );
}
} elseif ($Hasard == 7) {
// Ah un tour pour rien
doquery("UPDATE {{table}} SET `fleet_mess` = '1' WHERE `fleet_id` = ". $FleetRow["fleet_id"], 'fleets');
SendSimpleMessage ( $FleetOwner, '', $FleetRow['fleet_end_stay'], 15, $MessSender, $MessTitle, $lang['sys_expe_nothing_2'] );
} elseif ($Hasard >= 8 && $Hasard < 11) {
// Gain de vaisseaux
$FoundChance = $FleetPoints / $FleetCount;
for ($Ship = 202; $Ship < 216; $Ship++) {
if ($LaFlotte[$Ship] != 0) {
$FoundShip[$Ship] = round($LaFlotte[$Ship] * $RatioGain[$Ship]);
if ($FoundShip[$Ship] > 0) {
$LaFlotte[$Ship] += $FoundShip[$Ship];
}
}
}
$NewFleetArray = "";
$FoundShipMess = "";
foreach ($LaFlotte as $Ship => $Count) {
if ($Count > 0) {
$NewFleetArray .= $Ship.",". $Count .";";
}
}
foreach ($FoundShip as $Ship => $Count) {
if ($Count != 0) {
$FoundShipMess .= $Count." ".$lang['tech'][$Ship].",";
}
}
$QryUpdateFleet = "UPDATE {{table}} SET ";
$QryUpdateFleet .= "`fleet_array` = '". $NewFleetArray ."', ";
$QryUpdateFleet .= "`fleet_mess` = '1' ";
$QryUpdateFleet .= "WHERE ";
$QryUpdateFleet .= "`fleet_id` = '". $FleetRow["fleet_id"] ."';";
doquery( $QryUpdateFleet, 'fleets');
$Message = $lang['sys_expe_found_ships']. $FoundShipMess . "";
SendSimpleMessage ( $FleetOwner, '', $FleetRow['fleet_end_stay'], 15, $MessSender, $MessTitle, $Message );
}
}
} else {
// La Flotte est de retour a quai
if ($FleetRow['fleet_end_time'] < time()) {
// Reintegration de ce qui se ballade avec la flotte
$farray = explode(";", $FleetRow['fleet_array']);
foreach ($farray as $Item => $Group) {
if ($Group != '') {
$Class = explode (",", $Group);
$FleetAutoQuery .= "`". $resource[$Class[0]]. "` = `". $resource[$Class[0]] ."` + ". $Class[1] .", ";
}
}
$QryUpdatePlanet = "UPDATE {{table}} SET ";
$QryUpdatePlanet .= $FleetAutoQuery;
$QryUpdatePlanet .= "`metal` = `metal` + ". $FleetRow['fleet_resource_metal'] .", ";
$QryUpdatePlanet .= "`crystal` = `crystal` + ". $FleetRow['fleet_resource_crystal'] .", ";
$QryUpdatePlanet .= "`deuterium` = `deuterium` + ". $FleetRow['fleet_resource_deuterium'] ." ";
$QryUpdatePlanet .= "WHERE ";
$QryUpdatePlanet .= "`galaxy` = '". $FleetRow['fleet_start_galaxy'] ."' AND ";
$QryUpdatePlanet .= "`system` = '". $FleetRow['fleet_start_system'] ."' AND ";
$QryUpdatePlanet .= "`planet` = '". $FleetRow['fleet_start_planet'] ."' AND ";
$QryUpdatePlanet .= "`planet_type` = '". $FleetRow['fleet_start_type'] ."' ";
$QryUpdatePlanet .= "LIMIT 1 ;";
doquery( $QryUpdatePlanet, 'planets');
// Message pour annoncer le retour de flotte
SendSimpleMessage ( $FleetOwner, '', $FleetRow['fleet_end_time'], 15, $MessSender, $MessTitle, $lang['sys_expe_back_home'] );
// Suppression de la flotte
doquery ("DELETE FROM {{table}} WHERE `fleet_id` = ". $FleetRow["fleet_id"], 'fleets');
}
}
}
?>

View file

@ -0,0 +1,141 @@
<?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 $FleetRow
*/
function MissionCaseRecycling ($FleetRow) {
global $pricelist, $lang;
if ($FleetRow["fleet_mess"] == "0") {
if ($FleetRow['fleet_start_time'] <= time()) {
$QrySelectGalaxy = "SELECT * FROM {{table}} ";
$QrySelectGalaxy .= "WHERE ";
$QrySelectGalaxy .= "`galaxy` = '".$FleetRow['fleet_end_galaxy']."' AND ";
$QrySelectGalaxy .= "`system` = '".$FleetRow['fleet_end_system']."' AND ";
$QrySelectGalaxy .= "`planet` = '".$FleetRow['fleet_end_planet']."' ";
$QrySelectGalaxy .= "LIMIT 1;";
$TargetGalaxy = doquery( $QrySelectGalaxy, 'galaxy', true);
$FleetRecord = explode(";", $FleetRow['fleet_array']);
$RecyclerCapacity = 0;
$OtherFleetCapacity = 0;
foreach ($FleetRecord as $Item => $Group) {
if ($Group != '') {
$Class = explode (",", $Group);
if ($Class[0] == 209) {
$RecyclerCapacity += $pricelist[$Class[0]]["capacity"] * $Class[1];
} else {
$OtherFleetCapacity += $pricelist[$Class[0]]["capacity"] * $Class[1];
}
}
}
$IncomingFleetGoods = $FleetRow["fleet_resource_metal"] + $FleetRow["fleet_resource_crystal"] + $FleetRow["fleet_resource_deuterium"];
if ($IncomingFleetGoods > $OtherFleetCapacity) {
$RecyclerCapacity -= ($IncomingFleetGoods - $OtherFleetCapacity);
}
if (($TargetGalaxy["metal"] + $TargetGalaxy["crystal"]) <= $RecyclerCapacity) {
$RecycledGoods["metal"] = $TargetGalaxy["metal"];
$RecycledGoods["crystal"] = $TargetGalaxy["crystal"];
} else {
if (($TargetGalaxy["metal"] > $RecyclerCapacity / 2) AND
($TargetGalaxy["crystal"] > $RecyclerCapacity / 2)) {
$RecycledGoods["metal"] = $RecyclerCapacity / 2;
$RecycledGoods["crystal"] = $RecyclerCapacity / 2;
} else {
if ($TargetGalaxy["metal"] > $TargetGalaxy["crystal"]) {
$RecycledGoods["crystal"] = $TargetGalaxy["crystal"];
if ($TargetGalaxy["metal"] > ($RecyclerCapacity - $RecycledGoods["crystal"])) {
$RecycledGoods["metal"] = $RecyclerCapacity - $RecycledGoods["crystal"];
} else {
$RecycledGoods["metal"] = $TargetGalaxy["metal"];
}
} else {
$RecycledGoods["metal"] = $TargetGalaxy["metal"];
if ($TargetGalaxy["crystal"] > ($RecyclerCapacity - $RecycledGoods["metal"])) {
$RecycledGoods["crystal"] = $RecyclerCapacity - $RecycledGoods["metal"];
} else {
$RecycledGoods["crystal"] = $TargetGalaxy["crystal"];
}
}
}
}
$NewCargo['Metal'] = $FleetRow["fleet_resource_metal"] + $RecycledGoods["metal"];
$NewCargo['Crystal'] = $FleetRow["fleet_resource_crystal"] + $RecycledGoods["crystal"];
$NewCargo['Deuterium'] = $FleetRow["fleet_resource_deuterium"];
$QryUpdateGalaxy = "UPDATE {{table}} SET ";
$QryUpdateGalaxy .= "`metal` = `metal` - '".$RecycledGoods["metal"]."', ";
$QryUpdateGalaxy .= "`crystal` = `crystal` - '".$RecycledGoods["crystal"]."' ";
$QryUpdateGalaxy .= "WHERE ";
$QryUpdateGalaxy .= "`galaxy` = '".$FleetRow['fleet_end_galaxy']."' AND ";
$QryUpdateGalaxy .= "`system` = '".$FleetRow['fleet_end_system']."' AND ";
$QryUpdateGalaxy .= "`planet` = '".$FleetRow['fleet_end_planet']."' ";
$QryUpdateGalaxy .= "LIMIT 1;";
doquery( $QryUpdateGalaxy, 'galaxy');
$Message = sprintf($lang['sys_recy_gotten'], pretty_number($RecycledGoods["metal"]), $lang['Metal'], pretty_number($RecycledGoods["crystal"]), $lang['Crystal']);
SendSimpleMessage ( $FleetRow['fleet_owner'], '', $FleetRow['fleet_start_time'], 4, $lang['sys_mess_spy_control'], $lang['sys_recy_report'], $Message);
doquery("UPDATE {{table}} SET `mnl_exploit` = `mnl_exploit` + '1' WHERE `id` = '".$FleetRow['fleet_owner']."'", 'users');
$QryUpdateFleet = "UPDATE {{table}} SET ";
$QryUpdateFleet .= "`fleet_resource_metal` = '".$NewCargo['Metal']."', ";
$QryUpdateFleet .= "`fleet_resource_crystal` = '".$NewCargo['Crystal']."', ";
$QryUpdateFleet .= "`fleet_resource_deuterium` = '".$NewCargo['Deuterium']."', ";
$QryUpdateFleet .= "`fleet_mess` = '1' ";
$QryUpdateFleet .= "WHERE ";
$QryUpdateFleet .= "`fleet_id` = '".$FleetRow['fleet_id']."' ";
$QryUpdateFleet .= "LIMIT 1;";
doquery( $QryUpdateFleet, 'fleets');
}
} else {
if ($FleetRow['fleet_end_time'] <= time()) {
// Mettre le message de retour de flotte
$Message = sprintf( $lang['sys_tran_mess_owner'],
$TargetName, GetTargetAdressLink($FleetRow, ''),
pretty_number($FleetRow['fleet_resource_metal']), $lang['Metal'],
pretty_number($FleetRow['fleet_resource_crystal']), $lang['Crystal'],
pretty_number($FleetRow['fleet_resource_deuterium']), $lang['Deuterium'] );
SendSimpleMessage ( $FleetRow['fleet_owner'], '', $FleetRow['fleet_end_time'], 4, $lang['sys_mess_spy_control'], $lang['sys_mess_fleetback'], $Message);
RestoreFleetToPlanet ( $FleetRow, true );
doquery("DELETE FROM {{table}} WHERE `fleet_id` = '". $FleetRow["fleet_id"] ."';", 'fleets');
}
}
}
// -----------------------------------------------------------------------------------------------------------
// History version
// 1.0 Mise en module initiale
?>

View file

@ -0,0 +1,204 @@
<?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 $FleetRow
*/
function MissionCaseSpy($FleetRow)
{
global $lang;
$resource = Legacies_Empire_Model_Game_FieldsAlias::getSingleton();
if ($FleetRow['fleet_start_time'] <= time()) {
// refactored parts
// {{{
$planetCollection = new Legacies_Core_Collection(array('planet' => 'planets'), 'Legacies_Empire_Model_Planet');
$planetCollection
->where('galaxy=:galaxy')
->where('system=:system')
->where('planet=:planet')
->where('type=:type')
->limit(1)
->load(array(
'galaxy' => $FleetRow['fleet_end_galaxy'],
'system' => $FleetRow['fleet_end_system'],
'planet' => $FleetRow['fleet_end_planet'],
'planet_type' => $FleetRow['fleet_end_type']
))
;
$TargetPlanet = $planetCollection->current();
/*
* Update planet resources and constructions
*/
Legacies::dispatchEvent('planet.update', array(
'planet' => $TargetPlanet
));
$TargetPlanet->save();
$TargetUser = $targetPlanet->getUser();
$CurrentUser = Legacies_Empire_Model_User::factory($FleetRow['fleet_owner']);
$TargetUserID = $TargetUser->getId();
$CurrentUserID = $CurrentUser->getId();
$TargetTechno = array(
'military_tech' => $TargetUser->getData('military_tech'),
'defence_tech' => $TargetUser->getData('defence_tech'),
'shield_tech' => $TargetUser->getData('shield_tech')
);
$CurrentTechno = array(
'military_tech' => $CurrentUser->getData('military_tech'),
'defence_tech' => $CurrentUser->getData('defence_tech'),
'shield_tech' => $CurrentUser->getData('shield_tech')
);
// }}}
$fleet = explode(";", $FleetRow['fleet_array']);
$fquery = "";
foreach ($fleet as $a => $b) {
if ($b != '') {
$a = explode(",", $b);
$fquery .= "{$resource[$a[0]]}={$resource[$a[0]]} + {$a[1]}, \n";
if ($FleetRow["fleet_mess"] != "1") {
if ($a[0] == "210") {
$LS = $a[1];
$QryTargetGalaxy = "SELECT * FROM {{table}} WHERE ";
$QryTargetGalaxy .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
$QryTargetGalaxy .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
$QryTargetGalaxy .= "`planet` = '". $FleetRow['fleet_end_planet'] ."';";
$TargetGalaxy = doquery( $QryTargetGalaxy, 'galaxy', true);
$CristalDebris = $TargetGalaxy['crystal'];
$SpyToolDebris = $LS * 300;
$MaterialsInfo = SpyTarget ( $TargetPlanet, 0, $lang['sys_spy_maretials'] );
$Materials = $MaterialsInfo['String'];
$PlanetFleetInfo = SpyTarget ( $TargetPlanet, 1, $lang['sys_spy_fleet'] );
$PlanetFleet = $Materials;
$PlanetFleet .= $PlanetFleetInfo['String'];
$PlanetDefenInfo = SpyTarget ( $TargetPlanet, 2, $lang['sys_spy_defenses'] );
$PlanetDefense = $PlanetFleet;
$PlanetDefense .= $PlanetDefenInfo['String'];
$PlanetBuildInfo = SpyTarget ( $TargetPlanet, 3, $lang['tech'][0] );
$PlanetBuildings = $PlanetDefense;
$PlanetBuildings .= $PlanetBuildInfo['String'];
$TargetTechnInfo = SpyTarget ( $TargetUser, 4, $lang['tech'][100] );
$TargetTechnos = $PlanetBuildings;
$TargetTechnos .= $TargetTechnInfo['String'];
$TargetForce = ($PlanetFleetInfo['Count'] * $LS) / 4;
if ($TargetForce > 100) {
$TargetForce = 100;
}
$TargetChances = rand(0, $TargetForce);
$SpyerChances = rand(0, 100);
if ($TargetChances >= $SpyerChances) {
$DestProba = sprintf( $lang['sys_mess_spy_lostproba'], $TargetChances);
} elseif ($TargetChances < $SpyerChances) {
$DestProba = "<font color=\"red\">".$lang['sys_mess_spy_destroyed']."</font>";
}
$AttackLink = "<center>";
$AttackLink .= "<a href=\"fleet.php?galaxy=". $FleetRow['fleet_end_galaxy'] ."&system=". $FleetRow['fleet_end_system'] ."";
$AttackLink .= "&planet=".$FleetRow['fleet_end_planet']."";
$AttackLink .= "&target_mission=1";
$AttackLink .= " \">". $lang['type_mission'][1] ."";
$AttackLink .= "</a></center>";
$MessageEnd = "<center>".$DestProba."</center>";
$pT = ($TargetSpyLvl - $CurrentSpyLvl);
$pW = ($CurrentSpyLvl - $TargetSpyLvl);
if ($TargetSpyLvl > $CurrentSpyLvl) {
$ST = ($LS - pow($pT, 2));
}
if ($CurrentSpyLvl > $TargetSpyLvl) {
$ST = ($LS + pow($pW, 2));
}
if ($TargetSpyLvl == $CurrentSpyLvl) {
$ST = $CurrentSpyLvl;
}
if ($ST <= "1") {
$SpyMessage = $Materials."<br />".$AttackLink.$MessageEnd;
}
if ($ST == "2") {
$SpyMessage = $PlanetFleet."<br />".$AttackLink.$MessageEnd;
}
if ($ST == "4" or $ST == "3") {
$SpyMessage = $PlanetDefense."<br />".$AttackLink.$MessageEnd;
}
if ($ST == "5" or $ST == "6") {
$SpyMessage = $PlanetBuildings."<br />".$AttackLink.$MessageEnd;
}
if ($ST >= "7") {
$SpyMessage = $TargetTechnos."<br />".$AttackLink.$MessageEnd;
}
SendSimpleMessage ( $CurrentUserID, '', $FleetRow['fleet_start_time'], 0, $lang['sys_mess_qg'], $lang['sys_mess_spy_report'], $SpyMessage);
$TargetMessage = $lang['sys_mess_spy_ennemyfleet'] ." ". $CurrentPlanet['name'];
$TargetMessage .= "<a href=\"galaxy.php?mode=3&galaxy=". $CurrentPlanet["galaxy"] ."&system=". $CurrentPlanet["system"] ."\">";
$TargetMessage .= "[". $CurrentPlanet["galaxy"] .":". $CurrentPlanet["system"] .":". $CurrentPlanet["planet"] ."]</a> ";
$TargetMessage .= $lang['sys_mess_spy_seen_at'] ." ". $TargetPlanet['name'];
$TargetMessage .= " [". $TargetPlanet["galaxy"] .":". $TargetPlanet["system"] .":". $TargetPlanet["planet"] ."].";
SendSimpleMessage ( $TargetUserID, '', $FleetRow['fleet_start_time'], 0, $lang['sys_mess_spy_control'], $lang['sys_mess_spy_activity'], $TargetMessage);
}
if ($TargetChances >= $SpyerChances) {
$QryUpdateGalaxy = "UPDATE {{table}} SET ";
$QryUpdateGalaxy .= "`crystal` = `crystal` + '". (0 + $SpyToolDebris) ."' ";
$QryUpdateGalaxy .= "WHERE `id_planet` = '". $TargetPlanet['id'] ."';";
doquery( $QryUpdateGalaxy, 'galaxy');
doquery("DELETE FROM {{table}} WHERE `fleet_id` = '". $FleetRow["fleet_id"] ."';", 'fleets');
} else {
doquery("UPDATE {{table}} SET `fleet_mess` = '1' WHERE `fleet_id` = '". $FleetRow["fleet_id"] ."';", 'fleets');
}
}
} else {
// Retour de sondes
if ($FleetRow['fleet_end_time'] <= time()) {
RestoreFleetToPlanet ( $FleetRow, true );
doquery("DELETE FROM {{table}} WHERE `fleet_id` = ". $FleetRow["fleet_id"], 'fleets');
}
}
}
}
}

View file

@ -0,0 +1,85 @@
<?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 $FleetRow
*/
function MissionCaseStay ( $FleetRow ) {
global $lang, $resource;
if ($FleetRow['fleet_mess'] == 0) {
if ($FleetRow['fleet_start_time'] <= time()) {
$QryGetTargetPlanet = "SELECT * FROM {{table}} ";
$QryGetTargetPlanet .= "WHERE ";
$QryGetTargetPlanet .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
$QryGetTargetPlanet .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
$QryGetTargetPlanet .= "`planet` = '". $FleetRow['fleet_end_planet'] ."' AND ";
$QryGetTargetPlanet .= "`planet_type` = '". $FleetRow['fleet_end_type'] ."';";
$TargetPlanet = doquery( $QryGetTargetPlanet, 'planets', true);
$TargetUserID = $TargetPlanet['id_owner'];
$TargetAdress = sprintf ($lang['sys_adress_planet'], $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
$TargetAddedGoods = sprintf ($lang['sys_stay_mess_goods'],
$lang['Metal'], pretty_number($FleetRow['fleet_resource_metal']),
$lang['Crystal'], pretty_number($FleetRow['fleet_resource_crystal']),
$lang['Deuterium'], pretty_number($FleetRow['fleet_resource_deuterium']));
$TargetMessage = $lang['sys_stay_mess_start'] ."<a href=\"galaxy.php?mode=3&galaxy=". $FleetRow['fleet_end_galaxy'] ."&system=". $FleetRow['fleet_end_system'] ."\">";
$TargetMessage .= $TargetAdress. "</a>". $lang['sys_stay_mess_end'] ."<br />". $TargetAddedGoods;
SendSimpleMessage ( $TargetUserID, '', $FleetRow['fleet_start_time'], 5, $lang['sys_mess_qg'], $lang['sys_stay_mess_stay'], $TargetMessage);
RestoreFleetToPlanet ( $FleetRow, false );
doquery("DELETE FROM {{table}} WHERE `fleet_id` = '". $FleetRow["fleet_id"] ."';", 'fleets');
}
} else {
if ($FleetRow['fleet_end_time'] <= time()) {
$TargetAdress = sprintf ($lang['sys_adress_planet'], $FleetRow['fleet_start_galaxy'], $FleetRow['fleet_start_system'], $FleetRow['fleet_start_planet']);
$TargetAddedGoods = sprintf ($lang['sys_stay_mess_goods'],
$lang['Metal'], pretty_number($FleetRow['fleet_resource_metal']),
$lang['Crystal'], pretty_number($FleetRow['fleet_resource_crystal']),
$lang['Deuterium'], pretty_number($FleetRow['fleet_resource_deuterium']));
$TargetMessage = $lang['sys_stay_mess_back'] ."<a href=\"galaxy.php?mode=3&galaxy=". $FleetRow['fleet_start_galaxy'] ."&system=". $FleetRow['fleet_start_system'] ."\">";
$TargetMessage .= $TargetAdress. "</a>". $lang['sys_stay_mess_bend'] ."<br />". $TargetAddedGoods;
SendSimpleMessage ( $FleetRow['fleet_owner'], '', $FleetRow['fleet_end_time'], 5, $lang['sys_mess_qg'], $lang['sys_mess_fleetback'], $TargetMessage);
RestoreFleetToPlanet ( $FleetRow, true );
doquery("DELETE FROM {{table}} WHERE `fleet_id` = '". $FleetRow["fleet_id"] ."';", 'fleets');
}
}
}
// -----------------------------------------------------------------------------------------------------------
// History version
// 1.0 Mise en module initiale
// 1.1 FIX permet un retour de flotte coh<6F>rant
?>

View file

@ -0,0 +1,93 @@
<?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 $FleetRow
*/
function MissionCaseStayAlly ( $FleetRow ) {
global $lang;
$QryStartPlanet = "SELECT * FROM {{table}} ";
$QryStartPlanet .= "WHERE ";
$QryStartPlanet .= "`galaxy` = '". $FleetRow['fleet_start_galaxy'] ."' AND ";
$QryStartPlanet .= "`system` = '". $FleetRow['fleet_start_system'] ."' AND ";
$QryStartPlanet .= "`planet` = '". $FleetRow['fleet_start_planet'] ."';";
$StartPlanet = doquery( $QryStartPlanet, 'planets', true);
$StartName = $StartPlanet['name'];
$StartOwner = $StartPlanet['id_owner'];
$QryTargetPlanet = "SELECT * FROM {{table}} ";
$QryTargetPlanet .= "WHERE ";
$QryTargetPlanet .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
$QryTargetPlanet .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
$QryTargetPlanet .= "`planet` = '". $FleetRow['fleet_end_planet'] ."';";
$TargetPlanet = doquery( $QryTargetPlanet, 'planets', true);
$TargetName = $TargetPlanet['name'];
$TargetOwner = $TargetPlanet['id_owner'];
if ($FleetRow['fleet_mess'] == 0) {
if ($FleetRow['fleet_start_time'] <= time()) {
$Message = sprintf( $lang['sys_tran_mess_owner'],
$TargetName, GetTargetAdressLink($FleetRow, ''),
$FleetRow['fleet_resource_metal'], $lang['Metal'],
$FleetRow['fleet_resource_crystal'], $lang['Crystal'],
$FleetRow['fleet_resource_deuterium'], $lang['Deuterium'] );
SendSimpleMessage ( $StartOwner, '', $FleetRow['fleet_start_time'], 5, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message);
$Message = sprintf( $lang['sys_tran_mess_user'],
$StartName, GetStartAdressLink($FleetRow, ''),
$TargetName, GetTargetAdressLink($FleetRow, ''),
$FleetRow['fleet_resource_metal'], $lang['Metal'],
$FleetRow['fleet_resource_crystal'], $lang['Crystal'],
$FleetRow['fleet_resource_deuterium'], $lang['Deuterium'] );
SendSimpleMessage ( $TargetOwner, '', $FleetRow['fleet_start_time'], 5, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message);
} elseif ( $FleetRow['fleet_end_stay'] <= time() ) {
$QryUpdateFleet = "UPDATE {{table}} SET ";
$QryUpdateFleet .= "`fleet_mess` = 2 ";
$QryUpdateFleet .= "WHERE `fleet_id` = '". $FleetRow['fleet_id'] ."' ";
$QryUpdateFleet .= "LIMIT 1 ;";
doquery( $QryUpdateFleet, 'fleets');
}
} else {
if ($FleetRow['fleet_end_time'] < time()) {
$Message = sprintf ($lang['sys_tran_mess_back'],
$StartName, GetStartAdressLink($FleetRow, ''));
SendSimpleMessage ( $StartOwner, '', $FleetRow['fleet_end_time'], 5, $lang['sys_mess_tower'], $lang['sys_mess_fleetback'], $Message);
RestoreFleetToPlanet ( $FleetRow, true );
doquery("DELETE FROM {{table}} WHERE fleet_id=" . $FleetRow["fleet_id"], 'fleets');
}
}
}
?>

View file

@ -0,0 +1,101 @@
<?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 $FleetRow
*/
function MissionCaseTransport ( $FleetRow ) {
global $lang;
$QryStartPlanet = "SELECT * FROM {{table}} ";
$QryStartPlanet .= "WHERE ";
$QryStartPlanet .= "`galaxy` = '". $FleetRow['fleet_start_galaxy'] ."' AND ";
$QryStartPlanet .= "`system` = '". $FleetRow['fleet_start_system'] ."' AND ";
$QryStartPlanet .= "`planet` = '". $FleetRow['fleet_start_planet'] ."' AND ";
$QryStartPlanet .= "`planet_type` = '". $FleetRow['fleet_start_type'] ."';";
$StartPlanet = doquery( $QryStartPlanet, 'planets', true);
$StartName = $StartPlanet['name'];
$StartOwner = $StartPlanet['id_owner'];
$QryTargetPlanet = "SELECT * FROM {{table}} ";
$QryTargetPlanet .= "WHERE ";
$QryTargetPlanet .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
$QryTargetPlanet .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
$QryTargetPlanet .= "`planet` = '". $FleetRow['fleet_end_planet'] ."' AND ";
$QryTargetPlanet .= "`planet_type` = '". $FleetRow['fleet_end_type'] ."';";
$TargetPlanet = doquery( $QryTargetPlanet, 'planets', true);
$TargetName = $TargetPlanet['name'];
$TargetOwner = $TargetPlanet['id_owner'];
if ($FleetRow['fleet_mess'] == 0) {
if ($FleetRow['fleet_start_time'] < time()) {
StoreGoodsToPlanet ($FleetRow, false);
$Message = sprintf( $lang['sys_tran_mess_owner'],
$TargetName, GetTargetAdressLink($FleetRow, ''),
$FleetRow['fleet_resource_metal'], $lang['Metal'],
$FleetRow['fleet_resource_crystal'], $lang['Crystal'],
$FleetRow['fleet_resource_deuterium'], $lang['Deuterium'] );
SendSimpleMessage ( $StartOwner, '', $FleetRow['fleet_start_time'], 5, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message);
if ($TargetOwner <> $StartOwner) {
$Message = sprintf( $lang['sys_tran_mess_user'],
$StartName, GetStartAdressLink($FleetRow, ''),
$TargetName, GetTargetAdressLink($FleetRow, ''),
$FleetRow['fleet_resource_metal'], $lang['Metal'],
$FleetRow['fleet_resource_crystal'], $lang['Crystal'],
$FleetRow['fleet_resource_deuterium'], $lang['Deuterium'] );
SendSimpleMessage ( $TargetOwner, '', $FleetRow['fleet_start_time'], 5, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message);
}
$QryUpdateFleet = "UPDATE {{table}} SET ";
$QryUpdateFleet .= "`fleet_resource_metal` = '0' , ";
$QryUpdateFleet .= "`fleet_resource_crystal` = '0' , ";
$QryUpdateFleet .= "`fleet_resource_deuterium` = '0' , ";
$QryUpdateFleet .= "`fleet_mess` = '1' ";
$QryUpdateFleet .= "WHERE `fleet_id` = '". $FleetRow['fleet_id'] ."' ";
$QryUpdateFleet .= "LIMIT 1 ;";
doquery( $QryUpdateFleet, 'fleets');
}
} else {
if ($FleetRow['fleet_end_time'] < time()) {
$Message = sprintf ($lang['sys_tran_mess_back'], $StartName, GetStartAdressLink($FleetRow, ''));
SendSimpleMessage ( $StartOwner, '', $FleetRow['fleet_end_time'], 5, $lang['sys_mess_tower'], $lang['sys_mess_fleetback'], $Message);
RestoreFleetToPlanet ( $FleetRow, true );
doquery("DELETE FROM {{table}} WHERE fleet_id=" . $FleetRow["fleet_id"], 'fleets');
}
}
}
// -----------------------------------------------------------------------------------------------------------
// History version
?>

View file

@ -0,0 +1,50 @@
<?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 array $CurrentUser
* @param array $CurrentPlanet
* @param int $UpdateTime
*/
function PlanetResourceUpdate($CurrentUser, &$CurrentPlanet, $UpdateTime)
{
$planet = Legacies_Empire_Model_User::factory($CurrentPlanet['id']);
/*
* Update planet resources and constructions
*/
Legacies::dispatchEvent('planet.update', array(
'planet' => $planet,
'time' => $UpdateTime
));
$planet->save();
}

View file

@ -0,0 +1,69 @@
<?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 ) {
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

@ -0,0 +1,219 @@
<?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

@ -0,0 +1,77 @@
<?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 $UserID
*/
function ResetThisFuckingCheater ( $UserID ) {
$TheUser = doquery ("SELECT * FROM {{table}} WHERE `id` = '". $UserID ."';", 'users', true);
$UserPlanet = doquery ("SELECT `name` FROM {{table}} WHERE `id` = '". $TheUser['id_planet']."';", 'planets', true);
DeleteSelectedUser ( $UserID );
if ($UserPlanet['name'] != "") {
// Creation de l'utilisateur
$QryInsertUser = "INSERT INTO {{table}} SET ";
$QryInsertUser .= "`id` = '". $TheUser['id'] ."', ";
$QryInsertUser .= "`username` = '". $TheUser['username'] ."', ";
$QryInsertUser .= "`email` = '". $TheUser['email'] ."', ";
$QryInsertUser .= "`email_2` = '". $TheUser['email_2'] ."', ";
$QryInsertUser .= "`sex` = '". $TheUser['sex'] ."', ";
$QryInsertUser .= "`id_planet` = '0', ";
$QryInsertUser .= "`authlevel` = '". $TheUser['authlevel'] ."', ";
$QryInsertUser .= "`dpath` = '". $TheUser['dpath'] ."', ";
$QryInsertUser .= "`galaxy` = '". $TheUser['galaxy'] ."', ";
$QryInsertUser .= "`system` = '". $TheUser['system'] ."', ";
$QryInsertUser .= "`planet` = '". $TheUser['planet'] ."', ";
$QryInsertUser .= "`register_time` = '". $TheUser['register_time'] ."', ";
$QryInsertUser .= "`password` = '". $TheUser['password'] ."';";
doquery( $QryInsertUser, 'users');
// On cherche le numero d'enregistrement de l'utilisateur fraichement cr??
$NewUser = doquery("SELECT `id` FROM {{table}} WHERE `username` = '". $TheUser['username'] ."' LIMIT 1;", 'users', true);
CreateOnePlanetRecord ($TheUser['galaxy'], $TheUser['system'], $TheUser['planet'], $NewUser['id'], $UserPlanet['name'], true);
// Recherche de la reference de la nouvelle planete (qui est unique normalement !
$PlanetID = doquery("SELECT `id` FROM {{table}} WHERE `id_owner` = '". $NewUser['id'] ."' LIMIT 1;", 'planets', true);
// Mise a jour de l'enregistrement utilisateur avec les infos de sa planete mere
$QryUpdateUser = "UPDATE {{table}} SET ";
$QryUpdateUser .= "`id_planet` = '". $PlanetID['id'] ."', ";
$QryUpdateUser .= "`current_planet` = '". $PlanetID['id'] ."' ";
$QryUpdateUser .= "WHERE ";
$QryUpdateUser .= "`id` = '". $NewUser['id'] ."';";
doquery( $QryUpdateUser, 'users');
}
return;
}
?>

View file

@ -0,0 +1,73 @@
<?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 $FleetRow
* @param unknown_type $Start
*/
function RestoreFleetToPlanet ( $FleetRow, $Start = true ) {
global $resource;
$FleetRecord = explode(";", $FleetRow['fleet_array']);
$QryUpdFleet = "";
foreach ($FleetRecord as $Item => $Group) {
if ($Group != '') {
$Class = explode (",", $Group);
$QryUpdFleet .= "`". $resource[$Class[0]] ."` = `".$resource[$Class[0]]."` + '".$Class[1]."', \n";
}
}
$QryUpdatePlanet = "UPDATE {{table}} SET ";
if ($QryUpdFleet != "") {
$QryUpdatePlanet .= $QryUpdFleet;
}
$QryUpdatePlanet .= "`metal` = `metal` + '". $FleetRow['fleet_resource_metal'] ."', ";
$QryUpdatePlanet .= "`crystal` = `crystal` + '". $FleetRow['fleet_resource_crystal'] ."', ";
$QryUpdatePlanet .= "`deuterium` = `deuterium` + '". $FleetRow['fleet_resource_deuterium'] ."' ";
$QryUpdatePlanet .= "WHERE ";
if ($Start == true) {
$QryUpdatePlanet .= "`galaxy` = '". $FleetRow['fleet_start_galaxy'] ."' AND ";
$QryUpdatePlanet .= "`system` = '". $FleetRow['fleet_start_system'] ."' AND ";
$QryUpdatePlanet .= "`planet` = '". $FleetRow['fleet_start_planet'] ."' AND ";
$QryUpdatePlanet .= "`planet_type` = '". $FleetRow['fleet_start_type'] ."' ";
} else {
$QryUpdatePlanet .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
$QryUpdatePlanet .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
$QryUpdatePlanet .= "`planet` = '". $FleetRow['fleet_end_planet'] ."' AND ";
$QryUpdatePlanet .= "`planet_type` = '". $FleetRow['fleet_end_type'] ."' ";
}
$QryUpdatePlanet .= "LIMIT 1;";
doquery( $QryUpdatePlanet, 'planets');
}
?>

View file

@ -0,0 +1,64 @@
<?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 $seconds
*/
function RevisionTime ($seconds) {
$days = floor($seconds / 86400);
$hours = (floor(($seconds % 86400) / 3600));
$minutes = floor(($seconds % 3600) / 60);
$secs = $seconds % 60;
$month_len = array(0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
$year = 1970;
$done = 0;
$month_id = 1;
while ($days > $month_lenght) {
$month_lenght = ($month_id == 2 ? ($year % 4 == 0 ? 29 : $month_len[$month_id]) : $month_len[$month_id]);
$days -= $month_lenght;
if ($month_id > 12) {
$month_id = 1;
$year++;
} else
$month_id++;
}
$days++;
$days = ($days < 10 ? "0" . $days : $days);
$month = ($month_id < 10 ? "0" . $month_id : $month_id);
$hours = ($hours < 10 ? "0" . $hours : $hours);
$minutes = ($minutes < 10 ? "0" . $minutes : $minutes);
$secs = ($secs < 10 ? "0" . $secs : $secs);
$ret = ($seconds > 0 ? "$year-$month-$days<br>GMT $hours:$minutes:$secs" : "");
return $ret;
}
?>

View file

@ -0,0 +1,91 @@
<?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 $mail
*/
function sendnewpassword($mail){
$ExistMail = doquery("SELECT `email` FROM {{table}} WHERE `email` = '". $mail ."' LIMIT 1;", 'users', true);
if (empty($ExistMail['email'])) {
message('L\'adresse n\'existe pas !','Erreur');
}
else{
//Caractere qui seront contenus dans le nouveau mot de passe
$Caracters="aazertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN1234567890";
$Count=strlen($Caracters);
$NewPass="";
$Taille=6;
srand((double)microtime()*1000000);
for($i=0;$i<$Taille;$i++){
$CaracterBoucle=rand(0,$Count-1);
$NewPass=$NewPass.substr($Caracters,$CaracterBoucle,1);
}
//Et un nouveau mot de passe tout chaud ^^
//On va maintenant l'envoyer au destinataire
$Title = "XNova : Nouveau mot de passe";
$Body = "Voici votre nouveau mot de passe : ";
$Body .= $NewPass;
mail($mail,$Title,$Body);
//Email envoy<6F>, maintenant place au changement dans la BDD
$NewPassSql = md5($NewPass);
$QryPassChange = "UPDATE {{table}} SET ";
$QryPassChange .= "`password` ='". $NewPassSql ."' ";
$QryPassChange .= "WHERE `email`='". $mail ."' LIMIT 1;";
doquery( $QryPassChange, 'users');
}
}
?>

View file

@ -0,0 +1,74 @@
<?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 $Owner
* @param unknown_type $Sender
* @param unknown_type $Time
* @param unknown_type $Type
* @param unknown_type $From
* @param unknown_type $Subject
* @param unknown_type $Message
*/
function SendSimpleMessage ( $Owner, $Sender, $Time, $Type, $From, $Subject, $Message) {
global $messfields;
if ($Time == '') {
$Time = time();
}
$QryInsertMessage = "INSERT INTO {{table}} SET ";
$QryInsertMessage .= "`message_owner` = '". $Owner ."', ";
$QryInsertMessage .= "`message_sender` = '". $Sender ."', ";
$QryInsertMessage .= "`message_time` = '" . $Time . "', ";
$QryInsertMessage .= "`message_type` = '". $Type ."', ";
$QryInsertMessage .= "`message_from` = '". addslashes( $From ) ."', ";
$QryInsertMessage .= "`message_subject` = '". addslashes( $Subject ) ."', ";
$QryInsertMessage .= "`message_text` = '". addslashes( $Message ) ."';";
doquery( $QryInsertMessage, 'messages');
$QryUpdateUser = "UPDATE {{table}} SET ";
$QryUpdateUser .= "`".$messfields[$Type]."` = `".$messfields[$Type]."` + 1, ";
$QryUpdateUser .= "`".$messfields[100]."` = `".$messfields[100]."` + 1 ";
$QryUpdateUser .= "WHERE ";
$QryUpdateUser .= "`id` = '". $Owner ."';";
doquery( $QryUpdateUser, 'users');
}
// Revision history :
// 1.0 - Initial release (mise en fonction generique)
// 1.1 - Ajout gestion des messages par type pour le module de messages
// 1.2 - Correction bug (addslashes pour les zone texte pouvant contenir une apostrophe)
// 1.3 - Correction bug (integration de la variable $Time pour afficher l'heure exacte de l'evenement pour les flottes)
?>

View file

@ -0,0 +1,129 @@
<?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;
// 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

@ -0,0 +1,58 @@
<?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 )
{
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

@ -0,0 +1,109 @@
<?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

@ -0,0 +1,101 @@
<?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 $Galaxy
* @param unknown_type $System
* @param unknown_type $CurrentMIP
* @param unknown_type $CurrentRC
* @param unknown_type $CurrentSP
*/
function ShowGalaxyFooter ( $Galaxy, $System, $CurrentMIP, $CurrentRC, $CurrentSP) {
global $lang, $maxfleet_count, $fleetmax, $planetcount;
$Result = "";
if ($planetcount == 1) {
$PlanetCountMessage = $planetcount ." ". $lang['gf_cntmone'];
} elseif ($planetcount == 0) {
$PlanetCountMessage = $lang['gf_cntmnone'];
} else {
$PlanetCountMessage = $planetcount." " . $lang['gf_cntmsome'];
}
$LegendPopup = GalaxyLegendPopup ();
$Recyclers = pretty_number($CurrentRC);
$SpyProbes = pretty_number($CurrentSP);
$Result .= "\n";
$Result .= "<tr>";
$Result .= "<th width=\"30\">16</th>";
$Result .= "<th colspan=7>";
$Result .= "<a href=fleet.php?galaxy=".$Galaxy."&amp;system=".$System."&amp;planet=16;planettype=1&amp;target_mission=15>". $lang['gf_unknowsp'] ."</a>";
$Result .= "</th>";
$Result .= "</tr>";
$Result .= "\n";
$Result .= "<tr>";
$Result .= "<td class=c colspan=6>( ".$PlanetCountMessage." )</td>";
$Result .= "<td class=c colspan=2>". $LegendPopup ."</td>";
$Result .= "</tr>";
$Result .= "\n";
$Result .= "<tr>";
$Result .= "<td class=c colspan=3><span id=\"missiles\">". $CurrentMIP ."</span> ". $lang['gf_mi_title'] ."</td>";
$Result .= "<td class=c colspan=3><span id=\"slots\">". $maxfleet_count ."</span>/". $fleetmax ." ". $lang['gf_fleetslt'] ."</td>";
$Result .= "<td class=c colspan=2>";
$Result .= "<span id=\"recyclers\">". $Recyclers ."</span> ". $lang['gf_rc_title'] ."<br>";
$Result .= "<span id=\"probes\">". $SpyProbes ."</span> ". $lang['gf_sp_title'] ."</td>";
$Result .= "</tr>";
$Result .= "\n";
$Result .= "<tr style=\"display: none;\" id=\"fleetstatusrow\">";
$Result .= "<th class=c colspan=8><!--<div id=\"fleetstatus\"></div>-->";
$Result .= "<table style=\"font-weight: bold\" width=\"100%\" id=\"fleetstatustable\">";
$Result .= "<!-- will be filled with content later on while processing ajax replys -->";
// $Result .= "<tr style=\"display: none; align:left\" id=\"fleetstatusrow\">";
// $Result .= "<th colspan=8><div style=\"align:left\" id=\"fleetstatus\"></div></th>";
// $Result .= "</tr>";
$Result .= "</table>";
$Result .= "</th>";
$Result .= "\n";
$Result .= "</tr>";
/*
<tr style=\"display: none;\" id=\"fleetstatusrow\"><th colspan="8"><!--<div id="fleetstatus"></div>-->
<table style="font-weight: bold;" width=100% id="fleetstatustable">
<!-- will be filled with content later on while processing ajax replys -->
</table>
</th>
</tr>
*/
return $Result;
}
?>

View file

@ -0,0 +1,76 @@
<?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 $Galaxy
* @param unknown_type $System
* @param unknown_type $Planet
* @param unknown_type $Current
* @param unknown_type $MICount
*/
function ShowGalaxyMISelector ( $Galaxy, $System, $Planet, $Current, $MICount ) {
global $lang;
$Result = "<form action=\"raketenangriff.php?c=".$Current."&mode=2&galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."\" method=\"POST\">";
$Result .= "<tr>";
$Result .= "<table border=\"0\">";
$Result .= "<tr>";
$Result .= "<td class=\"c\" colspan=\"2\">";
$Result .= $lang['gm_launch'] ." [".$Galaxy.":".$System.":".$Planet."]";
$Result .= "</td>";
$Result .= "</tr>";
$Result .= "<tr>";
$String = sprintf($lang['gm_restmi'], $MICount);
$Result .= "<td class=\"c\">".$String." <input type=\"text\" name=\"SendMI\" size=\"2\" maxlength=\"7\" /></td>";
$Result .= "<td class=\"c\">".$lang['gm_target']." <select name=\"Target\">";
$Result .= "<option value=\"all\" selected>".$lang['gm_all']."</option>";
$Result .= "<option value=\"0\">".$lang['tech'][401]."</option>";
$Result .= "<option value=\"1\">".$lang['tech'][402]."</option>";
$Result .= "<option value=\"2\">".$lang['tech'][403]."</option>";
$Result .= "<option value=\"3\">".$lang['tech'][404]."</option>";
$Result .= "<option value=\"4\">".$lang['tech'][405]."</option>";
$Result .= "<option value=\"5\">".$lang['tech'][406]."</option>";
$Result .= "<option value=\"6\">".$lang['tech'][407]."</option>";
$Result .= "<option value=\"7\">".$lang['tech'][408]."</option>";
$Result .= "</select>";
$Result .= "</td>";
$Result .= "</tr>";
$Result .= "<tr>";
$Result .= "<td class=\"c\" colspan=\"2\"><input type=\"submit\" name=\"aktion\" value=\"".$lang['gm_send']."\"></td>";
$Result .= "</tr>";
$Result .= "</table>";
$Result .= "</form>";
return $Result;
}
?>

View file

@ -0,0 +1,102 @@
<?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 $Galaxy
* @param unknown_type $System
*/
function ShowGalaxyRows ($Galaxy, $System) {
global $lang, $planetcount, $CurrentRC, $dpath, $user;
$Result = "";
for ($Planet = 1; $Planet < 16; $Planet++) {
unset($GalaxyRowPlanet);
unset($GalaxyRowMoon);
unset($GalaxyRowPlayer);
unset($GalaxyRowAlly);
$GalaxyRow = doquery("SELECT * FROM {{table}} WHERE `galaxy` = '".$Galaxy."' AND `system` = '".$System."' AND `planet` = '".$Planet."';", 'galaxy', true);
$Result .= "\n";
$Result .= "<tr>"; // Depart de ligne
if ($GalaxyRow) {
// Il existe des choses sur cette ligne de planete
if ($GalaxyRow["id_planet"] != 0) {
$GalaxyRowPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '". $GalaxyRow["id_planet"] ."';", 'planets', true);
if ($GalaxyRowPlanet['destruyed'] != 0 AND
$GalaxyRowPlanet['id_owner'] != '' AND
$GalaxyRow["id_planet"] != '') {
CheckAbandonPlanetState ($GalaxyRowPlanet);
} else {
$planetcount++;
$GalaxyRowPlayer = doquery("SELECT * FROM {{table}} WHERE `id` = '". $GalaxyRowPlanet["id_owner"] ."';", 'users', true);
}
if ($GalaxyRow["id_luna"] != 0) {
$GalaxyRowMoon = doquery("SELECT * FROM {{table}} WHERE `id` = '". $GalaxyRow["id_luna"] ."';", 'lunas', true);
if ($GalaxyRowMoon["destruyed"] != 0) {
CheckAbandonMoonState ($GalaxyRowMoon);
}
}
$GalaxyRowPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '". $GalaxyRow["id_planet"] ."';", 'planets', true);
if ($GalaxyRowPlanet['id_owner'] <> 0) {
$GalaxyRowUser = doquery("SELECT * FROM {{table}} WHERE `id` = '". $GalaxyRowPlanet['id_owner'] ."';", 'users', true);
} else {
$GalaxyRowUser = array();
}
}
}
$Result .= "\n";
$Result .= GalaxyRowPos ( $Planet, $GalaxyRow );
$Result .= "\n";
$Result .= GalaxyRowPlanet ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowPlayer, $Galaxy, $System, $Planet, 1 );
$Result .= "\n";
$Result .= GalaxyRowPlanetName ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowPlayer, $Galaxy, $System, $Planet, 1 );
$Result .= "\n";
$Result .= GalaxyRowMoon ( $GalaxyRow, $GalaxyRowMoon , $GalaxyRowPlayer, $Galaxy, $System, $Planet, 3 );
$Result .= "\n";
$Result .= GalaxyRowDebris ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowPlayer, $Galaxy, $System, $Planet, 2 );
$Result .= "\n";
$Result .= GalaxyRowUser ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowPlayer, $Galaxy, $System, $Planet, 0 );
$Result .= "\n";
$Result .= GalaxyRowAlly ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowPlayer, $Galaxy, $System, $Planet, 0 );
$Result .= "\n";
$Result .= GalaxyRowActions ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowPlayer, $Galaxy, $System, $Planet, 0 );
$Result .= "\n";
$Result .= "</tr>";
}
return $Result;
}
?>

View file

@ -0,0 +1,85 @@
<?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 $Galaxy
* @param unknown_type $System
*/
function ShowGalaxySelector ( $Galaxy, $System ) {
global $lang;
if ($Galaxy > MAX_GALAXY_IN_WORLD) {
$Galaxy = MAX_GALAXY_IN_WORLD;
}
if ($Galaxy < 1) {
$Galaxy = 1;
}
if ($System > MAX_SYSTEM_IN_GALAXY) {
$System = MAX_SYSTEM_IN_GALAXY;
}
if ($System < 1) {
$System = 1;
}
$Result = "<form action=\"galaxy.php?mode=1\" method=\"post\" id=\"galaxy_form\">";
$Result .= "<input type=\"hidden\" id=\"auto\" value=\"dr\" >";
$Result .= "<table border=\"0\">";
$Result .= "<tbody><tr><td>";
$Result .= "<table><tbody><tr>";
$Result .= "<td class=\"c\" colspan=\"3\">". $lang['Galaxy'] ."</td></tr><tr>";
$Result .= "<td class=\"l\"><input name=\"galaxyLeft\" value=\"&lt;-\" onclick=\"galaxy_submit('galaxyLeft')\" type=\"button\"></td>";
$Result .= "<td class=\"l\"><input name=\"galaxy\" value=\"". $Galaxy ."\" size=\"5\" maxlength=\"3\" tabindex=\"1\" type=\"text\"></td>";
$Result .= "<td class=\"l\"><input name=\"galaxyRight\" value=\"-&gt;\" onclick=\"galaxy_submit('galaxyRight')\" type=\"button\"></td>";
$Result .= "</tr></tbody></table>";
$Result .= "</td><td>";
$Result .= "<table><tbody><tr>";
$Result .= "<td class=\"c\" colspan=\"3\">". $lang['Solar_system'] ."</td></tr><tr>";
$Result .= "<td class=\"l\"><input name=\"systemLeft\" value=\"&lt;-\" onclick=\"galaxy_submit('systemLeft')\" type=\"button\"></td>";
$Result .= "<td class=\"l\"><input name=\"system\" value=\"". $System ."\" size=\"5\" maxlength=\"3\" tabindex=\"2\" type=\"text\"></td>";
$Result .= "<td class=\"l\"><input name=\"systemRight\" value=\"-&gt;\" onclick=\"galaxy_submit('systemRight')\" type=\"button\"></td>";
$Result .= "</tr></tbody></table>";
$Result .= "</td>";
$Result .= "</tr><tr>";
$Result .= "<td class=\"l\" colspan=\"2\" align=\"center\"> <input value=\"". $lang['Afficher'] ."\" type=\"submit\"></td>";
$Result .= "</tr>";
$Result .= "</tbody></table>";
$Result .= "</form>";
return $Result;
}
?>

View file

@ -0,0 +1,57 @@
<?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 $Galaxy
* @param unknown_type $System
*/
function ShowGalaxyTitles ( $Galaxy, $System ) {
global $lang;
$Result = "\n";
$Result .= "<tr>";
$Result .= "<td class=c colspan=8>".$lang['Solar_system']." ".$Galaxy.":".$System."</td>";
$Result .= "</tr><tr>";
$Result .= "<td class=c>".$lang['Pos']."</td>";
$Result .= "<td class=c>".$lang['Planet']."</td>";
$Result .= "<td class=c>".$lang['Name']."</td>";
$Result .= "<td class=c>".$lang['Moon']."</td>";
$Result .= "<td class=c>".$lang['Debris']."</td>";
$Result .= "<td class=c>".$lang['Player']."</td>";
$Result .= "<td class=c>".$lang['Alliance']."</td>";
$Result .= "<td class=c>".$lang['Actions']."</td>";
$Result .= "</tr>";
return $Result;
}
?>

View file

@ -0,0 +1,124 @@
<?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 = mysql_fetch_array($ThisUsersPlanets)) {
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;
}
?>

View file

@ -0,0 +1,52 @@
<?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 SortUserPlanets ( $CurrentUser ) {
$Order = ( $CurrentUser['planet_sort_order'] == 1 ) ? "DESC" : "ASC" ;
$Sort = $CurrentUser['planet_sort'];
$QryPlanets = "SELECT `id`, `name`, `galaxy`, `system`, `planet`, `planet_type` FROM {{table}} WHERE `id_owner` = '". $CurrentUser['id'] ."' ORDER BY ";
if ( $Sort == 0 ) {
$QryPlanets .= "`id` ". $Order;
} elseif ( $Sort == 1 ) {
$QryPlanets .= "`galaxy`, `system`, `planet`, `planet_type` ". $Order;
} elseif ( $Sort == 2 ) {
$QryPlanets .= "`name` ". $Order;
}
$Planets = doquery ( $QryPlanets, 'planets');
return $Planets;
}
?>

View file

@ -0,0 +1,118 @@
<?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 $TargetPlanet
* @param unknown_type $Mode
* @param unknown_type $TitleString
*/
function SpyTarget ( $TargetPlanet, $Mode, $TitleString ) {
global $lang, $resource;
$LookAtLoop = true;
if ($Mode == 0) {
$String = "<table width=\"440\"><tr><td class=\"c\" colspan=\"5\">";
$String .= $TitleString ." ". $TargetPlanet['name'];
$String .= " <a href=\"galaxy.php?mode=3&galaxy=". $TargetPlanet["galaxy"] ."&system=". $TargetPlanet["system"]. "\">";
$String .= "[". $TargetPlanet["galaxy"] .":". $TargetPlanet["system"] .":". $TargetPlanet["planet"] ."]</a>";
$String .= " le ". gmdate("d-m-Y H:i:s", time() + 2 * 60 * 60) ."</td>";
$String .= "</tr><tr>";
$String .= "<td width=220>". $lang['Metal'] ."</td><td width=220 align=right>". pretty_number($TargetPlanet['metal']) ."</td><td>&nbsp;</td>";
$String .= "<td width=220>". $lang['Crystal'] ."</td></td><td width=220 align=right>". pretty_number($TargetPlanet['crystal']) ."</td>";
$String .= "</tr><tr>";
$String .= "<td width=220>". $lang['Deuterium'] ."</td><td width=220 align=right>". pretty_number($TargetPlanet['deuterium']) ."</td><td>&nbsp;</td>";
$String .= "<td width=220>". $lang['Energy'] ."</td><td width=220 align=right>". pretty_number($TargetPlanet['energy_max']) ."</td>";
$String .= "</tr>";
$LookAtLoop = false;
} elseif ($Mode == 1) {
$ResFrom[0] = 200;
$ResTo[0] = 299;
$Loops = 1;
} elseif ($Mode == 2) {
$ResFrom[0] = 400;
$ResTo[0] = 499;
$ResFrom[1] = 500;
$ResTo[1] = 599;
$Loops = 2;
} elseif ($Mode == 3) {
$ResFrom[0] = 1;
$ResTo[0] = 99;
$Loops = 1;
} elseif ($Mode == 4) {
$ResFrom[0] = 100;
$ResTo[0] = 199;
$Loops = 1;
}
if ($LookAtLoop == true) {
$String = "<table width=\"440\" cellspacing=\"1\"><tr><td class=\"c\" colspan=\"". ((2 * SPY_REPORT_ROW) + (SPY_REPORT_ROW - 1))."\">". $TitleString ."</td></tr>";
$Count = 0;
$CurrentLook = 0;
while ($CurrentLook < $Loops) {
$row = 0;
for ($Item = $ResFrom[$CurrentLook]; $Item <= $ResTo[$CurrentLook]; $Item++) {
if ( $TargetPlanet[$resource[$Item]] > 0) {
if ($row == 0) {
$String .= "<tr>";
}
$String .= "<td align=left>".$lang['tech'][$Item]."</td><td align=right>".$TargetPlanet[$resource[$Item]]."</td>";
if ($row < SPY_REPORT_ROW - 1) {
$String .= "<td>&nbsp;</td>";
}
$Count += $TargetPlanet[$resource[$Item]];
$row++;
if ($row == SPY_REPORT_ROW) {
$String .= "</tr>";
$row = 0;
}
}
}
while ($row != 0) {
$String .= "<td>&nbsp;</td><td>&nbsp;</td>";
$row++;
if ($row == SPY_REPORT_ROW) {
$String .= "</tr>";
$row = 0;
}
}
$CurrentLook++;
} // while
}
$String .= "</table>";
$return['String'] = $String;
$return['Count'] = $Count;
return $return;
}
?>

View file

@ -0,0 +1,62 @@
<?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 $FleetRow
* @param unknown_type $Start
*/
function StoreGoodsToPlanet ( $FleetRow, $Start = false ) {
global $resource;
$QryUpdatePlanet = "UPDATE {{table}} SET ";
$QryUpdatePlanet .= "`metal` = `metal` + '". $FleetRow['fleet_resource_metal'] ."', ";
$QryUpdatePlanet .= "`crystal` = `crystal` + '". $FleetRow['fleet_resource_crystal'] ."', ";
$QryUpdatePlanet .= "`deuterium` = `deuterium` + '". $FleetRow['fleet_resource_deuterium'] ."' ";
$QryUpdatePlanet .= "WHERE ";
if ($Start == true) {
$QryUpdatePlanet .= "`galaxy` = '". $FleetRow['fleet_start_galaxy'] ."' AND ";
$QryUpdatePlanet .= "`system` = '". $FleetRow['fleet_start_system'] ."' AND ";
$QryUpdatePlanet .= "`planet` = '". $FleetRow['fleet_start_planet'] ."' AND ";
$QryUpdatePlanet .= "`planet_type` = '". $FleetRow['fleet_start_type'] ."' ";
} else {
$QryUpdatePlanet .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
$QryUpdatePlanet .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
$QryUpdatePlanet .= "`planet` = '". $FleetRow['fleet_end_planet'] ."' AND ";
$QryUpdatePlanet .= "`planet_type` = '". $FleetRow['fleet_end_type'] ."' ";
}
$QryUpdatePlanet .= "LIMIT 1;";
doquery( $QryUpdatePlanet, 'planets');
}
?>

View file

@ -0,0 +1,61 @@
<?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 UpdatePlanetBatimentQueueList ( &$CurrentPlanet, &$CurrentUser ) {
$RetValue = false;
if ( $CurrentPlanet['b_building_id'] != 0 ) {
while ( $CurrentPlanet['b_building_id'] != 0 ) {
if ( $CurrentPlanet['b_building'] <= time() ) {
PlanetResourceUpdate ( $CurrentUser, $CurrentPlanet, $CurrentPlanet['b_building'], false );
$IsDone = CheckPlanetBuildingQueue( $CurrentPlanet, $CurrentUser );
if ( $IsDone == true ) {
SetNextQueueElementOnTop ( $CurrentPlanet, $CurrentUser );
}
} else {
$RetValue = true;
break;
}
}
}
return $RetValue;
}
// Revision History
// - 1.0 Mise en module initiale
// - 1.1 Mise a jour des ressources sur la planete verifi<66>e (pour prendre en compte les ressources produites
// pendant la construction et avant l'evolution evantuel d'une mine ou d'en batiment
?>