forked from wap-game/ogame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquickfleet.php
152 lines (136 loc) · 5.76 KB
/
quickfleet.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?php
/**
* quickfleet.php
*
* @version 1.0
* @copyright 2008 by Chlorel for XNova
*/
define('INSIDE' , true);
define('INSTALL' , false);
$xnova_root_path = './';
include($xnova_root_path . 'extension.inc');
include($xnova_root_path . 'common.' . $phpEx);
includeLang('fleet');
$Mode = $_GET['mode'];
$Galaxy = $_GET['g'];
$System = $_GET['s'];
$Planet = $_GET['p'];
$TypePl = $_GET['t'];
// Cadre liste de flottes ...
$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 ($Mode == 8) {
$QrySelectGalaxy = "SELECT * FROM {{table}} ";
$QrySelectGalaxy .= "WHERE ";
$QrySelectGalaxy .= "`galaxy` = '".$planetrow['galaxy']."' AND ";
$QrySelectGalaxy .= "`system` = '".$planetrow['system']."' AND ";
$QrySelectGalaxy .= "`planet` = '".$planetrow['planet']."' ";
$QrySelectGalaxy .= "LIMIT 1;";
$TargetGalaxy = doquery( $QrySelectGalaxy, 'galaxy', true);
$DebrisSize = $TargetGalaxy['metal'] + $TargetGalaxy['crystal'];
$RecyclerNeeded = floor($DebrisSize / ($pricelist[209]['capacity'])) + 1;
$RecyclerSpeed = $pricelist[209]['speed'] + (($pricelist[209]['speed'] * $user['combustion_tech']) * 0.1);
$RecyclerCount = $planetrow[$resource[209]];
if ($RecyclerCount > $RecyclerNeeded) {
$FleetCount = $RecyclerNeeded;
} else {
$FleetCount = $RecyclerCount;
}
$FleetArray[209] = $FleetCount;
}
$distance = GetTargetDistance ( $planetrow['galaxy'], $Galaxy, $planetrow['system'], $System, $planetrow['planet'], $Planet );
$SpeedFactor = $game_config['fleet_speed'] / 2500;
$GenFleetSpeed = 10; // a 100%
$duration = GetMissionDuration ( $GenFleetSpeed, $RecyclerSpeed, $distance, $SpeedFactor );
$page .= "<br /><br />";
$page .= "<center>";
$page .= "<table width=\"519\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\">";
$page .= "<tr height=\"20\">";
$page .= "<td class=\"c\" colspan=\"2\">";
$page .= "<span class=\"success\">".$lang['fl_fleet_send']."</span>";
$page .= "</td>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<th>". $lang['fl_mission'] ."</th>";
$page .= "<th>". $missiontype[$Mode] ."</th>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<th>". $lang['fl_dist'] ."</th>";
$page .= "<th>". $distance ."</th>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<th>". $lang['fl_fleetspeed'] ."</th>";
$page .= "<th>28750</th>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<th>". $lang['fl_deute_need'] ."</th>";
$page .= "<th>10</th>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<th>". $lang['fl_from'] ."</th>";
$page .= "<th>[". $planetrow['galaxy'] .":". $planetrow['system'] .":". $planetrow['planet'] ."]</th>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<th>". $lang['fl_dest'] ."</th>";
$page .= "<th>[". $Galaxy .":". $System .":". $Planet ."]</th>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<th>". $lang['fl_time_go'] ."</th>";
$page .= "<th>". date("M D d H:i:s",($duration + time())) ."</th>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<th>". $lang['fl_time_back'] ."</th>";
$page .= "<th>". date("M D d H:i:s",(($duration * 2) + time())) ."</th>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$page .= "<td class=\"c\" colspan=\"2\">". $lang['fl_title'] ."</td>";
$page .= "</tr>";
$page .= "<tr height=\"20\">";
$ShipCount = 0;
$ShipArray = "";
foreach ($FleetArray as $Ship => $Count) {
$page .= "<th width=\"50%\>". $lang['tech'][$Ship] ."</th>";
$page .= "<th>". pretty_number($Count) ."</th>";
$FleetSubQRY .= "`".$resource[$Ship] . "` = `" . $resource[$Ship] . "` - " . $Count . " , ";
$ShipArray .= $Ship.",".$Count.";";
$ShipCount += $Count;
}
$page .= " </tr>";
$page .= " </table>";
$QryInsertFleet = "INSERT INTO {{table}} SET ";
$QryInsertFleet .= "`fleet_owner` = '". $user['id'] ."', ";
$QryInsertFleet .= "`fleet_mission` = '". $Mode ."', ";
$QryInsertFleet .= "`fleet_amount` = '". $ShipCount ."', ";
$QryInsertFleet .= "`fleet_array` = '". $ShipArray ."', ";
$QryInsertFleet .= "`fleet_start_time` = '". ($duration + time()) ."', ";
$QryInsertFleet .= "`fleet_start_galaxy` = '". $planetrow['galaxy'] ."', ";
$QryInsertFleet .= "`fleet_start_system` = '". $planetrow['system'] ."', ";
$QryInsertFleet .= "`fleet_start_planet` = '". $planetrow['planet'] ."', ";
$QryInsertFleet .= "`fleet_start_type` = '". $planetrow['planet_type'] ."', ";
$QryInsertFleet .= "`fleet_end_time` = '". (($duration * 2) + time()) ."', ";
$QryInsertFleet .= "`fleet_end_galaxy` = '". $Galaxy ."', ";
$QryInsertFleet .= "`fleet_end_system` = '". $System ."', ";
$QryInsertFleet .= "`fleet_end_planet` = '". $Planet ."', ";
$QryInsertFleet .= "`fleet_end_type` = '". $TypePl ."', ";
$QryInsertFleet .= "`start_time` = '". time() ."';";
doquery( $QryInsertFleet, 'fleets');
$QryUpdatePlanet = "UPDATE {{table}} SET ";
$QryUpdatePlanet .= $FleetSubQRY;
$QryUpdatePlanet .= "`planet_type` = '".$planetrow['planet_type']."' ";
$QryUpdatePlanet .= "WHERE ";
$QryUpdatePlanet .= "`id` = '". $planetrow['id'] ."'";
doquery ($QryUpdatePlanet, "planets");
display ( $page, "QuickFleet" );
// Updated by Chlorel Jan 22 2008 (all code just hold the table and the idea)
// Created by Perberos. All rights reversed (C) 2006
?><?php /* Powered by OGameCN www.ogamecn.com */ ?>