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