@@ -9,7 +9,7 @@ |
||
| 9 | 9 | * @return int|mixed |
| 10 | 10 | */ |
| 11 | 11 | function flt_mission_colonize($fleetEvent) { |
| 12 | - $fleet_row = $fleetEvent->fleet; |
|
| 12 | + $fleet_row = $fleetEvent->fleet; |
|
| 13 | 13 | /** @noinspection PhpDeprecationInspection */ |
| 14 | 14 | $fleetOwnerRow = db_user_by_id($fleetEvent->fleet['fleet_owner'], true); |
| 15 | 15 | |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | use DBAL\db_mysql; |
| 4 | 4 | |
| 5 | -if(!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) |
|
| 5 | +if (!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) |
|
| 6 | 6 | { |
| 7 | 7 | $debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403); |
| 8 | 8 | } |
@@ -17,50 +17,50 @@ discard block |
||
| 17 | 17 | )); |
| 18 | 18 | |
| 19 | 19 | $info_action = sys_get_param_int('action'); |
| 20 | -if($info_action) |
|
| 20 | +if ($info_action) |
|
| 21 | 21 | { |
| 22 | 22 | try |
| 23 | 23 | { |
| 24 | 24 | db_mysql::db_transaction_start(); |
| 25 | 25 | |
| 26 | 26 | $user = db_user_by_id($user['id'], true); |
| 27 | - if(mrc_get_level($user, null, RES_DARK_MATTER) < $config->rpg_cost_info) |
|
| 27 | + if (mrc_get_level($user, null, RES_DARK_MATTER) < $config->rpg_cost_info) |
|
| 28 | 28 | { |
| 29 | 29 | throw new Exception(MARKET_NO_DM, ERR_ERROR); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - switch($info_action) |
|
| 32 | + switch ($info_action) |
|
| 33 | 33 | { |
| 34 | 34 | case MARKET_INFO_PLAYER: |
| 35 | 35 | $user_info_name_or_id_unsafe = sys_get_param_str_unsafe('user_info_name'); |
| 36 | - if(!$user_info_name_or_id_unsafe) |
|
| 36 | + if (!$user_info_name_or_id_unsafe) |
|
| 37 | 37 | { |
| 38 | 38 | throw new Exception(MARKET_INFO_PLAYER_WRONG, ERR_ERROR); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if(is_id($user_info_name_or_id_unsafe)) |
|
| 41 | + if (is_id($user_info_name_or_id_unsafe)) |
|
| 42 | 42 | { |
| 43 | 43 | $user_info = db_user_by_id($user_info_name_or_id_unsafe, true, true); |
| 44 | 44 | } |
| 45 | - if(!is_array($user_info)) |
|
| 45 | + if (!is_array($user_info)) |
|
| 46 | 46 | { |
| 47 | 47 | $user_info = db_user_by_username($user_info_name_or_id_unsafe, true); |
| 48 | 48 | } |
| 49 | - if(!is_array($user_info)) |
|
| 49 | + if (!is_array($user_info)) |
|
| 50 | 50 | { |
| 51 | 51 | throw new Exception(MARKET_INFO_PLAYER_NOT_FOUND, ERR_ERROR); |
| 52 | 52 | } |
| 53 | - if($user_info['id'] == $user['id']) |
|
| 53 | + if ($user_info['id'] == $user['id']) |
|
| 54 | 54 | { |
| 55 | 55 | throw new Exception(MARKET_INFO_PLAYER_SAME, ERR_ERROR); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | $msg_text = array(); |
| 59 | - foreach(sn_get_groups('mercenaries') as $mercenary_id) |
|
| 59 | + foreach (sn_get_groups('mercenaries') as $mercenary_id) |
|
| 60 | 60 | { |
| 61 | 61 | $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']); |
| 62 | 62 | } |
| 63 | - if($mercenary_level = mrc_get_level($user_info, false, UNIT_PREMIUM)) |
|
| 63 | + if ($mercenary_level = mrc_get_level($user_info, false, UNIT_PREMIUM)) |
|
| 64 | 64 | { |
| 65 | 65 | $msg_text[] = "{$lang['tech'][UNIT_PREMIUM]} - {$mercenary_level} {$lang['sys_level']}"; |
| 66 | 66 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | break; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - 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']}")) |
|
| 77 | + 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']}")) |
|
| 78 | 78 | { |
| 79 | 79 | // TODO: throw new Exception(MARKET_INFO_PLAYER_SAME, ERR_ERROR); |
| 80 | 80 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | static $ship_data, $rates; |
| 54 | 54 | |
| 55 | - $result = array( |
|
| 55 | + $result = array( |
|
| 56 | 56 | '$fleetEvent' => $fleetEvent, |
| 57 | 57 | '$userId' => $fleetEvent->fleet['fleet_owner'], |
| 58 | 58 | '$outcome_list' => array(), |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $fleet_capacity = 0; |
| 93 | 93 | $fleet_metal_points = 0; |
| 94 | 94 | foreach ($fleet as $ship_id => $ship_amount) { |
| 95 | - $unit_info = get_unit_param($ship_id); |
|
| 95 | + $unit_info = get_unit_param($ship_id); |
|
| 96 | 96 | $fleet_capacity += $ship_amount * $unit_info[P_CAPACITY]; |
| 97 | 97 | $fleet_metal_points += $ship_amount * $ship_data[$ship_id][P_COST_METAL]; |
| 98 | 98 | } |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | if ($found_ship_cost > $found_in_metal) { |
| 190 | 190 | unset($can_be_found[$found_ship_id]); |
| 191 | 191 | } else { |
| 192 | - $found_ship_count = mt_rand(1, floor($found_in_metal / $found_ship_cost)); |
|
| 192 | + $found_ship_count = mt_rand(1, floor($found_in_metal / $found_ship_cost)); |
|
| 193 | 193 | $fleet_found[$found_ship_id] += $found_ship_count; |
| 194 | 194 | $found_in_metal -= $found_ship_count * $found_ship_cost; |
| 195 | 195 | } |
@@ -211,11 +211,11 @@ discard block |
||
| 211 | 211 | $found_in_metal = ceil(min($outcome_percent * $fleet_metal_points, game_resource_multiplier(true) * 10000000, $fleet_capacity) * mt_rand(950000, 1050000) / 1000000); // game_speed |
| 212 | 212 | |
| 213 | 213 | $resources_found[RES_METAL] = floor(mt_rand(300000, 700000) / 1000000 * $found_in_metal); |
| 214 | - $found_in_metal -= $resources_found[RES_METAL]; |
|
| 214 | + $found_in_metal -= $resources_found[RES_METAL]; |
|
| 215 | 215 | $found_in_metal = floor($found_in_metal * $rates[RES_METAL] / $rates[RES_CRYSTAL]); |
| 216 | 216 | |
| 217 | 217 | $resources_found[RES_CRYSTAL] = floor(mt_rand(500000, 1000000) / 1000000 * $found_in_metal); |
| 218 | - $found_in_metal -= $resources_found[RES_CRYSTAL]; |
|
| 218 | + $found_in_metal -= $resources_found[RES_CRYSTAL]; |
|
| 219 | 219 | $found_in_metal = floor($found_in_metal * $rates[RES_CRYSTAL] / $rates[RES_DEUTERIUM]); |
| 220 | 220 | |
| 221 | 221 | $resources_found[RES_DEUTERIUM] = $found_in_metal; |
@@ -304,8 +304,7 @@ discard block |
||
| 304 | 304 | $messages = &$messages[$outcome_mission_sub]; |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | - $msg_text = is_string($messages) ? $messages : |
|
| 308 | - (is_array($messages) ? $messages[mt_rand(0, count($messages) - 1)] : ''); |
|
| 307 | + $msg_text = is_string($messages) ? $messages : (is_array($messages) ? $messages[mt_rand(0, count($messages) - 1)] : ''); |
|
| 309 | 308 | } |
| 310 | 309 | $msg_text = sprintf($msg_text, $fleet_row['fleet_id'], uni_render_coordinates($fleet_row, 'fleet_end_')) . |
| 311 | 310 | ($msg_text_addon ? "\r\n" . $msg_text_addon : ''); |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | /** @noinspection SpellCheckingInspection */ |
| 245 | - $updater->upd_alter_table('users', ["DROP COLUMN `dpath`",], $updater->isFieldExists('users', 'dpath')); |
|
| 245 | + $updater->upd_alter_table('users', ["DROP COLUMN `dpath`", ], $updater->isFieldExists('users', 'dpath')); |
|
| 246 | 246 | |
| 247 | 247 | // 2017-06-12 13:47:36 42c1 |
| 248 | 248 | $updater->new_version = 42; |
@@ -255,14 +255,14 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | // 2017-10-11 09:51:49 43a4.3 |
| 257 | 257 | $updater->upd_alter_table('messages', |
| 258 | - ["ADD COLUMN `message_json` tinyint(1) unsigned NOT NULL DEFAULT 0 AFTER `message_text`",], |
|
| 258 | + ["ADD COLUMN `message_json` tinyint(1) unsigned NOT NULL DEFAULT 0 AFTER `message_text`", ], |
|
| 259 | 259 | !$updater->isFieldExists('messages', 'message_json') |
| 260 | 260 | ); |
| 261 | 261 | |
| 262 | 262 | |
| 263 | 263 | // 2017-10-17 09:49:24 43a6.0 |
| 264 | 264 | // Removing old index i_user_id |
| 265 | - $updater->upd_alter_table('counter', ['DROP KEY `i_user_id`',], $updater->isIndexExists('counter', 'i_user_id')); |
|
| 265 | + $updater->upd_alter_table('counter', ['DROP KEY `i_user_id`', ], $updater->isIndexExists('counter', 'i_user_id')); |
|
| 266 | 266 | // Adding new index I_counter_user_id |
| 267 | 267 | $updater->upd_alter_table('counter', |
| 268 | 268 | [ |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | ); |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | - $updater->updPatchApply(1, function () use ($updater) { |
|
| 319 | + $updater->updPatchApply(1, function() use ($updater) { |
|
| 320 | 320 | $q = $updater->upd_do_query("SELECT `messageid`, `user` FROM `{{chat}}`", true); |
| 321 | 321 | while ($row = db_fetch($q)) { |
| 322 | 322 | if (strpos($row['user'], 'a:') !== 0) { |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | }); |
| 340 | 340 | |
| 341 | 341 | // 2018-03-07 09:23:41 43a13.23 + 2018-03-07 12:00:47 43a13.24 |
| 342 | - $updater->updPatchApply(2, function () use ($updater) { |
|
| 342 | + $updater->updPatchApply(2, function() use ($updater) { |
|
| 343 | 343 | $updater->upd_alter_table('festival_gifts', [ |
| 344 | 344 | "ADD COLUMN `disclosure` tinyint(1) unsigned NOT NULL DEFAULT 0 AFTER `amount`", |
| 345 | 345 | "ADD COLUMN `message` VARCHAR(4096) CHARSET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' AFTER `disclosure`", |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | }); |
| 348 | 348 | |
| 349 | 349 | // 2018-03-12 13:23:10 43a13.33 |
| 350 | - $updater->updPatchApply(3, function () use ($updater) { |
|
| 350 | + $updater->updPatchApply(3, function() use ($updater) { |
|
| 351 | 351 | $updater->upd_alter_table('player_options', |
| 352 | 352 | [ |
| 353 | 353 | "MODIFY COLUMN `value` VARCHAR(16000) CHARSET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT ''", |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | }); |
| 358 | 358 | |
| 359 | 359 | // 2018-03-24 21:31:51 43a16.16 - OiS |
| 360 | - $updater->updPatchApply(4, function () use ($updater) { |
|
| 360 | + $updater->updPatchApply(4, function() use ($updater) { |
|
| 361 | 361 | if (!$updater->isTableExists('festival_ois_player')) { |
| 362 | 362 | $updater->upd_create_table( |
| 363 | 363 | 'festival_ois_player', |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | }); |
| 377 | 377 | |
| 378 | 378 | // 2018-03-25 08:11:39 43a16.21 |
| 379 | - $updater->updPatchApply(5, function () use ($updater) { |
|
| 379 | + $updater->updPatchApply(5, function() use ($updater) { |
|
| 380 | 380 | $updater->upd_alter_table( |
| 381 | 381 | 'que', |
| 382 | 382 | "ADD COLUMN `que_unit_one_time_raw` DECIMAL(20,5) NOT NULL DEFAULT 0", |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | $updater->upd_log_version_update(); |
| 394 | 394 | |
| 395 | 395 | // 2018-12-21 14:00:41 44a5 Module "ad_promo_code" support |
| 396 | - $updater->updPatchApply(6, function () use ($updater) { |
|
| 396 | + $updater->updPatchApply(6, function() use ($updater) { |
|
| 397 | 397 | if (!$updater->isTableExists('ad_promo_codes')) { |
| 398 | 398 | $updater->upd_create_table( |
| 399 | 399 | 'ad_promo_codes', |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | }); |
| 435 | 435 | |
| 436 | 436 | // 2018-12-22 11:42:20 44a12 |
| 437 | - $updater->updPatchApply(7, function () use ($updater) { |
|
| 437 | + $updater->updPatchApply(7, function() use ($updater) { |
|
| 438 | 438 | // Creating table for HTTP query strings |
| 439 | 439 | $updater->upd_create_table( |
| 440 | 440 | 'security_query_strings', |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | $updater->upd_log_version_update(); |
| 577 | 577 | |
| 578 | 578 | // 2019-08-15 00:10:48 45a8 |
| 579 | - $updater->updPatchApply(8, function () use ($updater) { |
|
| 579 | + $updater->updPatchApply(8, function() use ($updater) { |
|
| 580 | 580 | if (!$updater->isTableExists('player_ignore')) { |
| 581 | 581 | $updater->upd_create_table( |
| 582 | 582 | 'player_ignore', |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | }, PATCH_REGISTER); |
| 598 | 598 | |
| 599 | 599 | // 2019-08-21 20:14:18 45a19 |
| 600 | - $updater->updPatchApply(9, function () use ($updater) { |
|
| 600 | + $updater->updPatchApply(9, function() use ($updater) { |
|
| 601 | 601 | $updater->upd_alter_table('payment', [ |
| 602 | 602 | 'ADD COLUMN `payment_method_id` smallint DEFAULT NULL AFTER `payment_module_name`', |
| 603 | 603 | 'ADD KEY `I_payment_method_id` (`payment_method_id`)', |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | }, PATCH_REGISTER); |
| 606 | 606 | |
| 607 | 607 | // 2020-02-18 21:00:19 45a71 |
| 608 | - $updater->updPatchApply(10, function () use ($updater) { |
|
| 608 | + $updater->updPatchApply(10, function() use ($updater) { |
|
| 609 | 609 | $name = classConfig::FLEET_UPDATE_MAX_RUN_TIME; |
| 610 | 610 | if (!SN::$gc->config->pass()->$name) { |
| 611 | 611 | SN::$gc->config->pass()->$name = 30; |
@@ -621,14 +621,14 @@ discard block |
||
| 621 | 621 | $updater->upd_log_version_update(); |
| 622 | 622 | |
| 623 | 623 | // 2021-03-03 13:41:05 46a13 |
| 624 | - $updater->updPatchApply(11, function () use ($updater) { |
|
| 624 | + $updater->updPatchApply(11, function() use ($updater) { |
|
| 625 | 625 | $updater->upd_alter_table('festival_gifts', [ |
| 626 | 626 | 'ADD COLUMN `gift_unit_id` bigint(20) NOT NULL DEFAULT 0 AFTER `amount`', |
| 627 | 627 | ], !$updater->isFieldExists('festival_gifts', 'gift_unit_id')); |
| 628 | 628 | }, PATCH_REGISTER); |
| 629 | 629 | |
| 630 | 630 | // 2024-04-13 13:04:16 46a127 |
| 631 | - $updater->updPatchApply(12, function () use ($updater) { |
|
| 631 | + $updater->updPatchApply(12, function() use ($updater) { |
|
| 632 | 632 | $updater->upd_alter_table('config', [ |
| 633 | 633 | "ADD COLUMN `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP", |
| 634 | 634 | "ADD COLUMN `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP", |
@@ -697,28 +697,28 @@ discard block |
||
| 697 | 697 | $updater->upd_log_message("Migrated {$patched}/{$total} festival configuration records"); |
| 698 | 698 | } |
| 699 | 699 | |
| 700 | - $updater->upd_alter_table('que', ['DROP KEY `que_id`',], $updater->isIndexExists('que', 'que_id')); |
|
| 701 | - $updater->upd_alter_table('counter', ['DROP KEY `counter_id`',], $updater->isIndexExists('counter', 'counter_id')); |
|
| 702 | - $updater->upd_alter_table('captain', ['DROP KEY `captain_id`',], $updater->isIndexExists('captain', 'captain_id')); |
|
| 700 | + $updater->upd_alter_table('que', ['DROP KEY `que_id`', ], $updater->isIndexExists('que', 'que_id')); |
|
| 701 | + $updater->upd_alter_table('counter', ['DROP KEY `counter_id`', ], $updater->isIndexExists('counter', 'counter_id')); |
|
| 702 | + $updater->upd_alter_table('captain', ['DROP KEY `captain_id`', ], $updater->isIndexExists('captain', 'captain_id')); |
|
| 703 | 703 | }, PATCH_REGISTER); |
| 704 | 704 | |
| 705 | 705 | // 2024-10-21 21:08:03 46a147 |
| 706 | - $updater->updPatchApply(13, function () use ($updater) { |
|
| 706 | + $updater->updPatchApply(13, function() use ($updater) { |
|
| 707 | 707 | $updater->indexDropIfExists('planets', 'id'); |
| 708 | 708 | $updater->indexDropIfExists('users', 'I_user_id_name'); |
| 709 | 709 | |
| 710 | 710 | $updater->indexReplace( |
| 711 | 711 | 'que', |
| 712 | 712 | 'I_que_planet_id', |
| 713 | - ['que_planet_id', 'que_player_id',], |
|
| 714 | - function () use ($updater) { |
|
| 713 | + ['que_planet_id', 'que_player_id', ], |
|
| 714 | + function() use ($updater) { |
|
| 715 | 715 | $updater->constraintDropIfExists('que', 'FK_que_planet_id'); |
| 716 | 716 | }, |
| 717 | - function () use ($updater) { |
|
| 717 | + function() use ($updater) { |
|
| 718 | 718 | // CONSTRAINT `FK_que_player_id` FOREIGN KEY (`que_player_id`) REFERENCES `sn_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE |
| 719 | 719 | $updater->upd_alter_table( |
| 720 | 720 | 'que', |
| 721 | - ['ADD CONSTRAINT `FK_que_planet_id` FOREIGN KEY (`que_planet_id`) REFERENCES `{{planets}}` (`id`) ON DELETE CASCADE ON UPDATE CASCADE',], |
|
| 721 | + ['ADD CONSTRAINT `FK_que_planet_id` FOREIGN KEY (`que_planet_id`) REFERENCES `{{planets}}` (`id`) ON DELETE CASCADE ON UPDATE CASCADE', ], |
|
| 722 | 722 | true |
| 723 | 723 | ); |
| 724 | 724 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $used_silo = 0; |
| 193 | 193 | foreach ($group_missile as $missile_id) { |
| 194 | 194 | $missile_qued = isset($in_que[$missile_id]) ? $in_que[$missile_id] : 0; |
| 195 | - $used_silo += (mrc_get_level($user, $planet, $missile_id, true, true) + $missile_qued) * get_unit_param($missile_id, P_UNIT_SIZE); |
|
| 195 | + $used_silo += (mrc_get_level($user, $planet, $missile_id, true, true) + $missile_qued) * get_unit_param($missile_id, P_UNIT_SIZE); |
|
| 196 | 196 | } |
| 197 | 197 | $free_silo = mrc_get_level($user, $planet, STRUC_SILO) * get_unit_param(STRUC_SILO, P_CAPACITY) - $used_silo; |
| 198 | 198 | if ($free_silo <= 0) { |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | // $sqlBlock = QueUnitStatic::que_unit_make_sql($unit_id, $user, $planet, $build_data, $new_unit_level, $place, $build_mode); |
| 324 | 324 | $sqlBlock = SN::$gc->pimp->que_unit_make_sql($unit_id, $user, $planet, $build_data, $new_unit_level, $place, $build_mode); |
| 325 | 325 | |
| 326 | - array_walk($sqlBlock, function (&$value, $field) { |
|
| 326 | + array_walk($sqlBlock, function(&$value, $field) { |
|
| 327 | 327 | if ($value === null) { |
| 328 | 328 | $value = 'NULL'; |
| 329 | 329 | } elseif (is_string($value)) { |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | |
| 350 | 350 | |
| 351 | 351 | $unit_amount -= $place; |
| 352 | - $que = que_get($user['id'], $planet['id'], $que_id, true); |
|
| 352 | + $que = que_get($user['id'], $planet['id'], $que_id, true); |
|
| 353 | 353 | $unit_amount_qued += $place; |
| 354 | 354 | } |
| 355 | 355 | |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | } |
| 636 | 636 | |
| 637 | 637 | if ($unit_processed) { |
| 638 | - $unit_processed_delta = $unit_processed * ($que_item['que_unit_mode'] == BUILD_CREATE ? 1 : -1); |
|
| 638 | + $unit_processed_delta = $unit_processed * ($que_item['que_unit_mode'] == BUILD_CREATE ? 1 : -1); |
|
| 639 | 639 | $unit_changes[$que_player_id][$que_planet_id][$que_item['que_unit_id']] += $unit_processed_delta; |
| 640 | 640 | } |
| 641 | 641 | } |
@@ -102,8 +102,7 @@ |
||
| 102 | 102 | |
| 103 | 103 | $core_info = uni_create_planet_get_density($position_data, $user_row, $planet_sectors); |
| 104 | 104 | |
| 105 | - $planet_name_unsafe = !empty($options['force_name']) ? $options['force_name'] : |
|
| 106 | - ($user_row['username'] . ' ' . ( |
|
| 105 | + $planet_name_unsafe = !empty($options['force_name']) ? $options['force_name'] : ($user_row['username'] . ' ' . ( |
|
| 107 | 106 | $HomeWorld |
| 108 | 107 | ? SN::$lang['sys_capital'] |
| 109 | 108 | : ($planet_name_unsafe ?: SN::$lang['sys_colo_default_name']) |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $can_be_destroyed = min($current_target[0], floor($MIPDamage / $current_target[$damageTo])); |
| 62 | 62 | //debug($MIPDamage, 'MIPDamage'); |
| 63 | 63 | //debug($can_be_destroyed, 'Can be destroyed'); |
| 64 | - $destroyed = mt_rand(1, $can_be_destroyed); |
|
| 64 | + $destroyed = mt_rand(1, $can_be_destroyed); |
|
| 65 | 65 | $MIPDamage -= $current_target[$damageTo] * $destroyed; |
| 66 | 66 | $current_target[0] -= $destroyed; |
| 67 | 67 | //debug($destroyed, 'Actually destroyed'); |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | $crystal += $destroyed * $unit_info[P_COST][RES_CRYSTAL] / 4; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - $return['structures'] = $structures; // Structures left after attack |
|
| 85 | - $return['metal'] = floor($metal); // Metal scraps |
|
| 84 | + $return['structures'] = $structures; // Structures left after attack |
|
| 85 | + $return['metal'] = floor($metal); // Metal scraps |
|
| 86 | 86 | $return['crystal'] = floor($crystal); // Crystal scraps |
| 87 | 87 | |
| 88 | 88 | return $return; |
@@ -120,9 +120,9 @@ discard block |
||
| 120 | 120 | db_mysql::db_transaction_start(); |
| 121 | 121 | set_time_limit(15); |
| 122 | 122 | SN::$gc->db->lockRecords([ |
| 123 | - 'users' => [$targetUser['id'], $rowAttacker['id'],], |
|
| 124 | - 'planets' => [$target_planet_row['id'], $sourcePlanet['id'],], |
|
| 125 | - 'iraks' => [$fleetRow['id'],], |
|
| 123 | + 'users' => [$targetUser['id'], $rowAttacker['id'], ], |
|
| 124 | + 'planets' => [$target_planet_row['id'], $sourcePlanet['id'], ], |
|
| 125 | + 'iraks' => [$fleetRow['id'], ], |
|
| 126 | 126 | ]); |
| 127 | 127 | $fleetRow = doquery("SELECT * FROM `{{iraks}}` WHERE `id` = {$fleetRow['id']} FOR UPDATE;", '', true); |
| 128 | 128 | if (empty($fleetRow)) { |
@@ -10,23 +10,23 @@ discard block |
||
| 10 | 10 | $fleet_events = array(); |
| 11 | 11 | $fleet_number = 0; |
| 12 | 12 | |
| 13 | - if(empty($fleet_list)) |
|
| 13 | + if (empty($fleet_list)) |
|
| 14 | 14 | { |
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - foreach($fleet_list as $fleet) |
|
| 18 | + foreach ($fleet_list as $fleet) |
|
| 19 | 19 | { |
| 20 | 20 | $planet_start_type = $fleet['fleet_start_type'] == PT_MOON ? PT_MOON : PT_PLANET; |
| 21 | 21 | $planet_start = DBStaticPlanet::db_planet_by_gspt($fleet['fleet_start_galaxy'], $fleet['fleet_start_system'], $fleet['fleet_start_planet'], $planet_start_type); |
| 22 | 22 | $fleet['fleet_start_name'] = $planet_start['name']; |
| 23 | 23 | |
| 24 | 24 | $planet_end_type = $fleet['fleet_end_type'] == PT_MOON ? PT_MOON : PT_PLANET; |
| 25 | - if($fleet['fleet_end_planet'] > $config->game_maxPlanet) |
|
| 25 | + if ($fleet['fleet_end_planet'] > $config->game_maxPlanet) |
|
| 26 | 26 | { |
| 27 | 27 | $fleet['fleet_end_name'] = $lang['ov_fleet_exploration']; |
| 28 | 28 | } |
| 29 | - elseif($fleet['fleet_mission'] == MT_COLONIZE) |
|
| 29 | + elseif ($fleet['fleet_mission'] == MT_COLONIZE) |
|
| 30 | 30 | { |
| 31 | 31 | $fleet['fleet_end_name'] = $lang['ov_fleet_colonization']; |
| 32 | 32 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $fleet['fleet_end_name'] = $planet_end['name']; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - if($fleet['fleet_start_time'] > SN_TIME_NOW && $fleet['fleet_mess'] == 0 && $fleet['fleet_mission'] != MT_MISSILE && |
|
| 39 | + if ($fleet['fleet_start_time'] > SN_TIME_NOW && $fleet['fleet_mess'] == 0 && $fleet['fleet_mission'] != MT_MISSILE && |
|
| 40 | 40 | ($planet_scanned === false |
| 41 | 41 | || |
| 42 | 42 | ( |
@@ -51,12 +51,12 @@ discard block |
||
| 51 | 51 | $fleet_events[] = flt_register_fleet_event($fleet, 0, $planet_end_type); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - if($fleet['fleet_end_stay'] > SN_TIME_NOW && $fleet['fleet_mess'] == 0 && $planet_scanned === false && $fleet['fleet_mission'] != MT_MISSILE) |
|
| 54 | + if ($fleet['fleet_end_stay'] > SN_TIME_NOW && $fleet['fleet_mess'] == 0 && $planet_scanned === false && $fleet['fleet_mission'] != MT_MISSILE) |
|
| 55 | 55 | { |
| 56 | 56 | $fleet_events[] = flt_register_fleet_event($fleet, 1, $planet_end_type); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - if( |
|
| 59 | + if ( |
|
| 60 | 60 | $fleet['fleet_end_time'] > SN_TIME_NOW && $fleet['fleet_mission'] != MT_MISSILE && ($fleet['fleet_mess'] == 1 || ($fleet['fleet_mission'] != MT_RELOCATE && $fleet['fleet_mission'] != MT_COLONIZE)) && |
| 61 | 61 | ( |
| 62 | 62 | ($planet_scanned === false && $fleet['fleet_owner'] == $user['id']) |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $fleet_events[] = flt_register_fleet_event($fleet, 2, $planet_end_type); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - if($fleet['fleet_mission'] == MT_MISSILE) |
|
| 76 | + if ($fleet['fleet_mission'] == MT_MISSILE) |
|
| 77 | 77 | { |
| 78 | 78 | $fleet_events[] = flt_register_fleet_event($fleet, 3, $planet_end_type); |
| 79 | 79 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | { |
| 87 | 87 | global $user, $planetrow, $fleet_number; |
| 88 | 88 | |
| 89 | - switch($fleet['ov_label'] = $ov_label) |
|
| 89 | + switch ($fleet['ov_label'] = $ov_label) |
|
| 90 | 90 | { |
| 91 | 91 | case 0: |
| 92 | 92 | $fleet['event_time'] = $fleet['fleet_start_time']; |
@@ -118,9 +118,9 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - $fleet['ov_this_planet'] = $is_this_planet;// || $planet_scanned != false; |
|
| 121 | + $fleet['ov_this_planet'] = $is_this_planet; // || $planet_scanned != false; |
|
| 122 | 122 | |
| 123 | - if($fleet['fleet_owner'] == $user['id']) |
|
| 123 | + if ($fleet['fleet_owner'] == $user['id']) |
|
| 124 | 124 | { |
| 125 | 125 | $user_data = $user; |
| 126 | 126 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * @noinspection PhpUnusedParameterInspection |
| 23 | 23 | */ |
| 24 | 24 | function db_user_by_id($user_id_unsafe, $for_update = false, $player = null) { |
| 25 | - $user = PlayerStatic::dbSelectOne("SELECT * FROM {{users}} WHERE `id` = " . idval($user_id_unsafe)); |
|
| 25 | + $user = PlayerStatic::dbSelectOne("SELECT * FROM {{users}} WHERE `id` = " . idval($user_id_unsafe)); |
|
| 26 | 26 | |
| 27 | 27 | return (is_array($user) && |
| 28 | 28 | ( |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | // Вытаскиваем запись |
| 49 | 49 | $operand = $like ? 'LIKE' : '='; |
| 50 | 50 | |
| 51 | - $user = PlayerStatic::dbSelectOne("SELECT * FROM {{users}} WHERE `username` {$operand} '{$username_safe}'"); |
|
| 51 | + $user = PlayerStatic::dbSelectOne("SELECT * FROM {{users}} WHERE `username` {$operand} '{$username_safe}'"); |
|
| 52 | 52 | |
| 53 | 53 | return $user; |
| 54 | 54 | } |