1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Stu\Module\Spacecraft\Lib; |
6
|
|
|
|
7
|
|
|
use Stu\Component\Game\TimeConstants; |
|
|
|
|
8
|
|
|
use Stu\Component\Spacecraft\SpacecraftRumpCategoryEnum; |
9
|
|
|
use Stu\Component\Spacecraft\SpacecraftTypeEnum; |
10
|
|
|
use Stu\Component\Spacecraft\System\SpacecraftSystemModeEnum; |
11
|
|
|
use Stu\Component\Spacecraft\System\Type\TractorBeamShipSystem; |
12
|
|
|
use Stu\Lib\Transfer\TransferEntityTypeEnum; |
13
|
|
|
use Stu\Module\PlayerSetting\Lib\UserConstants; |
|
|
|
|
14
|
|
|
use Stu\Module\Spacecraft\Lib\Battle\FightLib; |
15
|
|
|
use Stu\Module\Spacecraft\Lib\TSpacecraftItemInterface; |
16
|
|
|
|
17
|
|
|
class SpacecraftNfsItem |
18
|
|
|
{ |
19
|
1 |
|
public function __construct(private TSpacecraftItemInterface $item, private int $userId) {} |
20
|
|
|
|
21
|
1 |
|
public function getId(): int |
22
|
|
|
{ |
23
|
1 |
|
return $this->item->getShipId(); |
24
|
|
|
} |
25
|
|
|
public function getFleetId(): ?int |
26
|
|
|
{ |
27
|
|
|
return $this->item->getFleetId(); |
28
|
|
|
} |
29
|
1 |
|
public function getName(): string |
30
|
|
|
{ |
31
|
1 |
|
return $this->item->getShipName(); |
32
|
|
|
} |
33
|
1 |
|
public function getHull(): int |
34
|
|
|
{ |
35
|
1 |
|
return $this->item->getHull(); |
36
|
|
|
} |
37
|
1 |
|
public function getMaxHull(): int |
38
|
|
|
{ |
39
|
1 |
|
return $this->item->getMaxHull(); |
40
|
|
|
} |
41
|
|
|
public function getShield(): int |
42
|
|
|
{ |
43
|
|
|
return $this->item->getShield(); |
44
|
|
|
} |
45
|
1 |
|
public function isShielded(): bool |
46
|
|
|
{ |
47
|
1 |
|
return $this->item->isShielded() > SpacecraftSystemModeEnum::MODE_OFF->value; |
48
|
|
|
} |
49
|
1 |
|
public function isCloaked(): bool |
50
|
|
|
{ |
51
|
1 |
|
return $this->item->isCloaked() > SpacecraftSystemModeEnum::MODE_OFF->value; |
52
|
|
|
} |
53
|
1 |
|
public function getWarpDriveState(): bool |
54
|
|
|
{ |
55
|
1 |
|
return $this->item->getWarpDriveState() > SpacecraftSystemModeEnum::MODE_OFF->value; |
56
|
|
|
} |
57
|
1 |
|
public function isWarped(): bool |
58
|
|
|
{ |
59
|
1 |
|
return $this->getWarpDriveState() |
60
|
1 |
|
|| $this->item->getTractorWarpState() > SpacecraftSystemModeEnum::MODE_OFF->value; |
61
|
|
|
} |
62
|
1 |
|
public function isScanPossible(): bool |
63
|
|
|
{ |
64
|
1 |
|
return !$this->isCloaked() |
65
|
1 |
|
&& $this->getType() !== SpacecraftTypeEnum::THOLIAN_WEB; |
66
|
|
|
} |
67
|
1 |
|
public function isTractorbeamPossible(): bool |
68
|
|
|
{ |
69
|
1 |
|
return TractorBeamShipSystem::isTractorBeamPossible($this); |
70
|
|
|
} |
71
|
1 |
|
public function isBoardingPossible(): bool |
72
|
|
|
{ |
73
|
1 |
|
return FightLib::isBoardingPossible($this); |
74
|
|
|
} |
75
|
1 |
|
public function isInterceptable(): bool |
76
|
|
|
{ |
77
|
|
|
//TODO can tractored ships be intercepted?! |
78
|
1 |
|
return $this->getWarpDriveState(); |
79
|
|
|
} |
80
|
1 |
|
public function getType(): SpacecraftTypeEnum |
81
|
|
|
{ |
82
|
1 |
|
return $this->item->getType(); |
83
|
|
|
} |
84
|
1 |
|
public function isStation(): bool |
85
|
|
|
{ |
86
|
1 |
|
return $this->item->getType() === SpacecraftTypeEnum::STATION; |
87
|
|
|
} |
88
|
1 |
|
public function isTrumfield(): bool |
89
|
|
|
{ |
90
|
1 |
|
return false; |
91
|
|
|
} |
92
|
1 |
|
public function isShuttle(): bool |
93
|
|
|
{ |
94
|
1 |
|
return $this->item->getRumpCategoryId() === SpacecraftRumpCategoryEnum::SHUTTLE->value; |
95
|
|
|
} |
96
|
|
|
public function canBeTracked(): bool |
97
|
|
|
{ |
98
|
|
|
return $this->item->getType() === SpacecraftTypeEnum::SHIP; |
99
|
|
|
} |
100
|
1 |
|
public function getRumpId(): int |
101
|
|
|
{ |
102
|
1 |
|
return $this->item->getRumpId(); |
103
|
|
|
} |
104
|
1 |
|
public function getHoldingWebBackgroundStyle(): string |
105
|
|
|
{ |
106
|
1 |
|
if ($this->item->getWebId() === null) { |
107
|
1 |
|
return ''; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
$finishTime = $this->item->getWebFinishTime(); |
111
|
|
|
|
112
|
|
|
if ($finishTime === null || $finishTime < time()) { |
113
|
|
|
$icon = 'web.png'; |
114
|
|
|
} else { |
115
|
|
|
$closeTofinish = $finishTime - time() < TimeConstants::ONE_HOUR_IN_SECONDS; |
116
|
|
|
|
117
|
|
|
$icon = $closeTofinish ? 'web_u.png' : 'web_u2.png'; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
return sprintf('background-image: url(assets/buttons/%s); vertical-align: middle; text-align: center;', $icon); |
121
|
|
|
} |
122
|
1 |
|
public function getRumpName(): string |
123
|
|
|
{ |
124
|
1 |
|
return $this->item->getRumpName(); |
125
|
|
|
} |
126
|
1 |
|
public function getUserId(): int |
127
|
|
|
{ |
128
|
1 |
|
return $this->item->getUserId(); |
129
|
|
|
} |
130
|
|
|
|
131
|
1 |
|
public function isContactable(): bool |
132
|
|
|
{ |
133
|
1 |
|
return $this->getUserId() != UserConstants::USER_NOONE; |
134
|
|
|
} |
135
|
|
|
|
136
|
1 |
|
public function getUserName(): string |
137
|
|
|
{ |
138
|
1 |
|
return $this->item->getUserName(); |
139
|
|
|
} |
140
|
1 |
|
public function isSelectable(): bool |
141
|
|
|
{ |
142
|
1 |
|
return $this->userId === $this->getUserId() |
143
|
1 |
|
&& $this->getType()->getModuleView() !== null; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
public function hasUplink(): bool |
147
|
|
|
{ |
148
|
|
|
return $this->item->getUplinkState() > SpacecraftSystemModeEnum::MODE_OFF->value; |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
public function getRump(): mixed |
152
|
|
|
{ |
153
|
|
|
return $this; |
154
|
|
|
} |
155
|
|
|
|
156
|
1 |
|
public function hasLogBook(): bool |
157
|
|
|
{ |
158
|
1 |
|
return $this->item->hasLogBook(); |
159
|
|
|
} |
160
|
|
|
|
161
|
1 |
|
public function hasCrew(): bool |
162
|
|
|
{ |
163
|
1 |
|
return $this->item->hasCrew(); |
164
|
|
|
} |
165
|
|
|
|
166
|
1 |
|
public function isTransferPossible(): bool |
167
|
|
|
{ |
168
|
1 |
|
return $this->getType()->isTransferPossible(); |
169
|
|
|
} |
170
|
|
|
|
171
|
1 |
|
public function getTransferEntityType(): TransferEntityTypeEnum |
172
|
|
|
{ |
173
|
1 |
|
return $this->isStation() |
174
|
1 |
|
? TransferEntityTypeEnum::STATION |
175
|
1 |
|
: TransferEntityTypeEnum::SHIP; |
176
|
|
|
} |
177
|
|
|
} |
178
|
|
|
|
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