@@ -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 |
@@ -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 |
@@ -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 | } |
@@ -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() { |