diff --git a/modules/overview/_includes.php b/modules/overview/_includes.php index c521da10..9526fc63 100644 --- a/modules/overview/_includes.php +++ b/modules/overview/_includes.php @@ -6,6 +6,8 @@ $includePath = $_EnginePath . 'modules/overview/'; + include($includePath . './screens/AbandonPlanet/utils/effects/triggerUserTasksUpdates.effect.php'); + include($includePath . './screens/FirstLogin/FirstLogin.screen.php'); include($includePath . './screens/FirstLogin/FirstLogin.utils.php'); include($includePath . './screens/FirstLogin/utils/effects/createUserDevLogDump.effect.php'); diff --git a/modules/overview/screens/AbandonPlanet/index.php b/modules/overview/screens/AbandonPlanet/index.php new file mode 100644 index 00000000..bc99142d --- /dev/null +++ b/modules/overview/screens/AbandonPlanet/index.php @@ -0,0 +1,5 @@ + diff --git a/modules/overview/screens/AbandonPlanet/utils/effects/index.php b/modules/overview/screens/AbandonPlanet/utils/effects/index.php new file mode 100644 index 00000000..bc99142d --- /dev/null +++ b/modules/overview/screens/AbandonPlanet/utils/effects/index.php @@ -0,0 +1,5 @@ + diff --git a/modules/overview/screens/AbandonPlanet/utils/effects/triggerUserTasksUpdates.effect.php b/modules/overview/screens/AbandonPlanet/utils/effects/triggerUserTasksUpdates.effect.php new file mode 100644 index 00000000..9cfebc22 --- /dev/null +++ b/modules/overview/screens/AbandonPlanet/utils/effects/triggerUserTasksUpdates.effect.php @@ -0,0 +1,38 @@ + function ($JobArray, $ThisCat, $TaskID, $JobID) use ($user) { + global $UserTasksUpdate; + + $userId = $user['id']; + + if (!empty($UserTasksUpdate[$userId]['status'][$ThisCat][$TaskID][$JobID])) { + $user['tasks_done_parsed']['status'][$ThisCat][$TaskID][$JobID] = $UserTasksUpdate[$userId]['status'][$ThisCat][$TaskID][$JobID]; + } + if ($user['tasks_done_parsed']['status'][$ThisCat][$TaskID][$JobID] <= 0) { + return true; + } + + $user['tasks_done_parsed']['status'][$ThisCat][$TaskID][$JobID] -= 1; + $UserTasksUpdate[$userId]['status'][$ThisCat][$TaskID][$JobID] = $user['tasks_done_parsed']['status'][$ThisCat][$TaskID][$JobID]; + + return true; + } + ] + ); +} + +?> diff --git a/modules/overview/screens/AbandonPlanet/utils/index.php b/modules/overview/screens/AbandonPlanet/utils/index.php new file mode 100644 index 00000000..bc99142d --- /dev/null +++ b/modules/overview/screens/AbandonPlanet/utils/index.php @@ -0,0 +1,5 @@ + diff --git a/overview.php b/overview.php index c04a47bf..e34e5b6a 100644 --- a/overview.php +++ b/overview.php @@ -77,25 +77,9 @@ $DeleteResult = DeleteSelectedPlanetorMoon(); if($DeleteResult['result'] === true) { - // Prevent abandoning Planet to make mission faster - Tasks_TriggerTask($_User, 'COLONIZE_PLANET', array - ( - 'mainCheck' => function($JobArray, $ThisCat, $TaskID, $JobID) use ($_User) - { - global $UserTasksUpdate; - if(!empty($UserTasksUpdate[$_User['id']]['status'][$ThisCat][$TaskID][$JobID])) - { - $_User['tasks_done_parsed']['status'][$ThisCat][$TaskID][$JobID] = $UserTasksUpdate[$_User['id']]['status'][$ThisCat][$TaskID][$JobID]; - } - if($_User['tasks_done_parsed']['status'][$ThisCat][$TaskID][$JobID] <= 0) - { - return true; - } - $_User['tasks_done_parsed']['status'][$ThisCat][$TaskID][$JobID] -= 1; - $UserTasksUpdate[$_User['id']]['status'][$ThisCat][$TaskID][$JobID] = $_User['tasks_done_parsed']['status'][$ThisCat][$TaskID][$JobID]; - return true; - } - )); + Overview\Screens\AbandonPlanet\Utils\Effects\triggerUserTasksUpdates([ + 'user' => &$_User, + ]); // User Development Log $UserDev_Log[] = array('PlanetID' => $_Planet['id'], 'Date' => $Now, 'Place' => 25, 'Code' => '0', 'ElementID' => '0');