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