Fixed mysql_* calls

Updated skin
Fixed minor bugs in shipyard pages display
Fixed various bugs in legacy fleet pages source code.

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
This commit is contained in:
Gregory PLANCHAT 2011-09-22 01:19:45 +02:00
commit cfeb6aca6d
68 changed files with 1561 additions and 1451 deletions

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/
@ -53,7 +53,7 @@ require_once dirname(dirname(__FILE__)) .'/common.php';
$parse['adm_ul_table'] = "";
$i = 0;
$Color = "lime";
while ($u = mysql_fetch_assoc ($query) ) {
while ($u = $query->fetch(PDO::FETCH_ASSOC) ) {
if ($PrevIP != "") {
if ($PrevIP == $u['declarator']) {
$Color = "red";

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/
@ -53,7 +53,7 @@ require_once dirname(dirname(__FILE__)) .'/common.php';
$Last15Mins = doquery("SELECT * FROM {{table}} WHERE `onlinetime` >= '". (time() - 15 * 60) ."' ORDER BY `". $TypeSort ."` ASC;", 'users');
$Count = 0;
$Color = "lime";
while ( $TheUser = mysql_fetch_array($Last15Mins) ) {
while ($TheUser = $Last15Mins->fetch(PDO::FETCH_ASSOC) ) {
if ($PrevIP != "") {
if ($PrevIP == $TheUser['user_lastip']) {
$Color = "red";

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/
@ -50,37 +50,79 @@ require_once dirname(dirname(__FILE__)) .'/common.php';
switch ($_GET['result']){
case 'usr_search':
$pattern = mysql_real_escape_string($_GET['player']);
$SelUser = doquery("SELECT * FROM {{table}} WHERE `username` LIKE '%". $pattern ."%' LIMIT 1;", 'users', true);
$UsrMain = doquery("SELECT `name` FROM {{table}} WHERE `id` = '". $SelUser['id_planet'] ."';", 'planets', true);
$db = Legacies_Database::getSingleton();
$sql =<<<SQL_EOF
SELECT
planet.id AS planet_id,
planet.name AS planet_name,
planet.galaxy AS planet_galaxy,
planet.system AS planet_system,
planet.planet AS planet_position,
user.id AS user_id,
user.username AS username,
user.user_lastip AS user_lastip,
user.email AS email,
user.authlevel AS authlevel,
user.sex AS sex
FROM {{table}}planets AS planet
INNER JOIN {{table}}users AS user ON user.id_planet=planet.id
WHERE user.id = {$db->quote('%' . str_replace('*', '%', str_replace('%', '%%', $_GET['player'])) . '%')}"
SQL_EOF;
$statement = $db->prepare($sql);
$statement->execute();
$data = $statement->fetch(PDO::FETCH_ASSOC);
$bloc = $lang;
$bloc['answer1'] = $SelUser['id'];
$bloc['answer2'] = $SelUser['username'];
$bloc['answer3'] = $SelUser['user_lastip'];
$bloc['answer4'] = $SelUser['email'];
$bloc['answer5'] = $lang['adm_usr_level'][ $SelUser['authlevel'] ];
$bloc['answer6'] = $lang['adm_usr_genre'][ $SelUser['sex'] ];
$bloc['answer7'] = "[".$SelUser['id_planet']."] ".$UsrMain['name'];
$bloc['answer8'] = "[".$SelUser['galaxy'].":".$SelUser['system'].":".$SelUser['planet']."] ";
$bloc['answer1'] = $data['user_id'];
$bloc['answer2'] = $data['username'];
$bloc['answer3'] = $data['user_lastip'];
$bloc['answer4'] = $data['email'];
$bloc['answer5'] = $lang['adm_usr_level'][$data['authlevel']];
$bloc['answer6'] = $lang['adm_usr_genre'][$data['sex']];
$bloc['answer7'] = "[".$data['planet_id']."] {$data['planet_name']}";
$bloc['answer8'] = "[".$SelUser['planet_galaxy'].":".$SelUser['planet_system'].":".$SelUser['planet_position']."] ";
$SubPanelTPL = gettemplate('admin/admin_panel_asw1');
$parse['adm_sub_form2'] = parsetemplate( $SubPanelTPL, $bloc );
$parse['adm_sub_form2'] = parsetemplate($SubPanelTPL, $bloc);
break;
case 'usr_data':
$db = Legacies_Database::getSingleton();
$sql =<<<SQL_EOF
SELECT
planet.id AS planet_id,
planet.name AS planet_name,
planet.galaxy AS planet_galaxy,
planet.system AS planet_system,
planet.planet AS planet_position,
user.id AS user_id,
user.username AS username,
user.user_lastip AS user_lastip,
user.email AS email,
user.authlevel AS authlevel,
user.sex AS sex
FROM {{table}}planets AS planet
INNER JOIN {{table}}users AS user ON user.id_planet=planet.id
WHERE user.id = {$db->quote('%' . str_replace('*', '%', str_replace('%', '%%', $_GET['player'])) . '%')}"
SQL_EOF;
$statement = $db->prepare($sql);
$statement->execute();
$data = $statement->fetch(PDO::FETCH_ASSOC);
$pattern = mysql_real_escape_string($_GET['player']);
$SelUser = doquery("SELECT * FROM {{table}} WHERE `username` LIKE '%". $pattern ."%' LIMIT 1;", 'users', true);
$UsrMain = doquery("SELECT `name` FROM {{table}} WHERE `id` = '". $SelUser['id_planet'] ."';", 'planets', true);
$bloc = $lang;
$bloc['answer1'] = $SelUser['id'];
$bloc['answer2'] = $SelUser['username'];
$bloc['answer3'] = $SelUser['user_lastip'];
$bloc['answer4'] = $SelUser['email'];
$bloc['answer5'] = $lang['adm_usr_level'][ $SelUser['authlevel'] ];
$bloc['answer6'] = $lang['adm_usr_genre'][ $SelUser['sex'] ];
$bloc['answer7'] = "[".$SelUser['id_planet']."] ".$UsrMain['name'];
$bloc['answer8'] = "[".$SelUser['galaxy'].":".$SelUser['system'].":".$SelUser['planet']."] ";
$bloc['answer1'] = $data['user_id'];
$bloc['answer2'] = $data['username'];
$bloc['answer3'] = $data['user_lastip'];
$bloc['answer4'] = $data['email'];
$bloc['answer5'] = $lang['adm_usr_level'][$data['authlevel']];
$bloc['answer6'] = $lang['adm_usr_genre'][$data['sex']];
$bloc['answer7'] = "[".$data['planet_id']."] {$data['planet_name']}";
$bloc['answer8'] = "[".$SelUser['planet_galaxy'].":".$SelUser['planet_system'].":".$SelUser['planet_position']."] ";
$SubPanelTPL = gettemplate('admin/admin_panel_asw1');
$parse['adm_sub_form1'] = parsetemplate( $SubPanelTPL, $bloc );

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -146,7 +146,7 @@ if ( $a == 1 ) {
}
$buddyrow = doquery( "SELECT * FROM {{table}} " . $query, 'buddy' );
while ( $b = mysql_fetch_array( $buddyrow ) ) {
while ( $b = $buddyrow->fetch(PDO::FETCH_BOTH) ) {
// para solicitudes
if ( !isset( $i ) && isset( $a ) ) {
$page .= "

View file

@ -40,7 +40,7 @@ $mode = isset($_GET['mode']) ? $_GET['mode'] : null;
switch ($mode) {
case 'fleet':
if ($planet->getElement(Legacies_Empire::ID_BUILDING_SHIPYARD) === null) {
if ($planet->getElement(Legacies_Empire::ID_BUILDING_SHIPYARD) < 1) {
$layout = new Legacies_Core_Layout();
$layout->load('message');
@ -71,7 +71,7 @@ case 'fleet':
break;
case 'research':
if ($planet->getElement(Legacies_Empire::ID_BUILDING_RESEARCH_LAB) === null) {
if ($planet->getElement(Legacies_Empire::ID_BUILDING_RESEARCH_LAB) < 1) {
$layout = new Legacies_Core_Layout();
$layout->load('message');
@ -99,7 +99,7 @@ case 'research':
break;
case 'defense':
if ($planet->getElement(Legacies_Empire::ID_BUILDING_SHIPYARD) === null) {
if ($planet->getElement(Legacies_Empire::ID_BUILDING_SHIPYARD) < 1) {
$layout = new Legacies_Core_Layout();
$layout->load('message');

View file

@ -44,7 +44,7 @@ require_once dirname(__FILE__) .'/common.php';
$QrySelectUser .= "WHERE `authlevel` != '0' ORDER BY `authlevel` DESC;";
$GameOps = doquery ( $QrySelectUser, 'users');
while( $Ops = mysql_fetch_assoc($GameOps) ) {
while( $Ops = $GameOps->fetch(PDO::FETCH_ASSOC) ) {
$bloc['ctc_data_name'] = $Ops['username'];
$bloc['ctc_data_auth'] = $lang['user_level'][$Ops['authlevel']];
$bloc['ctc_data_mail'] = "<a href=mailto:".$Ops['email'].">".$Ops['email']."</a>";

474
fleet.php
View file

@ -32,254 +32,256 @@ define('INSIDE' , true);
define('INSTALL' , false);
require_once dirname(__FILE__) .'/common.php';
$maxfleet = doquery("SELECT COUNT(fleet_owner) AS `actcnt` FROM {{table}} WHERE `fleet_owner` = '".$user['id']."';", 'fleets', true);
$maxfleet = doquery("SELECT 1 FROM {{table}} WHERE `fleet_owner` = '".$user['id']."';", 'fleets');
$MaxFlyingFleets = $maxfleet['actcnt'];
$MaxFlyingFleets = $maxfleet->rowCount();
$maxfleet->closeCursor();
//Compteur de flotte en expéditions et nombre d'expédition maximum
$MaxExpedition = $user[$resource[124]];
if ($MaxExpedition >= 1) {
$maxexpde = doquery("SELECT COUNT(fleet_owner) AS `expedi` FROM {{table}} WHERE `fleet_owner` = '".$user['id']."' AND `fleet_mission` = '15';", 'fleets', true);
$ExpeditionEnCours = $maxexpde['expedi'];
$EnvoiMaxExpedition = 1 + floor( $MaxExpedition / 3 );
//Compteur de flotte en expéditions et nombre d'expédition maximum
$maxExpedition = $user->getElement(Legacies_Empire::ID_RESEARCH_EXPEDITION_TECHNOLOGY);
$ExpeditionEnCours = 0;
$EnvoiMaxExpedition = 0;
if ($maxExpedition >= 1) {
$maxexpde = doquery("SELECT 1 FROM {{table}} WHERE `fleet_owner` = '".$user['id']."' AND `fleet_mission` = '15';", 'fleets');
$ExpeditionEnCours = $maxexpde->rowCount();
$maxexpde->closeCursor();
$EnvoiMaxExpedition = 1 + floor($maxExpedition / 3);
}
$MaxFlottes = 1 + $user->getElement(Legacies_Empire::ID_RESEARCH_COMPUTER_TECHNOLOGY);
includeLang('fleet');
$missionTypes = array(
Legacies_Empire::ID_MISSION_ATTACK => $lang['type_mission'][Legacies_Empire::ID_MISSION_ATTACK],
Legacies_Empire::ID_MISSION_GROUP_ATTACK => $lang['type_mission'][Legacies_Empire::ID_MISSION_GROUP_ATTACK],
Legacies_Empire::ID_MISSION_TRANSPORT => $lang['type_mission'][Legacies_Empire::ID_MISSION_TRANSPORT],
Legacies_Empire::ID_MISSION_STATION => $lang['type_mission'][Legacies_Empire::ID_MISSION_STATION],
Legacies_Empire::ID_MISSION_STATION_ALLY => $lang['type_mission'][Legacies_Empire::ID_MISSION_STATION_ALLY],
Legacies_Empire::ID_MISSION_SPY => $lang['type_mission'][Legacies_Empire::ID_MISSION_SPY],
Legacies_Empire::ID_MISSION_SETTLE_COLONY => $lang['type_mission'][Legacies_Empire::ID_MISSION_SETTLE_COLONY],
Legacies_Empire::ID_MISSION_RECYCLE => $lang['type_mission'][Legacies_Empire::ID_MISSION_RECYCLE],
Legacies_Empire::ID_MISSION_DESTROY => $lang['type_mission'][Legacies_Empire::ID_MISSION_DESTROY],
Legacies_Empire::ID_MISSION_EXPEDITION => $lang['type_mission'][Legacies_Empire::ID_MISSION_EXPEDITION]
);
// Histoire de recuperer les infos passées par galaxy
$galaxy = isset($_GET['galaxy']) ? intval($_GET['galaxy']) : 0;
$system = isset($_GET['system']) ? intval($_GET['system']) : 0;
$position = isset($_GET['planet']) ? intval($_GET['planet']) : 0;
$planetType = isset($_GET['planettype']) ? intval($_GET['planettype']) : 0;
$targetMission = isset($_GET['target_mission']) ? intval($_GET['target_mission']) : 0;
$user = Legacies_Empire_Model_User::getSingleton();
$planet = $user->getCurrentPlanet();
if ($galaxy <= 0 || $galaxy > MAX_GALAXY_IN_WORLD) {
$galaxy = $planet['galaxy'];
}
if ($system <= 0 || $system > MAX_SYSTEM_IN_GALAXY) {
$system = $planet['system'];
}
if ($position <= 0 || $position > MAX_PLANET_IN_SYSTEM) {
$position = $planet['planet'];
}
$allowedPlanetTypes = array(
Legacies_Empire_Model_Planet::TYPE_PLANET,
Legacies_Empire_Model_Planet::TYPE_DEBRIS,
Legacies_Empire_Model_Planet::TYPE_MOON
);
if (!in_array($planetType, $allowedPlanetTypes)) {
$planetType = $planet['planet_type'];
}
$page = "<script type=\"text/javascript\" src=\"scripts/flotten.js\"></script>\n";
$page .= "<script language=\"JavaScript\" src=\"scripts/ocnt.js\"></script>\n";
$page .= "<br><center>";
$page .= "<table width='519' border='0' cellpadding='0' cellspacing='1'>";
$page .= "<tr height='20'>";
$page .= "<td colspan='9' class='c'>";
$page .= "<table border=\"0\" width=\"100%\">";
$page .= "<tbody><tr>";
$page .= "<td style=\"background-color: transparent;\">";
$page .= $lang['fl_title']." ".$MaxFlyingFleets." ".$lang['fl_sur']." ".$MaxFlottes;
$page .= "</td><td style=\"background-color: transparent;\" align=\"right\">";
$page .= $ExpeditionEnCours."/".$EnvoiMaxExpedition." ".$lang['fl_expttl'];
$page .= "</td>";
$page .= "</tr></tbody></table>";
$page .= "</td>";
$page .= "</tr><tr height='20'>";
$page .= "<th>".$lang['fl_id']."</th>";
$page .= "<th>".$lang['fl_mission']."</th>";
$page .= "<th>".$lang['fl_count']."</th>";
$page .= "<th>".$lang['fl_from']."</th>";
$page .= "<th>".$lang['fl_start_t']."</th>";
$page .= "<th>".$lang['fl_dest']."</th>";
$page .= "<th>".$lang['fl_dest_t']."</th>";
//$page .= "<th>".$lang['fl_back_t']."</th>";
$page .= "<th>".$lang['fl_back_in']."</th>";
$page .= "<th>".$lang['fl_order']."</th>";
$page .= "</tr>";
$i = 0;
foreach ($user->getFleetCollection() as $f) {
$i++;
$page .= "<tr height=20>";
// (01) Fleet ID
$page .= "<th>".$i."</th>";
// (02) Fleet Mission
$page .= "<th>";
$page .= "<a>". $missionTypes[$f['fleet_mission']] ."</a>";
if (($f['fleet_start_time'] + 1) == $f['fleet_end_time']) {
$page .= "<br><a title=\"".$lang['fl_back_to_ttl']."\">".$lang['fl_back_to']."</a>";
} else {
$page .= "<br><a title=\"".$lang['fl_get_to_ttl']."\">".$lang['fl_get_to']."</a>";
}
$page .= "</th>";
// (03) Fleet Mission
$page .= "<th><a title=\"";
// Fleet details (commentaire)
$fleet = explode(";", $f['fleet_array']);
$e = 0;
foreach ($fleet as $a => $b) {
if ($b != '') {
$e++;
$a = explode(",", $b);
$page .= $lang['tech'][$a[0]]. ":". $a[1] ."\n";
if ($e > 1) {
$page .= "\t";
}
}
}
$page .= "\">". pretty_number($f['fleet_amount']) ."</a></th>";
// (04) Fleet From (Planete d'origine)
$page .= "<th>[".$f[fleet_start_galaxy].":".$f['fleet_start_system'].":".$f['fleet_start_planet']."]</th>";
// (05) Fleet Start Time
$page .= "<th>". gmdate("d. M Y H:i:s", $f['fleet_start_time']) ."</th>";
// (06) Fleet Target (Planete de destination)
$page .= "<th>[".$f['fleet_end_galaxy'].":".$f['fleet_end_system'].":".$f['fleet_end_planet']."]</th>";
// (07) Fleet Target Time
$page .= "<th>". gmdate("d. M Y H:i:s", $f['fleet_end_time']) ."</th>";
// (08) Fleet Back Time
// $page .= "<th><font color=\"lime\"><div id=\"time_0\"><font>". pretty_time(floor($f['fleet_end_time'] + 1 - time())) ."</font></th>";
// (09) Fleet Back In
$page .= "<th><font color=\"lime\"><div id=\"time_0\"><font>". pretty_time(floor($f['fleet_end_time'] + 1 - time())) ."</font></th>";
// (10) Orders
$page .= "<th>";
if ($f['fleet_mess'] == 0) {
$page .= "<form action=\"fleetback.php\" method=\"post\">";
$page .= "<input name=\"fleetid\" value=\"". $f['fleet_id'] ."\" type=\"hidden\">";
$page .= "<input value=\" ".$lang['fl_back_to_ttl']." \" type=\"submit\" name=\"send\">";
$page .= "</form>";
if ($f[fleet_mission] == 1) {
$page .= "<form action=\"verband.php\" method=\"post\">";
$page .= "<input name=\"fleetid\" value=\"". $f['fleet_id'] ."\" type=\"hidden\">";
$page .= "<input value=\" ".$lang['fl_associate']." \" type=\"submit\">";
$page .= "</form>";
}
} else {
$page .= "&nbsp;-&nbsp;";
}
$page .= "</th>";
// Fin de ligne
$page .= "</tr>";
}
$MaxFlottes = 1 + $user[$resource[108]];
// Y a pas de flottes en vol ... on met des '-'
if ($i == 0) {
$page .= "<tr>";
$page .= "<th>-</th>";
$page .= "<th>-</th>";
$page .= "<th>-</th>";
$page .= "<th>-</th>";
$page .= "<th>-</th>";
$page .= "<th>-</th>";
$page .= "<th>-</th>";
// $page .= "<th>-</th>";
$page .= "<th>-</th>";
$page .= "<th>-</th>";
$page .= "</tr>";
}
CheckPlanetUsedFields($planetrow);
if ($MaxFlottes == $MaxFlyingFleets) {
$page .= "<tr height=\"20\"><th colspan=\"9\"><font color=\"red\">".$lang['fl_noslotfree']."</font></th></tr>";
}
includeLang('fleet');
$page .= "</table></center>";
$missiontype = array(
1 => $lang['type_mission'][1],
2 => $lang['type_mission'][2],
3 => $lang['type_mission'][3],
4 => $lang['type_mission'][4],
5 => $lang['type_mission'][5],
6 => $lang['type_mission'][6],
7 => $lang['type_mission'][7],
8 => $lang['type_mission'][8],
9 => $lang['type_mission'][9],
15 => $lang['type_mission'][15]
);
$page .= "<center>";
// Histoire de recuperer les infos passées par galaxy
$galaxy = $_GET['galaxy'];
$system = $_GET['system'];
$planet = $_GET['planet'];
$planettype = $_GET['planettype'];
$target_mission = $_GET['target_mission'];
// Selection d'une nouvelle mission
$page .= "<form action=\"floten1.php\" method=\"post\">";
$page .= "<table width=\"519\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\">";
$page .= "<tr height=\"20\">";
$page .= "<td colspan=\"4\" class=\"c\">".$lang['fl_new_miss']."</td>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<th>".$lang['fl_fleet_typ']."</th>";
$page .= "<th>".$lang['fl_fleet_disp']."</th>";
$page .= "<th>-</th>";
$page .= "<th>-</th>";
$page .= "</tr>";
if (!$galaxy) {
$galaxy = $planetrow['galaxy'];
}
if (!$system) {
$system = $planetrow['system'];
}
if (!$planet) {
$planet = $planetrow['planet'];
}
if (!$planettype) {
$planettype = $planetrow['planet_type'];
}
if (!$planet) {
message($lang['fl_noplanetrow'], $lang['fl_error']);
}
$page = "<script language=\"JavaScript\" src=\"scripts/flotten.js\"></script>\n";
$page .= "<script language=\"JavaScript\" src=\"scripts/ocnt.js\"></script>\n";
$page .= "<br><center>";
$page .= "<table width='519' border='0' cellpadding='0' cellspacing='1'>";
$page .= "<tr height='20'>";
$page .= "<td colspan='9' class='c'>";
$page .= "<table border=\"0\" width=\"100%\">";
$page .= "<tbody><tr>";
$page .= "<td style=\"background-color: transparent;\">";
$page .= $lang['fl_title']." ".$MaxFlyingFleets." ".$lang['fl_sur']." ".$MaxFlottes;
$page .= "</td><td style=\"background-color: transparent;\" align=\"right\">";
$page .= $ExpeditionEnCours."/".$EnvoiMaxExpedition." ".$lang['fl_expttl'];
$page .= "</td>";
$page .= "</tr></tbody></table>";
$page .= "</td>";
$page .= "</tr><tr height='20'>";
$page .= "<th>".$lang['fl_id']."</th>";
$page .= "<th>".$lang['fl_mission']."</th>";
$page .= "<th>".$lang['fl_count']."</th>";
$page .= "<th>".$lang['fl_from']."</th>";
$page .= "<th>".$lang['fl_start_t']."</th>";
$page .= "<th>".$lang['fl_dest']."</th>";
$page .= "<th>".$lang['fl_dest_t']."</th>";
// $page .= "<th>".$lang['fl_back_t']."</th>";
$page .= "<th>".$lang['fl_back_in']."</th>";
$page .= "<th>".$lang['fl_order']."</th>";
$page .= "</tr>";
$ShipData = "";
// Gestion des flottes du joueur actif
$fq = doquery("SELECT * FROM {{table}} WHERE fleet_owner={$user[id]}", "fleets");
$i = 0;
foreach ($reslist['fleet'] as $n => $i) {
if ($planet[$resource[$i]] > 0) {
$page .= "<tr height=\"20\">";
$page .= "<th><a title=\"". $lang['fl_fleetspeed'] /*. $CurrentShipSpeed*/ ."\">" . $lang['tech'][$i] . "</a></th>";
$page .= "<th>". pretty_number ($planet[$resource[$i]]);
$ShipData .= "<input type=\"hidden\" name=\"maxship[". $i ."]\" value=\"". $planet[$resource[$i]] ."\" />";
$ShipData .= "<input type=\"hidden\" name=\"consumption[". $i ."]\" value=\"". GetShipConsumption ( $i, $user ) ."\" />";
$ShipData .= "<input type=\"hidden\" name=\"speed[" .$i ."]\" value=\"" . GetFleetMaxSpeed ("", $i, $user) . "\" />";
$ShipData .= "<input type=\"hidden\" name=\"capacity[". $i ."]\" value=\"". $pricelist[$i]['capacity'] ."\" />";
$page .= "</th>";
// Satelitte Solaire (eux ne peuvent pas bouger !)
if ($i == 212) {
$page .= "<th></th><th></th>";
} else {
$page .= "<th><a href=\"javascript:maxShip('ship[". $i ."]'); shortInfo();\">".$lang['fl_selmax']."</a> </th>";
$page .= "<th><input name=\"ship[". $i ."]\" size=\"10\" value=\"0\" onfocus=\"javascript:if(this.value == '0') this.value='';\" onblur=\"javascript:if(this.value == '') this.value='0';\" alt=\"". $lang['tech'][$i] . $planet[$resource[$i]] ."\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\" /></th>";
}
$page .= "</tr>";
}
$have_ships = true;
}
$btncontinue = "<tr height=\"20\"><th colspan=\"4\"><input type=\"submit\" value=\" ".$lang['fl_continue']." \" /></th>";
$page .= "<tr height=\"20\">";
if (!$have_ships) {
// Il n'y a pas de vaisseaux sur cette planete
$page .= "<th colspan=\"4\">". $lang['fl_noships'] ."</th>";
$page .= "</tr>";
$page .= $btncontinue;
} else {
$page .= "<th colspan=\"2\"><a href=\"javascript:noShips();shortInfo();noResources();\" >". $lang['fl_unselectall'] ."</a></th>";
$page .= "<th colspan=\"2\"><a href=\"javascript:maxShips();shortInfo();\" >". $lang['fl_selectall'] ."</a></th>";
$page .= "</tr>";
while ($f = $fq->fetch(PDO::FETCH_BOTH)) {
$i++;
$page .= "<tr height=20>";
// (01) Fleet ID
$page .= "<th>".$i."</th>";
// (02) Fleet Mission
$page .= "<th>";
$page .= "<a>". $missiontype[$f[fleet_mission]] ."</a>";
if (($f['fleet_start_time'] + 1) == $f['fleet_end_time']) {
$page .= "<br><a title=\"".$lang['fl_back_to_ttl']."\">".$lang['fl_back_to']."</a>";
} else {
$page .= "<br><a title=\"".$lang['fl_get_to_ttl']."\">".$lang['fl_get_to']."</a>";
}
$page .= "</th>";
// (03) Fleet Mission
$page .= "<th><a title=\"";
// Fleet details (commentaire)
$fleet = explode(";", $f['fleet_array']);
$e = 0;
foreach ($fleet as $a => $b) {
if ($b != '') {
$e++;
$a = explode(",", $b);
$page .= $lang['tech'][$a[0]]. ":". $a[1] ."\n";
if ($e > 1) {
$page .= "\t";
}
}
}
$page .= "\">". pretty_number($f[fleet_amount]) ."</a></th>";
// (04) Fleet From (Planete d'origine)
$page .= "<th>[".$f[fleet_start_galaxy].":".$f[fleet_start_system].":".$f[fleet_start_planet]."]</th>";
// (05) Fleet Start Time
$page .= "<th>". gmdate("d. M Y H:i:s", $f['fleet_start_time']) ."</th>";
// (06) Fleet Target (Planete de destination)
$page .= "<th>[".$f[fleet_end_galaxy].":".$f[fleet_end_system].":".$f[fleet_end_planet]."]</th>";
// (07) Fleet Target Time
$page .= "<th>". gmdate("d. M Y H:i:s", $f['fleet_end_time']) ."</th>";
// (08) Fleet Back Time
// $page .= "<th><font color=\"lime\"><div id=\"time_0\"><font>". pretty_time(floor($f['fleet_end_time'] + 1 - time())) ."</font></th>";
// (09) Fleet Back In
$page .= "<th><font color=\"lime\"><div id=\"time_0\"><font>". pretty_time(floor($f['fleet_end_time'] + 1 - time())) ."</font></th>";
// (10) Orders
$page .= "<th>";
if ($f['fleet_mess'] == 0) {
$page .= "<form action=\"fleetback.php\" method=\"post\">";
$page .= "<input name=\"fleetid\" value=\"". $f['fleet_id'] ."\" type=\"hidden\">";
$page .= "<input value=\" ".$lang['fl_back_to_ttl']." \" type=\"submit\" name=\"send\">";
$page .= "</form>";
if ($f[fleet_mission] == 1) {
$page .= "<form action=\"verband.php\" method=\"post\">";
$page .= "<input name=\"fleetid\" value=\"". $f['fleet_id'] ."\" type=\"hidden\">";
$page .= "<input value=\" ".$lang['fl_associate']." \" type=\"submit\">";
$page .= "</form>";
}
} else {
$page .= "&nbsp;-&nbsp;";
}
$page .= "</th>";
// Fin de ligne
$page .= "</tr>";
}
if ($MaxFlottes > $MaxFlyingFleets) {
$page .= $btncontinue;
}
}
$page .= "</tr>";
$page .= "</table>";
$page .= $ShipData;
$page .= "<input type=\"hidden\" name=\"galaxy\" value=\"". $galaxy ."\" />";
$page .= "<input type=\"hidden\" name=\"system\" value=\"". $system ."\" />";
$page .= "<input type=\"hidden\" name=\"planet\" value=\"". $position ."\" />";
$page .= "<input type=\"hidden\" name=\"planet_type\" value=\"". $planetType ."\" />";
$page .= "<input type=\"hidden\" name=\"mission\" value=\"". $targetMission ."\" />";
$page .= "<input type=\"hidden\" name=\"maxepedition\" value=\"". $EnvoiMaxExpedition ."\" />";
$page .= "<input type=\"hidden\" name=\"curepedition\" value=\"". $ExpeditionEnCours ."\" />";
$page .= "<input type=\"hidden\" name=\"target_mission\" value=\"". $targetMission ."\" />";
$page .= "</form>";
$page .= "</center>";
// Y a pas de flottes en vol ... on met des '-'
if ($i == 0) {
$page .= "<tr>";
$page .= "<th>-</th>";
$page .= "<th>-</th>";
$page .= "<th>-</th>";
$page .= "<th>-</th>";
$page .= "<th>-</th>";
$page .= "<th>-</th>";
$page .= "<th>-</th>";
// $page .= "<th>-</th>";
$page .= "<th>-</th>";
$page .= "<th>-</th>";
$page .= "</tr>";
}
display($page, $lang['fl_title']);
if ($MaxFlottes == $MaxFlyingFleets) {
$page .= "<tr height=\"20\"><th colspan=\"9\"><font color=\"red\">".$lang['fl_noslotfree']."</font></th></tr>";
}
$page .= "</table></center>";
$page .= "<center>";
// Selection d'une nouvelle mission
$page .= "<form action=\"floten1.php\" method=\"post\">";
$page .= "<table width=\"519\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\">";
$page .= "<tr height=\"20\">";
$page .= "<td colspan=\"4\" class=\"c\">".$lang['fl_new_miss']."</td>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<th>".$lang['fl_fleet_typ']."</th>";
$page .= "<th>".$lang['fl_fleet_disp']."</th>";
$page .= "<th>-</th>";
$page .= "<th>-</th>";
$page .= "</tr>";
if (!$planetrow) {
message($lang['fl_noplanetrow'], $lang['fl_error']);
}
// Prise des coordonnées sur la ligne de commande
$galaxy = intval($_GET['galaxy']);
$system = intval($_GET['system']);
$planet = intval($_GET['planet']);
$planettype = intval($_GET['planettype']);
$target_mission = intval($_GET['target_mission']);
$ShipData = "";
foreach ($reslist['fleet'] as $n => $i) {
if ($planetrow[$resource[$i]] > 0) {
$page .= "<tr height=\"20\">";
$page .= "<th><a title=\"". $lang['fl_fleetspeed'] . $CurrentShipSpeed ."\">" . $lang['tech'][$i] . "</a></th>";
$page .= "<th>". pretty_number ($planetrow[$resource[$i]]);
$ShipData .= "<input type=\"hidden\" name=\"maxship". $i ."\" value=\"". $planetrow[$resource[$i]] ."\" />";
$ShipData .= "<input type=\"hidden\" name=\"consumption". $i ."\" value=\"". GetShipConsumption ( $i, $user ) ."\" />";
$ShipData .= "<input type=\"hidden\" name=\"speed" .$i ."\" value=\"" . GetFleetMaxSpeed ("", $i, $user) . "\" />";
$ShipData .= "<input type=\"hidden\" name=\"capacity". $i ."\" value=\"". $pricelist[$i]['capacity'] ."\" />";
$page .= "</th>";
// Satelitte Solaire (eux ne peuvent pas bouger !)
if ($i == 212) {
$page .= "<th></th><th></th>";
} else {
$page .= "<th><a href=\"javascript:maxShip('ship". $i ."'); shortInfo();\">".$lang['fl_selmax']."</a> </th>";
$page .= "<th><input name=\"ship". $i ."\" size=\"10\" value=\"0\" onfocus=\"javascript:if(this.value == '0') this.value='';\" onblur=\"javascript:if(this.value == '') this.value='0';\" alt=\"". $lang['tech'][$i] . $planetrow[$resource[$i]] ."\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\" /></th>";
}
$page .= "</tr>";
}
$have_ships = true;
}
$btncontinue = "<tr height=\"20\"><th colspan=\"4\"><input type=\"submit\" value=\" ".$lang['fl_continue']." \" /></th>";
$page .= "<tr height=\"20\">";
if (!$have_ships) {
// Il n'y a pas de vaisseaux sur cette planete
$page .= "<th colspan=\"4\">". $lang['fl_noships'] ."</th>";
$page .= "</tr>";
$page .= $btncontinue;
} else {
$page .= "<th colspan=\"2\"><a href=\"javascript:noShips();shortInfo();noResources();\" >". $lang['fl_unselectall'] ."</a></th>";
$page .= "<th colspan=\"2\"><a href=\"javascript:maxShips();shortInfo();\" >". $lang['fl_selectall'] ."</a></th>";
$page .= "</tr>";
if ($MaxFlottes > $MaxFlyingFleets) {
$page .= $btncontinue;
}
}
$page .= "</tr>";
$page .= "</table>";
$page .= $ShipData;
$page .= "<input type=\"hidden\" name=\"galaxy\" value=\"". $galaxy ."\" />";
$page .= "<input type=\"hidden\" name=\"system\" value=\"". $system ."\" />";
$page .= "<input type=\"hidden\" name=\"planet\" value=\"". $planet ."\" />";
$page .= "<input type=\"hidden\" name=\"planet_type\" value=\"". $planettype ."\" />";
$page .= "<input type=\"hidden\" name=\"mission\" value=\"". $target_mission ."\" />";
$page .= "<input type=\"hidden\" name=\"maxepedition\" value=\"". $EnvoiMaxExpedition ."\" />";
$page .= "<input type=\"hidden\" name=\"curepedition\" value=\"". $ExpeditionEnCours ."\" />";
$page .= "<input type=\"hidden\" name=\"target_mission\" value=\"". $target_mission ."\" />";
$page .= "</form>";
$page .= "</center>";
display($page, $lang['fl_title']);
?>

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/
@ -31,256 +31,300 @@
define('INSIDE' , true);
define('INSTALL' , false);
require_once dirname(__FILE__) .'/common.php';
includeLang('fleet');
includeLang('fleet');
$speed = array(10 => 100,
9 => 90,
8 => 80,
7 => 70,
6 => 60,
5 => 50,
4 => 40,
3 => 30,
2 => 20,
1 => 10,
);
$speed = array(10 => 100,
9 => 90,
8 => 80,
7 => 70,
6 => 60,
5 => 50,
4 => 40,
3 => 30,
2 => 20,
1 => 10,
);
$g = $_POST['galaxy'];
$s = $_POST['system'];
$p = $_POST['planet'];
$t = $_POST['planet_type'];
$user = Legacies_Empire_Model_User::getSingleton();
$planetrow = $user->getCurrentPlanet();
if (!$g) {
$g = $planetrow['galaxy'];
}
if (!$s) {
$s = $planetrow['system'];
}
if (!$p) {
$p = $planetrow['planet'];
}
if (!$t) {
$t = $planetrow['planet_type'];
}
$g = isset($_POST['galaxy']) ? intval($_POST['galaxy']) : 0;
$s = isset($_POST['system']) ? intval($_POST['system']) : 0;
$p = isset($_POST['planet']) ? intval($_POST['planet']) : 0;
$t = isset($_POST['planet_type']) ? intval($_POST['planet_type']) : 0;
// Verifions si nous avons bien tout ce que nous voullons envoyer
$FleetHiddenBlock = "";
foreach ($reslist['fleet'] as $n => $i) {
if ($i > 200 && $i < 300 && $_POST["ship$i"] > "0") {
if ($_POST["ship$i"] > $planetrow[$resource[$i]]) {
$page .= $lang['fl_noenought'];
$speedalls[$i] = GetFleetMaxSpeed ( "", $i, $user );
} else {
$fleet['fleetarray'][$i] = $_POST["ship$i"];
// Tableau des vaisseaux avec leur nombre
$fleet['fleetlist'] .= $i . "," . $_POST["ship$i"] . ";";
// Nombre total de vaisseaux
$fleet['amount'] += $_POST["ship$i"];
// Tableau des vitesses
$FleetHiddenBlock .= "<input type=\"hidden\" name=\"consumption". $i ."\" value=\"". GetShipConsumption ( $i, $user ) ."\" />";
$FleetHiddenBlock .= "<input type=\"hidden\" name=\"speed". $i ."\" value=\"". GetFleetMaxSpeed ( "", $i, $user ) ."\" />";
$FleetHiddenBlock .= "<input type=\"hidden\" name=\"capacity". $i ."\" value=\"". $pricelist[$i]['capacity'] ."\" />";
$FleetHiddenBlock .= "<input type=\"hidden\" name=\"ship". $i ."\" value=\"". $_POST["ship$i"] ."\" />";
$speedalls[$i] = GetFleetMaxSpeed ( "", $i, $user );
}
}
}
if ($g <= 0 || $g > MAX_GALAXY_IN_WORLD) {
$g = $planetrow['galaxy'];
}
if ($s <= 0 || $s > MAX_SYSTEM_IN_GALAXY) {
$s = $planetrow['system'];
}
if ($p <= 0 || $p > MAX_PLANET_IN_SYSTEM) {
$p = $planetrow['planet'];
}
$allowedPlanetTypes = array(
Legacies_Empire_Model_Planet::TYPE_PLANET,
Legacies_Empire_Model_Planet::TYPE_DEBRIS,
Legacies_Empire_Model_Planet::TYPE_MOON
);
if (!$fleet['fleetlist']) {
message($lang['fl_unselectall'], $lang['fl_error'], "fleet." . PHPEXT, 1);
} else {
$speedallsmin = min($speedalls);
}
$page .= "<script type=\"text/javascript\" src=\"scripts/flotten.js\"></script>";
$page .= "<script type=\"text/javascript\">\n";
$page .= "function getStorageFaktor() {\n";
$page .= " return 1\n";
$page .= "}\n";
$page .= "</script>\n";
$page .= "<form action=\"floten2.php\" method=\"post\">";
$page .= $FleetHiddenBlock;
$page .= "<input type=\"hidden\" name=\"speedallsmin\" value=\"". $speedallsmin ."\" />";
$page .= "<input type=\"hidden\" name=\"usedfleet\" value=\"". str_rot13(base64_encode(serialize($fleet['fleetarray']))) ."\" />";
$page .= "<input type=\"hidden\" name=\"thisgalaxy\" value=\"". $planetrow['galaxy'] ."\" />";
$page .= "<input type=\"hidden\" name=\"thissystem\" value=\"". $planetrow['system'] ."\" />";
$page .= "<input type=\"hidden\" name=\"thisplanet\" value=\"". $planetrow['planet'] ."\" />";
$page .= "<input type=\"hidden\" name=\"galaxyend\" value=\"". intval($_POST['galaxy']) ."\" />";
$page .= "<input type=\"hidden\" name=\"systemend\" value=\"". intval($_POST['system']) ."\" />";
$page .= "<input type=\"hidden\" name=\"planetend\" value=\"". intval($_POST['planet']) ."\" />";
$page .= "<input type=\"hidden\" name=\"speedfactor\" value=\"". GetGameSpeedFactor () ."\" />";
$page .= "<input type=\"hidden\" name=\"thisplanettype\" value=\"". $planetrow['planet_type'] ."\" />";
$page .= "<input type=\"hidden\" name=\"thisresource1\" value=\"". floor($planetrow['metal']) ."\" />";
$page .= "<input type=\"hidden\" name=\"thisresource2\" value=\"". floor($planetrow['crystal']) ."\" />";
$page .= "<input type=\"hidden\" name=\"thisresource3\" value=\"". floor($planetrow['deuterium']) ."\" />";
if (!in_array($t, $allowedPlanetTypes)) {
$t = $planet['planet_type'];
}
$page .= "<br><div><center>";
$page .= "<table width=\"519\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\">";
$page .= "<tr height=\"20\">";
$page .= "<td colspan=\"2\" class=\"c\">". $lang['fl_floten1_ttl'] ."</td>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<th width=\"50%\">". $lang['fl_dest'] ."</th>";
$page .= "<th>";
$page .= "<input name=\"galaxy\" size=\"3\" maxlength=\"2\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\" value=\"". $g ."\" />";
$page .= "<input name=\"system\" size=\"3\" maxlength=\"3\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\" value=\"". $s ."\" />";
$page .= "<input name=\"planet\" size=\"3\" maxlength=\"2\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\" value=\"". $p ."\" />";
$page .= "<select name=\"planettype\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\">";
$page .= "<option value=\"1\"". (($t == 1) ? " SELECTED" : "" ) .">". $lang['fl_planet'] ." </option>";
$page .= "<option value=\"2\"". (($t == 2) ? " SELECTED" : "" ) .">". $lang['fl_ruins'] ." </option>";
$page .= "<option value=\"3\"". (($t == 3) ? " SELECTED" : "" ) .">". $lang['fl_moon'] ." </option>";
$page .= "</select>";
$page .= "</th>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<th>". $lang['fl_speed'] ."</th>";
$page .= "<th>";
$page .= "<select name=\"speed\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\">";
foreach ($speed as $a => $b) {
$page .= "<option value=\"".$a."\">".$b."</option>";
}
$page .= "</select> %";
$page .= "</th>";
$page .= "</tr>";
$session = Legacies::getSession('fleet');
$session->clearData();
$FleetHiddenBlock = "";
$page .= "<tr height=\"20\">";
$page .= "<th>". $lang['fl_dist'] ."</th>";
$page .= "<th><div id=\"distance\">-</div></th>";
$page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['fl_fltime'] ."</th>";
$page .= "<th><div id=\"duration\">-</div></th>";
$page .= "</tr><tr height=\"20\">";
$fleetArray = array();
$speedArray = array();
$consumptionArray = array();
$capacityArray = array();
if (isset($_POST['ship']) && is_array($_POST['ship'])) {
$selectedShips = $_POST['ship'];
}
foreach ($reslist[Legacies_Empire::TYPE_SHIP] as $shipId) {
if (!isset($selectedShips[$shipId])) {
continue;
}
$qty = intval($selectedShips[$shipId]);
if ($qty <= 0) {
continue;
}
if ($qty > $planetrow->getElement($shipId)) {
$page .= $lang['fl_noenought'];
$speedalls[$shipId] = GetFleetMaxSpeed("", $shipId, $user);
} else {
$fleetArray[$shipId] = $qty;
$session['qty'] += $qty;
$speedArray[$shipId] = GetFleetMaxSpeed("", $shipId, $user);
$consumptionArray[$shipId] = GetShipConsumption($shipId, $user);
$capacityArray[$shipId] = $pricelist[$shipId]['capacity'];
// Tableau des vitesses
$FleetHiddenBlock .= "<input type=\"hidden\" name=\"consumption[". $shipId ."]\" value=\"". GetShipConsumption($shipId, $user) ."\" />";
$FleetHiddenBlock .= "<input type=\"hidden\" name=\"speed[". $shipId ."]\" value=\"". GetFleetMaxSpeed("", $shipId, $user) ."\" />";
$FleetHiddenBlock .= "<input type=\"hidden\" name=\"capacity[". $shipId ."]\" value=\"". $pricelist[$shipId]['capacity'] ."\" />";
$FleetHiddenBlock .= "<input type=\"hidden\" name=\"ship[". $shipId ."]\" value=\"". $qty ."\" />";
$speedalls[$shipId] = GetFleetMaxSpeed("", $shipId, $user);
}
}
unset($selectedShips);
$session['fleet'] = $fleetArray;
$session['speed'] = $speedArray;
$session['consumption'] = $consumptionArray;
$session['capacity'] = $capacityArray;
if (empty($fleetArray)) {
message($lang['fl_unselectall'], $lang['fl_error'], "fleet." . PHPEXT, 1);
} else {
$speedallsmin = min($speedalls);
}
$speedFactor = GetGameSpeedFactor();
$session['speedallsmin'] = $speedallsmin;
$scriptPath = Legacies::getUrl('scripts/flotten.js');
$page .= "<script type=\"text/javascript\" src=\"{$scriptPath}\"></script>";
$page .= "<script type=\"text/javascript\">\n";
$page .= "function getStorageFaktor() {\n";
$page .= " return 1\n";
$page .= "}\n";
$page .= "</script>\n";
$page .= "<form action=\"floten2.php\" method=\"post\">";
$page .= $FleetHiddenBlock;
$page .= "<input type=\"hidden\" name=\"speedallsmin\" value=\"". $speedallsmin ."\" />";
$page .= "<input type=\"hidden\" name=\"thisgalaxy\" value=\"". $planetrow['galaxy'] ."\" />";
$page .= "<input type=\"hidden\" name=\"thissystem\" value=\"". $planetrow['system'] ."\" />";
$page .= "<input type=\"hidden\" name=\"thisplanet\" value=\"". $planetrow['planet'] ."\" />";
$page .= "<input type=\"hidden\" name=\"galaxyend\" value=\"". $g ."\" />";
$page .= "<input type=\"hidden\" name=\"systemend\" value=\"". $s ."\" />";
$page .= "<input type=\"hidden\" name=\"planetend\" value=\"". $p ."\" />";
$page .= "<input type=\"hidden\" name=\"speedfactor\" value=\"". $speedFactor ."\" />";
$page .= "<input type=\"hidden\" name=\"thisplanettype\" value=\"". $t ."\" />";
$page .= "<input type=\"hidden\" name=\"thisresource1\" value=\"". floor($planetrow['metal']) ."\" />";
$page .= "<input type=\"hidden\" name=\"thisresource2\" value=\"". floor($planetrow['crystal']) ."\" />";
$page .= "<input type=\"hidden\" name=\"thisresource3\" value=\"". floor($planetrow['deuterium']) ."\" />";
$page .= "<br><div><center>";
$page .= "<table width=\"519\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\">";
$page .= "<tr height=\"20\">";
$page .= "<td colspan=\"2\" class=\"c\">". $lang['fl_floten1_ttl'] ."</td>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<th width=\"50%\">". $lang['fl_dest'] ."</th>";
$page .= "<th>";
$page .= "<input name=\"galaxy\" size=\"3\" maxlength=\"2\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\" value=\"". $g ."\" />";
$page .= "<input name=\"system\" size=\"3\" maxlength=\"3\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\" value=\"". $s ."\" />";
$page .= "<input name=\"planet\" size=\"3\" maxlength=\"2\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\" value=\"". $p ."\" />";
$page .= "<select name=\"planettype\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\">";
$page .= "<option value=\"1\"". (($t == 1) ? " SELECTED" : "" ) .">". $lang['fl_planet'] ." </option>";
$page .= "<option value=\"2\"". (($t == 2) ? " SELECTED" : "" ) .">". $lang['fl_ruins'] ." </option>";
$page .= "<option value=\"3\"". (($t == 3) ? " SELECTED" : "" ) .">". $lang['fl_moon'] ." </option>";
$page .= "</select>";
$page .= "</th>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<th>". $lang['fl_speed'] ."</th>";
$page .= "<th>";
$page .= "<select name=\"speed\" onChange=\"shortInfo()\" onKeyUp=\"shortInfo()\">";
foreach ($speed as $a => $b) {
$page .= "<option value=\"".$a."\">".$b."</option>";
}
$page .= "</select> %";
$page .= "</th>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<th>". $lang['fl_dist'] ."</th>";
$page .= "<th><div id=\"distance\">-</div></th>";
$page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['fl_fltime'] ."</th>";
$page .= "<th><div id=\"duration\">-</div></th>";
$page .= "</tr><tr height=\"20\">";
/* A faire assez rapidement (faut juste savoir comment)
$page .= "<th>". $lang['fl_time_go'] ."</th>";
$page .= "<th><font color=\"lime\"><div id=\"llegada1\"><font>". gmdate("H:i:s") ."</font></div></font></th>";
$page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['fl_time_back'] ."</th>";
$page .= "<th><font color=\"lime\"><div id=\"llegada2\"><font>". gmdate("H:i:s") ."</font></div></font></th>";
$page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['fl_time_go'] ."</th>";
$page .= "<th><font color=\"lime\"><div id=\"llegada1\"><font>". gmdate("H:i:s") ."</font></div></font></th>";
$page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['fl_time_back'] ."</th>";
$page .= "<th><font color=\"lime\"><div id=\"llegada2\"><font>". gmdate("H:i:s") ."</font></div></font></th>";
$page .= "</tr><tr height=\"20\">";
*/
$page .= "<th>". $lang['fl_deute_need'] ."</th>";
$page .= "<th><div id=\"consumption\">-</div></th>";
$page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['fl_speed_max'] ."</th>";
$page .= "<th><div id=\"maxspeed\">-</div></th>";
$page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['fl_max_load'] ."</th>";
$page .= "<th><div id=\"storage\">-</div></th>";
$page .= "</tr>";
$page .= "<th>". $lang['fl_deute_need'] ."</th>";
$page .= "<th><div id=\"consumption\">-</div></th>";
$page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['fl_speed_max'] ."</th>";
$page .= "<th><div id=\"maxspeed\">-</div></th>";
$page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['fl_max_load'] ."</th>";
$page .= "<th><div id=\"storage\">-</div></th>";
$page .= "</tr>";
// Gestion des raccourcis sur la galaxie
$page .= "<tr height=\"20\">";
$page .= "<td colspan=\"2\" class=\"c\">". $lang['fl_shortcut'] ." <a href=\"fleetshortcut.php\">". $lang['fl_shortlnk'] ."</a></td>";
$page .= "</tr>";
if ($user['fleet_shortcut']) {
$scarray = explode("\r\n", $user['fleet_shortcut']);
$i = 0;
foreach ($scarray as $a => $b) {
if ($b != "") {
$c = explode(',', $b);
if ($i == 0) {
$page .= "<tr height=\"20\">";
}
$page .= "<th><a href=\"javascript:setTarget(". $c[1] .",". $c[2] .",". $c[3] .",". $c[4] ."); shortInfo();\"";
$page .= ">". $c[0] ." ". $c[1] .":". $c[2] .":". $c[3] ." ";
// Signalisation du type de raccourci ...
// (P)lanete
// (D)ebris
// (L)une
if ($c[4] == 1) {
$page .= $lang['fl_shrtcup1'];
} elseif ($c[4] == 2) {
$page .= $lang['fl_shrtcup2'];
} elseif ($c[4] == 3) {
$page .= $lang['fl_shrtcup3'];
}
$page .= "</a></th>";
if ($i == 1) {
$page .= "</tr>";
}
if ($i == 1) {
$i = 0;
} else {
$i = 1;
}
}
}
if ($i == 1) {
$page .= "<th></th></tr>";
}
} else {
$page .= "<tr height=\"20\">";
$page .= "<th colspan=\"2\">". $lang['fl_noshortc'] ."</th>";
$page .= "</tr>";
}
// Gestion des raccourcis sur la galaxie
$page .= "<tr height=\"20\">";
$page .= "<td colspan=\"2\" class=\"c\">". $lang['fl_shortcut'] ." <a href=\"fleetshortcut.php\">". $lang['fl_shortlnk'] ."</a></td>";
$page .= "</tr>";
if ($user['fleet_shortcut']) {
$scarray = explode("\r\n", $user['fleet_shortcut']);
$i = 0;
foreach ($scarray as $a => $b) {
if ($b != "") {
$c = explode(',', $b);
if ($i == 0) {
$page .= "<tr height=\"20\">";
}
$page .= "<th><a href=\"javascript:setTarget(". $c[1] .",". $c[2] .",". $c[3] .",". $c[4] ."); shortInfo();\"";
$page .= ">". $c[0] ." ". $c[1] .":". $c[2] .":". $c[3] ." ";
// Signalisation du type de raccourci ...
// (P)lanete
// (D)ebris
// (L)une
if ($c[4] == 1) {
$page .= $lang['fl_shrtcup1'];
} elseif ($c[4] == 2) {
$page .= $lang['fl_shrtcup2'];
} elseif ($c[4] == 3) {
$page .= $lang['fl_shrtcup3'];
}
$page .= "</a></th>";
if ($i == 1) {
$page .= "</tr>";
}
if ($i == 1) {
$i = 0;
} else {
$i = 1;
}
}
}
if ($i == 1) {
$page .= "<th></th></tr>";
}
} else {
$page .= "<tr height=\"20\">";
$page .= "<th colspan=\"2\">". $lang['fl_noshortc'] ."</th>";
$page .= "</tr>";
}
$page .= "<tr height=\"20\">";
$page .= "<td colspan=\"2\" class=\"c\">". $lang['fl_myplanets'] ."</td>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<td colspan=\"2\" class=\"c\">". $lang['fl_myplanets'] ."</td>";
$page .= "</tr>";
// Gestion des raccourcis vers ses propres colonies ou planetes
$kolonien = SortUserPlanets ( $user );
$currentplanet = doquery("SELECT * FROM {{table}} WHERE id = '" . $user['current_planet'] . "'", 'planets', true);
// Gestion des raccourcis vers ses propres colonies ou planetes
$kolonien = SortUserPlanets ( $user );
$currentplanet = doquery("SELECT * FROM {{table}} WHERE id = '" . $user['current_planet'] . "'", 'planets', true);
if (mysql_num_rows($kolonien) > 1) {
$i = 0;
$w = 0;
$tr = true;
while ($row = $kolonien->fetch(PDO::FETCH_BOTH)) {
if ($w == 0 && $tr) {
$page .= "<tr height=\"20\">";
$tr = false;
}
if ($w == 2) {
$page .= "</tr>";
$w = 0;
$tr = true;
}
if ($kolonien->rowCount() > 1) {
$i = 0;
$w = 0;
$tr = true;
while ($row = $kolonien->fetch(PDO::FETCH_BOTH)) {
if ($w == 0 && $tr) {
$page .= "<tr height=\"20\">";
$tr = false;
}
if ($w == 2) {
$page .= "</tr>";
$w = 0;
$tr = true;
}
if ($row['planet_type'] == 3) {
$row['name'] .= " ". $lang['fl_shrtcup3'];
}
if ($row['planet_type'] == 3) {
$row['name'] .= " ". $lang['fl_shrtcup3'];
}
if ($currentplanet['galaxy'] == $row['galaxy'] &&
$currentplanet['system'] == $row['system'] &&
$currentplanet['planet'] == $row['planet'] &&
$currentplanet['planet_type'] == $row['planet_type'] ) {
// $page .= '<th><a href="javascript:setTarget('.$row['galaxy'].','.$row['system'].','.$row['planet'].','.$row['planet_type'].'); shortInfo();">'.$row['name'].' '.$row['galaxy'].':'.$row['system'].':'.$row['planet'].'</a></th>';
} else {
$page .= "<th><a href=\"javascript:setTarget(". $row['galaxy'] .",". $row['system'] .",". $row['planet'] .",". $row['planet_type'] ."); shortInfo();\">". $row['name'] ." ". $row['galaxy'] .":". $row['system'] .":". $row['planet'] ."</a></th>";
$w++;
$i++;
}
}
if ($currentplanet['galaxy'] == $row['galaxy'] &&
$currentplanet['system'] == $row['system'] &&
$currentplanet['planet'] == $row['planet'] &&
$currentplanet['planet_type'] == $row['planet_type'] ) {
// $page .= '<th><a href="javascript:setTarget('.$row['galaxy'].','.$row['system'].','.$row['planet'].','.$row['planet_type'].'); shortInfo();">'.$row['name'].' '.$row['galaxy'].':'.$row['system'].':'.$row['planet'].'</a></th>';
} else {
$page .= "<th><a href=\"javascript:setTarget(". $row['galaxy'] .",". $row['system'] .",". $row['planet'] .",". $row['planet_type'] ."); shortInfo();\">". $row['name'] ." ". $row['galaxy'] .":". $row['system'] .":". $row['planet'] ."</a></th>";
$w++;
$i++;
}
}
if ($i % 2 != 0) {
$page .= "<th>&nbsp;</th></tr>";
} elseif ($w == 2) {
$page .= "</tr>";
}
} else {
$page .= "<th colspan=\"2\">". $lang['fl_nocolonies'] ."</th>";
}
if ($i % 2 != 0) {
$page .= "<th>&nbsp;</th></tr>";
} elseif ($w == 2) {
$page .= "</tr>";
}
} else {
$page .= "<th colspan=\"2\">". $lang['fl_nocolonies'] ."</th>";
}
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<td colspan=\"2\" class=\"c\">". $lang['fl_grattack'] ."</td>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<th colspan=\"2\">-</th>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<th colspan=\"2\"><input type=\"submit\" value=\"". $lang['fl_continue'] ."\" /></th>";
$page .= "</tr>";
$page .= "</table>";
$page .= "</div></center>";
$page .= "<input type=\"hidden\" name=\"maxepedition\" value=\"". $_POST['maxepedition'] ."\" />";
$page .= "<input type=\"hidden\" name=\"curepedition\" value=\"". $_POST['curepedition'] ."\" />";
$page .= "<input type=\"hidden\" name=\"target_mission\" value=\"". $target_mission ."\" />";
$page .= "</form>";
$page .= "<script>javascript:shortInfo(); </script>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<td colspan=\"2\" class=\"c\">". $lang['fl_grattack'] ."</td>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<th colspan=\"2\">-</th>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<th colspan=\"2\"><input type=\"submit\" value=\"". $lang['fl_continue'] ."\" /></th>";
$page .= "</tr>";
$page .= "</table>";
$page .= "</div></center>";
display($page, $lang['fl_title']);
$maxExpedition = $user->getElement(Legacies_Empire::ID_RESEARCH_EXPEDITION_TECHNOLOGY);
$ExpeditionEnCours = 0;
$EnvoiMaxExpedition = 0;
if ($maxExpedition >= 1) {
$maxexpde = doquery("SELECT 1 FROM {{table}} WHERE `fleet_owner` = '".$user['id']."' AND `fleet_mission` = '15';", 'fleets');
$ExpeditionEnCours = $maxexpde->rowCount();
$maxexpde->closeCursor();
$EnvoiMaxExpedition = 1 + floor($maxExpedition / 3);
}
$page .= "<input type=\"hidden\" name=\"maxepedition\" value=\"". $maxExpedition ."\" />";
$page .= "<input type=\"hidden\" name=\"curepedition\" value=\"". $ExpeditionEnCours ."\" />";
$page .= "<input type=\"hidden\" name=\"target_mission\" value=\"". $target_mission ."\" />";
$page .= "</form>";
$page .= "<script>javascript:shortInfo(); </script>";
display($page, $lang['fl_title']);
// Updated by Chlorel. 16 Jan 2008 (String extraction, bug corrections, code uniformisation
// Created by Perberos. All rights reversed (C) 2006
?>

View file

@ -31,251 +31,280 @@
define('INSIDE' , true);
define('INSTALL' , false);
require_once dirname(__FILE__) .'/common.php';
includeLang('fleet');
includeLang('fleet');
$galaxy = intval($_POST['galaxy']);
$system = intval($_POST['system']);
$planet = intval($_POST['planet']);
$planettype = intval($_POST['planettype']);
$session = Legacies::getSession('fleet');
// Test d'existance et de proprieté de la planete
$YourPlanet = false;
$UsedPlanet = false;
$select = doquery("SELECT * FROM {{table}}", "planets");
$galaxy = isset($_POST['galaxy']) ? intval($_POST['galaxy']) : 0;
$system = isset($_POST['system']) ? intval($_POST['system']) : 0;
$planet = isset($_POST['planet']) ? intval($_POST['planet']) : 0;
$planettype = isset($_POST['planettype']) ? intval($_POST['planettype']) : 0;
$speed = isset($_POST['speed']) ? intval($_POST['speed']) : 10;
while ($row = $select->fetch(PDO::FETCH_BOTH)) {
if ($galaxy == $row['galaxy'] &&
$system == $row['system'] &&
$planet == $row['planet'] &&
$planettype == $row['planet_type']) {
if ($row['id_owner'] == $user['id']) {
$YourPlanet = true;
$UsedPlanet = true;
} else {
$UsedPlanet = true;
}
break;
}
}
$coords = array(
'galaxy' => $galaxy,
'system' => $system,
'position' => $planet
);
$destination = Legacies_Empire_Model_Planet::factoryFromCoords($coords, $planettype);
$session['planet_destination'] = $destination->getId();
// Determinons les type de missions possibles par rapport a la planete cible
if ($_POST['planettype'] == "2") {
if ($_POST['ship209'] >= 1) {
$missiontype = array(8 => $lang['type_mission'][8]);
} else {
$missiontype = array();
}
} elseif ($_POST['planettype'] == "1" || $_POST['planettype'] == "3") {
if ($_POST['ship208'] >= 1 && !$UsedPlanet) {
$missiontype = array(7 => $lang['type_mission'][7]);
} elseif ($_POST['ship210'] >= 1 && !$YourPlanet) {
$missiontype = array(6 => $lang['type_mission'][6]);
}
$user = Legacies_Empire_Model_User::getSingleton();
$planetrow = $user->getCurrentPlanet();
if ($_POST['ship202'] >= 1 ||
$_POST['ship203'] >= 1 ||
$_POST['ship204'] >= 1 ||
$_POST['ship205'] >= 1 ||
$_POST['ship206'] >= 1 ||
$_POST['ship207'] >= 1 ||
$_POST['ship210'] >= 1 ||
$_POST['ship211'] >= 1 ||
$_POST['ship213'] >= 1 ||
$_POST['ship214'] >= 1 ||
$_POST['ship215'] >= 1 ||
$_POST['ship216'] >= 1) {
if (!$YourPlanet) {
$missiontype[1] = $lang['type_mission'][1];
$missiontype[5] = $lang['type_mission'][5];
}
$missiontype[3] = $lang['type_mission'][3];
}
$YourPlanet = false;
if ($destination->getUserId() == $user->getId()) {
$YourPlanet = true;
}
$UsedPlanet = false;
if ($destination->getId()) {
$UsedPlanet = true;
}
$fleetArray = $session['fleet'];
} elseif ($_POST['ship209'] >= 1 || $_POST['ship208'] >= 1) {
$missiontype[3] = $lang['type_mission'][3];
}
if ($YourPlanet)
$missiontype[4] = $lang['type_mission'][4];
$missionTypes = array();
// Determinons les type de missions possibles par rapport a la planete cible
if ( $_POST['planettype'] == 3 &&
($_POST['ship214'] ||
$_POST['ship213']) &&
!$YourPlanet &&
$UsedPlanet) {
$missiontype[2] = $lang['type_mission'][2];
}
if ( $_POST['planettype'] == 3 &&
($_POST['ship214'] >= 1 || $_POST['ship216'] >= 1) &&
!$YourPlanet &&
$UsedPlanet) {
$missiontype[9] = $lang['type_mission'][9];
}
if ($position == (MAX_PLANET_IN_SYSTEM + 1)) {
$missionTypes[Legacies_Empire::ID_MISSION_EXPEDITION] = $lang['type_mission'][Legacies_Empire::ID_MISSION_EXPEDITION];
} else {
if ($planettype == Legacies_Empire_Model_Planet::TYPE_DEBRIS) {
if (isset($fleetArray[Legacies_Empire::ID_SHIP_RECYCLER]) && $fleetArray[Legacies_Empire::ID_SHIP_RECYCLER] > 0) {
$missionTypes[Legacies_Empire::ID_MISSION_RECYCLE] = $lang['type_mission'][Legacies_Empire::ID_MISSION_RECYCLE];
}
} else if ($planettype == Legacies_Empire_Model_Planet::TYPE_PLANET) {
if (isset($fleetArray[Legacies_Empire::ID_SHIP_COLONY_SHIP]) && $fleetArray[Legacies_Empire::ID_SHIP_COLONY_SHIP] > 0 && !$UsedPlanet) {
$missionTypes[Legacies_Empire::ID_MISSION_SETTLE_COLONY] = $lang['type_mission'][7];
}
} else if ($planettype == Legacies_Empire_Model_Planet::TYPE_MOON) {
if (((isset($fleetArray[Legacies_Empire::ID_SHIP_DEATH_STAR]) && $fleetArray[Legacies_Empire::ID_SHIP_DEATH_STAR] > 0) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_SUPERNOVA]) && $fleetArray[Legacies_Empire::ID_SHIP_SUPERNOVA] > 0)) &&
!$YourPlanet && $UsedPlanet) {
$missionTypes[Legacies_Empire::ID_MISSION_DESTROY] = $lang['type_mission'][Legacies_Empire::ID_MISSION_DESTROY];
}
}
$fleetarray = unserialize(base64_decode(str_rot13($_POST["usedfleet"])));
$mission = $_POST['target_mission'];
$SpeedFactor = $_POST['speedfactor'];
$AllFleetSpeed = GetFleetMaxSpeed ($fleetarray, 0, $user);
$GenFleetSpeed = $_POST['speed'];
$MaxFleetSpeed = min($AllFleetSpeed);
if (in_array($planettype, array(Legacies_Empire_Model_Planet::TYPE_MOON, Legacies_Empire_Model_Planet::TYPE_PLANET))) {
if (isset($fleetArray[Legacies_Empire::ID_SHIP_SPY_DRONE]) && $fleetArray[Legacies_Empire::ID_SHIP_SPY_DRONE] > 0 && !$YourPlanet) {
$missionTypes[Legacies_Empire::ID_MISSION_SPY] = $lang['type_mission'][Legacies_Empire::ID_MISSION_SPY];
}
$distance = GetTargetDistance ( $_POST['thisgalaxy'], $_POST['galaxy'], $_POST['thissystem'], $_POST['system'], $_POST['thisplanet'], $_POST['planet'] );
$duration = GetMissionDuration ( $GenFleetSpeed, $MaxFleetSpeed, $distance, $SpeedFactor );
$consumption = GetFleetConsumption ( $fleetarray, $SpeedFactor, $duration, $distance, $MaxFleetSpeed, $user );
if ((isset($fleetArray[Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT]) && $fleetArray[Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT] > 0) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_LARGE_TRANSPORT]) && $fleetArray[Legacies_Empire::ID_SHIP_LARGE_TRANSPORT] > 0) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_LIGHT_FIGHTER]) && $fleetArray[Legacies_Empire::ID_SHIP_LIGHT_FIGHTER] > 0) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_HEAVY_FIGHTER]) && $fleetArray[Legacies_Empire::ID_SHIP_HEAVY_FIGHTER] > 0) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_CRUISER]) && $fleetArray[Legacies_Empire::ID_SHIP_CRUISER] > 0) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_BATTLESHIP]) && $fleetArray[Legacies_Empire::ID_SHIP_BATTLESHIP] > 0) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_COLONY_SHIP]) && $fleetArray[Legacies_Empire::ID_SHIP_COLONY_SHIP] > 0) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_RECYCLER]) && $fleetArray[Legacies_Empire::ID_SHIP_RECYCLER] > 0) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_SPY_DRONE]) && $fleetArray[Legacies_Empire::ID_SHIP_SPY_DRONE] > 0 && ALLOW_SPY_DRONE_ATTACKS) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_BOMBER]) && $fleetArray[Legacies_Empire::ID_SHIP_BOMBER] > 0) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_DESTRUCTOR]) && $fleetArray[Legacies_Empire::ID_SHIP_DESTRUCTOR] > 0) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_DEATH_STAR]) && $fleetArray[Legacies_Empire::ID_SHIP_DEATH_STAR] > 0) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_BATTLECRUISER]) && $fleetArray[Legacies_Empire::ID_SHIP_BATTLECRUISER] > 0) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_SUPERNOVA]) && $fleetArray[Legacies_Empire::ID_SHIP_SUPERNOVA] > 0)) {
$MissionSelector = "";
if (count($missiontype) > 0) {
if ($planet == 16) {
$MissionSelector .= "<tr height=\"20\">";
$MissionSelector .= "<th>";
$MissionSelector .= "<input type=\"radio\" name=\"mission\" value=\"15\" checked=\"checked\">". $lang['type_mission'][15] ."<br /><br />";
$MissionSelector .= "<font color=\"red\">". $lang['fl_expe_warning'] ."</font>";
$MissionSelector .= "</th>";
$MissionSelector .= "</tr>";
} else {
$i = 0;
foreach ($missiontype as $a => $b) {
$MissionSelector .= "<tr height=\"20\">";
$MissionSelector .= "<th>";
$MissionSelector .= "<input id=\"inpuT_".$i."\" type=\"radio\" name=\"mission\" value=\"".$a."\"". ($mission == $a ? " checked=\"checked\"":"") .">";
$MissionSelector .= "<label for=\"inpuT_".$i."\">".$b."</label><br>";
$MissionSelector .= "</th>";
$MissionSelector .= "</tr>";
$i++;
}
}
} else {
$MissionSelector .= "<tr height=\"20\">";
$MissionSelector .= "<th>";
$MissionSelector .= "<font color=\"red\">". $lang['fl_bad_mission'] ."</font>";
$MissionSelector .= "</th>";
$MissionSelector .= "</tr>";
}
if (!$YourPlanet) {
$missionTypes[Legacies_Empire::ID_MISSION_ATTACK] = $lang['type_mission'][Legacies_Empire::ID_MISSION_ATTACK];
$missionTypes[Legacies_Empire::ID_MISSION_GROUP_ATTACK] = $lang['type_mission'][Legacies_Empire::ID_MISSION_GROUP_ATTACK];
$missionTypes[Legacies_Empire::ID_MISSION_STATION_ALLY] = $lang['type_mission'][Legacies_Empire::ID_MISSION_STATION_ALLY];
}
$missionTypes[Legacies_Empire::ID_MISSION_TRANSPORT] = $lang['type_mission'][Legacies_Empire::ID_MISSION_TRANSPORT];
}
if ($_POST['thisplanettype'] == 1) {
$TableTitle = "". $_POST['thisgalaxy'] .":". $_POST['thissystem'] .":". $_POST['thisplanet'] ." - ". $lang['fl_planet'] ."";
} elseif ($_POST['thisplanettype'] == 3) {
$TableTitle = "". $_POST['thisgalaxy'] .":". $_POST['thissystem'] .":". $_POST['thisplanet'] ." - ". $lang['fl_moon'] ."";
}
if ($YourPlanet) {
$missionTypes[Legacies_Empire::ID_MISSION_STATION] = $lang['type_mission'][Legacies_Empire::ID_MISSION_STATION];
}
}
}
$page = "<script type=\"text/javascript\" src=\"scripts/flotten.js\">\n</script>";
$page .= "<script type=\"text/javascript\">\n";
$page .= "function getStorageFaktor() {\n";
$page .= " return 1;\n";
$page .= "}\n";
$page .= "</script>\n";
$page .= "<br><center>";
$page .= "<form action=\"floten3.php\" method=\"post\">\n";
$page .= "<input type=\"hidden\" name=\"thisresource1\" value=\"". floor($planetrow["metal"]) ."\" />\n";
$page .= "<input type=\"hidden\" name=\"thisresource2\" value=\"". floor($planetrow["crystal"]) ."\" />\n";
$page .= "<input type=\"hidden\" name=\"thisresource3\" value=\"". floor($planetrow["deuterium"]) ."\" />\n";
$page .= "<input type=\"hidden\" name=\"consumption\" value=\"". $consumption ."\" />\n";
$page .= "<input type=\"hidden\" name=\"dist\" value=\"". $distance ."\" />\n";
$page .= "<input type=\"hidden\" name=\"speedfactor\" value=\"". $_POST['speedfactor'] ."\" />\n";
$page .= "<input type=\"hidden\" name=\"thisgalaxy\" value=\"". $_POST["thisgalaxy"] ."\" />\n";
$page .= "<input type=\"hidden\" name=\"thissystem\" value=\"". $_POST["thissystem"] ."\" />\n";
$page .= "<input type=\"hidden\" name=\"thisplanet\" value=\"". $_POST["thisplanet"] ."\" />\n";
$page .= "<input type=\"hidden\" name=\"galaxy\" value=\"". $_POST["galaxy"] ."\" />\n";
$page .= "<input type=\"hidden\" name=\"system\" value=\"". $_POST["system"] ."\" />\n";
$page .= "<input type=\"hidden\" name=\"planet\" value=\"". $_POST["planet"] ."\" />\n";
$page .= "<input type=\"hidden\" name=\"thisplanettype\" value=\"". $_POST["thisplanettype"] ."\" />\n";
$page .= "<input type=\"hidden\" name=\"planettype\" value=\"". $_POST["planettype"] ."\" />\n";
$page .= "<input type=\"hidden\" name=\"speedallsmin\" value=\"". $_POST["speedallsmin"] ."\" />\n";
$page .= "<input type=\"hidden\" name=\"speed\" value=\"". $_POST['speed'] ."\" />\n";
$page .= "<input type=\"hidden\" name=\"speedfactor\" value=\"". $_POST["speedfactor"] ."\" />\n";
$page .= "<input type=\"hidden\" name=\"usedfleet\" value=\"". $_POST["usedfleet"] ."\" />\n";
$page .= "<input type=\"hidden\" name=\"maxepedition\" value=\"". $_POST['maxepedition'] ."\" />\n";
$page .= "<input type=\"hidden\" name=\"curepedition\" value=\"". $_POST['curepedition'] ."\" />\n";
foreach ($fleetarray as $Ship => $Count) {
$page .= "<input type=\"hidden\" name=\"ship". $Ship ."\" value=\"". $Count ."\" />\n";
$page .= "<input type=\"hidden\" name=\"capacity". $Ship ."\" value=\"". $pricelist[$Ship]['capacity'] ."\" />\n";
$page .= "<input type=\"hidden\" name=\"consumption". $Ship ."\" value=\"". GetShipConsumption ( $Ship, $user ) ."\" />\n";
$page .= "<input type=\"hidden\" name=\"speed". $Ship ."\" value=\"". GetFleetMaxSpeed ( "", $Ship, $user ) ."\" />\n";
if (isset($fleetArray[Legacies_Empire::ID_SHIP_SOLAR_SATELLITE])) {
$missionTypes = array();
}
}
$page .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"519\">\n";
$page .= "<tbody>\n";
$page .= "<tr align=\"left\" height=\"20\">\n";
$page .= "<td class=\"c\" colspan=\"2\">". $TableTitle ."</td>\n";
$page .= "</tr>\n";
$page .= "<tr align=\"left\" valign=\"top\">\n";
$page .= "<th width=\"50%\">\n";
$page .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"259\">\n";
$page .= "<tbody>\n";
$page .= "<tr height=\"20\">\n";
$page .= "<td class=\"c\" colspan=\"2\">". $lang['fl_mission'] ."</td>\n";
$page .= "</tr>\n";
$page .= $MissionSelector;
$page .= "</tbody>\n";
$page .= "</table>\n";
$page .= "</th>\n";
$page .= "<th>\n";
$page .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"259\">\n";
$page .= "<tbody>\n";
$page .= "<tr height=\"20\">\n";
$page .= "<td colspan=\"3\" class=\"c\">". $lang['fl_ressources'] ."</td>\n";
$page .= "</tr><tr height=\"20\">\n";
$page .= "<th>". $lang['Metal'] ."</th>\n";
$page .= "<th><a href=\"javascript:maxResource('1');\">". $lang['fl_selmax'] ."</a></th>\n";
$page .= "<th><input name=\"resource1\" alt=\"". $lang['Metal'] ." ". floor($planetrow["metal"]) ."\" size=\"10\" onchange=\"calculateTransportCapacity();\" type=\"text\"></th>\n";
$page .= "</tr><tr height=\"20\">\n";
$page .= "<th>". $lang['Crystal'] ."</th>\n";
$page .= "<th><a href=\"javascript:maxResource('2');\">". $lang['fl_selmax'] ."</a></th>\n";
$page .= "<th><input name=\"resource2\" alt=\"". $lang['Crystal'] ." ". floor($planetrow["crystal"]) ."\" size=\"10\" onchange=\"calculateTransportCapacity();\" type=\"text\"></th>\n";
$page .= "</tr><tr height=\"20\">\n";
$page .= "<th>". $lang['Deuterium'] ."</th>\n";
$page .= "<th><a href=\"javascript:maxResource('3');\">". $lang['fl_selmax'] ."</a></th>\n";
$page .= "<th><input name=\"resource3\" alt=\"". $lang['Deuterium'] ." ". floor($planetrow["deuterium"]) ."\" size=\"10\" onchange=\"calculateTransportCapacity();\" type=\"text\"></th>\n";
$page .= "</tr><tr height=\"20\">\n";
$page .= "<th>". $lang['fl_space_left'] ."</th>\n";
$page .= "<th colspan=\"2\"><div id=\"remainingresources\">-</div></th>\n";
$page .= "</tr><tr height=\"20\">\n";
$page .= "<th colspan=\"3\"><a href=\"javascript:maxResources()\">". $lang['fl_allressources'] ."</a></th>\n";
$page .= "</tr><tr height=\"20\">\n";
$page .= "<th colspan=\"3\">&nbsp;</th>\n";
$page .= "</tr>\n";
if ($planet == 16) {
$page .= "<tr height=\"20\">";
$page .= "<td class=\"c\" colspan=\"3\">". $lang['fl_expe_staytime'] ."</td>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<th colspan=\"3\">";
$page .= "<select name=\"expeditiontime\" >";
$page .= "<option value=\"1\">1</option>";
$page .= "<option value=\"2\">2</option>";
$page .= "</select>";
$page .= $lang['fl_expe_hours'];
$page .= "</th>";
$page .= "</tr>";
} elseif ( $missiontype[5] != '' ) {
$page .= "<tr height=\"20\">";
$page .= "<td class=\"c\" colspan=\"3\">". $lang['fl_expe_staytime'] ."</td>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<th colspan=\"3\">";
$page .= "<select name=\"holdingtime\" >";
$page .= "<option value=\"0\">0</option>";
$page .= "<option value=\"1\">1</option>";
$page .= "<option value=\"2\">2</option>";
$page .= "<option value=\"4\">4</option>";
$page .= "<option value=\"8\">8</option>";
$page .= "<option value=\"16\">16</option>";
$page .= "<option value=\"32\">32</option>";
$page .= "</select>";
$page .= $lang['fl_expe_hours'];
$page .= "</th>";
$page .= "</tr>";
}
$page .= "</tbody>\n";
$page .= "</table>\n";
$page .= "</th>\n";
$page .= "</tr><tr height=\"20\">\n";
$page .= "<th colspan=\"2\"><input accesskey=\"z\" value=\"". $lang['fl_continue'] ."\" type=\"submit\"></th>\n";
$page .= "</tr>\n";
$page .= "</tbody>\n";
$page .= "</table>\n";
$page .= "</form></center>\n";
$mission = isset($_POST['target_mission']) ? $_POST['target_mission'] : 0;
display($page, $lang['fl_title']);
$SpeedFactor = GetGameSpeedFactor();
$AllFleetSpeed = GetFleetMaxSpeed($fleetArray, 0, $user);
$MaxFleetSpeed = min($AllFleetSpeed);
?>
$distance = GetTargetDistance($planetrow->getGalaxy(), $galaxy, $planetrow->getSystem(), $system, $planetrow->getPosition(), $planet);
$duration = GetMissionDuration($speed, $MaxFleetSpeed, $distance, $SpeedFactor);
$consumption = GetFleetConsumption($fleetArray, $SpeedFactor, $duration, $distance, $MaxFleetSpeed, $user );
$session['distance'] = $distance;
$session['duration'] = $duration;
$session['consumption'] = $consumption;
$session['speed'] = $speed;
$session['galaxy'] = $galaxy;
$session['system'] = $system;
$session['position'] = $planet;
$session['type'] = $planettype;
$MissionSelector = "";
if (count($missionTypes) > 0) {
if ($planet == (MAX_PLANET_IN_SYSTEM + 1)) {
$MissionSelector .= "<tr height=\"20\">";
$MissionSelector .= "<th>";
$MissionSelector .= "<input type=\"radio\" name=\"mission\" value=\"15\" checked=\"checked\">". $lang['type_mission'][Legacies_Empire::ID_MISSION_EXPEDITION] ."<br /><br />";
$MissionSelector .= "<font color=\"red\">". $lang['fl_expe_warning'] ."</font>";
$MissionSelector .= "</th>";
$MissionSelector .= "</tr>";
} else {
$i = 0;
foreach ($missionTypes as $a => $b) {
$MissionSelector .= "<tr height=\"20\">";
$MissionSelector .= "<th>";
$MissionSelector .= "<input id=\"inpuT_".$i."\" type=\"radio\" name=\"mission\" value=\"".$a."\"". ($mission == $a ? " checked=\"checked\"":"") .">";
$MissionSelector .= "<label for=\"inpuT_".$i."\">".$b."</label><br>";
$MissionSelector .= "</th>";
$MissionSelector .= "</tr>";
$i++;
}
}
} else {
$MissionSelector .= "<tr height=\"20\">";
$MissionSelector .= "<th>";
$MissionSelector .= "<font color=\"red\">". $lang['fl_bad_mission'] ."</font>";
$MissionSelector .= "</th>";
$MissionSelector .= "</tr>";
}
if ($planetrow->isPlanet()) {
$TableTitle = "{$planetrow->getCoords()} - {$lang['fl_planet']}";
} elseif ($planetrow->isMoon()) {
$TableTitle = "{$planetrow->getCoords()} - {$lang['fl_moon']}";
}
$maxExpedition = $user->getElement(Legacies_Empire::ID_RESEARCH_EXPEDITION_TECHNOLOGY);
$ExpeditionEnCours = 0;
$EnvoiMaxExpedition = 0;
if ($maxExpedition >= 1) {
$maxexpde = doquery("SELECT 1 FROM {{table}} WHERE `fleet_owner` = '".$user['id']."' AND `fleet_mission` = '15';", 'fleets');
$ExpeditionEnCours = $maxexpde->rowCount();
$maxexpde->closeCursor();
$EnvoiMaxExpedition = 1 + floor($maxExpedition / 3);
}
$maxfleet = doquery("SELECT 1 FROM {{table}} WHERE `fleet_owner` = '".$user['id']."';", 'fleets');
$MaxFlyingFleets = $maxfleet->rowCount();
$maxfleet->closeCursor();
$page = "<script type=\"text/javascript\" src=\"scripts/flotten.js\">\n</script>";
$page .= "<script type=\"text/javascript\">\n";
$page .= "function getStorageFaktor() {\n";
$page .= " return 1;\n";
$page .= "}\n";
$page .= "</script>\n";
$page .= "<br><center>";
$page .= "<form action=\"floten3.php\" method=\"post\">\n";
$page .= "<input type=\"hidden\" name=\"consumption\" value=\"". $consumption ."\" />\n";
$page .= "<input type=\"hidden\" name=\"dist\" value=\"". $distance ."\" />\n";
$page .= "<input type=\"hidden\" name=\"speedfactor\" value=\"". $SpeedFactor ."\" />\n";
$page .= "<input type=\"hidden\" name=\"thisgalaxy\" value=\"". $planetrow->getGalaxy() ."\" />\n";
$page .= "<input type=\"hidden\" name=\"thissystem\" value=\"". $planetrow->getSystem() ."\" />\n";
$page .= "<input type=\"hidden\" name=\"thisplanet\" value=\"". $planetrow->getPosition() ."\" />\n";
$page .= "<input type=\"hidden\" name=\"galaxy\" value=\"". $galaxy ."\" />\n";
$page .= "<input type=\"hidden\" name=\"system\" value=\"". $system ."\" />\n";
$page .= "<input type=\"hidden\" name=\"planet\" value=\"". $planet ."\" />\n";
$page .= "<input type=\"hidden\" name=\"thisplanettype\" value=\"". $planetrow->getType() ."\" />\n";
$page .= "<input type=\"hidden\" name=\"planettype\" value=\"". $planettype ."\" />\n";
$page .= "<input type=\"hidden\" name=\"speedallsmin\" value=\"". $session['speedallsmin'] ."\" />\n";
$page .= "<input type=\"hidden\" name=\"speed\" value=\"". $speed ."\" />\n";
$page .= "<input type=\"hidden\" name=\"usedfleet\" value=\"". $MaxFlyingFleets ."\" />\n";
$page .= "<input type=\"hidden\" name=\"maxepedition\" value=\"". $maxExpedition ."\" />\n";
$page .= "<input type=\"hidden\" name=\"curepedition\" value=\"". $ExpeditionEnCours ."\" />\n";
foreach ($fleetArray as $shipId => $count) {
$page .= "<input type=\"hidden\" name=\"ship[". $shipId ."]\" value=\"". $count ."\" />\n";
$page .= "<input type=\"hidden\" name=\"capacity[". $shipId ."]\" value=\"". $pricelist[$shipId]['capacity'] ."\" />\n";
$page .= "<input type=\"hidden\" name=\"consumption[". $shipId ."]\" value=\"". GetShipConsumption($shipId, $user) ."\" />\n";
$page .= "<input type=\"hidden\" name=\"speed[". $shipId ."]\" value=\"". GetFleetMaxSpeed(array(), $shipId, $user) ."\" />\n";
}
$page .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"519\">\n";
$page .= "<tbody>\n";
$page .= "<tr align=\"left\" height=\"20\">\n";
$page .= "<td class=\"c\" colspan=\"2\">". $TableTitle ."</td>\n";
$page .= "</tr>\n";
$page .= "<tr align=\"left\" valign=\"top\">\n";
$page .= "<th width=\"50%\">\n";
$page .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"259\">\n";
$page .= "<tbody>\n";
$page .= "<tr height=\"20\">\n";
$page .= "<td class=\"c\" colspan=\"2\">". $lang['fl_mission'] ."</td>\n";
$page .= "</tr>\n";
$page .= $MissionSelector;
$page .= "</tbody>\n";
$page .= "</table>\n";
$page .= "</th>\n";
$page .= "<th>\n";
$page .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"259\">\n";
$page .= "<tbody>\n";
$page .= "<tr height=\"20\">\n";
$page .= "<td colspan=\"3\" class=\"c\">". $lang['fl_ressources'] ."</td>\n";
$page .= "</tr><tr height=\"20\">\n";
$page .= "<th>". $lang['Metal'] ."</th>\n";
$page .= "<th><a href=\"javascript:maxResource('1');\">". $lang['fl_selmax'] ."</a></th>\n";
$page .= "<th><input name=\"resource1\" alt=\"". $lang['Metal'] ." ". floor($planetrow["metal"]) ."\" size=\"10\" onchange=\"calculateTransportCapacity();\" type=\"text\"></th>\n";
$page .= "</tr><tr height=\"20\">\n";
$page .= "<th>". $lang['Crystal'] ."</th>\n";
$page .= "<th><a href=\"javascript:maxResource('2');\">". $lang['fl_selmax'] ."</a></th>\n";
$page .= "<th><input name=\"resource2\" alt=\"". $lang['Crystal'] ." ". floor($planetrow["crystal"]) ."\" size=\"10\" onchange=\"calculateTransportCapacity();\" type=\"text\"></th>\n";
$page .= "</tr><tr height=\"20\">\n";
$page .= "<th>". $lang['Deuterium'] ."</th>\n";
$page .= "<th><a href=\"javascript:maxResource('3');\">". $lang['fl_selmax'] ."</a></th>\n";
$page .= "<th><input name=\"resource3\" alt=\"". $lang['Deuterium'] ." ". floor($planetrow["deuterium"]) ."\" size=\"10\" onchange=\"calculateTransportCapacity();\" type=\"text\"></th>\n";
$page .= "</tr><tr height=\"20\">\n";
$page .= "<th>". $lang['fl_space_left'] ."</th>\n";
$page .= "<th colspan=\"2\"><div id=\"remainingresources\">-</div></th>\n";
$page .= "</tr><tr height=\"20\">\n";
$page .= "<th colspan=\"3\"><a href=\"javascript:maxResources()\">". $lang['fl_allressources'] ."</a></th>\n";
$page .= "</tr><tr height=\"20\">\n";
$page .= "<th colspan=\"3\">&nbsp;</th>\n";
$page .= "</tr>\n";
if ($planet == (MAX_PLANET_IN_SYSTEM + 1)) {
$page .= "<tr height=\"20\">";
$page .= "<td class=\"c\" colspan=\"3\">". $lang['fl_expe_staytime'] ."</td>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<th colspan=\"3\">";
$page .= "<select name=\"expeditiontime\" >";
$page .= "<option value=\"1\">1</option>";
$page .= "<option value=\"2\">2</option>";
$page .= "</select>";
$page .= $lang['fl_expe_hours'];
$page .= "</th>";
$page .= "</tr>";
} else if (!isset($missionTypes[Legacies_Empire::ID_MISSION_STATION_ALLY])) {
$page .= "<tr height=\"20\">";
$page .= "<td class=\"c\" colspan=\"3\">". $lang['fl_expe_staytime'] ."</td>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<th colspan=\"3\">";
$page .= "<select name=\"holdingtime\" >";
$page .= "<option value=\"0\">0</option>";
$page .= "<option value=\"1\">1</option>";
$page .= "<option value=\"2\">2</option>";
$page .= "<option value=\"4\">4</option>";
$page .= "<option value=\"8\">8</option>";
$page .= "<option value=\"16\">16</option>";
$page .= "<option value=\"32\">32</option>";
$page .= "</select>";
$page .= $lang['fl_expe_hours'];
$page .= "</th>";
$page .= "</tr>";
}
$page .= "</tbody>\n";
$page .= "</table>\n";
$page .= "</th>\n";
$page .= "</tr><tr height=\"20\">\n";
$page .= "<th colspan=\"2\"><input accesskey=\"z\" value=\"". $lang['fl_continue'] ."\" type=\"submit\"></th>\n";
$page .= "</tr>\n";
$page .= "</tbody>\n";
$page .= "</table>\n";
$page .= "</form></center>\n";
display($page, $lang['fl_title']);

