@@ -7,8 +7,7 @@ discard block |
||
7 | 7 | use DBAL\OldDbChangeSet; |
8 | 8 | use Planet\DBStaticPlanet; |
9 | 9 | |
10 | -function COE_missileAttack($defenceTech, $attackerTech, $MIPs, $structures, $targetedStructure = '0') |
|
11 | -{ |
|
10 | +function COE_missileAttack($defenceTech, $attackerTech, $MIPs, $structures, $targetedStructure = '0') { |
|
12 | 11 | // Here we select which part of defense should take damage: structure or shield |
13 | 12 | // $damageTo = P_SHIELD; |
14 | 13 | // $damageTo = P_STRUCTURE; |
@@ -37,8 +36,7 @@ discard block |
||
37 | 36 | $structsDestroyed = min( floor($MIPDamage/$damageDone), $structures[$targetedStructure][0] ); |
38 | 37 | $structures[$targetedStructure][0] -= $structsDestroyed; |
39 | 38 | $MIPDamage -= $structsDestroyed*$damageDone; |
40 | - } |
|
41 | - else |
|
39 | + } else |
|
42 | 40 | { |
43 | 41 | // REALLY random attack |
44 | 42 | $can_be_damaged = sn_get_groups('defense_active'); |
@@ -3,8 +3,7 @@ discard block |
||
3 | 3 | |
4 | 4 | use Planet\DBStaticPlanet; |
5 | 5 | |
6 | -function flt_parse_fleets_to_events($fleet_list, $planet_scanned = false) |
|
7 | -{ |
|
6 | +function flt_parse_fleets_to_events($fleet_list, $planet_scanned = false) { |
|
8 | 7 | global $config, $user, $fleet_number, $lang; |
9 | 8 | |
10 | 9 | $fleet_events = array(); |
@@ -25,12 +24,10 @@ discard block |
||
25 | 24 | if($fleet['fleet_end_planet'] > $config->game_maxPlanet) |
26 | 25 | { |
27 | 26 | $fleet['fleet_end_name'] = $lang['ov_fleet_exploration']; |
28 | - } |
|
29 | - elseif($fleet['fleet_mission'] == MT_COLONIZE) |
|
27 | + } elseif($fleet['fleet_mission'] == MT_COLONIZE) |
|
30 | 28 | { |
31 | 29 | $fleet['fleet_end_name'] = $lang['ov_fleet_colonization']; |
32 | - } |
|
33 | - else |
|
30 | + } else |
|
34 | 31 | { |
35 | 32 | $planet_end = DBStaticPlanet::db_planet_by_gspt($fleet['fleet_end_galaxy'], $fleet['fleet_end_system'], $fleet['fleet_end_planet'], $planet_end_type, false, 'name'); |
36 | 33 | $fleet['fleet_end_name'] = $planet_end['name']; |
@@ -82,8 +79,7 @@ discard block |
||
82 | 79 | return $fleet_events; |
83 | 80 | } |
84 | 81 | |
85 | -function flt_register_fleet_event($fleet, $ov_label, $planet_end_type) |
|
86 | -{ |
|
82 | +function flt_register_fleet_event($fleet, $ov_label, $planet_end_type) { |
|
87 | 83 | global $user, $planetrow, $fleet_number; |
88 | 84 | |
89 | 85 | switch($fleet['ov_label'] = $ov_label) |
@@ -123,8 +119,7 @@ discard block |
||
123 | 119 | if($fleet['fleet_owner'] == $user['id']) |
124 | 120 | { |
125 | 121 | $user_data = $user; |
126 | - } |
|
127 | - else |
|
122 | + } else |
|
128 | 123 | { |
129 | 124 | $user_data = db_user_by_id($fleet['fleet_owner']); |
130 | 125 | } |
@@ -136,8 +131,7 @@ discard block |
||
136 | 131 | * @param array $planetrow |
137 | 132 | * @param template $template |
138 | 133 | */ |
139 | -function int_planet_pretemplate($planetrow, &$template) |
|
140 | -{ |
|
134 | +function int_planet_pretemplate($planetrow, &$template) { |
|
141 | 135 | global $lang, $user; |
142 | 136 | |
143 | 137 | $governor_id = $planetrow['PLANET_GOVERNOR_ID']; |
@@ -2,8 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | use Unit\DBStaticUnit; |
4 | 4 | |
5 | -function eco_lab_sort_effectivness($a, $b) |
|
6 | -{ |
|
5 | +function eco_lab_sort_effectivness($a, $b) { |
|
7 | 6 | return $a['laboratory_effective_level'] > $b['laboratory_effective_level'] ? -1 : ($a['laboratory_effective_level'] < $b['laboratory_effective_level'] ? 1 : 0); |
8 | 7 | } |
9 | 8 | |
@@ -13,8 +12,7 @@ discard block |
||
13 | 12 | * 1.0 - copyright (c) 2010 by Gorlum for http://supernova.ws |
14 | 13 | * @version 1.0 |
15 | 14 | */ |
16 | -function eco_get_lab_max_effective_level(&$user, $lab_require) |
|
17 | -{ |
|
15 | +function eco_get_lab_max_effective_level(&$user, $lab_require) { |
|
18 | 16 | if(!$user['user_as_ally'] && !isset($user['laboratories_active'])) |
19 | 17 | { |
20 | 18 | $user['laboratories_active'] = array(); |
@@ -40,8 +38,7 @@ discard block |
||
40 | 38 | if($user['user_as_ally']) |
41 | 39 | { |
42 | 40 | $lab_level = doquery("SELECT ally_members AS effective_level FROM {{alliance}} WHERE id = {$user['user_as_ally']} LIMIT 1", true); |
43 | - } |
|
44 | - else |
|
41 | + } else |
|
45 | 42 | { |
46 | 43 | $tech_intergalactic = mrc_get_level($user, false, TECH_RESEARCH) + 1; |
47 | 44 | $lab_level['effective_level'] = 0; |
@@ -219,8 +216,7 @@ discard block |
||
219 | 216 | return $result; |
220 | 217 | } |
221 | 218 | |
222 | -function eco_is_builds_in_que($planet_que, $unit_list) |
|
223 | -{ |
|
219 | +function eco_is_builds_in_que($planet_que, $unit_list) { |
|
224 | 220 | $eco_is_builds_in_que = false; |
225 | 221 | |
226 | 222 | $unit_list = is_array($unit_list) ? $unit_list : array($unit_list => $unit_list); |
@@ -242,8 +238,7 @@ discard block |
||
242 | 238 | } |
243 | 239 | |
244 | 240 | function eco_unit_busy(&$user, &$planet, $unit_id){$result = null;return sn_function_call('eco_unit_busy', [&$user, &$planet, $unit_id, &$result]);} |
245 | -function sn_eco_unit_busy(&$user, &$planet, $unit_id, &$result) |
|
246 | -{ |
|
241 | +function sn_eco_unit_busy(&$user, &$planet, $unit_id, &$result) { |
|
247 | 242 | global $config; |
248 | 243 | |
249 | 244 | $result = isset($result) ? $result : false; |
@@ -264,8 +259,7 @@ discard block |
||
264 | 259 | //{ |
265 | 260 | // $result = true; |
266 | 261 | //} |
267 | - } |
|
268 | - elseif(($unit_id == UNIT_TECHNOLOGIES || in_array($unit_id, sn_get_groups('tech'))) && !$config->BuildLabWhileRun && $planet['que']) |
|
262 | + } elseif(($unit_id == UNIT_TECHNOLOGIES || in_array($unit_id, sn_get_groups('tech'))) && !$config->BuildLabWhileRun && $planet['que']) |
|
269 | 263 | { |
270 | 264 | $result = eco_is_builds_in_que($planet['que'], array(STRUC_LABORATORY, STRUC_LABORATORY_NANO)); |
271 | 265 | } |
@@ -3,8 +3,7 @@ discard block |
||
3 | 3 | use DBAL\OldDbChangeSet; |
4 | 4 | use Planet\DBStaticPlanet; |
5 | 5 | |
6 | -function flt_fleet_speed($user, $fleet) |
|
7 | -{ |
|
6 | +function flt_fleet_speed($user, $fleet) { |
|
8 | 7 | if (!is_array($fleet)) |
9 | 8 | { |
10 | 9 | $fleet = array($fleet => 1); |
@@ -32,16 +31,13 @@ discard block |
||
32 | 31 | if($from['galaxy'] != $to['galaxy']) |
33 | 32 | { |
34 | 33 | $distance = abs($from['galaxy'] - $to['galaxy']) * $config->uni_galaxy_distance; |
35 | - } |
|
36 | - elseif($from['system'] != $to['system']) |
|
34 | + } elseif($from['system'] != $to['system']) |
|
37 | 35 | { |
38 | 36 | $distance = abs($from['system'] - $to['system']) * 5 * 19 + 2700; |
39 | - } |
|
40 | - elseif($from['planet'] != $to['planet']) |
|
37 | + } elseif($from['planet'] != $to['planet']) |
|
41 | 38 | { |
42 | 39 | $distance = abs($from['planet'] - $to['planet']) * 5 + 1000; |
43 | - } |
|
44 | - else |
|
40 | + } else |
|
45 | 41 | { |
46 | 42 | $distance = 5; |
47 | 43 | } |
@@ -58,8 +54,7 @@ discard block |
||
58 | 54 | * |
59 | 55 | * @return array |
60 | 56 | */ |
61 | -function flt_travel_data($user_row, $from, $to, $fleet_array, $speed_percent = 10) |
|
62 | -{ |
|
57 | +function flt_travel_data($user_row, $from, $to, $fleet_array, $speed_percent = 10) { |
|
63 | 58 | $distance = flt_travel_distance($from, $to); |
64 | 59 | |
65 | 60 | $consumption = 0; |
@@ -123,8 +118,7 @@ discard block |
||
123 | 118 | ); |
124 | 119 | } |
125 | 120 | |
126 | -function flt_bashing_check($user, $enemy, $planet_dst, $mission, $flight_duration, $fleet_group = 0) |
|
127 | -{ |
|
121 | +function flt_bashing_check($user, $enemy, $planet_dst, $mission, $flight_duration, $fleet_group = 0) { |
|
128 | 122 | global $config; |
129 | 123 | |
130 | 124 | $config_bashing_attacks = $config->fleet_bashing_attacks; |
@@ -534,8 +528,7 @@ discard block |
||
534 | 528 | $fleet_ship_count += $amount; |
535 | 529 | $fleet_string .= "{$unit_id},{$amount};"; |
536 | 530 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, -$amount, $user, $from['id']); |
537 | - } |
|
538 | - elseif(in_array($unit_id, sn_get_groups('resources_loot'))) |
|
531 | + } elseif(in_array($unit_id, sn_get_groups('resources_loot'))) |
|
539 | 532 | { |
540 | 533 | $planet_fields[pname_resource_name($unit_id)]['delta'] -= $amount; |
541 | 534 | } |
@@ -627,8 +620,7 @@ discard block |
||
627 | 620 | //ini_set('error_reporting', E_ALL ^ E_NOTICE); |
628 | 621 | } |
629 | 622 | |
630 | -function flt_calculate_ship_to_transport_sort($a, $b) |
|
631 | -{ |
|
623 | +function flt_calculate_ship_to_transport_sort($a, $b) { |
|
632 | 624 | return $a['transport_effectivness'] == $b['transport_effectivness'] ? 0 : ($a['transport_effectivness'] > $b['transport_effectivness'] ? -1 : 1); |
633 | 625 | } |
634 | 626 | |
@@ -637,8 +629,7 @@ discard block |
||
637 | 629 | // $resource_amount - how much amount of resources need to be transported |
638 | 630 | // $from - transport from |
639 | 631 | // $to - transport to |
640 | -function flt_calculate_fleet_to_transport($ship_list, $resource_amount, $from, $to) |
|
641 | -{ |
|
632 | +function flt_calculate_fleet_to_transport($ship_list, $resource_amount, $from, $to) { |
|
642 | 633 | global $user; |
643 | 634 | |
644 | 635 | $ship_data = array(); |
@@ -5,8 +5,7 @@ discard block |
||
5 | 5 | use Que\DBStaticQue; |
6 | 6 | use Universe\Universe; |
7 | 7 | |
8 | -function art_use(&$user, &$planetrow, $unit_id) |
|
9 | -{ |
|
8 | +function art_use(&$user, &$planetrow, $unit_id) { |
|
10 | 9 | global $lang; |
11 | 10 | |
12 | 11 | if(!in_array($unit_id, sn_get_groups('artifacts'))) |
@@ -53,14 +52,12 @@ discard block |
||
53 | 52 | { |
54 | 53 | $new_moon_row = uni_create_moon($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], $user['id'], $moonSize, $updateDebris); |
55 | 54 | $message = sprintf($lang['art_moon_create'][$unit_id], $new_moon_row['name'], uni_render_coordinates($planetrow), HelperString::numberFloorAndFormat($moonSize)); |
56 | - } |
|
57 | - else |
|
55 | + } else |
|
58 | 56 | { |
59 | 57 | $message = $lang['art_lhc_moon_fail']; |
60 | 58 | } |
61 | 59 | msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_ADMIN, $lang['art_lhc_from'], $lang['art_lhc_subj'], $message); |
62 | - } |
|
63 | - else |
|
60 | + } else |
|
64 | 61 | { |
65 | 62 | $message = $lang['art_moon_exists']; |
66 | 63 | } |
@@ -88,8 +85,9 @@ discard block |
||
88 | 85 | $sectors_used = 0; |
89 | 86 | foreach($artifact_deploy as $deploy_unit_id => $deploy_unit_level) |
90 | 87 | { |
91 | - if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) |
|
92 | - continue; |
|
88 | + if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) { |
|
89 | + continue; |
|
90 | + } |
|
93 | 91 | $sectors_used += $levels_deployed; |
94 | 92 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($deploy_unit_id, $levels_deployed, $user, $planetrow['id']); |
95 | 93 | } |
@@ -123,8 +121,7 @@ discard block |
||
123 | 121 | DBStaticQue::db_que_set_time_left_by_id($que_item['que_id'], $que_item['que_time_left']); |
124 | 122 | $message = sprintf($lang['art_heurestic_chip_ok'], $lang['tech'][$que_item['que_unit_id']], $que_item['que_unit_level'], sys_time_human($old_time - $que_item['que_time_left'])); |
125 | 123 | msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_QUE, $lang['art_heurestic_chip_subj'], $lang['art_heurestic_chip_subj'], $message); |
126 | - } |
|
127 | - else |
|
124 | + } else |
|
128 | 125 | { |
129 | 126 | $message = $lang['art_heurestic_chip_no_research']; |
130 | 127 | } |
@@ -152,8 +149,7 @@ discard block |
||
152 | 149 | $lang['tech'][$que_item['que_unit_id']], $que_item['que_unit_level'], $planetrow['name'], uni_render_coordinates($planetrow), sys_time_human($old_time - $que_item['que_time_left']) |
153 | 150 | ); |
154 | 151 | msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_QUE, $lang['art_nano_builder_subj'], $lang['art_nano_builder_subj'], $message); |
155 | - } |
|
156 | - else |
|
152 | + } else |
|
157 | 153 | { |
158 | 154 | $message = $lang['art_nano_builder_no_que']; |
159 | 155 | } |
@@ -165,8 +161,7 @@ discard block |
||
165 | 161 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, $unit_level - $artifact_level_old, $user); |
166 | 162 | OldDbChangeSet::db_changeset_apply($db_changeset); |
167 | 163 | } |
168 | - } |
|
169 | - else |
|
164 | + } else |
|
170 | 165 | { |
171 | 166 | $message = $lang['art_err_no_artifact']; |
172 | 167 | } |