". $lang['fl_fleet_err'] ."", $lang['fl_error'], "fleet." . $phpEx, 2); } // On verifie s'il y a assez de vaisseaux sur la planete ! foreach ($fleetarray as $Ship => $Count) { if ($Count > $planetrow[$resource[$Ship]]) { message ("". $lang['fl_fleet_err'] ."", $lang['fl_error'], "fleet." . $phpEx, 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 ("". $lang['fl_fleet_err_pl'] ."", $lang['fl_error'], "fleet." . $phpEx, 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"); } $currentplanet = doquery("SELECT * FROM {{table}} WHERE id = '" . $user['current_planet'] . "'", 'planets', true); if ($currentplanet['galaxy'] == $galaxy && $currentplanet['system'] == $system && $currentplanet['planet'] == $planet && $currentplanet['planet_type'] == $planettype) { message ("". $lang['fl_ownpl_err'] ."", $lang['fl_error'], "fleet." . $phpEx, 2); } // Test d'existance de l'enregistrement dans la gaalxie ! if ($_POST['mission'] != 15) { if (mysql_num_rows($select) < 1 && $fleetmission != 9) { message ("". $lang['fl_unknow_target'] ."", $lang['fl_error'], "fleet." . $phpEx, 2); } elseif ($fleetmission == 9 && mysql_num_rows($select)) { message ("". $lang['fl_used_target'] ."", $lang['fl_error'], "fleet." . $phpEx, 2); } } else { // Va falloir penser serieusement a verifier les droits pour les expeditions // voir si l'interessé a la technologie 214 par exemple ... // voir aussi a quel niveau il est ... // voir s'il n'a pas deja de flottes en expedition } $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é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(9 => $lang['type_mission_9']); } 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) { if (!$YourPlanet) { $missiontype[1] = $lang['type_mission_1']; } $missiontype[3] = $lang['type_mission_3']; } if ( ($_POST['ship202'] >= 1 || $_POST['ship203'] ) && !$YourPlanet && $UsedPlanet) { $missiontype[5] = $lang['type_mission_5']; } } elseif ($_POST['ship209'] >= 1 || $_POST['ship208']) { $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 (empty($missiontype[$fleetmission])) { message ("". $lang['fl_bad_mission'] ."", $lang['fl_error'], "fleet." . $phpEx, 2); } check_field_current($planetrow); $enemyrow = doquery("SELECT * FROM {{table}} WHERE galaxy={$_POST['galaxy']} AND system={$_POST['system']} AND planet={$_POST['planet']}", 'planets', true); $MyDBRec = doquery("SELECT * FROM {{table}} WHERE id={$user['id']}", 'users', true); if ($enemyrow['id_owner'] == '') { $HeDBRec = $MyDBRec; } elseif ($enemyrow['id_owner'] != '') { $HeDBRec = doquery("SELECT * FROM {{table}} WHERE id={$enemyrow['id_owner']}", 'users', true); } if($idty['urlaubs_modus'] == 1){ message("Bu oyuncuya filo gonderemessin cunku oyuncu tatil modunda","Tatil Modu","fleet.".$phpEx,1); } if($user['urlaubs_modus'] == 1){ message("Bu oyuncuya filo gonderemessin cunku oyuncu tatil modunda","Tatil Modu","fleet.".$phpEx,1); } if($idty['urlaubs_modus'] > 0 and $idty != $idja and $_POST['mission'] == 1){ message("Bu oyuncuya filo gonderemessin cunku oyuncu tatil modunda","Tatil Modu","fleet.".$phpEx,1); } if($idty['urlaubs_modus'] > 0 and $idty != $idja and $_POST['mission'] == 3){ message("Bu oyuncuya filo gonderemessin cunku oyuncu tatil modunda","Tatil Modu","fleet.".$phpEx,1); } if($idty['urlaubs_modus'] > 0 and $idty != $idja and $_POST['mission'] == 5){ message("Bu oyuncuya filo gonderemessin cunku oyuncu tatil modunda","Tatil Modu","fleet.".$phpEx,1); } if($idty['urlaubs_modus'] > 0 and $idty != $idja and $_POST['mission'] == 6){ message("Bu oyuncuya filo gonderemessin cunku oyuncu tatil modunda","Tatil Modu","fleet.".$phpEx,1); } if($user['urlaubs_modus'] == 1){ message("Bu oyuncuya filo gonderemessin cunku oyuncu tatil modunda","Tatil Modu","fleet.".$phpEx,1); } $MyGameLevel = $MyDBRec['points_points']; $HeGameLevel = $HeDBRec['points_points']; $VacationMode = $HeDBRec['urlaubs_modus']; if ($MyGameLevel > ($HeGameLevel * $protectionmulti) AND $enemyrow['id_owner'] != '' AND $_POST['mission'] == 1 AND $protection == 1 AND $HeGameLevel < ($protectiontime * 1000)) { message("".$lang['fl_noob_mess_n']."", $lang['fl_noob_title'], "fleet." . $phpEx, 2); } if ($MyGameLevel > ($HeGameLevel * $protectionmulti) AND $enemyrow['id_owner'] != '' AND $_POST['mission'] == 5 AND $protection == 1 AND $HeGameLevel < ($protectiontime * 1000)) { message("".$lang['fl_noob_mess_n']."", $lang['fl_noob_title'], "fleet." . $phpEx, 2); } if ($MyGameLevel > ($HeGameLevel * $protectionmulti) AND $enemyrow['id_owner'] != '' AND $_POST['mission'] == 6 AND $protection == 1 AND $HeGameLevel < ($protectiontime * 1000)) { message("".$lang['fl_noob_mess_n']."", $lang['fl_noob_title'], "fleet." . $phpEx, 2); } if (($MyGameLevel * $protectionmulti) < $HeGameLevel AND $enemyrow['id_owner'] != '' AND $_POST['mission'] == 1 AND $protection == 1 AND $MyGameLevel < ($protectiontime * 1000)) { message("".$lang['fl_noob_mess_n']."", $lang['fl_noob_title'], "fleet." . $phpEx, 2); } if (($MyGameLevel * $protectionmulti) < $HeGameLevel AND $enemyrow['id_owner'] != '' AND $_POST['mission'] == 5 AND $protection == 1 AND $MyGameLevel < ($protectiontime * 1000)) { message("".$lang['fl_noob_mess_n']."", $lang['fl_noob_title'], "fleet." . $phpEx, 2); } if (($MyGameLevel * $protectionmulti) < $HeGameLevel AND $enemyrow['id_owner'] != '' AND $_POST['mission'] == 6 AND $protection == 1 AND $MyGameLevel < ($protectiontime * 1000)) { message("".$lang['fl_noob_mess_n']."", $lang['fl_noob_title'], "fleet." . $phpEx, 2); } if ($VacationMode AND $_POST['mission'] != 8) { message("".$lang['fl_vacation_pla']."", $lang['fl_vacation_ttl'], "fleet." . $phpEx, 2); } $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." . $phpEx, 1); } if ($_POST['resource1'] + $_POST['resource2'] + $_POST['resource3'] < 1 AND $_POST['mission'] == 3) { message("".$lang['fl_noenoughtgoods']."", $lang['type_mission_3'], "fleet." . $phpEx, 1); } if ($_POST['mission'] != 15) { if ($enemyrow['id_owner'] == '' AND $_POST['mission'] < 8) { message ("". $lang['fl_bad_planet01'] ."", $lang['fl_error'], "fleet." . $phpEx, 2); } if ($enemyrow['id_owner'] != '' AND $_POST['mission'] == 9) { message ("". $lang['fl_bad_planet02'] ."", $lang['fl_error'], "fleet." . $phpEx, 2); } if ($HeDBRec['ally_id'] != $MyDBRec['ally_id'] AND $_POST['mission'] == 4) { message ("". $lang['fl_dont_stay_here'] ."", $lang['fl_error'], "fleet." . $phpEx, 2); } if ($enemyrow['ally_deposit'] < 1 AND $HeDBRec != $MyDBRec AND $_POST['mission'] == 5) { message ("". $lang['fl_no_allydeposit'] ."", $lang['fl_error'], "fleet." . $phpEx, 2); } if (($enemyrow["id_owner"] == $planetrow["id_owner"]) AND ($_POST["mission"] == 1)) { message ("". $lang['fl_no_self_attack'] ."", $lang['fl_error'], "fleet." . $phpEx, 2); } if (($enemyrow["id_owner"] == $planetrow["id_owner"]) AND ($_POST["mission"] == 6)) { message ("". $lang['fl_no_self_spy'] ."", $lang['fl_error'], "fleet." . $phpEx, 2); } if (($enemyrow["id_owner"] != $planetrow["id_owner"]) AND ($_POST["mission"] == 4)) { message ("". $lang['fl_only_stay_at_home'] ."", $lang['fl_error'], "fleet." . $phpEx, 2); } if (($Multialarm == 1 && $idty['user_lastip'] == $user['user_lastip'] && $enemyrow['id_owner'] != $user["id"] && $_POST["mission"] != 9)) { message("Multialarm","Error"); } } $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'], ); $speed_possible = array(10, 9, 8, 7, 6, 5, 4, 3, 2, 1); if (!in_array($_POST['speed'], $speed_possible)) { message ("". $lang['fl_cheat_speed'] ."", $lang['fl_error'], "fleet." . $phpEx, 2); } $planetrow = doquery("SELECT * FROM {{table}} WHERE id={$user['current_planet']}", 'planets', true); foreach ($reslist['fleet'] as $n => $i) { if ($planetrow[$resource[$i]] > 0) { if ($i == 202 or $i == 203 or $i == 204 or $i == 209 or $i == 210) { $speedalls[$i] = $pricelist[$i]['speed'] + (($pricelist[$i]['speed'] * $user['combustion_tech']) * 0.1); } if ($i == 205 or $i == 206 or $i == 208 or $i == 211) { $speedalls[$i] = $pricelist[$i]['speed'] + (($pricelist[$i]['speed'] * $user['impulse_motor_tech']) * 0.2); } if ($i == 207 or $i == 213 or $i == 214 or $i == 215 or $i == 216) { $speedalls[$i] = $pricelist[$i]['speed'] + (($pricelist[$i]['speed'] * $user['hyperspace_motor_tech']) * 0.3); } } } $newarray = array(); foreach ($speedalls as $i => $geschw) { if ($_POST['ship' . $i] >= 1) { $newarray[$i] = $geschw; } } $speedallsmin = min($newarray); if ($speedallsmin != $_POST['speedallsmin']) { message ("". $lang['fl_cheat_speed'] ."", $lang['fl_error'], "fleet." . $phpEx, 2); } if (!$_POST['planettype']) { message ("". $lang['fl_no_planet_type'] ."", $lang['fl_error'], "fleet." . $phpEx, 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'] > 9 || $_POST['galaxy'] < 1) { $error++; $errorlist .= $lang['fl_limit_galaxy']; } if (!$_POST['system'] || !is_numeric($_POST['system']) || $_POST['system'] > 499 || $_POST['system'] < 1) { $error++; $errorlist .= $lang['fl_limit_system']; } if (!$_POST['planet'] || !is_numeric($_POST['planet']) || $_POST['planet'] > 16 || $_POST['planet'] < 1) { $error++; $errorlist .= $lang['fl_limit_planet']; } if ($error > 0) { message ("", $lang['fl_error'], "fleet." . $phpEx, 2); } // La flotte part bien de la planete courrante ?? if ($_POST['thisgalaxy'] != $planetrow['galaxy'] | $_POST['thissystem'] != $planetrow['system'] | $_POST['thisplanet'] != $planetrow['planet'] | $_POST['thisplanettype'] != $planetrow['planet_type']) { message ("". $lang['fl_cheat_origine'] ."", $lang['fl_error'], "fleet." . $phpEx, 2); } if (!isset($fleetarray)) { message ("". $lang['fl_no_fleetarray'] ."", $lang['fl_error'], "fleet." . $phpEx, 2); } $SpeedFactor = $_POST['speedfactor']; $MaxFleetSpeed = $_POST['speedallsmin']; $GenFleetSpeed = $_POST['speed']; $distance = GetTargetDistance ( $_POST['thisgalaxy'], $_POST['galaxy'], $_POST['thissystem'], $_POST['system'], $_POST['thisplanet'], $_POST['planet'] ); $duration = GetMissionDuration ( $GenFleetSpeed, $MaxFleetSpeed, $distance, $SpeedFactor ); $fleet['start_time'] = $duration + time(); $fleet['end_time'] = (2 * $duration) + time(); $consumption = 0; $FleetStorage = 0; $FleetShipCount = 0; $fleet_array = ""; $FleetSubQRY = ""; $consumption = 0; foreach ($fleetarray as $Ship => $Count) { $ShipSpeed = $pricelist[$Ship]["speed"]; $spd = 35000 / ($duration * $SpeedFactor - 10) * sqrt($distance * 10 / $ShipSpeed); $basicConsumption = $pricelist[$Ship]["consumption"] * $Count ; $consumption += $basicConsumption * $distance / 35000 * (($spd / 10) + 1) * (($spd / 10) + 1); $FleetStorage += $pricelist[$Ship]["capacity"] * $Count; $FleetShipCount += $Count; $fleet_array .= $Ship .",". $Count .";"; $FleetSubQRY .= "`".$resource[$Ship] . "` = `" . $resource[$Ship] . "` - " . $Count . " , "; } $consumption = round($consumption) + 1; if ($_POST['resource1'] >= $planetrow['metal'] | $_POST['resource2'] >= $planetrow['crystal'] | $_POST['resource3'] >= ($planetrow['deuterium'] - $consumption)) { message ("". $lang['fl_noressources'] . pretty_number($consumption) ."", $lang['fl_error'], "fleet." . $phpEx, 2); } if (($_POST['resource1'] + $_POST['resource2'] + $_POST['resource3']) > ($FleetStorage - $consumption)) { message ("". $lang['fl_nostoragespa'] . (($_POST['resource1'] + $_POST['resource2'] + $_POST['resource3']) - ($FleetStorage - $consumption)) ."", $lang['fl_error'], "fleet." . $phpEx, 2); } if ($_POST['mission'] == 15) { $StayTime = $_POST['expeditiontime'] * 3600; } elseif ($_POST['mission'] == 5) { $StayTime = $_POST['holdingtime'] * 3600; } else { $StayTime = '0'; } // 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) doquery("INSERT INTO {{table}} SET `fleet_owner`='{$user['id']}', `fleet_mission`='{$_POST['mission']}', `fleet_amount`='{$FleetShipCount}', `fleet_array`='{$fleet_array}', `fleet_start_time`= '{$fleet['start_time']}', `fleet_start_galaxy`='" . intval($_POST['thisgalaxy']) . "', `fleet_start_system`='" . intval($_POST['thissystem']) . "', `fleet_start_planet`='" . intval($_POST['thisplanet']) . "', `fleet_start_type`='" . intval($_POST['thisplanettype']) . "', `fleet_end_time`='" . $fleet['end_time'] . "', `fleet_end_stay`='" . $StayTime . "', `fleet_end_galaxy`='" . intval($_POST['galaxy']) . "', `fleet_end_system`='" . intval($_POST['system']) . "', `fleet_end_planet`='" . intval($_POST['planet']) . "', `fleet_end_type`='" . intval($_POST['planettype']) . "', `fleet_resource_metal` = '" . $_POST['resource1'] . "', `fleet_resource_crystal` = '" . $_POST['resource2'] . "', `fleet_resource_deuterium` = '" . $_POST['resource3'] . "', `fleet_ofiara`='" . $enemyrow['id_owner'] . "', `start_time` = '" . time() . "'", 'fleets'); if ($_POST['resource1'] < 1) { $transport["metal"] = 0; } else { $transport["metal"] = $_POST['resource1']; } if ($_POST['resource2'] < 1) { $transport["crystal"] = 0; } else { $transport["crystal"] = $_POST['resource2']; } if ($_POST['resource3'] < 1) { $transport["deuterium"] = 0 + $consumption; } else { $transport["deuterium"] = $_POST['resource3'] + $consumption; } $planetrow["metal"] = $planetrow["metal"] - $transport["metal"]; $planetrow["crystal"] = $planetrow["crystal"] - $transport["crystal"]; $planetrow["deuterium"] = $planetrow["deuterium"] - $transport["deuterium"]; $query = "UPDATE {{table}} SET `metal` = `metal` - '{$transport["metal"]}', `crystal` = `crystal` - '{$transport["crystal"]}', `deuterium` = `deuterium` - '{$transport["deuterium"]}', $FleetSubQRY `id_owner` = '{$planetrow['id_owner']}' WHERE `id` = '{$planetrow['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 ($query, "planets"); // Un peu de blabla pour l'utilisateur, affichage d'un joli tableau de la flotte expediée $page = "

