@@ -7,12 +7,12 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | $possible_cores = array(); |
| 9 | 9 | $probability = 0; |
| 10 | - foreach($density_list as $possible_core_id => $core_data) { |
|
| 11 | - if(!$core_data[UNIT_PLANET_DENSITY_RARITY]) { |
|
| 10 | + foreach ($density_list as $possible_core_id => $core_data) { |
|
| 11 | + if (!$core_data[UNIT_PLANET_DENSITY_RARITY]) { |
|
| 12 | 12 | continue; |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | - if( |
|
| 15 | + if ( |
|
| 16 | 16 | // Core type exists |
| 17 | 17 | in_array($possible_core_id, $position_data['core_types']) |
| 18 | 18 | // Limit core type with planet sector count |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | $random = mt_rand(1, $probability); |
| 35 | 35 | $selected_core = null; |
| 36 | - foreach($possible_cores as $core_type => $core_info) { |
|
| 37 | - if($random <= $core_info[UNIT_PLANET_DENSITY_RARITY]) { |
|
| 36 | + foreach ($possible_cores as $core_type => $core_info) { |
|
| 37 | + if ($random <= $core_info[UNIT_PLANET_DENSITY_RARITY]) { |
|
| 38 | 38 | $selected_core = $core_info; |
| 39 | 39 | break; |
| 40 | 40 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | $Position = intval($Position); |
| 61 | 61 | |
| 62 | - if(!isset($options['skip_check']) && DBStaticPlanet::db_planet_by_gspt($Galaxy, $System, $Position, PT_PLANET, true, '`id`')) { |
|
| 62 | + if (!isset($options['skip_check']) && DBStaticPlanet::db_planet_by_gspt($Galaxy, $System, $Position, PT_PLANET, true, '`id`')) { |
|
| 63 | 63 | return false; |
| 64 | 64 | } |
| 65 | 65 | |
@@ -68,11 +68,11 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | $planet_generator = sn_get_groups('planet_generator'); |
| 70 | 70 | |
| 71 | - if($HomeWorld) { |
|
| 71 | + if ($HomeWorld) { |
|
| 72 | 72 | $position_data = $planet_generator[0]; |
| 73 | 73 | } else { |
| 74 | 74 | $position_data = $planet_generator[$Position >= UNIVERSE_RANDOM_PLANET_START || $Position < 1 ? UNIVERSE_RANDOM_PLANET_START : $Position]; |
| 75 | - if($Position >= UNIVERSE_RANDOM_PLANET_START) { |
|
| 75 | + if ($Position >= UNIVERSE_RANDOM_PLANET_START) { |
|
| 76 | 76 | // Корректируем температуру для планеты-странника |
| 77 | 77 | $position_data['t_max_max'] -= UNIVERSE_RANDOM_PLANET_TEMPERATURE_DECREASE * ($Position - UNIVERSE_RANDOM_PLANET_START); |
| 78 | 78 | } |
@@ -172,15 +172,15 @@ discard block |
||
| 172 | 172 | $moon_name = ''; |
| 173 | 173 | $moon_row = array(); |
| 174 | 174 | $moon = DBStaticPlanet::db_planet_by_gspt($pos_galaxy, $pos_system, $pos_planet, PT_MOON, false, 'id'); |
| 175 | - if(!$moon['id']) { |
|
| 175 | + if (!$moon['id']) { |
|
| 176 | 176 | $moon_planet = DBStaticPlanet::db_planet_by_gspt($pos_galaxy, $pos_system, $pos_planet, PT_PLANET, true, '`id`, `temp_min`, `temp_max`, `name`, `debris_metal`, `debris_crystal`'); |
| 177 | 177 | |
| 178 | - if($moon_planet['id']) { |
|
| 178 | + if ($moon_planet['id']) { |
|
| 179 | 179 | $base_storage_size = BASE_STORAGE_SIZE; |
| 180 | 180 | |
| 181 | - if(!$moon_chance) { |
|
| 181 | + if (!$moon_chance) { |
|
| 182 | 182 | $size = mt_rand(1100, 8999); |
| 183 | - } elseif($moon_chance <= 100) { |
|
| 183 | + } elseif ($moon_chance <= 100) { |
|
| 184 | 184 | $size = mt_rand($moon_chance * 100 + 1000, $moon_chance * 200 + 2999); |
| 185 | 185 | } else { |
| 186 | 186 | $size = $moon_chance; |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | $field_max = ceil($size / 1000); |
| 198 | 198 | |
| 199 | - if(isset($options['image']) && $options['image']) { |
|
| 199 | + if (isset($options['image']) && $options['image']) { |
|
| 200 | 200 | $moon_image = $options['image']; |
| 201 | 201 | } else { |
| 202 | 202 | $moon_image = 'mond'; |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | `deuterium` = '0', `deuterium_perhour` = '0', `deuterium_max` = '{$base_storage_size}'" |
| 212 | 212 | ); |
| 213 | 213 | |
| 214 | - if($update_debris) { |
|
| 214 | + if ($update_debris) { |
|
| 215 | 215 | $debris_spent = $moon_chance * 1000000; |
| 216 | 216 | $metal_spent = round(min($moon_planet['debris_metal'], $debris_spent * mt_rand(50, 75) / 100)); |
| 217 | 217 | $crystal_spent = min($moon_planet['debris_crystal'], $debris_spent - $metal_spent); |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | $planet_row['id'] = $user['current_planet']; |
| 248 | 248 | |
| 249 | 249 | // Пытаемся переключить на новую планету |
| 250 | - if(($selected_planet = sys_get_param_id('cp')) && $selected_planet != $user['current_planet']) |
|
| 250 | + if (($selected_planet = sys_get_param_id('cp')) && $selected_planet != $user['current_planet']) |
|
| 251 | 251 | { |
| 252 | 252 | $planet_row = DBStaticPlanet::db_planet_by_id_and_owner($selected_planet, $user['id'], false, 'id'); |
| 253 | 253 | } |
@@ -257,15 +257,15 @@ discard block |
||
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | // Если новая планета не найдена или было переключения - проверяем текущую выбранную планету |
| 260 | - if(!isset($planet_row['id'])) // || $planet_row['id'] != $user['current_planet'] |
|
| 260 | + if (!isset($planet_row['id'])) // || $planet_row['id'] != $user['current_planet'] |
|
| 261 | 261 | { |
| 262 | 262 | $planet_row = DBStaticPlanet::db_planet_by_id_and_owner($user['current_planet'], $user['id'], false, 'id'); |
| 263 | 263 | // Если текущей планеты не существует - выставляем Столицу |
| 264 | - if(!isset($planet_row['id'])) |
|
| 264 | + if (!isset($planet_row['id'])) |
|
| 265 | 265 | { |
| 266 | 266 | $planet_row = DBStaticPlanet::db_planet_by_id_and_owner($user['id_planet'], $user['id'], false, 'id'); |
| 267 | 267 | // Если и столицы не существует - значит что-то очень не так с записью пользователя |
| 268 | - if(!isset($planet_row['id'])) |
|
| 268 | + if (!isset($planet_row['id'])) |
|
| 269 | 269 | { |
| 270 | 270 | global $debug; |
| 271 | 271 | $debug->error("User ID {$user['id']} has Capital planet {$user['id_planet']} but this planet does not exists", 'User record error', 502); |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | // Если производилось переключение планеты - делаем запись в юзере |
| 277 | - if($user['current_planet'] != $planet_row['id']) |
|
| 277 | + if ($user['current_planet'] != $planet_row['id']) |
|
| 278 | 278 | { |
| 279 | 279 | db_user_set_by_id($user['id'], "`current_planet` = '{$planet_row['id']}'"); |
| 280 | 280 | $user['current_planet'] = $planet_row['id']; |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | { |
| 299 | 299 | global $lang; |
| 300 | 300 | |
| 301 | - if(!$from['id']) |
|
| 301 | + if (!$from['id']) |
|
| 302 | 302 | { |
| 303 | 303 | $result = $lang['sys_planet_expedition']; |
| 304 | 304 | } |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | function uni_calculate_moon_chance($FleetDebris) |
| 338 | 338 | { |
| 339 | 339 | $MoonChance = $FleetDebris / 1000000; |
| 340 | - return ($MoonChance < 1) ? 0 : ($MoonChance>30 ? 30 : $MoonChance); |
|
| 340 | + return ($MoonChance < 1) ? 0 : ($MoonChance > 30 ? 30 : $MoonChance); |
|
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | function uni_coordinates_valid($coordinates, $prefix = '') |
@@ -359,11 +359,11 @@ discard block |
||
| 359 | 359 | global $lang, $config; |
| 360 | 360 | |
| 361 | 361 | try { |
| 362 | - if($planetrow['planet_teleport_next'] && $planetrow['planet_teleport_next'] > SN_TIME_NOW) { |
|
| 362 | + if ($planetrow['planet_teleport_next'] && $planetrow['planet_teleport_next'] > SN_TIME_NOW) { |
|
| 363 | 363 | throw new exception($lang['ov_teleport_err_cooldown'], ERR_ERROR); |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | - if(mrc_get_level($user, false, RES_DARK_MATTER) < $config->planet_teleport_cost) { |
|
| 366 | + if (mrc_get_level($user, false, RES_DARK_MATTER) < $config->planet_teleport_cost) { |
|
| 367 | 367 | throw new exception($lang['ov_teleport_err_no_dark_matter'], ERR_ERROR); |
| 368 | 368 | } |
| 369 | 369 | |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | // if(!empty($incoming['incoming'])) { |
| 376 | 376 | // throw new exception($lang['ov_teleport_err_fleet'], ERR_ERROR); |
| 377 | 377 | // } |
| 378 | - if(fleet_count_incoming($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'])) { |
|
| 378 | + if (fleet_count_incoming($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'])) { |
|
| 379 | 379 | throw new exception($lang['ov_teleport_err_fleet'], ERR_ERROR); |
| 380 | 380 | } |
| 381 | 381 | |
@@ -384,10 +384,10 @@ discard block |
||
| 384 | 384 | // throw new exception($lang['ov_teleport_err_fleet'], ERR_ERROR); |
| 385 | 385 | //} |
| 386 | 386 | |
| 387 | - if(is_array($new_coordinates)) { |
|
| 387 | + if (is_array($new_coordinates)) { |
|
| 388 | 388 | $new_coordinates['planet_type'] = PT_PLANET; |
| 389 | 389 | $incoming = DBStaticPlanet::db_planet_by_vector($new_coordinates, '', true, 'id'); |
| 390 | - if($incoming['id']) { |
|
| 390 | + if ($incoming['id']) { |
|
| 391 | 391 | throw new exception($lang['ov_teleport_err_destination_busy'], ERR_ERROR); |
| 392 | 392 | } |
| 393 | 393 | } |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | 'result' => ERR_NONE, |
| 397 | 397 | 'message' => '', |
| 398 | 398 | ); |
| 399 | - } catch(exception $e) { |
|
| 399 | + } catch (exception $e) { |
|
| 400 | 400 | $response = array( |
| 401 | 401 | 'result' => $e->getCode(), |
| 402 | 402 | 'message' => $e->getMessage(), |
@@ -15,11 +15,11 @@ discard block |
||
| 15 | 15 | array('query' => 'DELETE FROM {{aks}} WHERE `id` NOT IN (SELECT DISTINCT `fleet_group` FROM {{fleets}});', 'result' => false, 'error' => '', 'affected_rows' => 0), |
| 16 | 16 | ); |
| 17 | 17 | |
| 18 | - foreach($queries as &$query) |
|
| 18 | + foreach ($queries as &$query) |
|
| 19 | 19 | { |
| 20 | 20 | $query['result'] = doquery($query['query']); |
| 21 | 21 | $query['error'] = classSupernova::$db->db_error(); |
| 22 | - $query['affected_rows'] = classSupernova::$db->db_affected_rows(); |
|
| 22 | + $query['affected_rows'] = classSupernova::$db->db_affected_rows(); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | return $queries; |
@@ -51,30 +51,30 @@ discard block |
||
| 51 | 51 | $recorded_run = strtotime($recorded_run); |
| 52 | 52 | |
| 53 | 53 | $prev_run_array = getdate($recorded_run); |
| 54 | - $prev_run_array = array($prev_run_array['seconds'],$prev_run_array['minutes'],$prev_run_array['hours'],$prev_run_array['mday'],$prev_run_array['mon'],$prev_run_array['year']); |
|
| 54 | + $prev_run_array = array($prev_run_array['seconds'], $prev_run_array['minutes'], $prev_run_array['hours'], $prev_run_array['mday'], $prev_run_array['mon'], $prev_run_array['year']); |
|
| 55 | 55 | $today_array = getdate(SN_TIME_NOW); |
| 56 | - $today_array = array($today_array['seconds'],$today_array['minutes'],$today_array['hours'],$today_array['mday'],$today_array['mon'],$today_array['year']); |
|
| 56 | + $today_array = array($today_array['seconds'], $today_array['minutes'], $today_array['hours'], $today_array['mday'], $today_array['mon'], $today_array['year']); |
|
| 57 | 57 | $scheduleList = explode(',', $scheduleList); |
| 58 | 58 | array_walk($scheduleList, function(&$schedule) use ($prev_run_array, $today_array, $date_part_names_reverse, &$possible_schedules) { |
| 59 | 59 | $schedule = array('schedule_array' => array_reverse(explode(':', trim($schedule)))); |
| 60 | 60 | |
| 61 | 61 | $interval = $date_part_names_reverse[count($schedule['schedule_array'])]; |
| 62 | 62 | |
| 63 | - foreach($prev_run_array as $index => $date_part) { |
|
| 63 | + foreach ($prev_run_array as $index => $date_part) { |
|
| 64 | 64 | $schedule['array']['recorded'][$index] = isset($schedule['schedule_array'][$index]) ? intval($schedule['schedule_array'][$index]) : $date_part; |
| 65 | 65 | $schedule['array']['now'][$index] = isset($schedule['schedule_array'][$index]) ? intval($schedule['schedule_array'][$index]) : $today_array[$index]; |
| 66 | 66 | } |
| 67 | - if($schedule['array']['recorded'] == $schedule['array']['now']) { |
|
| 67 | + if ($schedule['array']['recorded'] == $schedule['array']['now']) { |
|
| 68 | 68 | unset($schedule['array']['now']); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - foreach($schedule['array'] as $name => $array) { |
|
| 71 | + foreach ($schedule['array'] as $name => $array) { |
|
| 72 | 72 | $schedule['string'][$name] = "{$array[5]}-{$array[4]}-{$array[3]} {$array[2]}:{$array[1]}:{$array[0]}"; |
| 73 | 73 | $schedule['string'][$name . '_next'] = $schedule['string'][$name] . ' +1 ' . $interval; |
| 74 | 74 | $schedule['string'][$name . '_prev'] = $schedule['string'][$name] . ' -1 ' . $interval; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - foreach($schedule['string'] as $string) { |
|
| 77 | + foreach ($schedule['string'] as $string) { |
|
| 78 | 78 | $timestamp = strtotime($string); |
| 79 | 79 | $schedule['timestamp'][$timestamp] = $possible_schedules[$timestamp] = date(FMT_DATE_TIME_SQL, strtotime($string)); |
| 80 | 80 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | $prev_run = 0; |
| 86 | 86 | $next_run = 0; |
| 87 | - foreach($possible_schedules as $timestamp => $string_date) { |
|
| 87 | + foreach ($possible_schedules as $timestamp => $string_date) { |
|
| 88 | 88 | $prev_run = SN_TIME_NOW >= $timestamp ? $timestamp : $prev_run; |
| 89 | 89 | $next_run = SN_TIME_NOW < $timestamp && !$next_run ? $timestamp : $next_run; |
| 90 | 90 | } |
@@ -14,13 +14,13 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | $no_data = array('user' => false, 'planet' => false, 'que' => false); |
| 16 | 16 | |
| 17 | - if(!$planet) { |
|
| 17 | + if (!$planet) { |
|
| 18 | 18 | return $no_data; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - if(!$no_user_update) { |
|
| 21 | + if (!$no_user_update) { |
|
| 22 | 22 | $user = intval(is_array($user) && $user['id'] ? $user['id'] : $user); |
| 23 | - if(!$user) { |
|
| 23 | + if (!$user) { |
|
| 24 | 24 | // TODO - Убрать позже |
| 25 | 25 | print('<h1>СООБЩИТЕ ЭТО АДМИНУ: sys_o_get_updated() - USER пустой!</h1>'); |
| 26 | 26 | $backtrace = debug_backtrace(); |
@@ -32,17 +32,17 @@ discard block |
||
| 32 | 32 | $user = db_user_by_id($user, !$simulation, '*', true); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - if(empty($user['id'])) { |
|
| 35 | + if (empty($user['id'])) { |
|
| 36 | 36 | return $no_data; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - if(is_array($planet) && isset($planet['galaxy']) && $planet['galaxy']) { |
|
| 39 | + if (is_array($planet) && isset($planet['galaxy']) && $planet['galaxy']) { |
|
| 40 | 40 | $planet = DBStaticPlanet::db_planet_by_vector($planet, '', !$simulation); |
| 41 | 41 | } else { |
| 42 | 42 | $planet = intval(is_array($planet) && isset($planet['id']) ? $planet['id'] : $planet); |
| 43 | 43 | $planet = DBStaticPlanet::db_planet_by_id($planet, !$simulation); |
| 44 | 44 | } |
| 45 | - if(!is_array($planet) || !isset($planet['id'])) { |
|
| 45 | + if (!is_array($planet) || !isset($planet['id'])) { |
|
| 46 | 46 | return $no_data; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -65,15 +65,15 @@ discard block |
||
| 65 | 65 | RES_DEUTERIUM => 0, |
| 66 | 66 | ); |
| 67 | 67 | |
| 68 | - switch($planet['planet_type']) { |
|
| 68 | + switch ($planet['planet_type']) { |
|
| 69 | 69 | case PT_PLANET: |
| 70 | - foreach($resources_increase as $resource_id => &$increment) { |
|
| 70 | + foreach ($resources_increase as $resource_id => &$increment) { |
|
| 71 | 71 | $resource_name = pname_resource_name($resource_id); |
| 72 | 72 | $increment = $caps_real['total'][$resource_id] * $ProductionTime / 3600; |
| 73 | 73 | $store_free = $caps_real['total_storage'][$resource_id] - $planet[$resource_name]; |
| 74 | 74 | $increment = min($increment, max(0, $store_free)); |
| 75 | 75 | |
| 76 | - if($planet[$resource_name] + $increment < 0 && !$simulation) { |
|
| 76 | + if ($planet[$resource_name] + $increment < 0 && !$simulation) { |
|
| 77 | 77 | global $debug; |
| 78 | 78 | $debug->warning("Player ID {$user['id']} have negative resources on ID {$planet['id']}.{$planet['planet_type']} [{$planet['galaxy']}:{$planet['system']}:{$planet['planet']}]. Difference {$planet[$resource_name]} of {$resource_name}", 'Negative Resources', 501); |
| 79 | 79 | } |
@@ -95,13 +95,13 @@ discard block |
||
| 95 | 95 | // TODO пересчитывать размер планеты только при постройке чего-нибудь и при покупке сектора |
| 96 | 96 | $planet['field_current'] = 0; |
| 97 | 97 | $sn_group_build_allow = sn_get_groups('build_allow'); |
| 98 | - if(is_array($sn_group_build_allow[$planet['planet_type']])) { |
|
| 99 | - foreach($sn_group_build_allow[$planet['planet_type']] as $building_id) { |
|
| 98 | + if (is_array($sn_group_build_allow[$planet['planet_type']])) { |
|
| 99 | + foreach ($sn_group_build_allow[$planet['planet_type']] as $building_id) { |
|
| 100 | 100 | $planet['field_current'] += mrc_get_level($user, $planet, $building_id, !$simulation, true); |
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - if($simulation) { |
|
| 104 | + if ($simulation) { |
|
| 105 | 105 | return array('user' => $user, 'planet' => $planet, 'que' => $que); |
| 106 | 106 | } |
| 107 | 107 | |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | function flt_mission_hold(&$mission_data) |
| 4 | 4 | { |
| 5 | - if($mission_data['fleet']['fleet_end_stay'] < SN_TIME_NOW) |
|
| 5 | + if ($mission_data['fleet']['fleet_end_stay'] < SN_TIME_NOW) |
|
| 6 | 6 | { |
| 7 | 7 | fleet_send_back($mission_data['fleet']); |
| 8 | 8 | // doquery("UPDATE {{fleets}} SET `fleet_mess` = 1 WHERE `fleet_id` = '{$fleet_row['fleet_id']}' LIMIT 1;"); |
@@ -12,9 +12,9 @@ discard block |
||
| 12 | 12 | // ---------------------------------------------------------------------------------------------------------------- |
| 13 | 13 | function coe_compress_add_units($unit_group, $target_planet, &$compress_data, $target_user = array()) |
| 14 | 14 | { |
| 15 | - foreach($unit_group as $unit_id) |
|
| 15 | + foreach ($unit_group as $unit_id) |
|
| 16 | 16 | { |
| 17 | - if(($unit_count = mrc_get_level($target_user, $target_planet, $unit_id, false, true)) > 0) |
|
| 17 | + if (($unit_count = mrc_get_level($target_user, $target_planet, $unit_id, false, true)) > 0) |
|
| 18 | 18 | { |
| 19 | 19 | $compress_data[$unit_id] = $unit_count; |
| 20 | 20 | } |
@@ -34,9 +34,9 @@ discard block |
||
| 34 | 34 | global $lang; |
| 35 | 35 | |
| 36 | 36 | $result = "<tr><td class=\"c\" colspan=\"4\">{$section_title}</td></tr>"; |
| 37 | - foreach(sn_get_groups($group_name) as $unit_id) |
|
| 37 | + foreach (sn_get_groups($group_name) as $unit_id) |
|
| 38 | 38 | { |
| 39 | - if(($unit_amount = mrc_get_level($target_user, $target_planet, $unit_id, false, true)) > 0) |
|
| 39 | + if (($unit_amount = mrc_get_level($target_user, $target_planet, $unit_id, false, true)) > 0) |
|
| 40 | 40 | { |
| 41 | 41 | $result .= "<tr><td align=\"left\" colspan=\"3\">{$lang['tech'][$unit_id]}</td><td align=\"right\">{$unit_amount}</td></tr>"; |
| 42 | 42 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $spying_user_row = &$mission_data['src_user']; |
| 64 | 64 | $spying_planet_row = &$mission_data['src_planet']; |
| 65 | 65 | |
| 66 | - if(!isset($target_user_row['id']) || !isset($target_planet_row['id']) || !isset($spying_user_row['id'])) |
|
| 66 | + if (!isset($target_user_row['id']) || !isset($target_planet_row['id']) || !isset($spying_user_row['id'])) |
|
| 67 | 67 | { |
| 68 | 68 | // doquery("UPDATE {{fleets}} SET `fleet_mess` = 1 WHERE `fleet_id` = {$fleet_row['fleet_id']} LIMIT 1;"); |
| 69 | 69 | fleet_send_back($fleet_row); |
@@ -71,14 +71,14 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | $fleet_array = sys_unit_str2arr($fleet_row['fleet_array']); |
| 74 | - if($fleet_array[SHIP_SPY] > 0) |
|
| 74 | + if ($fleet_array[SHIP_SPY] > 0) |
|
| 75 | 75 | { |
| 76 | 76 | $TargetSpyLvl = GetSpyLevel($target_user_row); |
| 77 | 77 | $CurrentSpyLvl = GetSpyLevel($spying_user_row); |
| 78 | 78 | $spy_diff_empire = $CurrentSpyLvl - $TargetSpyLvl; |
| 79 | 79 | |
| 80 | 80 | $spy_probes = $fleet_array[SHIP_SPY]; |
| 81 | - $spy_diff = $spy_diff_empire + sqrt($spy_probes) - 1 ; |
|
| 81 | + $spy_diff = $spy_diff_empire + sqrt($spy_probes) - 1; |
|
| 82 | 82 | |
| 83 | 83 | $combat_pack[0] = array( |
| 84 | 84 | RES_METAL => $target_planet_row['metal'], |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $spy_message .= "<td width=220>{$lang['sys_metal']}</td><td width=220 align=right>" . pretty_number($target_planet_row['metal']) . "</td>"; |
| 95 | 95 | $spy_message .= "<td width=220>{$lang['sys_crystal']}</td></td><td width=220 align=right>" . pretty_number($target_planet_row['crystal']) . "</td>"; |
| 96 | 96 | $spy_message .= "</tr><tr>"; |
| 97 | - $spy_message .= "<td width=220>{$lang['sys_deuterium']}</td><td width=220 align=right>" . pretty_number($target_planet_row['deuterium']) . "</td>"; |
|
| 97 | + $spy_message .= "<td width=220>{$lang['sys_deuterium']}</td><td width=220 align=right>" . pretty_number($target_planet_row['deuterium']) . "</td>"; |
|
| 98 | 98 | $spy_message .= "<td width=220>{$lang['sys_energy']}</td><td width=220 align=right>" . pretty_number($target_planet_row['energy_max']) . "</td>"; |
| 99 | 99 | $spy_message .= "</tr>"; |
| 100 | 100 | if ($spy_diff >= 2) |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $spy_message .= "<div class='spy_long'>" . flt_spy_scan($target_planet_row, 'structures', $lang['tech'][UNIT_STRUCTURES], $target_user_row) . "</div>"; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - if($spy_diff_empire >= 0) |
|
| 114 | + if ($spy_diff_empire >= 0) |
|
| 115 | 115 | { |
| 116 | 116 | $spy_message .= "<div class='spy_long'>" . flt_spy_scan($target_planet_row, 'tech', $lang['tech'][UNIT_TECHNOLOGIES], $target_user_row) . "</div>"; |
| 117 | 117 | coe_compress_add_units(array(TECH_WEAPON, TECH_SHIELD, TECH_ARMOR), $target_planet_row, $combat_pack[0], $target_user_row); |
@@ -121,14 +121,14 @@ discard block |
||
| 121 | 121 | $simulator_link = sn_ube_simulator_encode_replay($combat_pack, 'D'); |
| 122 | 122 | |
| 123 | 123 | $target_unit_list = 0; |
| 124 | - foreach(sn_get_groups('fleet') as $unit_id) |
|
| 124 | + foreach (sn_get_groups('fleet') as $unit_id) |
|
| 125 | 125 | { |
| 126 | 126 | $target_unit_list += max(0, mrc_get_level($target_user_row, $target_planet_row, $unit_id, false, true)); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | $spy_detected = $spy_probes * $target_unit_list / 4 * pow(2, $TargetSpyLvl - $CurrentSpyLvl); |
| 130 | 130 | |
| 131 | - if(mt_rand(0, 99) > $spy_detected) |
|
| 131 | + if (mt_rand(0, 99) > $spy_detected) |
|
| 132 | 132 | { |
| 133 | 133 | $spy_outcome_str = sprintf($lang['sys_mess_spy_detect_chance'], $spy_detected); |
| 134 | 134 | $spy_detected = false; |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | $target_user_id = $fleet_row['fleet_target_owner']; |
| 155 | 155 | |
| 156 | - if($spy_detected) |
|
| 156 | + if ($spy_detected) |
|
| 157 | 157 | { |
| 158 | 158 | // doquery("DELETE FROM {{fleets}} WHERE `fleet_id` = '{$fleet_row['fleet_id']}' LIMIT 1;"); |
| 159 | 159 | db_fleet_delete($fleet_row['fleet_id']); |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | $spy_cost = get_unit_param(SHIP_SPY, P_COST); |
| 164 | 164 | |
| 165 | 165 | DBStaticPlanet::db_planet_set_by_id($debris_planet_id, |
| 166 | - "`debris_metal` = `debris_metal` + ". floor($spy_probes * $spy_cost[RES_METAL] * 0.3) .", `debris_crystal` = `debris_crystal` + ". floor($spy_probes * $spy_cost[RES_CRYSTAL] * 0.3)); |
|
| 166 | + "`debris_metal` = `debris_metal` + " . floor($spy_probes * $spy_cost[RES_METAL] * 0.3) . ", `debris_crystal` = `debris_crystal` + " . floor($spy_probes * $spy_cost[RES_CRYSTAL] * 0.3)); |
|
| 167 | 167 | |
| 168 | 168 | $target_message .= "<br />{$lang['sys_mess_spy_destroyed_enemy']}"; |
| 169 | 169 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | msg_send_simple_message($target_user_id, '', $fleet_row['fleet_start_time'], MSG_TYPE_SPY, $lang['sys_mess_spy_control'], $lang['sys_mess_spy_activity'], $target_message); |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - if(!$spy_detected) |
|
| 179 | + if (!$spy_detected) |
|
| 180 | 180 | { |
| 181 | 181 | // doquery("UPDATE {{fleets}} SET `fleet_mess` = '1' WHERE `fleet_id` = '{$fleet_row['fleet_id']}' LIMIT 1;"); |
| 182 | 182 | fleet_send_back($fleet_row); |
@@ -12,12 +12,12 @@ discard block |
||
| 12 | 12 | $fleet_row = &$mission_data['fleet']; |
| 13 | 13 | $destination_planet = &$mission_data['dst_planet']; |
| 14 | 14 | |
| 15 | - if(!$fleet_row) |
|
| 15 | + if (!$fleet_row) |
|
| 16 | 16 | { |
| 17 | 17 | return CACHE_NOTHING; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - if(!isset($destination_planet['id'])) |
|
| 20 | + if (!isset($destination_planet['id'])) |
|
| 21 | 21 | { |
| 22 | 22 | // doquery("UPDATE {{fleets}} SET `fleet_mess` = 1 WHERE `fleet_id` = {$fleet_row['fleet_id']} LIMIT 1;"); |
| 23 | 23 | fleet_send_back($mission_data['fleet']); |
@@ -29,12 +29,12 @@ discard block |
||
| 29 | 29 | $RecyclerCapacity = 0; |
| 30 | 30 | $OtherFleetCapacity = 0; |
| 31 | 31 | $fleet_array = sys_unit_str2arr($fleet_row['fleet_array']); |
| 32 | - foreach($fleet_array as $unit_id => $unit_count) |
|
| 32 | + foreach ($fleet_array as $unit_id => $unit_count) |
|
| 33 | 33 | { |
| 34 | - if(in_array($unit_id, sn_get_groups('fleet'))) |
|
| 34 | + if (in_array($unit_id, sn_get_groups('fleet'))) |
|
| 35 | 35 | { |
| 36 | 36 | $capacity = get_unit_param($unit_id, P_CAPACITY) * $unit_count; |
| 37 | - if(in_array($unit_id, sn_get_groups('flt_recyclers'))) |
|
| 37 | + if (in_array($unit_id, sn_get_groups('flt_recyclers'))) |
|
| 38 | 38 | { |
| 39 | 39 | $RecyclerCapacity += $capacity; |
| 40 | 40 | } |
@@ -46,19 +46,19 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | $IncomingFleetGoods = $fleet_row["fleet_resource_metal"] + $fleet_row["fleet_resource_crystal"] + $fleet_row["fleet_resource_deuterium"]; |
| 49 | - if($IncomingFleetGoods > $OtherFleetCapacity) |
|
| 49 | + if ($IncomingFleetGoods > $OtherFleetCapacity) |
|
| 50 | 50 | { |
| 51 | 51 | $RecyclerCapacity -= ($IncomingFleetGoods - $OtherFleetCapacity); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - if(($destination_planet["debris_metal"] + $destination_planet["debris_crystal"]) <= $RecyclerCapacity) |
|
| 54 | + if (($destination_planet["debris_metal"] + $destination_planet["debris_crystal"]) <= $RecyclerCapacity) |
|
| 55 | 55 | { |
| 56 | 56 | $RecycledGoods["metal"] = $destination_planet["debris_metal"]; |
| 57 | 57 | $RecycledGoods["crystal"] = $destination_planet["debris_crystal"]; |
| 58 | 58 | } |
| 59 | 59 | else |
| 60 | 60 | { |
| 61 | - if (($destination_planet["debris_metal"] > $RecyclerCapacity / 2) AND |
|
| 61 | + if (($destination_planet["debris_metal"] > $RecyclerCapacity / 2) AND |
|
| 62 | 62 | ($destination_planet["debris_crystal"] > $RecyclerCapacity / 2)) |
| 63 | 63 | { |
| 64 | 64 | $RecycledGoods["metal"] = $RecyclerCapacity / 2; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | - $NewCargo['Metal'] = $fleet_row["fleet_resource_metal"] + $RecycledGoods["metal"]; |
|
| 95 | + $NewCargo['Metal'] = $fleet_row["fleet_resource_metal"] + $RecycledGoods["metal"]; |
|
| 96 | 96 | $NewCargo['Crystal'] = $fleet_row["fleet_resource_crystal"] + $RecycledGoods["crystal"]; |
| 97 | 97 | $NewCargo['Deuterium'] = $fleet_row["fleet_resource_deuterium"]; |
| 98 | 98 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | ); |
| 102 | 102 | |
| 103 | 103 | $Message = sprintf($lang['sys_recy_gotten'], pretty_number($RecycledGoods["metal"]), $lang['Metal'], pretty_number($RecycledGoods["crystal"]), $lang['Crystal']); |
| 104 | - msg_send_simple_message ( $fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_RECYCLE, $lang['sys_mess_spy_control'], $lang['sys_recy_report'], $Message); |
|
| 104 | + msg_send_simple_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_RECYCLE, $lang['sys_mess_spy_control'], $lang['sys_recy_report'], $Message); |
|
| 105 | 105 | |
| 106 | 106 | // $QryUpdateFleet = "UPDATE {{fleets}} SET `fleet_mess` = 1,`fleet_resource_metal` = '{$NewCargo['Metal']}',`fleet_resource_crystal` = '{$NewCargo['Crystal']}',`fleet_resource_deuterium` = '{$NewCargo['Deuterium']}' "; |
| 107 | 107 | // $QryUpdateFleet .= "WHERE `fleet_id` = '{$fleet_row['fleet_id']}' LIMIT 1;"; |
@@ -14,11 +14,11 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | $fleet_left = 1 - mt_rand(1, 3) * mt_rand(200000, 300000) / 1000000; |
| 16 | 16 | $fleet_lost = array(); |
| 17 | - foreach($fleet as $unit_id => &$unit_amount) { |
|
| 17 | + foreach ($fleet as $unit_id => &$unit_amount) { |
|
| 18 | 18 | $ships_left = floor($unit_amount * $fleet_left); |
| 19 | 19 | $fleet_lost[$unit_id] = $unit_amount - $ships_left; |
| 20 | 20 | $unit_amount = $ships_left; |
| 21 | - if(!$unit_amount) { |
|
| 21 | + if (!$unit_amount) { |
|
| 22 | 22 | unset($fleet[$unit_id]); |
| 23 | 23 | } |
| 24 | 24 | } |
@@ -31,14 +31,14 @@ discard block |
||
| 31 | 31 | // $fleet = array(); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | -function flt_mission_explore_addon(&$result){return sn_function_call('flt_mission_explore_addon', array(&$result));} |
|
| 34 | +function flt_mission_explore_addon(&$result) {return sn_function_call('flt_mission_explore_addon', array(&$result)); } |
|
| 35 | 35 | function sn_flt_mission_explore_addon(&$result) { |
| 36 | 36 | return $result; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | function flt_mission_explore(&$mission_data) { |
| 41 | - if(!isset($mission_data['fleet_event']) || $mission_data['fleet_event'] != EVENT_FLT_ACOMPLISH) { |
|
| 41 | + if (!isset($mission_data['fleet_event']) || $mission_data['fleet_event'] != EVENT_FLT_ACOMPLISH) { |
|
| 42 | 42 | return CACHE_NONE; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -71,10 +71,10 @@ discard block |
||
| 71 | 71 | $outcome_list = &$result['$outcome_list']; |
| 72 | 72 | $fleet_metal_points = &$result['$fleet_metal_points']; |
| 73 | 73 | |
| 74 | - if(!$ship_data) { |
|
| 75 | - foreach(sn_get_groups('fleet') as $unit_id) { |
|
| 74 | + if (!$ship_data) { |
|
| 75 | + foreach (sn_get_groups('fleet') as $unit_id) { |
|
| 76 | 76 | $unit_info = get_unit_param($unit_id); |
| 77 | - if($unit_info[P_UNIT_TYPE] != UNIT_SHIPS || !isset($unit_info['engine'][0]['speed']) || !$unit_info['engine'][0]['speed']) { |
|
| 77 | + if ($unit_info[P_UNIT_TYPE] != UNIT_SHIPS || !isset($unit_info['engine'][0]['speed']) || !$unit_info['engine'][0]['speed']) { |
|
| 78 | 78 | continue; |
| 79 | 79 | } |
| 80 | 80 | $ship_data[$unit_id][P_COST_METAL] = get_unit_cost_in($unit_info[P_COST]); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | $fleet = sys_unit_str2arr($fleet_row['fleet_array']); |
| 87 | 87 | $fleet_capacity = 0; |
| 88 | 88 | $fleet_metal_points = 0; |
| 89 | - foreach($fleet as $ship_id => $ship_amount) { |
|
| 89 | + foreach ($fleet as $ship_id => $ship_amount) { |
|
| 90 | 90 | $unit_info = get_unit_param($ship_id); |
| 91 | 91 | $fleet_capacity += $ship_amount * $unit_info[P_CAPACITY]; |
| 92 | 92 | $fleet_metal_points += $ship_amount * $ship_data[$ship_id][P_COST_METAL]; |
@@ -96,11 +96,11 @@ discard block |
||
| 96 | 96 | $flt_stay_hours = ($fleet_row['fleet_end_stay'] - $fleet_row['fleet_start_time']) / 3600 * ($config->game_speed_expedition ? $config->game_speed_expedition : 1); |
| 97 | 97 | |
| 98 | 98 | $outcome_list = sn_get_groups('mission_explore_outcome_list'); |
| 99 | - $outcome_list[FLT_EXPEDITION_OUTCOME_NONE]['chance'] = ceil(200 / pow($flt_stay_hours, 1/1.7)); |
|
| 99 | + $outcome_list[FLT_EXPEDITION_OUTCOME_NONE]['chance'] = ceil(200 / pow($flt_stay_hours, 1 / 1.7)); |
|
| 100 | 100 | |
| 101 | 101 | $chance_max = 0; |
| 102 | - foreach($outcome_list as $key => &$value) { |
|
| 103 | - if(!$value['chance']) { |
|
| 102 | + foreach ($outcome_list as $key => &$value) { |
|
| 103 | + if (!$value['chance']) { |
|
| 104 | 104 | unset($outcome_list[$key]); |
| 105 | 105 | continue; |
| 106 | 106 | } |
@@ -109,13 +109,13 @@ discard block |
||
| 109 | 109 | $outcome_value = mt_rand(0, $chance_max); |
| 110 | 110 | // $outcome_value = 409; |
| 111 | 111 | $outcome_description = &$outcome_list[$mission_outcome = FLT_EXPEDITION_OUTCOME_NONE]; |
| 112 | - foreach($outcome_list as $key => &$value) { |
|
| 113 | - if(!$value['chance']) { |
|
| 112 | + foreach ($outcome_list as $key => &$value) { |
|
| 113 | + if (!$value['chance']) { |
|
| 114 | 114 | continue; |
| 115 | 115 | } |
| 116 | 116 | $mission_outcome = $key; |
| 117 | 117 | $outcome_description = $value; |
| 118 | - if($outcome_value <= $outcome_description['value']) { |
|
| 118 | + if ($outcome_value <= $outcome_description['value']) { |
|
| 119 | 119 | break; |
| 120 | 120 | } |
| 121 | 121 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | $found_dark_matter = 0; |
| 132 | 132 | // $outcome_mission_sub = -1; |
| 133 | 133 | |
| 134 | - switch($mission_outcome) { |
|
| 134 | + switch ($mission_outcome) { |
|
| 135 | 135 | // switch(FLT_EXPEDITION_OUTCOME_LOST_FLEET) { // TODO DEBUG! |
| 136 | 136 | case FLT_EXPEDITION_OUTCOME_LOST_FLEET: |
| 137 | 137 | flt_mission_explore_outcome_lost_fleet($result); |
@@ -166,14 +166,14 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | // Рассчитываем стоимость самого дорого корабля в металле |
| 168 | 168 | $max_metal_cost = 0; |
| 169 | - foreach($fleet as $ship_id => $ship_amount) { |
|
| 169 | + foreach ($fleet as $ship_id => $ship_amount) { |
|
| 170 | 170 | $max_metal_cost = max($max_metal_cost, $ship_data[$ship_id]['metal_cost']); |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | // Ограничиваем корабли только теми, чья стоимость в металле меньше или равно стоимости самого дорогого корабля |
| 174 | 174 | $can_be_found = array(); |
| 175 | - foreach($ship_data as $ship_id => $ship_info) { |
|
| 176 | - if($ship_info['metal_cost'] < $max_metal_cost) { |
|
| 175 | + foreach ($ship_data as $ship_id => $ship_info) { |
|
| 176 | + if ($ship_info['metal_cost'] < $max_metal_cost) { |
|
| 177 | 177 | $can_be_found[$ship_id] = $ship_info['metal_cost']; |
| 178 | 178 | } |
| 179 | 179 | } |
@@ -182,13 +182,13 @@ discard block |
||
| 182 | 182 | unset($can_be_found[SHIP_SPY]); |
| 183 | 183 | |
| 184 | 184 | $fleet_found = array(); |
| 185 | - while(count($can_be_found) && $found_in_metal >= max($can_be_found)) { |
|
| 185 | + while (count($can_be_found) && $found_in_metal >= max($can_be_found)) { |
|
| 186 | 186 | $found_index = mt_rand(1, count($can_be_found)) - 1; |
| 187 | 187 | $found_ship = array_slice($can_be_found, $found_index, 1, true); |
| 188 | 188 | $found_ship_cost = reset($found_ship); |
| 189 | 189 | $found_ship_id = key($found_ship); |
| 190 | 190 | |
| 191 | - if($found_ship_cost > $found_in_metal) { |
|
| 191 | + if ($found_ship_cost > $found_in_metal) { |
|
| 192 | 192 | unset($can_be_found[$found_ship_id]); |
| 193 | 193 | } else { |
| 194 | 194 | $found_ship_count = mt_rand(1, floor($found_in_metal / $found_ship_cost)); |
@@ -197,10 +197,10 @@ discard block |
||
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - if(empty($fleet_found)) { |
|
| 200 | + if (empty($fleet_found)) { |
|
| 201 | 201 | $msg_text_addon = $lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result']; |
| 202 | 202 | } else { |
| 203 | - foreach($fleet_found as $unit_id => $unit_amount) { |
|
| 203 | + foreach ($fleet_found as $unit_id => $unit_amount) { |
|
| 204 | 204 | $fleet[$unit_id] += $unit_amount; |
| 205 | 205 | } |
| 206 | 206 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | $fleet_row['fleet_resource_crystal'] += $resources_found[RES_CRYSTAL]; |
| 227 | 227 | $fleet_row['fleet_resource_deuterium'] += $resources_found[RES_DEUTERIUM]; |
| 228 | 228 | |
| 229 | - if(array_sum($resources_found) == 0) { |
|
| 229 | + if (array_sum($resources_found) == 0) { |
|
| 230 | 230 | $msg_text_addon = $lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result']; |
| 231 | 231 | } |
| 232 | 232 | break; |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | // Рассчитываем количество найденной ТМ |
| 238 | 238 | $found_dark_matter = floor(min($outcome_percent * $fleet_metal_points / $rates[RES_DARK_MATTER], 10000) * mt_rand(750000, 1000000) / 1000000); |
| 239 | 239 | |
| 240 | - if(!$found_dark_matter) { |
|
| 240 | + if (!$found_dark_matter) { |
|
| 241 | 241 | $msg_text_addon = $lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result']; |
| 242 | 242 | } |
| 243 | 243 | break; |
@@ -251,31 +251,31 @@ discard block |
||
| 251 | 251 | |
| 252 | 252 | flt_mission_explore_addon($result); |
| 253 | 253 | |
| 254 | - if($found_dark_matter) { |
|
| 254 | + if ($found_dark_matter) { |
|
| 255 | 255 | rpg_points_change($fleet_row['fleet_owner'], RPG_EXPEDITION, $found_dark_matter, 'Expedition Bonus'); |
| 256 | 256 | $msg_text_addon = sprintf($lang['flt_mission_expedition']['found_dark_matter'], $found_dark_matter); |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - if(!empty($fleet_lost)) { |
|
| 259 | + if (!empty($fleet_lost)) { |
|
| 260 | 260 | $msg_text_addon = $lang['flt_mission_expedition']['lost_fleet']; |
| 261 | - foreach($fleet_lost as $ship_id => $ship_amount) { |
|
| 261 | + foreach ($fleet_lost as $ship_id => $ship_amount) { |
|
| 262 | 262 | $msg_text_addon .= $lang['tech'][$ship_id] . ' - ' . $ship_amount . "\r\n"; |
| 263 | 263 | } |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | $fleet_row['fleet_amount'] = array_sum($fleet); |
| 267 | - if(!empty($fleet) && $fleet_row['fleet_amount']) { |
|
| 268 | - if(!empty($fleet_found)) { |
|
| 267 | + if (!empty($fleet) && $fleet_row['fleet_amount']) { |
|
| 268 | + if (!empty($fleet_found)) { |
|
| 269 | 269 | $msg_text_addon = $lang['flt_mission_expedition']['found_fleet']; |
| 270 | - foreach($fleet_found as $ship_id => $ship_amount) { |
|
| 270 | + foreach ($fleet_found as $ship_id => $ship_amount) { |
|
| 271 | 271 | $msg_text_addon .= $lang['tech'][$ship_id] . ' - ' . $ship_amount . "\r\n"; |
| 272 | 272 | } |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | $query_delta = array(); |
| 276 | - if(!empty($resources_found) && array_sum($resources_found) > 0) { |
|
| 276 | + if (!empty($resources_found) && array_sum($resources_found) > 0) { |
|
| 277 | 277 | $msg_text_addon = $lang['flt_mission_expedition']['found_resources']; |
| 278 | - foreach($resources_found as $ship_id => $ship_amount) { |
|
| 278 | + foreach ($resources_found as $ship_id => $ship_amount) { |
|
| 279 | 279 | $msg_text_addon .= $lang['tech'][$ship_id] . ' - ' . $ship_amount . "\r\n"; |
| 280 | 280 | } |
| 281 | 281 | |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | $query_data = array(); |
| 291 | - if(!empty($fleet_lost) || !empty($fleet_found)) { |
|
| 291 | + if (!empty($fleet_lost) || !empty($fleet_found)) { |
|
| 292 | 292 | $fleet_row['fleet_array'] = sys_unit_arr2str($fleet); |
| 293 | 293 | |
| 294 | 294 | // $query_data[] = "`fleet_amount` = {$fleet_row['fleet_amount']}"; |
@@ -316,17 +316,16 @@ discard block |
||
| 316 | 316 | |
| 317 | 317 | db_user_set_by_id($fleet_row['fleet_owner'], "`player_rpg_explore_xp` = `player_rpg_explore_xp` + 1"); |
| 318 | 318 | |
| 319 | - if(!$msg_text) { |
|
| 319 | + if (!$msg_text) { |
|
| 320 | 320 | $messages = &$lang['flt_mission_expedition']['outcomes'][$mission_outcome]['messages']; |
| 321 | - if($outcome_mission_sub >= 0 && is_array($messages)) { |
|
| 321 | + if ($outcome_mission_sub >= 0 && is_array($messages)) { |
|
| 322 | 322 | $messages = &$messages[$outcome_mission_sub]; |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | - $msg_text = is_string($messages) ? $messages : |
|
| 326 | - (is_array($messages) ? $messages[mt_rand(0, count($messages) - 1)] : ''); |
|
| 325 | + $msg_text = is_string($messages) ? $messages : (is_array($messages) ? $messages[mt_rand(0, count($messages) - 1)] : ''); |
|
| 327 | 326 | } |
| 328 | 327 | $msg_text = sprintf($msg_text, $fleet_row['fleet_id'], uni_render_coordinates($fleet_row, 'fleet_end_')) . |
| 329 | - ($msg_text_addon ? "\r\n" . $msg_text_addon: ''); |
|
| 328 | + ($msg_text_addon ? "\r\n" . $msg_text_addon : ''); |
|
| 330 | 329 | |
| 331 | 330 | msg_send_simple_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_end_stay'], MSG_TYPE_EXPLORE, $msg_sender, $msg_title, $msg_text); |
| 332 | 331 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | $fleet_row = &$mission_data['fleet']; |
| 14 | 14 | $destination_planet = &$mission_data['dst_planet']; |
| 15 | 15 | |
| 16 | - if(!$destination_planet || !is_array($destination_planet) || $fleet_row['fleet_owner'] != $destination_planet['id_owner']) |
|
| 16 | + if (!$destination_planet || !is_array($destination_planet) || $fleet_row['fleet_owner'] != $destination_planet['id_owner']) |
|
| 17 | 17 | { |
| 18 | 18 | // doquery("UPDATE {{fleets}} SET `fleet_mess` = 1 WHERE `fleet_id` = {$fleet_row['fleet_id']} LIMIT 1;"); |
| 19 | 19 | fleet_send_back($mission_data['fleet']); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | $mission_data['src_planet']['name'], uni_render_coordinates_href($fleet_row, 'fleet_start_', 3, ''), $destination_planet['name'], uni_render_coordinates_href($fleet_row, 'fleet_end_', 3, ''), |
| 27 | 27 | $fleet_row['fleet_resource_metal'], $lang['Metal'], $fleet_row['fleet_resource_crystal'], $lang['Crystal'], $fleet_row['fleet_resource_deuterium'], $lang['Deuterium']) . |
| 28 | 28 | '<br />' . $lang['sys_relocate_mess_user']; |
| 29 | - foreach(sys_unit_str2arr($fleet_row['fleet_array']) as $ship_id => $ship_count) |
|
| 29 | + foreach (sys_unit_str2arr($fleet_row['fleet_array']) as $ship_id => $ship_count) |
|
| 30 | 30 | { |
| 31 | 31 | $Message .= $lang['tech'][$ship_id] . ' - ' . $ship_count . '<br />'; |
| 32 | 32 | } |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | function flt_mission_destroy($mission_data) { |
| 9 | 9 | $fleet_row = $mission_data['fleet']; |
| 10 | 10 | $destination_planet = $mission_data['dst_planet']; |
| 11 | - if(!$destination_planet || !is_array($destination_planet) || $destination_planet['planet_type'] != PT_MOON) { |
|
| 11 | + if (!$destination_planet || !is_array($destination_planet) || $destination_planet['planet_type'] != PT_MOON) { |
|
| 12 | 12 | fleet_send_back($fleet_row); |
| 13 | 13 | |
| 14 | 14 | return CACHE_FLEET; |