@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | 'factor' => 1.5, |
17 | 17 | ), |
18 | 18 | P_UNIT_PRODUCTION => array( |
19 | - RES_METAL => function ($level, $production_factor, $user, $planet_row) { return 40 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
20 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) { return -13 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
19 | + RES_METAL => function($level, $production_factor, $user, $planet_row) { return 40 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
20 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) { return -13 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
21 | 21 | ), |
22 | 22 | P_MINING_IS_MANAGED => true, |
23 | 23 | ), |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | 'factor' => 1.6, |
35 | 35 | ), |
36 | 36 | P_UNIT_PRODUCTION => array( |
37 | - RES_CRYSTAL => function ($level, $production_factor, $user, $planet_row) { return 32 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
38 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) { return -16 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
37 | + RES_CRYSTAL => function($level, $production_factor, $user, $planet_row) { return 32 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
38 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) { return -16 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
39 | 39 | ), |
40 | 40 | P_MINING_IS_MANAGED => true, |
41 | 41 | ), |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | 'factor' => 1.5, |
53 | 53 | ), |
54 | 54 | P_UNIT_PRODUCTION => array( |
55 | - RES_DEUTERIUM => function ($level, $production_factor, $user, $planet_row) { return 10 * $level * pow(1.1, $level) * (0.1 * $production_factor) * (-0.002 * $planet_row["temp_max"] + 1.28); }, |
|
56 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) { return -20 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
55 | + RES_DEUTERIUM => function($level, $production_factor, $user, $planet_row) { return 10 * $level * pow(1.1, $level) * (0.1 * $production_factor) * (-0.002 * $planet_row["temp_max"] + 1.28); }, |
|
56 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) { return -20 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
57 | 57 | ), |
58 | 58 | P_MINING_IS_MANAGED => true, |
59 | 59 | ), |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | 'factor' => 1.5, |
71 | 71 | ), |
72 | 72 | P_UNIT_PRODUCTION => array( |
73 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) { return ($planet_row["temp_max"] / 5 + 15) * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
73 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) { return ($planet_row["temp_max"] / 5 + 15) * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
74 | 74 | ), |
75 | 75 | P_MINING_IS_MANAGED => true, |
76 | 76 | ), |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | 'factor' => 1.8, |
89 | 89 | ), |
90 | 90 | P_UNIT_PRODUCTION => array( |
91 | - RES_DEUTERIUM => function ($level, $production_factor, $user, $planet_row) { return -10 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
92 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) { return 30 * $level * pow(1.05 + 0.01 * mrc_get_level($user, "", TECH_ENERGY), $level) * (0.1 * $production_factor); }, |
|
91 | + RES_DEUTERIUM => function($level, $production_factor, $user, $planet_row) { return -10 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
92 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) { return 30 * $level * pow(1.05 + 0.01 * mrc_get_level($user, "", TECH_ENERGY), $level) * (0.1 * $production_factor); }, |
|
93 | 93 | ), |
94 | 94 | P_MINING_IS_MANAGED => true, |
95 | 95 | ), |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | 'factor' => 2, |
107 | 107 | ), |
108 | 108 | 'storage' => array( |
109 | - RES_METAL => function ($level) { return BASE_STORAGE_SIZE * pow(1.5, $level); }, |
|
109 | + RES_METAL => function($level) { return BASE_STORAGE_SIZE * pow(1.5, $level); }, |
|
110 | 110 | ), |
111 | 111 | ), |
112 | 112 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | 'factor' => 2, |
123 | 123 | ), |
124 | 124 | 'storage' => array( |
125 | - RES_CRYSTAL => function ($level) { return BASE_STORAGE_SIZE * pow(1.5, $level); }, |
|
125 | + RES_CRYSTAL => function($level) { return BASE_STORAGE_SIZE * pow(1.5, $level); }, |
|
126 | 126 | ), |
127 | 127 | ), |
128 | 128 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | 'factor' => 2, |
139 | 139 | ), |
140 | 140 | 'storage' => array( |
141 | - RES_DEUTERIUM => function ($level) { return BASE_STORAGE_SIZE * pow(1.5, $level); }, |
|
141 | + RES_DEUTERIUM => function($level) { return BASE_STORAGE_SIZE * pow(1.5, $level); }, |
|
142 | 142 | ), |
143 | 143 | ), |
144 | 144 |
@@ -52,7 +52,7 @@ |
||
52 | 52 | //print("<br />CACHE CLEAR {$cache_id} " . ($hard ? 'HARD' : 'SOFT') . "<br />"); |
53 | 53 | if ($hard && !empty(_SnCacheInternal::$data[$location_type])) { |
54 | 54 | // Здесь нельзя делать unset - надо записывать NULL, что бы это отразилось на зависимых записях |
55 | - array_walk(_SnCacheInternal::$data[$location_type], function (&$item) { $item = null; }); |
|
55 | + array_walk(_SnCacheInternal::$data[$location_type], function(&$item) { $item = null; }); |
|
56 | 56 | } |
57 | 57 | _SnCacheInternal::$locator[$location_type] = []; |
58 | 58 | _SnCacheInternal::$queries[$location_type] = []; |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | "SELECT `id` AS `ID`, `username` AS `NAME`, `ally_name` AS `ALLY`, `total_points` AS `STAT_POINTS`, |
181 | 181 | `onlinetime` AS `ACTIVITY` |
182 | 182 | FROM `{{users}}` |
183 | - WHERE `onlinetime` >= ". (SN_TIME_NOW - $config->game_users_online_timeout) ." ORDER BY user_as_ally, `". $TypeSort ."` ASC;"); |
|
183 | + WHERE `onlinetime` >= ". (SN_TIME_NOW - $config->game_users_online_timeout) . " ORDER BY user_as_ally, `" . $TypeSort . "` ASC;"); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | return doquery("SELECT u.*, COUNT(r.id) AS referral_count, SUM(r.dark_matter) AS referral_dm FROM {{users}} as u |
196 | 196 | LEFT JOIN {{referrals}} as r on r.id_partner = u.id |
197 | 197 | WHERE" . |
198 | - ($online ? " `onlinetime` >= ". (SN_TIME_NOW - $config->game_users_online_timeout) : ' user_as_ally IS NULL') . |
|
198 | + ($online ? " `onlinetime` >= " . (SN_TIME_NOW - $config->game_users_online_timeout) : ' user_as_ally IS NULL') . |
|
199 | 199 | " GROUP BY u.id |
200 | 200 | ORDER BY user_as_ally, {$sort} ASC"); |
201 | 201 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | !is_array($user_id_list) ? $user_id_list = array($user_id_list) : false; |
212 | 212 | |
213 | 213 | $user_list = array(); |
214 | - foreach($user_id_list as $user_id_unsafe) { |
|
214 | + foreach ($user_id_list as $user_id_unsafe) { |
|
215 | 215 | $user = db_user_by_id($user_id_unsafe); |
216 | 216 | !empty($user) ? $user_list[$user_id_unsafe] = $user : false; |
217 | 217 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) |
|
3 | +if (!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) |
|
4 | 4 | { |
5 | 5 | $debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403); |
6 | 6 | } |
@@ -15,50 +15,50 @@ discard block |
||
15 | 15 | )); |
16 | 16 | |
17 | 17 | $info_action = sys_get_param_int('action'); |
18 | -if($info_action) |
|
18 | +if ($info_action) |
|
19 | 19 | { |
20 | 20 | try |
21 | 21 | { |
22 | 22 | sn_db_transaction_start(); |
23 | 23 | |
24 | 24 | $user = db_user_by_id($user['id'], true); |
25 | - if(mrc_get_level($user, null, RES_DARK_MATTER) < $config->rpg_cost_info) |
|
25 | + if (mrc_get_level($user, null, RES_DARK_MATTER) < $config->rpg_cost_info) |
|
26 | 26 | { |
27 | 27 | throw new Exception(MARKET_NO_DM, ERR_ERROR); |
28 | 28 | } |
29 | 29 | |
30 | - switch($info_action) |
|
30 | + switch ($info_action) |
|
31 | 31 | { |
32 | 32 | case MARKET_INFO_PLAYER: |
33 | 33 | $user_info_name_unsafe = sys_get_param_str_unsafe('user_info_name'); |
34 | - if(!$user_info_name_unsafe) |
|
34 | + if (!$user_info_name_unsafe) |
|
35 | 35 | { |
36 | 36 | throw new Exception(MARKET_INFO_PLAYER_WRONG, ERR_ERROR); |
37 | 37 | } |
38 | 38 | |
39 | - if(is_id($user_info_name_unsafe)) |
|
39 | + if (is_id($user_info_name_unsafe)) |
|
40 | 40 | { |
41 | 41 | $user_info = db_user_by_id($user_info_name_unsafe, true, '`id`, `username`', true); |
42 | 42 | } |
43 | - if(!is_array($user_info)) |
|
43 | + if (!is_array($user_info)) |
|
44 | 44 | { |
45 | 45 | $user_info = db_user_by_username($user_info_name_unsafe, true); |
46 | 46 | } |
47 | - if(!is_array($user_info)) |
|
47 | + if (!is_array($user_info)) |
|
48 | 48 | { |
49 | 49 | throw new Exception(MARKET_INFO_PLAYER_NOT_FOUND, ERR_ERROR); |
50 | 50 | } |
51 | - if($user_info['id'] == $user['id']) |
|
51 | + if ($user_info['id'] == $user['id']) |
|
52 | 52 | { |
53 | 53 | throw new Exception(MARKET_INFO_PLAYER_SAME, ERR_ERROR); |
54 | 54 | } |
55 | 55 | |
56 | 56 | $msg_text = array(); |
57 | - foreach(sn_get_groups('mercenaries') as $mercenary_id) |
|
57 | + foreach (sn_get_groups('mercenaries') as $mercenary_id) |
|
58 | 58 | { |
59 | 59 | $msg_text[] = "{$lang['tech'][$mercenary_id]} - " . (($mercenary_level = mrc_get_level($user_info, false, $mercenary_id)) ? "{$lang['sys_level']} {$mercenary_level}" : $lang['eco_mrk_info_not_hired']); |
60 | 60 | } |
61 | - if($mercenary_level = mrc_get_level($user_info, false, UNIT_PREMIUM)) |
|
61 | + if ($mercenary_level = mrc_get_level($user_info, false, UNIT_PREMIUM)) |
|
62 | 62 | { |
63 | 63 | $msg_text[] = "{$lang['tech'][UNIT_PREMIUM]} - {$mercenary_level} {$lang['sys_level']}"; |
64 | 64 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | break; |
73 | 73 | } |
74 | 74 | |
75 | - if(!rpg_points_change($user['id'], RPG_MARKET_INFO_MERCENARY, -$config->rpg_cost_info, "Using Black Market page {$lang['eco_mrk_info']} - getting info about user ID {$user_info['id']}")) |
|
75 | + if (!rpg_points_change($user['id'], RPG_MARKET_INFO_MERCENARY, -$config->rpg_cost_info, "Using Black Market page {$lang['eco_mrk_info']} - getting info about user ID {$user_info['id']}")) |
|
76 | 76 | { |
77 | 77 | // TODO: throw new Exception(MARKET_INFO_PLAYER_SAME, ERR_ERROR); |
78 | 78 | } |
@@ -18,13 +18,13 @@ discard block |
||
18 | 18 | |
19 | 19 | messageBoxAdminAccessDenied(AUTH_LEVEL_ADMINISTRATOR); |
20 | 20 | |
21 | -$template = gettemplate('admin/adm_payment', true); |
|
21 | +$template = gettemplate('admin/adm_payment', true); |
|
22 | 22 | |
23 | 23 | $payer_list = array( |
24 | 24 | -1 => $lang['adm_pay_filter_all'], |
25 | 25 | ); |
26 | 26 | $query = doquery("SELECT payment_user_id, payment_user_name FROM `{{payment}}` GROUP BY payment_user_id ORDER BY payment_user_name"); |
27 | -while($row = db_fetch($query)) { |
|
27 | +while ($row = db_fetch($query)) { |
|
28 | 28 | $payer_list[$row['payment_user_id']] = '[' . $row['payment_user_id'] . '] ' . $row['payment_user_name']; |
29 | 29 | } |
30 | 30 | tpl_assign_select($template, 'payer', $payer_list); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | '' => $lang['adm_pay_filter_all'], |
34 | 34 | ); |
35 | 35 | $query = doquery("SELECT distinct payment_module_name FROM `{{payment}}` ORDER BY payment_module_name"); |
36 | -while($row = db_fetch($query)) { |
|
36 | +while ($row = db_fetch($query)) { |
|
37 | 37 | $module_list[$row['payment_module_name']] = $row['payment_module_name']; |
38 | 38 | } |
39 | 39 | tpl_assign_select($template, 'module', $module_list); |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | |
70 | 70 | |
71 | 71 | //while($row = db_fetch($query)) { |
72 | -foreach($query as $row) { |
|
72 | +foreach ($query as $row) { |
|
73 | 73 | $row2 = array(); |
74 | - foreach($row as $key => $value) { |
|
74 | + foreach ($row as $key => $value) { |
|
75 | 75 | $row2[strtoupper($key)] = $value; |
76 | 76 | } |
77 | 77 | $template->assign_block_vars('payment', $row2); |
@@ -46,7 +46,7 @@ |
||
46 | 46 | * @return bool |
47 | 47 | */ |
48 | 48 | public function changeTitle(AllianceTitle $title) { |
49 | - if(!$title instanceof AllianceTitle) { |
|
49 | + if (!$title instanceof AllianceTitle) { |
|
50 | 50 | return false; |
51 | 51 | } |
52 | 52 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | continue; |
46 | 46 | } |
47 | 47 | |
48 | - $result[] = (string)$title; |
|
48 | + $result[] = (string) $title; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return implode(';', $result); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * Updates title names and access rights with current ones |
68 | 68 | */ |
69 | 69 | public function updateTitles() { |
70 | - $this->alliance->titleList = (string)$this; |
|
70 | + $this->alliance->titleList = (string) $this; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | protected function extractTitles() { |
@@ -58,8 +58,7 @@ |
||
58 | 58 | * @return int |
59 | 59 | */ |
60 | 60 | public static function calcBonusPower($unitInfo) { |
61 | - return isset($unitInfo[P_BONUS_VALUE]) ? $unitInfo[P_BONUS_VALUE] : |
|
62 | - (static::calcBonusType($unitInfo) == BONUS_ABILITY ? 1 : 0); |
|
61 | + return isset($unitInfo[P_BONUS_VALUE]) ? $unitInfo[P_BONUS_VALUE] : (static::calcBonusType($unitInfo) == BONUS_ABILITY ? 1 : 0); |
|
63 | 62 | } |
64 | 63 | |
65 | 64 | /** |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | renderFooter(); |
289 | 289 | } |
290 | 290 | |
291 | - $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false;; |
|
291 | + $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false; ; |
|
292 | 292 | |
293 | 293 | sn_db_disconnect(); |
294 | 294 | |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | 'QUE_ID' => QUE_RESEARCH, |
671 | 671 | 'QUE_HTML' => 'topnav', |
672 | 672 | |
673 | - 'RESEARCH_ONGOING' => (boolean)$user['que'], |
|
673 | + 'RESEARCH_ONGOING' => (boolean) $user['que'], |
|
674 | 674 | |
675 | 675 | 'TIME_TEXT' => sprintf($str_date_format, $time_now_parsed['year'], $lang['months'][$time_now_parsed['mon']], $time_now_parsed['mday'], |
676 | 676 | $time_now_parsed['hours'], $time_now_parsed['minutes'], $time_now_parsed['seconds'] |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | 'LANG' => $language ? $language : '', |
964 | 964 | 'referral' => $id_ref ? '&id_ref=' . $id_ref : '', |
965 | 965 | |
966 | - 'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '',// "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''), |
|
966 | + 'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '', // "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''), |
|
967 | 967 | 'FILENAME' => basename($_SERVER['PHP_SELF']), |
968 | 968 | )); |
969 | 969 |