@@ -6,14 +6,14 @@ |
||
| 6 | 6 | |
| 7 | 7 | global $sn_page_name, $sn_mvc, $template, $template_result; |
| 8 | 8 | |
| 9 | -if(isset($sn_page_name) || ($sn_page_name = isset($_GET['page']) ? trim(strip_tags($_GET['page'])) : '')) { |
|
| 9 | +if (isset($sn_page_name) || ($sn_page_name = isset($_GET['page']) ? trim(strip_tags($_GET['page'])) : '')) { |
|
| 10 | 10 | require_once('common.' . substr(strrchr(__FILE__, '.'), 1)); |
| 11 | - if($sn_page_name) { |
|
| 11 | + if ($sn_page_name) { |
|
| 12 | 12 | // Loading page-specific language files |
| 13 | 13 | |
| 14 | 14 | !empty($sn_mvc['model'][$sn_page_name]) and execute_hooks($sn_mvc['model'][$sn_page_name], $template, 'model', $sn_page_name); |
| 15 | 15 | !empty($sn_mvc['view'][$sn_page_name]) and execute_hooks($sn_mvc['view'][$sn_page_name], $template, 'view', $sn_page_name); |
| 16 | - if(!empty($template_result) && is_object($template)) { |
|
| 16 | + if (!empty($template_result) && is_object($template)) { |
|
| 17 | 17 | $template->assign_recursive($template_result); |
| 18 | 18 | } |
| 19 | 19 | |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | * @copyright 2008-2015 Gorlum for Project "SuperNova.WS" |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | -if(!defined('INSIDE')) { |
|
| 8 | +if (!defined('INSIDE')) { |
|
| 9 | 9 | die(); |
| 10 | 10 | } |
| 11 | 11 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | function db_change_units_perform($query, $tablename, $object_id) { |
| 15 | 15 | $query = implode(',', $query); |
| 16 | - if($query && $object_id) { |
|
| 16 | + if ($query && $object_id) { |
|
| 17 | 17 | return SN::db_upd_record_by_id($tablename == 'users' ? LOC_USER : LOC_PLANET, $object_id, $query); |
| 18 | 18 | } |
| 19 | 19 | } |
@@ -29,15 +29,15 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | $group = sn_get_groups('resources_loot'); |
| 31 | 31 | |
| 32 | - foreach($unit_list as $unit_id => $unit_amount) { |
|
| 33 | - if(!in_array($unit_id, $group)) { |
|
| 32 | + foreach ($unit_list as $unit_id => $unit_amount) { |
|
| 33 | + if (!in_array($unit_id, $group)) { |
|
| 34 | 34 | // TODO - remove later |
| 35 | 35 | print('<h1>СООБЩИТЕ ЭТО АДМИНУ: db_change_units() вызван для не-ресурсов!</h1>'); |
| 36 | 36 | pdump(debug_backtrace()); |
| 37 | 37 | die('db_change_units() вызван для не-ресурсов!'); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - if(!$unit_amount) { |
|
| 40 | + if (!$unit_amount) { |
|
| 41 | 41 | continue; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $unit_location = sys_get_unit_location($user, $planet, $unit_id); |
| 47 | 47 | |
| 48 | 48 | // Changing value in object |
| 49 | - switch($unit_location) { |
|
| 49 | + switch ($unit_location) { |
|
| 50 | 50 | case LOC_USER: |
| 51 | 51 | $user[$unit_db_name] += $unit_amount; |
| 52 | 52 | break; |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @deprecated |
| 110 | 110 | */ |
| 111 | 111 | function doquery($query, $table = '', $fetch = false, $skip_query_check = false) { |
| 112 | - if(is_bool($table) || !is_string($table)) { |
|
| 112 | + if (is_bool($table) || !is_string($table)) { |
|
| 113 | 113 | $fetch = $table; |
| 114 | 114 | } |
| 115 | 115 | return SN::$db->doquery($query, $fetch, $skip_query_check); |
@@ -601,29 +601,29 @@ discard block |
||
| 601 | 601 | P_MISSION_EXPEDITION_OUTCOME => FLT_EXPEDITION_OUTCOME_FOUND_FLEET, |
| 602 | 602 | P_MISSION_EXPEDITION_OUTCOME_TYPE => FLT_EXPEDITION_OUTCOME_TYPE_GOOD, |
| 603 | 603 | P_CHANCE => 200, |
| 604 | - 'percent' => [0 => 0.1, 1 => 0.02, 2 => 0.01,], |
|
| 604 | + 'percent' => [0 => 0.1, 1 => 0.02, 2 => 0.01, ], |
|
| 605 | 605 | P_MISSION_EXPEDITION_OUTCOME_SECONDARY => [ |
| 606 | - [P_CHANCE => 90, P_MULTIPLIER => 0.01, P_MESSAGE_ID => 2,], |
|
| 607 | - [P_CHANCE => 9, P_MULTIPLIER => 0.02, P_MESSAGE_ID => 1,], |
|
| 608 | - [P_CHANCE => 1, P_MULTIPLIER => 0.10, P_MESSAGE_ID => 0,], |
|
| 606 | + [P_CHANCE => 90, P_MULTIPLIER => 0.01, P_MESSAGE_ID => 2, ], |
|
| 607 | + [P_CHANCE => 9, P_MULTIPLIER => 0.02, P_MESSAGE_ID => 1, ], |
|
| 608 | + [P_CHANCE => 1, P_MULTIPLIER => 0.10, P_MESSAGE_ID => 0, ], |
|
| 609 | 609 | ], |
| 610 | 610 | ], |
| 611 | 611 | FLT_EXPEDITION_OUTCOME_FOUND_RESOURCES => [ |
| 612 | 612 | P_MISSION_EXPEDITION_OUTCOME => FLT_EXPEDITION_OUTCOME_FOUND_RESOURCES, |
| 613 | 613 | P_MISSION_EXPEDITION_OUTCOME_TYPE => FLT_EXPEDITION_OUTCOME_TYPE_GOOD, |
| 614 | 614 | P_CHANCE => 300, |
| 615 | - 'percent' => [0 => 0.1, 1 => 0.050, 2 => 0.025,], |
|
| 615 | + 'percent' => [0 => 0.1, 1 => 0.050, 2 => 0.025, ], |
|
| 616 | 616 | P_MISSION_EXPEDITION_OUTCOME_SECONDARY => [ |
| 617 | - [P_CHANCE => 90, P_MULTIPLIER => 0.025, P_MESSAGE_ID => 2,], |
|
| 618 | - [P_CHANCE => 9, P_MULTIPLIER => 0.050, P_MESSAGE_ID => 1,], |
|
| 619 | - [P_CHANCE => 1, P_MULTIPLIER => 0.100, P_MESSAGE_ID => 0,], |
|
| 617 | + [P_CHANCE => 90, P_MULTIPLIER => 0.025, P_MESSAGE_ID => 2, ], |
|
| 618 | + [P_CHANCE => 9, P_MULTIPLIER => 0.050, P_MESSAGE_ID => 1, ], |
|
| 619 | + [P_CHANCE => 1, P_MULTIPLIER => 0.100, P_MESSAGE_ID => 0, ], |
|
| 620 | 620 | ], |
| 621 | 621 | ], |
| 622 | 622 | FLT_EXPEDITION_OUTCOME_FOUND_DM => [ |
| 623 | 623 | P_MISSION_EXPEDITION_OUTCOME => FLT_EXPEDITION_OUTCOME_FOUND_DM, |
| 624 | 624 | P_MISSION_EXPEDITION_OUTCOME_TYPE => FLT_EXPEDITION_OUTCOME_TYPE_GOOD, |
| 625 | 625 | P_CHANCE => 100, |
| 626 | - 'percent' => [0 => 0.0100, 1 => 0.0040, 2 => 0.0010,], |
|
| 626 | + 'percent' => [0 => 0.0100, 1 => 0.0040, 2 => 0.0010, ], |
|
| 627 | 627 | P_MISSION_EXPEDITION_OUTCOME_SECONDARY => [ |
| 628 | 628 | [P_CHANCE => 90, P_MULTIPLIER => 0.0010, /*P_MESSAGE_ID => 2,*/], |
| 629 | 629 | [P_CHANCE => 9, P_MULTIPLIER => 0.0040, /*P_MESSAGE_ID => 1,*/], |
@@ -658,14 +658,14 @@ discard block |
||
| 658 | 658 | ], |
| 659 | 659 | |
| 660 | 660 | 'planet_generator' => [ |
| 661 | - 0 => [ // HomeWorld |
|
| 661 | + 0 => [// HomeWorld |
|
| 662 | 662 | 't_max_min' => 40, // Tmax 40 |
| 663 | 663 | 't_max_max' => 40, |
| 664 | 664 | 't_delta_min' => 40, // Tmin 0 |
| 665 | 665 | 't_delta_max' => 40, |
| 666 | 666 | 'size_min' => $config->initial_fields, |
| 667 | 667 | 'size_max' => $config->initial_fields, |
| 668 | - 'core_types' => [PLANET_DENSITY_STANDARD,], |
|
| 668 | + 'core_types' => [PLANET_DENSITY_STANDARD, ], |
|
| 669 | 669 | 'planet_images' => ['normaltemp'], |
| 670 | 670 | ], |
| 671 | 671 | 1 => [ |
@@ -895,7 +895,7 @@ discard block |
||
| 895 | 895 | ], |
| 896 | 896 | 'planet_images' => ['eis'], |
| 897 | 897 | ], |
| 898 | - 16 => [ // Random planet - stranger; -35 avg |
|
| 898 | + 16 => [// Random planet - stranger; -35 avg |
|
| 899 | 899 | 't_max_min' => -90, |
| 900 | 900 | 't_max_max' => +40, |
| 901 | 901 | 't_delta_min' => 2, |
@@ -915,7 +915,7 @@ discard block |
||
| 915 | 915 | PLANET_DENSITY_METAL_PERIDOT, |
| 916 | 916 | PLANET_DENSITY_METAL_RAW, |
| 917 | 917 | ], |
| 918 | - 'planet_images' => ['trocken', 'dschjungel', 'normaltemp', 'wasser', 'eis',], |
|
| 918 | + 'planet_images' => ['trocken', 'dschjungel', 'normaltemp', 'wasser', 'eis', ], |
|
| 919 | 919 | ], |
| 920 | 920 | ], |
| 921 | 921 | |
@@ -938,7 +938,7 @@ discard block |
||
| 938 | 938 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_ICE_HYDROGEN, |
| 939 | 939 | UNIT_PLANET_DENSITY_RARITY => 30, // 1, // 40.00, // * 1/121 0,82645 |
| 940 | 940 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_PERFECT, |
| 941 | - UNIT_RESOURCES => [RES_METAL => 0.20, RES_CRYSTAL => 0.60, RES_DEUTERIUM => 7.10,], |
|
| 941 | + UNIT_RESOURCES => [RES_METAL => 0.20, RES_CRYSTAL => 0.60, RES_DEUTERIUM => 7.10, ], |
|
| 942 | 942 | UNIT_PLANET_DENSITY_MAX_SECTORS => 150, |
| 943 | 943 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 11, |
| 944 | 944 | ], |
@@ -947,7 +947,7 @@ discard block |
||
| 947 | 947 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_ICE_METHANE, |
| 948 | 948 | UNIT_PLANET_DENSITY_RARITY => 130, // 6, // 6.67, // * 6,0 4,95868 |
| 949 | 949 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_GOOD, |
| 950 | - UNIT_RESOURCES => [RES_METAL => 0.55, RES_CRYSTAL => 0.85, RES_DEUTERIUM => 4.60,], |
|
| 950 | + UNIT_RESOURCES => [RES_METAL => 0.55, RES_CRYSTAL => 0.85, RES_DEUTERIUM => 4.60, ], |
|
| 951 | 951 | UNIT_PLANET_DENSITY_MAX_SECTORS => 200, |
| 952 | 952 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 6, |
| 953 | 953 | ], |
@@ -956,7 +956,7 @@ discard block |
||
| 956 | 956 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_ICE_WATER, |
| 957 | 957 | UNIT_PLANET_DENSITY_RARITY => 450, //20, // 2.00, // * 20,0 16,52893 |
| 958 | 958 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_AVERAGE, |
| 959 | - UNIT_RESOURCES => [RES_METAL => 0.86, RES_CRYSTAL => 0.95, RES_DEUTERIUM => 2.20,], |
|
| 959 | + UNIT_RESOURCES => [RES_METAL => 0.86, RES_CRYSTAL => 0.95, RES_DEUTERIUM => 2.20, ], |
|
| 960 | 960 | UNIT_PLANET_DENSITY_MAX_SECTORS => 999, |
| 961 | 961 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0, |
| 962 | 962 | ], |
@@ -966,7 +966,7 @@ discard block |
||
| 966 | 966 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_CRYSTAL_RAW, |
| 967 | 967 | UNIT_PLANET_DENSITY_RARITY => 20, // 1, // 40.00, // *1,0 0,82645 |
| 968 | 968 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_PERFECT, |
| 969 | - UNIT_RESOURCES => [RES_METAL => 0.40, RES_CRYSTAL => 12.37, RES_DEUTERIUM => 0.50,], |
|
| 969 | + UNIT_RESOURCES => [RES_METAL => 0.40, RES_CRYSTAL => 12.37, RES_DEUTERIUM => 0.50, ], |
|
| 970 | 970 | UNIT_PLANET_DENSITY_MAX_SECTORS => 150, |
| 971 | 971 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 11, |
| 972 | 972 | ], |
@@ -975,7 +975,7 @@ discard block |
||
| 975 | 975 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_CRYSTAL_SILICATE, |
| 976 | 976 | UNIT_PLANET_DENSITY_RARITY => 140, // 5.71, // * 7,0 5,78512 |
| 977 | 977 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_GOOD, |
| 978 | - UNIT_RESOURCES => [RES_METAL => 0.67, RES_CRYSTAL => 4.50, RES_DEUTERIUM => 0.85,], |
|
| 978 | + UNIT_RESOURCES => [RES_METAL => 0.67, RES_CRYSTAL => 4.50, RES_DEUTERIUM => 0.85, ], |
|
| 979 | 979 | UNIT_PLANET_DENSITY_MAX_SECTORS => 200, |
| 980 | 980 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 6, |
| 981 | 981 | ], |
@@ -984,7 +984,7 @@ discard block |
||
| 984 | 984 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_CRYSTAL_STONE, |
| 985 | 985 | UNIT_PLANET_DENSITY_RARITY => 500, // 1.90, // * 21,0 17,35537 |
| 986 | 986 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_AVERAGE, |
| 987 | - UNIT_RESOURCES => [RES_METAL => 0.80, RES_CRYSTAL => 2.00, RES_DEUTERIUM => 0.95,], |
|
| 987 | + UNIT_RESOURCES => [RES_METAL => 0.80, RES_CRYSTAL => 2.00, RES_DEUTERIUM => 0.95, ], |
|
| 988 | 988 | UNIT_PLANET_DENSITY_MAX_SECTORS => 999, |
| 989 | 989 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0, |
| 990 | 990 | ], |
@@ -994,7 +994,7 @@ discard block |
||
| 994 | 994 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_STANDARD, |
| 995 | 995 | UNIT_PLANET_DENSITY_RARITY => 1000, // 1.0, // * 40,0 33,05785 |
| 996 | 996 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_NORMAL, |
| 997 | - UNIT_RESOURCES => [RES_METAL => 1.00, RES_CRYSTAL => 1.00, RES_DEUTERIUM => 1.00,], |
|
| 997 | + UNIT_RESOURCES => [RES_METAL => 1.00, RES_CRYSTAL => 1.00, RES_DEUTERIUM => 1.00, ], |
|
| 998 | 998 | UNIT_PLANET_DENSITY_MAX_SECTORS => 999, |
| 999 | 999 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0, |
| 1000 | 1000 | ], |
@@ -1004,7 +1004,7 @@ discard block |
||
| 1004 | 1004 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_METAL_ORE, |
| 1005 | 1005 | UNIT_PLANET_DENSITY_RARITY => 550, // 2.11, // * 19,0 15,70248 |
| 1006 | 1006 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_AVERAGE, |
| 1007 | - UNIT_RESOURCES => [RES_METAL => 1.60, RES_CRYSTAL => 0.90, RES_DEUTERIUM => 0.80,], |
|
| 1007 | + UNIT_RESOURCES => [RES_METAL => 1.60, RES_CRYSTAL => 0.90, RES_DEUTERIUM => 0.80, ], |
|
| 1008 | 1008 | UNIT_PLANET_DENSITY_MAX_SECTORS => 999, |
| 1009 | 1009 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 0, |
| 1010 | 1010 | ], |
@@ -1013,7 +1013,7 @@ discard block |
||
| 1013 | 1013 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_METAL_PERIDOT, |
| 1014 | 1014 | UNIT_PLANET_DENSITY_RARITY => 120, // 8.00, // * 5,0 4,13223 |
| 1015 | 1015 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_GOOD, |
| 1016 | - UNIT_RESOURCES => [RES_METAL => 4.71, RES_CRYSTAL => 0.80, RES_DEUTERIUM => 0.55,], |
|
| 1016 | + UNIT_RESOURCES => [RES_METAL => 4.71, RES_CRYSTAL => 0.80, RES_DEUTERIUM => 0.55, ], |
|
| 1017 | 1017 | UNIT_PLANET_DENSITY_MAX_SECTORS => 200, |
| 1018 | 1018 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 6, |
| 1019 | 1019 | ], |
@@ -1022,7 +1022,7 @@ discard block |
||
| 1022 | 1022 | UNIT_PLANET_DENSITY_INDEX => PLANET_DENSITY_METAL_RAW, |
| 1023 | 1023 | UNIT_PLANET_DENSITY_RARITY => 25, // 40.00, // * 1,0 0,82645 |
| 1024 | 1024 | UNIT_PLANET_DENSITY_RICHNESS => PLANET_DENSITY_RICHNESS_PERFECT, |
| 1025 | - UNIT_RESOURCES => [RES_METAL => 8.00, RES_CRYSTAL => 0.40, RES_DEUTERIUM => 0.25,], |
|
| 1025 | + UNIT_RESOURCES => [RES_METAL => 8.00, RES_CRYSTAL => 0.40, RES_DEUTERIUM => 0.25, ], |
|
| 1026 | 1026 | UNIT_PLANET_DENSITY_MAX_SECTORS => 150, |
| 1027 | 1027 | UNIT_PLANET_DENSITY_MIN_ASTROTECH => 11, |
| 1028 | 1028 | ], |
@@ -1199,7 +1199,7 @@ discard block |
||
| 1199 | 1199 | ], |
| 1200 | 1200 | |
| 1201 | 1201 | // Missiles list |
| 1202 | - UNIT_DEF_MISSILES_STR => [UNIT_DEF_MISSILE_INTERCEPTOR => UNIT_DEF_MISSILE_INTERCEPTOR, UNIT_DEF_MISSILE_INTERPLANET => UNIT_DEF_MISSILE_INTERPLANET,], |
|
| 1202 | + UNIT_DEF_MISSILES_STR => [UNIT_DEF_MISSILE_INTERCEPTOR => UNIT_DEF_MISSILE_INTERCEPTOR, UNIT_DEF_MISSILE_INTERPLANET => UNIT_DEF_MISSILE_INTERPLANET, ], |
|
| 1203 | 1203 | |
| 1204 | 1204 | // Combat units list |
| 1205 | 1205 | 'combat' => [ |
@@ -1248,7 +1248,7 @@ discard block |
||
| 1248 | 1248 | // Resource list |
| 1249 | 1249 | UNIT_RESOURCES_STR => [0 => 'metal', 1 => 'crystal', 2 => 'deuterium', 3 => 'dark_matter'], |
| 1250 | 1250 | // Resources all |
| 1251 | - 'resources_all' => [RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_ENERGY => RES_ENERGY, RES_DARK_MATTER => RES_DARK_MATTER, RES_METAMATTER => RES_METAMATTER,], |
|
| 1251 | + 'resources_all' => [RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_ENERGY => RES_ENERGY, RES_DARK_MATTER => RES_DARK_MATTER, RES_METAMATTER => RES_METAMATTER, ], |
|
| 1252 | 1252 | // Resources can be produced on planet |
| 1253 | 1253 | 'resources_planet' => [RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_ENERGY => RES_ENERGY], |
| 1254 | 1254 | // Resources can be looted from planet |
@@ -1267,13 +1267,13 @@ discard block |
||
| 1267 | 1267 | ], |
| 1268 | 1268 | |
| 1269 | 1269 | // Resources that can be tradeable in market trader AND be a quest_rewards |
| 1270 | - 'quest_rewards' => [RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_DARK_MATTER => RES_DARK_MATTER,], |
|
| 1270 | + 'quest_rewards' => [RES_METAL => RES_METAL, RES_CRYSTAL => RES_CRYSTAL, RES_DEUTERIUM => RES_DEUTERIUM, RES_DARK_MATTER => RES_DARK_MATTER, ], |
|
| 1271 | 1271 | |
| 1272 | 1272 | // // Ques list |
| 1273 | 1273 | // 'ques' => array(QUE_STRUCTURES, QUE_HANGAR, QUE_RESEARCH), |
| 1274 | 1274 | |
| 1275 | - 'STAT_COMMON' => [STAT_TOTAL => STAT_TOTAL, STAT_FLEET => STAT_FLEET, STAT_TECH => STAT_TECH, STAT_BUILDING => STAT_BUILDING, STAT_DEFENSE => STAT_DEFENSE, STAT_RESOURCE => STAT_RESOURCE,], |
|
| 1276 | - 'STAT_PLAYER' => [STAT_RAID_TOTAL => STAT_RAID_TOTAL, STAT_RAID_WON => STAT_RAID_WON, STAT_RAID_LOST => STAT_RAID_LOST, STAT_LVL_BUILDING => STAT_LVL_BUILDING, STAT_LVL_TECH => STAT_LVL_TECH, STAT_LVL_RAID => STAT_LVL_RAID,], |
|
| 1275 | + 'STAT_COMMON' => [STAT_TOTAL => STAT_TOTAL, STAT_FLEET => STAT_FLEET, STAT_TECH => STAT_TECH, STAT_BUILDING => STAT_BUILDING, STAT_DEFENSE => STAT_DEFENSE, STAT_RESOURCE => STAT_RESOURCE, ], |
|
| 1276 | + 'STAT_PLAYER' => [STAT_RAID_TOTAL => STAT_RAID_TOTAL, STAT_RAID_WON => STAT_RAID_WON, STAT_RAID_LOST => STAT_RAID_LOST, STAT_LVL_BUILDING => STAT_LVL_BUILDING, STAT_LVL_TECH => STAT_LVL_TECH, STAT_LVL_RAID => STAT_LVL_RAID, ], |
|
| 1277 | 1277 | |
| 1278 | 1278 | GROUP_GROUP_ID_TO_NAMES => [ |
| 1279 | 1279 | UNIT_STRUCTURES => 'structures', |
@@ -1287,7 +1287,7 @@ discard block |
||
| 1287 | 1287 | UNIT_PLANS => 'plans', |
| 1288 | 1288 | ], |
| 1289 | 1289 | |
| 1290 | - GROUP_CAPITAL_BUILDING_BONUS_GROUPS => ['structures', 'defense', 'fleet',], |
|
| 1290 | + GROUP_CAPITAL_BUILDING_BONUS_GROUPS => ['structures', 'defense', 'fleet', ], |
|
| 1291 | 1291 | |
| 1292 | 1292 | GROUP_UNIT_COMBAT_SORT_ORDER => [ |
| 1293 | 1293 | SHIP_SPY, |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - if($prepend) { |
|
| 124 | + if ($prepend) { |
|
| 125 | 125 | array_unshift($functions[$function_name], $function_data); |
| 126 | 126 | } else { |
| 127 | 127 | $functions[$function_name][] = $function_data; |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | $time_left = min(floor($time_left / PERIOD_DAY), $term_original); |
| 333 | 333 | $cost_left = $term_original > 0 ? ceil($time_left / $term_original * $original_cost) : 0; |
| 334 | 334 | |
| 335 | - array_walk_recursive($result, function (&$value) use ($cost_left) { |
|
| 335 | + array_walk_recursive($result, function(&$value) use ($cost_left) { |
|
| 336 | 336 | $value -= $cost_left; |
| 337 | 337 | }); |
| 338 | 338 | } |
@@ -86,7 +86,7 @@ |
||
| 86 | 86 | ); |
| 87 | 87 | |
| 88 | 88 | // Quick hack to support IPv6 at least on local host |
| 89 | - if($ip['ip'] == '::1') { |
|
| 89 | + if ($ip['ip'] == '::1') { |
|
| 90 | 90 | $ip['ip'] = '127.0.0.1'; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | renderFooter(); |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | - $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false;; |
|
| 325 | + $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false; ; |
|
| 326 | 326 | |
| 327 | 327 | sn_db_disconnect(); |
| 328 | 328 | |
@@ -705,7 +705,7 @@ discard block |
||
| 705 | 705 | 'QUE_ID' => QUE_RESEARCH, |
| 706 | 706 | 'QUE_HTML' => 'topnav', |
| 707 | 707 | |
| 708 | - 'RESEARCH_ONGOING' => (boolean)$user['que'], |
|
| 708 | + 'RESEARCH_ONGOING' => (boolean) $user['que'], |
|
| 709 | 709 | |
| 710 | 710 | 'TIME_TEXT' => sprintf($str_date_format, $time_now_parsed['year'], $lang['months'][$time_now_parsed['mon']], $time_now_parsed['mday'], |
| 711 | 711 | $time_now_parsed['hours'], $time_now_parsed['minutes'], $time_now_parsed['seconds'] |
@@ -975,7 +975,7 @@ discard block |
||
| 975 | 975 | if (empty($files)) { |
| 976 | 976 | // Make sure that all empty files will translate to empty array |
| 977 | 977 | $files = []; |
| 978 | - } elseif(is_string($files)) { |
|
| 978 | + } elseif (is_string($files)) { |
|
| 979 | 979 | // If we have single filename - making array from it |
| 980 | 980 | $files = [basename($files) => $files]; |
| 981 | 981 | } elseif (!is_array($files)) { |
@@ -1008,7 +1008,7 @@ discard block |
||
| 1008 | 1008 | 'LANG' => $language ? $language : '', |
| 1009 | 1009 | 'referral' => $id_ref ? '&id_ref=' . $id_ref : '', |
| 1010 | 1010 | |
| 1011 | - 'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '',// "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''), |
|
| 1011 | + 'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '', // "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''), |
|
| 1012 | 1012 | 'FILENAME' => basename($_SERVER['PHP_SELF']), |
| 1013 | 1013 | )); |
| 1014 | 1014 | |
@@ -1125,7 +1125,7 @@ discard block |
||
| 1125 | 1125 | 'MESSAGE' => $message, |
| 1126 | 1126 | ]; |
| 1127 | 1127 | |
| 1128 | - if($template instanceof template) { |
|
| 1128 | + if ($template instanceof template) { |
|
| 1129 | 1129 | $template->assign_block_vars('result', $block); |
| 1130 | 1130 | } else { |
| 1131 | 1131 | $template_result['.']['result'][] = $block; |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | } |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - $updater->upd_alter_table('users', ["DROP COLUMN `dpath`",], $updater->isFieldExists('users', 'dpath')); |
|
| 240 | + $updater->upd_alter_table('users', ["DROP COLUMN `dpath`", ], $updater->isFieldExists('users', 'dpath')); |
|
| 241 | 241 | |
| 242 | 242 | // 2017-06-12 13:47:36 42c1 |
| 243 | 243 | $updater->new_version = 42; |
@@ -250,14 +250,14 @@ discard block |
||
| 250 | 250 | |
| 251 | 251 | // 2017-10-11 09:51:49 43a4.3 |
| 252 | 252 | $updater->upd_alter_table('messages', |
| 253 | - ["ADD COLUMN `message_json` tinyint(1) unsigned NOT NULL DEFAULT 0 AFTER `message_text`",], |
|
| 253 | + ["ADD COLUMN `message_json` tinyint(1) unsigned NOT NULL DEFAULT 0 AFTER `message_text`", ], |
|
| 254 | 254 | !$updater->isFieldExists('messages', 'message_json') |
| 255 | 255 | ); |
| 256 | 256 | |
| 257 | 257 | |
| 258 | 258 | // 2017-10-17 09:49:24 43a6.0 |
| 259 | 259 | // Removing old index i_user_id |
| 260 | - $updater->upd_alter_table('counter', ['DROP KEY `i_user_id`',], $updater->isIndexExists('counter', 'i_user_id')); |
|
| 260 | + $updater->upd_alter_table('counter', ['DROP KEY `i_user_id`', ], $updater->isIndexExists('counter', 'i_user_id')); |
|
| 261 | 261 | // Adding new index I_counter_user_id |
| 262 | 262 | $updater->upd_alter_table('counter', |
| 263 | 263 | [ |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | ); |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | - $updater->updPatchApply(1, function () use ($updater) { |
|
| 314 | + $updater->updPatchApply(1, function() use ($updater) { |
|
| 315 | 315 | $q = $updater->upd_do_query("SELECT `messageid`, `user` FROM `{{chat}}`", true); |
| 316 | 316 | while ($row = db_fetch($q)) { |
| 317 | 317 | if (strpos($row['user'], 'a:') !== 0) { |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | }); |
| 334 | 334 | |
| 335 | 335 | // 2018-03-07 09:23:41 43a13.23 + 2018-03-07 12:00:47 43a13.24 |
| 336 | - $updater->updPatchApply(2, function () use ($updater) { |
|
| 336 | + $updater->updPatchApply(2, function() use ($updater) { |
|
| 337 | 337 | $updater->upd_alter_table('festival_gifts', [ |
| 338 | 338 | "ADD COLUMN `disclosure` tinyint(1) unsigned NOT NULL DEFAULT 0 AFTER `amount`", |
| 339 | 339 | "ADD COLUMN `message` VARCHAR(4096) CHARSET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' AFTER `disclosure`", |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | }); |
| 342 | 342 | |
| 343 | 343 | // 2018-03-12 13:23:10 43a13.33 |
| 344 | - $updater->updPatchApply(3, function () use ($updater) { |
|
| 344 | + $updater->updPatchApply(3, function() use ($updater) { |
|
| 345 | 345 | $updater->upd_alter_table('player_options', |
| 346 | 346 | [ |
| 347 | 347 | "MODIFY COLUMN `value` VARCHAR(16000) CHARSET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT ''", |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | }); |
| 352 | 352 | |
| 353 | 353 | // 2018-03-24 21:31:51 43a16.16 - OiS |
| 354 | - $updater->updPatchApply(4, function () use ($updater) { |
|
| 354 | + $updater->updPatchApply(4, function() use ($updater) { |
|
| 355 | 355 | if (!$updater->isTableExists('festival_ois_player')) { |
| 356 | 356 | $updater->upd_create_table( |
| 357 | 357 | 'festival_ois_player', |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | }); |
| 371 | 371 | |
| 372 | 372 | // 2018-03-25 08:11:39 43a16.21 |
| 373 | - $updater->updPatchApply(5, function () use ($updater) { |
|
| 373 | + $updater->updPatchApply(5, function() use ($updater) { |
|
| 374 | 374 | $updater->upd_alter_table( |
| 375 | 375 | 'que', |
| 376 | 376 | "ADD COLUMN `que_unit_one_time_raw` DECIMAL(20,5) NOT NULL DEFAULT 0", |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | $updater->upd_log_version_update(); |
| 387 | 387 | |
| 388 | 388 | // 2018-12-21 14:00:41 44a5 Module "ad_promo_code" support |
| 389 | - $updater->updPatchApply(6, function () use ($updater) { |
|
| 389 | + $updater->updPatchApply(6, function() use ($updater) { |
|
| 390 | 390 | if (!$updater->isTableExists('ad_promo_codes')) { |
| 391 | 391 | $updater->upd_create_table( |
| 392 | 392 | 'ad_promo_codes', |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | }); |
| 428 | 428 | |
| 429 | 429 | // 2018-12-22 11:42:20 44a12 |
| 430 | - $updater->updPatchApply(7, function () use ($updater) { |
|
| 430 | + $updater->updPatchApply(7, function() use ($updater) { |
|
| 431 | 431 | // Creating table for HTTP query strings |
| 432 | 432 | $updater->upd_create_table( |
| 433 | 433 | 'security_query_strings', |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | // Adding unique index for all significant fields |
| 513 | 513 | $updater->upd_alter_table('security_player_entry', [ |
| 514 | 514 | "ADD UNIQUE KEY `I_player_entry_unique` (`device_id`, `browser_id`, `user_ip`, `user_proxy`)", |
| 515 | - ], ! $updater->isIndexExists('security_player_entry', 'I_player_entry_unique')); |
|
| 515 | + ], !$updater->isIndexExists('security_player_entry', 'I_player_entry_unique')); |
|
| 516 | 516 | // Filling `security_player_entry` from temp table |
| 517 | 517 | $updater->upd_do_query( |
| 518 | 518 | "INSERT IGNORE INTO `{{security_player_entry}}` (`device_id`, `browser_id`, `user_ip`, `user_proxy`, `first_visit`) |
@@ -7,18 +7,18 @@ discard block |
||
| 7 | 7 | use Fleet\DbFleetStatic; |
| 8 | 8 | use Planet\DBStaticPlanet; |
| 9 | 9 | |
| 10 | -if(SN_IN_FLEET !== true) { |
|
| 10 | +if (SN_IN_FLEET !== true) { |
|
| 11 | 11 | $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | $template = gettemplate('fleet1', true); |
| 15 | 15 | |
| 16 | 16 | $ships = sys_get_param('ships', array()); |
| 17 | -if(!is_array($ships)) { |
|
| 17 | +if (!is_array($ships)) { |
|
| 18 | 18 | $ships = array(); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | -foreach(array(PT_PLANET, PT_DEBRIS, PT_MOON) as $possible_planet_type_id) { |
|
| 21 | +foreach (array(PT_PLANET, PT_DEBRIS, PT_MOON) as $possible_planet_type_id) { |
|
| 22 | 22 | $template->assign_block_vars('possible_planet_type_id', array( |
| 23 | 23 | 'ID' => $possible_planet_type_id, |
| 24 | 24 | 'NAME' => $lang['sys_planet_type_sh'][$possible_planet_type_id], |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | 'START_NAME' => $planetrow['name'], |
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | -if(!empty($TargetPlanet)) { |
|
| 34 | +if (!empty($TargetPlanet)) { |
|
| 35 | 35 | $template_route += array( |
| 36 | 36 | 'END_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$TargetPlanet['planet_type']], |
| 37 | 37 | 'END_COORDS' => uni_render_coordinates($TargetPlanet), |
@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | $template->assign_block_vars('fleets', $template_route); |
| 43 | 43 | |
| 44 | 44 | $sn_groups_fleet = sn_get_groups('fleet'); |
| 45 | -foreach($ships as $ship_id => $ship_count) { |
|
| 46 | - if(in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
| 45 | +foreach ($ships as $ship_id => $ship_count) { |
|
| 46 | + if (in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
| 47 | 47 | $ship_info = get_unit_param($ship_id); |
| 48 | - if($ship_count > mrc_get_level($user, $planetrow, $ship_id, false, true)) { |
|
| 48 | + if ($ship_count > mrc_get_level($user, $planetrow, $ship_id, false, true)) { |
|
| 49 | 49 | $page .= $lang['fl_noenought']; |
| 50 | 50 | } else { |
| 51 | 51 | $fleet['fleetarray'][$ship_id] = $ship_count; |
@@ -64,13 +64,13 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | -if(empty($fleet['fleetarray'])) { |
|
| 67 | +if (empty($fleet['fleetarray'])) { |
|
| 68 | 68 | messageBox($lang['fl_err_no_ships'], $lang['fl_error'], 'fleet' . DOT_PHP_EX, 5); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | // Building list of shortcuts |
| 72 | 72 | $query = doquery("SELECT * FROM {{notes}} WHERE `owner` = {$user['id']} AND `galaxy` <> 0 AND `system` <> 0 AND `planet` <> 0 ORDER BY `priority` DESC, `galaxy`, `system`, `planet`, `planet_type`;"); |
| 73 | -while($shortcut = db_fetch($query)) { |
|
| 73 | +while ($shortcut = db_fetch($query)) { |
|
| 74 | 74 | $template->assign_block_vars('shortcut', array( |
| 75 | 75 | 'NAME' => $shortcut['title'], |
| 76 | 76 | 'GALAXY' => $shortcut['galaxy'], |
@@ -84,10 +84,10 @@ discard block |
||
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | // Building list of own planets & moons |
| 87 | -$colonies = DBStaticPlanet::db_planet_list_sorted ( $user ); |
|
| 88 | -if(count($colonies) > 1) { |
|
| 87 | +$colonies = DBStaticPlanet::db_planet_list_sorted($user); |
|
| 88 | +if (count($colonies) > 1) { |
|
| 89 | 89 | // while($row = db_fetch($colonies)) |
| 90 | - foreach($colonies as $row) { |
|
| 90 | + foreach ($colonies as $row) { |
|
| 91 | 91 | $template->assign_block_vars('colonies', array( |
| 92 | 92 | 'NAME' => $row['name'], |
| 93 | 93 | 'GALAXY' => $row['galaxy'], |
@@ -102,9 +102,9 @@ discard block |
||
| 102 | 102 | //ACS Start |
| 103 | 103 | //Need to look for acs attacks. |
| 104 | 104 | $aks_madnessred = DbFleetStatic::dbAcsGetAll(); |
| 105 | -while($row = db_fetch($aks_madnessred)) { |
|
| 105 | +while ($row = db_fetch($aks_madnessred)) { |
|
| 106 | 106 | $members = explode(',', $row['eingeladen']); |
| 107 | - foreach($members as $a => $b) { |
|
| 107 | + foreach ($members as $a => $b) { |
|
| 108 | 108 | if ($b == $user['id']) { |
| 109 | 109 | $template->assign_block_vars('acss', array( |
| 110 | 110 | 'ID' => $row['id'], |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | use Planet\DBStaticPlanet; |
| 9 | 9 | use Unit\DBStaticUnit; |
| 10 | 10 | |
| 11 | -if(SN_IN_FLEET !== true) { |
|
| 11 | +if (SN_IN_FLEET !== true) { |
|
| 12 | 12 | $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403); |
| 13 | 13 | } |
| 14 | 14 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | $errorlist .= $lang['fl_limit_galaxy']; |
| 28 | 28 | if (!$system || $system > $config->game_maxSystem || $system < 1) |
| 29 | 29 | $errorlist .= $lang['fl_limit_system']; |
| 30 | - if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE )) |
|
| 30 | + if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE)) |
|
| 31 | 31 | $errorlist .= $lang['fl_limit_planet']; |
| 32 | 32 | if ($planetrow['galaxy'] == $galaxy && $planetrow['system'] == $system && $planetrow['planet'] == $planet && $planetrow['planet_type'] == $planet_type) |
| 33 | 33 | $errorlist .= $lang['fl_ownpl_err']; |
@@ -54,35 +54,35 @@ discard block |
||
| 54 | 54 | $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true); |
| 55 | 55 | |
| 56 | 56 | if ($target_mission == MT_EXPLORE) { |
| 57 | - if ($MaxExpeditions == 0 ) { |
|
| 57 | + if ($MaxExpeditions == 0) { |
|
| 58 | 58 | $errorlist .= $lang['fl_expe_notech']; |
| 59 | - } elseif ($FlyingExpeditions >= $MaxExpeditions ) { |
|
| 59 | + } elseif ($FlyingExpeditions >= $MaxExpeditions) { |
|
| 60 | 60 | $errorlist .= $lang['fl_expe_max']; |
| 61 | 61 | } |
| 62 | 62 | } else { |
| 63 | - if ($TargetPlanet['id_owner']){ |
|
| 63 | + if ($TargetPlanet['id_owner']) { |
|
| 64 | 64 | if ($target_mission == MT_COLONIZE) |
| 65 | 65 | $errorlist .= $lang['fl_colonized']; |
| 66 | 66 | |
| 67 | - if ($TargetPlanet['id_owner'] == $planetrow['id_owner']){ |
|
| 67 | + if ($TargetPlanet['id_owner'] == $planetrow['id_owner']) { |
|
| 68 | 68 | if ($target_mission == MT_ATTACK) |
| 69 | 69 | $errorlist .= $lang['fl_no_self_attack']; |
| 70 | 70 | |
| 71 | 71 | if ($target_mission == MT_SPY) |
| 72 | 72 | $errorlist .= $lang['fl_no_self_spy']; |
| 73 | - }else{ |
|
| 73 | + } else { |
|
| 74 | 74 | if ($target_mission == MT_RELOCATE) |
| 75 | 75 | $errorlist .= $lang['fl_only_stay_at_home']; |
| 76 | 76 | } |
| 77 | - }else{ |
|
| 78 | - if ($target_mission < MT_COLONIZE){ |
|
| 77 | + } else { |
|
| 78 | + if ($target_mission < MT_COLONIZE) { |
|
| 79 | 79 | $errorlist .= $lang['fl_unknow_target']; |
| 80 | - }else{ |
|
| 80 | + } else { |
|
| 81 | 81 | if ($target_mission == MT_DESTROY) |
| 82 | 82 | $errorlist .= $lang['fl_nomoon']; |
| 83 | 83 | |
| 84 | - if ($target_mission == MT_RECYCLE){ |
|
| 85 | - if($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0) |
|
| 84 | + if ($target_mission == MT_RECYCLE) { |
|
| 85 | + if ($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0) |
|
| 86 | 86 | $errorlist .= $lang['fl_nodebris']; |
| 87 | 87 | } |
| 88 | 88 | } |
@@ -90,13 +90,13 @@ discard block |
||
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | |
| 93 | - if(is_object($captainModule = moduleCaptain()) && $captain_id = sys_get_param_id('captain_id')) { |
|
| 93 | + if (is_object($captainModule = moduleCaptain()) && $captain_id = sys_get_param_id('captain_id')) { |
|
| 94 | 94 | $captain = $captainModule->unit_captain_get($planetrow['id']); |
| 95 | 95 | // mrc_get_level($user, $planetrow, UNIT_CAPTAIN, true); |
| 96 | - if(!$captain) { |
|
| 96 | + if (!$captain) { |
|
| 97 | 97 | $errorlist .= $lang['module_unit_captain_error_no_captain']; |
| 98 | - } elseif($captain['unit_location_type'] == LOC_PLANET) { |
|
| 99 | - if($target_mission == MT_RELOCATE && ($arriving_captain = mrc_get_level($user, $TargetPlanet, UNIT_CAPTAIN, true))) { |
|
| 98 | + } elseif ($captain['unit_location_type'] == LOC_PLANET) { |
|
| 99 | + if ($target_mission == MT_RELOCATE && ($arriving_captain = mrc_get_level($user, $TargetPlanet, UNIT_CAPTAIN, true))) { |
|
| 100 | 100 | $errorlist .= $lang['module_unit_captain_error_captain_already_bound']; |
| 101 | 101 | } |
| 102 | 102 | } else { |
@@ -106,13 +106,13 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | if ($errorlist) { |
| 108 | 108 | sn_db_transaction_rollback(); |
| 109 | - messageBox ("<span class='error'><ul>{$errorlist}</ul></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, false); |
|
| 109 | + messageBox("<span class='error'><ul>{$errorlist}</ul></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, false); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | // On verifie s'il y a assez de vaisseaux sur la planete ! |
| 113 | 113 | foreach ($fleetarray as $Ship => $Count) { |
| 114 | 114 | if ($Count > mrc_get_level($user, $planetrow, $Ship)) { |
| 115 | - messageBox ("<span class='error'><b>{$lang['fl_fleet_err']}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
| 115 | + messageBox("<span class='error'><b>{$lang['fl_fleet_err']}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
@@ -120,13 +120,13 @@ discard block |
||
| 120 | 120 | $fleet_group = max(0, intval($_POST['fleet_group'])); |
| 121 | 121 | //But is it acs?? |
| 122 | 122 | //Well all acs fleets must have a fleet code. |
| 123 | - if($fleet_group) { |
|
| 123 | + if ($fleet_group) { |
|
| 124 | 124 | //Also it must be mission type 2 |
| 125 | 125 | $target_mission = MT_AKS; |
| 126 | 126 | |
| 127 | 127 | //The co-ords must be the same as where the acs fleet is going. |
| 128 | 128 | $target = "g{$galaxy}s{$system}p{$planet}t{$planet_type}"; |
| 129 | - if($_POST['acs_target_mr'] == $target) { |
|
| 129 | + if ($_POST['acs_target_mr'] == $target) { |
|
| 130 | 130 | //ACS attack must exist (if acs fleet has arrived this will also return false (2 checks in 1!!!) |
| 131 | 131 | $aks = DbFleetStatic::dbAcsGetById($fleet_group); |
| 132 | 132 | if (!$aks) { |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | 144 | //Check that a failed acs attack isn't being sent, if it is, make it an attack fleet. |
| 145 | - if(!$fleet_group && $target_mission == MT_AKS) { |
|
| 145 | + if (!$fleet_group && $target_mission == MT_AKS) { |
|
| 146 | 146 | $target_mission = MT_ATTACK; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -152,22 +152,21 @@ discard block |
||
| 152 | 152 | $options = [P_FLEET_ATTACK_SPEED_PERCENT_TENTH => $speed_percent, P_FLEET_ATTACK_FLEET_GROUP => $fleet_group, P_FLEET_ATTACK_RESOURCES_SUM => $StorageNeeded]; |
| 153 | 153 | $cant_attack = flt_can_attack($planetrow, $TargetPlanet, $fleetarray, $target_mission, $options); |
| 154 | 154 | |
| 155 | - if($cant_attack !== ATTACK_ALLOWED) { |
|
| 155 | + if ($cant_attack !== ATTACK_ALLOWED) { |
|
| 156 | 156 | messageBox("<span class='error'><b>{$lang['fl_attack_error'][$cant_attack]}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 99); |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | $speed_possible = array(10, 9, 8, 7, 6, 5, 4, 3, 2, 1); |
| 160 | 160 | if (!in_array($speed_percent, $speed_possible)) { |
| 161 | - messageBox ("<span class='error'><b>". $lang['fl_cheat_speed'] ."</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
| 161 | + messageBox("<span class='error'><b>" . $lang['fl_cheat_speed'] . "</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | $fleet['start_time'] = $duration + SN_TIME_NOW; |
| 165 | 165 | |
| 166 | - $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) : |
|
| 167 | - ($target_mission == MT_HOLD ? 12 : 0); |
|
| 168 | - if($max_duration) { |
|
| 166 | + $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) : ($target_mission == MT_HOLD ? 12 : 0); |
|
| 167 | + if ($max_duration) { |
|
| 169 | 168 | $StayDuration = sys_get_param_id('missiontime'); |
| 170 | - if($StayDuration > $max_duration || $StayDuration < 1) { |
|
| 169 | + if ($StayDuration > $max_duration || $StayDuration < 1) { |
|
| 171 | 170 | $debug->warning('Supplying wrong mission time', 'Hack attempt', 302, array('base_dump' => true)); |
| 172 | 171 | die(); |
| 173 | 172 | } |
@@ -177,11 +176,11 @@ discard block |
||
| 177 | 176 | $StayDuration = 0; |
| 178 | 177 | $StayTime = 0; |
| 179 | 178 | } |
| 180 | - $fleet['end_time'] = $StayDuration + (2 * $duration) + SN_TIME_NOW; |
|
| 179 | + $fleet['end_time'] = $StayDuration + (2 * $duration) + SN_TIME_NOW; |
|
| 181 | 180 | |
| 182 | - if($aks && $target_mission == MT_AKS) { |
|
| 183 | - if ($fleet['start_time']>$aks['ankunft']) { |
|
| 184 | - messageBox ($lang['fl_aks_too_slow'] . 'Fleet arrival: ' . date(FMT_DATE_TIME,$fleet['start_time']) . " AKS arrival: " .date(FMT_DATE_TIME,$aks['ankunft']), $lang['fl_error']); |
|
| 181 | + if ($aks && $target_mission == MT_AKS) { |
|
| 182 | + if ($fleet['start_time'] > $aks['ankunft']) { |
|
| 183 | + messageBox($lang['fl_aks_too_slow'] . 'Fleet arrival: ' . date(FMT_DATE_TIME, $fleet['start_time']) . " AKS arrival: " . date(FMT_DATE_TIME, $aks['ankunft']), $lang['fl_error']); |
|
| 185 | 184 | } |
| 186 | 185 | $fleet['start_time'] = $aks['ankunft']; |
| 187 | 186 | $fleet['end_time'] = $aks['ankunft'] + $duration; |
@@ -191,21 +190,21 @@ discard block |
||
| 191 | 190 | $FleetShipCount = 0; |
| 192 | 191 | $db_changeset = array(); |
| 193 | 192 | foreach ($fleetarray as $Ship => $Count) { |
| 194 | - $FleetStorage += get_unit_param($Ship, P_CAPACITY) * $Count; |
|
| 193 | + $FleetStorage += get_unit_param($Ship, P_CAPACITY) * $Count; |
|
| 195 | 194 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($Ship, -$Count, $user, $planetrow['id']); |
| 196 | 195 | } |
| 197 | 196 | $fleet_array = sys_unit_arr2str($fleetarray); |
| 198 | - $FleetShipCount += array_sum($fleetarray); |
|
| 199 | - $FleetStorage -= $consumption; |
|
| 197 | + $FleetShipCount += array_sum($fleetarray); |
|
| 198 | + $FleetStorage -= $consumption; |
|
| 200 | 199 | |
| 201 | - if ( $StorageNeeded > $FleetStorage) { |
|
| 202 | - messageBox ("<span class='error'><b>". $lang['fl_nostoragespa'] . HelperString::numberFloorAndFormat($StorageNeeded - $FleetStorage) ."</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
| 200 | + if ($StorageNeeded > $FleetStorage) { |
|
| 201 | + messageBox("<span class='error'><b>" . $lang['fl_nostoragespa'] . HelperString::numberFloorAndFormat($StorageNeeded - $FleetStorage) . "</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
| 203 | 202 | } |
| 204 | 203 | if ($planetrow['deuterium'] < $TransDeuterium + $consumption) { |
| 205 | - messageBox ("<font color=\"red\"><b>". $lang['fl_no_deuterium'] . HelperString::numberFloorAndFormat($TransDeuterium + $consumption - $planetrow['deuterium']) ."</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
| 204 | + messageBox("<font color=\"red\"><b>" . $lang['fl_no_deuterium'] . HelperString::numberFloorAndFormat($TransDeuterium + $consumption - $planetrow['deuterium']) . "</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
| 206 | 205 | } |
| 207 | 206 | if (($planetrow['metal'] < $TransMetal) || ($planetrow['crystal'] < $TransCrystal)) { |
| 208 | - messageBox ("<font color=\"red\"><b>". $lang['fl_no_resources'] ."</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
| 207 | + messageBox("<font color=\"red\"><b>" . $lang['fl_no_resources'] . "</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
| 209 | 208 | } |
| 210 | 209 | |
| 211 | 210 | $fleet_set = array( |
@@ -247,7 +246,7 @@ discard block |
||
| 247 | 246 | // )); |
| 248 | 247 | // } |
| 249 | 248 | |
| 250 | - if(is_array($captain)) { |
|
| 249 | + if (is_array($captain)) { |
|
| 251 | 250 | DBStaticUnit::db_unit_set_by_id($captain['unit_id'], "`unit_location_type` = " . LOC_FLEET . ", `unit_location_id` = {$fleet_id}"); |
| 252 | 251 | } |
| 253 | 252 | |
@@ -260,7 +259,7 @@ discard block |
||
| 260 | 259 | 'START_LEFT' => floor($fleet['end_time'] + 1 - SN_TIME_NOW), |
| 261 | 260 | ); |
| 262 | 261 | |
| 263 | - if(!empty($TargetPlanet)) { |
|
| 262 | + if (!empty($TargetPlanet)) { |
|
| 264 | 263 | $template_route += array( |
| 265 | 264 | 'END_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$TargetPlanet['planet_type']], |
| 266 | 265 | 'END_COORDS' => uni_render_coordinates($TargetPlanet), |
@@ -273,8 +272,8 @@ discard block |
||
| 273 | 272 | $template->assign_block_vars('fleets', $template_route); |
| 274 | 273 | |
| 275 | 274 | $sn_groups_fleet = sn_get_groups('fleet'); |
| 276 | - foreach($fleetarray as $ship_id => $ship_count) { |
|
| 277 | - if(in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
| 275 | + foreach ($fleetarray as $ship_id => $ship_count) { |
|
| 276 | + if (in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
| 278 | 277 | // $ship_base_data = get_ship_data($ship_id, $user); |
| 279 | 278 | $template->assign_block_vars('fleets.ships', array( |
| 280 | 279 | 'ID' => $ship_id, |