View file

@ -32,508 +32,472 @@ define('INSIDE' , true);
define('INSTALL' , false);
require_once dirname(__FILE__) .'/common.php';
$dpath = (!$user["dpath"]) ? DEFAULT_SKINPATH : $user["dpath"];
includeLang('fleet');
includeLang('fleet');
$session = Legacies::getSession('fleet');
$CurrentPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '". $user['current_planet'] ."'", 'planets', true);
$TargetPlanet = doquery("SELECT * FROM {{table}} WHERE `galaxy` = '". $_POST['galaxy'] ."' AND `system` = '". $_POST['system'] ."' AND `planet` = '". $_POST['planet'] ."' AND `planet_type` = '". $_POST['planettype'] ."';", 'planets', true);
$MyDBRec = doquery("SELECT * FROM {{table}} WHERE `id` = '". $user['id']."';", 'users', true);
$user = Legacies_Empire_Model_User::getSingleton();
$planet = $user->getCurrentPlanet();
$protection = $gameConfig['noobprotection'];
$protectiontime = $gameConfig['noobprotectiontime'];
$protectionmulti = $gameConfig['noobprotectionmulti'];
if ($protectiontime < 1) {
$protectiontime = 9999999999999999;
}
$fleetarray = unserialize(base64_decode(str_rot13($_POST["usedfleet"])));
if (!is_array($fleetarray)) {
message ("<font color=\"red\"><b>". $lang['fl_fleet_err'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
// On verifie s'il y a assez de vaisseaux sur la planete !
foreach ($fleetarray as $Ship => $Count) {
if ($Count > $CurrentPlanet[$resource[$Ship]]) {
message ("<font color=\"red\"><b>". $lang['fl_fleet_err'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
}
$error = 0;
$galaxy = intval($_POST['galaxy']);
$system = intval($_POST['system']);
$planet = intval($_POST['planet']);
$planettype = intval($_POST['planettype']);
$fleetmission = $_POST['mission'];
if ($planettype != 1 && $planettype != 2 && $planettype != 3) {
message ("<font color=\"red\"><b>". $lang['fl_fleet_err_pl'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
if ($fleetmission == 8) {
$YourPlanet = false;
$UsedPlanet = false;
$select = doquery("SELECT * FROM {{table}} WHERE galaxy = '". $galaxy ."' AND system = '". $system ."' AND planet = '". $planet ."'", "planets");
} else {
$YourPlanet = false;
$UsedPlanet = false;
$select = doquery("SELECT * FROM {{table}} WHERE galaxy = '". $galaxy ."' AND system = '". $system ."' AND planet = '". $planet ."' AND planet_type = '". $planettype ."'", "planets");
}
if ($CurrentPlanet['galaxy'] == $galaxy &&
$CurrentPlanet['system'] == $system &&
$CurrentPlanet['planet'] == $planet &&
$CurrentPlanet['planet_type'] == $planettype) {
message ("<font color=\"red\"><b>". $lang['fl_ownpl_err'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
// Test d'existance de l'enregistrement dans la gaalxie !
if ($_POST['mission'] != 15) {
if (mysql_num_rows($select) < 1 && $fleetmission != 7) {
message ("<font color=\"red\"><b>". $lang['fl_unknow_target'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
} elseif ($fleetmission == 9 && mysql_num_rows($select) < 1) {
message ("<font color=\"red\"><b>". $lang['fl_used_target'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
} else {
$EnvoiMaxExpedition = $_POST['maxepedition'];
$Expedition = $_POST['curepedition'];
if ($EnvoiMaxExpedition == 0 ) {
message ("<font color=\"red\"><b>". $lang['fl_expe_notech'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
} elseif ($Expedition >= $EnvoiMaxExpedition ) {
message ("<font color=\"red\"><b>". $lang['fl_expe_max'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
}
$select = mysql_fetch_array($select);
if ($select['id_owner'] == $user['id']) {
$YourPlanet = true;
$UsedPlanet = true;
} elseif (!empty($select['id_owner'])) {
$YourPlanet = false;
$UsedPlanet = true;
} else {
$YourPlanet = false;
$UsedPlanet = false;
}
// Determinons les type de missions possibles par rapport a la planete cible
if ($fleetmission == 15) {
// Gestion des Exp<78>ditions
$missiontype = array(15 => $lang['type_mission'][15]);
} else {
if ($_POST['planettype'] == "2") {
if ($_POST['ship209'] >= 1) {
$missiontype = array(8 => $lang['type_mission'][8]);
} else {
$missiontype = array();
}
} elseif ($_POST['planettype'] == "1" || $_POST['planettype'] == "3") {
if ($_POST['ship208'] >= 1 && !$UsedPlanet) {
$missiontype = array(7 => $lang['type_mission'][7]);
} elseif ($_POST['ship210'] >= 1 && !$YourPlanet) {
$missiontype = array(6 => $lang['type_mission'][6]);
}
if ($_POST['ship202'] >= 1 ||
$_POST['ship203'] >= 1 ||
$_POST['ship204'] >= 1 ||
$_POST['ship205'] >= 1 ||
$_POST['ship206'] >= 1 ||
$_POST['ship207'] >= 1 ||
$_POST['ship210'] >= 1 ||
$_POST['ship211'] >= 1 ||
$_POST['ship213'] >= 1 ||
$_POST['ship214'] >= 1 ||
$_POST['ship215'] >= 1 ||
$_POST['ship216'] >= 1) {
if (!$YourPlanet) {
$missiontype[1] = $lang['type_mission'][1];
$missiontype[5] = $lang['type_mission'][5];
}
$missiontype[3] = $lang['type_mission'][3];
}
$galaxy = isset($_POST['galaxy']) ? intval($_POST['galaxy']) : 0;
$system = isset($_POST['system']) ? intval($_POST['system']) : 0;
$position = isset($_POST['planet']) ? intval($_POST['planet']) : 0;
$type = isset($_POST['planettype']) ? intval($_POST['planettype']) : 0;
$mission = isset($_POST['mission']) ? intval($_POST['mission']) : 0;
$galaxy = isset($session['galaxy']) ? $session['galaxy'] : 0;
$system = isset($session['system']) ? $session['system'] : 0;
$position = isset($session['position']) ? $session['position'] : 0;
$type = isset($session['type']) ? $session['type'] : 0;
$speed = isset($session['speed']) ? $session['speed'] : 10;
} elseif ($_POST['ship209'] >= 1 || $_POST['ship208'] >= 1) {
$missiontype[3] = $lang['type_mission'][3];
}
if ($YourPlanet)
$missiontype[4] = $lang['type_mission'][4];
$protection = $gameConfig['noobprotection'];
$protectiontime = $gameConfig['noobprotectiontime'];
$protectionmulti = $gameConfig['noobprotectionmulti'];
if ( $_POST['planettype'] == 3 &&
($_POST['ship214'] ||
$_POST['ship213']) &&
!$YourPlanet &&
$UsedPlanet) {
$missiontype[2] = $lang['type_mission'][2];
}
if ($_POST['planettype'] == 3 &&
($_POST['ship214'] >= 1 || $_POST['ship216'] >= 1) &&
!$YourPlanet && $UsedPlanet) {
$missiontype[9] = $lang['type_mission'][9];
if ($protectiontime < 1) {
$protectiontime = 9999999999999999;
}
$fleetArray = $session['fleet'];
if (!is_array($fleetArray)) {
message ("<font color=\"red\"><b>". $lang['fl_fleet_err'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
// On verifie s'il y a assez de vaisseaux sur la planete !
foreach ($fleetArray as $shipId => $count) {
if ($Count > $planet->getElement($shipId)) {
message ("<font color=\"red\"><b>". $lang['fl_fleet_err'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
}
$allowedPlanetTypes = array(
Legacies_Empire_Model_Planet::TYPE_PLANET,
Legacies_Empire_Model_Planet::TYPE_DEBRIS,
Legacies_Empire_Model_Planet::TYPE_MOON
);
if (!in_array($type, $allowedPlanetTypes)) {
message ("<font color=\"red\"><b>". $lang['fl_fleet_err_pl'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
if ($planet->getGalaxy() == $galaxy &&
$planet->getSystem() == $system &&
$planet->getPosition() == $position &&
$planet->getType() == $type) {
message ("<font color=\"red\"><b>". $lang['fl_ownpl_err'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
$YourPlanet = false;
$UsedPlanet = false;
$coords = array(
'galaxy' => $galaxy,
'system' => $system,
'position' => $position
);
if ($mission == Legacies_Empire::ID_MISSION_RECYCLE) {
$destination = Legacies_Empire_Model_Planet::factoryFromCoords($coords);
} else {
$destination = Legacies_Empire_Model_Planet::factoryFromCoords($coords, $type);
}
// Test d'existence de l'enregistrement dans la galaxie !
if ($mission != Legacies_Empire::ID_MISSION_EXPEDITION) {
if (!$destination->getId()) {
if ($mission != Legacies_Empire::ID_MISSION_SETTLE_COLONY) {
message ("<font color=\"red\"><b>". $lang['fl_unknow_target'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
} else if ($mission == Legacies_Empire::ID_MISSION_DESTROY) {
message ("<font color=\"red\"><b>". $lang['fl_used_target'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
}
} else if ($mission == Legacies_Empire::ID_MISSION_DESTROY && !$destination->isMoon()) {
message ("<font color=\"red\"><b>". $lang['fl_used_target'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
} else {
if (empty($missiontype[$fleetmission])) {
message ("<font color=\"red\"><b>". $lang['fl_bad_mission'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
$EnvoiMaxExpedition = $user->getElement(Legacies_Empire::ID_RESEARCH_EXPEDITION_TECHNOLOGY);
$Expedition = 0;
if ($EnvoiMaxExpedition > 0) {
$maxexpde = doquery("SELECT 1 FROM {{table}} WHERE `fleet_owner` = '".$user['id']."' AND `fleet_mission` = '15';", 'fleets');
$Expedition = $maxexpde->rowCount();
$maxexpde->closeCursor();
}
CheckPlanetUsedFields($CurrentPlanet);
if ($EnvoiMaxExpedition == 0 ) {
message ("<font color=\"red\"><b>". $lang['fl_expe_notech'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
} else if ($Expedition >= $EnvoiMaxExpedition ) {
message ("<font color=\"red\"><b>". $lang['fl_expe_max'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
}
if ($TargetPlanet['id_owner'] == '') {
$HeDBRec = $MyDBRec;
} elseif ($TargetPlanet['id_owner'] != '') {
$HeDBRec = doquery("SELECT * FROM {{table}} WHERE `id` = '". $TargetPlanet['id_owner'] ."';", 'users', true);
}
if ($destination->getUserId() == $user['id']) {
$YourPlanet = true;
$UsedPlanet = true;
} else if ($destination['id_owner']->getId()) {
$UsedPlanet = true;
}
$UserPoints = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '". $MyDBRec['id'] ."';", 'statpoints', true);
$User2Points = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '". $HeDBRec['id'] ."';", 'statpoints', true);
$missionTypes = array();
// Determinons les type de missions possibles par rapport a la planete cible
if ($position == (MAX_PLANET_IN_SYSTEM + 1)) {
$missionTypes[Legacies_Empire::ID_MISSION_EXPEDITION] = $lang['type_mission'][Legacies_Empire::ID_MISSION_EXPEDITION];
} else {
if ($type == Legacies_Empire_Model_Planet::TYPE_DEBRIS) {
if (isset($fleetArray[Legacies_Empire::ID_SHIP_RECYCLER]) && $fleetArray[Legacies_Empire::ID_SHIP_RECYCLER] > 0) {
$missionTypes[Legacies_Empire::ID_MISSION_RECYCLE] = $lang['type_mission'][Legacies_Empire::ID_MISSION_RECYCLE];
}
} else if ($type == Legacies_Empire_Model_Planet::TYPE_PLANET) {
if (isset($fleetArray[Legacies_Empire::ID_SHIP_COLONY_SHIP]) && $fleetArray[Legacies_Empire::ID_SHIP_COLONY_SHIP] > 0 && !$UsedPlanet) {
$missionTypes[Legacies_Empire::ID_MISSION_SETTLE_COLONY] = $lang['type_mission'][7];
}
} else if ($type == Legacies_Empire_Model_Planet::TYPE_MOON) {
if (((isset($fleetArray[Legacies_Empire::ID_SHIP_DEATH_STAR]) && $fleetArray[Legacies_Empire::ID_SHIP_DEATH_STAR] > 0) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_SUPERNOVA]) && $fleetArray[Legacies_Empire::ID_SHIP_SUPERNOVA] > 0)) &&
!$YourPlanet && $UsedPlanet) {
$missionTypes[Legacies_Empire::ID_MISSION_DESTROY] = $lang['type_mission'][Legacies_Empire::ID_MISSION_DESTROY];
}
}
$MyGameLevel = $UserPoints['total_points'];
$HeGameLevel = $User2Points['total_points'];
$VacationMode = $HeDBRec['urlaubs_modus'];
if (in_array($type, array(Legacies_Empire_Model_Planet::TYPE_MOON, Legacies_Empire_Model_Planet::TYPE_PLANET))) {
if (isset($fleetArray[Legacies_Empire::ID_SHIP_SPY_DRONE]) && $fleetArray[Legacies_Empire::ID_SHIP_SPY_DRONE] > 0 && !$YourPlanet) {
$missionTypes[Legacies_Empire::ID_MISSION_SPY] = $lang['type_mission'][Legacies_Empire::ID_MISSION_SPY];
}
if ($MyGameLevel > ($HeGameLevel * $protectionmulti) AND
$TargetPlanet['id_owner'] != '' AND
$_POST['mission'] == 1 AND
$protection == 1 AND
$HeGameLevel < ($protectiontime * 1000)) {
message("<font color=\"lime\"><b>".$lang['fl_noob_mess_n']."</b></font>", $lang['fl_noob_title'], "fleet." . PHPEXT, 2);
}
if ((isset($fleetArray[Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT]) && $fleetArray[Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT] > 0) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_LARGE_TRANSPORT]) && $fleetArray[Legacies_Empire::ID_SHIP_LARGE_TRANSPORT] > 0) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_LIGHT_FIGHTER]) && $fleetArray[Legacies_Empire::ID_SHIP_LIGHT_FIGHTER] > 0) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_HEAVY_FIGHTER]) && $fleetArray[Legacies_Empire::ID_SHIP_HEAVY_FIGHTER] > 0) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_CRUISER]) && $fleetArray[Legacies_Empire::ID_SHIP_CRUISER] > 0) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_BATTLESHIP]) && $fleetArray[Legacies_Empire::ID_SHIP_BATTLESHIP] > 0) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_COLONY_SHIP]) && $fleetArray[Legacies_Empire::ID_SHIP_COLONY_SHIP] > 0) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_RECYCLER]) && $fleetArray[Legacies_Empire::ID_SHIP_RECYCLER] > 0) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_SPY_DRONE]) && $fleetArray[Legacies_Empire::ID_SHIP_SPY_DRONE] > 0 && ALLOW_SPY_DRONE_ATTACKS) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_BOMBER]) && $fleetArray[Legacies_Empire::ID_SHIP_BOMBER] > 0) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_DESTRUCTOR]) && $fleetArray[Legacies_Empire::ID_SHIP_DESTRUCTOR] > 0) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_DEATH_STAR]) && $fleetArray[Legacies_Empire::ID_SHIP_DEATH_STAR] > 0) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_BATTLECRUISER]) && $fleetArray[Legacies_Empire::ID_SHIP_BATTLECRUISER] > 0) ||
(isset($fleetArray[Legacies_Empire::ID_SHIP_SUPERNOVA]) && $fleetArray[Legacies_Empire::ID_SHIP_SUPERNOVA] > 0)) {
if ($MyGameLevel > ($HeGameLevel * $protectionmulti) AND
$TargetPlanet['id_owner'] != '' AND
$_POST['mission'] == 5 AND
$protection == 1 AND
$HeGameLevel < ($protectiontime * 1000)) {
message("<font color=\"lime\"><b>".$lang['fl_noob_mess_n']."</b></font>", $lang['fl_noob_title'], "fleet." . PHPEXT, 2);
}
if (!$YourPlanet) {
$missionTypes[Legacies_Empire::ID_MISSION_ATTACK] = $lang['type_mission'][Legacies_Empire::ID_MISSION_ATTACK];
$missionTypes[Legacies_Empire::ID_MISSION_GROUP_ATTACK] = $lang['type_mission'][Legacies_Empire::ID_MISSION_GROUP_ATTACK];
$missionTypes[Legacies_Empire::ID_MISSION_STATION_ALLY] = $lang['type_mission'][Legacies_Empire::ID_MISSION_STATION_ALLY];
}
$missionTypes[Legacies_Empire::ID_MISSION_TRANSPORT] = $lang['type_mission'][Legacies_Empire::ID_MISSION_TRANSPORT];
}
if ($MyGameLevel > ($HeGameLevel * $protectionmulti) AND
$TargetPlanet['id_owner'] != '' AND
$_POST['mission'] == 6 AND
$protection == 1 AND
$HeGameLevel < ($protectiontime * 1000)) {
message("<font color=\"lime\"><b>".$lang['fl_noob_mess_n']."</b></font>", $lang['fl_noob_title'], "fleet." . PHPEXT, 2);
}
if ($YourPlanet) {
$missionTypes[Legacies_Empire::ID_MISSION_STATION] = $lang['type_mission'][Legacies_Empire::ID_MISSION_STATION];
}
}
}
if (($MyGameLevel * $protectionmulti) < $HeGameLevel AND
$TargetPlanet['id_owner'] != '' AND
$_POST['mission'] == 1 AND
$protection == 1 AND
$MyGameLevel < ($protectiontime * 1000)) {
message("<font color=\"lime\"><b>".$lang['fl_noob_mess_n']."</b></font>", $lang['fl_noob_title'], "fleet." . PHPEXT, 2);
}
if (isset($fleetArray[Legacies_Empire::ID_SHIP_SOLAR_SATELLITE])) {
$missionTypes = array();
}
if (($MyGameLevel * $protectionmulti) < $HeGameLevel AND
$TargetPlanet['id_owner'] != '' AND
$_POST['mission'] == 5 AND
$protection == 1 AND
$MyGameLevel < ($protectiontime * 1000)) {
message("<font color=\"lime\"><b>".$lang['fl_noob_mess_n']."</b></font>", $lang['fl_noob_title'], "fleet." . PHPEXT, 2);
}
if (!isset($missionTypes[$mission])) {
message ("<font color=\"red\"><b>". $lang['fl_bad_mission'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
if (($MyGameLevel * $protectionmulti) < $HeGameLevel AND
$TargetPlanet['id_owner'] != '' AND
$_POST['mission'] == 6 AND
$protection == 1 AND
$MyGameLevel < ($protectiontime * 1000)) {
message("<font color=\"lime\"><b>".$lang['fl_noob_mess_n']."</b></font>", $lang['fl_noob_title'], "fleet." . PHPEXT, 2);
}
if (!$destination->getId()) {
$destinationUser = $user;
} else {
$destinationUser = $destination->getUser();
}
if ($VacationMode AND $_POST['mission'] != 8) {
message("<font color=\"lime\"><b>".$lang['fl_vacation_pla']."</b></font>", $lang['fl_vacation_ttl'], "fleet." . PHPEXT, 2);
}
$userPoints = doquery("SELECT total_points FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner`='{$user->getId()}'", 'statpoints', true);
$myGameLevel = $userPoints['total_points'];
if ($destinationUser->getId()) {
$destinationPoints = doquery("SELECT total_points FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '{$destinationUser->getId()}';", 'statpoints', true);
$hisGameLevel = $destinationPoints['total_points'];
} else {
$hisGameLevel = 0;
}
$FlyingFleets = mysql_fetch_assoc(doquery("SELECT COUNT(fleet_id) as Number FROM {{table}} WHERE `fleet_owner`='{$user['id']}'", 'fleets'));
$ActualFleets = $FlyingFleets["Number"];
if (($user[$resource[108]] + 1) <= $ActualFleets) {
message("Pas de slot disponible", "Erreur", "fleet." . PHPEXT, 1);
}
$vacationMode = $destinationUser['urlaubs_modus'];
if ($_POST['resource1'] + $_POST['resource2'] + $_POST['resource3'] < 1 AND $_POST['mission'] == 3) {
message("<font color=\"lime\"><b>".$lang['fl_noenoughtgoods']."</b></font>", $lang['type_mission'][3], "fleet." . PHPEXT, 1);
}
if ($_POST['mission'] != 15) {
if ($TargetPlanet['id_owner'] == '' AND $_POST['mission'] < 7) {
message ("<font color=\"red\"><b>". $lang['fl_bad_planet01'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
if ($TargetPlanet['id_owner'] != '' AND $_POST['mission'] == 7) {
message ("<font color=\"red\"><b>". $lang['fl_bad_planet02'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
if ($HeDBRec['ally_id'] != $MyDBRec['ally_id'] AND $_POST['mission'] == 4) {
message ("<font color=\"red\"><b>". $lang['fl_dont_stay_here'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
if ($TargetPlanet['ally_deposit'] < 1 AND $HeDBRec != $MyDBRec AND $_POST['mission'] == 5) {
message ("<font color=\"red\"><b>". $lang['fl_no_allydeposit'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
if (($TargetPlanet["id_owner"] == $CurrentPlanet["id_owner"]) AND ($_POST["mission"] == 1)) {
message ("<font color=\"red\"><b>". $lang['fl_no_self_attack'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
if (($TargetPlanet["id_owner"] == $CurrentPlanet["id_owner"]) AND ($_POST["mission"] == 6)) {
message ("<font color=\"red\"><b>". $lang['fl_no_self_spy'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
if (($TargetPlanet["id_owner"] != $CurrentPlanet["id_owner"]) AND ($_POST["mission"] == 4)) {
message ("<font color=\"red\"><b>". $lang['fl_only_stay_at_home'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
}
if ($protection) {
$protectedMissions = array(
Legacies_Empire::ID_MISSION_ATTACK,
Legacies_Empire::ID_MISSION_GROUP_ATTACK,
Legacies_Empire::ID_MISSION_STATION_ALLY,
Legacies_Empire::ID_MISSION_SPY,
Legacies_Empire::ID_MISSION_DESTROY
);
$missiontype = array(
1 => $lang['type_mission'][1],
2 => $lang['type_mission'][2],
3 => $lang['type_mission'][3],
4 => $lang['type_mission'][4],
5 => $lang['type_mission'][5],
6 => $lang['type_mission'][6],
7 => $lang['type_mission'][7],
8 => $lang['type_mission'][8],
9 => $lang['type_mission'][9],
15 => $lang['type_mission'][15],
);
if ($myGameLevel > ($hisGameLevel * $protectionmulti) && $destinationUser->getId() &&
in_array($mission, $protectedMissions) && $hisGameLevel < ($protectiontime * 1000)) {
message("<font color=\"lime\"><b>".$lang['fl_noob_mess_n']."</b></font>", $lang['fl_noob_title'], "fleet." . PHPEXT, 2);
}
$speed_possible = array(10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
if (($myGameLevel * $protectionmulti) < $hisGameLevel && $destinationUser->getId() &&
in_array($mission, $protectedMissions) && $myGameLevel < ($protectiontime * 1000)) {
message("<font color=\"lime\"><b>".$lang['fl_noob_mess_n']."</b></font>", $lang['fl_noob_title'], "fleet." . PHPEXT, 2);
}
}
$AllFleetSpeed = GetFleetMaxSpeed ($fleetarray, 0, $user);
$GenFleetSpeed = $_POST['speed'];
$SpeedFactor = $_POST['speedfactor'];
$MaxFleetSpeed = min($AllFleetSpeed);
if ($vacationMode && $mission != Legacies_Empire::ID_MISSION_RECYCLE) {
message("<font color=\"lime\"><b>".$lang['fl_vacation_pla']."</b></font>", $lang['fl_vacation_ttl'], "fleet." . PHPEXT, 2);
}
if (!in_array($GenFleetSpeed, $speed_possible)) {
message ("<font color=\"red\"><b>". $lang['fl_cheat_speed'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
$currentFleets = $user->getFleets()->count();
$CurrentPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '".$user['current_planet']."';", 'planets', true);
if (($user->getElement(Legacies_Empire::ID_RESEARCH_COMPUTER_TECHNOLOGY) + 1) <= $currentFleets) {
message("Pas de slot disponible", "Erreur", "fleet." . PHPEXT, 1);
}
if ($MaxFleetSpeed != $_POST['speedallsmin']) {
message ("<font color=\"red\"><b>". $lang['fl_cheat_speed'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
$metal = isset($_POST['resource1']) ? intval($_POST['resource1']) : 0;
$cristal = isset($_POST['resource2']) ? intval($_POST['resource2']) : 0;
$deuterium = isset($_POST['resource3']) ? intval($_POST['resource3']) : 0;
if (!$_POST['planettype']) {
message ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
if ($metal + $cristal + $deuterium < 1 && $mission == Legacies_Empire::ID_MISSION_TRANSPORT) {
message("<font color=\"lime\"><b>".$lang['fl_noenoughtgoods']."</b></font>", $lang['type_mission'][3], "fleet." . PHPEXT, 1);
}
if ($mission != Legacies_Empire::ID_MISSION_EXPEDITION) {
$userMissions = array(
Legacies_Empire::ID_MISSION_ATTACK,
Legacies_Empire::ID_MISSION_GROUP_ATTACK,
Legacies_Empire::ID_MISSION_TRANSPORT,
Legacies_Empire::ID_MISSION_STATION,
Legacies_Empire::ID_MISSION_STATION_ALLY,
Legacies_Empire::ID_MISSION_SPY
);
if (!$destination->getUserId() && in_array($mission, $userMissions)) {
message ("<font color=\"red\"><b>". $lang['fl_bad_planet01'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
if ($destination->getId() && $mission == Legacies_Empire::ID_MISSION_SETTLE_COLONY) {
message ("<font color=\"red\"><b>". $lang['fl_bad_planet02'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
if ($destination->getId() != $planet->getId() && $mission == Legacies_Empire::ID_MISSION_STATION) {
message ("<font color=\"red\"><b>". $lang['fl_dont_stay_here'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
if ($destination->getElement(Legacies_Empire::ID_BUILDING_ALLIANCE_DEPOT) < 1 && $destinationUser->getId() != $user->getId() && $mission == Legacies_Empire::ID_MISSION_STATION_ALLY) {
message ("<font color=\"red\"><b>". $lang['fl_no_allydeposit'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
if ($destinationUser->getId() != $user->getId() && ($mission == Legacies_Empire::ID_MISSION_ATTACK)) {
message ("<font color=\"red\"><b>". $lang['fl_no_self_attack'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
if ($destinationUser->getId() != $user->getId() && ($mission == Legacies_Empire::ID_MISSION_SPY)) {
message ("<font color=\"red\"><b>". $lang['fl_no_self_spy'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
if ($destinationUser->getId() != $user->getId() && $mission == Legacies_Empire::ID_MISSION_STATION) {
message ("<font color=\"red\"><b>". $lang['fl_only_stay_at_home'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
}
// Test de coherance de la destination (voir si elle se trouve dans les limites de l'univers connu
$error = 0;
$errorlist = "";
if (!$_POST['galaxy'] || !is_numeric($_POST['galaxy']) || $_POST['galaxy'] > MAX_GALAXY_IN_WORLD || $_POST['galaxy'] < 1) {
$error++;
$errorlist .= $lang['fl_limit_galaxy'];
}
if (!$_POST['system'] || !is_numeric($_POST['system']) || $_POST['system'] > MAX_SYSTEM_IN_GALAXY || $_POST['system'] < 1) {
$error++;
$errorlist .= $lang['fl_limit_system'];
}
if (!$_POST['planet'] || !is_numeric($_POST['planet']) || $_POST['planet'] > MAX_PLANET_IN_SYSTEM+1 || $_POST['planet'] < 1) {
$error++;
$errorlist .= $lang['fl_limit_planet'];
}
$possibleSpeeds = array(10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
if ($error > 0) {
message ("<font color=\"red\"><ul>" . $errorlist . "</ul></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
$AllFleetSpeed = GetFleetMaxSpeed($fleetArray, 0, $user);
$SpeedFactor = GetGameSpeedFactor();
$MaxFleetSpeed = min($AllFleetSpeed);
// La flotte part bien de la planete courrante ??
if ($_POST['thisgalaxy'] != $CurrentPlanet['galaxy'] |
$_POST['thissystem'] != $CurrentPlanet['system'] |
$_POST['thisplanet'] != $CurrentPlanet['planet'] |
$_POST['thisplanettype'] != $CurrentPlanet['planet_type']) {
message ("<font color=\"red\"><b>". $lang['fl_cheat_origine'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
if (!in_array($speed, $possibleSpeeds)) {
message ("<font color=\"red\"><b>". $lang['fl_cheat_speed'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
if (!isset($fleetarray)) {
message ("<font color=\"red\"><b>". $lang['fl_no_fleetarray'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
$error = 0;
$errorlist = "";
if ($galaxy > MAX_GALAXY_IN_WORLD || $galaxy < 1) {
$error++;
$errorlist .= $lang['fl_limit_galaxy'];
}
if ($system > MAX_SYSTEM_IN_GALAXY || $system < 1) {
$error++;
$errorlist .= $lang['fl_limit_system'];
}
if ($position > (MAX_PLANET_IN_SYSTEM + 1) || $position < 1) {
$error++;
$errorlist .= $lang['fl_limit_planet'];
}
$distance = GetTargetDistance ( $_POST['thisgalaxy'], $_POST['galaxy'], $_POST['thissystem'], $_POST['system'], $_POST['thisplanet'], $_POST['planet'] );
$duration = GetMissionDuration ( $GenFleetSpeed, $MaxFleetSpeed, $distance, $SpeedFactor );
$consumption = GetFleetConsumption ( $fleetarray, $SpeedFactor, $duration, $distance, $MaxFleetSpeed, $user );
if ($error > 0) {
message ("<font color=\"red\"><ul>" . $errorlist . "</ul></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
$fleet['start_time'] = $duration + time();
if ($_POST['mission'] == 15) {
$StayDuration = $_POST['expeditiontime'] * 3600;
$StayTime = $fleet['start_time'] + $_POST['expeditiontime'] * 3600;
} elseif ($_POST['mission'] == 5) {
$StayDuration = $_POST['holdingtime'] * 3600;
$StayTime = $fleet['start_time'] + $_POST['holdingtime'] * 3600;
} else {
$StayDuration = 0;
$StayTime = 0;
}
$fleet['end_time'] = $StayDuration + (2 * $duration) + time();
$FleetStorage = 0;
$FleetShipCount = 0;
$fleet_array = "";
$FleetSubQRY = "";
if (!isset($fleetArray)) {
message ("<font color=\"red\"><b>". $lang['fl_no_fleetarray'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
foreach ($fleetarray as $Ship => $Count) {
$FleetStorage += $pricelist[$Ship]["capacity"] * $Count;
$FleetShipCount += $Count;
$fleet_array .= $Ship .",". $Count .";";
$FleetSubQRY .= "`".$resource[$Ship] . "` = `" . $resource[$Ship] . "` - " . $Count . " , ";
}
$distance = GetTargetDistance($planet->getGalaxy(), $galaxy, $planet->getSystem(), $system, $planet->getPosition(), $position);
$duration = GetMissionDuration($speed, $MaxFleetSpeed, $distance, $SpeedFactor);
$consumption = GetFleetConsumption($fleetArray, $SpeedFactor, $duration, $distance, $MaxFleetSpeed, $user);
$FleetStorage -= $consumption;
$StorageNeeded = 0;
if ($_POST['resource1'] < 1) {
$TransMetal = 0;
} else {
$TransMetal = $_POST['resource1'];
$StorageNeeded += $TransMetal;
}
if ($_POST['resource2'] < 1) {
$TransCrystal = 0;
} else {
$TransCrystal = $_POST['resource2'];
$StorageNeeded += $TransCrystal;
}
if ($_POST['resource3'] < 1) {
$TransDeuterium = 0;
} else {
$TransDeuterium = $_POST['resource3'];
$StorageNeeded += $TransDeuterium;
}
/***************/
$fleet['start_time'] = $duration + time();
if ($mission == Legacies_Empire::ID_MISSION_EXPEDITION) {
$StayDuration = $_POST['expeditiontime'] * 3600;
$StayTime = $fleet['start_time'] + $_POST['expeditiontime'] * 3600;
} elseif ($_POST['mission'] == 5) {
$StayDuration = $_POST['holdingtime'] * 3600;
$StayTime = $fleet['start_time'] + $_POST['holdingtime'] * 3600;
} else {
$StayDuration = 0;
$StayTime = 0;
}
$fleet['end_time'] = $StayDuration + (2 * $duration) + time();
$FleetStorage = 0;
$FleetShipCount = 0;
$fleet_array = "";
$FleetSubQRY = "";
$StockMetal = $CurrentPlanet['metal'];
$StockCrystal = $CurrentPlanet['crystal'];
$StockDeuterium = $CurrentPlanet['deuterium'];
$StockDeuterium -= $consumption;
foreach ($fleetArray as $Ship => $Count) {
$FleetStorage += $pricelist[$Ship]["capacity"] * $Count;
$FleetShipCount += $Count;
$fleet_array .= $Ship .",". $Count .";";
$FleetSubQRY .= "`".$resource[$Ship] . "` = `" . $resource[$Ship] . "` - " . $Count . " , ";
}
$StockOk = false;
if ($StockMetal >= $TransMetal) {
if ($StockCrystal >= $TransCrystal) {
if ($StockDeuterium >= $TransDeuterium) {
$StockOk = true;
}
}
}
if ( !$StockOk ) {
message ("<font color=\"red\"><b>". $lang['fl_noressources'] . pretty_number($consumption) ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
$FleetStorage -= $consumption;
$StorageNeeded = 0;
if ($_POST['resource1'] < 1) {
$TransMetal = 0;
} else {
$TransMetal = $_POST['resource1'];
$StorageNeeded += $TransMetal;
}
if ($_POST['resource2'] < 1) {
$TransCrystal = 0;
} else {
$TransCrystal = $_POST['resource2'];
$StorageNeeded += $TransCrystal;
}
if ($_POST['resource3'] < 1) {
$TransDeuterium = 0;
} else {
$TransDeuterium = $_POST['resource3'];
$StorageNeeded += $TransDeuterium;
}
if ( $StorageNeeded > $FleetStorage) {
message ("<font color=\"red\"><b>". $lang['fl_nostoragespa'] . pretty_number($StorageNeeded - $FleetStorage) ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
$StockMetal = $planet['metal'];
$StockCrystal = $planet['crystal'];
$StockDeuterium = $planet['deuterium'];
$StockDeuterium -= $consumption;
if ($TargetPlanet['id_level'] > $user['authlevel']) {
$Allowed = true;
switch ($_POST['mission']){
case 1:
case 2:
case 6:
case 9:
$Allowed = false;
break;
case 3:
case 4:
case 5:
case 7:
case 8:
case 15:
break;
default:
}
if ($Allowed == false) {
message ("<font color=\"red\"><b>". $lang['fl_adm_attak'] ."</b></font>", $lang['fl_warning'], "fleet." . PHPEXT, 2);
}
}
$StockOk = false;
if ($StockMetal >= $TransMetal) {
if ($StockCrystal >= $TransCrystal) {
if ($StockDeuterium >= $TransDeuterium) {
$StockOk = true;
}
}
}
if ( !$StockOk ) {
message ("<font color=\"red\"><b>". $lang['fl_noressources'] . pretty_number($consumption) ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
// ecriture de l'enregistrement de flotte (a partir de l<>, y a quelque chose qui vole et c'est toujours sur la planete d'origine)
$QryInsertFleet = "INSERT INTO {{table}} SET ";
$QryInsertFleet .= "`fleet_owner` = '". $user['id'] ."', ";
$QryInsertFleet .= "`fleet_mission` = '". $_POST['mission'] ."', ";
$QryInsertFleet .= "`fleet_amount` = '". $FleetShipCount ."', ";
$QryInsertFleet .= "`fleet_array` = '". $fleet_array ."', ";
$QryInsertFleet .= "`fleet_start_time` = '". $fleet['start_time'] ."', ";
$QryInsertFleet .= "`fleet_start_galaxy` = '". intval($_POST['thisgalaxy']) ."', ";
$QryInsertFleet .= "`fleet_start_system` = '". intval($_POST['thissystem']) ."', ";
$QryInsertFleet .= "`fleet_start_planet` = '". intval($_POST['thisplanet']) ."', ";
$QryInsertFleet .= "`fleet_start_type` = '". intval($_POST['thisplanettype']) ."', ";
$QryInsertFleet .= "`fleet_end_time` = '". $fleet['end_time'] ."', ";
$QryInsertFleet .= "`fleet_end_stay` = '". $StayTime ."', ";
$QryInsertFleet .= "`fleet_end_galaxy` = '". intval($_POST['galaxy']) ."', ";
$QryInsertFleet .= "`fleet_end_system` = '". intval($_POST['system']) ."', ";
$QryInsertFleet .= "`fleet_end_planet` = '". intval($_POST['planet']) ."', ";
$QryInsertFleet .= "`fleet_end_type` = '". intval($_POST['planettype']) ."', ";
$QryInsertFleet .= "`fleet_resource_metal` = '". intval($TransMetal) ."', ";
$QryInsertFleet .= "`fleet_resource_crystal` = '". intval($TransCrystal) ."', ";
$QryInsertFleet .= "`fleet_resource_deuterium` = '". intval($TransDeuterium) ."', ";
$QryInsertFleet .= "`fleet_target_owner` = '". $TargetPlanet['id_owner'] ."', ";
$QryInsertFleet .= "`start_time` = '". time() ."';";
doquery( $QryInsertFleet, 'fleets');
if ( $StorageNeeded > $FleetStorage) {
message ("<font color=\"red\"><b>". $lang['fl_nostoragespa'] . pretty_number($StorageNeeded - $FleetStorage) ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
if ($destination['id_level'] > $user['authlevel']) {
$Allowed = true;
switch ($_POST['mission']){
case 1:
case 2:
case 6:
case 9:
$Allowed = false;
break;
case 3:
case 4:
case 5:
case 7:
case 8:
case 15:
break;
default:
}
if ($Allowed == false) {
message ("<font color=\"red\"><b>". $lang['fl_adm_attak'] ."</b></font>", $lang['fl_warning'], "fleet." . PHPEXT, 2);
}
}
// ecriture de l'enregistrement de flotte (a partir de l<>, y a quelque chose qui vole et c'est toujours sur la planete d'origine)
$QryInsertFleet = "INSERT INTO {{table}} SET ";
$QryInsertFleet .= "`fleet_owner` = '". $user['id'] ."', ";
$QryInsertFleet .= "`fleet_mission` = '". $_POST['mission'] ."', ";
$QryInsertFleet .= "`fleet_amount` = '". $FleetShipCount ."', ";
$QryInsertFleet .= "`fleet_array` = '". $fleet_array ."', ";
$QryInsertFleet .= "`fleet_start_time` = '". $fleet['start_time'] ."', ";
$QryInsertFleet .= "`fleet_start_galaxy` = '". intval($_POST['thisgalaxy']) ."', ";
$QryInsertFleet .= "`fleet_start_system` = '". intval($_POST['thissystem']) ."', ";
$QryInsertFleet .= "`fleet_start_planet` = '". intval($_POST['thisplanet']) ."', ";
$QryInsertFleet .= "`fleet_start_type` = '". intval($_POST['thisplanettype']) ."', ";
$QryInsertFleet .= "`fleet_end_time` = '". $fleet['end_time'] ."', ";
$QryInsertFleet .= "`fleet_end_stay` = '". $StayTime ."', ";
$QryInsertFleet .= "`fleet_end_galaxy` = '". intval($_POST['galaxy']) ."', ";
$QryInsertFleet .= "`fleet_end_system` = '". intval($_POST['system']) ."', ";
$QryInsertFleet .= "`fleet_end_planet` = '". intval($_POST['planet']) ."', ";
$QryInsertFleet .= "`fleet_end_type` = '". intval($_POST['planettype']) ."', ";
$QryInsertFleet .= "`fleet_resource_metal` = '". intval($TransMetal) ."', ";
$QryInsertFleet .= "`fleet_resource_crystal` = '". intval($TransCrystal) ."', ";
$QryInsertFleet .= "`fleet_resource_deuterium` = '". intval($TransDeuterium) ."', ";
$QryInsertFleet .= "`fleet_target_owner` = '". $destination['id_owner'] ."', ";
$QryInsertFleet .= "`start_time` = '". time() ."';";
doquery( $QryInsertFleet, 'fleets');
$CurrentPlanet["metal"] = $CurrentPlanet["metal"] - $TransMetal;
$CurrentPlanet["crystal"] = $CurrentPlanet["crystal"] - $TransCrystal;
$CurrentPlanet["deuterium"] = $CurrentPlanet["deuterium"] - $TransDeuterium;
$CurrentPlanet["deuterium"] = $CurrentPlanet["deuterium"] - $consumption;
$planet["metal"] = $planet["metal"] - $TransMetal;
$planet["crystal"] = $planet["crystal"] - $TransCrystal;
$planet["deuterium"] = $planet["deuterium"] - $TransDeuterium;
$planet["deuterium"] = $planet["deuterium"] - $consumption;
$QryUpdatePlanet = "UPDATE {{table}} SET ";
$QryUpdatePlanet .= $FleetSubQRY;
$QryUpdatePlanet .= "`metal` = '". $CurrentPlanet["metal"] ."', ";
$QryUpdatePlanet .= "`crystal` = '". $CurrentPlanet["crystal"] ."', ";
$QryUpdatePlanet .= "`deuterium` = '". $CurrentPlanet["deuterium"] ."' ";
$QryUpdatePlanet .= "WHERE ";
$QryUpdatePlanet .= "`id` = '". $CurrentPlanet['id'] ."'";
$QryUpdatePlanet = "UPDATE {{table}} SET ";
$QryUpdatePlanet .= $FleetSubQRY;
$QryUpdatePlanet .= "`metal` = '". $planet["metal"] ."', ";
$QryUpdatePlanet .= "`crystal` = '". $planet["crystal"] ."', ";
$QryUpdatePlanet .= "`deuterium` = '". $planet["deuterium"] ."' ";
$QryUpdatePlanet .= "WHERE ";
$QryUpdatePlanet .= "`id` = '". $planet['id'] ."'";
// Mise a jours de l'enregistrement de la planete de depart (a partir de là, y a quelque chose qui vole et ce n'est plus sur la planete de depart)
doquery("LOCK TABLE {{table}} WRITE", 'planets');
doquery ($QryUpdatePlanet, "planets");
doquery("UNLOCK TABLES", '');
// doquery("FLUSH TABLES", '');
// Mise a jours de l'enregistrement de la planete de depart (a partir de là, y a quelque chose qui vole et ce n'est plus sur la planete de depart)
doquery("LOCK TABLE {{table}} WRITE", 'planets');
doquery ($QryUpdatePlanet, "planets");
doquery("UNLOCK TABLES", '');
// doquery("FLUSH TABLES", '');
// Un peu de blabla pour l'utilisateur, affichage d'un joli tableau de la flotte expedi<64>e
$page = "<br><div><center>";
$page .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"519\">";
$page .= "<tr height=\"20\">";
$page .= "<td class=\"c\" colspan=\"2\"><span class=\"success\">". $lang['fl_fleet_send'] ."</span></td>";
$page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['fl_mission'] ."</th>";
$page .= "<th>". $missiontype[$_POST['mission']] ."</th>";
$page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['fl_dist'] ."</th>";
$page .= "<th>". pretty_number($distance) ."</th>";
$page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['fl_speed'] ."</th>";
$page .= "<th>". pretty_number($_POST['speedallsmin']) ."</th>";
$page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['fl_deute_need'] ."</th>";
$page .= "<th>". pretty_number($consumption) ."</th>";
$page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['fl_from'] ."</th>";
$page .= "<th>". $_POST['thisgalaxy'] .":". $_POST['thissystem']. ":". $_POST['thisplanet'] ."</th>";
$page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['fl_dest'] ."</th>";
$page .= "<th>". $_POST['galaxy'] .":". $_POST['system'] .":". $_POST['planet'] ."</th>";
$page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['fl_time_go'] ."</th>";
$page .= "<th>". date("M D d H:i:s", $fleet['start_time']) ."</th>";
$page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['fl_time_back'] ."</th>";
$page .= "<th>". date("M D d H:i:s", $fleet['end_time']) ."</th>";
$page .= "</tr><tr height=\"20\">";
$page .= "<td class=\"c\" colspan=\"2\">". $lang['fl_title'] ."</td>";
// Un peu de blabla pour l'utilisateur, affichage d'un joli tableau de la flotte expedi<64>e
$page = "<br><div><center>";
$page .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"519\">";
$page .= "<tr height=\"20\">";
$page .= "<td class=\"c\" colspan=\"2\"><span class=\"success\">". $lang['fl_fleet_send'] ."</span></td>";
$page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['fl_mission'] ."</th>";
$page .= "<th>". $missionTypes[$_POST['mission']] ."</th>";
$page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['fl_dist'] ."</th>";
$page .= "<th>". pretty_number($distance) ."</th>";
$page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['fl_speed'] ."</th>";
$page .= "<th>". pretty_number($_POST['speedallsmin']) ."</th>";
$page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['fl_deute_need'] ."</th>";
$page .= "<th>". pretty_number($consumption) ."</th>";
$page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['fl_from'] ."</th>";
$page .= "<th>". $_POST['thisgalaxy'] .":". $_POST['thissystem']. ":". $_POST['thisplanet'] ."</th>";
$page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['fl_dest'] ."</th>";
$page .= "<th>". $_POST['galaxy'] .":". $_POST['system'] .":". $_POST['planet'] ."</th>";
$page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['fl_time_go'] ."</th>";
$page .= "<th>". date("M D d H:i:s", $fleet['start_time']) ."</th>";
$page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['fl_time_back'] ."</th>";
$page .= "<th>". date("M D d H:i:s", $fleet['end_time']) ."</th>";
$page .= "</tr><tr height=\"20\">";
$page .= "<td class=\"c\" colspan=\"2\">". $lang['fl_title'] ."</td>";
foreach ($fleetarray as $Ship => $Count) {
$page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['tech'][$Ship] ."</th>";
$page .= "<th>". pretty_number($Count) ."</th>";
}
$page .= "</tr></table></div></center>";
foreach ($fleetArray as $Ship => $Count) {
$page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['tech'][$Ship] ."</th>";
$page .= "<th>". pretty_number($Count) ."</th>";
}
$page .= "</tr></table></div></center>";
// Provisoire
sleep (1);
// Provisoire
sleep (1);
$planetrow = doquery ("SELECT * FROM {{table}} WHERE `id` = '". $CurrentPlanet['id'] ."';", 'planets', true);
$planetrow = doquery ("SELECT * FROM {{table}} WHERE `id` = '". $planet['id'] ."';", 'planets', true);
display($page, $lang['fl_title']);
// Updated by Chlorel. 16 Jan 2008 (String extraction, bug corrections, code uniformisation
// Updated by -= MoF =- for Deutsches Ugamela Forum
// 06.12.2007 - 08:39
// Open Source
// (c) by MoF
?>
display($page, $lang['fl_title']);

View file

@ -50,7 +50,7 @@ require_once dirname(__FILE__) .'/common.php';
$CanDestroy = $CurrentPlanet[$resource[213]] + $CurrentPlanet[$resource[214]];
$maxfleet = doquery("SELECT * FROM {{table}} WHERE `fleet_owner` = '". $user['id'] ."';", 'fleets');
$maxfleet_count = mysql_num_rows($maxfleet);
$maxfleet_count = $maxfleet->rowCount();
CheckPlanetUsedFields($CurrentPlanet);
CheckPlanetUsedFields($lunarow);

View file

@ -216,4 +216,20 @@ class Legacies
{
self::$_response = $response;
}
public static function getUrl($uri, Array $params = array())
{
// TODO: base path integration
$serializedParams = array();
foreach ($params as $paramKey => $paramValue) {
if ($paramValue) {
$serializedParams[] = "{$paramKey}={$paramValue}";
}
}
if (count($serializedParams) > 0) {
return $uri . '?' . implode('&', $serializedParams);
}
return $uri;
}
}

View file

@ -297,7 +297,7 @@ SQL_EOF;
{
$clone = clone $this;
$clone->_fields = array();
$clone->column('COUNT(*)');
$clone->column('1');
$sql = $clone->_prepareSql();
@ -306,7 +306,10 @@ SQL_EOF;
$args = func_get_args();
$statement->execute(array_shift($args));
return $statement->fetch(PDO::FETCH_COLUMN, 0);
$count = $statement->rowCount();
$statement->closeCursor();
return $count;
}
public function count()
@ -342,4 +345,22 @@ SQL_EOF;
{
return current($this->_items) !== false;
}
public function getFirstItem()
{
if (!$this->_)
if (count($this->_items) > 0) {
return $this->_items[0];
}
return null;
}
public function getLastItem()
{
$size = count($this->_items);
if ($size > 0) {
return $this->_items[$size - 1];
}
return null;
}
}

View file

@ -112,18 +112,7 @@ class Legacies_Core_View
public function getUrl($uri, Array $params = array())
{
// TODO: base path integration
$serializedParams = array();
foreach ($params as $paramKey => $paramValue) {
if ($paramValue) {
$serializedParams[] = "{$paramKey}={$paramValue}";
}
}
if (count($serializedParams) > 0) {
return $uri . '?' . implode('&', $serializedParams);
}
return $uri;
return Legacies::getUrl($uri, $params);
}
public function getSkinUrl($uri)

View file

@ -5,7 +5,7 @@ class Legacies_Empire_Block_Planet_Shipyard_Queue
{
public function getQueue()
{
return $this->getPlanet()->getShipyard()->getQueue();
return $this->getPlanet()->getShipyard()->getBuilder();
}
public function isEmpty()

View file

@ -64,6 +64,56 @@ class Legacies_Empire_Model_Planet
return self::$_instances[$id];
}
public static function factoryFromCoords($coords, $type = self::TYPE_PLANET)
{
if ($coords === null || empty($coords)) {
return new self();
}
if (!in_array($type, array(self::TYPE_PLANET, self::TYPE_DEBRIS, self::TYPE_MOON))) {
$type = self::TYPE_PLANET;
}
if (!is_array($coords)) {
$coords = explode(':', $coords);
if (count($coords) != 3) {
return new self();
}
$coords = array(
'galaxy' => $coords[0],
'system' => $coords[1],
'position' => $coords[2],
'type' => $type
);
}
if (!isset($coords['type'])) {
$coords['type'] = $type;
}
$database = Legacies_Database::getSingleton();
$collection = new Legacies_Core_Collection('planets');
$collection
->column('id')
->where('galaxy=:galaxy')
->where('system=:system')
->where('planet=:position')
->where('planet_type=:type')
->limit(1)
->load($coords)
;
$planetData = $collection->getFirstItem();
if ($planetData === null || !$planetData->getData('id')) {
return new self();
}
return self::factory($planetData->getData('id'));
}
public function _init()
{
$this->_tableName = 'planets';

View file

@ -27,7 +27,7 @@ class Legacies_Empire_Model_Planet_Builder
}
if (!isset($params['started_at'])) {
$startedAt = 0;
$startedAt = null;
} else {
$startedAt = $params['started_at'];
}
@ -128,7 +128,7 @@ class Legacies_Empire_Model_Planet_Builder
foreach ($this->getQueue() as $element) {
$elementTime = $element->getData('started_at');
if ($elementTime == 0) {
if ($elementTime === null) {
$element->setData('started_at', $startingTime);
$elementTime = $startingTime;
}
@ -199,6 +199,10 @@ class Legacies_Empire_Model_Planet_Builder
return $this;
}
if ($this->count() == 0) {
$this->_currentPlanet->setData('b_building', $time);
}
$this->enqueue(array(
'building_id' => $buildingId,
'level' => $level,

View file

@ -233,11 +233,11 @@ class Legacies_Empire_Model_User
*/
public function updateCurrentPlanet($planet)
{
if (!$planetId instanceof Legacies_Empire_Model_Planet) {
if (!$planet instanceof Legacies_Empire_Model_Planet) {
$planetCollection = $this->_preparePlanetCollection()->where('id=:id');
$planetCollection->load(array(
'id' => $planet,
'id' => $planet,
'user' => $this->getId()
));

View file

@ -1,13 +1,17 @@
<div class="planet-carrousel">
<div class="arrow left">&#8678;</div>
<div class="items">
<?php foreach ($this->getPlanetCollection() as $planet):?>
<div class="planet item">
<div class="planet item">
<?php if ($planet->getId() != $this->getCurrentPlanet()->getId()):?>
<a href="<?php echo $this->getUrl('', array('cp' => $planet->getId()))?>"><?php echo $this->escape($planet->getName())?> [<?php echo $this->escape($planet->getCoords())?>]</a>
<a href="<?php echo $this->getUrl('', array('cp' => $planet->getId()))?>"><?php echo $this->escape($planet->getName())?> [<?php echo $this->escape($planet->getCoords())?>]</a>
<?php else:?>
<?php echo $this->escape($planet->getName())?> [<?php echo $this->escape($planet->getCoords())?>]
<?php endif?>
</div>
</div>
<?php endforeach?>
</div>
<div class="arrow right">&#8680;</div>
</div>
<div class="resources-display">
<div class="resource metal">

View file

@ -43,6 +43,8 @@ define('LEVEL_OPERATOR', 2);
define('LEVEL_MODERATOR', 1);
define('LEVEL_PLAYER', 0);
define('ALLOW_SPY_DRONE_ATTACKS', true);
// Nombre de colones pour les rapports d'espionnage
define('SPY_REPORT_ROW', 2);

View file

@ -125,33 +125,32 @@ EOF;
* @param $title
* @return unknown_type
*/
function error($message, $title)
public function error($message, $title)
{
global $link, $gameConfig;
$gameConfig = Legacies_Core_Model_Config::getSingleton();
if($gameConfig['debug']==1){
if ($gameConfig['debug'] == 1) {
echo "<h2>$title</h2><br><font color=red>$message</font><br><hr>";
echo "<table>".$this->log."</table>";
}
global $user;
$user = Legacies_Empire_Model_User::getSingleton();
$db = Legacies_Database::getSingleton();
$config = include ROOT_PATH . 'config.' . PHPEXT;
if(!$link) die('La base de donnee n est pas disponible pour le moment, desole pour la gene occasionnee...');
$query = "INSERT INTO {{table}} SET
`error_sender` = '{$user['id']}' ,
`error_time` = '".time()."' ,
`error_type` = '{$title}' ,
`error_text` = '".mysql_escape_string($message)."';";
$sqlquery = mysql_query(str_replace("{{table}}", $dbsettings["prefix"].'errors',$query))
or die('error fatal');
$query = "explain select * from {{table}}";
$q = mysql_fetch_array(mysql_query(str_replace("{{table}}", $dbsettings["prefix"].
'errors', $query))) or die('error fatal: ');
$query = "INSERT INTO {$db->getTable('errors')} SET
`error_sender` = {$user->getId()} ,
`error_time` = {$db->quote(time())},
`error_type` = {$db->quote($title)},
`error_text` = {$db->quote($message)}";
$db->query($query);
$id = $db->lastInsertId($db->getTable('errors'));
if (!function_exists('message')) {
echo "Erreur, merci de contacter l'admin. Erreur n<>: <b>".$q['rows']."</b>";
echo "Erreur, merci de contacter l'admin. Erreur n<>: <b>".$id."</b>";
} else {
message("Erreur, merci de contacter l'admin. Erreur n<>: <b>".$q['rows']."</b>", "Erreur");
message("Erreur, merci de contacter l'admin. Erreur n<>: <b>".$id."</b>", "Erreur");
}
}
}

View file

@ -37,7 +37,7 @@ function BuildFlyingFleetTable () {
$TableTPL = gettemplate('admin/fleet_rows');
$FlyingFleets = doquery ("SELECT * FROM {{table}} ORDER BY `fleet_end_time` ASC;", 'fleets');
while ( $CurrentFleet = mysql_fetch_assoc( $FlyingFleets ) ) {
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'];

View file

@ -50,7 +50,7 @@ function DeleteSelectedUser ( $UserID ) {
doquery ( "DELETE FROM {{table}} WHERE `stat_type` = '1' AND `id_owner` = '" . $UserID . "';", 'statpoints' );
$ThePlanets = doquery ( "SELECT * FROM {{table}} WHERE `id_owner` = '" . $UserID . "';", 'planets' );
while ( $OnePlanet = mysql_fetch_assoc ( $ThePlanets ) ) {
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 ) {

View file

@ -36,10 +36,12 @@
function MissionCaseColonisation ( $FleetRow ) {
global $lang, $resource;
$iPlanetCount = mysql_result(doquery ("SELECT count(*) FROM {{table}} WHERE `id_owner` = '". $FleetRow['fleet_owner'] ."' AND `planet_type` = '1'", 'planets'), 0);
$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 ??
$iGalaxyPlace = mysql_result(doquery ("SELECT count(*) FROM {{table}} WHERE `galaxy` = '". $FleetRow['fleet_end_galaxy']."' AND `system` = '". $FleetRow['fleet_end_system']."' AND `planet` = '". $FleetRow['fleet_end_planet']."';", 'galaxy'), 0);
$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 !

View file

@ -63,38 +63,51 @@ function GetGameSpeedFactor () {
* Calcul de la vitesse de la flotte par rapport aux technos du joueur
* Avec prise en compte
*/
function GetFleetMaxSpeed ($FleetArray, $Fleet, $Player) {
function GetFleetMaxSpeed($FleetArray, $Fleet, $Player) {
global $reslist, $pricelist;
if (!is_array($FleetArray)) {
$FleetArray = array();
}
if ($Fleet != 0) {
$FleetArray[$Fleet] = 1;
}
$speedalls = array();
foreach ($FleetArray as $Ship => $Count) {
if ($Ship == 202) {
if ($Ship == Legacies_Empire::ID_SHIP_SOLAR_SATELLITE) {
$speedalls[$Ship] = 0;
}
if ($Ship == Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT) {
if ($Player['impulse_motor_tech'] >= 5) {
$speedalls[$Ship] = $pricelist[$Ship]['speed2'] + (($pricelist[$Ship]['speed'] * $Player['impulse_motor_tech']) * 0.2);
} else {
$speedalls[$Ship] = $pricelist[$Ship]['speed'] + (($pricelist[$Ship]['speed'] * $Player['combustion_tech']) * 0.1);
}
}
if ($Ship == 203 or $Ship == 204 or $Ship == 209 or $Ship == 210) {
if ($Ship == Legacies_Empire::ID_SHIP_LARGE_TRANSPORT || $Ship == Legacies_Empire::ID_SHIP_LIGHT_FIGHTER ||
$Ship == Legacies_Empire::ID_SHIP_RECYCLER || $Ship == Legacies_Empire::ID_SHIP_SPY_DRONE) {
$speedalls[$Ship] = $pricelist[$Ship]['speed'] + (($pricelist[$Ship]['speed'] * $Player['combustion_tech']) * 0.1);
}
if ($Ship == 205 or $Ship == 206 or $Ship == 208) {
if ($Ship == Legacies_Empire::ID_SHIP_HEAVY_FIGHTER || $Ship == Legacies_Empire::ID_SHIP_CRUISER ||
$Ship == Legacies_Empire::ID_SHIP_COLONY_SHIP) {
$speedalls[$Ship] = $pricelist[$Ship]['speed'] + (($pricelist[$Ship]['speed'] * $Player['impulse_motor_tech']) * 0.2);
}
if ($Ship == 211) {
if ($Ship == Legacies_Empire::ID_SHIP_BOMBER) {
if ($Player['hyperspace_motor_tech'] >= 8) {
$speedalls[$Ship] = $pricelist[$Ship]['speed2'] + (($pricelist[$Ship]['speed'] * $Player['hyperspace_motor_tech']) * 0.3);
} else {
$speedalls[$Ship] = $pricelist[$Ship]['speed'] + (($pricelist[$Ship]['speed'] * $Player['impulse_motor_tech']) * 0.2);
}
}
if ($Ship == 207 or $Ship == 213 or $Ship == 214 or $Ship == 215 or $Ship == 216) {
if ($Ship == Legacies_Empire::ID_SHIP_BATTLESHIP || $Ship == Legacies_Empire::ID_SHIP_DESTRUCTOR ||
$Ship == Legacies_Empire::ID_SHIP_DEATH_STAR || $Ship == Legacies_Empire::ID_SHIP_BATTLECRUISER ||
$Ship == Legacies_Empire::ID_SHIP_SUPERNOVA) {
$speedalls[$Ship] = $pricelist[$Ship]['speed'] + (($pricelist[$Ship]['speed'] * $Player['hyperspace_motor_tech']) * 0.3);
}
}
if ($Fleet != 0) {
if ($Fleet != 0 && isset($speedalls[$Ship])) {
$ShipSpeed = $speedalls[$Ship];
$speedalls = $ShipSpeed;
}

View file

@ -1,6 +1,6 @@
<?php
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -153,7 +153,7 @@ if (isset($_POST) && !empty($_POST)) {
planet = '" . $irak['planet_angreifer'] . "' AND
planet_type = '1'", 'planets', true);
if (mysql_num_rows($planet_start) == 1) {
if ($planet_start->rowCount() == 1) {
$planet = mysql_fetch_array($planet_start);
}
@ -197,7 +197,7 @@ if (isset($_POST) && !empty($_POST)) {
$newMessages = new Legacies_Core_View();
$newMessages->setTemplate('empire/overview/messages.phtml');
$newMessages['count'] = (int) $count;
/** Gestion des officiers
* Update miner and raider level
*
@ -220,7 +220,7 @@ if (isset($_POST) && !empty($_POST)) {
$user->setData('rpg_points', $user->getData('rpg_points') +1);
$user->save();
}
/**
* Page display
* Refactoring needed

View file

@ -81,7 +81,7 @@ require_once dirname(__FILE__) .'/common.php';
$FleetToTarget = doquery( $QryLookFleets, 'fleets' );
if (mysql_num_rows($FleetToTarget) <> 0 ) {
if ($FleetToTarget->rowCount() > 0 ) {
while ($FleetRow = $FleetToTarget->fetch(PDO::FETCH_BOTH)) {
$Record++;

12
rak.php
View file

@ -53,12 +53,12 @@ if (isset($resource) && !empty($resource[401])) {
$select_owner = doquery("SELECT military_tech FROM {{table}} WHERE
id = '" . $selected_row['owner'] . "'", 'users');
if (mysql_num_rows($planetrow) != 1 OR mysql_num_rows($select_ziel) != 1) {
if ($planetrow->rowCount() != 1 || $select_ziel->rowCount() != 1) {
doquery("DELETE FROM {{table}} WHERE id = '" . $selected_row['id'] . "'", 'iraks');
} else {
$verteidiger = mysql_fetch_array($select_ziel);
$angreifer = mysql_fetch_array($select_owner);
$planet = mysql_fetch_array($planetrow);
$verteidiger = $select_ziel->fetch(PDO::FETCH_BOTH);
$angreifer = $select_owner->fetch(PDO::FETCH_BOTH);
$planet = $planetrow->fetch(PDO::FETCH_BOTH);
$ids = array(0 => 401,
1 => 402,
@ -136,7 +136,7 @@ if (isset($resource) && !empty($resource[401])) {
system = '" . $selected_row['system_angreifer'] . "' AND
planet = '" . $selected_row['planet_angreifer'] . "'", 'planets');
if (mysql_num_rows($planet_) == 1) {
if ($planet_->rowCount() == 1) {
$array = mysql_fetch_array($planet_);
$name = $array['name'];
@ -147,7 +147,7 @@ if (isset($resource) && !empty($resource[401])) {
system = '" . $selected_row['system'] . "' AND
planet = '" . $selected_row['planet'] . "'", 'planets');
if (mysql_num_rows($planet_2) == 1) {
if ($planet_2->rowCount() == 1) {
$array = mysql_fetch_array($planet_2);
$name_deffer = $array['name'];

View file

@ -65,7 +65,7 @@ elseif ($user['impulse_motor_tech'] == 0) {;
elseif ($tempvar1 >= $tempvar2 || $g != $currentplanet['galaxy']) {
$error = 1;
}
elseif (mysql_num_rows($tempvar3) != 1) {
elseif ($tempvar3->rowCount() != 1) {
$error = 1;
}
elseif ($anz > $iraks) {

View file

@ -53,7 +53,8 @@ if (!empty($_POST) && isset($_POST['username']) && isset($_POST['planet_name'])
if ($user !== null && $user->getId()) {
header("HTTP/1.1 302 Found");
header("Location: welcome.php");
//header("Location: welcome.php");
header("Location: frames.php");
} else {
header("HTTP/1.1 302 Found");
header("Location: reg.php");

View file

@ -52,10 +52,10 @@ function min(a, b) {
function maxspeed() {
var msp = 1000000000;
for (i = 200; i < 220; i++) {
if (document.getElementsByName("ship" + i)[0]) {
if ((document.getElementsByName("speed" + i)[0].value * 1) >= 1
&& (document.getElementsByName("ship" + i)[0].value * 1) >= 1) {
msp = min(msp, document.getElementsByName("speed" + i)[0].value);
if (document.getElementsByName("ship[" + i + "]")[0]) {
if ((document.getElementsByName("speed[" + i + "]")[0].value * 1) >= 1
&& (document.getElementsByName("ship[" + i + "]")[0].value * 1) >= 1) {
msp = min(msp, document.getElementsByName("speed[" + i + "]")[0].value);
}
}
}
@ -113,10 +113,10 @@ function consumption2() {
var basicConsumption = 0;
for (i = 200; i < 220; i++) {
if (document.getElementsByName("ship" + i)[0]) {
if (document.getElementsByName("ship[" + i + "]")[0]) {
basicConsumption = basicConsumption +
document.getElementsByName("consumption" + i)[0].value
* document.getElementsByName("ship" + i)[0].value;
document.getElementsByName("consumption[" + i + "]")[0].value
* document.getElementsByName("ship[" + i + "]")[0].value;
}
}
@ -143,16 +143,16 @@ function consumption() {
speedfactor = document.getElementsByName("speedfactor")[0].value;
for (i = 200; i < 220; i++) {
if (document.getElementsByName("ship" + i)[0]) {
shipspeed = document.getElementsByName("speed" + i)[0].value;
if (document.getElementsByName("ship[" + i + "]")[0]) {
shipspeed = document.getElementsByName("speed[" + i + "]")[0].value;
spd = 35000 / (dur * speedfactor - 10) * Math.sqrt(dist * 10 / shipspeed);
//spd = Math.max(msp / document.getElementsByName("speed" + i)[0].value, 0.1);
//spd = Math.min(spd, 1.0);
//spd = spd * sp;
//spd = 10;
basicConsumption = document.getElementsByName("consumption" + i)[0].value
* document.getElementsByName("ship" + i)[0].value;
basicConsumption = document.getElementsByName("consumption[" + i + "]")[0].value
* document.getElementsByName("ship[" + i + "]")[0].value;
consumption += basicConsumption * dist / 35000 * ((spd / 10) + 1) * ((spd / 10) + 1);
// values = values + " " + spd;
}
@ -208,11 +208,11 @@ function storage() {
for (i = 200; i < 300; i++) {
if (document.getElementsByName("ship" + i)[0]) {
if ((document.getElementsByName("ship" + i)[0].value * 1) >= 1) {
if (document.getElementsByName("ship[" + i + "]")[0]) {
if ((document.getElementsByName("ship[" + i + "]")[0].value * 1) >= 1) {
storage
+= document.getElementsByName("ship" + i)[0].value
* document.getElementsByName("capacity" + i)[0].value
+= document.getElementsByName("ship[" + i + "]")[0].value
* document.getElementsByName("capacity[" + i + "]")[0].value
}
}
}
@ -359,7 +359,7 @@ function maxShip(id) {
function maxShips() {
var id;
for (i = 200; i < 220; i++) {
id = "ship"+i;
id = "ship["+i+"]";
maxShip(id);
}
}
@ -375,7 +375,7 @@ function noShip(id) {
function noShips (){
var id;
for (i = 200; i < 220; i++) {
id = "ship"+i;
id = "ship["+i+"]";
noShip(id);
}
}

View file

@ -74,7 +74,7 @@ switch($type){
*/
if(isset($searchtext) && isset($type)){
while($r = mysql_fetch_array($search, MYSQL_BOTH)){
while($r = $search->fetch(PDO::FETCH_BOTH)){
if($type=='playername'||$type=='planetname'){
$s=$r;

View file

@ -1,5 +1,5 @@
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,31 +1,3 @@
.allymember {
color: lime;
}
.noob {
color: #a0ffa0;
}
.strong {
color: #ffa0a0;
}
.vacation {
color: skyblue;
}
.inactive {
color: CCCCCC;
}
.longinactive {
color: 999999;
}
.banned {
text-decoration: line-through;
}
.flight {
}

View file

@ -10,21 +10,10 @@ __ __ _ _
*/
., #, td, th, textarea, body, table
{
font-family : Tahoma,sans-serif;
font-size : 10px;
}
* {font-family:Tahoma,sans-serif;font-size:10px;}
img
{
border : 0px;
}
p table
{
border : 0px;
}
img {border:none;}
p table {border:none;}
p td
{
@ -33,78 +22,29 @@ p td
font-family : Tahoma,sans-serif;
}
table table
{
border : 0px;
}
table table {border:0px;}
table table td
{
font-size : 10px;
font-family : Tahoma,sans-serif;
}
body {color:#000;margin:1px 0 0 1px;background:#040e1e url(../../graphics/img/background2.jpg) fixed no-repeat top left;}
body
{
color : #FFFFFF;
margin-top : 1px;
margin-left : 1px;
background-color : #040e1e;
background-image : url(img/background2.jpg);
background-attachment: fixed;
background-repeat : no-repeat;
background-position : top left;
scrollbar-arrow-color: #FFFFFF;
scrollbar-base-color: #344566;
scrollbar-track-color: #344566;
scrollbar-face-color: #344566;
scrollbar-highlight-color: #344566;
scrollbar-3dlight-color: #465673;
scrollbar-darkshadow-color: #344566;
scrollbar-shadow-color: #465673;
font-size : 10px;
font-family : Tahoma,sans-serif;
}
body.style {background-image:url(../../graphics/img/background1.jpg);}
body.style table {margin:0px;border:0 auto}
body form table th table input {width: 60px;}
body.style{
background-image : url(img/background1.jpg);
}
body.style table {
margin : 0px;
}
body form table th table input
{
width: 60px;
}
.content table {margin:0 auto;}
th, td.a, td.b, td.c, td.f, td.g, td.h, td.i,
td.j, td.k, td.l, td.m, td.n, td.o, td.q, td.r,
td.v, .style td, p td, table.s th img
{
border : 1px #545454 solid;
font-size : 10px;
font-family : Tahoma,sans-serif;
}
input, select, textarea
{
border : 1px #545454 solid;
font-size : 10px;
font-family : Tahoma,sans-serif;
}
th, td.a, td.b, td.c, td.f, input, select, td.g,
td.h, td.i, td.j, td.k, td.m, td.o, td.q, td.r,
td.v, td.s, .style td, p td
{
background-color : #000000;
filter : alpha(opacity=70);
-moz-opacity : 0.7;
-khtml-opacity : 0.7;
opacity : 0.7;
}
th, td.a,td.b,td.c,td.f,input,select,td.g,td.h,td.i,td.j,td.k,td.m,td.o,td.q,td.r,td.v,td.s,.style td,p td {background:#FFF;filter:alpha(opacity=90);-moz-opacity:0.9;-khtml-opacity:0.9;opacity:0.9;}
th
{
@ -130,7 +70,7 @@ td.c
color : #FFFFFF;
padding-left : 3px;
background-image : url(img/bg1.gif);
filter : alpha(opacity=70);
filter : alpha(opacity=90);
-moz-opacity : 0.7;
-khtml-opacity : 0.7;
opacity : 0.7;
@ -140,7 +80,7 @@ td.f, input, select, textarea
{
color : #FFFFFF;
background-color : #1c1c1c;
filter : alpha(opacity=70);
filter : alpha(opacity=90);
-moz-opacity : 0.7;
-khtml-opacity : 0.7;
opacity : 0.7;
@ -265,24 +205,24 @@ div.z
{
font-size : 10px;
font-weight : bold;
color : #FFFFFF;
color : #000;
}
a
{
color : #FFFFFF;
color : #000;
text-decoration : none;
font-weight : bold;
}
a.s
{
color : #FFFFFF;
color : #000;
}
a.t
{
color : #FFFFFF;
color : #000;
}
a:hover

View file

@ -1,5 +1,5 @@
/**
* Tis file is part of XNova:Legacies
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/

View file

@ -1,5 +1,12 @@
@CHARSET "UTF-8";
.global .content .resources-display {width:770px;height:40px;margin:0 auto 30px;padding:0 50px;color:#000;background:#FFF;box-shadow:0 -4px 6px #156 inset;border:1px solid #FFF;border-top:none;border-radius: 0 0 20px 20px;}
.global .content .planet-carrousel {width:950px;height:100px;margin:0 auto;padding:0 30px;color:#000;background:#FFF;border:1px solid #FFF;border-top:none;box-shadow:0 -4px 8px #115566 inset, 20px 20px 40px #115566, -20px 20px 40px #115566, 0 -20px 40px #115566;border-bottom-left-radius:50px;border-bottom-right-radius:50px;}
.global .content .planet-carrousel .items {width:900px;height:100px;overflow:hidden;float:left;}
.global .content .planet-carrousel .arrow {height:40px;width:25px;float:left;font-size:20px;font-weight:bold;margin:30px 0;}
.global .content .planet-carrousel .planet {color:#000;height:100px;width:100px;float:left;}
.global .content .planet-carrousel .planet a {color:#000;}
.global .content .resources-display {width:770px;height:40px;margin:0 auto 30px;padding:0 50px;color:#000;background:#FFF;box-shadow:0 -4px 6px #115566 inset, 0 20px 40px #115566;border:1px solid #FFF;border-top:none;border-radius: 0 0 20px 20px;}
.global .content .resources-display .resource,.global .content .resources-display .messages {height:22px;float:left;width:140px;margin:7px 0;}
.global .content .resources-display .resource img,.global .content .resources-display .messages img {float:left;}
.global .content .resources-display .resource p,.global .content .resources-display .messages p {font-weight:bold;font-size:12px;margin:2px 0 2px 47px;}
@ -8,15 +15,25 @@
.global .content .resources-display .messages {height:22px;float:left;width:160px;}
.global .content .resources-display .energy {width:190px;}
.global .content .queue {width:600px;margin:10px auto 0;background:#FFF;color:#000;border:1px solid #FFF;border-radius:5px;border-top-left-radius:20px;border-top-right-radius:20px;box-shadow:0 4px 6px #156 inset;}
.global .content .queue h1 {color:#000;margin:10px 15px;width:570px;text-align:center;border-bottom:5px solid #9BC;}
.global .content .queue .item {width:580px;margin:0 10px;border:0;box-shadow:none;border-radius:0;}
.global .content .queue .item,.global .content .queue .item * {color:#000;}
.global .content .item-list {width:800px; margin:10px auto 0;background:#FFF;color:#000;border:1px solid #FFF;border-radius:5px;border-top-left-radius:20px;border-top-right-radius:20px;box-shadow:0 4px 6px #156 inset;}
.global .content .item-list {width:800px; margin:10px auto 0;background:#FFF;color:#000;border:1px solid #FFF;border-radius:5px;border-top-left-radius:20px;border-top-right-radius:20px;box-shadow:0 -4px 8px #115566 inset, 20px 20px 40px #115566, -20px 20px 40px #115566, 0 -20px 40px #115566;}
.global .content .item-list h1 {color:#000;margin:10px 15px;width:770px;text-align:center;border-bottom:5px solid #9BC;}
.global .content .item-list .item {width:780px;margin:0 10px;border:0;box-shadow:none;border-radius:0;}
.global .content .item-list .item,.global .content .item-list .item * {color:#000;}
.global .content .item-list .item,.global .content .item-list .item * {color:#000;}
/**
* Galaxy user name display colors
*/
.allymember {color:lime;}
.noob {color:darkgreen;}
.strong {color:darkred;}
.vacation {color:lightblue;}
.inactive {color:grey;}
.longinactive {color:darkgrey;}
.banned {color:red;text-decoration:line-through;}

View file

@ -42,7 +42,7 @@ require_once dirname(__FILE__) .'/common.php';
$query = doquery("SELECT * FROM {{table}} WHERE fleet_id = '" . $fleetid . "'", 'fleets');
if (mysql_num_rows($query) != 1) {
if ($query->rowCount() != 1) {
message('Cette flotte n\'existe pas (ou plus)!', 'Erreur');
}
@ -104,10 +104,9 @@ require_once dirname(__FILE__) .'/common.php';
id = '" . $fleet['fleet_group'] . "'"
, 'aks');
if (mysql_num_rows($aks) != 1) {
if ($aks->rowCount() != 1) {
message('AKS nicht gefunden!', 'Fehler');
}
$aks = mysql_num_rows($aks);
}
$missiontype = array(1 => 'Attaquer',