1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Stu\Module\Ship\Lib\Ui; |
6
|
|
|
|
7
|
|
|
use JBBCode\Parser; |
8
|
|
|
use Stu\Component\Ship\AstronomicalMappingEnum; |
|
|
|
|
9
|
|
|
use Stu\Component\Ship\ShipStateEnum; |
10
|
|
|
use Stu\Module\Control\GameControllerInterface; |
11
|
|
|
use Stu\Module\Ship\Lib\ShipWrapperInterface; |
12
|
|
|
|
13
|
|
|
class StateIconAndTitle |
14
|
|
|
{ |
15
|
8 |
|
public function __construct( |
16
|
|
|
private GameControllerInterface $game, |
17
|
|
|
private Parser $bbCodeParser |
18
|
8 |
|
) {} |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @return array<string>|null |
22
|
|
|
*/ |
23
|
7 |
|
public function getStateIconAndTitle(ShipWrapperInterface $wrapper): ?array |
24
|
|
|
{ |
25
|
7 |
|
$ship = $wrapper->get(); |
26
|
7 |
|
$state = $ship->getState(); |
27
|
|
|
|
28
|
7 |
|
if ($state === ShipStateEnum::SHIP_STATE_REPAIR_ACTIVE) { |
29
|
2 |
|
$isBase = $ship->isBase(); |
30
|
2 |
|
return ['rep2', sprintf('%s repariert die Station', $isBase ? 'Stationscrew' : 'Schiffscrew')]; |
31
|
|
|
} |
32
|
|
|
|
33
|
5 |
|
if ($state === ShipStateEnum::SHIP_STATE_REPAIR_PASSIVE) { |
34
|
2 |
|
$isBase = $ship->isBase(); |
35
|
2 |
|
$repairDuration = $wrapper->getRepairDuration(); |
36
|
2 |
|
return ['rep2', sprintf('%s wird repariert (noch %d Runden)', $isBase ? 'Station' : 'Schiff', $repairDuration)]; |
37
|
|
|
} |
38
|
|
|
|
39
|
3 |
|
$currentTurn = $this->game->getCurrentRound()->getTurn(); |
40
|
3 |
|
$astroLab = $wrapper->getAstroLaboratorySystemData(); |
41
|
|
|
if ( |
42
|
3 |
|
$state === ShipStateEnum::SHIP_STATE_ASTRO_FINALIZING |
43
|
3 |
|
&& $astroLab !== null |
44
|
|
|
) { |
45
|
1 |
|
return ['map1', sprintf( |
46
|
1 |
|
'Schiff kartographiert (noch %d Runden)', |
47
|
1 |
|
$astroLab->getAstroStartTurn() + AstronomicalMappingEnum::TURNS_TO_FINISH - $currentTurn |
48
|
1 |
|
)]; |
49
|
|
|
} |
50
|
|
|
|
51
|
2 |
|
$takeover = $ship->getTakeoverActive(); |
52
|
|
|
if ( |
53
|
2 |
|
$state === ShipStateEnum::SHIP_STATE_ACTIVE_TAKEOVER |
54
|
2 |
|
&& $takeover !== null |
55
|
|
|
) { |
56
|
1 |
|
$targetNamePlainText = $this->bbCodeParser->parse($takeover->getTargetShip()->getName())->getAsText(); |
57
|
1 |
|
return ['take2', sprintf( |
58
|
1 |
|
'Schiff übernimmt die "%s" (noch %d Runden)', |
59
|
1 |
|
$targetNamePlainText, |
60
|
1 |
|
$wrapper->getTakeoverTicksLeft($takeover) |
61
|
1 |
|
)]; |
62
|
|
|
} |
63
|
|
|
|
64
|
1 |
|
$takeover = $ship->getTakeoverPassive(); |
65
|
1 |
|
if ($takeover !== null) { |
66
|
1 |
|
$sourceUserNamePlainText = $this->bbCodeParser->parse($takeover->getSourceShip()->getUser()->getName())->getAsText(); |
67
|
1 |
|
return ['untake2', sprintf( |
68
|
1 |
|
'Schiff wird von Spieler "%s" übernommen (noch %d Runden)', |
69
|
1 |
|
$sourceUserNamePlainText, |
70
|
1 |
|
$wrapper->getTakeoverTicksLeft($takeover) |
71
|
1 |
|
)]; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
return null; |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|
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