Updated data access layer
Renamed classes, methods & variables from "User" to "Player" Fixed dependencies requirements in the research lab queue Updated overview Added MVC's controller Added build files Updated directory structure Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
This commit is contained in:
parent
d40313279a
commit
690a7f60f3
1435 changed files with 5772 additions and 5764 deletions
133
src/includes/functions/BBcodeFunction.php
Normal file
133
src/includes/functions/BBcodeFunction.php
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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',
|
||||
'#\[youtube\]([^\]]+)\[/youtube\]#',
|
||||
'#\[dailymotion\]([^\]]+)\[/dailymotion\]#'
|
||||
);
|
||||
|
||||
$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\')',
|
||||
'<iframe src="http://www.youtube.com/embed/\\1" width="640" height="385"></iframe>',
|
||||
'<iframe frameborder="0" width="560" height="420" src="http://www.dailymotion.com/embed/video/\\1?width=560"></iframe>'
|
||||
);
|
||||
|
||||
return preg_replace($pattern, $replace, nl2br(htmlspecialchars(stripslashes($string))));
|
||||
}
|
||||
|
||||
|
||||
|
||||
function image($string)
|
||||
{
|
||||
//On va pas se casser le fion a lire les accents quand meme !!!!!!!
|
||||
$string = str_replace("'", "'", $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>';
|
||||
}
|
||||
?>
|
||||
167
src/includes/functions/BuildFleetEventTable.php
Normal file
167
src/includes/functions/BuildFleetEventTable.php
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
|
||||
?>
|
||||
70
src/includes/functions/BuildFlyingFleetTable.php
Normal file
70
src/includes/functions/BuildFlyingFleetTable.php
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
function BuildFlyingFleetTable () {
|
||||
global $lang;
|
||||
|
||||
$TableTPL = gettemplate('admin/fleet_rows');
|
||||
$FlyingFleets = doquery ("SELECT * FROM {{table}} ORDER BY `fleet_end_time` ASC;", 'fleets');
|
||||
while ( $CurrentFleet = $FlyingFleets->fetch(PDO::FETCH_ASSOC) ) {
|
||||
$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;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
39
src/includes/functions/CheckInputStrings.php
Normal file
39
src/includes/functions/CheckInputStrings.php
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $String
|
||||
*/
|
||||
function CheckInputStrings($string)
|
||||
{
|
||||
return htmlspecialchars($string, ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
74
src/includes/functions/DeleteSelectedUser.php
Normal file
74
src/includes/functions/DeleteSelectedUser.php
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $UserID
|
||||
*/
|
||||
function DeleteSelectedUser ( $UserID ) {
|
||||
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
$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 = $ThePlanets->fetch(PDO::FETCH_ASSOC) ) {
|
||||
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' );
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
71
src/includes/functions/ElementBuildListBox.php
Normal file
71
src/includes/functions/ElementBuildListBox.php
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $CurrentUser
|
||||
* @param unknown_type $CurrentPlanet
|
||||
*/
|
||||
function ElementBuildListBox ( $CurrentUser, $CurrentPlanet ) {
|
||||
global $lang, $pricelist;
|
||||
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
// // 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;
|
||||
}
|
||||
|
||||
?>
|
||||
108
src/includes/functions/FlyingFleetHandler.php
Normal file
108
src/includes/functions/FlyingFleetHandler.php
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $planet
|
||||
*/
|
||||
function FlyingFleetHandler($planet) {
|
||||
global $resource;
|
||||
|
||||
$sql =<<<SQL_EOF
|
||||
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
|
||||
SQL_EOF;
|
||||
//doquery($sql, ''); // FIXME: use transactions
|
||||
|
||||
foreach ($planet->getFleetCollection(Wootook::now()) as $CurrentFleet) {
|
||||
switch ($CurrentFleet["fleet_mission"]) {
|
||||
case Legacies_Empire::ID_MISSION_ATTACK:
|
||||
// Attaquer
|
||||
MissionCaseAttack ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case Legacies_Empire::ID_MISSION_TRANSPORT:
|
||||
// Transporter
|
||||
MissionCaseTransport ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case Legacies_Empire::ID_MISSION_STATION:
|
||||
// Stationner
|
||||
MissionCaseStay ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case Legacies_Empire::ID_MISSION_STATION_ALLY:
|
||||
// Stationner chez un Allié
|
||||
MissionCaseStayAlly ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case Legacies_Empire::ID_MISSION_SPY:
|
||||
// Flotte d'espionnage
|
||||
MissionCaseSpy ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case Legacies_Empire::ID_MISSION_SETTLE_COLONY:
|
||||
// Coloniser
|
||||
MissionCaseColonisation ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case Legacies_Empire::ID_MISSION_RECYCLE:
|
||||
// Recyclage
|
||||
MissionCaseRecycling ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case Legacies_Empire::ID_MISSION_DESTROY:
|
||||
// Detruire ??? dans le code ogame c'est 9 !!
|
||||
MissionCaseDestruction ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case Legacies_Empire::ID_MISSION_EXPEDITION:
|
||||
// Expeditions
|
||||
MissionCaseExpedition ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case Legacies_Empire::ID_MISSION_GROUP_ATTACK: // TODO: implement mission type
|
||||
case Legacies_Empire::ID_MISSION_MISSILES: // TODO: implement mission type
|
||||
default:
|
||||
$CurrentFleet->delete();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//doquery("UNLOCK TABLES", ""); // FIXME: use transactions
|
||||
}
|
||||
57
src/includes/functions/GalaxyCheckFunctions.php
Normal file
57
src/includes/functions/GalaxyCheckFunctions.php
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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) {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
if ($planet['destruyed'] <= time()) {
|
||||
$id = $planet['id'];
|
||||
doquery("DELETE FROM {{table}} WHERE id={$id}", 'planets');
|
||||
doquery("DELETE FROM {{table}} WHERE id_planet={$id}", 'galaxy');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
73
src/includes/functions/GalaxyLegendPopup.php
Normal file
73
src/includes/functions/GalaxyLegendPopup.php
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
function GalaxyLegendPopup () {
|
||||
global $lang;
|
||||
|
||||
$Result = '<a href="#" onclick="return false;" 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=red><blink>A</blink></font></td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td width=220>Operator</td><td><font color=lime><blink>O</blink></font></td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td width=220>Moderator</td><td><font color=skyblue><blink>M</blink></font></td>";
|
||||
$Result .= "</tr>";
|
||||
$Result .= "</table>";
|
||||
$Result .= "\");' onmouseout='return nd();'>";
|
||||
$Result .= $lang['Legend']."</a>";
|
||||
|
||||
|
||||
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
?>
|
||||
113
src/includes/functions/GalaxyRowActions.php
Normal file
113
src/includes/functions/GalaxyRowActions.php
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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;
|
||||
|
||||
if (empty($GalaxyRowPlanet)) {
|
||||
return '<th width="125"></th>';
|
||||
}
|
||||
|
||||
// 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="' . Wootook::getSkinUrl('base', 'default', 'graphics/img/e.gif') . '" alt="'.$lang['gl_espionner'].'" title="'.$lang['gl_espionner'].'" border="0"></a>';
|
||||
$Result .= " ";
|
||||
}
|
||||
if ($user["settings_wri"] == "1" &&
|
||||
$GalaxyRowPlayer['id']) {
|
||||
$Result .= "<a href=messages.php?mode=write&id=".$GalaxyRowPlayer["id"].">";
|
||||
$Result .= '<img src="' . Wootook::getSkinUrl('base', 'default', 'graphics/img/m.gif') . '" alt="'.$lang['gl_sendmess'].'" title="'.$lang['gl_sendmess'].'" border="0"></a>';
|
||||
$Result .= " ";
|
||||
}
|
||||
if ($user["settings_bud"] == "1" &&
|
||||
$GalaxyRowPlayer['id']) {
|
||||
$Result .= "<a href=buddy.php?a=2&u=".$GalaxyRowPlayer['id']." >";
|
||||
$Result .= '<img src="' . Wootook::getSkinUrl('base', 'default', 'graphics/img/b.gif') . '" alt="'.$lang['gl_buddyreq'].'" title="'.$lang['gl_buddyreq'].'" border="0"></a>';
|
||||
$Result .= " ";
|
||||
}
|
||||
if ($user["settings_mis"] == "1" AND
|
||||
$MissileBtn == true &&
|
||||
$GalaxyRowPlayer['id']) {
|
||||
$Result .= "<a href=galaxy.php?mode=2&galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."¤t=".$user['current_planet']." >";
|
||||
$Result .= '<img src="' . Wootook::getSkinUrl('base', 'default', 'graphics/img/r.gif') . '" alt="'.$lang['gl_mipattack'].'" title="'.$lang['gl_mipattack'].'" border="0"></a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
$Result .= "</th>";
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
?>
|
||||
96
src/includes/functions/GalaxyRowAlly.php
Normal file
96
src/includes/functions/GalaxyRowAlly.php
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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;
|
||||
|
||||
if (empty($GalaxyRowPlanet)) {
|
||||
return '<th width="80"></th>';
|
||||
}
|
||||
|
||||
// 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>".htmlspecialchars($lang['Alliance'], ENT_QUOTES, 'UTF-8')." ". htmlspecialchars($allyquery['ally_name'], ENT_QUOTES, 'UTF-8') ." ".$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=". intval($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=". htmlspecialchars($allyquery["ally_web"], ENT_QUOTES, 'UTF-8') ." 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'] == $GalaxyRowUser['ally_id']) {
|
||||
$Result .= "<span class=\"allymember\">". htmlspecialchars($allyquery['ally_tag'], ENT_QUOTES, 'UTF-8') ."</span></a>";
|
||||
} else {
|
||||
$Result .= $allyquery['ally_tag'] ."</a>";
|
||||
}
|
||||
}
|
||||
}
|
||||
$Result .= "</th>";
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
?>
|
||||
105
src/includes/functions/GalaxyRowDebris.php
Normal file
105
src/includes/functions/GalaxyRowDebris.php
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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='javascript:doit (8, ".$Galaxy.", ".$System.", ".$Planet.", ".$PlanetType.", ".$RecSended.");' >". $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;
|
||||
}
|
||||
|
||||
?>
|
||||
132
src/includes/functions/GalaxyRowMoon.php
Normal file
132
src/includes/functions/GalaxyRowMoon.php
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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;
|
||||
|
||||
if (empty($GalaxyRowPlanet)) {
|
||||
return '<th width="30"></th>';
|
||||
}
|
||||
|
||||
// Lune
|
||||
$Result = "<th style=\"white-space: nowrap;\" width=30>";
|
||||
if ($GalaxyRowUser['id'] != $user['id']) {
|
||||
$MissionType6Link = "<a href=# onclick='javascript:doit(6, ".$Galaxy.", ".$System.", ".$Planet.", ".$PlanetType.", ".$user["spio_anz"].");' >". $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."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."&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 && (!isset($GalaxyRowPlanet["destruyed"]) || $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;
|
||||
}
|
||||
|
||||
?>
|
||||
136
src/includes/functions/GalaxyRowPlanet.php
Normal file
136
src/includes/functions/GalaxyRowPlanet.php
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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;
|
||||
|
||||
if (empty($GalaxyRowPlanet)) {
|
||||
return '<th width="30"></th>';
|
||||
}
|
||||
// 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('phalanx.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."') >".$lang['gl_phalanx']."</a><br />";
|
||||
} else {
|
||||
$PhalanxTypeLink = "";
|
||||
}
|
||||
} else {
|
||||
$PhalanxTypeLink = "";
|
||||
}
|
||||
} else {
|
||||
$PhalanxTypeLink = "";
|
||||
}
|
||||
} else {
|
||||
$PhalanxTypeLink = "";
|
||||
}
|
||||
} else {
|
||||
$PhalanxTypeLink = "";
|
||||
}
|
||||
|
||||
if ($GalaxyRowUser['id'] != $user['id']) {
|
||||
$MissionType6Link = "<a href=# onclick='javascript:doit(6, ".$Galaxy.", ".$System.", ".$Planet.", ".$PlanetType.", ".$user["spio_anz"].");' >". $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."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."&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;
|
||||
}
|
||||
|
||||
?>
|
||||
106
src/includes/functions/GalaxyRowPlanetName.php
Normal file
106
src/includes/functions/GalaxyRowPlanetName.php
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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;
|
||||
|
||||
if (empty($GalaxyRowPlanet)) {
|
||||
return '<th width="130"></th>';
|
||||
}
|
||||
|
||||
// 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."&system=".$System."&planet=".$Planet."&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;
|
||||
}
|
||||
|
||||
?>
|
||||
50
src/includes/functions/GalaxyRowPos.php
Normal file
50
src/includes/functions/GalaxyRowPos.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
?>
|
||||
141
src/includes/functions/GalaxyRowUser.php
Normal file
141
src/includes/functions/GalaxyRowUser.php
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
?>
|
||||
80
src/includes/functions/GetMaxConstructibleElements.php
Normal file
80
src/includes/functions/GetMaxConstructibleElements.php
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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
|
||||
?>
|
||||
47
src/includes/functions/GetMissileRange.php
Normal file
47
src/includes/functions/GetMissileRange.php
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
?>
|
||||
50
src/includes/functions/GetPhalanxRange.php
Normal file
50
src/includes/functions/GetPhalanxRange.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
?>
|
||||
75
src/includes/functions/GetRestPrice.php
Normal file
75
src/includes/functions/GetRestPrice.php
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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;
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
?>
|
||||
138
src/includes/functions/InsertGalaxyScripts.php
Normal file
138
src/includes/functions/InsertGalaxyScripts.php
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
?>
|
||||
83
src/includes/functions/InsertJavaScriptChronoApplet.php
Normal file
83
src/includes/functions/InsertJavaScriptChronoApplet.php
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
?>
|
||||
58
src/includes/functions/IsOfficierAccessible.php
Normal file
58
src/includes/functions/IsOfficierAccessible.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
58
src/includes/functions/IsTechnologieAccessible.php
Normal file
58
src/includes/functions/IsTechnologieAccessible.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $user
|
||||
* @param unknown_type $planet
|
||||
* @param unknown_type $element
|
||||
*/
|
||||
function IsTechnologieAccessible($user, $planet, $element)
|
||||
{
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
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;
|
||||
}
|
||||
}
|
||||
63
src/includes/functions/MessageForm.php
Normal file
63
src/includes/functions/MessageForm.php
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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
|
||||
?>
|
||||
104
src/includes/functions/MipCombatEngine.php
Normal file
104
src/includes/functions/MipCombatEngine.php
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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égère',
|
||||
403 => 'Artillerie laser lourde',
|
||||
404 => 'Canon de Gauss',
|
||||
405 => 'Artillerie à 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');
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
458
src/includes/functions/MissionCaseAttack.php
Normal file
458
src/includes/functions/MissionCaseAttack.php
Normal file
|
|
@ -0,0 +1,458 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param unknown_type $FleetRow
|
||||
*/
|
||||
function MissionCaseAttack($FleetRow)
|
||||
{
|
||||
global $lang;
|
||||
|
||||
$pricelist = Wootook_Empire_Model_Game_Prices::getSingleton();
|
||||
$resource = Wootook_Empire_Model_Game_FieldsAlias::getSingleton();
|
||||
$CombatCaps = Wootook_Empire_Model_Game_Combat::getSingleton();
|
||||
|
||||
if ($FleetRow['fleet_mess'] == 0 && $FleetRow['fleet_start_time'] <= time()) {
|
||||
|
||||
// refactored parts
|
||||
// {{{
|
||||
$targetPlanet = Wootook_Empire_Model_Planet::factoryFromCoords(array(
|
||||
'galaxy' => $FleetRow['fleet_end_galaxy'],
|
||||
'system' => $FleetRow['fleet_end_system'],
|
||||
'planet' => $FleetRow['fleet_end_planet'],
|
||||
'type' => $FleetRow['fleet_end_type']
|
||||
));
|
||||
|
||||
/*
|
||||
* Update planet resources and constructions
|
||||
*/
|
||||
Wootook::dispatchEvent('planet.update', array(
|
||||
'planet' => $targetPlanet
|
||||
));
|
||||
$targetPlanet->save();
|
||||
|
||||
$TargetUser = $targetPlanet->getUser();
|
||||
$CurrentUser = Wootook_Player_Model_Entity::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) {
|
||||
$user = Wootook_Player_Model_Entity::factory($TargetUserID);
|
||||
$user->createNewPlanet(
|
||||
intval($FleetRow['fleet_end_galaxy']),
|
||||
intval($FleetRow['fleet_end_system']),
|
||||
intval($FleetRow['fleet_end_planet']),
|
||||
Wootook_Empire_Model_Planet::TYPE_MOON,
|
||||
Wootook::__('Moon')
|
||||
);
|
||||
$GottenMoon = Wootook::_('A moon has been created!');
|
||||
} 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');
|
||||
}
|
||||
}
|
||||
}
|
||||
115
src/includes/functions/MissionCaseColonisation.php
Normal file
115
src/includes/functions/MissionCaseColonisation.php
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $FleetRow
|
||||
*/
|
||||
function MissionCaseColonisation ( $FleetRow ) {
|
||||
global $lang, $resource;
|
||||
|
||||
$statement = doquery ("SELECT count(*) FROM {{table}} WHERE `id_owner` = '". $FleetRow['fleet_owner'] ."' AND `planet_type` = '1'", 'planets');
|
||||
$iPlanetCount = $statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($FleetRow['fleet_mess'] == 0) {
|
||||
// Déjà, sommes nous a l'aller ??
|
||||
$statement2 = doquery ("SELECT count(*) FROM {{table}} WHERE `galaxy` = '". $FleetRow['fleet_end_galaxy']."' AND `system` = '". $FleetRow['fleet_end_system']."' AND `planet` = '". $FleetRow['fleet_end_planet']."';", 'galaxy');
|
||||
$iGalaxyPlace = $statement2->fetch(PDO::FETCH_ASSOC);
|
||||
$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 {
|
||||
$user = Wootook_Player_Model_Entity::factory($FleetRow['fleet_owner']);
|
||||
$user->createNewPlanet(
|
||||
intval($FleetRow['fleet_end_galaxy']),
|
||||
intval($FleetRow['fleet_end_system']),
|
||||
intval($FleetRow['fleet_end_planet']),
|
||||
Wootook_Empire_Model_Planet::TYPE_PLANET,
|
||||
Wootook::__('Colony')
|
||||
);
|
||||
|
||||
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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
521
src/includes/functions/MissionCaseDestruction.php
Normal file
521
src/includes/functions/MissionCaseDestruction.php
Normal file
|
|
@ -0,0 +1,521 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $FleetRow
|
||||
*/
|
||||
function MissionCaseDestruction($FleetRow)
|
||||
{
|
||||
global $user, $pricelist, $lang, $resource, $CombatCaps;
|
||||
|
||||
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(Wootook::getGameConfig('game/speed/general'))) * 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) {
|
||||
$user = Wootook_Player_Model_Entity::factory($TargetUserID);
|
||||
$user->createNewPlanet(
|
||||
intval($FleetRow['fleet_end_galaxy']),
|
||||
intval($FleetRow['fleet_end_system']),
|
||||
intval($FleetRow['fleet_end_planet']),
|
||||
Wootook_Empire_Model_Planet::TYPE_MOON,
|
||||
Wootook::__('Moon')
|
||||
);
|
||||
$GottenMoon = Wootook::_('A moon has been created!');
|
||||
} 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' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
239
src/includes/functions/MissionCaseExpedition.php
Normal file
239
src/includes/functions/MissionCaseExpedition.php
Normal file
|
|
@ -0,0 +1,239 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
141
src/includes/functions/MissionCaseRecycling.php
Normal file
141
src/includes/functions/MissionCaseRecycling.php
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @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
|
||||
|
||||
?>
|
||||
204
src/includes/functions/MissionCaseSpy.php
Normal file
204
src/includes/functions/MissionCaseSpy.php
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $FleetRow
|
||||
*/
|
||||
function MissionCaseSpy($FleetRow)
|
||||
{
|
||||
global $lang;
|
||||
|
||||
$resource = Wootook_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
|
||||
*/
|
||||
Wootook::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');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
85
src/includes/functions/MissionCaseStay.php
Normal file
85
src/includes/functions/MissionCaseStay.php
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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
|
||||
?>
|
||||
93
src/includes/functions/MissionCaseStayAlly.php
Normal file
93
src/includes/functions/MissionCaseStayAlly.php
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
101
src/includes/functions/MissionCaseTransport.php
Normal file
101
src/includes/functions/MissionCaseTransport.php
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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
|
||||
|
||||
?>
|
||||
51
src/includes/functions/PlanetResourceUpdate.php
Normal file
51
src/includes/functions/PlanetResourceUpdate.php
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param array $CurrentUser
|
||||
* @param array $CurrentPlanet
|
||||
* @param int $UpdateTime
|
||||
*/
|
||||
function PlanetResourceUpdate($CurrentUser, &$CurrentPlanet, $UpdateTime)
|
||||
{
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
$planet = Legacies_Empire_Model_User::factory($CurrentPlanet['id']);
|
||||
|
||||
/*
|
||||
* Update planet resources and constructions
|
||||
*/
|
||||
Wootook::dispatchEvent('planet.update', array(
|
||||
'planet' => $planet,
|
||||
'time' => $UpdateTime
|
||||
));
|
||||
$planet->save();
|
||||
}
|
||||
74
src/includes/functions/RestoreFleetToPlanet.php
Normal file
74
src/includes/functions/RestoreFleetToPlanet.php
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $FleetRow
|
||||
* @param unknown_type $Start
|
||||
*/
|
||||
function RestoreFleetToPlanet ( $FleetRow, $Start = true ) {
|
||||
global $resource;
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
$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');
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
64
src/includes/functions/RevisionTime.php
Normal file
64
src/includes/functions/RevisionTime.php
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
?>
|
||||
92
src/includes/functions/SendNewPassword.php
Normal file
92
src/includes/functions/SendNewPassword.php
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $mail
|
||||
*/
|
||||
function sendnewpassword($mail){
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
$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 = "Wootook : 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');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
74
src/includes/functions/SendSimpleMessage.php
Normal file
74
src/includes/functions/SendSimpleMessage.php
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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)
|
||||
|
||||
?>
|
||||
101
src/includes/functions/ShowGalaxyFooter.php
Normal file
101
src/includes/functions/ShowGalaxyFooter.php
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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."&system=".$System."&planet=16;planettype=1&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;
|
||||
}
|
||||
|
||||
?>
|
||||
76
src/includes/functions/ShowGalaxyMISelector.php
Normal file
76
src/includes/functions/ShowGalaxyMISelector.php
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
?>
|
||||
103
src/includes/functions/ShowGalaxyRows.php
Normal file
103
src/includes/functions/ShowGalaxyRows.php
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $Galaxy
|
||||
* @param unknown_type $System
|
||||
*/
|
||||
function ShowGalaxyRows ($Galaxy, $System) {
|
||||
global $lang, $planetcount, $CurrentRC, $dpath, $user;
|
||||
|
||||
$Result = "";
|
||||
for ($Planet = 1; $Planet <= Wootook::getGameConfig('engine/universe/positions'); $Planet++) {
|
||||
|
||||
$GalaxyRowPlanet = array();
|
||||
$GalaxyRowMoon = array();
|
||||
$GalaxyRowPlayer = array();
|
||||
$GalaxyRowAlly = array();
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
?>
|
||||
85
src/includes/functions/ShowGalaxySelector.php
Normal file
85
src/includes/functions/ShowGalaxySelector.php
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $Galaxy
|
||||
* @param unknown_type $System
|
||||
*/
|
||||
function ShowGalaxySelector ( $Galaxy, $System ) {
|
||||
global $lang;
|
||||
|
||||
if ($Galaxy > Wootook::getGameConfig('engine/universe/galaxies')) {
|
||||
$Galaxy = Wootook::getGameConfig('engine/universe/galaxies');
|
||||
}
|
||||
if ($Galaxy < 1) {
|
||||
$Galaxy = 1;
|
||||
}
|
||||
if ($System > Wootook::getGameConfig('engine/universe/systems')) {
|
||||
$System = Wootook::getGameConfig('engine/universe/systems');
|
||||
}
|
||||
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=\"<-\" 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=\"->\" 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=\"<-\" 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=\"->\" 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;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
57
src/includes/functions/ShowGalaxyTitles.php
Normal file
57
src/includes/functions/ShowGalaxyTitles.php
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
?>
|
||||
52
src/includes/functions/SortUserPlanets.php
Normal file
52
src/includes/functions/SortUserPlanets.php
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
?>
|
||||
118
src/includes/functions/SpyTarget.php
Normal file
118
src/includes/functions/SpyTarget.php
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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> </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> </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> </td>";
|
||||
}
|
||||
$Count += $TargetPlanet[$resource[$Item]];
|
||||
$row++;
|
||||
if ($row == SPY_REPORT_ROW) {
|
||||
$String .= "</tr>";
|
||||
$row = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while ($row != 0) {
|
||||
$String .= "<td> </td><td> </td>";
|
||||
$row++;
|
||||
if ($row == SPY_REPORT_ROW) {
|
||||
$String .= "</tr>";
|
||||
$row = 0;
|
||||
}
|
||||
}
|
||||
$CurrentLook++;
|
||||
} // while
|
||||
}
|
||||
$String .= "</table>";
|
||||
|
||||
$return['String'] = $String;
|
||||
$return['Count'] = $Count;
|
||||
return $return;
|
||||
}
|
||||
|
||||
?>
|
||||
62
src/includes/functions/StoreGoodsToPlanet.php
Normal file
62
src/includes/functions/StoreGoodsToPlanet.php
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @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');
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
62
src/includes/functions/UpdatePlanetBatimentQueueList.php
Normal file
62
src/includes/functions/UpdatePlanetBatimentQueueList.php
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $CurrentPlanet
|
||||
* @param unknown_type $CurrentUser
|
||||
*/
|
||||
function UpdatePlanetBatimentQueueList ( &$CurrentPlanet, &$CurrentUser ) {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
$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
|
||||
|
||||
?>
|
||||
Loading…
Reference in a new issue