@@ -11,6 +11,9 @@ discard block |
||
11 | 11 | |
12 | 12 | require_once('db/db_queries.php'); |
13 | 13 | |
14 | +/** |
|
15 | + * @param string $tablename |
|
16 | + */ |
|
14 | 17 | function db_change_units_perform($query, $tablename, $object_id) { |
15 | 18 | $query = implode(',', $query); |
16 | 19 | if($query && $object_id) { |
@@ -67,11 +70,8 @@ discard block |
||
67 | 70 | /** |
68 | 71 | * Функция проверяет статус транзакции |
69 | 72 | * |
70 | - * @param null|true|false $status Должна ли быть запущена транзакция в момент проверки |
|
71 | - * <p>null - транзакция НЕ должна быть запущена</p> |
|
72 | - * <p>true - транзакция должна быть запущена - для совместимости с $for_update</p> |
|
73 | - * <p>false - всё равно - для совместимости с $for_update</p> |
|
74 | - * @return bool Текущий статус транзакции |
|
73 | + * @param boolean $transaction_should_be_started |
|
74 | + * @return null|boolean Текущий статус транзакции |
|
75 | 75 | */ |
76 | 76 | function sn_db_transaction_check($transaction_should_be_started = null) { |
77 | 77 | return classSupernova::db_transaction_check($transaction_should_be_started); |
@@ -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 classSupernova::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; |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | |
23 | 23 | $sn_group_artifacts = sn_get_groups('artifacts'); |
24 | 24 | |
25 | -if(($action = sys_get_param_int('action')) && in_array($unit_id = sys_get_param_int('unit_id'), $sn_group_artifacts)) |
|
25 | +if (($action = sys_get_param_int('action')) && in_array($unit_id = sys_get_param_int('unit_id'), $sn_group_artifacts)) |
|
26 | 26 | { |
27 | - switch($action) |
|
27 | + switch ($action) |
|
28 | 28 | { |
29 | 29 | case ACTION_BUY: |
30 | 30 | sn_db_transaction_start(); |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | $darkmater_cost = $build_data[BUILD_CREATE][RES_DARK_MATTER]; |
37 | 37 | |
38 | 38 | // TODO: more correct check - with "FOR UPDATE" |
39 | - if(mrc_get_level($user, null, RES_DARK_MATTER) >= $darkmater_cost) |
|
39 | + if (mrc_get_level($user, null, RES_DARK_MATTER) >= $darkmater_cost) |
|
40 | 40 | { |
41 | 41 | $unit_max_stack = get_unit_param($unit_id, P_MAX_STACK); |
42 | - if(!isset($unit_max_stack) || $unit_max_stack > mrc_get_level($user, $planetrow, $unit_id)) |
|
42 | + if (!isset($unit_max_stack) || $unit_max_stack > mrc_get_level($user, $planetrow, $unit_id)) |
|
43 | 43 | { |
44 | 44 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, 1, $user); |
45 | 45 | OldDbChangeSet::db_changeset_apply($db_changeset); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | $template = gettemplate('artifacts', true); |
75 | 75 | |
76 | -foreach($sn_group_artifacts as $artifact_id) |
|
76 | +foreach ($sn_group_artifacts as $artifact_id) |
|
77 | 77 | { |
78 | 78 | $artifact_level = mrc_get_level($user, array(), $artifact_id, true); |
79 | 79 | $build_data = eco_get_build_data($user, $planetrow, $artifact_id, $artifact_level); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $artifact_data = get_unit_param($artifact_id); |
82 | 82 | $artifact_data_bonus = $artifact_data['bonus']; |
83 | 83 | $artifact_data_bonus = $artifact_data_bonus >= 0 ? "+{$artifact_data_bonus}" : "{$artifact_data_bonus}"; |
84 | - switch($artifact_data['bonus_type']) |
|
84 | + switch ($artifact_data['bonus_type']) |
|
85 | 85 | { |
86 | 86 | case BONUS_PERCENT: |
87 | 87 | $artifact_data_bonus = "{$artifact_data_bonus}% "; |
@@ -46,13 +46,11 @@ |
||
46 | 46 | rpg_points_change($user['id'], RPG_ARTIFACT, -($darkmater_cost), "Spent for artifact {$lang['tech'][$unit_id]} ID {$unit_id}"); |
47 | 47 | sn_db_transaction_commit(); |
48 | 48 | sys_redirect("artifacts.php#{$unit_id}"); |
49 | - } |
|
50 | - else |
|
49 | + } else |
|
51 | 50 | { |
52 | 51 | $Message = $lang['off_maxed_out']; |
53 | 52 | } |
54 | - } |
|
55 | - else |
|
53 | + } else |
|
56 | 54 | { |
57 | 55 | $Message = $lang['sys_no_points']; |
58 | 56 | } |
@@ -5,14 +5,14 @@ |
||
5 | 5 | */ |
6 | 6 | global $template; |
7 | 7 | |
8 | -if(isset($sn_page_name) || ($sn_page_name = isset($_GET['page']) ? trim(strip_tags($_GET['page'])) : '')) { |
|
8 | +if (isset($sn_page_name) || ($sn_page_name = isset($_GET['page']) ? trim(strip_tags($_GET['page'])) : '')) { |
|
9 | 9 | require_once('common.' . substr(strrchr(__FILE__, '.'), 1)); |
10 | - if($sn_page_name) { |
|
10 | + if ($sn_page_name) { |
|
11 | 11 | // Loading page-specific language files |
12 | 12 | |
13 | 13 | !empty($sn_mvc['model'][$sn_page_name]) and execute_hooks($sn_mvc['model'][$sn_page_name], $template, 'model', $sn_page_name); |
14 | 14 | !empty($sn_mvc['view'][$sn_page_name]) and execute_hooks($sn_mvc['view'][$sn_page_name], $template, 'view', $sn_page_name); |
15 | - if(!empty($template_result) && is_object($template)) { |
|
15 | + if (!empty($template_result) && is_object($template)) { |
|
16 | 16 | $template->assign_recursive($template_result); |
17 | 17 | } |
18 | 18 |
@@ -104,13 +104,13 @@ discard block |
||
104 | 104 | // Trying to load configuration from file |
105 | 105 | $config_exists = false; |
106 | 106 | // Конфигурация может лежать в config_path в манифеста или в корне модуля |
107 | - if(isset($this->manifest['config_path']) && file_exists($config_filename = $this->manifest['config_path'] . '/config.php')) { |
|
107 | + if (isset($this->manifest['config_path']) && file_exists($config_filename = $this->manifest['config_path'] . '/config.php')) { |
|
108 | 108 | $config_exists = true; |
109 | - } elseif(file_exists($config_filename = dirname($filename) . '/config.php')) { |
|
109 | + } elseif (file_exists($config_filename = dirname($filename) . '/config.php')) { |
|
110 | 110 | $config_exists = true; |
111 | 111 | } |
112 | 112 | |
113 | - if($config_exists) { |
|
113 | + if ($config_exists) { |
|
114 | 114 | include($config_filename); |
115 | 115 | $module_config_array = $class_module_name . '_config'; |
116 | 116 | $this->config = $$module_config_array; |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | } |
122 | 122 | |
123 | 123 | protected function __patch_menu(&$sn_menu_extra, &$menu_patch) { |
124 | - if(isset($menu_patch) && is_array($menu_patch) && !empty($menu_patch)) { |
|
125 | - foreach($menu_patch as $menu_item_name => $menu_item_data) { |
|
124 | + if (isset($menu_patch) && is_array($menu_patch) && !empty($menu_patch)) { |
|
125 | + foreach ($menu_patch as $menu_item_name => $menu_item_data) { |
|
126 | 126 | $sn_menu_extra[$menu_item_name] = $menu_item_data; |
127 | 127 | } |
128 | 128 | } |
@@ -132,13 +132,13 @@ discard block |
||
132 | 132 | public function initialize() { |
133 | 133 | // Checking module status - is it installed and active |
134 | 134 | $this->check_status(); |
135 | - if(!$this->manifest['active']) { |
|
135 | + if (!$this->manifest['active']) { |
|
136 | 136 | return; |
137 | 137 | } |
138 | 138 | |
139 | 139 | // Setting constants - if any |
140 | - if(isset($this->manifest['constants']) && is_array($this->manifest['constants']) && !empty($this->manifest['constants'])) { |
|
141 | - foreach($this->manifest['constants'] as $constant_name => $constant_value) { |
|
140 | + if (isset($this->manifest['constants']) && is_array($this->manifest['constants']) && !empty($this->manifest['constants'])) { |
|
141 | + foreach ($this->manifest['constants'] as $constant_name => $constant_value) { |
|
142 | 142 | defined($constant_name) or define($constant_name, $constant_value); |
143 | 143 | } |
144 | 144 | } |
@@ -149,34 +149,34 @@ discard block |
||
149 | 149 | // New values from module variables will overwrite previous values (for root variables) and array elements with corresponding indexes (for arrays) |
150 | 150 | // Constants as array indexes are honored - it's make valid such declarations as 'sn_data[ques][QUE_STRUCTURES]' |
151 | 151 | $this->manifest['vars'] = $this->__assign_vars(); |
152 | - if(!empty($this->manifest['vars'])) { |
|
152 | + if (!empty($this->manifest['vars'])) { |
|
153 | 153 | $vars_assigned = array(); |
154 | - foreach($this->manifest['vars'] as $var_name => $var_value) { |
|
154 | + foreach ($this->manifest['vars'] as $var_name => $var_value) { |
|
155 | 155 | $sub_vars = explode('[', str_replace(']', '', $var_name)); |
156 | 156 | $var_name = $sub_vars[0]; |
157 | 157 | |
158 | - if(!isset($vars_assigned[$var_name])) { |
|
158 | + if (!isset($vars_assigned[$var_name])) { |
|
159 | 159 | $vars_assigned[$var_name] = true; |
160 | 160 | global $$var_name; |
161 | 161 | } |
162 | 162 | |
163 | 163 | $pointer = &$$var_name; |
164 | - if(($n = count($sub_vars)) > 1) { |
|
165 | - for($i = 1; $i < $n; $i++) { |
|
166 | - if(defined($sub_vars[$i])) { |
|
164 | + if (($n = count($sub_vars)) > 1) { |
|
165 | + for ($i = 1; $i < $n; $i++) { |
|
166 | + if (defined($sub_vars[$i])) { |
|
167 | 167 | $sub_vars[$i] = constant($sub_vars[$i]); |
168 | 168 | } |
169 | 169 | |
170 | - if(!isset($pointer[$sub_vars[$i]]) && $i != $n) { |
|
170 | + if (!isset($pointer[$sub_vars[$i]]) && $i != $n) { |
|
171 | 171 | $pointer[$sub_vars[$i]] = array(); |
172 | 172 | } |
173 | 173 | $pointer = &$pointer[$sub_vars[$i]]; |
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
177 | - if(!isset($pointer) || !is_array($pointer)) { |
|
177 | + if (!isset($pointer) || !is_array($pointer)) { |
|
178 | 178 | $pointer = $var_value; |
179 | - } elseif(is_array($$var_name)) { |
|
179 | + } elseif (is_array($$var_name)) { |
|
180 | 180 | $pointer = array_merge_recursive_numeric($pointer, $var_value); |
181 | 181 | } |
182 | 182 | } |
@@ -192,50 +192,50 @@ discard block |
||
192 | 192 | isset($this->manifest['menu_admin']) and $this->__patch_menu($sn_menu_admin_extra, $this->manifest['menu_admin']); |
193 | 193 | |
194 | 194 | global $sn_mvc; |
195 | - foreach($sn_mvc as $handler_type => &$handler_data) { |
|
195 | + foreach ($sn_mvc as $handler_type => &$handler_data) { |
|
196 | 196 | sn_sys_handler_add($handler_data, $this->manifest['mvc'][$handler_type], $this, $handler_type); |
197 | 197 | } |
198 | 198 | |
199 | - if(isset($this->manifest['i18n']) && is_array($this->manifest['i18n']) && !empty($this->manifest['i18n'])) { |
|
200 | - foreach($this->manifest['i18n'] as $i18n_page_name => &$i18n_file_list) { |
|
201 | - foreach($i18n_file_list as &$i18n_file_data) { |
|
202 | - if(is_array($i18n_file_data) && !$i18n_file_data['path']) { |
|
199 | + if (isset($this->manifest['i18n']) && is_array($this->manifest['i18n']) && !empty($this->manifest['i18n'])) { |
|
200 | + foreach ($this->manifest['i18n'] as $i18n_page_name => &$i18n_file_list) { |
|
201 | + foreach ($i18n_file_list as &$i18n_file_data) { |
|
202 | + if (is_array($i18n_file_data) && !$i18n_file_data['path']) { |
|
203 | 203 | $i18n_file_data['path'] = $this->manifest['root_relative']; |
204 | 204 | } |
205 | 205 | } |
206 | - if(!isset($sn_mvc['i18n'][$i18n_page_name])) { |
|
206 | + if (!isset($sn_mvc['i18n'][$i18n_page_name])) { |
|
207 | 207 | $sn_mvc['i18n'][$i18n_page_name] = array(); |
208 | 208 | } |
209 | 209 | $sn_mvc['i18n'][$i18n_page_name] += $i18n_file_list; |
210 | 210 | } |
211 | 211 | } |
212 | 212 | |
213 | - if(!empty($this->manifest['javascript']) && is_array($this->manifest['javascript'])) { |
|
214 | - foreach($this->manifest['javascript'] as $javascript_page_name => &$javascript_list) { |
|
213 | + if (!empty($this->manifest['javascript']) && is_array($this->manifest['javascript'])) { |
|
214 | + foreach ($this->manifest['javascript'] as $javascript_page_name => &$javascript_list) { |
|
215 | 215 | !isset($sn_mvc['javascript'][$javascript_page_name]) ? $sn_mvc['javascript'][$javascript_page_name] = array() : false; |
216 | - foreach($javascript_list as $script_name => &$script_content) { |
|
216 | + foreach ($javascript_list as $script_name => &$script_content) { |
|
217 | 217 | $sn_mvc['javascript'][$javascript_page_name][$script_name] = $script_content; |
218 | 218 | } |
219 | 219 | } |
220 | 220 | } |
221 | 221 | |
222 | - if(!empty($this->manifest['css']) && is_array($this->manifest['css'])) { |
|
223 | - foreach($this->manifest['css'] as $javascript_page_name => &$javascript_list) { |
|
222 | + if (!empty($this->manifest['css']) && is_array($this->manifest['css'])) { |
|
223 | + foreach ($this->manifest['css'] as $javascript_page_name => &$javascript_list) { |
|
224 | 224 | !isset($sn_mvc['css'][$javascript_page_name]) ? $sn_mvc['css'][$javascript_page_name] = array() : false; |
225 | - foreach($javascript_list as $script_name => &$script_content) { |
|
225 | + foreach ($javascript_list as $script_name => &$script_content) { |
|
226 | 226 | $sn_mvc['css'][$javascript_page_name][$script_name] = $script_content; |
227 | 227 | } |
228 | 228 | } |
229 | 229 | } |
230 | 230 | |
231 | - if(!empty($this->manifest['navbar_prefix_button']) && is_array($this->manifest['navbar_prefix_button'])) { |
|
232 | - foreach($this->manifest['navbar_prefix_button'] as $button_image => $button_url_relative) { |
|
231 | + if (!empty($this->manifest['navbar_prefix_button']) && is_array($this->manifest['navbar_prefix_button'])) { |
|
232 | + foreach ($this->manifest['navbar_prefix_button'] as $button_image => $button_url_relative) { |
|
233 | 233 | $sn_mvc['navbar_prefix_button'][$button_image] = $button_url_relative; |
234 | 234 | } |
235 | 235 | } |
236 | 236 | |
237 | - if(!empty($this->manifest['navbar_main_button']) && is_array($this->manifest['navbar_main_button'])) { |
|
238 | - foreach($this->manifest['navbar_main_button'] as $button_image => $button_url_relative) { |
|
237 | + if (!empty($this->manifest['navbar_main_button']) && is_array($this->manifest['navbar_main_button'])) { |
|
238 | + foreach ($this->manifest['navbar_main_button'] as $button_image => $button_url_relative) { |
|
239 | 239 | $sn_mvc['navbar_main_button'][$button_image] = $button_url_relative; |
240 | 240 | } |
241 | 241 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | */ |
252 | 252 | protected function __mvcRegisterPagesOld($pages) { |
253 | 253 | !is_array($this->manifest['mvc']['pages']) ? $this->manifest['mvc']['pages'] = array() : false; |
254 | - if(is_array($pages) && !empty($pages)) { |
|
254 | + if (is_array($pages) && !empty($pages)) { |
|
255 | 255 | $this->manifest['mvc']['pages'] = array_merge($this->manifest['mvc']['pages'], $pages); |
256 | 256 | } |
257 | 257 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | define('IN_AJAX', true); |
23 | 23 | |
24 | - if(!is_object($template)) { |
|
24 | + if (!is_object($template)) { |
|
25 | 25 | $template = gettemplate('_ajax', true); |
26 | 26 | } |
27 | 27 | |
@@ -37,16 +37,16 @@ discard block |
||
37 | 37 | |
38 | 38 | $mode = sys_get_param_str('mode'); |
39 | 39 | |
40 | - if(class_exists($className = 'Pages\\Page' . ucfirst($mode))) { |
|
40 | + if (class_exists($className = 'Pages\\Page' . ucfirst($mode))) { |
|
41 | 41 | /** |
42 | 42 | * @var \Pages\IPage $page |
43 | 43 | */ |
44 | 44 | $page = new $className(); |
45 | - if(method_exists($page, 'loadParams')) { |
|
45 | + if (method_exists($page, 'loadParams')) { |
|
46 | 46 | $page->loadParams(); |
47 | 47 | } |
48 | 48 | |
49 | - if(method_exists($page, $action = sys_get_param('action')) && $page->checkAction($action)) { |
|
49 | + if (method_exists($page, $action = sys_get_param('action')) && $page->checkAction($action)) { |
|
50 | 50 | $result = $page->$action(); |
51 | 51 | is_array($result) ? HelperArray::merge($template_result['AJAX'], $result) : false; |
52 | 52 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | $this->raw = $stringTag; |
50 | 50 | |
51 | 51 | // Separating params - so there are will be no false-positives for template's variable names |
52 | - if(strpos($this->raw, '|') !== false) { |
|
52 | + if (strpos($this->raw, '|') !== false) { |
|
53 | 53 | $this->params = explode('|', $this->raw); |
54 | 54 | $this->resolved = $this->params[0]; |
55 | 55 | unset($this->params[0]); |
@@ -31,7 +31,7 @@ |
||
31 | 31 | QUEST_STATUS_COMPLETE => '', |
32 | 32 | ); |
33 | 33 | |
34 | - if(!isset($statuses[$this->filterQuestStatus])) { |
|
34 | + if (!isset($statuses[$this->filterQuestStatus])) { |
|
35 | 35 | $this->filterQuestStatus = QUEST_STATUS_ALL; |
36 | 36 | } |
37 | 37 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | - if(!isset($next)) { |
|
104 | + if (!isset($next)) { |
|
105 | 105 | $next = new TextEntity(); |
106 | 106 | } |
107 | 107 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $prev = $this->getById($currentText->prev); |
120 | 120 | } |
121 | 121 | |
122 | - if(!isset($prev)) { |
|
122 | + if (!isset($prev)) { |
|
123 | 123 | $prev = new TextEntity(); |
124 | 124 | } |
125 | 125 |
@@ -7,16 +7,16 @@ discard block |
||
7 | 7 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
8 | 8 | |
9 | 9 | $unit_id = sys_get_param_id('gid'); |
10 | -if($unit_id == RES_DARK_MATTER) { |
|
10 | +if ($unit_id == RES_DARK_MATTER) { |
|
11 | 11 | sys_redirect('dark_matter.php'); |
12 | 12 | } |
13 | 13 | |
14 | -if($unit_id == RES_METAMATTER) { |
|
14 | +if ($unit_id == RES_METAMATTER) { |
|
15 | 15 | sys_redirect('metamatter.php'); |
16 | 16 | } |
17 | 17 | |
18 | 18 | lng_include('infos'); |
19 | -if(!$unit_id || (!get_unit_param($unit_id) && !isset($lang['info'][$unit_id]))) { |
|
19 | +if (!$unit_id || (!get_unit_param($unit_id) && !isset($lang['info'][$unit_id]))) { |
|
20 | 20 | sys_redirect('index.php?page=techtree'); |
21 | 21 | } |
22 | 22 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $unit_data = get_unit_param($unit_id); |
26 | 26 | $unit_type = $unit_data['type']; |
27 | 27 | |
28 | -if($unit_type == UNIT_SHIPS) { |
|
28 | +if ($unit_type == UNIT_SHIPS) { |
|
29 | 29 | $template_result['UNIT_IS_SHIP'] = true; |
30 | 30 | |
31 | 31 | $ship_data = get_ship_data($unit_id, $user); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | ); |
42 | 42 | |
43 | 43 | $engine_template_info = array(); |
44 | - foreach($unit_data['engine'] as $unit_engine_data) { |
|
44 | + foreach ($unit_data['engine'] as $unit_engine_data) { |
|
45 | 45 | $unit_engine_data = get_engine_data($user, $unit_engine_data); |
46 | 46 | |
47 | 47 | $engine_template_info[] = array( |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | |
62 | 62 | $sn_data_group_combat = sn_get_groups('combat'); |
63 | -if(in_array($unit_id, $sn_data_group_combat)) { |
|
63 | +if (in_array($unit_id, $sn_data_group_combat)) { |
|
64 | 64 | $template_result['UNIT_IS_COMBAT'] = true; |
65 | 65 | |
66 | 66 | $unit_durability = $unit_data['shield'] + $unit_data['armor']; |
@@ -68,21 +68,21 @@ discard block |
||
68 | 68 | $volley_arr = $rapid_to = $rapid_from = array(); |
69 | 69 | $str_rapid_from = ''; |
70 | 70 | $str_rapid_to = ''; |
71 | - foreach($sn_data_group_combat as $enemy_id) { |
|
71 | + foreach ($sn_data_group_combat as $enemy_id) { |
|
72 | 72 | $enemy_data = get_unit_param($enemy_id); |
73 | 73 | $enemy_durability = $enemy_data['shield'] + $enemy_data['armor']; |
74 | 74 | |
75 | 75 | $rapid = $unit_data['attack'] * (isset($unit_data['amplify'][$enemy_id]) ? $unit_data['amplify'][$enemy_id] : 1) / $enemy_durability; |
76 | - if($rapid >= 1) { |
|
76 | + if ($rapid >= 1) { |
|
77 | 77 | $volley_arr[$enemy_id]['TO'] = floor($rapid); |
78 | 78 | } |
79 | 79 | |
80 | 80 | $rapid = $enemy_data['attack'] * (isset($enemy_data['amplify'][$unit_id]) ? $enemy_data['amplify'][$unit_id] : 1) / $unit_durability; |
81 | - if($rapid >= 1) { |
|
81 | + if ($rapid >= 1) { |
|
82 | 82 | $volley_arr[$enemy_id]['FROM'] = floor($rapid); |
83 | 83 | } |
84 | 84 | } |
85 | - foreach($volley_arr as $enemy_id => &$rapid) { |
|
85 | + foreach ($volley_arr as $enemy_id => &$rapid) { |
|
86 | 86 | $rapid['ENEMY_ID'] = $enemy_id; |
87 | 87 | $rapid['ENEMY_NAME'] = $lang['tech'][$enemy_id]; |
88 | 88 | } |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | |
101 | 101 | } |
102 | 102 | |
103 | -if($lang['info'][$unit_id]['effect']) { |
|
103 | +if ($lang['info'][$unit_id]['effect']) { |
|
104 | 104 | $template_result['UNIT_EFFECT'] = $lang['info'][$unit_id]['effect']; |
105 | 105 | } |
106 | 106 | |
107 | -if($unit_data['bonus']) { |
|
107 | +if ($unit_data['bonus']) { |
|
108 | 108 | $unit_bonus = !$unit_data['bonus'] || $unit_data['bonus_type'] == BONUS_ABILITY ? '' : ( |
109 | 109 | ($unit_data['bonus'] >= 0 ? '+' : '') . $unit_data['bonus'] . ($unit_data['bonus_type'] == BONUS_PERCENT ? '%' : '') |
110 | 110 | ); |