@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | { |
5 | 5 | global $lang; |
6 | 6 | |
7 | - if(!in_array($unit_id, sn_get_groups('artifacts'))) |
|
7 | + if (!in_array($unit_id, sn_get_groups('artifacts'))) |
|
8 | 8 | { |
9 | 9 | return; |
10 | 10 | } |
@@ -13,17 +13,17 @@ discard block |
||
13 | 13 | $user = db_user_by_id($user['id'], true); |
14 | 14 | |
15 | 15 | $unit_level = $artifact_level_old = mrc_get_level($user, array(), $unit_id, true); |
16 | - if($unit_level > 0) |
|
16 | + if ($unit_level > 0) |
|
17 | 17 | { |
18 | 18 | $db_changeset = array(); |
19 | - switch($unit_id) |
|
19 | + switch ($unit_id) |
|
20 | 20 | { |
21 | 21 | case ART_LHC: |
22 | 22 | case ART_HOOK_SMALL: |
23 | 23 | case ART_HOOK_MEDIUM: |
24 | 24 | case ART_HOOK_LARGE: |
25 | 25 | $has_moon = DBStaticPlanet::db_planet_by_parent($planetrow['id'], true, '`id`'); |
26 | - if($planetrow['planet_type'] == PT_PLANET && !$has_moon['id']) |
|
26 | + if ($planetrow['planet_type'] == PT_PLANET && !$has_moon['id']) |
|
27 | 27 | { |
28 | 28 | $unit_level--; |
29 | 29 | $updateDebris = false; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | break; |
45 | 45 | } |
46 | 46 | |
47 | - if($moonSize) |
|
47 | + if ($moonSize) |
|
48 | 48 | { |
49 | 49 | $new_moon_row = uni_create_moon($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], $user['id'], $moonSize, $updateDebris); |
50 | 50 | $message = sprintf($lang['art_moon_create'][$unit_id], $new_moon_row['name'], uni_render_coordinates($planetrow), HelperString::numberFloorAndFormat($moonSize)); |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | case ART_RCD_MEDIUM: |
66 | 66 | case ART_RCD_LARGE: |
67 | 67 | $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true); |
68 | - if($planetrow['planet_type'] != PT_PLANET) |
|
68 | + if ($planetrow['planet_type'] != PT_PLANET) |
|
69 | 69 | { |
70 | 70 | $message = $lang['art_rcd_err_moon']; |
71 | 71 | break; |
72 | 72 | } |
73 | 73 | |
74 | 74 | $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, false); |
75 | - if(!empty($que['items'])) |
|
75 | + if (!empty($que['items'])) |
|
76 | 76 | { |
77 | 77 | $message = $lang['art_rcd_err_que']; |
78 | 78 | break; |
@@ -81,15 +81,15 @@ discard block |
||
81 | 81 | $artifact_deploy = get_unit_param($unit_id, P_DEPLOY); |
82 | 82 | |
83 | 83 | $sectors_used = 0; |
84 | - foreach($artifact_deploy as $deploy_unit_id => $deploy_unit_level) |
|
84 | + foreach ($artifact_deploy as $deploy_unit_id => $deploy_unit_level) |
|
85 | 85 | { |
86 | - if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) |
|
86 | + if (!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) |
|
87 | 87 | continue; |
88 | 88 | $sectors_used += $levels_deployed; |
89 | 89 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($deploy_unit_id, $levels_deployed, $user, $planetrow['id']); |
90 | 90 | } |
91 | 91 | |
92 | - if($sectors_used == 0) |
|
92 | + if ($sectors_used == 0) |
|
93 | 93 | { |
94 | 94 | $message = $lang['art_rcd_err_no_sense']; |
95 | 95 | break; |
@@ -104,13 +104,13 @@ discard block |
||
104 | 104 | $que_item = null; |
105 | 105 | $que = que_get($user['id'], $planetrow['id'], QUE_RESEARCH, true); |
106 | 106 | $current_que = &$que['ques'][QUE_RESEARCH][$user['id']][0]; |
107 | - if(!empty($current_que)) |
|
107 | + if (!empty($current_que)) |
|
108 | 108 | { |
109 | 109 | reset($current_que); |
110 | 110 | $que_item = &$que['ques'][QUE_RESEARCH][$user['id']][0][key($current_que)]; |
111 | 111 | } |
112 | 112 | |
113 | - if(!empty($que_item) && $que_item['que_time_left'] > 60) |
|
113 | + if (!empty($que_item) && $que_item['que_time_left'] > 60) |
|
114 | 114 | { |
115 | 115 | $unit_level--; |
116 | 116 | $old_time = $que_item['que_time_left']; |
@@ -131,13 +131,13 @@ discard block |
||
131 | 131 | $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, true); |
132 | 132 | $current_que = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']]; |
133 | 133 | // $que_item = &$que['que'][QUE_STRUCTURES][0]; |
134 | - if(!empty($current_que)) |
|
134 | + if (!empty($current_que)) |
|
135 | 135 | { |
136 | 136 | reset($current_que); |
137 | 137 | $que_item = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']][key($current_que)]; |
138 | 138 | } |
139 | 139 | |
140 | - if(isset($que_item) && $que_item['que_time_left'] > 60) |
|
140 | + if (isset($que_item) && $que_item['que_time_left'] > 60) |
|
141 | 141 | { |
142 | 142 | $unit_level--; |
143 | 143 | $old_time = $que_item['que_time_left']; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | break; |
156 | 156 | |
157 | 157 | } |
158 | - if($unit_level != $artifact_level_old) |
|
158 | + if ($unit_level != $artifact_level_old) |
|
159 | 159 | { |
160 | 160 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, $unit_level - $artifact_level_old, $user); |
161 | 161 | OldDbChangeSet::db_changeset_apply($db_changeset); |
@@ -1,7 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -function art_use(&$user, &$planetrow, $unit_id) |
|
4 | -{ |
|
3 | +function art_use(&$user, &$planetrow, $unit_id) { |
|
5 | 4 | global $lang; |
6 | 5 | |
7 | 6 | if(!in_array($unit_id, sn_get_groups('artifacts'))) |
@@ -48,14 +47,12 @@ discard block |
||
48 | 47 | { |
49 | 48 | $new_moon_row = uni_create_moon($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], $user['id'], $moonSize, $updateDebris); |
50 | 49 | $message = sprintf($lang['art_moon_create'][$unit_id], $new_moon_row['name'], uni_render_coordinates($planetrow), HelperString::numberFloorAndFormat($moonSize)); |
51 | - } |
|
52 | - else |
|
50 | + } else |
|
53 | 51 | { |
54 | 52 | $message = $lang['art_lhc_moon_fail']; |
55 | 53 | } |
56 | 54 | msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_ADMIN, $lang['art_lhc_from'], $lang['art_lhc_subj'], $message); |
57 | - } |
|
58 | - else |
|
55 | + } else |
|
59 | 56 | { |
60 | 57 | $message = $lang['art_moon_exists']; |
61 | 58 | } |
@@ -83,8 +80,9 @@ discard block |
||
83 | 80 | $sectors_used = 0; |
84 | 81 | foreach($artifact_deploy as $deploy_unit_id => $deploy_unit_level) |
85 | 82 | { |
86 | - if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) |
|
87 | - continue; |
|
83 | + if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) { |
|
84 | + continue; |
|
85 | + } |
|
88 | 86 | $sectors_used += $levels_deployed; |
89 | 87 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($deploy_unit_id, $levels_deployed, $user, $planetrow['id']); |
90 | 88 | } |
@@ -118,8 +116,7 @@ discard block |
||
118 | 116 | DBStaticQue::db_que_set_time_left_by_id($que_item['que_id'], $que_item['que_time_left']); |
119 | 117 | $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'])); |
120 | 118 | msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_QUE, $lang['art_heurestic_chip_subj'], $lang['art_heurestic_chip_subj'], $message); |
121 | - } |
|
122 | - else |
|
119 | + } else |
|
123 | 120 | { |
124 | 121 | $message = $lang['art_heurestic_chip_no_research']; |
125 | 122 | } |
@@ -147,8 +144,7 @@ discard block |
||
147 | 144 | $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']) |
148 | 145 | ); |
149 | 146 | msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_QUE, $lang['art_nano_builder_subj'], $lang['art_nano_builder_subj'], $message); |
150 | - } |
|
151 | - else |
|
147 | + } else |
|
152 | 148 | { |
153 | 149 | $message = $lang['art_nano_builder_no_que']; |
154 | 150 | } |
@@ -160,8 +156,7 @@ discard block |
||
160 | 156 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, $unit_level - $artifact_level_old, $user); |
161 | 157 | OldDbChangeSet::db_changeset_apply($db_changeset); |
162 | 158 | } |
163 | - } |
|
164 | - else |
|
159 | + } else |
|
165 | 160 | { |
166 | 161 | $message = $lang['art_err_no_artifact']; |
167 | 162 | } |
@@ -72,7 +72,7 @@ |
||
72 | 72 | // Для не-симулятора - рандомизируем каждый раунд значения атаки и щитов |
73 | 73 | $fleet_data[UBE_ATTACK_BASE][$unit_id] = floor($fleet_info[UBE_ATTACK][$unit_id] * ($isSimulatorStatic ? 1 : mt_rand(80, 120) / 100)); |
74 | 74 | $fleet_data[UBE_SHIELD_BASE][$unit_id] = floor($fleet_info[UBE_SHIELD][$unit_id] * ($isSimulatorStatic ? 1 : mt_rand(80, 120) / 100)); |
75 | - $fleet_data[UBE_ARMOR_BASE][$unit_id] = floor($fleet_info[UBE_ARMOR][$unit_id]);// * ($is_simulator ? 1 : mt_rand(80, 120) / 100)); |
|
75 | + $fleet_data[UBE_ARMOR_BASE][$unit_id] = floor($fleet_info[UBE_ARMOR][$unit_id]); // * ($is_simulator ? 1 : mt_rand(80, 120) / 100)); |
|
76 | 76 | |
77 | 77 | $fleet_data[UBE_ATTACK][$unit_id] = $fleet_data[UBE_ATTACK_BASE][$unit_id] * $unit_count; |
78 | 78 | $fleet_data[UBE_SHIELD][$unit_id] = $fleet_data[UBE_SHIELD_BASE][$unit_id] * $unit_count; |
@@ -8,8 +8,8 @@ |
||
8 | 8 | const MOON_MIN_SIZE = 1100; |
9 | 9 | const MOON_MAX_SIZE = 8999; |
10 | 10 | |
11 | - const MOON_DEBRIS_MIN = 1000000; // Minimum amount of debris to span a moon |
|
12 | - const MOON_CHANCE_MIN_PERCENT = 1; // Minimum chance to span a moon |
|
11 | + const MOON_DEBRIS_MIN = 1000000; // Minimum amount of debris to span a moon |
|
12 | + const MOON_CHANCE_MIN_PERCENT = 1; // Minimum chance to span a moon |
|
13 | 13 | const MOON_CHANCE_MAX_PERCENT = 30; // Maximum chance to span a moon |
14 | 14 | |
15 | 15 | /** |