-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-230 Move colonization task handling to an util
- Loading branch information
Showing
6 changed files
with
58 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
header("Location: ../index.php"); | ||
|
||
?> |
5 changes: 5 additions & 0 deletions
5
modules/overview/screens/AbandonPlanet/utils/effects/index.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
header("Location: ../index.php"); | ||
|
||
?> |
38 changes: 38 additions & 0 deletions
38
modules/overview/screens/AbandonPlanet/utils/effects/triggerUserTasksUpdates.effect.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace UniEngine\Engine\Modules\Overview\Screens\AbandonPlanet\Utils\Effects; | ||
|
||
/** | ||
* @param array $params | ||
* @param arrayRef $params['user'] | ||
*/ | ||
function triggerUserTasksUpdates($props) { | ||
$user = &$props['user']; | ||
|
||
// Prevent abandoning Planet to make mission faster | ||
Tasks_TriggerTask( | ||
$user, | ||
'COLONIZE_PLANET', | ||
[ | ||
'mainCheck' => 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; | ||
} | ||
] | ||
); | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
header("Location: ../index.php"); | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters