@@ -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,24 +13,24 @@ 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 | $moon_chance = $unit_id == ART_LHC ? uni_calculate_moon_chance($planetrow['debris_metal'] + $planetrow['debris_crystal']) : ( |
30 | 30 | $unit_id == ART_HOOK_MEDIUM ? mt_rand(1100, 8999) : ($unit_id == ART_HOOK_SMALL ? 1100 : 8999) |
31 | 31 | ); |
32 | 32 | $random = $unit_id == ART_LHC ? mt_rand(1, 100) : $moon_chance; |
33 | - if($random <= $moon_chance) |
|
33 | + if ($random <= $moon_chance) |
|
34 | 34 | { |
35 | 35 | $new_moon_row = uni_create_moon($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], $user['id'], $moon_chance); |
36 | 36 | $message = sprintf($lang['art_moon_create'][$unit_id], $new_moon_row['name'], uni_render_coordinates($planetrow), HelperString::numberFloorAndFormat($moon_chance)); |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | case ART_RCD_MEDIUM: |
52 | 52 | case ART_RCD_LARGE: |
53 | 53 | $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true); |
54 | - if($planetrow['planet_type'] != PT_PLANET) |
|
54 | + if ($planetrow['planet_type'] != PT_PLANET) |
|
55 | 55 | { |
56 | 56 | $message = $lang['art_rcd_err_moon']; |
57 | 57 | break; |
58 | 58 | } |
59 | 59 | |
60 | 60 | $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, false); |
61 | - if(!empty($que['items'])) |
|
61 | + if (!empty($que['items'])) |
|
62 | 62 | { |
63 | 63 | $message = $lang['art_rcd_err_que']; |
64 | 64 | break; |
@@ -67,15 +67,15 @@ discard block |
||
67 | 67 | $artifact_deploy = get_unit_param($unit_id, P_DEPLOY); |
68 | 68 | |
69 | 69 | $sectors_used = 0; |
70 | - foreach($artifact_deploy as $deploy_unit_id => $deploy_unit_level) |
|
70 | + foreach ($artifact_deploy as $deploy_unit_id => $deploy_unit_level) |
|
71 | 71 | { |
72 | - if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) |
|
72 | + if (!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) |
|
73 | 73 | continue; |
74 | 74 | $sectors_used += $levels_deployed; |
75 | 75 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($deploy_unit_id, $levels_deployed, $user, $planetrow['id']); |
76 | 76 | } |
77 | 77 | |
78 | - if($sectors_used == 0) |
|
78 | + if ($sectors_used == 0) |
|
79 | 79 | { |
80 | 80 | $message = $lang['art_rcd_err_no_sense']; |
81 | 81 | break; |
@@ -90,13 +90,13 @@ discard block |
||
90 | 90 | $que_item = null; |
91 | 91 | $que = que_get($user['id'], $planetrow['id'], QUE_RESEARCH, true); |
92 | 92 | $current_que = &$que['ques'][QUE_RESEARCH][$user['id']][0]; |
93 | - if(!empty($current_que)) |
|
93 | + if (!empty($current_que)) |
|
94 | 94 | { |
95 | 95 | reset($current_que); |
96 | 96 | $que_item = &$que['ques'][QUE_RESEARCH][$user['id']][0][key($current_que)]; |
97 | 97 | } |
98 | 98 | |
99 | - if(!empty($que_item) && $que_item['que_time_left'] > 60) |
|
99 | + if (!empty($que_item) && $que_item['que_time_left'] > 60) |
|
100 | 100 | { |
101 | 101 | $unit_level--; |
102 | 102 | $old_time = $que_item['que_time_left']; |
@@ -117,13 +117,13 @@ discard block |
||
117 | 117 | $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, true); |
118 | 118 | $current_que = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']]; |
119 | 119 | // $que_item = &$que['que'][QUE_STRUCTURES][0]; |
120 | - if(!empty($current_que)) |
|
120 | + if (!empty($current_que)) |
|
121 | 121 | { |
122 | 122 | reset($current_que); |
123 | 123 | $que_item = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']][key($current_que)]; |
124 | 124 | } |
125 | 125 | |
126 | - if(isset($que_item) && $que_item['que_time_left'] > 60) |
|
126 | + if (isset($que_item) && $que_item['que_time_left'] > 60) |
|
127 | 127 | { |
128 | 128 | $unit_level--; |
129 | 129 | $old_time = $que_item['que_time_left']; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | break; |
142 | 142 | |
143 | 143 | } |
144 | - if($unit_level != $artifact_level_old) |
|
144 | + if ($unit_level != $artifact_level_old) |
|
145 | 145 | { |
146 | 146 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, $unit_level - $artifact_level_old, $user); |
147 | 147 | 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'))) |
@@ -34,14 +33,12 @@ discard block |
||
34 | 33 | { |
35 | 34 | $new_moon_row = uni_create_moon($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], $user['id'], $moon_chance); |
36 | 35 | $message = sprintf($lang['art_moon_create'][$unit_id], $new_moon_row['name'], uni_render_coordinates($planetrow), HelperString::numberFloorAndFormat($moon_chance)); |
37 | - } |
|
38 | - else |
|
36 | + } else |
|
39 | 37 | { |
40 | 38 | $message = $lang['art_lhc_moon_fail']; |
41 | 39 | } |
42 | 40 | msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_ADMIN, $lang['art_lhc_from'], $lang['art_lhc_subj'], $message); |
43 | - } |
|
44 | - else |
|
41 | + } else |
|
45 | 42 | { |
46 | 43 | $message = $lang['art_moon_exists']; |
47 | 44 | } |
@@ -69,8 +66,9 @@ discard block |
||
69 | 66 | $sectors_used = 0; |
70 | 67 | foreach($artifact_deploy as $deploy_unit_id => $deploy_unit_level) |
71 | 68 | { |
72 | - if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) |
|
73 | - continue; |
|
69 | + if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) { |
|
70 | + continue; |
|
71 | + } |
|
74 | 72 | $sectors_used += $levels_deployed; |
75 | 73 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($deploy_unit_id, $levels_deployed, $user, $planetrow['id']); |
76 | 74 | } |
@@ -104,8 +102,7 @@ discard block |
||
104 | 102 | DBStaticQue::db_que_set_time_left_by_id($que_item['que_id'], $que_item['que_time_left']); |
105 | 103 | $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'])); |
106 | 104 | msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_QUE, $lang['art_heurestic_chip_subj'], $lang['art_heurestic_chip_subj'], $message); |
107 | - } |
|
108 | - else |
|
105 | + } else |
|
109 | 106 | { |
110 | 107 | $message = $lang['art_heurestic_chip_no_research']; |
111 | 108 | } |
@@ -133,8 +130,7 @@ discard block |
||
133 | 130 | $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']) |
134 | 131 | ); |
135 | 132 | msg_send_simple_message($user['id'], 0, 0, MSG_TYPE_QUE, $lang['art_nano_builder_subj'], $lang['art_nano_builder_subj'], $message); |
136 | - } |
|
137 | - else |
|
133 | + } else |
|
138 | 134 | { |
139 | 135 | $message = $lang['art_nano_builder_no_que']; |
140 | 136 | } |
@@ -146,8 +142,7 @@ discard block |
||
146 | 142 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, $unit_level - $artifact_level_old, $user); |
147 | 143 | OldDbChangeSet::db_changeset_apply($db_changeset); |
148 | 144 | } |
149 | - } |
|
150 | - else |
|
145 | + } else |
|
151 | 146 | { |
152 | 147 | $message = $lang['art_err_no_artifact']; |
153 | 148 | } |
@@ -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 | $debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403); |
5 | 5 | } |
6 | 6 | |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | 'rpg_cost' => $rpg_cost, |
13 | 13 | )); |
14 | 14 | |
15 | -if(is_array($shipList)) { |
|
16 | - if(mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) { |
|
15 | +if (is_array($shipList)) { |
|
16 | + if (mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) { |
|
17 | 17 | $intError = MARKET_NO_DM; |
18 | 18 | } |
19 | 19 | |
@@ -30,30 +30,30 @@ discard block |
||
30 | 30 | $qry = array(); |
31 | 31 | $total = array(); |
32 | 32 | $db_changeset = array(); |
33 | - foreach($shipList as $shipID => &$shipCount) { |
|
33 | + foreach ($shipList as $shipID => &$shipCount) { |
|
34 | 34 | $shipCount = ceil(floatval($shipCount)); |
35 | - if(!$shipCount) { |
|
35 | + if (!$shipCount) { |
|
36 | 36 | continue; |
37 | 37 | } |
38 | 38 | |
39 | - if($shipCount < 0) { |
|
39 | + if ($shipCount < 0) { |
|
40 | 40 | $debug->warning('User supplied negative ship count on Black Market page', 'Hack Attempt', 307); |
41 | 41 | $intError = MARKET_NEGATIVE_SHIPS; |
42 | 42 | break; |
43 | 43 | } |
44 | 44 | |
45 | - if($mode == MARKET_SCRAPPER) { |
|
45 | + if ($mode == MARKET_SCRAPPER) { |
|
46 | 46 | $amount = mrc_get_level($user, $planetrow, $shipID, true, true); // $planetrow[get_unit_param($shipID, P_NAME)]; |
47 | - } elseif($mode == MARKET_STOCKMAN) { |
|
47 | + } elseif ($mode == MARKET_STOCKMAN) { |
|
48 | 48 | $amount = $stock[$shipID]; |
49 | 49 | } |
50 | 50 | |
51 | - if($amount < $shipCount) { |
|
51 | + if ($amount < $shipCount) { |
|
52 | 52 | $intError = $error_no_stock; |
53 | 53 | break; |
54 | 54 | } |
55 | 55 | |
56 | - if(!in_array($shipID, sn_get_groups('fleet'))) { |
|
56 | + if (!in_array($shipID, sn_get_groups('fleet'))) { |
|
57 | 57 | $debug->warning('Hack Attempt', 'User supplied non-ship unit ID on Black Market page', 306); |
58 | 58 | $intError = MARKET_NOT_A_SHIP; |
59 | 59 | break; |
@@ -69,16 +69,16 @@ discard block |
||
69 | 69 | $resTemp[RES_CRYSTAL] = floor($build_data[BUILD_CREATE][RES_CRYSTAL] * $shipCount * $config_rpg_scrape_crystal * (-$multiplier)); |
70 | 70 | $resTemp[RES_DEUTERIUM] = floor($build_data[BUILD_CREATE][RES_DEUTERIUM] * $shipCount * $config_rpg_scrape_deuterium * (-$multiplier)); |
71 | 71 | |
72 | - foreach($resTemp as $resID => $resCount) { |
|
72 | + foreach ($resTemp as $resID => $resCount) { |
|
73 | 73 | $total[$resID] += $resCount; |
74 | 74 | } |
75 | 75 | |
76 | 76 | $message .= "<li>{$lang['tech'][$shipID]}: " . HelperString::numberFloorAndFormat($shipCount); |
77 | 77 | } |
78 | 78 | |
79 | - if($mode == MARKET_STOCKMAN && $intError == MARKET_DEAL) { |
|
80 | - foreach($total as $resID => $resCount) { |
|
81 | - if(mrc_get_level($user, $planetrow, $resID, true, true) < -$resCount) { |
|
79 | + if ($mode == MARKET_STOCKMAN && $intError == MARKET_DEAL) { |
|
80 | + foreach ($total as $resID => $resCount) { |
|
81 | + if (mrc_get_level($user, $planetrow, $resID, true, true) < -$resCount) { |
|
82 | 82 | $intError = MARKET_NO_RESOURCES; |
83 | 83 | $debug->warning('Trying to use bug in s/h market', 'S/H Ship Market', 301); |
84 | 84 | break; |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | |
89 | 89 | $intError = ($intError == MARKET_DEAL) && (array_sum($total) == 0) ? $error_zero_res : $intError; |
90 | 90 | |
91 | - if($intError == MARKET_DEAL) { |
|
91 | + if ($intError == MARKET_DEAL) { |
|
92 | 92 | $message .= '</ul>' . $lang["eco_mrk_{$submode}_res"] . '<ul>'; |
93 | - foreach($total as $resID => $resCount) { |
|
94 | - if(!$resCount) { |
|
93 | + foreach ($total as $resID => $resCount) { |
|
94 | + if (!$resCount) { |
|
95 | 95 | continue; |
96 | 96 | } |
97 | 97 | |
@@ -125,38 +125,38 @@ discard block |
||
125 | 125 | 'MESSAGE' => $lang['eco_mrk_errors'][$intError], |
126 | 126 | )); |
127 | 127 | |
128 | - foreach($shipList as $shipID => $shipCount) { |
|
128 | + foreach ($shipList as $shipID => $shipCount) { |
|
129 | 129 | $data['ships'][$shipID] = max(0, intval($shipCount)); |
130 | 130 | } |
131 | 131 | } |
132 | 132 | } |
133 | 133 | $message = ''; |
134 | 134 | |
135 | -if(!$config->eco_stockman_fleet && $config->eco_stockman_fleet_populate) { |
|
136 | - $config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item){return mt_rand(1, 1000);}, sn_get_groups('fleet')))); |
|
135 | +if (!$config->eco_stockman_fleet && $config->eco_stockman_fleet_populate) { |
|
136 | + $config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item) {return mt_rand(1, 1000); }, sn_get_groups('fleet')))); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | tpl_set_resource_info($template, $planetrow, array()); |
140 | 140 | |
141 | -if(!$array) { |
|
141 | +if (!$array) { |
|
142 | 142 | $array = array(); |
143 | 143 | } |
144 | 144 | |
145 | 145 | $group_fleet = sn_get_groups('fleet'); |
146 | -foreach($array as $key => $value) { |
|
147 | - if($mode == MARKET_SCRAPPER) { |
|
146 | +foreach ($array as $key => $value) { |
|
147 | + if ($mode == MARKET_SCRAPPER) { |
|
148 | 148 | $shipID = $value; |
149 | 149 | $amount = mrc_get_level($user, $planetrow, $shipID, false, true); // $planetrow[get_unit_param($shipID, P_NAME)]; |
150 | - } elseif($mode == MARKET_STOCKMAN) { |
|
150 | + } elseif ($mode == MARKET_STOCKMAN) { |
|
151 | 151 | $shipID = $key; |
152 | 152 | $amount = $value; |
153 | 153 | } |
154 | 154 | |
155 | - if(!in_array($shipID, $group_fleet)) { |
|
155 | + if (!in_array($shipID, $group_fleet)) { |
|
156 | 156 | continue; |
157 | 157 | } |
158 | 158 | |
159 | - if($amount > 0) { |
|
159 | + if ($amount > 0) { |
|
160 | 160 | $build_data = eco_get_build_data($user, $planetrow, $shipID); |
161 | 161 | $template->assign_block_vars('ships', array( |
162 | 162 | 'ID' => $shipID, |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | // $same_user = false; |
48 | 48 | // } |
49 | 49 | |
50 | - if(!$user_data) { |
|
50 | + if (!$user_data) { |
|
51 | 51 | messageBox($lang['imp_imperator_none'], $lang['sys_error'], 'index.php', 10); |
52 | 52 | die(); |
53 | 53 | } |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | $stat_array = array(); |
59 | 59 | $query = doquery("SELECT * FROM {{statpoints}} WHERE `stat_type` = 1 AND `id_owner` = {$user_id} ORDER BY `stat_code` DESC;"); |
60 | 60 | $stat_count = classSupernova::$db->db_affected_rows(); |
61 | - while($row = db_fetch($query)) { |
|
62 | - foreach($stat_fields as $field_db_name => $field_template_name) { |
|
61 | + while ($row = db_fetch($query)) { |
|
62 | + foreach ($stat_fields as $field_db_name => $field_template_name) { |
|
63 | 63 | // $stat_count - $row['stat_code'] - для реверсирования ID статы в JS |
64 | 64 | $stat_array[$field_template_name]['DATA'][$stat_count - $row['stat_code']] = $row[$field_db_name]; |
65 | 65 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | $stat_array_date = $stat_array['STAT_DATE']; |
69 | 69 | empty($stat_array_date['DATA']) ? $stat_array_date['DATA'] = array() : false; |
70 | - foreach($stat_array_date['DATA'] as $key => $value) { |
|
70 | + foreach ($stat_array_date['DATA'] as $key => $value) { |
|
71 | 71 | $template->assign_block_vars('stat_date', array( |
72 | 72 | 'ID' => $key, |
73 | 73 | 'VALUE' => $value, |
@@ -77,21 +77,21 @@ discard block |
||
77 | 77 | |
78 | 78 | unset($stat_array['STAT_DATE']); |
79 | 79 | $template_data = array(); |
80 | - foreach($stat_array as $stat_type => &$stat_type_data) { |
|
80 | + foreach ($stat_array as $stat_type => &$stat_type_data) { |
|
81 | 81 | $reverse_min_max = strpos($stat_type, '_RANK') !== false; |
82 | 82 | $stat_type_data['MIN'] = $reverse_min_max ? max($stat_type_data['DATA']) : min($stat_type_data['DATA']); |
83 | 83 | $stat_type_data['MAX'] = $reverse_min_max ? min($stat_type_data['DATA']) : max($stat_type_data['DATA']); |
84 | 84 | $stat_type_data['AVG'] = average($stat_type_data['DATA']); |
85 | - foreach($stat_type_data['DATA'] as $key => $value) { |
|
85 | + foreach ($stat_type_data['DATA'] as $key => $value) { |
|
86 | 86 | $stat_type_data['PERCENT'][$key] = ($stat_type_data['MAX'] - $value ? ($value - $stat_type_data['MIN']) / ($stat_type_data['MAX'] - $stat_type_data['MIN']) : 1) * 100; |
87 | 87 | $template_data[$stat_type][$key]['ID'] = $key; |
88 | 88 | $template_data[$stat_type][$key]['VALUE'] = $value; |
89 | - $template_data[$stat_type][$key]['DELTA'] = ($reverse_min_max ? $stat_type_data['MIN'] - $value : $value - $stat_type_data['MAX']); |
|
89 | + $template_data[$stat_type][$key]['DELTA'] = ($reverse_min_max ? $stat_type_data['MIN'] - $value : $value - $stat_type_data['MAX']); |
|
90 | 90 | $template_data[$stat_type][$key]['PERCENT'] = $stat_type_data['PERCENT'][$key]; |
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
94 | - foreach($template_data as $stat_type => $stat_type_data) { |
|
94 | + foreach ($template_data as $stat_type => $stat_type_data) { |
|
95 | 95 | $template->assign_block_vars('stat', array( |
96 | 96 | 'TYPE' => $stat_type, |
97 | 97 | 'TEXT' => $lang['imp_stat_types'][$stat_type], |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | 'MAX' => $stat_array[$stat_type]['MAX'], |
100 | 100 | 'AVG' => $stat_array[$stat_type]['AVG'], |
101 | 101 | )); |
102 | - foreach($stat_type_data as $stat_entry) { |
|
102 | + foreach ($stat_type_data as $stat_entry) { |
|
103 | 103 | $template->assign_block_vars('stat.entry', $stat_entry); |
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
107 | 107 | |
108 | - if($same_user) { |
|
108 | + if ($same_user) { |
|
109 | 109 | rpg_level_up($user, RPG_STRUCTURE); |
110 | 110 | rpg_level_up($user, RPG_RAID); |
111 | 111 | rpg_level_up($user, RPG_TECH); |
@@ -139,29 +139,29 @@ discard block |
||
139 | 139 | 'builder_xp' => HelperString::numberFloorAndFormat($user_data['xpminier']), |
140 | 140 | 'builder_lvl' => HelperString::numberFloorAndFormat($user_data['lvl_minier']), |
141 | 141 | 'builder_lvl_st' => HelperString::numberFloorAndFormat(rpg_get_miner_xp($user_data['lvl_minier'])), |
142 | - 'builder_lvl_up' => HelperString::numberFloorAndFormat(rpg_get_miner_xp($user_data['lvl_minier']+1)), |
|
142 | + 'builder_lvl_up' => HelperString::numberFloorAndFormat(rpg_get_miner_xp($user_data['lvl_minier'] + 1)), |
|
143 | 143 | 'raid_xp' => HelperString::numberFloorAndFormat($user_data['xpraid']), |
144 | 144 | 'raid_lvl' => HelperString::numberFloorAndFormat($user_data['lvl_raid']), |
145 | - 'raid_lvl_up' => HelperString::numberFloorAndFormat(rpg_get_raider_xp($user_data['lvl_raid']+1)), |
|
145 | + 'raid_lvl_up' => HelperString::numberFloorAndFormat(rpg_get_raider_xp($user_data['lvl_raid'] + 1)), |
|
146 | 146 | 'raids' => HelperString::numberFloorAndFormat($user_data['raids']), |
147 | 147 | 'raidswin' => HelperString::numberFloorAndFormat($user_data['raidswin']), |
148 | 148 | 'raidsloose' => HelperString::numberFloorAndFormat($user_data['raidsloose']), |
149 | 149 | 'tech_xp' => HelperString::numberFloorAndFormat($user_data['player_rpg_tech_xp']), |
150 | 150 | 'tech_lvl' => HelperString::numberFloorAndFormat($user_data['player_rpg_tech_level']), |
151 | 151 | 'tech_lvl_st' => HelperString::numberFloorAndFormat(rpg_get_tech_xp($user_data['player_rpg_tech_level'])), |
152 | - 'tech_lvl_up' => HelperString::numberFloorAndFormat(rpg_get_tech_xp($user_data['player_rpg_tech_level']+1)), |
|
152 | + 'tech_lvl_up' => HelperString::numberFloorAndFormat(rpg_get_tech_xp($user_data['player_rpg_tech_level'] + 1)), |
|
153 | 153 | |
154 | 154 | 'explore_xp' => HelperString::numberFloorAndFormat($user_data['player_rpg_explore_xp']), |
155 | 155 | 'explore_lvl' => HelperString::numberFloorAndFormat($user_data['player_rpg_explore_level']), |
156 | 156 | 'explore_lvl_st' => HelperString::numberFloorAndFormat(rpg_get_explore_xp($user_data['player_rpg_explore_level'])), |
157 | - 'explore_lvl_up' => HelperString::numberFloorAndFormat(rpg_get_explore_xp($user_data['player_rpg_explore_level']+1)), |
|
158 | - |
|
159 | - 'build_points' => HelperString::numberFloorAndFormat( $StatRecord['build_points'] ), |
|
160 | - 'tech_points' => HelperString::numberFloorAndFormat( $StatRecord['tech_points'] ), |
|
161 | - 'fleet_points' => HelperString::numberFloorAndFormat( $StatRecord['fleet_points'] ), |
|
162 | - 'defs_points' => HelperString::numberFloorAndFormat( $StatRecord['defs_points'] ), |
|
163 | - 'res_points' => HelperString::numberFloorAndFormat( $StatRecord['res_points'] ), |
|
164 | - 'total_points' => HelperString::numberFloorAndFormat( $StatRecord['total_points'] ), |
|
157 | + 'explore_lvl_up' => HelperString::numberFloorAndFormat(rpg_get_explore_xp($user_data['player_rpg_explore_level'] + 1)), |
|
158 | + |
|
159 | + 'build_points' => HelperString::numberFloorAndFormat($StatRecord['build_points']), |
|
160 | + 'tech_points' => HelperString::numberFloorAndFormat($StatRecord['tech_points']), |
|
161 | + 'fleet_points' => HelperString::numberFloorAndFormat($StatRecord['fleet_points']), |
|
162 | + 'defs_points' => HelperString::numberFloorAndFormat($StatRecord['defs_points']), |
|
163 | + 'res_points' => HelperString::numberFloorAndFormat($StatRecord['res_points']), |
|
164 | + 'total_points' => HelperString::numberFloorAndFormat($StatRecord['total_points']), |
|
165 | 165 | 'user_rank' => $StatRecord['total_rank'], |
166 | 166 | 'RANK_DIFF' => $StatRecord['total_old_rank'] - $StatRecord['total_rank'], |
167 | 167 |
@@ -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--; |
@@ -109,33 +109,33 @@ discard block |
||
109 | 109 | `ube_report_time_combat` = '" . date(FMT_DATE_TIME_SQL, $combat_data[UBE_TIME]) . "', |
110 | 110 | `ube_report_time_spent` = {$combat_data[UBE_TIME_SPENT]}, |
111 | 111 | |
112 | - `ube_report_combat_admin` = " . (int)$combat_data[UBE_OPTIONS][UBE_COMBAT_ADMIN] . ", |
|
112 | + `ube_report_combat_admin` = " . (int) $combat_data[UBE_OPTIONS][UBE_COMBAT_ADMIN] . ", |
|
113 | 113 | `ube_report_mission_type` = {$combat_data[UBE_OPTIONS][UBE_MISSION_TYPE]}, |
114 | 114 | |
115 | 115 | `ube_report_combat_result` = {$outcome[UBE_COMBAT_RESULT]}, |
116 | - `ube_report_combat_sfr` = " . (int)$outcome[UBE_SFR] . ", |
|
116 | + `ube_report_combat_sfr` = " . (int) $outcome[UBE_SFR] . ", |
|
117 | 117 | |
118 | - `ube_report_debris_metal` = " . (float)$outcome[UBE_DEBRIS][RES_METAL] . ", |
|
119 | - `ube_report_debris_crystal` = " . (float)$outcome[UBE_DEBRIS][RES_CRYSTAL] . ", |
|
118 | + `ube_report_debris_metal` = " . (float) $outcome[UBE_DEBRIS][RES_METAL] . ", |
|
119 | + `ube_report_debris_crystal` = " . (float) $outcome[UBE_DEBRIS][RES_CRYSTAL] . ", |
|
120 | 120 | `ube_report_debris_total_in_metal` = " . $ube_report_debris_total_in_metal . ", |
121 | 121 | |
122 | - `ube_report_planet_id` = " . (int)$outcome[UBE_PLANET][PLANET_ID] . ", |
|
122 | + `ube_report_planet_id` = " . (int) $outcome[UBE_PLANET][PLANET_ID] . ", |
|
123 | 123 | `ube_report_planet_name` = '" . db_escape($outcome[UBE_PLANET][PLANET_NAME]) . "', |
124 | - `ube_report_planet_size` = " . (int)$outcome[UBE_PLANET][PLANET_SIZE] . ", |
|
125 | - `ube_report_planet_galaxy` = " . (int)$outcome[UBE_PLANET][PLANET_GALAXY] . ", |
|
126 | - `ube_report_planet_system` = " . (int)$outcome[UBE_PLANET][PLANET_SYSTEM] . ", |
|
127 | - `ube_report_planet_planet` = " . (int)$outcome[UBE_PLANET][PLANET_PLANET] . ", |
|
128 | - `ube_report_planet_planet_type` = " . (int)$outcome[UBE_PLANET][PLANET_TYPE] . ", |
|
124 | + `ube_report_planet_size` = " . (int) $outcome[UBE_PLANET][PLANET_SIZE] . ", |
|
125 | + `ube_report_planet_galaxy` = " . (int) $outcome[UBE_PLANET][PLANET_GALAXY] . ", |
|
126 | + `ube_report_planet_system` = " . (int) $outcome[UBE_PLANET][PLANET_SYSTEM] . ", |
|
127 | + `ube_report_planet_planet` = " . (int) $outcome[UBE_PLANET][PLANET_PLANET] . ", |
|
128 | + `ube_report_planet_planet_type` = " . (int) $outcome[UBE_PLANET][PLANET_TYPE] . ", |
|
129 | 129 | |
130 | - `ube_report_moon` = " . (int)$outcome[UBE_MOON] . ", |
|
131 | - `ube_report_moon_chance` = " . (int)$outcome[UBE_MOON_CHANCE] . ", |
|
132 | - `ube_report_moon_size` = " . (float)$outcome[UBE_MOON_SIZE] . ", |
|
130 | + `ube_report_moon` = " . (int) $outcome[UBE_MOON] . ", |
|
131 | + `ube_report_moon_chance` = " . (int) $outcome[UBE_MOON_CHANCE] . ", |
|
132 | + `ube_report_moon_size` = " . (float) $outcome[UBE_MOON_SIZE] . ", |
|
133 | 133 | |
134 | - `ube_report_moon_reapers` = " . (int)$outcome[UBE_MOON_REAPERS] . ", |
|
135 | - `ube_report_moon_destroy_chance` = " . (int)$outcome[UBE_MOON_DESTROY_CHANCE] . ", |
|
136 | - `ube_report_moon_reapers_die_chance` = " . (int)$outcome[UBE_MOON_REAPERS_DIE_CHANCE] . ", |
|
134 | + `ube_report_moon_reapers` = " . (int) $outcome[UBE_MOON_REAPERS] . ", |
|
135 | + `ube_report_moon_destroy_chance` = " . (int) $outcome[UBE_MOON_DESTROY_CHANCE] . ", |
|
136 | + `ube_report_moon_reapers_die_chance` = " . (int) $outcome[UBE_MOON_REAPERS_DIE_CHANCE] . ", |
|
137 | 137 | |
138 | - `ube_report_capture_result` = " . (int)$outcome[UBE_CAPTURE_RESULT] . " |
|
138 | + `ube_report_capture_result` = " . (int) $outcome[UBE_CAPTURE_RESULT] . " |
|
139 | 139 | "); |
140 | 140 | $ube_report_id = $combat_data[UBE_REPORT_ID] = db_insert_id(); |
141 | 141 | |
@@ -146,11 +146,11 @@ discard block |
||
146 | 146 | $player_id, |
147 | 147 | |
148 | 148 | "'" . db_escape($player_info[UBE_NAME]) . "'", |
149 | - (int)$player_info[UBE_ATTACKER], |
|
149 | + (int) $player_info[UBE_ATTACKER], |
|
150 | 150 | |
151 | - (float)$player_info[UBE_BONUSES][UBE_ATTACK], |
|
152 | - (float)$player_info[UBE_BONUSES][UBE_SHIELD], |
|
153 | - (float)$player_info[UBE_BONUSES][UBE_ARMOR], |
|
151 | + (float) $player_info[UBE_BONUSES][UBE_ATTACK], |
|
152 | + (float) $player_info[UBE_BONUSES][UBE_SHIELD], |
|
153 | + (float) $player_info[UBE_BONUSES][UBE_ARMOR], |
|
154 | 154 | ); |
155 | 155 | } |
156 | 156 | |
@@ -163,20 +163,20 @@ discard block |
||
163 | 163 | $fleet_info[UBE_OWNER], |
164 | 164 | $fleet_id, |
165 | 165 | |
166 | - (float)$fleet_info[UBE_PLANET][PLANET_ID], |
|
166 | + (float) $fleet_info[UBE_PLANET][PLANET_ID], |
|
167 | 167 | "'" . db_escape($fleet_info[UBE_PLANET][PLANET_NAME]) . "'", |
168 | - (int)$fleet_info[UBE_PLANET][PLANET_GALAXY], |
|
169 | - (int)$fleet_info[UBE_PLANET][PLANET_SYSTEM], |
|
170 | - (int)$fleet_info[UBE_PLANET][PLANET_PLANET], |
|
171 | - (int)$fleet_info[UBE_PLANET][PLANET_TYPE], |
|
172 | - |
|
173 | - (float)$fleet_info[UBE_RESOURCES][RES_METAL], |
|
174 | - (float)$fleet_info[UBE_RESOURCES][RES_CRYSTAL], |
|
175 | - (float)$fleet_info[UBE_RESOURCES][RES_DEUTERIUM], |
|
176 | - |
|
177 | - (float)$fleet_info[UBE_BONUSES][UBE_ATTACK], |
|
178 | - (float)$fleet_info[UBE_BONUSES][UBE_SHIELD], |
|
179 | - (float)$fleet_info[UBE_BONUSES][UBE_ARMOR], |
|
168 | + (int) $fleet_info[UBE_PLANET][PLANET_GALAXY], |
|
169 | + (int) $fleet_info[UBE_PLANET][PLANET_SYSTEM], |
|
170 | + (int) $fleet_info[UBE_PLANET][PLANET_PLANET], |
|
171 | + (int) $fleet_info[UBE_PLANET][PLANET_TYPE], |
|
172 | + |
|
173 | + (float) $fleet_info[UBE_RESOURCES][RES_METAL], |
|
174 | + (float) $fleet_info[UBE_RESOURCES][RES_CRYSTAL], |
|
175 | + (float) $fleet_info[UBE_RESOURCES][RES_DEUTERIUM], |
|
176 | + |
|
177 | + (float) $fleet_info[UBE_BONUSES][UBE_ATTACK], |
|
178 | + (float) $fleet_info[UBE_BONUSES][UBE_SHIELD], |
|
179 | + (float) $fleet_info[UBE_BONUSES][UBE_ARMOR], |
|
180 | 180 | ); |
181 | 181 | |
182 | 182 | // Сохраняем итоговую информацию по ресурсам флота - потеряно, выброшено, увезено |
@@ -185,19 +185,19 @@ discard block |
||
185 | 185 | $ube_report_id, |
186 | 186 | $fleet_id, |
187 | 187 | |
188 | - (float)$fleet_outcome_data[UBE_RESOURCES_LOST][RES_METAL], |
|
189 | - (float)$fleet_outcome_data[UBE_RESOURCES_LOST][RES_CRYSTAL], |
|
190 | - (float)$fleet_outcome_data[UBE_RESOURCES_LOST][RES_DEUTERIUM], |
|
188 | + (float) $fleet_outcome_data[UBE_RESOURCES_LOST][RES_METAL], |
|
189 | + (float) $fleet_outcome_data[UBE_RESOURCES_LOST][RES_CRYSTAL], |
|
190 | + (float) $fleet_outcome_data[UBE_RESOURCES_LOST][RES_DEUTERIUM], |
|
191 | 191 | |
192 | - (float)$fleet_outcome_data[UBE_CARGO_DROPPED][RES_METAL], |
|
193 | - (float)$fleet_outcome_data[UBE_CARGO_DROPPED][RES_CRYSTAL], |
|
194 | - (float)$fleet_outcome_data[UBE_CARGO_DROPPED][RES_DEUTERIUM], |
|
192 | + (float) $fleet_outcome_data[UBE_CARGO_DROPPED][RES_METAL], |
|
193 | + (float) $fleet_outcome_data[UBE_CARGO_DROPPED][RES_CRYSTAL], |
|
194 | + (float) $fleet_outcome_data[UBE_CARGO_DROPPED][RES_DEUTERIUM], |
|
195 | 195 | |
196 | - (float)$fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_METAL], |
|
197 | - (float)$fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_CRYSTAL], |
|
198 | - (float)$fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_DEUTERIUM], |
|
196 | + (float) $fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_METAL], |
|
197 | + (float) $fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_CRYSTAL], |
|
198 | + (float) $fleet_outcome_data[UBE_RESOURCES_LOOTED][RES_DEUTERIUM], |
|
199 | 199 | |
200 | - (float)$fleet_outcome_data[UBE_RESOURCES_LOST_IN_METAL][RES_METAL], |
|
200 | + (float) $fleet_outcome_data[UBE_RESOURCES_LOST_IN_METAL][RES_METAL], |
|
201 | 201 | ); |
202 | 202 | |
203 | 203 | // Сохраняем результаты по юнитам - потеряно и восстановлено |
@@ -209,8 +209,8 @@ discard block |
||
209 | 209 | $fleet_id, |
210 | 210 | |
211 | 211 | $unit_id, |
212 | - (float)$fleet_outcome_data[UBE_DEFENCE_RESTORE][$unit_id], |
|
213 | - (float)$fleet_outcome_data[UBE_UNITS_LOST][$unit_id], |
|
212 | + (float) $fleet_outcome_data[UBE_DEFENCE_RESTORE][$unit_id], |
|
213 | + (float) $fleet_outcome_data[UBE_UNITS_LOST][$unit_id], |
|
214 | 214 | |
215 | 215 | $unit_sort_order, |
216 | 216 | ); |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | |
234 | 234 | $unit_id, |
235 | 235 | $unit_count, |
236 | - (int)$fleet_data[UBE_UNITS_BOOM][$unit_id], |
|
236 | + (int) $fleet_data[UBE_UNITS_BOOM][$unit_id], |
|
237 | 237 | |
238 | 238 | $fleet_data[UBE_ATTACK][$unit_id], |
239 | 239 | $fleet_data[UBE_SHIELD][$unit_id], |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | MT_EXPLORE => 'flt_mission_explore', |
210 | 210 | ); |
211 | 211 | foreach ($missions_used as $mission_id => $cork) { |
212 | - if(empty($mission_files[$mission_id])) { |
|
212 | + if (empty($mission_files[$mission_id])) { |
|
213 | 213 | continue; |
214 | 214 | } |
215 | 215 | |
@@ -474,15 +474,11 @@ discard block |
||
474 | 474 | protected function flt_flyingFleetsSort($a, $b) { |
475 | 475 | return |
476 | 476 | // Сравниваем время флотов - кто раньше, тот и первый обрабатывается |
477 | - $a['fleet_time'] > $b['fleet_time'] ? 1 : ($a['fleet_time'] < $b['fleet_time'] ? -1 : |
|
478 | - // Если время - одинаковое, сравниваем события флотов |
|
477 | + $a['fleet_time'] > $b['fleet_time'] ? 1 : ($a['fleet_time'] < $b['fleet_time'] ? -1 : // Если время - одинаковое, сравниваем события флотов |
|
479 | 478 | // Если события - одинаковые, то флоты равны |
480 | - ($a['fleet_event'] == $b['fleet_event'] ? 0 : |
|
481 | - // Если события разные - первыми считаем прибывающие флоты |
|
482 | - ($a['fleet_event'] == EVENT_FLT_ARRIVE ? 1 : ($b['fleet_event'] == EVENT_FLT_ARRIVE ? -1 : |
|
483 | - // Если нет прибывающих флотов - дальше считаем флоты, которые закончили миссию |
|
484 | - ($a['fleet_event'] == EVENT_FLT_ACOMPLISH ? 1 : ($b['fleet_event'] == EVENT_FLT_ACOMPLISH ? -1 : |
|
485 | - // Если нет флотов, закончивших задание - остались возвращающиеся флоты, которые равны между собой |
|
479 | + ($a['fleet_event'] == $b['fleet_event'] ? 0 : // Если события разные - первыми считаем прибывающие флоты |
|
480 | + ($a['fleet_event'] == EVENT_FLT_ARRIVE ? 1 : ($b['fleet_event'] == EVENT_FLT_ARRIVE ? -1 : // Если нет прибывающих флотов - дальше считаем флоты, которые закончили миссию |
|
481 | + ($a['fleet_event'] == EVENT_FLT_ACOMPLISH ? 1 : ($b['fleet_event'] == EVENT_FLT_ACOMPLISH ? -1 : // Если нет флотов, закончивших задание - остались возвращающиеся флоты, которые равны между собой |
|
486 | 482 | // TODO: Добавить еще проверку по ID флота и/или времени запуска - что бы обсчитывать их в порядке запуска |
487 | 483 | ( |
488 | 484 | 0 // Вообще сюда доходить не должно - будет отсекаться на равенстве событий |
@@ -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); |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | |
97 | 97 | for ($Option = 10; $Option >= 0; $Option--) |
98 | 98 | { |
99 | - $template->assign_block_vars('option', array( |
|
100 | - 'VALUE' => $Option * 10, |
|
101 | - )); |
|
99 | + $template->assign_block_vars('option', array( |
|
100 | + 'VALUE' => $Option * 10, |
|
101 | + )); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | $capsObj = new ResourceCalculations(); |
@@ -165,12 +165,12 @@ discard block |
||
165 | 165 | int_calc_storage_bar(RES_DEUTERIUM, $capsObj); |
166 | 166 | |
167 | 167 | $template->assign_vars(array( |
168 | - 'PLANET_NAME' => $planetrow['name'], |
|
169 | - 'PLANET_TYPE' => $planetrow['planet_type'], |
|
168 | + 'PLANET_NAME' => $planetrow['name'], |
|
169 | + 'PLANET_TYPE' => $planetrow['planet_type'], |
|
170 | 170 | |
171 | - 'PRODUCTION_LEVEL' => floor($capsObj->efficiency * 100), |
|
171 | + 'PRODUCTION_LEVEL' => floor($capsObj->efficiency * 100), |
|
172 | 172 | |
173 | - 'PAGE_HINT' => $lang['res_hint'], |
|
173 | + 'PAGE_HINT' => $lang['res_hint'], |
|
174 | 174 | )); |
175 | 175 | |
176 | 176 | display($template, $lang['res_planet_production']); |
@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | ]); |
51 | 51 | }; |
52 | 52 | |
53 | -$ValidList['percent'] = array ( 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 ); |
|
53 | +$ValidList['percent'] = array(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100); |
|
54 | 54 | $template = gettemplate('resources', true); |
55 | 55 | |
56 | 56 | $planet = new \Planet\Planet($planetrow['id']); |
57 | -if(!empty($transmutation_result = $planet->sn_sys_planet_core_transmute($user))) { |
|
57 | +if (!empty($transmutation_result = $planet->sn_sys_planet_core_transmute($user))) { |
|
58 | 58 | $template->assign_block_vars('result', $transmutation_result); |
59 | 59 | $planet = new \Planet\Planet($planetrow['id']); |
60 | 60 | } |
@@ -63,20 +63,20 @@ discard block |
||
63 | 63 | $production = $_POST['production']; |
64 | 64 | //$SubQry = ''; |
65 | 65 | $SubQry = array(); |
66 | -if(is_array($production)) { |
|
67 | - foreach($production as $prod_id => $percent) { |
|
68 | - if($percent > 100 || $percent < 0) { |
|
66 | +if (is_array($production)) { |
|
67 | + foreach ($production as $prod_id => $percent) { |
|
68 | + if ($percent > 100 || $percent < 0) { |
|
69 | 69 | $debug->warning('Supplying wrong production percent (less then 0 or greater then 100)', 'Hack attempt', 302, array('base_dump' => true)); |
70 | 70 | die(); |
71 | 71 | } |
72 | 72 | |
73 | 73 | $prod_id = intval($prod_id); |
74 | - if(in_array($prod_id, $sn_group_factories) && get_unit_param($prod_id, P_MINING_IS_MANAGED)) { |
|
74 | + if (in_array($prod_id, $sn_group_factories) && get_unit_param($prod_id, P_MINING_IS_MANAGED)) { |
|
75 | 75 | $field_name = pname_factory_production_field_name($prod_id); |
76 | 76 | $percent = floor($percent / 10); |
77 | 77 | $planetrow[$field_name] = $percent; |
78 | 78 | //$SubQry .= "`{$field_name}` = '{$percent}',"; |
79 | - $SubQry[] = "`{$field_name}` = '{$percent}'"; |
|
79 | + $SubQry[] = "`{$field_name}` = '{$percent}'"; |
|
80 | 80 | } else { |
81 | 81 | $debug->warning('Supplying wrong ID in production array - attempt to change some field - ID' . $prod_id, 'Resource Page', 301); |
82 | 82 | continue; |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | 'ENERGY_TYPE' => prettyNumberStyledDefault($capsObj->productionCurrentMatrix[RES_ENERGY][0]), |
114 | 114 | )); |
115 | 115 | |
116 | -foreach($sn_group_factories as $unit_id) |
|
116 | +foreach ($sn_group_factories as $unit_id) |
|
117 | 117 | { |
118 | - if(mrc_get_level($user, $planetrow, $unit_id) > 0 && get_unit_param($unit_id)) |
|
118 | + if (mrc_get_level($user, $planetrow, $unit_id) > 0 && get_unit_param($unit_id)) |
|
119 | 119 | { |
120 | 120 | $level_plain = mrc_get_level($user, $planetrow, $unit_id, false, true); |
121 | 121 | $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 |