|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
|
|
3
|
|
|
use Smr\Database; |
|
4
|
|
|
use Smr\Exceptions\UserError; |
|
5
|
|
|
use Smr\Pages\Account\BugReportProcessor; |
|
6
|
|
|
use Smr\Pages\Account\BuyMessageNotifications; |
|
7
|
|
|
use Smr\Pages\Account\FeatureRequest; |
|
8
|
|
|
use Smr\Pages\Account\NewsReadAdvanced; |
|
9
|
|
|
use Smr\Pages\Player\AllianceBroadcast; |
|
10
|
|
|
use Smr\Pages\Player\AllianceForces; |
|
11
|
|
|
use Smr\Pages\Player\AllianceList; |
|
12
|
|
|
use Smr\Pages\Player\AllianceMessageBoard; |
|
13
|
|
|
use Smr\Pages\Player\AllianceMotd; |
|
14
|
|
|
use Smr\Pages\Player\AllianceOptions; |
|
15
|
|
|
use Smr\Pages\Player\AllianceRoster; |
|
16
|
|
|
use Smr\Pages\Player\AttackPlayerProcessor; |
|
17
|
|
|
use Smr\Pages\Player\Bank\AllianceBank; |
|
18
|
|
|
use Smr\Pages\Player\BetaFunctions; |
|
19
|
|
|
use Smr\Pages\Player\BuyShipName; |
|
20
|
|
|
use Smr\Pages\Player\Chess\MatchList; |
|
21
|
|
|
use Smr\Pages\Player\Chess\MatchStartProcessor; |
|
22
|
|
|
use Smr\Pages\Player\Council\MessageCouncil; |
|
23
|
|
|
use Smr\Pages\Player\Council\ViewCouncil; |
|
24
|
|
|
use Smr\Pages\Player\CurrentPlayers; |
|
25
|
|
|
use Smr\Pages\Player\CurrentSector; |
|
26
|
|
|
use Smr\Pages\Player\ListPlanetDefense; |
|
27
|
|
|
use Smr\Pages\Player\ListPlanetFinancial; |
|
28
|
|
|
use Smr\Pages\Player\LocalMap; |
|
29
|
|
|
use Smr\Pages\Player\MessageBlacklist; |
|
30
|
|
|
use Smr\Pages\Player\MessageBox; |
|
31
|
|
|
use Smr\Pages\Player\MessageSend; |
|
32
|
|
|
use Smr\Pages\Player\PlotCourse; |
|
33
|
|
|
use Smr\Pages\Player\PlotCourseConventionalProcessor; |
|
34
|
|
|
use Smr\Pages\Player\SectorMoveProcessor; |
|
35
|
|
|
use Smr\Pages\Player\SectorScan; |
|
36
|
|
|
use Smr\Pages\Player\SectorsFileDownloadProcessor; |
|
37
|
|
|
use Smr\Pages\Player\ShopGoods; |
|
38
|
|
|
use Smr\Pages\Player\TraderBounties; |
|
39
|
|
|
use Smr\Pages\Player\TraderRelations; |
|
40
|
|
|
use Smr\Pages\Player\TraderStatus; |
|
41
|
|
|
use Smr\Pages\Player\WeaponReorderProcessor; |
|
42
|
|
|
use Smr\Race; |
|
43
|
|
|
|
|
44
|
|
|
class Globals { |
|
45
|
|
|
|
|
46
|
|
|
/** @var array<int> */ |
|
47
|
|
|
protected static array $HIDDEN_PLAYERS; |
|
48
|
|
|
/** @var array<int, array<string, string|int>> */ |
|
49
|
|
|
protected static array $LEVEL_REQUIREMENTS; |
|
50
|
|
|
/** @var array<int, array<string, string|int>> */ |
|
51
|
|
|
protected static array $GOODS; |
|
52
|
|
|
/** @var array<int, array<string, string|int>> */ |
|
53
|
|
|
protected static array $HARDWARE_TYPES; |
|
54
|
|
|
protected static bool $FEATURE_REQUEST_OPEN; |
|
55
|
|
|
/** @var array<int, array<int, array<int, int>>> */ |
|
56
|
|
|
protected static array $RACE_RELATIONS; |
|
57
|
|
|
/** @var array<string, string> */ |
|
58
|
|
|
protected static array $AVAILABLE_LINKS = []; |
|
59
|
|
|
protected static Database $db; |
|
60
|
|
|
|
|
61
|
|
|
protected static function initialiseDatabase(): void { |
|
62
|
|
|
if (!isset(self::$db)) { |
|
63
|
|
|
self::$db = Database::getInstance(); |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* @return array<string, string> |
|
69
|
|
|
*/ |
|
70
|
|
|
public static function getAvailableLinks(): array { |
|
71
|
|
|
return self::$AVAILABLE_LINKS; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @param array<string, int> $extraInfo |
|
76
|
|
|
*/ |
|
77
|
|
|
public static function canAccessPage(string $pageName, AbstractSmrPlayer $player, array $extraInfo): void { |
|
78
|
|
|
switch ($pageName) { |
|
79
|
|
|
case 'AllianceMOTD': |
|
80
|
|
|
if ($player->getAllianceID() != $extraInfo['AllianceID']) { |
|
81
|
|
|
logException(new Exception('Tried to access page without permission.')); |
|
|
|
|
|
|
82
|
|
|
throw new UserError('You cannot access this page.'); |
|
83
|
|
|
} |
|
84
|
|
|
break; |
|
85
|
|
|
} |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* @return array<int> |
|
90
|
|
|
*/ |
|
91
|
|
|
public static function getHiddenPlayers(): array { |
|
92
|
|
|
if (!isset(self::$HIDDEN_PLAYERS)) { |
|
93
|
|
|
self::initialiseDatabase(); |
|
94
|
|
|
$dbResult = self::$db->read('SELECT account_id FROM hidden_players'); |
|
95
|
|
|
self::$HIDDEN_PLAYERS = [0]; //stop errors |
|
96
|
|
|
foreach ($dbResult->records() as $dbRecord) { |
|
97
|
|
|
self::$HIDDEN_PLAYERS[] = $dbRecord->getInt('account_id'); |
|
98
|
|
|
} |
|
99
|
|
|
} |
|
100
|
|
|
return self::$HIDDEN_PLAYERS; |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
/** |
|
104
|
|
|
* @return array<int> |
|
105
|
|
|
*/ |
|
106
|
|
|
public static function getGalacticPostEditorIDs(int $gameID): array { |
|
107
|
|
|
self::initialiseDatabase(); |
|
108
|
|
|
$editorIDs = []; |
|
109
|
|
|
$dbResult = self::$db->read('SELECT account_id FROM galactic_post_writer WHERE position=\'editor\' AND game_id=' . self::$db->escapeNumber($gameID)); |
|
110
|
|
|
foreach ($dbResult->records() as $dbRecord) { |
|
111
|
|
|
$editorIDs[] = $dbRecord->getInt('account_id'); |
|
112
|
|
|
} |
|
113
|
|
|
return $editorIDs; |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
/** |
|
117
|
|
|
* @return array<int, array<string, string|int>> |
|
118
|
|
|
*/ |
|
119
|
|
|
public static function getLevelRequirements(): array { |
|
120
|
|
|
if (!isset(self::$LEVEL_REQUIREMENTS)) { |
|
121
|
|
|
self::initialiseDatabase(); |
|
122
|
|
|
self::$LEVEL_REQUIREMENTS = []; |
|
123
|
|
|
|
|
124
|
|
|
// determine user level |
|
125
|
|
|
$dbResult = self::$db->read('SELECT * FROM level ORDER BY level_id ASC'); |
|
126
|
|
|
foreach ($dbResult->records() as $dbRecord) { |
|
127
|
|
|
self::$LEVEL_REQUIREMENTS[$dbRecord->getInt('level_id')] = [ |
|
128
|
|
|
'Name' => $dbRecord->getString('level_name'), |
|
129
|
|
|
'Requirement' => $dbRecord->getInt('requirement'), |
|
130
|
|
|
]; |
|
131
|
|
|
} |
|
132
|
|
|
} |
|
133
|
|
|
return self::$LEVEL_REQUIREMENTS; |
|
134
|
|
|
} |
|
135
|
|
|
|
|
136
|
|
|
public static function getColouredRaceNameForRace(int $raceID, int $gameID, int $fromRaceID, bool $linked = true): string { |
|
137
|
|
|
$raceRelations = self::getRaceRelations($gameID, $fromRaceID); |
|
138
|
|
|
return self::getColouredRaceName($raceID, $raceRelations[$raceID], $linked); |
|
139
|
|
|
} |
|
140
|
|
|
|
|
141
|
|
|
public static function getColouredRaceName(int $raceID, int $relations, bool $linked = true): string { |
|
142
|
|
|
$raceName = get_colored_text($relations, Race::getName($raceID)); |
|
143
|
|
|
if ($linked === true) { |
|
144
|
|
|
$container = new ViewCouncil($raceID); |
|
145
|
|
|
$raceName = create_link($container, $raceName); |
|
146
|
|
|
} |
|
147
|
|
|
return $raceName; |
|
148
|
|
|
} |
|
149
|
|
|
|
|
150
|
|
|
/** |
|
151
|
|
|
* @return array<int, array<string, string|int>> |
|
152
|
|
|
*/ |
|
153
|
|
|
public static function getGoods(): array { |
|
154
|
|
|
if (!isset(self::$GOODS)) { |
|
155
|
|
|
self::initialiseDatabase(); |
|
156
|
|
|
self::$GOODS = []; |
|
157
|
|
|
|
|
158
|
|
|
// determine user level |
|
159
|
|
|
$dbResult = self::$db->read('SELECT * FROM good ORDER BY good_id'); |
|
160
|
|
|
foreach ($dbResult->records() as $dbRecord) { |
|
161
|
|
|
self::$GOODS[$dbRecord->getInt('good_id')] = [ |
|
162
|
|
|
'Type' => 'Good', |
|
163
|
|
|
'ID' => $dbRecord->getInt('good_id'), |
|
164
|
|
|
'Name' => $dbRecord->getString('good_name'), |
|
165
|
|
|
'Max' => $dbRecord->getInt('max_amount'), |
|
166
|
|
|
'BasePrice' => $dbRecord->getInt('base_price'), |
|
167
|
|
|
'Class' => $dbRecord->getInt('good_class'), |
|
168
|
|
|
'ImageLink' => 'images/port/' . $dbRecord->getInt('good_id') . '.png', |
|
169
|
|
|
'AlignRestriction' => $dbRecord->getInt('align_restriction'), |
|
170
|
|
|
]; |
|
171
|
|
|
} |
|
172
|
|
|
} |
|
173
|
|
|
return self::$GOODS; |
|
174
|
|
|
} |
|
175
|
|
|
|
|
176
|
|
|
/** |
|
177
|
|
|
* @return array<string, string|int> |
|
178
|
|
|
*/ |
|
179
|
|
|
public static function getGood(int $goodID): array { |
|
180
|
|
|
return self::getGoods()[$goodID]; |
|
181
|
|
|
} |
|
182
|
|
|
|
|
183
|
|
|
public static function getGoodName(int $goodID): string { |
|
184
|
|
|
if ($goodID == GOODS_NOTHING) { |
|
185
|
|
|
return 'Nothing'; |
|
186
|
|
|
} |
|
187
|
|
|
return self::getGoods()[$goodID]['Name']; |
|
188
|
|
|
} |
|
189
|
|
|
|
|
190
|
|
|
/** |
|
191
|
|
|
* @return ($hardwareTypeID is null ? array<int, array<string, string|int>> : array<string, string|int>) |
|
|
|
|
|
|
192
|
|
|
*/ |
|
193
|
|
|
public static function getHardwareTypes(int $hardwareTypeID = null): array { |
|
194
|
|
|
if (!isset(self::$HARDWARE_TYPES)) { |
|
195
|
|
|
self::initialiseDatabase(); |
|
196
|
|
|
self::$HARDWARE_TYPES = []; |
|
197
|
|
|
|
|
198
|
|
|
// determine user level |
|
199
|
|
|
$dbResult = self::$db->read('SELECT * FROM hardware_type ORDER BY hardware_type_id'); |
|
200
|
|
|
foreach ($dbResult->records() as $dbRecord) { |
|
201
|
|
|
self::$HARDWARE_TYPES[$dbRecord->getInt('hardware_type_id')] = [ |
|
202
|
|
|
'Type' => 'Hardware', |
|
203
|
|
|
'ID' => $dbRecord->getInt('hardware_type_id'), |
|
204
|
|
|
'Name' => $dbRecord->getString('hardware_name'), |
|
205
|
|
|
'Cost' => $dbRecord->getInt('cost'), |
|
206
|
|
|
]; |
|
207
|
|
|
} |
|
208
|
|
|
} |
|
209
|
|
|
if ($hardwareTypeID === null) { |
|
210
|
|
|
return self::$HARDWARE_TYPES; |
|
211
|
|
|
} |
|
212
|
|
|
return self::$HARDWARE_TYPES[$hardwareTypeID]; |
|
213
|
|
|
} |
|
214
|
|
|
|
|
215
|
|
|
public static function getHardwareName(int $hardwareTypeID): string { |
|
216
|
|
|
return self::getHardwareTypes()[$hardwareTypeID]['Name']; |
|
217
|
|
|
} |
|
218
|
|
|
|
|
219
|
|
|
public static function getHardwareCost(int $hardwareTypeID): int { |
|
220
|
|
|
return self::getHardwareTypes()[$hardwareTypeID]['Cost']; |
|
221
|
|
|
} |
|
222
|
|
|
|
|
223
|
|
|
public static function isFeatureRequestOpen(): bool { |
|
224
|
|
|
if (!isset(self::$FEATURE_REQUEST_OPEN)) { |
|
225
|
|
|
self::initialiseDatabase(); |
|
226
|
|
|
$dbResult = self::$db->read('SELECT open FROM open_forms WHERE type=\'FEATURE\''); |
|
227
|
|
|
|
|
228
|
|
|
self::$FEATURE_REQUEST_OPEN = $dbResult->record()->getBoolean('open'); |
|
229
|
|
|
} |
|
230
|
|
|
return self::$FEATURE_REQUEST_OPEN; |
|
231
|
|
|
} |
|
232
|
|
|
|
|
233
|
|
|
/** |
|
234
|
|
|
* @return array<int, int> |
|
235
|
|
|
*/ |
|
236
|
|
|
public static function getRaceRelations(int $gameID, int $raceID): array { |
|
237
|
|
|
if (!isset(self::$RACE_RELATIONS[$gameID][$raceID])) { |
|
238
|
|
|
self::initialiseDatabase(); |
|
239
|
|
|
//get relations |
|
240
|
|
|
self::$RACE_RELATIONS[$gameID][$raceID] = []; |
|
241
|
|
|
foreach (Race::getAllIDs() as $otherRaceID) { |
|
242
|
|
|
self::$RACE_RELATIONS[$gameID][$raceID][$otherRaceID] = 0; |
|
243
|
|
|
} |
|
244
|
|
|
$dbResult = self::$db->read('SELECT race_id_2,relation FROM race_has_relation WHERE race_id_1=' . self::$db->escapeNumber($raceID) . ' AND game_id=' . self::$db->escapeNumber($gameID)); |
|
245
|
|
|
foreach ($dbResult->records() as $dbRecord) { |
|
246
|
|
|
self::$RACE_RELATIONS[$gameID][$raceID][$dbRecord->getInt('race_id_2')] = $dbRecord->getInt('relation'); |
|
247
|
|
|
} |
|
248
|
|
|
} |
|
249
|
|
|
return self::$RACE_RELATIONS[$gameID][$raceID]; |
|
250
|
|
|
} |
|
251
|
|
|
|
|
252
|
|
|
public static function getFeatureRequestHREF(): string { |
|
253
|
|
|
return (new FeatureRequest())->href(); |
|
254
|
|
|
} |
|
255
|
|
|
|
|
256
|
|
|
public static function getCurrentSectorHREF(): string { |
|
257
|
|
|
return self::$AVAILABLE_LINKS['CurrentSector'] = (new CurrentSector())->href(); |
|
258
|
|
|
} |
|
259
|
|
|
|
|
260
|
|
|
public static function getLocalMapHREF(): string { |
|
261
|
|
|
return self::$AVAILABLE_LINKS['LocalMap'] = (new LocalMap())->href(); |
|
262
|
|
|
} |
|
263
|
|
|
|
|
264
|
|
|
public static function getCurrentPlayersHREF(): string { |
|
265
|
|
|
return self::$AVAILABLE_LINKS['CurrentPlayers'] = (new CurrentPlayers())->href(); |
|
266
|
|
|
} |
|
267
|
|
|
|
|
268
|
|
|
public static function getTradeHREF(): string { |
|
269
|
|
|
return self::$AVAILABLE_LINKS['EnterPort'] = (new ShopGoods())->href(); |
|
270
|
|
|
} |
|
271
|
|
|
|
|
272
|
|
|
public static function getAttackTraderHREF(int $accountID): string { |
|
273
|
|
|
$container = new AttackPlayerProcessor($accountID); |
|
274
|
|
|
return self::$AVAILABLE_LINKS['AttackTrader'] = $container->href(); |
|
275
|
|
|
} |
|
276
|
|
|
|
|
277
|
|
|
public static function getBetaFunctionsHREF(): string { //BETA |
|
278
|
|
|
return (new BetaFunctions())->href(); |
|
279
|
|
|
} |
|
280
|
|
|
|
|
281
|
|
|
public static function getBugReportProcessingHREF(): string { |
|
282
|
|
|
return (new BugReportProcessor())->href(); |
|
283
|
|
|
} |
|
284
|
|
|
|
|
285
|
|
|
public static function getWeaponReorderHREF(int $weaponOrderID, string $direction): string { |
|
286
|
|
|
$container = new WeaponReorderProcessor($weaponOrderID, $direction); |
|
287
|
|
|
return $container->href(); |
|
288
|
|
|
} |
|
289
|
|
|
|
|
290
|
|
|
public static function getSmrFileCreateHREF(): string { |
|
291
|
|
|
$container = new SectorsFileDownloadProcessor(); |
|
292
|
|
|
return $container->href(); |
|
293
|
|
|
} |
|
294
|
|
|
|
|
295
|
|
|
public static function getCurrentSectorMoveHREF(AbstractSmrPlayer $player, int $toSector): string { |
|
296
|
|
|
return self::getSectorMoveHREF($player, $toSector, new CurrentSector()); |
|
297
|
|
|
} |
|
298
|
|
|
|
|
299
|
|
|
public static function getSectorMoveHREF(AbstractSmrPlayer $player, int $toSector, CurrentSector|LocalMap $targetPage): string { |
|
300
|
|
|
$container = new SectorMoveProcessor($toSector, $targetPage); |
|
301
|
|
|
return self::$AVAILABLE_LINKS['Move' . $player->getSector()->getSectorDirection($toSector)] = $container->href(); |
|
302
|
|
|
} |
|
303
|
|
|
|
|
304
|
|
|
public static function getSectorScanHREF(AbstractSmrPlayer $player, int $toSector): string { |
|
305
|
|
|
$container = new SectorScan($toSector); |
|
306
|
|
|
return self::$AVAILABLE_LINKS['Scan' . $player->getSector()->getSectorDirection($toSector)] = $container->href(); |
|
307
|
|
|
} |
|
308
|
|
|
|
|
309
|
|
|
public static function getPlotCourseHREF(int $fromSector = null, int $toSector = null): string { |
|
310
|
|
|
if ($fromSector === null && $toSector === null) { |
|
311
|
|
|
return self::$AVAILABLE_LINKS['PlotCourse'] = (new PlotCourse())->href(); |
|
312
|
|
|
} |
|
313
|
|
|
return (new PlotCourseConventionalProcessor(from: $fromSector, to: $toSector))->href(); |
|
314
|
|
|
} |
|
315
|
|
|
|
|
316
|
|
|
public static function getAllianceHREF(int $allianceID = null): string { |
|
317
|
|
|
if ($allianceID > 0) { |
|
318
|
|
|
return self::getAllianceMotdHREF($allianceID); |
|
|
|
|
|
|
319
|
|
|
} |
|
320
|
|
|
return self::getAllianceListHREF(); |
|
321
|
|
|
} |
|
322
|
|
|
|
|
323
|
|
|
public static function getAllianceBankHREF(int $allianceID = null): string { |
|
324
|
|
|
$container = new AllianceBank($allianceID); |
|
|
|
|
|
|
325
|
|
|
return $container->href(); |
|
326
|
|
|
} |
|
327
|
|
|
|
|
328
|
|
|
public static function getAllianceRosterHREF(int $allianceID = null): string { |
|
329
|
|
|
return (new AllianceRoster($allianceID))->href(); |
|
330
|
|
|
} |
|
331
|
|
|
|
|
332
|
|
|
public static function getAllianceListHREF(): string { |
|
333
|
|
|
return (new AllianceList())->href(); |
|
334
|
|
|
} |
|
335
|
|
|
|
|
336
|
|
|
public static function getAllianceNewsHREF(int $gameID, int $allianceID): string { |
|
337
|
|
|
return (new NewsReadAdvanced(gameID: $gameID, submit: 'Search For Alliance', allianceIDs: [$allianceID]))->href(); |
|
338
|
|
|
} |
|
339
|
|
|
|
|
340
|
|
|
public static function getAllianceMotdHREF(int $allianceID): string { |
|
341
|
|
|
return (new AllianceMotd($allianceID))->href(); |
|
342
|
|
|
} |
|
343
|
|
|
|
|
344
|
|
|
public static function getAllianceMessageHREF(int $allianceID): string { |
|
345
|
|
|
return (new AllianceBroadcast($allianceID))->href(); |
|
346
|
|
|
} |
|
347
|
|
|
|
|
348
|
|
|
public static function getAllianceMessageBoardHREF(int $allianceID): string { |
|
349
|
|
|
return (new AllianceMessageBoard($allianceID))->href(); |
|
350
|
|
|
} |
|
351
|
|
|
|
|
352
|
|
|
public static function getAllianceForcesHREF(int $allianceID): string { |
|
353
|
|
|
return (new AllianceForces($allianceID))->href(); |
|
354
|
|
|
} |
|
355
|
|
|
|
|
356
|
|
|
public static function getAllianceOptionsHREF(): string { |
|
357
|
|
|
return (new AllianceOptions())->href(); |
|
358
|
|
|
} |
|
359
|
|
|
|
|
360
|
|
|
public static function getPlanetListHREF(int $allianceID): string { |
|
361
|
|
|
return (new ListPlanetDefense($allianceID))->href(); |
|
362
|
|
|
} |
|
363
|
|
|
|
|
364
|
|
|
public static function getPlanetListFinancialHREF(int $allianceID): string { |
|
365
|
|
|
return (new ListPlanetFinancial($allianceID))->href(); |
|
366
|
|
|
} |
|
367
|
|
|
|
|
368
|
|
|
public static function getViewMessageBoxesHREF(): string { |
|
369
|
|
|
return (new MessageBox())->href(); |
|
370
|
|
|
} |
|
371
|
|
|
|
|
372
|
|
|
public static function getSendGlobalMessageHREF(): string { |
|
373
|
|
|
return (new MessageSend())->href(); |
|
374
|
|
|
} |
|
375
|
|
|
|
|
376
|
|
|
public static function getManageBlacklistHREF(): string { |
|
377
|
|
|
return (new MessageBlacklist())->href(); |
|
378
|
|
|
} |
|
379
|
|
|
|
|
380
|
|
|
public static function getSendCouncilMessageHREF(int $raceID): string { |
|
381
|
|
|
$container = new MessageCouncil($raceID); |
|
382
|
|
|
return $container->href(); |
|
383
|
|
|
} |
|
384
|
|
|
|
|
385
|
|
|
public static function getTraderStatusHREF(): string { |
|
386
|
|
|
return (new TraderStatus())->href(); |
|
387
|
|
|
} |
|
388
|
|
|
|
|
389
|
|
|
public static function getCouncilHREF(int $raceID): string { |
|
390
|
|
|
$container = new ViewCouncil($raceID); |
|
391
|
|
|
return $container->href(); |
|
392
|
|
|
} |
|
393
|
|
|
|
|
394
|
|
|
public static function getTraderRelationsHREF(): string { |
|
395
|
|
|
return (new TraderRelations())->href(); |
|
396
|
|
|
} |
|
397
|
|
|
|
|
398
|
|
|
public static function getTraderBountiesHREF(): string { |
|
399
|
|
|
return (new TraderBounties())->href(); |
|
400
|
|
|
} |
|
401
|
|
|
|
|
402
|
|
|
public static function getCasinoHREF(): string { |
|
403
|
|
|
return (new MatchList())->href(); |
|
404
|
|
|
} |
|
405
|
|
|
|
|
406
|
|
|
public static function getChessHREF(): string { |
|
407
|
|
|
return (new MatchList())->href(); |
|
408
|
|
|
} |
|
409
|
|
|
|
|
410
|
|
|
public static function getChessCreateHREF(): string { |
|
411
|
|
|
return (new MatchStartProcessor())->href(); |
|
412
|
|
|
} |
|
413
|
|
|
|
|
414
|
|
|
public static function getBuyMessageNotificationsHREF(): string { |
|
415
|
|
|
return (new BuyMessageNotifications())->href(); |
|
416
|
|
|
} |
|
417
|
|
|
|
|
418
|
|
|
public static function getBuyShipNameHREF(): string { |
|
419
|
|
|
return (new BuyShipName())->href(); |
|
420
|
|
|
} |
|
421
|
|
|
|
|
422
|
|
|
/** |
|
423
|
|
|
* @return array<string, int> |
|
424
|
|
|
*/ |
|
425
|
|
|
public static function getBuyShipNameCosts(): array { |
|
426
|
|
|
return [ |
|
427
|
|
|
'text' => CREDITS_PER_TEXT_SHIP_NAME, |
|
428
|
|
|
'html' => CREDITS_PER_HTML_SHIP_NAME, |
|
429
|
|
|
'logo' => CREDITS_PER_SHIP_LOGO, |
|
430
|
|
|
]; |
|
431
|
|
|
} |
|
432
|
|
|
|
|
433
|
|
|
public static function getSectorBBLink(int $sectorID): string { |
|
434
|
|
|
return '[sector=' . $sectorID . ']'; |
|
435
|
|
|
} |
|
436
|
|
|
|
|
437
|
|
|
/** |
|
438
|
|
|
* @return array<string> |
|
439
|
|
|
*/ |
|
440
|
|
|
public static function getAvailableTemplates(): array { |
|
441
|
|
|
return array_keys(CSS_URLS); |
|
442
|
|
|
} |
|
443
|
|
|
|
|
444
|
|
|
/** |
|
445
|
|
|
* @return array<string> |
|
446
|
|
|
*/ |
|
447
|
|
|
public static function getAvailableColourSchemes(string $templateName): array { |
|
448
|
|
|
return array_keys(CSS_COLOUR_URLS[$templateName]); |
|
449
|
|
|
} |
|
450
|
|
|
|
|
451
|
|
|
/** |
|
452
|
|
|
* Returns an array of history databases for which we have ancient saved |
|
453
|
|
|
* game data. Array keys are database names and values are the columns in |
|
454
|
|
|
* the `account` table with the linked historical account ID's. |
|
455
|
|
|
* |
|
456
|
|
|
* @return array<string, string> |
|
457
|
|
|
*/ |
|
458
|
|
|
public static function getHistoryDatabases(): array { |
|
459
|
|
|
if (!defined('HISTORY_DATABASES')) { |
|
460
|
|
|
return []; |
|
461
|
|
|
} |
|
462
|
|
|
return HISTORY_DATABASES; |
|
|
|
|
|
|
463
|
|
|
} |
|
464
|
|
|
|
|
465
|
|
|
} |
|
466
|
|
|
|