|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Stu\Lib\ModuleRumpWrapper; |
|
6
|
|
|
|
|
7
|
|
|
use Override; |
|
|
|
|
|
|
8
|
|
|
use RuntimeException; |
|
9
|
|
|
use Stu\Component\Player\Settings\UserSettingsProviderInterface; |
|
10
|
|
|
use Stu\Component\Spacecraft\SpacecraftModuleTypeEnum; |
|
11
|
|
|
use Stu\Config\Init; |
|
12
|
|
|
use Stu\Module\Spacecraft\Lib\ModuleValueCalculator; |
|
13
|
|
|
use Stu\Module\Spacecraft\Lib\SpacecraftWrapperInterface; |
|
14
|
|
|
use Stu\Orm\Entity\ModuleInterface; |
|
15
|
|
|
|
|
16
|
|
|
final class ModuleRumpWrapperWarpDrive extends ModuleRumpWrapperBase implements ModuleRumpWrapperInterface |
|
17
|
|
|
{ |
|
18
|
3 |
|
#[Override] |
|
19
|
|
|
public function getValue(?ModuleInterface $module = null): int |
|
20
|
|
|
{ |
|
21
|
3 |
|
$module ??= current($this->getModule()); |
|
22
|
3 |
|
if ($module === false) { |
|
23
|
|
|
return 0; |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
3 |
|
return (new ModuleValueCalculator())->calculateModuleValue( |
|
27
|
3 |
|
$this->rump, |
|
28
|
3 |
|
$module, |
|
29
|
3 |
|
$this->rump->getBaseWarpDrive() |
|
30
|
3 |
|
); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
#[Override] |
|
34
|
|
|
public function getModuleType(): SpacecraftModuleTypeEnum |
|
35
|
|
|
{ |
|
36
|
|
|
return SpacecraftModuleTypeEnum::WARPDRIVE; |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
#[Override] |
|
40
|
|
|
public function initialize(SpacecraftWrapperInterface $wrapper): ModuleRumpWrapperInterface |
|
41
|
|
|
{ |
|
42
|
|
|
$systemData = $wrapper->getWarpDriveSystemData(); |
|
43
|
|
|
if ($systemData === null) { |
|
44
|
|
|
throw new RuntimeException('this should not happen'); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
$userSettingsProvider = Init::getContainer()->get(UserSettingsProviderInterface::class); |
|
48
|
|
|
$isAutoCarryOver = $userSettingsProvider->getWarpsplitAutoCarryoverDefault($wrapper->get()->getUser()); |
|
49
|
|
|
|
|
50
|
|
|
$systemData |
|
51
|
|
|
->setAutoCarryOver($isAutoCarryOver) |
|
52
|
|
|
->update(); |
|
53
|
|
|
|
|
54
|
|
|
return $this; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
#[Override] |
|
58
|
|
|
public function apply(SpacecraftWrapperInterface $wrapper): void |
|
59
|
|
|
{ |
|
60
|
|
|
$systemData = $wrapper->getWarpDriveSystemData(); |
|
61
|
|
|
if ($systemData === null) { |
|
62
|
|
|
throw new RuntimeException('this should not happen'); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
if ($systemData->getWarpDrive() > $this->getValue()) { |
|
66
|
|
|
$systemData->setWarpDrive($this->getValue()); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
$systemData |
|
70
|
|
|
->setMaxWarpDrive($this->getValue()) |
|
71
|
|
|
->update(); |
|
72
|
|
|
} |
|
73
|
|
|
} |
|
74
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths