Passed
Branch trunk (7dc288)
by SuperNova.WS
06:07
created
fleet.php 1 patch
Switch Indentation   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -75,121 +75,121 @@  discard block
 block discarded – undo
75 75
 }
76 76
 
77 77
 switch ($fleet_page) {
78
-  case 3:
78
+    case 3:
79 79
 
80
-  case 2:
81
-    $fleet_group_mr = sys_get_param_id('fleet_group');
82
-    $fleetarray     = json_decode(base64_decode(str_rot13(sys_get_param('usedfleet'))), true);
83
-    $fleetarray = is_array($fleetarray) ? $fleetarray : array();
80
+    case 2:
81
+      $fleet_group_mr = sys_get_param_id('fleet_group');
82
+      $fleetarray     = json_decode(base64_decode(str_rot13(sys_get_param('usedfleet'))), true);
83
+      $fleetarray = is_array($fleetarray) ? $fleetarray : array();
84 84
 
85
-    foreach($fleetarray as $ship_id => &$ship_amount) {
86
-      if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) {
87
-        $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true));
88
-        die();
89
-      }
90
-      $ship_amount = floatval($ship_amount);
91
-    }
92
-
93
-    $UsedPlanet = false;
94
-    $YourPlanet = false;
95
-    $missiontype = array();
96
-    if ($planet > classSupernova::$config->game_maxPlanet) {
97
-      $target_mission = MT_EXPLORE;
98
-      $missiontype[MT_EXPLORE] = $lang['type_mission'][MT_EXPLORE];
99
-    } elseif ($galaxy && $system && $planet) {
100
-      $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET;
101
-
102
-      $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type);
103
-
104
-      if ($TargetPlanet['id_owner']) {
105
-        $UsedPlanet = true;
106
-        if ($TargetPlanet['id_owner'] == $user['id']) {
107
-          $YourPlanet = true;
85
+      foreach($fleetarray as $ship_id => &$ship_amount) {
86
+        if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) {
87
+          $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true));
88
+          die();
108 89
         }
90
+        $ship_amount = floatval($ship_amount);
109 91
       }
110 92
 
111
-      if (!$UsedPlanet) {
112
-        if ($fleetarray[SHIP_COLONIZER]) {
113
-          $missiontype[MT_COLONIZE] = $lang['type_mission'][MT_COLONIZE];
114
-          $target_mission = MT_COLONIZE;
115
-          $planet_type = PT_PLANET;
116
-        } else {
117
-          messageBox ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error']);
118
-        }
119
-      } else {
120
-        $recyclers = 0;
121
-        foreach(sn_get_groups('flt_recyclers') as $recycler_id) {
122
-          $recyclers += $fleetarray[$recycler_id];
93
+      $UsedPlanet = false;
94
+      $YourPlanet = false;
95
+      $missiontype = array();
96
+      if ($planet > classSupernova::$config->game_maxPlanet) {
97
+        $target_mission = MT_EXPLORE;
98
+        $missiontype[MT_EXPLORE] = $lang['type_mission'][MT_EXPLORE];
99
+      } elseif ($galaxy && $system && $planet) {
100
+        $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET;
101
+
102
+        $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type);
103
+
104
+        if ($TargetPlanet['id_owner']) {
105
+          $UsedPlanet = true;
106
+          if ($TargetPlanet['id_owner'] == $user['id']) {
107
+            $YourPlanet = true;
108
+          }
123 109
         }
124
-        if ($recyclers > 0 && $planet_type == PT_DEBRIS) {
125
-          $target_mission = MT_RECYCLE;
126
-          $missiontype[MT_RECYCLE] = $lang['type_mission'][MT_RECYCLE];
127
-        } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) {
128
-          if ($YourPlanet) {
129
-            $missiontype[MT_RELOCATE] = $lang['type_mission'][MT_RELOCATE];
130
-            $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT];
110
+
111
+        if (!$UsedPlanet) {
112
+          if ($fleetarray[SHIP_COLONIZER]) {
113
+            $missiontype[MT_COLONIZE] = $lang['type_mission'][MT_COLONIZE];
114
+            $target_mission = MT_COLONIZE;
115
+            $planet_type = PT_PLANET;
131 116
           } else {
132
-            // Not Your Planet
133
-            if ($fleetarray[SHIP_SPY]) {
134
-              // Only spy missions if any spy
135
-              $missiontype[MT_SPY] = $lang['type_mission'][MT_SPY];
117
+            messageBox ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error']);
118
+          }
119
+        } else {
120
+          $recyclers = 0;
121
+          foreach(sn_get_groups('flt_recyclers') as $recycler_id) {
122
+            $recyclers += $fleetarray[$recycler_id];
123
+          }
124
+          if ($recyclers > 0 && $planet_type == PT_DEBRIS) {
125
+            $target_mission = MT_RECYCLE;
126
+            $missiontype[MT_RECYCLE] = $lang['type_mission'][MT_RECYCLE];
127
+          } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) {
128
+            if ($YourPlanet) {
129
+              $missiontype[MT_RELOCATE] = $lang['type_mission'][MT_RELOCATE];
130
+              $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT];
136 131
             } else {
137
-              // If no spies...
138
-              if ($fleet_group_mr) {
139
-                $missiontype[MT_AKS] = $lang['type_mission'][MT_AKS];
132
+              // Not Your Planet
133
+              if ($fleetarray[SHIP_SPY]) {
134
+                // Only spy missions if any spy
135
+                $missiontype[MT_SPY] = $lang['type_mission'][MT_SPY];
140 136
               } else {
141
-                $missiontype[MT_ATTACK] = $lang['type_mission'][MT_ATTACK];
142
-                $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT];
143
-
144
-                $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD];
145
-
146
-                if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) {
147
-                  $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY];
137
+                // If no spies...
138
+                if ($fleet_group_mr) {
139
+                  $missiontype[MT_AKS] = $lang['type_mission'][MT_AKS];
140
+                } else {
141
+                  $missiontype[MT_ATTACK] = $lang['type_mission'][MT_ATTACK];
142
+                  $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT];
143
+
144
+                  $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD];
145
+
146
+                  if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) {
147
+                    $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY];
148
+                  }
148 149
                 }
149 150
               }
150 151
             }
151 152
           }
152 153
         }
153 154
       }
154
-    }
155
-
156
-    if (!$target_mission && is_array($missiontype)) {
157
-      $target_mission = MT_ATTACK;
158
-    }
159
-
160
-//    $sn_group_missions = sn_get_groups('missions');
161
-//    foreach($sn_group_missions as $mission_id => $cork) {
162
-//      $missiontype[$mission_id] = $lang['type_mission'][$mission_id];
163
-//    }
164
-//
165
-//
166
-    ksort($missiontype);
167
-
168
-    $speed_percent = sys_get_param_int('speed', 10);
169
-    $travel_data   = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent);
170
-
171
-//    $fleet_speed   = flt_fleet_speed($user, $fleetarray);
172
-    $fleet_speed   = $travel_data['fleet_speed'];
173
-    $distance      = $travel_data['distance'];
174
-    $duration      = $travel_data['duration'];
175
-    $consumption   = $travel_data['consumption'];
176
-  // No Break
177
-
178
-  case 1:
179
-    if ($galaxy && $system && $planet) {
180
-      $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET;
181
-
182
-      $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type);
183
-    }
184
-
185
-  case 0:
186
-    $template_result += array(
187
-      'thisgalaxy'      => $planetrow['galaxy'],
188
-      'thissystem'      => $planetrow['system'],
189
-      'thisplanet'      => $planetrow['planet'],
190
-      'thisplanet_type' => $planetrow['planet_type'],
191
-    );
192
-  // no break
155
+
156
+      if (!$target_mission && is_array($missiontype)) {
157
+        $target_mission = MT_ATTACK;
158
+      }
159
+
160
+  //    $sn_group_missions = sn_get_groups('missions');
161
+  //    foreach($sn_group_missions as $mission_id => $cork) {
162
+  //      $missiontype[$mission_id] = $lang['type_mission'][$mission_id];
163
+  //    }
164
+  //
165
+  //
166
+      ksort($missiontype);
167
+
168
+      $speed_percent = sys_get_param_int('speed', 10);
169
+      $travel_data   = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent);
170
+
171
+  //    $fleet_speed   = flt_fleet_speed($user, $fleetarray);
172
+      $fleet_speed   = $travel_data['fleet_speed'];
173
+      $distance      = $travel_data['distance'];
174
+      $duration      = $travel_data['duration'];
175
+      $consumption   = $travel_data['consumption'];
176
+    // No Break
177
+
178
+    case 1:
179
+      if ($galaxy && $system && $planet) {
180
+        $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET;
181
+
182
+        $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type);
183
+      }
184
+
185
+    case 0:
186
+      $template_result += array(
187
+        'thisgalaxy'      => $planetrow['galaxy'],
188
+        'thissystem'      => $planetrow['system'],
189
+        'thisplanet'      => $planetrow['planet'],
190
+        'thisplanet_type' => $planetrow['planet_type'],
191
+      );
192
+    // no break
193 193
 