"; $page .= ""; $page .= ""; $page .= ""; $page .= ""; $page .= ""; $page .= ""; $page .= ""; $page .= ""; $page .= ""; $page .= ""; $page .= ""; $page .= ""; $page .= ""; $page .= ""; $page .= ""; $page .= ""; $page .= ""; $page .= ""; $page .= ""; $page .= ""; $page .= ""; $page .= ""; $page .= ""; $page .= ""; $page .= ""; $page .= ""; $page .= ""; $page .= ""; $page .= ""; foreach ($fleetarray as $Ship => $Count) { $page .= ""; $page .= ""; $page .= ""; } $page .= "
". $lang['fl_fleet_send'] ."
". $lang['fl_mission'] ."". $missiontype[$_POST['mission']] ."
". $lang['fl_dist'] ."". pretty_number($distance) ."
". $lang['fl_speed'] ."". pretty_number($_POST['speedallsmin']) ."
". $lang['fl_deute_need'] ."". pretty_number($consumption) ."
". $lang['fl_from'] ."". $_POST['thisgalaxy'] .":". $_POST['thissystem']. ":". $_POST['thisplanet'] ."
". $lang['fl_dest'] ."". $_POST['galaxy'] .":". $_POST['system'] .":". $_POST['planet'] ."
". $lang['fl_time_go'] ."". date("M D d H:i:s", $fleet['start_time']) ."
". $lang['fl_time_back'] ."". date("M D d H:i:s", $fleet['end_time']) ."
". $lang['fl_title'] ."
". $lang['tech'][$Ship] ."". pretty_number($Count) ."
"; 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 ?>