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 <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

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

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

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

View file

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

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

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

View file

@ -40,7 +40,7 @@ $mode = isset($_GET['mode']) ? $_GET['mode'] : null;
switch ($mode) { switch ($mode) {
case 'fleet': 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 = new Legacies_Core_Layout();
$layout->load('message'); $layout->load('message');
@ -71,7 +71,7 @@ case 'fleet':
break; break;
case 'research': 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 = new Legacies_Core_Layout();
$layout->load('message'); $layout->load('message');
@ -99,7 +99,7 @@ case 'research':
break; break;
case 'defense': 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 = new Legacies_Core_Layout();
$layout->load('message'); $layout->load('message');

View file

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

134
fleet.php
View file

@ -32,58 +32,71 @@ define('INSIDE' , true);
define('INSTALL' , false); define('INSTALL' , false);
require_once dirname(__FILE__) .'/common.php'; 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 //Compteur de flotte en expéditions et nombre d'expédition maximum
$MaxExpedition = $user[$resource[124]]; $maxExpedition = $user->getElement(Legacies_Empire::ID_RESEARCH_EXPEDITION_TECHNOLOGY);
if ($MaxExpedition >= 1) { $ExpeditionEnCours = 0;
$maxexpde = doquery("SELECT COUNT(fleet_owner) AS `expedi` FROM {{table}} WHERE `fleet_owner` = '".$user['id']."' AND `fleet_mission` = '15';", 'fleets', true); $EnvoiMaxExpedition = 0;
$ExpeditionEnCours = $maxexpde['expedi']; if ($maxExpedition >= 1) {
$EnvoiMaxExpedition = 1 + floor( $MaxExpedition / 3 ); $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[$resource[108]]; $MaxFlottes = 1 + $user->getElement(Legacies_Empire::ID_RESEARCH_COMPUTER_TECHNOLOGY);
CheckPlanetUsedFields($planetrow);
includeLang('fleet'); includeLang('fleet');
$missiontype = array( $missionTypes = array(
1 => $lang['type_mission'][1], Legacies_Empire::ID_MISSION_ATTACK => $lang['type_mission'][Legacies_Empire::ID_MISSION_ATTACK],
2 => $lang['type_mission'][2], Legacies_Empire::ID_MISSION_GROUP_ATTACK => $lang['type_mission'][Legacies_Empire::ID_MISSION_GROUP_ATTACK],
3 => $lang['type_mission'][3], Legacies_Empire::ID_MISSION_TRANSPORT => $lang['type_mission'][Legacies_Empire::ID_MISSION_TRANSPORT],
4 => $lang['type_mission'][4], Legacies_Empire::ID_MISSION_STATION => $lang['type_mission'][Legacies_Empire::ID_MISSION_STATION],
5 => $lang['type_mission'][5], Legacies_Empire::ID_MISSION_STATION_ALLY => $lang['type_mission'][Legacies_Empire::ID_MISSION_STATION_ALLY],
6 => $lang['type_mission'][6], Legacies_Empire::ID_MISSION_SPY => $lang['type_mission'][Legacies_Empire::ID_MISSION_SPY],
7 => $lang['type_mission'][7], Legacies_Empire::ID_MISSION_SETTLE_COLONY => $lang['type_mission'][Legacies_Empire::ID_MISSION_SETTLE_COLONY],
8 => $lang['type_mission'][8], Legacies_Empire::ID_MISSION_RECYCLE => $lang['type_mission'][Legacies_Empire::ID_MISSION_RECYCLE],
9 => $lang['type_mission'][9], Legacies_Empire::ID_MISSION_DESTROY => $lang['type_mission'][Legacies_Empire::ID_MISSION_DESTROY],
15 => $lang['type_mission'][15] Legacies_Empire::ID_MISSION_EXPEDITION => $lang['type_mission'][Legacies_Empire::ID_MISSION_EXPEDITION]
); );
// Histoire de recuperer les infos passées par galaxy // Histoire de recuperer les infos passées par galaxy
$galaxy = $_GET['galaxy']; $galaxy = isset($_GET['galaxy']) ? intval($_GET['galaxy']) : 0;
$system = $_GET['system']; $system = isset($_GET['system']) ? intval($_GET['system']) : 0;
$planet = $_GET['planet']; $position = isset($_GET['planet']) ? intval($_GET['planet']) : 0;
$planettype = $_GET['planettype']; $planetType = isset($_GET['planettype']) ? intval($_GET['planettype']) : 0;
$target_mission = $_GET['target_mission']; $targetMission = isset($_GET['target_mission']) ? intval($_GET['target_mission']) : 0;
if (!$galaxy) { $user = Legacies_Empire_Model_User::getSingleton();
$galaxy = $planetrow['galaxy']; $planet = $user->getCurrentPlanet();
if ($galaxy <= 0 || $galaxy > MAX_GALAXY_IN_WORLD) {
$galaxy = $planet['galaxy'];
} }
if (!$system) { if ($system <= 0 || $system > MAX_SYSTEM_IN_GALAXY) {
$system = $planetrow['system']; $system = $planet['system'];
} }
if (!$planet) { if ($position <= 0 || $position > MAX_PLANET_IN_SYSTEM) {
$planet = $planetrow['planet']; $position = $planet['planet'];
}
if (!$planettype) {
$planettype = $planetrow['planet_type'];
} }
$page = "<script language=\"JavaScript\" src=\"scripts/flotten.js\"></script>\n"; $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 .= "<script language=\"JavaScript\" src=\"scripts/ocnt.js\"></script>\n";
$page .= "<br><center>"; $page .= "<br><center>";
$page .= "<table width='519' border='0' cellpadding='0' cellspacing='1'>"; $page .= "<table width='519' border='0' cellpadding='0' cellspacing='1'>";
@ -111,19 +124,15 @@ require_once dirname(__FILE__) .'/common.php';
$page .= "<th>".$lang['fl_order']."</th>"; $page .= "<th>".$lang['fl_order']."</th>";
$page .= "</tr>"; $page .= "</tr>";
// Gestion des flottes du joueur actif
$fq = doquery("SELECT * FROM {{table}} WHERE fleet_owner={$user[id]}", "fleets");
$i = 0; $i = 0;
foreach ($user->getFleetCollection() as $f) {
while ($f = $fq->fetch(PDO::FETCH_BOTH)) {
$i++; $i++;
$page .= "<tr height=20>"; $page .= "<tr height=20>";
// (01) Fleet ID // (01) Fleet ID
$page .= "<th>".$i."</th>"; $page .= "<th>".$i."</th>";
// (02) Fleet Mission // (02) Fleet Mission
$page .= "<th>"; $page .= "<th>";
$page .= "<a>". $missiontype[$f[fleet_mission]] ."</a>"; $page .= "<a>". $missionTypes[$f['fleet_mission']] ."</a>";
if (($f['fleet_start_time'] + 1) == $f['fleet_end_time']) { if (($f['fleet_start_time'] + 1) == $f['fleet_end_time']) {
$page .= "<br><a title=\"".$lang['fl_back_to_ttl']."\">".$lang['fl_back_to']."</a>"; $page .= "<br><a title=\"".$lang['fl_back_to_ttl']."\">".$lang['fl_back_to']."</a>";
} else { } else {
@ -145,13 +154,13 @@ require_once dirname(__FILE__) .'/common.php';
} }
} }
} }
$page .= "\">". pretty_number($f[fleet_amount]) ."</a></th>"; $page .= "\">". pretty_number($f['fleet_amount']) ."</a></th>";
// (04) Fleet From (Planete d'origine) // (04) Fleet From (Planete d'origine)
$page .= "<th>[".$f[fleet_start_galaxy].":".$f[fleet_start_system].":".$f[fleet_start_planet]."]</th>"; $page .= "<th>[".$f[fleet_start_galaxy].":".$f['fleet_start_system'].":".$f['fleet_start_planet']."]</th>";
// (05) Fleet Start Time // (05) Fleet Start Time
$page .= "<th>". gmdate("d. M Y H:i:s", $f['fleet_start_time']) ."</th>"; $page .= "<th>". gmdate("d. M Y H:i:s", $f['fleet_start_time']) ."</th>";
// (06) Fleet Target (Planete de destination) // (06) Fleet Target (Planete de destination)
$page .= "<th>[".$f[fleet_end_galaxy].":".$f[fleet_end_system].":".$f[fleet_end_planet]."]</th>"; $page .= "<th>[".$f['fleet_end_galaxy'].":".$f['fleet_end_system'].":".$f['fleet_end_planet']."]</th>";
// (07) Fleet Target Time // (07) Fleet Target Time
$page .= "<th>". gmdate("d. M Y H:i:s", $f['fleet_end_time']) ."</th>"; $page .= "<th>". gmdate("d. M Y H:i:s", $f['fleet_end_time']) ."</th>";
// (08) Fleet Back Time // (08) Fleet Back Time
@ -216,34 +225,28 @@ require_once dirname(__FILE__) .'/common.php';
$page .= "<th>-</th>"; $page .= "<th>-</th>";
$page .= "</tr>"; $page .= "</tr>";
if (!$planetrow) { if (!$planet) {
message($lang['fl_noplanetrow'], $lang['fl_error']); 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 = ""; $ShipData = "";
foreach ($reslist['fleet'] as $n => $i) { foreach ($reslist['fleet'] as $n => $i) {
if ($planetrow[$resource[$i]] > 0) { if ($planet[$resource[$i]] > 0) {
$page .= "<tr height=\"20\">"; $page .= "<tr height=\"20\">";
$page .= "<th><a title=\"". $lang['fl_fleetspeed'] . $CurrentShipSpeed ."\">" . $lang['tech'][$i] . "</a></th>"; $page .= "<th><a title=\"". $lang['fl_fleetspeed'] /*. $CurrentShipSpeed*/ ."\">" . $lang['tech'][$i] . "</a></th>";
$page .= "<th>". pretty_number ($planetrow[$resource[$i]]); $page .= "<th>". pretty_number ($planet[$resource[$i]]);
$ShipData .= "<input type=\"hidden\" name=\"maxship". $i ."\" value=\"". $planetrow[$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=\"consumption[". $i ."]\" value=\"". GetShipConsumption ( $i, $user ) ."\" />";
$ShipData .= "<input type=\"hidden\" name=\"speed" .$i ."\" value=\"" . GetFleetMaxSpeed ("", $i, $user) . "\" />"; $ShipData .= "<input type=\"hidden\" name=\"speed[" .$i ."]\" value=\"" . GetFleetMaxSpeed ("", $i, $user) . "\" />";
$ShipData .= "<input type=\"hidden\" name=\"capacity". $i ."\" value=\"". $pricelist[$i]['capacity'] ."\" />"; $ShipData .= "<input type=\"hidden\" name=\"capacity[". $i ."]\" value=\"". $pricelist[$i]['capacity'] ."\" />";
$page .= "</th>"; $page .= "</th>";
// Satelitte Solaire (eux ne peuvent pas bouger !) // Satelitte Solaire (eux ne peuvent pas bouger !)
if ($i == 212) { if ($i == 212) {
$page .= "<th></th><th></th>"; $page .= "<th></th><th></th>";
} else { } else {
$page .= "<th><a href=\"javascript:maxShip('ship". $i ."'); shortInfo();\">".$lang['fl_selmax']."</a> </th>"; $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 .= "<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>"; $page .= "</tr>";
} }
@ -271,15 +274,14 @@ require_once dirname(__FILE__) .'/common.php';
$page .= $ShipData; $page .= $ShipData;
$page .= "<input type=\"hidden\" name=\"galaxy\" value=\"". $galaxy ."\" />"; $page .= "<input type=\"hidden\" name=\"galaxy\" value=\"". $galaxy ."\" />";
$page .= "<input type=\"hidden\" name=\"system\" value=\"". $system ."\" />"; $page .= "<input type=\"hidden\" name=\"system\" value=\"". $system ."\" />";
$page .= "<input type=\"hidden\" name=\"planet\" value=\"". $planet ."\" />"; $page .= "<input type=\"hidden\" name=\"planet\" value=\"". $position ."\" />";
$page .= "<input type=\"hidden\" name=\"planet_type\" value=\"". $planettype ."\" />"; $page .= "<input type=\"hidden\" name=\"planet_type\" value=\"". $planetType ."\" />";
$page .= "<input type=\"hidden\" name=\"mission\" value=\"". $target_mission ."\" />"; $page .= "<input type=\"hidden\" name=\"mission\" value=\"". $targetMission ."\" />";
$page .= "<input type=\"hidden\" name=\"maxepedition\" value=\"". $EnvoiMaxExpedition ."\" />"; $page .= "<input type=\"hidden\" name=\"maxepedition\" value=\"". $EnvoiMaxExpedition ."\" />";
$page .= "<input type=\"hidden\" name=\"curepedition\" value=\"". $ExpeditionEnCours ."\" />"; $page .= "<input type=\"hidden\" name=\"curepedition\" value=\"". $ExpeditionEnCours ."\" />";
$page .= "<input type=\"hidden\" name=\"target_mission\" value=\"". $target_mission ."\" />"; $page .= "<input type=\"hidden\" name=\"target_mission\" value=\"". $targetMission ."\" />";
$page .= "</form>"; $page .= "</form>";
$page .= "</center>"; $page .= "</center>";
display($page, $lang['fl_title']); display($page, $lang['fl_title']);
?>

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/
@ -45,53 +45,90 @@ require_once dirname(__FILE__) .'/common.php';
1 => 10, 1 => 10,
); );
$g = $_POST['galaxy']; $user = Legacies_Empire_Model_User::getSingleton();
$s = $_POST['system']; $planetrow = $user->getCurrentPlanet();
$p = $_POST['planet'];
$t = $_POST['planet_type'];
if (!$g) { $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;
if ($g <= 0 || $g > MAX_GALAXY_IN_WORLD) {
$g = $planetrow['galaxy']; $g = $planetrow['galaxy'];
} }
if (!$s) { if ($s <= 0 || $s > MAX_SYSTEM_IN_GALAXY) {
$s = $planetrow['system']; $s = $planetrow['system'];
} }
if (!$p) { if ($p <= 0 || $p > MAX_PLANET_IN_SYSTEM) {
$p = $planetrow['planet']; $p = $planetrow['planet'];
} }
if (!$t) { $allowedPlanetTypes = array(
$t = $planetrow['planet_type']; Legacies_Empire_Model_Planet::TYPE_PLANET,
Legacies_Empire_Model_Planet::TYPE_DEBRIS,
Legacies_Empire_Model_Planet::TYPE_MOON
);
if (!in_array($t, $allowedPlanetTypes)) {
$t = $planet['planet_type'];
} }
// Verifions si nous avons bien tout ce que nous voullons envoyer $session = Legacies::getSession('fleet');
$session->clearData();
$FleetHiddenBlock = ""; $FleetHiddenBlock = "";
foreach ($reslist['fleet'] as $n => $i) {
if ($i > 200 && $i < 300 && $_POST["ship$i"] > "0") { $fleetArray = array();
if ($_POST["ship$i"] > $planetrow[$resource[$i]]) { $speedArray = array();
$page .= $lang['fl_noenought']; $consumptionArray = array();
$speedalls[$i] = GetFleetMaxSpeed ( "", $i, $user ); $capacityArray = array();
} else { if (isset($_POST['ship']) && is_array($_POST['ship'])) {
$fleet['fleetarray'][$i] = $_POST["ship$i"]; $selectedShips = $_POST['ship'];
// 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 );
}
} }
foreach ($reslist[Legacies_Empire::TYPE_SHIP] as $shipId) {
if (!isset($selectedShips[$shipId])) {
continue;
} }
if (!$fleet['fleetlist']) { $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); message($lang['fl_unselectall'], $lang['fl_error'], "fleet." . PHPEXT, 1);
} else { } else {
$speedallsmin = min($speedalls); $speedallsmin = min($speedalls);
} }
$page .= "<script type=\"text/javascript\" src=\"scripts/flotten.js\"></script>";
$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 .= "<script type=\"text/javascript\">\n";
$page .= "function getStorageFaktor() {\n"; $page .= "function getStorageFaktor() {\n";
$page .= " return 1\n"; $page .= " return 1\n";
@ -100,15 +137,14 @@ require_once dirname(__FILE__) .'/common.php';
$page .= "<form action=\"floten2.php\" method=\"post\">"; $page .= "<form action=\"floten2.php\" method=\"post\">";
$page .= $FleetHiddenBlock; $page .= $FleetHiddenBlock;
$page .= "<input type=\"hidden\" name=\"speedallsmin\" value=\"". $speedallsmin ."\" />"; $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=\"thisgalaxy\" value=\"". $planetrow['galaxy'] ."\" />";
$page .= "<input type=\"hidden\" name=\"thissystem\" value=\"". $planetrow['system'] ."\" />"; $page .= "<input type=\"hidden\" name=\"thissystem\" value=\"". $planetrow['system'] ."\" />";
$page .= "<input type=\"hidden\" name=\"thisplanet\" value=\"". $planetrow['planet'] ."\" />"; $page .= "<input type=\"hidden\" name=\"thisplanet\" value=\"". $planetrow['planet'] ."\" />";
$page .= "<input type=\"hidden\" name=\"galaxyend\" value=\"". intval($_POST['galaxy']) ."\" />"; $page .= "<input type=\"hidden\" name=\"galaxyend\" value=\"". $g ."\" />";
$page .= "<input type=\"hidden\" name=\"systemend\" value=\"". intval($_POST['system']) ."\" />"; $page .= "<input type=\"hidden\" name=\"systemend\" value=\"". $s ."\" />";
$page .= "<input type=\"hidden\" name=\"planetend\" value=\"". intval($_POST['planet']) ."\" />"; $page .= "<input type=\"hidden\" name=\"planetend\" value=\"". $p ."\" />";
$page .= "<input type=\"hidden\" name=\"speedfactor\" value=\"". GetGameSpeedFactor () ."\" />"; $page .= "<input type=\"hidden\" name=\"speedfactor\" value=\"". $speedFactor ."\" />";
$page .= "<input type=\"hidden\" name=\"thisplanettype\" value=\"". $planetrow['planet_type'] ."\" />"; $page .= "<input type=\"hidden\" name=\"thisplanettype\" value=\"". $t ."\" />";
$page .= "<input type=\"hidden\" name=\"thisresource1\" value=\"". floor($planetrow['metal']) ."\" />"; $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=\"thisresource2\" value=\"". floor($planetrow['crystal']) ."\" />";
$page .= "<input type=\"hidden\" name=\"thisresource3\" value=\"". floor($planetrow['deuterium']) ."\" />"; $page .= "<input type=\"hidden\" name=\"thisresource3\" value=\"". floor($planetrow['deuterium']) ."\" />";
@ -221,7 +257,7 @@ require_once dirname(__FILE__) .'/common.php';
$kolonien = SortUserPlanets ( $user ); $kolonien = SortUserPlanets ( $user );
$currentplanet = doquery("SELECT * FROM {{table}} WHERE id = '" . $user['current_planet'] . "'", 'planets', true); $currentplanet = doquery("SELECT * FROM {{table}} WHERE id = '" . $user['current_planet'] . "'", 'planets', true);
if (mysql_num_rows($kolonien) > 1) { if ($kolonien->rowCount() > 1) {
$i = 0; $i = 0;
$w = 0; $w = 0;
$tr = true; $tr = true;
@ -273,14 +309,22 @@ require_once dirname(__FILE__) .'/common.php';
$page .= "</tr>"; $page .= "</tr>";
$page .= "</table>"; $page .= "</table>";
$page .= "</div></center>"; $page .= "</div></center>";
$page .= "<input type=\"hidden\" name=\"maxepedition\" value=\"". $_POST['maxepedition'] ."\" />";
$page .= "<input type=\"hidden\" name=\"curepedition\" value=\"". $_POST['curepedition'] ."\" />"; $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 .= "<input type=\"hidden\" name=\"target_mission\" value=\"". $target_mission ."\" />";
$page .= "</form>"; $page .= "</form>";
$page .= "<script>javascript:shortInfo(); </script>"; $page .= "<script>javascript:shortInfo(); </script>";
display($page, $lang['fl_title']); 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

@ -33,108 +33,127 @@ define('INSTALL' , false);
require_once dirname(__FILE__) .'/common.php'; require_once dirname(__FILE__) .'/common.php';
includeLang('fleet'); includeLang('fleet');
$galaxy = intval($_POST['galaxy']); $session = Legacies::getSession('fleet');
$system = intval($_POST['system']);
$planet = intval($_POST['planet']); $galaxy = isset($_POST['galaxy']) ? intval($_POST['galaxy']) : 0;
$planettype = intval($_POST['planettype']); $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;
$coords = array(
'galaxy' => $galaxy,
'system' => $system,
'position' => $planet
);
$destination = Legacies_Empire_Model_Planet::factoryFromCoords($coords, $planettype);
$session['planet_destination'] = $destination->getId();
$user = Legacies_Empire_Model_User::getSingleton();
$planetrow = $user->getCurrentPlanet();
// Test d'existance et de proprieté de la planete
$YourPlanet = false; $YourPlanet = false;
$UsedPlanet = false; if ($destination->getUserId() == $user->getId()) {
$select = doquery("SELECT * FROM {{table}}", "planets");
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; $YourPlanet = true;
$UsedPlanet = true;
} else {
$UsedPlanet = true;
}
break;
} }
$UsedPlanet = false;
if ($destination->getId()) {
$UsedPlanet = true;
} }
$fleetArray = $session['fleet'];
$missionTypes = array();
// Determinons les type de missions possibles par rapport a la planete cible // Determinons les type de missions possibles par rapport a la planete cible
if ($_POST['planettype'] == "2") {
if ($_POST['ship209'] >= 1) { if ($position == (MAX_PLANET_IN_SYSTEM + 1)) {
$missiontype = array(8 => $lang['type_mission'][8]); $missionTypes[Legacies_Empire::ID_MISSION_EXPEDITION] = $lang['type_mission'][Legacies_Empire::ID_MISSION_EXPEDITION];
} else { } else {
$missiontype = array(); 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];
} }
} 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 || if (in_array($planettype, array(Legacies_Empire_Model_Planet::TYPE_MOON, Legacies_Empire_Model_Planet::TYPE_PLANET))) {
$_POST['ship203'] >= 1 || if (isset($fleetArray[Legacies_Empire::ID_SHIP_SPY_DRONE]) && $fleetArray[Legacies_Empire::ID_SHIP_SPY_DRONE] > 0 && !$YourPlanet) {
$_POST['ship204'] >= 1 || $missionTypes[Legacies_Empire::ID_MISSION_SPY] = $lang['type_mission'][Legacies_Empire::ID_MISSION_SPY];
$_POST['ship205'] >= 1 || }
$_POST['ship206'] >= 1 ||
$_POST['ship207'] >= 1 || if ((isset($fleetArray[Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT]) && $fleetArray[Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT] > 0) ||
$_POST['ship210'] >= 1 || (isset($fleetArray[Legacies_Empire::ID_SHIP_LARGE_TRANSPORT]) && $fleetArray[Legacies_Empire::ID_SHIP_LARGE_TRANSPORT] > 0) ||
$_POST['ship211'] >= 1 || (isset($fleetArray[Legacies_Empire::ID_SHIP_LIGHT_FIGHTER]) && $fleetArray[Legacies_Empire::ID_SHIP_LIGHT_FIGHTER] > 0) ||
$_POST['ship213'] >= 1 || (isset($fleetArray[Legacies_Empire::ID_SHIP_HEAVY_FIGHTER]) && $fleetArray[Legacies_Empire::ID_SHIP_HEAVY_FIGHTER] > 0) ||
$_POST['ship214'] >= 1 || (isset($fleetArray[Legacies_Empire::ID_SHIP_CRUISER]) && $fleetArray[Legacies_Empire::ID_SHIP_CRUISER] > 0) ||
$_POST['ship215'] >= 1 || (isset($fleetArray[Legacies_Empire::ID_SHIP_BATTLESHIP]) && $fleetArray[Legacies_Empire::ID_SHIP_BATTLESHIP] > 0) ||
$_POST['ship216'] >= 1) { (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 (!$YourPlanet) { if (!$YourPlanet) {
$missiontype[1] = $lang['type_mission'][1]; $missionTypes[Legacies_Empire::ID_MISSION_ATTACK] = $lang['type_mission'][Legacies_Empire::ID_MISSION_ATTACK];
$missiontype[5] = $lang['type_mission'][5]; $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];
} }
$missiontype[3] = $lang['type_mission'][3]; $missionTypes[Legacies_Empire::ID_MISSION_TRANSPORT] = $lang['type_mission'][Legacies_Empire::ID_MISSION_TRANSPORT];
} }
if ($YourPlanet) {
} elseif ($_POST['ship209'] >= 1 || $_POST['ship208'] >= 1) { $missionTypes[Legacies_Empire::ID_MISSION_STATION] = $lang['type_mission'][Legacies_Empire::ID_MISSION_STATION];
$missiontype[3] = $lang['type_mission'][3];
} }
if ($YourPlanet)
$missiontype[4] = $lang['type_mission'][4];
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];
} }
$fleetarray = unserialize(base64_decode(str_rot13($_POST["usedfleet"]))); if (isset($fleetArray[Legacies_Empire::ID_SHIP_SOLAR_SATELLITE])) {
$mission = $_POST['target_mission']; $missionTypes = array();
$SpeedFactor = $_POST['speedfactor']; }
$AllFleetSpeed = GetFleetMaxSpeed ($fleetarray, 0, $user);
$GenFleetSpeed = $_POST['speed']; $mission = isset($_POST['target_mission']) ? $_POST['target_mission'] : 0;
$SpeedFactor = GetGameSpeedFactor();
$AllFleetSpeed = GetFleetMaxSpeed($fleetArray, 0, $user);
$MaxFleetSpeed = min($AllFleetSpeed); $MaxFleetSpeed = min($AllFleetSpeed);
$distance = GetTargetDistance ( $_POST['thisgalaxy'], $_POST['galaxy'], $_POST['thissystem'], $_POST['system'], $_POST['thisplanet'], $_POST['planet'] ); $distance = GetTargetDistance($planetrow->getGalaxy(), $galaxy, $planetrow->getSystem(), $system, $planetrow->getPosition(), $planet);
$duration = GetMissionDuration ( $GenFleetSpeed, $MaxFleetSpeed, $distance, $SpeedFactor ); $duration = GetMissionDuration($speed, $MaxFleetSpeed, $distance, $SpeedFactor);
$consumption = GetFleetConsumption ( $fleetarray, $SpeedFactor, $duration, $distance, $MaxFleetSpeed, $user ); $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 = ""; $MissionSelector = "";
if (count($missiontype) > 0) { if (count($missionTypes) > 0) {
if ($planet == 16) { if ($planet == (MAX_PLANET_IN_SYSTEM + 1)) {
$MissionSelector .= "<tr height=\"20\">"; $MissionSelector .= "<tr height=\"20\">";
$MissionSelector .= "<th>"; $MissionSelector .= "<th>";
$MissionSelector .= "<input type=\"radio\" name=\"mission\" value=\"15\" checked=\"checked\">". $lang['type_mission'][15] ."<br /><br />"; $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 .= "<font color=\"red\">". $lang['fl_expe_warning'] ."</font>";
$MissionSelector .= "</th>"; $MissionSelector .= "</th>";
$MissionSelector .= "</tr>"; $MissionSelector .= "</tr>";
} else { } else {
$i = 0; $i = 0;
foreach ($missiontype as $a => $b) { foreach ($missionTypes as $a => $b) {
$MissionSelector .= "<tr height=\"20\">"; $MissionSelector .= "<tr height=\"20\">";
$MissionSelector .= "<th>"; $MissionSelector .= "<th>";
$MissionSelector .= "<input id=\"inpuT_".$i."\" type=\"radio\" name=\"mission\" value=\"".$a."\"". ($mission == $a ? " checked=\"checked\"":"") .">"; $MissionSelector .= "<input id=\"inpuT_".$i."\" type=\"radio\" name=\"mission\" value=\"".$a."\"". ($mission == $a ? " checked=\"checked\"":"") .">";
@ -152,12 +171,28 @@ require_once dirname(__FILE__) .'/common.php';
$MissionSelector .= "</tr>"; $MissionSelector .= "</tr>";
} }
if ($_POST['thisplanettype'] == 1) { if ($planetrow->isPlanet()) {
$TableTitle = "". $_POST['thisgalaxy'] .":". $_POST['thissystem'] .":". $_POST['thisplanet'] ." - ". $lang['fl_planet'] .""; $TableTitle = "{$planetrow->getCoords()} - {$lang['fl_planet']}";
} elseif ($_POST['thisplanettype'] == 3) { } elseif ($planetrow->isMoon()) {
$TableTitle = "". $_POST['thisgalaxy'] .":". $_POST['thissystem'] .":". $_POST['thisplanet'] ." - ". $lang['fl_moon'] .""; $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\" src=\"scripts/flotten.js\">\n</script>";
$page .= "<script type=\"text/javascript\">\n"; $page .= "<script type=\"text/javascript\">\n";
$page .= "function getStorageFaktor() {\n"; $page .= "function getStorageFaktor() {\n";
@ -166,31 +201,27 @@ require_once dirname(__FILE__) .'/common.php';
$page .= "</script>\n"; $page .= "</script>\n";
$page .= "<br><center>"; $page .= "<br><center>";
$page .= "<form action=\"floten3.php\" method=\"post\">\n"; $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=\"consumption\" value=\"". $consumption ."\" />\n";
$page .= "<input type=\"hidden\" name=\"dist\" value=\"". $distance ."\" />\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=\"speedfactor\" value=\"". $SpeedFactor ."\" />\n";
$page .= "<input type=\"hidden\" name=\"thisgalaxy\" value=\"". $_POST["thisgalaxy"] ."\" />\n"; $page .= "<input type=\"hidden\" name=\"thisgalaxy\" value=\"". $planetrow->getGalaxy() ."\" />\n";
$page .= "<input type=\"hidden\" name=\"thissystem\" value=\"". $_POST["thissystem"] ."\" />\n"; $page .= "<input type=\"hidden\" name=\"thissystem\" value=\"". $planetrow->getSystem() ."\" />\n";
$page .= "<input type=\"hidden\" name=\"thisplanet\" value=\"". $_POST["thisplanet"] ."\" />\n"; $page .= "<input type=\"hidden\" name=\"thisplanet\" value=\"". $planetrow->getPosition() ."\" />\n";
$page .= "<input type=\"hidden\" name=\"galaxy\" value=\"". $_POST["galaxy"] ."\" />\n"; $page .= "<input type=\"hidden\" name=\"galaxy\" value=\"". $galaxy ."\" />\n";
$page .= "<input type=\"hidden\" name=\"system\" value=\"". $_POST["system"] ."\" />\n"; $page .= "<input type=\"hidden\" name=\"system\" value=\"". $system ."\" />\n";
$page .= "<input type=\"hidden\" name=\"planet\" value=\"". $_POST["planet"] ."\" />\n"; $page .= "<input type=\"hidden\" name=\"planet\" value=\"". $planet ."\" />\n";
$page .= "<input type=\"hidden\" name=\"thisplanettype\" value=\"". $_POST["thisplanettype"] ."\" />\n"; $page .= "<input type=\"hidden\" name=\"thisplanettype\" value=\"". $planetrow->getType() ."\" />\n";
$page .= "<input type=\"hidden\" name=\"planettype\" value=\"". $_POST["planettype"] ."\" />\n"; $page .= "<input type=\"hidden\" name=\"planettype\" value=\"". $planettype ."\" />\n";
$page .= "<input type=\"hidden\" name=\"speedallsmin\" value=\"". $_POST["speedallsmin"] ."\" />\n"; $page .= "<input type=\"hidden\" name=\"speedallsmin\" value=\"". $session['speedallsmin'] ."\" />\n";
$page .= "<input type=\"hidden\" name=\"speed\" value=\"". $_POST['speed'] ."\" />\n"; $page .= "<input type=\"hidden\" name=\"speed\" value=\"". $speed ."\" />\n";
$page .= "<input type=\"hidden\" name=\"speedfactor\" value=\"". $_POST["speedfactor"] ."\" />\n"; $page .= "<input type=\"hidden\" name=\"usedfleet\" value=\"". $MaxFlyingFleets ."\" />\n";
$page .= "<input type=\"hidden\" name=\"usedfleet\" value=\"". $_POST["usedfleet"] ."\" />\n"; $page .= "<input type=\"hidden\" name=\"maxepedition\" value=\"". $maxExpedition ."\" />\n";
$page .= "<input type=\"hidden\" name=\"maxepedition\" value=\"". $_POST['maxepedition'] ."\" />\n"; $page .= "<input type=\"hidden\" name=\"curepedition\" value=\"". $ExpeditionEnCours ."\" />\n";
$page .= "<input type=\"hidden\" name=\"curepedition\" value=\"". $_POST['curepedition'] ."\" />\n"; foreach ($fleetArray as $shipId => $count) {
foreach ($fleetarray as $Ship => $Count) { $page .= "<input type=\"hidden\" name=\"ship[". $shipId ."]\" value=\"". $count ."\" />\n";
$page .= "<input type=\"hidden\" name=\"ship". $Ship ."\" value=\"". $Count ."\" />\n"; $page .= "<input type=\"hidden\" name=\"capacity[". $shipId ."]\" value=\"". $pricelist[$shipId]['capacity'] ."\" />\n";
$page .= "<input type=\"hidden\" name=\"capacity". $Ship ."\" value=\"". $pricelist[$Ship]['capacity'] ."\" />\n"; $page .= "<input type=\"hidden\" name=\"consumption[". $shipId ."]\" value=\"". GetShipConsumption($shipId, $user) ."\" />\n";
$page .= "<input type=\"hidden\" name=\"consumption". $Ship ."\" value=\"". GetShipConsumption ( $Ship, $user ) ."\" />\n"; $page .= "<input type=\"hidden\" name=\"speed[". $shipId ."]\" value=\"". GetFleetMaxSpeed(array(), $shipId, $user) ."\" />\n";
$page .= "<input type=\"hidden\" name=\"speed". $Ship ."\" value=\"". GetFleetMaxSpeed ( "", $Ship, $user ) ."\" />\n";
} }
$page .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"519\">\n"; $page .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"519\">\n";
@ -234,7 +265,7 @@ require_once dirname(__FILE__) .'/common.php';
$page .= "</tr><tr height=\"20\">\n"; $page .= "</tr><tr height=\"20\">\n";
$page .= "<th colspan=\"3\">&nbsp;</th>\n"; $page .= "<th colspan=\"3\">&nbsp;</th>\n";
$page .= "</tr>\n"; $page .= "</tr>\n";
if ($planet == 16) { if ($planet == (MAX_PLANET_IN_SYSTEM + 1)) {
$page .= "<tr height=\"20\">"; $page .= "<tr height=\"20\">";
$page .= "<td class=\"c\" colspan=\"3\">". $lang['fl_expe_staytime'] ."</td>"; $page .= "<td class=\"c\" colspan=\"3\">". $lang['fl_expe_staytime'] ."</td>";
$page .= "</tr>"; $page .= "</tr>";
@ -247,7 +278,7 @@ require_once dirname(__FILE__) .'/common.php';
$page .= $lang['fl_expe_hours']; $page .= $lang['fl_expe_hours'];
$page .= "</th>"; $page .= "</th>";
$page .= "</tr>"; $page .= "</tr>";
} elseif ( $missiontype[5] != '' ) { } else if (!isset($missionTypes[Legacies_Empire::ID_MISSION_STATION_ALLY])) {
$page .= "<tr height=\"20\">"; $page .= "<tr height=\"20\">";
$page .= "<td class=\"c\" colspan=\"3\">". $lang['fl_expe_staytime'] ."</td>"; $page .= "<td class=\"c\" colspan=\"3\">". $lang['fl_expe_staytime'] ."</td>";
$page .= "</tr>"; $page .= "</tr>";
@ -277,5 +308,3 @@ require_once dirname(__FILE__) .'/common.php';
$page .= "</form></center>\n"; $page .= "</form></center>\n";
display($page, $lang['fl_title']); display($page, $lang['fl_title']);
?>

View file

@ -32,72 +32,95 @@ define('INSIDE' , true);
define('INSTALL' , false); define('INSTALL' , false);
require_once dirname(__FILE__) .'/common.php'; require_once dirname(__FILE__) .'/common.php';
$dpath = (!$user["dpath"]) ? DEFAULT_SKINPATH : $user["dpath"];
includeLang('fleet'); includeLang('fleet');
$CurrentPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '". $user['current_planet'] ."'", 'planets', true); $session = Legacies::getSession('fleet');
$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();
$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;
$protection = $gameConfig['noobprotection']; $protection = $gameConfig['noobprotection'];
$protectiontime = $gameConfig['noobprotectiontime']; $protectiontime = $gameConfig['noobprotectiontime'];
$protectionmulti = $gameConfig['noobprotectionmulti']; $protectionmulti = $gameConfig['noobprotectionmulti'];
if ($protectiontime < 1) { if ($protectiontime < 1) {
$protectiontime = 9999999999999999; $protectiontime = 9999999999999999;
} }
$fleetarray = unserialize(base64_decode(str_rot13($_POST["usedfleet"]))); $fleetArray = $session['fleet'];
if (!is_array($fleetarray)) { if (!is_array($fleetArray)) {
message ("<font color=\"red\"><b>". $lang['fl_fleet_err'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2); 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 ! // On verifie s'il y a assez de vaisseaux sur la planete !
foreach ($fleetarray as $Ship => $Count) { foreach ($fleetArray as $shipId => $count) {
if ($Count > $CurrentPlanet[$resource[$Ship]]) { if ($Count > $planet->getElement($shipId)) {
message ("<font color=\"red\"><b>". $lang['fl_fleet_err'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2); message ("<font color=\"red\"><b>". $lang['fl_fleet_err'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
} }
} }
$error = 0; $allowedPlanetTypes = array(
$galaxy = intval($_POST['galaxy']); Legacies_Empire_Model_Planet::TYPE_PLANET,
$system = intval($_POST['system']); Legacies_Empire_Model_Planet::TYPE_DEBRIS,
$planet = intval($_POST['planet']); Legacies_Empire_Model_Planet::TYPE_MOON
$planettype = intval($_POST['planettype']); );
$fleetmission = $_POST['mission']; if (!in_array($type, $allowedPlanetTypes)) {
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); message ("<font color=\"red\"><b>". $lang['fl_fleet_err_pl'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
} }
if ($fleetmission == 8) { if ($planet->getGalaxy() == $galaxy &&
$YourPlanet = false; $planet->getSystem() == $system &&
$UsedPlanet = false; $planet->getPosition() == $position &&
$select = doquery("SELECT * FROM {{table}} WHERE galaxy = '". $galaxy ."' AND system = '". $system ."' AND planet = '". $planet ."'", "planets"); $planet->getType() == $type) {
} 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); 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 ! $YourPlanet = false;
if ($_POST['mission'] != 15) { $UsedPlanet = false;
if (mysql_num_rows($select) < 1 && $fleetmission != 7) { $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); 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) { } 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); message ("<font color=\"red\"><b>". $lang['fl_used_target'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
} }
} else { } else {
$EnvoiMaxExpedition = $_POST['maxepedition'];
$Expedition = $_POST['curepedition']; $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();
}
if ($EnvoiMaxExpedition == 0 ) { if ($EnvoiMaxExpedition == 0 ) {
message ("<font color=\"red\"><b>". $lang['fl_expe_notech'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2); message ("<font color=\"red\"><b>". $lang['fl_expe_notech'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
@ -106,227 +129,183 @@ require_once dirname(__FILE__) .'/common.php';
} }
} }
$select = mysql_fetch_array($select); if ($destination->getUserId() == $user['id']) {
if ($select['id_owner'] == $user['id']) {
$YourPlanet = true; $YourPlanet = true;
$UsedPlanet = true; $UsedPlanet = true;
} elseif (!empty($select['id_owner'])) { } else if ($destination['id_owner']->getId()) {
$YourPlanet = false;
$UsedPlanet = true; $UsedPlanet = true;
} else {
$YourPlanet = false;
$UsedPlanet = false;
} }
$missionTypes = array();
// Determinons les type de missions possibles par rapport a la planete cible // Determinons les type de missions possibles par rapport a la planete cible
if ($fleetmission == 15) { if ($position == (MAX_PLANET_IN_SYSTEM + 1)) {
// Gestion des Exp<78>ditions $missionTypes[Legacies_Empire::ID_MISSION_EXPEDITION] = $lang['type_mission'][Legacies_Empire::ID_MISSION_EXPEDITION];
$missiontype = array(15 => $lang['type_mission'][15]);
} else { } else {
if ($_POST['planettype'] == "2") { if ($type == Legacies_Empire_Model_Planet::TYPE_DEBRIS) {
if ($_POST['ship209'] >= 1) { if (isset($fleetArray[Legacies_Empire::ID_SHIP_RECYCLER]) && $fleetArray[Legacies_Empire::ID_SHIP_RECYCLER] > 0) {
$missiontype = array(8 => $lang['type_mission'][8]); $missionTypes[Legacies_Empire::ID_MISSION_RECYCLE] = $lang['type_mission'][Legacies_Empire::ID_MISSION_RECYCLE];
} else {
$missiontype = array();
} }
} elseif ($_POST['planettype'] == "1" || $_POST['planettype'] == "3") { } else if ($type == Legacies_Empire_Model_Planet::TYPE_PLANET) {
if ($_POST['ship208'] >= 1 && !$UsedPlanet) { if (isset($fleetArray[Legacies_Empire::ID_SHIP_COLONY_SHIP]) && $fleetArray[Legacies_Empire::ID_SHIP_COLONY_SHIP] > 0 && !$UsedPlanet) {
$missiontype = array(7 => $lang['type_mission'][7]); $missionTypes[Legacies_Empire::ID_MISSION_SETTLE_COLONY] = $lang['type_mission'][7];
} elseif ($_POST['ship210'] >= 1 && !$YourPlanet) {
$missiontype = array(6 => $lang['type_mission'][6]);
} }
} else if ($type == Legacies_Empire_Model_Planet::TYPE_MOON) {
if ($_POST['ship202'] >= 1 || if (((isset($fleetArray[Legacies_Empire::ID_SHIP_DEATH_STAR]) && $fleetArray[Legacies_Empire::ID_SHIP_DEATH_STAR] > 0) ||
$_POST['ship203'] >= 1 || (isset($fleetArray[Legacies_Empire::ID_SHIP_SUPERNOVA]) && $fleetArray[Legacies_Empire::ID_SHIP_SUPERNOVA] > 0)) &&
$_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];
}
} elseif ($_POST['ship209'] >= 1 || $_POST['ship208'] >= 1) {
$missiontype[3] = $lang['type_mission'][3];
}
if ($YourPlanet)
$missiontype[4] = $lang['type_mission'][4];
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) { !$YourPlanet && $UsedPlanet) {
$missiontype[9] = $lang['type_mission'][9]; $missionTypes[Legacies_Empire::ID_MISSION_DESTROY] = $lang['type_mission'][Legacies_Empire::ID_MISSION_DESTROY];
} }
} }
if (empty($missiontype[$fleetmission])) { 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 ((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 (!$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 ($YourPlanet) {
$missionTypes[Legacies_Empire::ID_MISSION_STATION] = $lang['type_mission'][Legacies_Empire::ID_MISSION_STATION];
}
}
}
if (isset($fleetArray[Legacies_Empire::ID_SHIP_SOLAR_SATELLITE])) {
$missionTypes = array();
}
if (!isset($missionTypes[$mission])) {
message ("<font color=\"red\"><b>". $lang['fl_bad_mission'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2); message ("<font color=\"red\"><b>". $lang['fl_bad_mission'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
} }
CheckPlanetUsedFields($CurrentPlanet); if (!$destination->getId()) {
$destinationUser = $user;
if ($TargetPlanet['id_owner'] == '') { } else {
$HeDBRec = $MyDBRec; $destinationUser = $destination->getUser();
} elseif ($TargetPlanet['id_owner'] != '') {
$HeDBRec = doquery("SELECT * FROM {{table}} WHERE `id` = '". $TargetPlanet['id_owner'] ."';", 'users', true);
} }
$UserPoints = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '". $MyDBRec['id'] ."';", 'statpoints', true); $userPoints = doquery("SELECT total_points FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner`='{$user->getId()}'", 'statpoints', true);
$User2Points = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '". $HeDBRec['id'] ."';", '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;
}
$MyGameLevel = $UserPoints['total_points']; $vacationMode = $destinationUser['urlaubs_modus'];
$HeGameLevel = $User2Points['total_points'];
$VacationMode = $HeDBRec['urlaubs_modus'];
if ($MyGameLevel > ($HeGameLevel * $protectionmulti) AND if ($protection) {
$TargetPlanet['id_owner'] != '' AND $protectedMissions = array(
$_POST['mission'] == 1 AND Legacies_Empire::ID_MISSION_ATTACK,
$protection == 1 AND Legacies_Empire::ID_MISSION_GROUP_ATTACK,
$HeGameLevel < ($protectiontime * 1000)) { Legacies_Empire::ID_MISSION_STATION_ALLY,
Legacies_Empire::ID_MISSION_SPY,
Legacies_Empire::ID_MISSION_DESTROY
);
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); message("<font color=\"lime\"><b>".$lang['fl_noob_mess_n']."</b></font>", $lang['fl_noob_title'], "fleet." . PHPEXT, 2);
} }
if ($MyGameLevel > ($HeGameLevel * $protectionmulti) AND if (($myGameLevel * $protectionmulti) < $hisGameLevel && $destinationUser->getId() &&
$TargetPlanet['id_owner'] != '' AND in_array($mission, $protectedMissions) && $myGameLevel < ($protectiontime * 1000)) {
$_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); message("<font color=\"lime\"><b>".$lang['fl_noob_mess_n']."</b></font>", $lang['fl_noob_title'], "fleet." . PHPEXT, 2);
} }
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 (($MyGameLevel * $protectionmulti) < $HeGameLevel AND if ($vacationMode && $mission != Legacies_Empire::ID_MISSION_RECYCLE) {
$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 (($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 (($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 ($VacationMode AND $_POST['mission'] != 8) {
message("<font color=\"lime\"><b>".$lang['fl_vacation_pla']."</b></font>", $lang['fl_vacation_ttl'], "fleet." . PHPEXT, 2); message("<font color=\"lime\"><b>".$lang['fl_vacation_pla']."</b></font>", $lang['fl_vacation_ttl'], "fleet." . PHPEXT, 2);
} }
$FlyingFleets = mysql_fetch_assoc(doquery("SELECT COUNT(fleet_id) as Number FROM {{table}} WHERE `fleet_owner`='{$user['id']}'", 'fleets')); $currentFleets = $user->getFleets()->count();
$ActualFleets = $FlyingFleets["Number"];
if (($user[$resource[108]] + 1) <= $ActualFleets) { if (($user->getElement(Legacies_Empire::ID_RESEARCH_COMPUTER_TECHNOLOGY) + 1) <= $currentFleets) {
message("Pas de slot disponible", "Erreur", "fleet." . PHPEXT, 1); message("Pas de slot disponible", "Erreur", "fleet." . PHPEXT, 1);
} }
if ($_POST['resource1'] + $_POST['resource2'] + $_POST['resource3'] < 1 AND $_POST['mission'] == 3) { $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 ($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); message("<font color=\"lime\"><b>".$lang['fl_noenoughtgoods']."</b></font>", $lang['type_mission'][3], "fleet." . PHPEXT, 1);
} }
if ($_POST['mission'] != 15) { if ($mission != Legacies_Empire::ID_MISSION_EXPEDITION) {
if ($TargetPlanet['id_owner'] == '' AND $_POST['mission'] < 7) { $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); 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) { 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); 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) { 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); 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) { 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); 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)) { 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); 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)) { 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); 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)) { 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); message ("<font color=\"red\"><b>". $lang['fl_only_stay_at_home'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
} }
} }
$missiontype = array( $possibleSpeeds = array(10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
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],
);
$speed_possible = array(10, 9, 8, 7, 6, 5, 4, 3, 2, 1); $AllFleetSpeed = GetFleetMaxSpeed($fleetArray, 0, $user);
$SpeedFactor = GetGameSpeedFactor();
$AllFleetSpeed = GetFleetMaxSpeed ($fleetarray, 0, $user);
$GenFleetSpeed = $_POST['speed'];
$SpeedFactor = $_POST['speedfactor'];
$MaxFleetSpeed = min($AllFleetSpeed); $MaxFleetSpeed = min($AllFleetSpeed);
if (!in_array($GenFleetSpeed, $speed_possible)) { if (!in_array($speed, $possibleSpeeds)) {
message ("<font color=\"red\"><b>". $lang['fl_cheat_speed'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2); message ("<font color=\"red\"><b>". $lang['fl_cheat_speed'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
} }
$CurrentPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '".$user['current_planet']."';", 'planets', true);
if ($MaxFleetSpeed != $_POST['speedallsmin']) {
message ("<font color=\"red\"><b>". $lang['fl_cheat_speed'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
}
if (!$_POST['planettype']) {
message ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</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; $error = 0;
$errorlist = ""; $errorlist = "";
if (!$_POST['galaxy'] || !is_numeric($_POST['galaxy']) || $_POST['galaxy'] > MAX_GALAXY_IN_WORLD || $_POST['galaxy'] < 1) { if ($galaxy > MAX_GALAXY_IN_WORLD || $galaxy < 1) {
$error++; $error++;
$errorlist .= $lang['fl_limit_galaxy']; $errorlist .= $lang['fl_limit_galaxy'];
} }
if (!$_POST['system'] || !is_numeric($_POST['system']) || $_POST['system'] > MAX_SYSTEM_IN_GALAXY || $_POST['system'] < 1) { if ($system > MAX_SYSTEM_IN_GALAXY || $system < 1) {
$error++; $error++;
$errorlist .= $lang['fl_limit_system']; $errorlist .= $lang['fl_limit_system'];
} }
if (!$_POST['planet'] || !is_numeric($_POST['planet']) || $_POST['planet'] > MAX_PLANET_IN_SYSTEM+1 || $_POST['planet'] < 1) { if ($position > (MAX_PLANET_IN_SYSTEM + 1) || $position < 1) {
$error++; $error++;
$errorlist .= $lang['fl_limit_planet']; $errorlist .= $lang['fl_limit_planet'];
} }
@ -335,24 +314,17 @@ require_once dirname(__FILE__) .'/common.php';
message ("<font color=\"red\"><ul>" . $errorlist . "</ul></font>", $lang['fl_error'], "fleet." . PHPEXT, 2); message ("<font color=\"red\"><ul>" . $errorlist . "</ul></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
} }
// La flotte part bien de la planete courrante ?? if (!isset($fleetArray)) {
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 (!isset($fleetarray)) {
message ("<font color=\"red\"><b>". $lang['fl_no_fleetarray'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2); message ("<font color=\"red\"><b>". $lang['fl_no_fleetarray'] ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
} }
$distance = GetTargetDistance ( $_POST['thisgalaxy'], $_POST['galaxy'], $_POST['thissystem'], $_POST['system'], $_POST['thisplanet'], $_POST['planet'] ); $distance = GetTargetDistance($planet->getGalaxy(), $galaxy, $planet->getSystem(), $system, $planet->getPosition(), $position);
$duration = GetMissionDuration ( $GenFleetSpeed, $MaxFleetSpeed, $distance, $SpeedFactor ); $duration = GetMissionDuration($speed, $MaxFleetSpeed, $distance, $SpeedFactor);
$consumption = GetFleetConsumption ( $fleetarray, $SpeedFactor, $duration, $distance, $MaxFleetSpeed, $user ); $consumption = GetFleetConsumption($fleetArray, $SpeedFactor, $duration, $distance, $MaxFleetSpeed, $user);
/***************/
$fleet['start_time'] = $duration + time(); $fleet['start_time'] = $duration + time();
if ($_POST['mission'] == 15) { if ($mission == Legacies_Empire::ID_MISSION_EXPEDITION) {
$StayDuration = $_POST['expeditiontime'] * 3600; $StayDuration = $_POST['expeditiontime'] * 3600;
$StayTime = $fleet['start_time'] + $_POST['expeditiontime'] * 3600; $StayTime = $fleet['start_time'] + $_POST['expeditiontime'] * 3600;
} elseif ($_POST['mission'] == 5) { } elseif ($_POST['mission'] == 5) {
@ -368,7 +340,7 @@ require_once dirname(__FILE__) .'/common.php';
$fleet_array = ""; $fleet_array = "";
$FleetSubQRY = ""; $FleetSubQRY = "";
foreach ($fleetarray as $Ship => $Count) { foreach ($fleetArray as $Ship => $Count) {
$FleetStorage += $pricelist[$Ship]["capacity"] * $Count; $FleetStorage += $pricelist[$Ship]["capacity"] * $Count;
$FleetShipCount += $Count; $FleetShipCount += $Count;
$fleet_array .= $Ship .",". $Count .";"; $fleet_array .= $Ship .",". $Count .";";
@ -396,9 +368,9 @@ require_once dirname(__FILE__) .'/common.php';
$StorageNeeded += $TransDeuterium; $StorageNeeded += $TransDeuterium;
} }
$StockMetal = $CurrentPlanet['metal']; $StockMetal = $planet['metal'];
$StockCrystal = $CurrentPlanet['crystal']; $StockCrystal = $planet['crystal'];
$StockDeuterium = $CurrentPlanet['deuterium']; $StockDeuterium = $planet['deuterium'];
$StockDeuterium -= $consumption; $StockDeuterium -= $consumption;
$StockOk = false; $StockOk = false;
@ -417,7 +389,7 @@ require_once dirname(__FILE__) .'/common.php';
message ("<font color=\"red\"><b>". $lang['fl_nostoragespa'] . pretty_number($StorageNeeded - $FleetStorage) ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2); message ("<font color=\"red\"><b>". $lang['fl_nostoragespa'] . pretty_number($StorageNeeded - $FleetStorage) ."</b></font>", $lang['fl_error'], "fleet." . PHPEXT, 2);
} }
if ($TargetPlanet['id_level'] > $user['authlevel']) { if ($destination['id_level'] > $user['authlevel']) {
$Allowed = true; $Allowed = true;
switch ($_POST['mission']){ switch ($_POST['mission']){
case 1: case 1:
@ -460,23 +432,23 @@ require_once dirname(__FILE__) .'/common.php';
$QryInsertFleet .= "`fleet_resource_metal` = '". intval($TransMetal) ."', "; $QryInsertFleet .= "`fleet_resource_metal` = '". intval($TransMetal) ."', ";
$QryInsertFleet .= "`fleet_resource_crystal` = '". intval($TransCrystal) ."', "; $QryInsertFleet .= "`fleet_resource_crystal` = '". intval($TransCrystal) ."', ";
$QryInsertFleet .= "`fleet_resource_deuterium` = '". intval($TransDeuterium) ."', "; $QryInsertFleet .= "`fleet_resource_deuterium` = '". intval($TransDeuterium) ."', ";
$QryInsertFleet .= "`fleet_target_owner` = '". $TargetPlanet['id_owner'] ."', "; $QryInsertFleet .= "`fleet_target_owner` = '". $destination['id_owner'] ."', ";
$QryInsertFleet .= "`start_time` = '". time() ."';"; $QryInsertFleet .= "`start_time` = '". time() ."';";
doquery( $QryInsertFleet, 'fleets'); doquery( $QryInsertFleet, 'fleets');
$CurrentPlanet["metal"] = $CurrentPlanet["metal"] - $TransMetal; $planet["metal"] = $planet["metal"] - $TransMetal;
$CurrentPlanet["crystal"] = $CurrentPlanet["crystal"] - $TransCrystal; $planet["crystal"] = $planet["crystal"] - $TransCrystal;
$CurrentPlanet["deuterium"] = $CurrentPlanet["deuterium"] - $TransDeuterium; $planet["deuterium"] = $planet["deuterium"] - $TransDeuterium;
$CurrentPlanet["deuterium"] = $CurrentPlanet["deuterium"] - $consumption; $planet["deuterium"] = $planet["deuterium"] - $consumption;
$QryUpdatePlanet = "UPDATE {{table}} SET "; $QryUpdatePlanet = "UPDATE {{table}} SET ";
$QryUpdatePlanet .= $FleetSubQRY; $QryUpdatePlanet .= $FleetSubQRY;
$QryUpdatePlanet .= "`metal` = '". $CurrentPlanet["metal"] ."', "; $QryUpdatePlanet .= "`metal` = '". $planet["metal"] ."', ";
$QryUpdatePlanet .= "`crystal` = '". $CurrentPlanet["crystal"] ."', "; $QryUpdatePlanet .= "`crystal` = '". $planet["crystal"] ."', ";
$QryUpdatePlanet .= "`deuterium` = '". $CurrentPlanet["deuterium"] ."' "; $QryUpdatePlanet .= "`deuterium` = '". $planet["deuterium"] ."' ";
$QryUpdatePlanet .= "WHERE "; $QryUpdatePlanet .= "WHERE ";
$QryUpdatePlanet .= "`id` = '". $CurrentPlanet['id'] ."'"; $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) // 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("LOCK TABLE {{table}} WRITE", 'planets');
@ -491,7 +463,7 @@ require_once dirname(__FILE__) .'/common.php';
$page .= "<td class=\"c\" colspan=\"2\"><span class=\"success\">". $lang['fl_fleet_send'] ."</span></td>"; $page .= "<td class=\"c\" colspan=\"2\"><span class=\"success\">". $lang['fl_fleet_send'] ."</span></td>";
$page .= "</tr><tr height=\"20\">"; $page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['fl_mission'] ."</th>"; $page .= "<th>". $lang['fl_mission'] ."</th>";
$page .= "<th>". $missiontype[$_POST['mission']] ."</th>"; $page .= "<th>". $missionTypes[$_POST['mission']] ."</th>";
$page .= "</tr><tr height=\"20\">"; $page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['fl_dist'] ."</th>"; $page .= "<th>". $lang['fl_dist'] ."</th>";
$page .= "<th>". pretty_number($distance) ."</th>"; $page .= "<th>". pretty_number($distance) ."</th>";
@ -516,7 +488,7 @@ require_once dirname(__FILE__) .'/common.php';
$page .= "</tr><tr height=\"20\">"; $page .= "</tr><tr height=\"20\">";
$page .= "<td class=\"c\" colspan=\"2\">". $lang['fl_title'] ."</td>"; $page .= "<td class=\"c\" colspan=\"2\">". $lang['fl_title'] ."</td>";
foreach ($fleetarray as $Ship => $Count) { foreach ($fleetArray as $Ship => $Count) {
$page .= "</tr><tr height=\"20\">"; $page .= "</tr><tr height=\"20\">";
$page .= "<th>". $lang['tech'][$Ship] ."</th>"; $page .= "<th>". $lang['tech'][$Ship] ."</th>";
$page .= "<th>". pretty_number($Count) ."</th>"; $page .= "<th>". pretty_number($Count) ."</th>";
@ -526,14 +498,6 @@ require_once dirname(__FILE__) .'/common.php';
// Provisoire // Provisoire
sleep (1); 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']); 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
?>

View file

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

View file

@ -216,4 +216,20 @@ class Legacies
{ {
self::$_response = $response; 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 = clone $this;
$clone->_fields = array(); $clone->_fields = array();
$clone->column('COUNT(*)'); $clone->column('1');
$sql = $clone->_prepareSql(); $sql = $clone->_prepareSql();
@ -306,7 +306,10 @@ SQL_EOF;
$args = func_get_args(); $args = func_get_args();
$statement->execute(array_shift($args)); $statement->execute(array_shift($args));
return $statement->fetch(PDO::FETCH_COLUMN, 0); $count = $statement->rowCount();
$statement->closeCursor();
return $count;
} }
public function count() public function count()
@ -342,4 +345,22 @@ SQL_EOF;
{ {
return current($this->_items) !== false; 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()) public function getUrl($uri, Array $params = array())
{ {
// TODO: base path integration return Legacies::getUrl($uri, $params);
$serializedParams = array();
foreach ($params as $paramKey => $paramValue) {
if ($paramValue) {
$serializedParams[] = "{$paramKey}={$paramValue}";
}
}
if (count($serializedParams) > 0) {
return $uri . '?' . implode('&', $serializedParams);
}
return $uri;
} }
public function getSkinUrl($uri) public function getSkinUrl($uri)

View file

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

View file

@ -64,6 +64,56 @@ class Legacies_Empire_Model_Planet
return self::$_instances[$id]; 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() public function _init()
{ {
$this->_tableName = 'planets'; $this->_tableName = 'planets';

View file

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

View file

@ -233,7 +233,7 @@ class Legacies_Empire_Model_User
*/ */
public function updateCurrentPlanet($planet) 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 = $this->_preparePlanetCollection()->where('id=:id');
$planetCollection->load(array( $planetCollection->load(array(

View file

@ -1,4 +1,6 @@
<div class="planet-carrousel"> <div class="planet-carrousel">
<div class="arrow left">&#8678;</div>
<div class="items">
<?php foreach ($this->getPlanetCollection() as $planet):?> <?php foreach ($this->getPlanetCollection() as $planet):?>
<div class="planet item"> <div class="planet item">
<?php if ($planet->getId() != $this->getCurrentPlanet()->getId()):?> <?php if ($planet->getId() != $this->getCurrentPlanet()->getId()):?>
@ -9,6 +11,8 @@
</div> </div>
<?php endforeach?> <?php endforeach?>
</div> </div>
<div class="arrow right">&#8680;</div>
</div>
<div class="resources-display"> <div class="resources-display">
<div class="resource metal"> <div class="resource metal">
<img src="<?php echo $this->getSkinUrl('graphics/images/metall.gif')?>" border="0" height="22" width="42" alt="<?php echo $this->__('Metal')?>" title="<?php echo $this->__('Metal')?>" /> <img src="<?php echo $this->getSkinUrl('graphics/images/metall.gif')?>" border="0" height="22" width="42" alt="<?php echo $this->__('Metal')?>" title="<?php echo $this->__('Metal')?>" />

View file

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

View file

@ -125,33 +125,32 @@ EOF;
* @param $title * @param $title
* @return unknown_type * @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 "<h2>$title</h2><br><font color=red>$message</font><br><hr>";
echo "<table>".$this->log."</table>"; echo "<table>".$this->log."</table>";
} }
global $user; $user = Legacies_Empire_Model_User::getSingleton();
$db = Legacies_Database::getSingleton();
$config = include ROOT_PATH . 'config.' . PHPEXT; $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...'); if(!$link) die('La base de donnee n est pas disponible pour le moment, desole pour la gene occasionnee...');
$query = "INSERT INTO {{table}} SET $query = "INSERT INTO {$db->getTable('errors')} SET
`error_sender` = '{$user['id']}' , `error_sender` = {$user->getId()} ,
`error_time` = '".time()."' , `error_time` = {$db->quote(time())},
`error_type` = '{$title}' , `error_type` = {$db->quote($title)},
`error_text` = '".mysql_escape_string($message)."';"; `error_text` = {$db->quote($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: ');
$db->query($query);
$id = $db->lastInsertId($db->getTable('errors'));
if (!function_exists('message')) { 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 { } 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'); $TableTPL = gettemplate('admin/fleet_rows');
$FlyingFleets = doquery ("SELECT * FROM {{table}} ORDER BY `fleet_end_time` ASC;", 'fleets'); $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); $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); $TargetOwner = doquery("SELECT `username` FROM {{table}} WHERE `id` = '". $CurrentFleet['fleet_target_owner'] ."';", 'users', true);
$Bloc['Id'] = $CurrentFleet['fleet_id']; $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' ); doquery ( "DELETE FROM {{table}} WHERE `stat_type` = '1' AND `id_owner` = '" . $UserID . "';", 'statpoints' );
$ThePlanets = doquery ( "SELECT * FROM {{table}} WHERE `id_owner` = '" . $UserID . "';", 'planets' ); $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 ) { if ( $OnePlanet['planet_type'] == 1 ) {
doquery ( "DELETE FROM {{table}} WHERE `galaxy` = '" . $OnePlanet['galaxy'] . "' AND `system` = '" . $OnePlanet['system'] . "' AND `planet` = '" . $OnePlanet['planet'] . "';", 'galaxy' ); doquery ( "DELETE FROM {{table}} WHERE `galaxy` = '" . $OnePlanet['galaxy'] . "' AND `system` = '" . $OnePlanet['system'] . "' AND `planet` = '" . $OnePlanet['planet'] . "';", 'galaxy' );
} elseif ( $OnePlanet['planet_type'] == 3 ) { } elseif ( $OnePlanet['planet_type'] == 3 ) {

View file

@ -36,10 +36,12 @@
function MissionCaseColonisation ( $FleetRow ) { function MissionCaseColonisation ( $FleetRow ) {
global $lang, $resource; 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) { if ($FleetRow['fleet_mess'] == 0) {
// Déjà, sommes nous a l'aller ?? // 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']); $TargetAdress = sprintf ($lang['sys_adress_planet'], $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
if ($iGalaxyPlace == 0) { if ($iGalaxyPlace == 0) {
// Y a personne qui s'y est mis avant que je ne debarque ! // Y a personne qui s'y est mis avant que je ne debarque !

View file

@ -66,35 +66,48 @@ function GetGameSpeedFactor () {
function GetFleetMaxSpeed($FleetArray, $Fleet, $Player) { function GetFleetMaxSpeed($FleetArray, $Fleet, $Player) {
global $reslist, $pricelist; global $reslist, $pricelist;
if (!is_array($FleetArray)) {
$FleetArray = array();
}
if ($Fleet != 0) { if ($Fleet != 0) {
$FleetArray[$Fleet] = 1; $FleetArray[$Fleet] = 1;
} }
$speedalls = array();
foreach ($FleetArray as $Ship => $Count) { 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) { if ($Player['impulse_motor_tech'] >= 5) {
$speedalls[$Ship] = $pricelist[$Ship]['speed2'] + (($pricelist[$Ship]['speed'] * $Player['impulse_motor_tech']) * 0.2); $speedalls[$Ship] = $pricelist[$Ship]['speed2'] + (($pricelist[$Ship]['speed'] * $Player['impulse_motor_tech']) * 0.2);
} else { } else {
$speedalls[$Ship] = $pricelist[$Ship]['speed'] + (($pricelist[$Ship]['speed'] * $Player['combustion_tech']) * 0.1); $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); $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); $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) { if ($Player['hyperspace_motor_tech'] >= 8) {
$speedalls[$Ship] = $pricelist[$Ship]['speed2'] + (($pricelist[$Ship]['speed'] * $Player['hyperspace_motor_tech']) * 0.3); $speedalls[$Ship] = $pricelist[$Ship]['speed2'] + (($pricelist[$Ship]['speed'] * $Player['hyperspace_motor_tech']) * 0.3);
} else { } else {
$speedalls[$Ship] = $pricelist[$Ship]['speed'] + (($pricelist[$Ship]['speed'] * $Player['impulse_motor_tech']) * 0.2); $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); $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]; $ShipSpeed = $speedalls[$Ship];
$speedalls = $ShipSpeed; $speedalls = $ShipSpeed;
} }

View file

@ -1,6 +1,6 @@
<?php <?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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -153,7 +153,7 @@ if (isset($_POST) && !empty($_POST)) {
planet = '" . $irak['planet_angreifer'] . "' AND planet = '" . $irak['planet_angreifer'] . "' AND
planet_type = '1'", 'planets', true); planet_type = '1'", 'planets', true);
if (mysql_num_rows($planet_start) == 1) { if ($planet_start->rowCount() == 1) {
$planet = mysql_fetch_array($planet_start); $planet = mysql_fetch_array($planet_start);
} }

View file

@ -81,7 +81,7 @@ require_once dirname(__FILE__) .'/common.php';
$FleetToTarget = doquery( $QryLookFleets, 'fleets' ); $FleetToTarget = doquery( $QryLookFleets, 'fleets' );
if (mysql_num_rows($FleetToTarget) <> 0 ) { if ($FleetToTarget->rowCount() > 0 ) {
while ($FleetRow = $FleetToTarget->fetch(PDO::FETCH_BOTH)) { while ($FleetRow = $FleetToTarget->fetch(PDO::FETCH_BOTH)) {
$Record++; $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 $select_owner = doquery("SELECT military_tech FROM {{table}} WHERE
id = '" . $selected_row['owner'] . "'", 'users'); 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'); doquery("DELETE FROM {{table}} WHERE id = '" . $selected_row['id'] . "'", 'iraks');
} else { } else {
$verteidiger = mysql_fetch_array($select_ziel); $verteidiger = $select_ziel->fetch(PDO::FETCH_BOTH);
$angreifer = mysql_fetch_array($select_owner); $angreifer = $select_owner->fetch(PDO::FETCH_BOTH);
$planet = mysql_fetch_array($planetrow); $planet = $planetrow->fetch(PDO::FETCH_BOTH);
$ids = array(0 => 401, $ids = array(0 => 401,
1 => 402, 1 => 402,
@ -136,7 +136,7 @@ if (isset($resource) && !empty($resource[401])) {
system = '" . $selected_row['system_angreifer'] . "' AND system = '" . $selected_row['system_angreifer'] . "' AND
planet = '" . $selected_row['planet_angreifer'] . "'", 'planets'); planet = '" . $selected_row['planet_angreifer'] . "'", 'planets');
if (mysql_num_rows($planet_) == 1) { if ($planet_->rowCount() == 1) {
$array = mysql_fetch_array($planet_); $array = mysql_fetch_array($planet_);
$name = $array['name']; $name = $array['name'];
@ -147,7 +147,7 @@ if (isset($resource) && !empty($resource[401])) {
system = '" . $selected_row['system'] . "' AND system = '" . $selected_row['system'] . "' AND
planet = '" . $selected_row['planet'] . "'", 'planets'); planet = '" . $selected_row['planet'] . "'", 'planets');
if (mysql_num_rows($planet_2) == 1) { if ($planet_2->rowCount() == 1) {
$array = mysql_fetch_array($planet_2); $array = mysql_fetch_array($planet_2);
$name_deffer = $array['name']; $name_deffer = $array['name'];

View file

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

View file

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

View file

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

View file

@ -74,7 +74,7 @@ switch($type){
*/ */
if(isset($searchtext) && isset($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'){ if($type=='playername'||$type=='planetname'){
$s=$r; $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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @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 { .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 img {border:none;}
{ p table {border:none;}
border : 0px;
}
p table
{
border : 0px;
}
p td p td
{ {
@ -33,78 +22,29 @@ p td
font-family : Tahoma,sans-serif; font-family : Tahoma,sans-serif;
} }
table table table table {border:0px;}
{
border : 0px;
}
table table td body {color:#000;margin:1px 0 0 1px;background:#040e1e url(../../graphics/img/background2.jpg) fixed no-repeat top left;}
{
font-size : 10px;
font-family : Tahoma,sans-serif;
}
body body.style {background-image:url(../../graphics/img/background1.jpg);}
{ body.style table {margin:0px;border:0 auto}
color : #FFFFFF; body form table th table input {width: 60px;}
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{ .content table {margin:0 auto;}
background-image : url(img/background1.jpg);
}
body.style table {
margin : 0px;
}
body form table th table input
{
width: 60px;
}
th, td.a, td.b, td.c, td.f, td.g, td.h, td.i, 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.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 td.v, .style td, p td, table.s th img
{ {
border : 1px #545454 solid; border : 1px #545454 solid;
font-size : 10px;
font-family : Tahoma,sans-serif;
} }
input, select, textarea input, select, textarea
{ {
border : 1px #545454 solid; 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, 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;}
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 th
{ {
@ -130,7 +70,7 @@ td.c
color : #FFFFFF; color : #FFFFFF;
padding-left : 3px; padding-left : 3px;
background-image : url(img/bg1.gif); background-image : url(img/bg1.gif);
filter : alpha(opacity=70); filter : alpha(opacity=90);
-moz-opacity : 0.7; -moz-opacity : 0.7;
-khtml-opacity : 0.7; -khtml-opacity : 0.7;
opacity : 0.7; opacity : 0.7;
@ -140,7 +80,7 @@ td.f, input, select, textarea
{ {
color : #FFFFFF; color : #FFFFFF;
background-color : #1c1c1c; background-color : #1c1c1c;
filter : alpha(opacity=70); filter : alpha(opacity=90);
-moz-opacity : 0.7; -moz-opacity : 0.7;
-khtml-opacity : 0.7; -khtml-opacity : 0.7;
opacity : 0.7; opacity : 0.7;
@ -265,24 +205,24 @@ div.z
{ {
font-size : 10px; font-size : 10px;
font-weight : bold; font-weight : bold;
color : #FFFFFF; color : #000;
} }
a a
{ {
color : #FFFFFF; color : #000;
text-decoration : none; text-decoration : none;
font-weight : bold; font-weight : bold;
} }
a.s a.s
{ {
color : #FFFFFF; color : #000;
} }
a.t a.t
{ {
color : #FFFFFF; color : #000;
} }
a:hover 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 * @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/ * @see http://www.xnova-ng.org/

View file

@ -1,5 +1,12 @@
@CHARSET "UTF-8"; @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,.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 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;} .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 .messages {height:22px;float:left;width:160px;}
.global .content .resources-display .energy {width:190px;} .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 {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 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 {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 .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 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 {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'); $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'); message('Cette flotte n\'existe pas (ou plus)!', 'Erreur');
} }
@ -104,10 +104,9 @@ require_once dirname(__FILE__) .'/common.php';
id = '" . $fleet['fleet_group'] . "'" id = '" . $fleet['fleet_group'] . "'"
, 'aks'); , 'aks');
if (mysql_num_rows($aks) != 1) { if ($aks->rowCount() != 1) {
message('AKS nicht gefunden!', 'Fehler'); message('AKS nicht gefunden!', 'Fehler');
} }
$aks = mysql_num_rows($aks);
} }
$missiontype = array(1 => 'Attaquer', $missiontype = array(1 => 'Attaquer',