@@ -75,11 +75,11 @@ |
||
75 | 75 | * @return float[] - [int resourceId] -> [float ratesNormalizedToResourceCost] |
76 | 76 | */ |
77 | 77 | public function getResourceExchangeIn($resourceId) { |
78 | - if(empty($this->resourceExchangeRates[$resourceId])) { |
|
78 | + if (empty($this->resourceExchangeRates[$resourceId])) { |
|
79 | 79 | $defaultRates = $this->getResourcesExchange(); |
80 | 80 | |
81 | 81 | $this->resourceExchangeRates[$resourceId] = []; |
82 | - foreach($defaultRates as $defaultResourceId => $defaultRate) { |
|
82 | + foreach ($defaultRates as $defaultResourceId => $defaultRate) { |
|
83 | 83 | $this->resourceExchangeRates[$resourceId][$defaultResourceId] = $defaultRate / $defaultRates[$resourceId]; |
84 | 84 | } |
85 | 85 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -function admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list){return sn_function_call('admin_planet_edit_mode', array(&$template, &$admin_planet_edit_mode_list));} |
|
3 | +function admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list) {return sn_function_call('admin_planet_edit_mode', array(&$template, &$admin_planet_edit_mode_list)); } |
|
4 | 4 | function sn_admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list) |
5 | 5 | { |
6 | 6 | global $lang; |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | return $mode; |
20 | 20 | } |
21 | 21 | |
22 | -function admin_planet_edit_template(&$template, $edit_planet_row, $mode){return sn_function_call('admin_planet_edit_template', array(&$template, $edit_planet_row, $mode));} |
|
22 | +function admin_planet_edit_template(&$template, $edit_planet_row, $mode) {return sn_function_call('admin_planet_edit_template', array(&$template, $edit_planet_row, $mode)); } |
|
23 | 23 | /** |
24 | 24 | * @param template $template |
25 | 25 | * @param $edit_planet_row |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | global $lang; |
31 | 31 | |
32 | 32 | $unit_list = sn_get_groups($mode); |
33 | - if(empty($unit_list)) |
|
33 | + if (empty($unit_list)) |
|
34 | 34 | { |
35 | 35 | return; |
36 | 36 | } |
37 | 37 | $name_list = $lang['tech']; |
38 | 38 | |
39 | - foreach($unit_list as $unit_id) |
|
39 | + foreach ($unit_list as $unit_id) |
|
40 | 40 | { |
41 | 41 | $template->assign_block_vars('unit', array( |
42 | 42 | 'ID' => $unit_id, |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
50 | -function admin_planet_edit_query_string($unit_id, $unit_amount, $mode){return sn_function_call('admin_planet_edit_query_string', array($unit_id, $unit_amount, $mode));} |
|
50 | +function admin_planet_edit_query_string($unit_id, $unit_amount, $mode) {return sn_function_call('admin_planet_edit_query_string', array($unit_id, $unit_amount, $mode)); } |
|
51 | 51 | function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode) |
52 | 52 | { |
53 | - if($unit_amount && in_array($unit_id, sn_get_groups($mode))) |
|
53 | + if ($unit_amount && in_array($unit_id, sn_get_groups($mode))) |
|
54 | 54 | { |
55 | 55 | $unit_amount = round($unit_amount); |
56 | 56 | $unit_name = get_unit_param($unit_id, P_NAME); |
@@ -1,8 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | function admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list){return sn_function_call('admin_planet_edit_mode', array(&$template, &$admin_planet_edit_mode_list));} |
4 | -function sn_admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list) |
|
5 | -{ |
|
4 | +function sn_admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list) { |
|
6 | 5 | global $lang; |
7 | 6 | |
8 | 7 | $admin_planet_edit_mode_list = array_merge(isset($admin_planet_edit_mode_list) ? $admin_planet_edit_mode_list : array(), array( |
@@ -25,8 +24,7 @@ discard block |
||
25 | 24 | * @param $edit_planet_row |
26 | 25 | * @param $mode |
27 | 26 | */ |
28 | -function sn_admin_planet_edit_template(&$template, $edit_planet_row, $mode) |
|
29 | -{ |
|
27 | +function sn_admin_planet_edit_template(&$template, $edit_planet_row, $mode) { |
|
30 | 28 | global $lang; |
31 | 29 | |
32 | 30 | $unit_list = sn_get_groups($mode); |
@@ -48,15 +46,13 @@ discard block |
||
48 | 46 | } |
49 | 47 | |
50 | 48 | function admin_planet_edit_query_string($unit_id, $unit_amount, $mode){return sn_function_call('admin_planet_edit_query_string', array($unit_id, $unit_amount, $mode));} |
51 | -function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode) |
|
52 | -{ |
|
49 | +function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode) { |
|
53 | 50 | if($unit_amount && in_array($unit_id, sn_get_groups($mode))) |
54 | 51 | { |
55 | 52 | $unit_amount = round($unit_amount); |
56 | 53 | $unit_name = get_unit_param($unit_id, P_NAME); |
57 | 54 | $result = "{$unit_name} = GREATEST(0, {$unit_name} + ({$unit_amount}))"; |
58 | - } |
|
59 | - else |
|
55 | + } else |
|
60 | 56 | { |
61 | 57 | $result = ''; |
62 | 58 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | $this->Field = isset($mySqlDescription['Field']) ? $mySqlDescription['Field'] : null; |
30 | 30 | $this->Type = isset($mySqlDescription['Type']) ? $mySqlDescription['Type'] : null; |
31 | 31 | $this->Collation = isset($mySqlDescription['Collation']) ? $mySqlDescription['Collation'] : null; |
32 | - $this->Null = isset($mySqlDescription['Null']) ? $mySqlDescription['Null'] : null; |
|
32 | + $this->null = isset($mySqlDescription['Null']) ? $mySqlDescription['Null'] : null; |
|
33 | 33 | $this->Key = isset($mySqlDescription['Key']) ? $mySqlDescription['Key'] : null; |
34 | 34 | $this->Default = isset($mySqlDescription['Default']) ? $mySqlDescription['Default'] : null; |
35 | 35 | $this->Extra = isset($mySqlDescription['Extra']) ? $mySqlDescription['Extra'] : null; |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | |
151 | 151 | public function unset_by_prefix($prefix_unset = '') { |
152 | 152 | static $array_clear; |
153 | - !$array_clear ? $array_clear = function (&$v, $k, $p) { |
|
153 | + !$array_clear ? $array_clear = function(&$v, $k, $p) { |
|
154 | 154 | strpos($k, $p) === 0 ? $v = null : false; |
155 | 155 | } : false; |
156 | 156 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | if ($this->$name[0] === null) { |
206 | 206 | for ($i = count($name) - 1; $i > 0; $i--) { |
207 | 207 | $cName = "{$name[$i]}_COUNT"; |
208 | - $cName1 = "{$name[$i-1]}_COUNT"; |
|
208 | + $cName1 = "{$name[$i - 1]}_COUNT"; |
|
209 | 209 | if ($this->$cName1 == null || $i == 1) { |
210 | 210 | $this->$cName++; |
211 | 211 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | $count = count($name); |
252 | 252 | for ($i = 1; $i < $count; $i++) { |
253 | 253 | $cName = "{$name[$i]}_COUNT"; |
254 | - $cName1 = "{$name[$i-1]}_COUNT"; |
|
254 | + $cName1 = "{$name[$i - 1]}_COUNT"; |
|
255 | 255 | |
256 | 256 | if ($i == 1 || $this->$cName1 === null) { |
257 | 257 | $this->$cName--; |
@@ -30,8 +30,7 @@ |
||
30 | 30 | * @param $resource_id |
31 | 31 | * @param ResourceCalculations $capsObj |
32 | 32 | */ |
33 | -function int_calc_storage_bar($resource_id, $capsObj) |
|
34 | -{ |
|
33 | +function int_calc_storage_bar($resource_id, $capsObj) { |
|
35 | 34 | global $lang, $template, $planetrow, $user; |
36 | 35 | |
37 | 36 | $totalProduction = $capsObj->getProduction($resource_id); |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | // $BuildEnergyTech = $user['energy_tech']; |
113 | 113 | for ($Option = 10; $Option >= 0; $Option--) |
114 | 114 | { |
115 | - $template->assign_block_vars('option', array( |
|
116 | - 'VALUE' => $Option * 10, |
|
117 | - )); |
|
115 | + $template->assign_block_vars('option', array( |
|
116 | + 'VALUE' => $Option * 10, |
|
117 | + )); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | $capsObj = new ResourceCalculations(); |
@@ -180,12 +180,12 @@ discard block |
||
180 | 180 | int_calc_storage_bar(RES_DEUTERIUM, $capsObj); |
181 | 181 | |
182 | 182 | $template->assign_vars(array( |
183 | - 'PLANET_NAME' => $planetrow['name'], |
|
184 | - 'PLANET_TYPE' => $planetrow['planet_type'], |
|
183 | + 'PLANET_NAME' => $planetrow['name'], |
|
184 | + 'PLANET_TYPE' => $planetrow['planet_type'], |
|
185 | 185 | |
186 | - 'PRODUCTION_LEVEL' => floor($capsObj->efficiency * 100), |
|
186 | + 'PRODUCTION_LEVEL' => floor($capsObj->efficiency * 100), |
|
187 | 187 | |
188 | - 'PAGE_HINT' => $lang['res_hint'], |
|
188 | + 'PAGE_HINT' => $lang['res_hint'], |
|
189 | 189 | )); |
190 | 190 | |
191 | 191 | SnTemplate::display($template, $lang['res_planet_production']); |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | ]); |
53 | 53 | }; |
54 | 54 | |
55 | -$ValidList['percent'] = array ( 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 ); |
|
55 | +$ValidList['percent'] = array(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100); |
|
56 | 56 | $template = SnTemplate::gettemplate('resources', true); |
57 | 57 | |
58 | 58 | /** @noinspection PhpUnhandledExceptionInspection */ |
59 | 59 | $planet = SN::$gc->repoV2->getPlanet($planetrow['id']); |
60 | -if(!empty($transmutation_result = $planet->sn_sys_planet_core_transmute($user))) { |
|
60 | +if (!empty($transmutation_result = $planet->sn_sys_planet_core_transmute($user))) { |
|
61 | 61 | $template->assign_block_vars('result', $transmutation_result); |
62 | 62 | $planet->dbLoadRecord($planetrow['id']); |
63 | 63 | } |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | 'ENERGY_TYPE' => $capsObj->productionCurrentMatrix[RES_ENERGY][0], |
130 | 130 | )); |
131 | 131 | |
132 | -foreach($sn_group_factories as $unit_id) |
|
132 | +foreach ($sn_group_factories as $unit_id) |
|
133 | 133 | { |
134 | - if(mrc_get_level($user, $planetrow, $unit_id) > 0 && get_unit_param($unit_id)) |
|
134 | + if (mrc_get_level($user, $planetrow, $unit_id) > 0 && get_unit_param($unit_id)) |
|
135 | 135 | { |
136 | 136 | $level_plain = mrc_get_level($user, $planetrow, $unit_id, false, true); |
137 | 137 | $template->assign_block_vars('production', array( |
@@ -30,7 +30,7 @@ |
||
30 | 30 | |
31 | 31 | $this->target_message = "{$lang['sys_mess_spy_enemy_fleet']} {$this->src_planet['name']} " . uni_render_coordinates_href($this->src_planet, '', 3); |
32 | 32 | $this->target_message .= " {$lang['sys_mess_spy_seen_at']} {$this->dst_planet['name']} " . uni_render_coordinates($this->dst_planet); |
33 | - if($this->missionReport->isSpyDetected()) { |
|
33 | + if ($this->missionReport->isSpyDetected()) { |
|
34 | 34 | $this->target_message .= "<br />{$lang['sys_mess_spy_destroyed_enemy']}"; |
35 | 35 | } |
36 | 36 |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | $groups[get_unit_param($unitId, P_UNIT_TYPE)][$unitId] = $unitAmount; |
26 | 26 | } |
27 | 27 | |
28 | - foreach(static::ALLOWED_UNITS as $groupId) { |
|
29 | - if(empty($groups[$groupId])) { |
|
28 | + foreach (static::ALLOWED_UNITS as $groupId) { |
|
29 | + if (empty($groups[$groupId])) { |
|
30 | 30 | continue; |
31 | 31 | } |
32 | 32 | |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | 'NAME' => $lang['tech'][$groupId], |
36 | 36 | ]); |
37 | 37 | |
38 | - foreach($general->getGroupsById($groupId) as $unitId) { |
|
39 | - if((!isset($groups[$groupId][$unitId]) || floor($groups[$groupId][$unitId]) < 1) && $unitId != RES_ENERGY) { |
|
38 | + foreach ($general->getGroupsById($groupId) as $unitId) { |
|
39 | + if ((!isset($groups[$groupId][$unitId]) || floor($groups[$groupId][$unitId]) < 1) && $unitId != RES_ENERGY) { |
|
40 | 40 | continue; |
41 | 41 | } |
42 | 42 |
@@ -15,8 +15,7 @@ discard block |
||
15 | 15 | 1.5 - copyright (c) 2010-2011 by Gorlum for http://supernova.ws |
16 | 16 | [+] SuperMassMailing - authlevel=3 player can send messages to whole server ('*' as $owners) |
17 | 17 | */ |
18 | -function msg_ali_send($message, $subject, $ally_rank_id = 0, $ally_id = 0) |
|
19 | -{ |
|
18 | +function msg_ali_send($message, $subject, $ally_rank_id = 0, $ally_id = 0) { |
|
20 | 19 | global $user; |
21 | 20 | |
22 | 21 | $ally_id = $ally_id ? $ally_id : $user['ally_id']; |
@@ -49,8 +48,7 @@ discard block |
||
49 | 48 | * @param bool $force |
50 | 49 | * @param bool $json |
51 | 50 | */ |
52 | -function msg_send_simple_message($owners, $sender, $timestamp, $message_type, $from, $subject, $text, $escaped = STRING_NEED_ESCAPING, $force = false, $json = false) |
|
53 | -{ |
|
51 | +function msg_send_simple_message($owners, $sender, $timestamp, $message_type, $from, $subject, $text, $escaped = STRING_NEED_ESCAPING, $force = false, $json = false) { |
|
54 | 52 | global $config, $user, $sn_message_class_list; |
55 | 53 | |
56 | 54 | if(!$owners) |
@@ -91,8 +89,7 @@ discard block |
||
91 | 89 | // TODO Добавить $sender - рассылка может быть и от кого-то |
92 | 90 | db_message_insert_all($message_type, $from, $subject, $text); |
93 | 91 | $owners = []; |
94 | - } |
|
95 | - else |
|
92 | + } else |
|
96 | 93 | { |
97 | 94 | $insert_values = []; |
98 | 95 | $insert_template = "('%u'," . str_replace('%', '%%', " '{$sender}', '{$timestamp}', '{$message_type}', '{$from}', '{$subject}', '{$text}', '" . intval($json) . "')"); |
@@ -102,8 +99,7 @@ discard block |
||
102 | 99 | if($user['id'] != $owner) |
103 | 100 | { |
104 | 101 | $owner_row = db_user_by_id($owner); |
105 | - } |
|
106 | - else |
|
102 | + } else |
|
107 | 103 | { |
108 | 104 | $owner_row = $user; |
109 | 105 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | "ally_id = '{$ally_id}'" . ($ally_rank_id >= 0 ? " AND ally_rank_id = {$ally_rank_id}" : ''), |
27 | 27 | false, 'id, username'); |
28 | 28 | // while ($u = db_fetch($query)) |
29 | - foreach($query as $u) |
|
29 | + foreach ($query as $u) |
|
30 | 30 | { |
31 | 31 | $sendList[] = $u['id']; |
32 | 32 | $list .= "<br>{$u['username']} "; |
@@ -53,19 +53,19 @@ discard block |
||
53 | 53 | { |
54 | 54 | global $config, $user, $sn_message_class_list; |
55 | 55 | |
56 | - if(!$owners) |
|
56 | + if (!$owners) |
|
57 | 57 | { |
58 | 58 | return; |
59 | 59 | } |
60 | 60 | |
61 | 61 | $timestamp = $timestamp ? $timestamp : SN_TIME_NOW; |
62 | 62 | $sender = intval($sender); |
63 | - if(!is_array($owners)) |
|
63 | + if (!is_array($owners)) |
|
64 | 64 | { |
65 | 65 | $owners = array($owners); |
66 | 66 | } |
67 | 67 | |
68 | - if($escaped == STRING_NEED_ESCAPING) |
|
68 | + if ($escaped == STRING_NEED_ESCAPING) |
|
69 | 69 | { |
70 | 70 | $from = SN::$db->db_escape($from); |
71 | 71 | $subject = SN::$db->db_escape($subject); |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | |
82 | 82 | $message_class_name_total = $sn_message_class_list[MSG_TYPE_NEW]['name']; |
83 | 83 | |
84 | - if($owners[0] == '*') |
|
84 | + if ($owners[0] == '*') |
|
85 | 85 | { |
86 | - if($user['authlevel'] < 3) |
|
86 | + if ($user['authlevel'] < 3) |
|
87 | 87 | { |
88 | 88 | return false; |
89 | 89 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | foreach ($owners as $owner) |
101 | 101 | { |
102 | - if($user['id'] != $owner) |
|
102 | + if ($user['id'] != $owner) |
|
103 | 103 | { |
104 | 104 | $owner_row = db_user_by_id($owner); |
105 | 105 | } |
@@ -109,14 +109,14 @@ discard block |
||
109 | 109 | } |
110 | 110 | sys_user_options_unpack($owner_row); |
111 | 111 | |
112 | - if($force || !$message_class_switchable || $owner_row["opt_{$message_class_name}"]) |
|
112 | + if ($force || !$message_class_switchable || $owner_row["opt_{$message_class_name}"]) |
|
113 | 113 | { |
114 | 114 | $insert_values[] = sprintf($insert_template, $owner); |
115 | 115 | } |
116 | 116 | |
117 | - if($message_class_email && $config->game_email_pm && $owner_row["opt_email_{$message_class_name}"]) |
|
117 | + if ($message_class_email && $config->game_email_pm && $owner_row["opt_email_{$message_class_name}"]) |
|
118 | 118 | { |
119 | - if($message_type == MSG_TYPE_SPY) { |
|
119 | + if ($message_type == MSG_TYPE_SPY) { |
|
120 | 120 | @$result = mymail($owner_row['email'], $subject, SN::$lang['sys_spy_activity'], '', true); |
121 | 121 | } else { |
122 | 122 | @$result = mymail($owner_row['email'], $subject, $text_unescaped, '', true); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
127 | - if(empty($insert_values)) |
|
127 | + if (empty($insert_values)) |
|
128 | 128 | { |
129 | 129 | return; |
130 | 130 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | } |
135 | 135 | db_user_list_set_mass_mail($owners, "`{$message_class_name}` = `{$message_class_name}` + 1, `{$message_class_name_total}` = `{$message_class_name_total}` + 1"); |
136 | 136 | |
137 | - if(in_array($user['id'], $owners) || $owners[0] == '*') |
|
137 | + if (in_array($user['id'], $owners) || $owners[0] == '*') |
|
138 | 138 | { |
139 | 139 | $user[$message_class_name]++; |
140 | 140 | $user[$message_class_name_total]++; |
@@ -223,7 +223,7 @@ |
||
223 | 223 | 'factor' => 1, |
224 | 224 | ), |
225 | 225 | P_UNIT_PRODUCTION => array( |
226 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) { return ($planet_row["temp_max"] / 4 + 20) * $level * (0.1 * $production_factor); }, |
|
226 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) { return ($planet_row["temp_max"] / 4 + 20) * $level * (0.1 * $production_factor); }, |
|
227 | 227 | ), |
228 | 228 | P_MINING_IS_MANAGED => true, |
229 | 229 |