@@ -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 | |
@@ -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 | } |
@@ -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 | /** |
@@ -58,8 +58,8 @@ |
||
| 58 | 58 | protected function bonusSort(BonusAtom $a, BonusAtom $b) { |
| 59 | 59 | static $bonusOrder = [BonusAtom::class, BonusAtomAbility::class, BonusAtomAdd::class, BonusAtomPercent::class, BonusAtomMultiply::class]; |
| 60 | 60 | |
| 61 | - $indexA = (int)array_search(get_class($a), $bonusOrder); |
|
| 62 | - $indexB = (int)array_search(get_class($b), $bonusOrder); |
|
| 61 | + $indexA = (int) array_search(get_class($a), $bonusOrder); |
|
| 62 | + $indexB = (int) array_search(get_class($b), $bonusOrder); |
|
| 63 | 63 | |
| 64 | 64 | return $indexA == $indexB ? 0 : ($indexA > $indexB ? +1 : -1); |
| 65 | 65 | } |
@@ -48,20 +48,20 @@ discard block |
||
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | protected function initValues() { |
| 51 | - $this[UNIT_SERVER_SPEED_BUILDING] = function (ValueStorage $vs) { |
|
| 51 | + $this[UNIT_SERVER_SPEED_BUILDING] = function(ValueStorage $vs) { |
|
| 52 | 52 | return new ValueBonused(UNIT_SERVER_SPEED_BUILDING, floatval($vs->getGlobalContainer()->config->game_speed)); |
| 53 | 53 | }; |
| 54 | - $this[UNIT_SERVER_SPEED_MINING] = function (ValueStorage $vs) { |
|
| 54 | + $this[UNIT_SERVER_SPEED_MINING] = function(ValueStorage $vs) { |
|
| 55 | 55 | return new ValueBonused(UNIT_SERVER_SPEED_MINING, floatval($vs->getGlobalContainer()->config->resource_multiplier)); |
| 56 | 56 | }; |
| 57 | - $this[UNIT_SERVER_SPEED_FLEET] = function (ValueStorage $vs) { |
|
| 57 | + $this[UNIT_SERVER_SPEED_FLEET] = function(ValueStorage $vs) { |
|
| 58 | 58 | return new ValueBonused(UNIT_SERVER_SPEED_FLEET, floatval($vs->getGlobalContainer()->config->fleet_speed)); |
| 59 | 59 | }; |
| 60 | - $this[UNIT_SERVER_SPEED_EXPEDITION] = function (ValueStorage $vs) { |
|
| 60 | + $this[UNIT_SERVER_SPEED_EXPEDITION] = function(ValueStorage $vs) { |
|
| 61 | 61 | return new ValueBonused(UNIT_SERVER_SPEED_EXPEDITION, floatval(1)); |
| 62 | 62 | }; |
| 63 | 63 | |
| 64 | - $this[UNIT_SERVER_FLEET_NOOB_POINTS] = function (ValueStorage $vs) { |
|
| 64 | + $this[UNIT_SERVER_FLEET_NOOB_POINTS] = function(ValueStorage $vs) { |
|
| 65 | 65 | $config = $vs->getGlobalContainer()->config; |
| 66 | 66 | |
| 67 | 67 | return new ValueBonused( |
@@ -69,11 +69,11 @@ discard block |
||
| 69 | 69 | floatval($config->game_noob_points * $vs->getBase(UNIT_SERVER_SPEED_MINING)) |
| 70 | 70 | ); |
| 71 | 71 | }; |
| 72 | - $this[UNIT_SERVER_FLEET_NOOB_FACTOR] = function (ValueStorage $vs) { |
|
| 72 | + $this[UNIT_SERVER_FLEET_NOOB_FACTOR] = function(ValueStorage $vs) { |
|
| 73 | 73 | return new ValueBonused(UNIT_SERVER_FLEET_NOOB_FACTOR, floatval($vs->getGlobalContainer()->config->game_noob_factor)); |
| 74 | 74 | }; |
| 75 | 75 | |
| 76 | - $this[UNIT_SERVER_PAYMENT_MM_PER_CURRENCY] = function (ValueStorage $vs) { |
|
| 76 | + $this[UNIT_SERVER_PAYMENT_MM_PER_CURRENCY] = function(ValueStorage $vs) { |
|
| 77 | 77 | return new ValueBonused(UNIT_SERVER_PAYMENT_MM_PER_CURRENCY, floatval($vs->getGlobalContainer()->config->payment_currency_exchange_mm_)); |
| 78 | 78 | }; |
| 79 | 79 | } |
@@ -105,7 +105,7 @@ |
||
| 105 | 105 | * @return int |
| 106 | 106 | */ |
| 107 | 107 | public function getMaxLevel() { |
| 108 | - $snId = $this->getSnId(); |
|
| 108 | + $snId = $this->getSnId(); |
|
| 109 | 109 | return !empty($snId) ? get_unit_param($snId, P_MAX_STACK) : 0; |
| 110 | 110 | } |
| 111 | 111 | |
@@ -165,8 +165,7 @@ discard block |
||
| 165 | 165 | $planet_info[PLANET_SYSTEM], |
| 166 | 166 | $planet_info[PLANET_PLANET], |
| 167 | 167 | htmlentities($planet_info[PLANET_NAME], ENT_COMPAT, 'UTF-8'), |
| 168 | - $lang[$outcome['UBE_COMBAT_RESULT'] == UBE_COMBAT_RESULT_WIN ? 'ube_report_info_outcome_win' : |
|
| 169 | - ($outcome['UBE_COMBAT_RESULT'] == UBE_COMBAT_RESULT_DRAW ? 'ube_report_info_outcome_draw' : 'ube_report_info_outcome_loss')] |
|
| 168 | + $lang[$outcome['UBE_COMBAT_RESULT'] == UBE_COMBAT_RESULT_WIN ? 'ube_report_info_outcome_win' : ($outcome['UBE_COMBAT_RESULT'] == UBE_COMBAT_RESULT_DRAW ? 'ube_report_info_outcome_draw' : 'ube_report_info_outcome_loss')] |
|
| 170 | 169 | ); |
| 171 | 170 | |
| 172 | 171 | $text_defender = ''; |
@@ -251,7 +250,7 @@ discard block |
||
| 251 | 250 | // Просматриваем результаты изменения флотов |
| 252 | 251 | foreach ($fleet_info[UBE_COUNT] as $unit_id => $unit_count) { |
| 253 | 252 | // Перебираем аутком на случай восстановления юнитов |
| 254 | - $units_lost = (float)$fleets_outcome[$fleet_id][UBE_UNITS_LOST][$unit_id]; |
|
| 253 | + $units_lost = (float) $fleets_outcome[$fleet_id][UBE_UNITS_LOST][$unit_id]; |
|
| 255 | 254 | |
| 256 | 255 | $units_left = $unit_count - $units_lost; |
| 257 | 256 | if ($fleet_id) { |
@@ -275,7 +274,7 @@ discard block |
||
| 275 | 274 | // Если во флоте остались юниты или это планета - генерируем изменение ресурсов |
| 276 | 275 | if ($new_fleet_count || !$fleet_id) { |
| 277 | 276 | foreach (sn_get_groups('resources_loot') as $resource_id) { |
| 278 | - $resource_change = (float)$fleets_outcome[$fleet_id][UBE_RESOURCES_LOOTED][$resource_id] + (float)$fleets_outcome[$fleet_id][UBE_CARGO_DROPPED][$resource_id]; |
|
| 277 | + $resource_change = (float) $fleets_outcome[$fleet_id][UBE_RESOURCES_LOOTED][$resource_id] + (float) $fleets_outcome[$fleet_id][UBE_CARGO_DROPPED][$resource_id]; |
|
| 279 | 278 | if ($resource_change) { |
| 280 | 279 | $resource_db_name = ($fleet_id ? 'fleet_resource_' : '') . pname_resource_name($resource_id); |
| 281 | 280 | $fleet_delta[$resource_db_name] = -($resource_change); |