|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
|
|
3
|
|
|
namespace Smr\Pages\Player\BetaFunctions; |
|
4
|
|
|
|
|
5
|
|
|
use AbstractSmrPlayer; |
|
6
|
|
|
use Globals; |
|
7
|
|
|
use Smr\Page\PlayerPage; |
|
8
|
|
|
use Smr\Page\ReusableTrait; |
|
9
|
|
|
use Smr\Template; |
|
10
|
|
|
use SmrShipType; |
|
11
|
|
|
use SmrWeaponType; |
|
12
|
|
|
|
|
13
|
|
|
class BetaFunctions extends PlayerPage { |
|
14
|
|
|
|
|
15
|
|
|
use ReusableTrait; |
|
16
|
|
|
|
|
17
|
|
|
public string $file = 'beta_functions.php'; |
|
18
|
|
|
|
|
19
|
|
|
public function build(AbstractSmrPlayer $player, Template $template): void { |
|
20
|
|
|
if (!ENABLE_BETA) { |
|
21
|
|
|
create_error('Beta functions are disabled.'); |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
$sector = $player->getSector(); |
|
25
|
|
|
|
|
26
|
|
|
$template->assign('PageTopic', 'Beta Functions'); |
|
27
|
|
|
|
|
28
|
|
|
// let them map all |
|
29
|
|
|
$container = new RevealMapProcessor(); |
|
30
|
|
|
$template->assign('MapHREF', $container->href()); |
|
31
|
|
|
|
|
32
|
|
|
// let them get money |
|
33
|
|
|
$container = new AddMoneyProcessor(); |
|
34
|
|
|
$template->assign('MoneyHREF', $container->href()); |
|
35
|
|
|
|
|
36
|
|
|
//next time for ship |
|
37
|
|
|
$container = new SetShipProcessor(); |
|
38
|
|
|
$template->assign('ShipHREF', $container->href()); |
|
39
|
|
|
$shipList = []; |
|
40
|
|
|
foreach (SmrShipType::getAll() as $shipTypeID => $shipType) { |
|
41
|
|
|
$shipList[$shipTypeID] = $shipType->getName(); |
|
42
|
|
|
} |
|
43
|
|
|
asort($shipList); // sort by name |
|
44
|
|
|
$template->assign('ShipList', $shipList); |
|
45
|
|
|
|
|
46
|
|
|
//next weapons |
|
47
|
|
|
$container = new AddWeaponsProcessor(); |
|
48
|
|
|
$template->assign('AddWeaponHREF', $container->href()); |
|
49
|
|
|
$weaponList = []; |
|
50
|
|
|
foreach (SmrWeaponType::getAllWeaponTypes() as $weaponTypeID => $weaponType) { |
|
51
|
|
|
$weaponList[$weaponTypeID] = $weaponType->getName(); |
|
52
|
|
|
} |
|
53
|
|
|
asort($weaponList); // sort by name |
|
54
|
|
|
$template->assign('WeaponList', $weaponList); |
|
55
|
|
|
|
|
56
|
|
|
//Remove Weapons |
|
57
|
|
|
$container = new RemoveWeaponsProcessor(); |
|
58
|
|
|
$template->assign('RemoveWeaponsHREF', $container->href()); |
|
59
|
|
|
|
|
60
|
|
|
//allow to get full hardware |
|
61
|
|
|
$container = new RepairShipProcessor(); |
|
62
|
|
|
$template->assign('UnoHREF', $container->href()); |
|
63
|
|
|
|
|
64
|
|
|
//move whereever you want |
|
65
|
|
|
$container = new SetSectorProcessor(); |
|
66
|
|
|
$template->assign('WarpHREF', $container->href()); |
|
67
|
|
|
|
|
68
|
|
|
//set turns |
|
69
|
|
|
$container = new SetTurnsProcessor(); |
|
70
|
|
|
$template->assign('TurnsHREF', $container->href()); |
|
71
|
|
|
|
|
72
|
|
|
//set experience |
|
73
|
|
|
$container = new SetExperienceProcessor(); |
|
74
|
|
|
$template->assign('ExperienceHREF', $container->href()); |
|
75
|
|
|
|
|
76
|
|
|
//Set alignment |
|
77
|
|
|
$container = new SetAlignmentProcessor(); |
|
78
|
|
|
$template->assign('AlignmentHREF', $container->href()); |
|
79
|
|
|
|
|
80
|
|
|
//add any type of hardware |
|
81
|
|
|
$container = new SetHardwareProcessor(); |
|
82
|
|
|
$template->assign('HardwareHREF', $container->href()); |
|
83
|
|
|
$hardware = []; |
|
84
|
|
|
foreach (Globals::getHardwareTypes() as $hardwareTypeID => $hardwareType) { |
|
85
|
|
|
$hardware[$hardwareTypeID] = $hardwareType['Name']; |
|
86
|
|
|
} |
|
87
|
|
|
$template->assign('Hardware', $hardware); |
|
88
|
|
|
|
|
89
|
|
|
//change personal relations |
|
90
|
|
|
$container = new SetPersonalRelationsProcessor(); |
|
91
|
|
|
$template->assign('PersonalRelationsHREF', $container->href()); |
|
92
|
|
|
|
|
93
|
|
|
//change race relations |
|
94
|
|
|
$container = new SetPoliticalRelationsProcessor(); |
|
95
|
|
|
$template->assign('RaceRelationsHREF', $container->href()); |
|
96
|
|
|
|
|
97
|
|
|
//change race |
|
98
|
|
|
$container = new SetRaceProcessor(); |
|
99
|
|
|
$template->assign('ChangeRaceHREF', $container->href()); |
|
100
|
|
|
|
|
101
|
|
|
if ($sector->hasPlanet()) { |
|
102
|
|
|
$container = new PlanetBuildingsProcessor(); |
|
103
|
|
|
$template->assign('MaxBuildingsHREF', $container->href()); |
|
104
|
|
|
|
|
105
|
|
|
$container = new PlanetDefensesProcessor(); |
|
106
|
|
|
$template->assign('MaxDefensesHREF', $container->href()); |
|
107
|
|
|
|
|
108
|
|
|
$container = new PlanetStockpileProcessor(); |
|
109
|
|
|
$template->assign('MaxStockpileHREF', $container->href()); |
|
110
|
|
|
} |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
} |
|
114
|
|
|
|