194 194
 }
195 195
 
@@ -211,35 +211,35 @@  discard block
 block discarded – undo
211 211
 }
212 212
 
213 213
 switch($fleet_page) {
214
-  case 1:
215
-    require('includes/includes/flt_page1.inc');
216
-  break;
217
-
218
-  case 2:
219
-    require_once('includes/includes/flt_page2.inc');
220
-    sn_fleet_page2();
221
-  break;
222
-
223
-  case 3:
224
-    require_once('includes/includes/flt_page3.inc');
225
-    sn_fleet_page3();
226
-  break;
227
-
228
-  case 4:
229
-    require('includes/includes/flt_page4.inc');
230
-  break;
231
-
232
-  case 5:
233
-    $template = gettemplate('fleet5', true);
234
-    $pageFleet5Gathering = new \Deprecated\PageFleet5Gathering();
235
-    $pageFleet5Gathering->modelFleet5Gathering($user, $planetrow, $template);
236
-    // Building list of own planets & moons
237
-    $pageFleet5Gathering->viewPage5Gathering($user, $planetrow, $template);
238
-  break;
239
-
240
-  default:
241
-    define('SN_RENDER_NAVBAR_PLANET', true);
242
-
243
-    require('includes/includes/flt_page0.inc');
244
-  break;
214
+    case 1:
215
+      require('includes/includes/flt_page1.inc');
216
+    break;
217
+
218
+    case 2:
219
+      require_once('includes/includes/flt_page2.inc');
220
+      sn_fleet_page2();
221
+    break;
222
+
223
+    case 3:
224
+      require_once('includes/includes/flt_page3.inc');
225
+      sn_fleet_page3();
226
+    break;
227
+
228
+    case 4:
229
+      require('includes/includes/flt_page4.inc');
230
+    break;
231
+
232
+    case 5:
233
+      $template = gettemplate('fleet5', true);
234
+      $pageFleet5Gathering = new \Deprecated\PageFleet5Gathering();
235
+      $pageFleet5Gathering->modelFleet5Gathering($user, $planetrow, $template);
236
+      // Building list of own planets & moons
237
+      $pageFleet5Gathering->viewPage5Gathering($user, $planetrow, $template);
238
+    break;
239
+
240
+    default:
241
+      define('SN_RENDER_NAVBAR_PLANET', true);
242
+
243
+      require('includes/includes/flt_page0.inc');
244
+    break;
245 245
 }
Please login to merge, or discard this patch.