PageRenderTime 846ms CodeModel.GetById 36ms RepoModel.GetById 10ms app.codeStats 0ms

/src/2.10.2/upload/includes/pages/class.ShowFleet3Page.php

https://github.com/SantiHarry/XG-Proyect-v2.10.x
PHP | 595 lines | 483 code | 91 blank | 21 comment | 154 complexity | 8445812e4e16e9dacebfa853936d0b2d MD5 | raw file
  1. <?php
  2. /**
  3. * @project XG Proyect
  4. * @version 2.10.x build 0000
  5. * @copyright Copyright (C) 2008 - 2012
  6. */
  7. if(!defined('INSIDE')){ die(header("location:../../"));}
  8. class ShowFleet3Page
  9. {
  10. function ShowFleet3Page($CurrentUser, $CurrentPlanet)
  11. {
  12. global $resource, $pricelist, $reslist, $lang;
  13. include_once ( XGP_ROOT . 'includes/functions/IsVacationMode.php' );
  14. $parse = $lang;
  15. if ( IsVacationMode ( $CurrentUser ) )
  16. {
  17. exit ( message ( $lang['fl_vacation_mode_active'] , "game.php?page=overview" , 2 ) );
  18. }
  19. $fleet_group_mr = 0;
  20. if ( $_POST['fleet_group'] > 0 )
  21. {
  22. if ( $_POST['mission'] == 2 )
  23. {
  24. $target = "g" .
  25. intval ( $_POST["galaxy"] ) .
  26. "s" .
  27. intval ( $_POST["system"] ) .
  28. "p" . intval ( $_POST["planet"] ) .
  29. "t" . intval ( $_POST["planettype"] );
  30. if ( $_POST['acs_target_mr'] == $target )
  31. {
  32. $aks_count_mr = doquery ( "SELECT COUNT(*)
  33. FROM {{table}}
  34. WHERE id = '" . intval ( $_POST['fleet_group'] ) . "'" , 'aks' );
  35. if ($aks_count_mr > 0)
  36. {
  37. $fleet_group_mr = $_POST['fleet_group'];
  38. }
  39. }
  40. }
  41. }
  42. if(($_POST['fleet_group'] == 0) && ($_POST['mission'] == 2))
  43. {
  44. $_POST['mission'] = 1;
  45. }
  46. $TargetPlanet = doquery("SELECT `id_owner`,`id_level`,`destruyed`,`ally_deposit` FROM {{table}} WHERE `galaxy` = '". intval($_POST['galaxy']) ."' AND `system` = '". intval($_POST['system']) ."' AND `planet` = '". intval($_POST['planet']) ."' AND `planet_type` = '". intval($_POST['planettype']) ."';", 'planets', TRUE);
  47. $MyDBRec = doquery("SELECT `id`,`onlinetime`,`ally_id`,`urlaubs_modus` FROM {{table}} WHERE `id` = '". intval($CurrentUser['id'])."';", 'users', TRUE);
  48. $fleetarray = unserialize ( base64_decode ( str_rot13 ( $_POST["usedfleet"] ) ) );
  49. if ( $TargetPlanet["destruyed"] != 0 )
  50. {
  51. exit ( header ( "Location: game.php?page=fleet" ) );
  52. }
  53. if ( !is_array ( $fleetarray ) )
  54. {
  55. exit ( header ( "Location: game.php?page=fleet" ) );
  56. }
  57. foreach ( $fleetarray as $Ship => $Count )
  58. {
  59. $Count = intval ( $Count );
  60. if ($Count > $CurrentPlanet[$resource[$Ship]])
  61. {
  62. exit ( header ( "location:game.php?page=fleet" ) );
  63. }
  64. }
  65. $error = 0;
  66. $galaxy = intval($_POST['galaxy']);
  67. $system = intval($_POST['system']);
  68. $planet = intval($_POST['planet']);
  69. $planettype = intval($_POST['planettype']);
  70. $fleetmission = intval($_POST['mission']);
  71. //fix by jstar
  72. if ( $fleetmission == 7 && !isset($fleetarray[208]) )
  73. {
  74. exit ( header ( "location:game.php?page=fleet" ) );
  75. }
  76. if ($planettype != 1 && $planettype != 2 && $planettype != 3)
  77. {
  78. exit ( header ( "location:game.php?page=fleet" ) );
  79. }
  80. //fix invisible debris like ogame by jstar
  81. if ($fleetmission == 8)
  82. {
  83. $YourPlanet = FALSE;
  84. $UsedPlanet = FALSE;
  85. $select = doquery("SELECT * FROM {{table}} WHERE galaxy = '". $galaxy ."' AND system = '". $system ."' AND planet = '". $planet ."'", "planets");
  86. $select2 = doquery("SELECT invisible_start_time, metal, crystal FROM {{table}} WHERE galaxy = '". $galaxy ."' AND system = '". $system ."' AND planet = '". $planet ."'", "galaxy",TRUE);
  87. if($select2['metal'] == 0 && $select2['crystal'] == 0 && time() > ($select2['invisible_start_time']+DEBRIS_LIFE_TIME))
  88. {
  89. exit ( header ( "location:game.php?page=fleet" ) );
  90. }
  91. }
  92. else
  93. {
  94. $YourPlanet = FALSE;
  95. $UsedPlanet = FALSE;
  96. $select = doquery("SELECT * FROM {{table}} WHERE galaxy = '". $galaxy ."' AND system = '". $system ."' AND planet = '". $planet ."' AND planet_type = '". $planettype ."'", "planets");
  97. }
  98. if ($CurrentPlanet['galaxy'] == $galaxy && $CurrentPlanet['system'] == $system &&
  99. $CurrentPlanet['planet'] == $planet && $CurrentPlanet['planet_type'] == $planettype)
  100. {
  101. exit ( header ( "location:game.php?page=fleet" ) );
  102. }
  103. if ($_POST['mission'] != 15)
  104. {
  105. if (mysql_num_rows($select) < 1 && $fleetmission != 7)
  106. {
  107. exit ( header ( "location:game.php?page=fleet" ) );
  108. }
  109. elseif ($fleetmission == 9 && mysql_num_rows($select) < 1)
  110. {
  111. exit ( header ( "location:game.php?page=fleet" ) );
  112. }
  113. }
  114. else
  115. {
  116. $MaxExpedition = $CurrentUser[$resource[124]];
  117. if ($MaxExpedition >= 1)
  118. {
  119. $maxexpde = doquery("SELECT COUNT(fleet_owner) AS `expedi` FROM {{table}} WHERE `fleet_owner` = '".intval($CurrentUser['id'])."' AND `fleet_mission` = '15';", 'fleets', TRUE);
  120. $ExpeditionEnCours = $maxexpde['expedi'];
  121. $EnvoiMaxExpedition = 1 + floor( $MaxExpedition / 3 );
  122. }
  123. else
  124. {
  125. $ExpeditionEnCours = 0;
  126. $EnvoiMaxExpedition = 0;
  127. }
  128. if($EnvoiMaxExpedition == 0 )
  129. {
  130. message ("<font color=\"red\"><b>".$lang['fl_expedition_tech_required']."</b></font>", "game.php?page=fleet", 2);
  131. }
  132. elseif ($ExpeditionEnCours >= $EnvoiMaxExpedition )
  133. {
  134. message ("<font color=\"red\"><b>".$lang['fl_expedition_fleets_limit']."</b></font>", "game.php?page=fleet", 2);
  135. }
  136. }
  137. $select = mysql_fetch_array($select);
  138. if ($select['id_owner'] == $CurrentUser['id'])
  139. {
  140. $YourPlanet = TRUE;
  141. $UsedPlanet = TRUE;
  142. }
  143. elseif (!empty($select['id_owner']))
  144. {
  145. $YourPlanet = FALSE;
  146. $UsedPlanet = TRUE;
  147. }
  148. else
  149. {
  150. $YourPlanet = FALSE;
  151. $UsedPlanet = FALSE;
  152. }
  153. //fix by jstar
  154. if($fleetmission == 9)
  155. {
  156. $countfleettype = count ( $fleetarray );
  157. if($YourPlanet or !$UsedPlanet or $planettype != 3)
  158. {
  159. exit ( header ( "location:game.php?page=fleet" ) );
  160. }
  161. elseif($countfleettype==1 && !(isset($fleetarray[214])))
  162. {
  163. exit ( header ( "location:game.php?page=fleet" ) );
  164. }
  165. elseif($countfleettype==2 && !(isset($fleetarray[214])))
  166. {
  167. exit ( header ( "location:game.php?page=fleet" ) );
  168. }
  169. elseif($countfleettype>2)
  170. {
  171. exit ( header ( "location:game.php?page=fleet" ) );
  172. }
  173. }
  174. if (empty($fleetmission))
  175. {
  176. exit ( header ( "location:game.php?page=fleet" ) );
  177. }
  178. if ($TargetPlanet['id_owner'] == '')
  179. {
  180. $HeDBRec = $MyDBRec;
  181. }
  182. elseif ($TargetPlanet['id_owner'] != '')
  183. {
  184. $HeDBRec = doquery("SELECT `id`,`onlinetime`,`ally_id`,`urlaubs_modus` FROM {{table}} WHERE `id` = '". intval($TargetPlanet['id_owner']) ."';", 'users', TRUE);
  185. }
  186. $UserPoints = doquery("SELECT `total_points` FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '". intval($MyDBRec['id']) ."';", 'statpoints', TRUE);
  187. $User2Points = doquery("SELECT `total_points` FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '". intval($HeDBRec['id']) ."';", 'statpoints', TRUE);
  188. $MyGameLevel = $UserPoints['total_points'];
  189. $HeGameLevel = $User2Points['total_points'];
  190. if($HeDBRec['onlinetime'] >= (time()-60 * 60 * 24 * 7))
  191. {
  192. if ( is_weak ( $MyGameLevel , $HeGameLevel ) &&
  193. $TargetPlanet['id_owner'] != '' &&
  194. ($_POST['mission'] == 1 or $_POST['mission'] == 6 or $_POST['mission'] == 9))
  195. {
  196. message("<font color=\"lime\"><b>".$lang['fl_week_player']."</b></font>", "game.php?page=fleet", 2);
  197. }
  198. if ( is_strong ( $MyGameLevel , $HeGameLevel ) &&
  199. $TargetPlanet['id_owner'] != '' &&
  200. ($_POST['mission'] == 1 or $_POST['mission'] == 5 or $_POST['mission'] == 6 or $_POST['mission'] == 9))
  201. {
  202. message("<font color=\"red\"><b>".$lang['fl_strong_player']."</b></font>", "game.php?page=fleet", 2);
  203. }
  204. }
  205. if ($HeDBRec['urlaubs_modus'] && $_POST['mission'] != 8)
  206. {
  207. message("<font color=\"lime\"><b>".$lang['fl_in_vacation_player']."</b></font>", "game.php?page=fleet", 2);
  208. }
  209. $FlyingFleets = mysql_fetch_assoc(doquery("SELECT COUNT(fleet_id) as Number FROM {{table}} WHERE `fleet_owner`='".intval($CurrentUser['id'])."'", 'fleets'));
  210. $ActualFleets = $FlyingFleets["Number"];
  211. if ((Fleets::get_max_fleets ( $CurrentUser[$resource[108]] , $CurrentUser['rpg_amiral'] ) ) <= $ActualFleets)
  212. {
  213. message($lang['fl_no_slots'], "game.php?page=fleet", 1);
  214. }
  215. if ($_POST['resource1'] + $_POST['resource2'] + $_POST['resource3'] < 1 && $_POST['mission'] == 3)
  216. {
  217. message("<font color=\"lime\"><b>".$lang['fl_empty_transport']."</b></font>", "game.php?page=fleet", 1);
  218. }
  219. if ($_POST['mission'] != 15)
  220. {
  221. if ($TargetPlanet['id_owner'] == '' && $_POST['mission'] < 7)
  222. {
  223. exit ( header ( "location:game.php?page=fleet" ) );
  224. }
  225. if ($TargetPlanet['id_owner'] != '' && $_POST['mission'] == 7)
  226. {
  227. message ("<font color=\"red\"><b>".$lang['fl_planet_populed']."</b></font>", "game.php?page=fleet", 2);
  228. }
  229. if ($HeDBRec['ally_id'] != $MyDBRec['ally_id'] && $_POST['mission'] == 4)
  230. {
  231. message ("<font color=\"red\"><b>".$lang['fl_stay_not_on_enemy']."</b></font>", "game.php?page=fleet", 2);
  232. }
  233. if (($TargetPlanet["id_owner"] == $CurrentPlanet["id_owner"]) && (($_POST["mission"] == 1) or ($_POST["mission"] == 6)))
  234. {
  235. exit ( header ( "location:game.php?page=fleet" ) );
  236. }
  237. if (($TargetPlanet["id_owner"] != $CurrentPlanet["id_owner"]) && ($_POST["mission"] == 4))
  238. {
  239. message ("<font color=\"red\"><b>".$lang['fl_deploy_only_your_planets']."</b></font>","game.php?page=fleet", 2);
  240. }
  241. if($_POST['mission'] == 5)
  242. {
  243. $buddy = doquery ( "SELECT COUNT( * ) AS buddys
  244. FROM `{{table}}`
  245. WHERE (
  246. (
  247. sender ='" . intval($CurrentPlanet['id_owner']) . "'
  248. AND owner ='" . intval($TargetPlanet['id_owner']) . "'
  249. )
  250. OR (
  251. sender ='" . intval($TargetPlanet['id_owner']) . "'
  252. AND owner ='" . intval($CurrentPlanet['id_owner']) . "'
  253. )
  254. )
  255. AND active =1" , 'buddy' , TRUE );
  256. /*
  257. if ($_POST['planettype']==3)
  258. {
  259. $x = doquery("SELECT `ally_deposit` FROM {{table}} WHERE `galaxy` = '". intval($_POST['galaxy']) ."' AND `system` = '". intval($_POST['system']) ."' AND `planet` = '". intval($_POST['planet']) ."' AND `planet_type` = 1;", 'planets', TRUE);
  260. }
  261. else
  262. {
  263. $x = $TargetPlanet;
  264. }
  265. */
  266. // if (($HeDBRec['ally_id'] != $MyDBRec['ally_id'] && $buddy<1) || $x['ally_deposit'] < 1)
  267. if ( $HeDBRec['ally_id'] != $MyDBRec['ally_id'] && $buddy['buddys'] < 1 )
  268. {
  269. message ("<font color=\"red\"><b>".$lang['fl_stay_not_on_enemy']."</b></font>", "game.php?page=fleet", 2);
  270. }
  271. }
  272. }
  273. $missiontype = array (
  274. 1 => $lang['type_mission'][1],
  275. 2 => $lang['type_mission'][2],
  276. 3 => $lang['type_mission'][3],
  277. 4 => $lang['type_mission'][4],
  278. 5 => $lang['type_mission'][5],
  279. 6 => $lang['type_mission'][6],
  280. 7 => $lang['type_mission'][7],
  281. 8 => $lang['type_mission'][8],
  282. 9 => $lang['type_mission'][9],
  283. 15 => $lang['type_mission'][15],
  284. );
  285. $speed_possible = array(10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
  286. $AllFleetSpeed = Fleets::fleet_max_speed ($fleetarray, 0, $CurrentUser);
  287. $GenFleetSpeed = $_POST['speed'];
  288. $SpeedFactor = read_config ( 'fleet_speed' ) / 2500;
  289. $MaxFleetSpeed = min($AllFleetSpeed);
  290. if (!in_array($GenFleetSpeed, $speed_possible))
  291. {
  292. exit ( header ( "location:game.php?page=fleet" ) );
  293. }
  294. if ($MaxFleetSpeed != $_POST['speedallsmin'])
  295. {
  296. exit ( header ( "location:game.php?page=fleet" ) );
  297. }
  298. if (!$_POST['planettype'])
  299. {
  300. exit ( header ( "location:game.php?page=fleet" ) );
  301. }
  302. if (!$_POST['galaxy'] || !is_numeric($_POST['galaxy']) || $_POST['galaxy'] > MAX_GALAXY_IN_WORLD || $_POST['galaxy'] < 1)
  303. {
  304. exit ( header ( "location:game.php?page=fleet" ) );
  305. }
  306. if (!$_POST['system'] || !is_numeric($_POST['system']) || $_POST['system'] > MAX_SYSTEM_IN_GALAXY || $_POST['system'] < 1)
  307. {
  308. exit ( header ( "location:game.php?page=fleet" ) );
  309. }
  310. if (!$_POST['planet'] || !is_numeric($_POST['planet']) || $_POST['planet'] > (MAX_PLANET_IN_SYSTEM + 1) || $_POST['planet'] < 1)
  311. {
  312. exit ( header ( "location:game.php?page=fleet" ) );
  313. }
  314. if ($_POST['thisgalaxy'] != $CurrentPlanet['galaxy'] |
  315. $_POST['thissystem'] != $CurrentPlanet['system'] |
  316. $_POST['thisplanet'] != $CurrentPlanet['planet'] |
  317. $_POST['thisplanettype'] != $CurrentPlanet['planet_type'])
  318. {
  319. exit ( header ( "location:game.php?page=fleet" ) );
  320. }
  321. if (!isset($fleetarray))
  322. {
  323. exit ( header ( "location:game.php?page=fleet" ) );
  324. }
  325. $distance = Fleets::target_distance($_POST['thisgalaxy'], $_POST['galaxy'], $_POST['thissystem'], $_POST['system'], $_POST['thisplanet'], $_POST['planet']);
  326. $duration = Fleets::mission_duration($GenFleetSpeed, $MaxFleetSpeed, $distance, $SpeedFactor);
  327. $consumption = Fleets::fleet_consumption($fleetarray, $SpeedFactor, $duration, $distance, $MaxFleetSpeed, $CurrentUser);
  328. $fleet['start_time'] = $duration + time();
  329. // START CODE BY JSTAR
  330. if ($_POST['mission'] == 15)
  331. {
  332. $StayDuration = floor($_POST['expeditiontime']);
  333. if ( $StayDuration <= floor ( sqrt ( $CurrentUser['expedition_tech'] ) ) && $StayDuration > 0 )
  334. {
  335. $StayDuration = $StayDuration * 3600;
  336. $StayTime = $fleet['start_time'] + $StayDuration;
  337. }
  338. else
  339. {
  340. exit ( header ( "location:game.php?page=fleet" ) );
  341. }
  342. } // END CODE BY JSTAR
  343. elseif ($_POST['mission'] == 5)
  344. {
  345. $StayDuration = $_POST['holdingtime'] * 3600;
  346. $StayTime = $fleet['start_time'] + $_POST['holdingtime'] * 3600;
  347. }
  348. else
  349. {
  350. $StayDuration = 0;
  351. $StayTime = 0;
  352. }
  353. $fleet['end_time'] = $StayDuration + (2 * $duration) + time();
  354. $FleetStorage = 0;
  355. $FleetShipCount = 0;
  356. $fleet_array = "";
  357. $FleetSubQRY = "";
  358. //fix by jstar
  359. $haveSpyProbos = FALSE;
  360. foreach ($fleetarray as $Ship => $Count)
  361. {
  362. $Count = intval($Count);
  363. if($Ship == 210)
  364. {
  365. $haveSpyProbos = TRUE;
  366. }
  367. $FleetStorage += $pricelist[$Ship]["capacity"] * $Count;
  368. $FleetShipCount += $Count;
  369. $fleet_array .= $Ship .",". $Count .";";
  370. $FleetSubQRY .= "`".$resource[$Ship] . "` = `" . $resource[$Ship] . "` - " . $Count . ", ";
  371. }
  372. if(!$haveSpyProbos AND $_POST['mission'] == 6)
  373. {
  374. exit ( header ( "location:game.php?page=fleet" ) );
  375. }
  376. $FleetStorage -= $consumption;
  377. $StorageNeeded = 0;
  378. $_POST['resource1'] = max(0, (int)trim($_POST['resource1']));
  379. $_POST['resource2'] = max(0, (int)trim($_POST['resource2']));
  380. $_POST['resource3'] = max(0, (int)trim($_POST['resource3']));
  381. if ($_POST['resource1'] < 1)
  382. {
  383. $TransMetal = 0;
  384. }
  385. else
  386. {
  387. $TransMetal = $_POST['resource1'];
  388. $StorageNeeded += $TransMetal;
  389. }
  390. if ($_POST['resource2'] < 1)
  391. {
  392. $TransCrystal = 0;
  393. }
  394. else
  395. {
  396. $TransCrystal = $_POST['resource2'];
  397. $StorageNeeded += $TransCrystal;
  398. }
  399. if ($_POST['resource3'] < 1)
  400. {
  401. $TransDeuterium = 0;
  402. }
  403. else
  404. {
  405. $TransDeuterium = $_POST['resource3'];
  406. $StorageNeeded += $TransDeuterium;
  407. }
  408. $StockMetal = $CurrentPlanet['metal'];
  409. $StockCrystal = $CurrentPlanet['crystal'];
  410. $StockDeuterium = $CurrentPlanet['deuterium'];
  411. $StockDeuterium -= $consumption;
  412. $StockOk = FALSE;
  413. if ($StockMetal >= $TransMetal)
  414. {
  415. if ($StockCrystal >= $TransCrystal)
  416. {
  417. if ($StockDeuterium >= $TransDeuterium)
  418. {
  419. $StockOk = TRUE;
  420. }
  421. }
  422. }
  423. if (!$StockOk)
  424. {
  425. message ("<font color=\"red\"><b>". $lang['fl_no_enought_deuterium'] . Format::pretty_number($consumption) ."</b></font>", "game.php?page=fleet", 2);
  426. }
  427. if ( $StorageNeeded > $FleetStorage)
  428. {
  429. message ("<font color=\"red\"><b>". $lang['fl_no_enought_cargo_capacity'] . Format::pretty_number($StorageNeeded - $FleetStorage) ."</b></font>", "game.php?page=fleet", 2);
  430. }
  431. if ($TargetPlanet['id_level'] > $CurrentUser['authlevel'] && read_config ( 'adm_attack' ) == 0)
  432. {
  433. message($lang['fl_admins_cannot_be_attacked'], "game.php?page=fleet",2);
  434. }
  435. if ($fleet_group_mr != 0)
  436. {
  437. $AksStartTime = doquery("SELECT MAX(`fleet_start_time`) AS Start FROM {{table}} WHERE `fleet_group` = '". $fleet_group_mr . "';", "fleets", TRUE);
  438. if ($AksStartTime['Start'] >= $fleet['start_time'])
  439. {
  440. $fleet['end_time'] += $AksStartTime['Start'] - $fleet['start_time'];
  441. $fleet['start_time'] = $AksStartTime['Start'];
  442. }
  443. else
  444. {
  445. $QryUpdateFleets = "UPDATE {{table}} SET ";
  446. $QryUpdateFleets .= "`fleet_start_time` = '". $fleet['start_time'] ."', ";
  447. $QryUpdateFleets .= "`fleet_end_time` = fleet_end_time + '".($fleet['start_time'] - $AksStartTime['Start'])."' ";
  448. $QryUpdateFleets .= "WHERE ";
  449. $QryUpdateFleets .= "`fleet_group` = '". $fleet_group_mr ."';";
  450. doquery($QryUpdateFleets, 'fleets');
  451. $fleet['end_time'] += $fleet['start_time'] - $AksStartTime['Start'];
  452. }
  453. }
  454. $QryInsertFleet = "INSERT INTO {{table}} SET ";
  455. $QryInsertFleet .= "`fleet_owner` = '". intval($CurrentUser['id']) ."', ";
  456. $QryInsertFleet .= "`fleet_mission` = '".intval($_POST['mission'])."', ";
  457. $QryInsertFleet .= "`fleet_amount` = '". intval($FleetShipCount) ."', ";
  458. $QryInsertFleet .= "`fleet_array` = '". $fleet_array ."', ";
  459. $QryInsertFleet .= "`fleet_start_time` = '". $fleet['start_time'] ."', ";
  460. $QryInsertFleet .= "`fleet_start_galaxy` = '". intval($_POST['thisgalaxy']) ."', ";
  461. $QryInsertFleet .= "`fleet_start_system` = '". intval($_POST['thissystem']) ."', ";
  462. $QryInsertFleet .= "`fleet_start_planet` = '". intval($_POST['thisplanet']) ."', ";
  463. $QryInsertFleet .= "`fleet_start_type` = '". intval($_POST['thisplanettype']) ."', ";
  464. $QryInsertFleet .= "`fleet_end_time` = '". intval($fleet['end_time']) ."', ";
  465. $QryInsertFleet .= "`fleet_end_stay` = '". intval($StayTime) ."', ";
  466. $QryInsertFleet .= "`fleet_end_galaxy` = '". intval($_POST['galaxy']) ."', ";
  467. $QryInsertFleet .= "`fleet_end_system` = '". intval($_POST['system']) ."', ";
  468. $QryInsertFleet .= "`fleet_end_planet` = '". intval($_POST['planet']) ."', ";
  469. $QryInsertFleet .= "`fleet_end_type` = '". intval($_POST['planettype']) ."', ";
  470. $QryInsertFleet .= "`fleet_resource_metal` = '". $TransMetal ."', ";
  471. $QryInsertFleet .= "`fleet_resource_crystal` = '". $TransCrystal ."', ";
  472. $QryInsertFleet .= "`fleet_resource_deuterium` = '". $TransDeuterium ."', ";
  473. $QryInsertFleet .= "`fleet_target_owner` = '". intval($TargetPlanet['id_owner']) ."', ";
  474. $QryInsertFleet .= "`fleet_group` = '".intval($fleet_group_mr)."', ";
  475. $QryInsertFleet .= "`start_time` = '". time() ."';";
  476. doquery( $QryInsertFleet, 'fleets');
  477. $QryUpdatePlanet = "UPDATE `{{table}}` SET ";
  478. $QryUpdatePlanet .= $FleetSubQRY;
  479. $QryUpdatePlanet .= "`metal` = `metal` - ". $TransMetal .", ";
  480. $QryUpdatePlanet .= "`crystal` = `crystal` - ". $TransCrystal .", ";
  481. $QryUpdatePlanet .= "`deuterium` = `deuterium` - ". ($TransDeuterium + $consumption) ." ";
  482. $QryUpdatePlanet .= "WHERE ";
  483. $QryUpdatePlanet .= "`id` = ". intval($CurrentPlanet['id']) ." LIMIT 1;";
  484. doquery ($QryUpdatePlanet, "planets");
  485. $parse['mission'] = $missiontype[$_POST['mission']];
  486. $parse['distance'] = Format::pretty_number($distance);
  487. $parse['speedallsmin'] = Format::pretty_number($_POST['speedallsmin']);
  488. $parse['consumption'] = Format::pretty_number($consumption);
  489. $parse['from'] = $_POST['thisgalaxy'] .":". $_POST['thissystem']. ":". $_POST['thisplanet'];
  490. $parse['destination'] = $_POST['galaxy'] .":". $_POST['system'] .":". $_POST['planet'];
  491. $parse['start_time'] = date("M D d H:i:s", $fleet['start_time']);
  492. $parse['end_time'] = date("M D d H:i:s", $fleet['end_time']);
  493. $ships_row_template = gettemplate ( 'fleet/fleet3_ships_row' );
  494. foreach ( $fleetarray as $Ship => $Count )
  495. {
  496. $fleet_list['ship'] = $lang['tech'][$Ship];
  497. $fleet_list['amount'] = Format::pretty_number ( $Count );
  498. $ships_list .= parsetemplate ( $ships_row_template , $fleet_list );
  499. }
  500. $parse['fleet_list'] = $ships_list;
  501. display ( parsetemplate ( gettemplate ( 'fleet/fleet3_table' ) , $parse ) , FALSE );
  502. }
  503. }
  504. ?>