1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
class Globals { |
4
|
|
|
protected static array $HIDDEN_PLAYERS; |
5
|
|
|
protected static array $LEVEL_REQUIREMENTS; |
6
|
|
|
protected static array $RACES; |
7
|
|
|
protected static array $GOODS; |
8
|
|
|
protected static array $HARDWARE_TYPES; |
9
|
|
|
protected static bool $FEATURE_REQUEST_OPEN; |
10
|
|
|
protected static array $RACE_RELATIONS; |
11
|
|
|
protected static array $USER_RANKINGS; |
12
|
|
|
protected static array $SHIP_CLASSES; |
13
|
|
|
protected static array $AVAILABLE_LINKS = []; |
14
|
|
|
protected static Smr\Database $db; |
15
|
|
|
|
16
|
|
|
protected static function initialiseDatabase() : void { |
17
|
|
|
if (!isset(self::$db)) { |
18
|
|
|
self::$db = Smr\Database::getInstance(); |
19
|
|
|
} |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
public static function getAvailableLinks() : array { |
23
|
|
|
return self::$AVAILABLE_LINKS; |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
public static function canAccessPage(string $pageName, AbstractSmrPlayer $player, array $extraInfo) : void { |
27
|
|
|
switch ($pageName) { |
28
|
|
|
case 'AllianceMOTD': |
29
|
|
|
if ($player->getAllianceID() != $extraInfo['AllianceID']) { |
30
|
|
|
logException(new Exception('Tried to access page without permission.')); |
31
|
|
|
create_error('You cannot access this page.'); |
32
|
|
|
} |
33
|
|
|
break; |
34
|
|
|
} |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
public static function getHiddenPlayers() : array { |
38
|
|
|
if (!isset(self::$HIDDEN_PLAYERS)) { |
39
|
|
|
self::initialiseDatabase(); |
40
|
|
|
self::$db->query('SELECT account_id FROM hidden_players'); |
41
|
|
|
self::$HIDDEN_PLAYERS = array(0); //stop errors |
42
|
|
|
while (self::$db->nextRecord()) { |
43
|
|
|
self::$HIDDEN_PLAYERS[] = self::$db->getInt('account_id'); |
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
return self::$HIDDEN_PLAYERS; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public static function getGalacticPostEditorIDs(int $gameID) : array { |
50
|
|
|
self::initialiseDatabase(); |
51
|
|
|
$editorIDs = []; |
52
|
|
|
self::$db->query('SELECT account_id FROM galactic_post_writer WHERE position=\'editor\' AND game_id=' . self::$db->escapeNumber($gameID)); |
53
|
|
|
while (self::$db->nextRecord()) { |
54
|
|
|
$editorIDs[] = self::$db->getInt('account_id'); |
55
|
|
|
} |
56
|
|
|
return $editorIDs; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public static function getLevelRequirements() : array { |
60
|
|
|
if (!isset(self::$LEVEL_REQUIREMENTS)) { |
61
|
|
|
self::initialiseDatabase(); |
62
|
|
|
self::$LEVEL_REQUIREMENTS = array(); |
63
|
|
|
|
64
|
|
|
// determine user level |
65
|
|
|
self::$db->query('SELECT * FROM level ORDER BY level_id ASC'); |
66
|
|
|
while (self::$db->nextRecord()) { |
67
|
|
|
self::$LEVEL_REQUIREMENTS[self::$db->getInt('level_id')] = array( |
68
|
|
|
'Name' => self::$db->getField('level_name'), |
69
|
|
|
'Requirement' => self::$db->getInt('requirement') |
70
|
|
|
); |
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
return self::$LEVEL_REQUIREMENTS; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
public static function getRaces() : array { |
77
|
|
|
if (!isset(self::$RACES)) { |
78
|
|
|
self::initialiseDatabase(); |
79
|
|
|
self::$RACES = array(); |
80
|
|
|
|
81
|
|
|
// determine user level |
82
|
|
|
self::$db->query('SELECT race_id,race_name,race_description FROM race ORDER BY race_id'); |
83
|
|
|
while (self::$db->nextRecord()) { |
84
|
|
|
self::$RACES[self::$db->getInt('race_id')] = array( |
85
|
|
|
'Race ID' => self::$db->getInt('race_id'), |
86
|
|
|
'Race Name' => self::$db->getField('race_name'), |
87
|
|
|
'Description' => self::$db->getField('race_description'), |
88
|
|
|
'ImageLink' => 'images/race/race' . self::$db->getInt('race_id') . '.jpg', |
89
|
|
|
'ImageHeadLink' => 'images/race/head/race' . self::$db->getInt('race_id') . '.jpg', |
90
|
|
|
); |
91
|
|
|
} |
92
|
|
|
} |
93
|
|
|
return self::$RACES; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
public static function getRaceName(int $raceID) : string { |
97
|
|
|
return Globals::getRaces()[$raceID]['Race Name']; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
public static function getRaceImage(int $raceID) : string { |
101
|
|
|
return Globals::getRaces()[$raceID]['ImageLink']; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
public static function getRaceHeadImage(int $raceID) : string { |
105
|
|
|
return Globals::getRaces()[$raceID]['ImageHeadLink']; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
public static function getColouredRaceNameForRace(int $raceID, int $gameID, int $fromRaceID, bool $linked = true) : string { |
109
|
|
|
$raceRelations = Globals::getRaceRelations($gameID, $fromRaceID); |
110
|
|
|
return self::getColouredRaceName($raceID, $raceRelations[$raceID], $linked); |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
public static function getColouredRaceName(int $raceID, int $relations, bool $linked = true) : string { |
114
|
|
|
$raceName = get_colored_text($relations, Globals::getRaceName($raceID)); |
115
|
|
|
if ($linked === true) { |
116
|
|
|
$container = Page::create('skeleton.php', 'council_list.php', array('race_id' => $raceID)); |
117
|
|
|
$raceName = create_link($container, $raceName); |
118
|
|
|
} |
119
|
|
|
return $raceName; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
public static function getGoods() : array { |
123
|
|
|
if (!isset(self::$GOODS)) { |
124
|
|
|
self::initialiseDatabase(); |
125
|
|
|
self::$GOODS = array(); |
126
|
|
|
|
127
|
|
|
// determine user level |
128
|
|
|
self::$db->query('SELECT * FROM good ORDER BY good_id'); |
129
|
|
|
while (self::$db->nextRecord()) { |
130
|
|
|
self::$GOODS[self::$db->getInt('good_id')] = array( |
131
|
|
|
'Type' => 'Good', |
132
|
|
|
'ID' => self::$db->getInt('good_id'), |
133
|
|
|
'Name' => self::$db->getField('good_name'), |
134
|
|
|
'Max' => self::$db->getInt('max_amount'), |
135
|
|
|
'BasePrice' => self::$db->getInt('base_price'), |
136
|
|
|
'Class' => self::$db->getInt('good_class'), |
137
|
|
|
'ImageLink' => 'images/port/' . self::$db->getInt('good_id') . '.png', |
138
|
|
|
'AlignRestriction' => self::$db->getInt('align_restriction') |
139
|
|
|
); |
140
|
|
|
} |
141
|
|
|
} |
142
|
|
|
return self::$GOODS; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
public static function getGood(int $goodID) : array { |
146
|
|
|
return Globals::getGoods()[$goodID]; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
public static function getGoodName(int $goodID) : string { |
150
|
|
|
if ($goodID == GOODS_NOTHING) { |
151
|
|
|
return 'Nothing'; |
152
|
|
|
} |
153
|
|
|
return Globals::getGoods()[$goodID]['Name']; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
public static function getHardwareTypes(int $hardwareTypeID = null) : array { |
157
|
|
|
if (!isset(self::$HARDWARE_TYPES)) { |
158
|
|
|
self::initialiseDatabase(); |
159
|
|
|
self::$HARDWARE_TYPES = array(); |
160
|
|
|
|
161
|
|
|
// determine user level |
162
|
|
|
self::$db->query('SELECT * FROM hardware_type ORDER BY hardware_type_id'); |
163
|
|
|
while (self::$db->nextRecord()) { |
164
|
|
|
self::$HARDWARE_TYPES[self::$db->getInt('hardware_type_id')] = array( |
165
|
|
|
'Type' => 'Hardware', |
166
|
|
|
'ID' => self::$db->getInt('hardware_type_id'), |
167
|
|
|
'Name' => self::$db->getField('hardware_name'), |
168
|
|
|
'Cost' => self::$db->getInt('cost') |
169
|
|
|
); |
170
|
|
|
} |
171
|
|
|
} |
172
|
|
|
if ($hardwareTypeID === null) { |
173
|
|
|
return self::$HARDWARE_TYPES; |
174
|
|
|
} |
175
|
|
|
return self::$HARDWARE_TYPES[$hardwareTypeID]; |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
public static function getHardwareName(int $hardwareTypeID) : string { |
179
|
|
|
return Globals::getHardwareTypes()[$hardwareTypeID]['Name']; |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
public static function getHardwareCost(int $hardwareTypeID) : int { |
183
|
|
|
return Globals::getHardwareTypes()[$hardwareTypeID]['Cost']; |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
public static function isValidGame(int $gameID) : bool { |
187
|
|
|
try { |
188
|
|
|
SmrGame::getGame($gameID); |
189
|
|
|
return true; |
190
|
|
|
} catch (GameNotFoundException $e) { |
191
|
|
|
return false; |
192
|
|
|
} |
193
|
|
|
} |
194
|
|
|
|
195
|
|
|
public static function getGameType(int $gameID) : string { |
196
|
|
|
return SmrGame::getGame($gameID)->getGameType(); |
197
|
|
|
} |
198
|
|
|
|
199
|
|
|
public static function isFeatureRequestOpen() : bool { |
200
|
|
|
if (!isset(self::$FEATURE_REQUEST_OPEN)) { |
201
|
|
|
self::initialiseDatabase(); |
202
|
|
|
self::$db->query('SELECT open FROM open_forms WHERE type=\'FEATURE\''); |
203
|
|
|
self::$db->nextRecord(); |
204
|
|
|
|
205
|
|
|
self::$FEATURE_REQUEST_OPEN = self::$db->getBoolean('open'); |
206
|
|
|
} |
207
|
|
|
return self::$FEATURE_REQUEST_OPEN; |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
public static function getRaceRelations(int $gameID, int $raceID) : array { |
211
|
|
|
if (!isset(self::$RACE_RELATIONS[$gameID][$raceID])) { |
212
|
|
|
self::initialiseDatabase(); |
213
|
|
|
//get relations |
214
|
|
|
$RACES = Globals::getRaces(); |
215
|
|
|
self::$RACE_RELATIONS[$gameID][$raceID] = array(); |
216
|
|
|
foreach ($RACES as $otherRaceID => $raceArray) { |
217
|
|
|
self::$RACE_RELATIONS[$gameID][$raceID][$otherRaceID] = 0; |
218
|
|
|
} |
219
|
|
|
self::$db->query('SELECT race_id_2,relation FROM race_has_relation WHERE race_id_1=' . self::$db->escapeNumber($raceID) . ' AND game_id=' . self::$db->escapeNumber($gameID) . ' LIMIT ' . count($RACES)); |
220
|
|
|
while (self::$db->nextRecord()) { |
221
|
|
|
self::$RACE_RELATIONS[$gameID][$raceID][self::$db->getInt('race_id_2')] = self::$db->getInt('relation'); |
222
|
|
|
} |
223
|
|
|
} |
224
|
|
|
return self::$RACE_RELATIONS[$gameID][$raceID]; |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
/** |
228
|
|
|
* If specified, returns the Ship Class Name associated with the given ID. |
229
|
|
|
* Otherwise, returns an array of all Ship Class Names. |
230
|
|
|
*/ |
231
|
|
|
public static function getShipClass(int $shipClassID = null) : array|string { |
232
|
|
|
if (!isset(self::$SHIP_CLASSES)) { |
233
|
|
|
self::initialiseDatabase(); |
234
|
|
|
self::$db->query('SELECT * FROM ship_class'); |
235
|
|
|
while (self::$db->nextRecord()) { |
236
|
|
|
self::$SHIP_CLASSES[self::$db->getInt('ship_class_id')] = self::$db->getField('ship_class_name'); |
237
|
|
|
} |
238
|
|
|
} |
239
|
|
|
if (is_null($shipClassID)) { |
240
|
|
|
return self::$SHIP_CLASSES; |
241
|
|
|
} |
242
|
|
|
return self::$SHIP_CLASSES[$shipClassID]; |
243
|
|
|
} |
244
|
|
|
|
245
|
|
|
public static function getUserRanking() : array { |
246
|
|
|
if (!isset(self::$USER_RANKINGS)) { |
247
|
|
|
self::initialiseDatabase(); |
248
|
|
|
self::$USER_RANKINGS = array(); |
249
|
|
|
self::$db->query('SELECT `rank`, rank_name FROM user_rankings ORDER BY `rank`'); |
250
|
|
|
while (self::$db->nextRecord()) { |
251
|
|
|
self::$USER_RANKINGS[self::$db->getInt('rank')] = self::$db->getField('rank_name'); |
252
|
|
|
} |
253
|
|
|
} |
254
|
|
|
return self::$USER_RANKINGS; |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
public static function getFeatureRequestHREF() : string { |
258
|
|
|
return Page::create('skeleton.php', 'feature_request.php')->href(); |
259
|
|
|
} |
260
|
|
|
|
261
|
|
|
public static function getCurrentSectorHREF() : string { |
262
|
|
|
return self::$AVAILABLE_LINKS['CurrentSector'] = Page::create('skeleton.php', 'current_sector.php')->href(); |
263
|
|
|
} |
264
|
|
|
|
265
|
|
|
public static function getLocalMapHREF() : string { |
266
|
|
|
return self::$AVAILABLE_LINKS['LocalMap'] = Page::create('skeleton.php', 'map_local.php')->href(); |
267
|
|
|
} |
268
|
|
|
|
269
|
|
|
public static function getCurrentPlayersHREF() : string { |
270
|
|
|
return self::$AVAILABLE_LINKS['CurrentPlayers'] = Page::create('skeleton.php', 'current_players.php')->href(); |
271
|
|
|
} |
272
|
|
|
|
273
|
|
|
public static function getTradeHREF() : string { |
274
|
|
|
return self::$AVAILABLE_LINKS['EnterPort'] = Page::create('skeleton.php', 'shop_goods.php')->href(); |
275
|
|
|
} |
276
|
|
|
|
277
|
|
|
public static function getAttackTraderHREF(int $accountID) : string { |
278
|
|
|
$container = Page::create('trader_attack_processing.php'); |
279
|
|
|
$container['target'] = $accountID; |
280
|
|
|
return self::$AVAILABLE_LINKS['AttackTrader'] = $container->href(); |
281
|
|
|
} |
282
|
|
|
|
283
|
|
|
public static function getPodScreenHREF() : string { |
284
|
|
|
return Page::create('death_processing.php')->href(); |
285
|
|
|
} |
286
|
|
|
|
287
|
|
|
public static function getBetaFunctionsHREF() : string { //BETA |
288
|
|
|
return Page::create('skeleton.php', 'beta_functions.php')->href(); |
289
|
|
|
} |
290
|
|
|
|
291
|
|
|
public static function getBugReportProcessingHREF() : string { |
292
|
|
|
return Page::create('bug_report_processing.php')->href(); |
293
|
|
|
} |
294
|
|
|
|
295
|
|
|
public static function getWeaponReorderHREF(int $weaponOrderID, string $direction) : string { |
296
|
|
|
$container = Page::create('weapon_reorder_processing.php'); |
297
|
|
|
$container[$direction] = $weaponOrderID; |
298
|
|
|
return $container->href(); |
299
|
|
|
} |
300
|
|
|
|
301
|
|
|
public static function getSmrFileCreateHREF(int $adminCreateGameID = null) : string { |
302
|
|
|
$container = Page::create('skeleton.php', 'smr_file_create.php'); |
303
|
|
|
$container['AdminCreateGameID'] = $adminCreateGameID; |
304
|
|
|
return $container->href(); |
305
|
|
|
} |
306
|
|
|
|
307
|
|
|
public static function getCurrentSectorMoveHREF(AbstractSmrPlayer $player, int $toSector) : string { |
308
|
|
|
return self::getSectorMoveHREF($player, $toSector, 'current_sector.php'); |
309
|
|
|
} |
310
|
|
|
|
311
|
|
|
public static function getSectorMoveHREF(AbstractSmrPlayer $player, int $toSector, string $targetPage) : string { |
312
|
|
|
$container = Page::create('sector_move_processing.php'); |
313
|
|
|
$container['target_page'] = $targetPage; |
314
|
|
|
$container['target_sector'] = $toSector; |
315
|
|
|
return self::$AVAILABLE_LINKS['Move' . $player->getSector()->getSectorDirection($toSector)] = $container->href(); |
316
|
|
|
} |
317
|
|
|
|
318
|
|
|
public static function getSectorScanHREF(AbstractSmrPlayer $player, int $toSector) : string { |
319
|
|
|
$container = Page::create('skeleton.php', 'sector_scan.php'); |
320
|
|
|
$container['target_sector'] = $toSector; |
321
|
|
|
return self::$AVAILABLE_LINKS['Scan' . $player->getSector()->getSectorDirection($toSector)] = $container->href(); |
322
|
|
|
} |
323
|
|
|
|
324
|
|
|
public static function getPlotCourseHREF(int $fromSector = null, int $toSector = null) : string { |
325
|
|
|
if ($fromSector === null && $toSector === null) { |
326
|
|
|
return self::$AVAILABLE_LINKS['PlotCourse'] = Page::create('skeleton.php', 'course_plot.php')->href(); |
327
|
|
|
} else { |
328
|
|
|
return Page::create('course_plot_processing.php', '', array('from'=>$fromSector, 'to'=>$toSector))->href(); |
329
|
|
|
} |
330
|
|
|
} |
331
|
|
|
|
332
|
|
|
public static function getPlanetMainHREF() : string { |
333
|
|
|
return Page::create('skeleton.php', 'planet_main.php')->href(); |
334
|
|
|
} |
335
|
|
|
|
336
|
|
|
public static function getPlanetConstructionHREF() : string { |
337
|
|
|
return Page::create('skeleton.php', 'planet_construction.php')->href(); |
338
|
|
|
} |
339
|
|
|
|
340
|
|
|
public static function getPlanetDefensesHREF() : string { |
341
|
|
|
return Page::create('skeleton.php', 'planet_defense.php')->href(); |
342
|
|
|
} |
343
|
|
|
|
344
|
|
|
public static function getPlanetOwnershipHREF() : string { |
345
|
|
|
return Page::create('skeleton.php', 'planet_ownership.php')->href(); |
346
|
|
|
} |
347
|
|
|
|
348
|
|
|
public static function getPlanetStockpileHREF() : string { |
349
|
|
|
return Page::create('skeleton.php', 'planet_stockpile.php')->href(); |
350
|
|
|
} |
351
|
|
|
|
352
|
|
|
public static function getPlanetFinancesHREF() : string { |
353
|
|
|
return Page::create('skeleton.php', 'planet_financial.php')->href(); |
354
|
|
|
} |
355
|
|
|
|
356
|
|
|
public static function getAllianceHREF(int $allianceID = null) : string { |
357
|
|
|
if ($allianceID > 0) { |
358
|
|
|
return self::getAllianceMotdHREF($allianceID); |
|
|
|
|
359
|
|
|
} else { |
360
|
|
|
return self::getAllianceListHREF(); |
361
|
|
|
} |
362
|
|
|
} |
363
|
|
|
|
364
|
|
|
public static function getAllianceBankHREF(int $allianceID = null) : string { |
365
|
|
|
$container = Page::create('skeleton.php', 'bank_alliance.php'); |
366
|
|
|
$container['alliance_id'] = $allianceID; |
367
|
|
|
return $container->href(); |
368
|
|
|
} |
369
|
|
|
|
370
|
|
|
public static function getAllianceRosterHREF($allianceID = null) : string { |
371
|
|
|
$container = Page::create('skeleton.php', 'alliance_roster.php'); |
372
|
|
|
$container['alliance_id'] = $allianceID; |
373
|
|
|
return $container->href(); |
374
|
|
|
} |
375
|
|
|
|
376
|
|
|
public static function getAllianceListHREF() : string { |
377
|
|
|
return Page::create('skeleton.php', 'alliance_list.php')->href(); |
378
|
|
|
} |
379
|
|
|
|
380
|
|
|
public static function getAllianceNewsHREF(int $allianceID) : string { |
381
|
|
|
return Page::create('skeleton.php', 'news_read_advanced.php', array('allianceID'=>$allianceID, 'submit' => 'Search For Alliance'))->href(); |
382
|
|
|
} |
383
|
|
|
|
384
|
|
|
public static function getAllianceMotdHREF(int $allianceID) : string { |
385
|
|
|
return Page::create('skeleton.php', 'alliance_mod.php', array('alliance_id'=>$allianceID))->href(); |
386
|
|
|
} |
387
|
|
|
|
388
|
|
|
public static function getAllianceMessageHREF(int $allianceID) : string { |
389
|
|
|
return Page::create('skeleton.php', 'alliance_broadcast.php', array('alliance_id'=>$allianceID))->href(); |
390
|
|
|
} |
391
|
|
|
|
392
|
|
|
public static function getAllianceMessageBoardHREF(int $allianceID) : string { |
393
|
|
|
return Page::create('skeleton.php', 'alliance_message.php', array('alliance_id'=>$allianceID))->href(); |
394
|
|
|
} |
395
|
|
|
|
396
|
|
|
public static function getAllianceForcesHREF(int $allianceID) : string { |
397
|
|
|
return Page::create('skeleton.php', 'alliance_forces.php', array('alliance_id'=>$allianceID))->href(); |
398
|
|
|
} |
399
|
|
|
|
400
|
|
|
public static function getAllianceOptionsHREF(int $allianceID) : string { |
401
|
|
|
return Page::create('skeleton.php', 'alliance_option.php', array('alliance_id'=>$allianceID))->href(); |
402
|
|
|
} |
403
|
|
|
|
404
|
|
|
public static function getPlanetListHREF(int $allianceID) : string { |
405
|
|
|
return Page::create('skeleton.php', 'planet_list.php', array('alliance_id'=>$allianceID))->href(); |
406
|
|
|
} |
407
|
|
|
|
408
|
|
|
public static function getPlanetListFinancialHREF(int $allianceID) : string { |
409
|
|
|
return Page::create('skeleton.php', 'planet_list_financial.php', array('alliance_id'=>$allianceID))->href(); |
410
|
|
|
} |
411
|
|
|
|
412
|
|
|
public static function getViewMessageBoxesHREF() : string { |
413
|
|
|
return Page::create('skeleton.php', 'message_box.php')->href(); |
414
|
|
|
} |
415
|
|
|
|
416
|
|
|
public static function getSendGlobalMessageHREF() : string { |
417
|
|
|
return Page::create('skeleton.php', 'message_send.php')->href(); |
418
|
|
|
} |
419
|
|
|
|
420
|
|
|
public static function getManageBlacklistHREF() : string { |
421
|
|
|
return Page::create('skeleton.php', 'message_blacklist.php')->href(); |
422
|
|
|
} |
423
|
|
|
|
424
|
|
|
public static function getSendCouncilMessageHREF(int $raceID) : string { |
425
|
|
|
$container = Page::create('skeleton.php', 'council_send_message.php'); |
426
|
|
|
$container['race_id'] = $raceID; |
427
|
|
|
$container['folder_id'] = MSG_POLITICAL; |
428
|
|
|
return $container->href(); |
429
|
|
|
} |
430
|
|
|
|
431
|
|
|
public static function getTraderStatusHREF() : string { |
432
|
|
|
return Page::create('skeleton.php', 'trader_status.php')->href(); |
433
|
|
|
} |
434
|
|
|
|
435
|
|
|
public static function getCouncilHREF(int $raceID = null) : string { |
436
|
|
|
$container = Page::create('skeleton.php', 'council_list.php'); |
437
|
|
|
$container['race_id'] = $raceID; |
438
|
|
|
return $container->href(); |
439
|
|
|
} |
440
|
|
|
|
441
|
|
|
public static function getTraderRelationsHREF() : string { |
442
|
|
|
return Page::create('skeleton.php', 'trader_relations.php')->href(); |
443
|
|
|
} |
444
|
|
|
|
445
|
|
|
public static function getTraderBountiesHREF() : string { |
446
|
|
|
return Page::create('skeleton.php', 'trader_bounties.php')->href(); |
447
|
|
|
} |
448
|
|
|
|
449
|
|
|
public static function getPoliticsHREF() : string { |
450
|
|
|
return Page::create('skeleton.php', 'council_list.php')->href(); |
451
|
|
|
} |
452
|
|
|
|
453
|
|
|
public static function getCasinoHREF() : string { |
454
|
|
|
return Page::create('skeleton.php', 'chess.php')->href(); |
455
|
|
|
} |
456
|
|
|
|
457
|
|
|
public static function getChessHREF() : string { |
458
|
|
|
return Page::create('skeleton.php', 'chess.php')->href(); |
459
|
|
|
} |
460
|
|
|
|
461
|
|
|
public static function getChessCreateHREF() : string { |
462
|
|
|
return Page::create('chess_create_processing.php')->href(); |
463
|
|
|
} |
464
|
|
|
|
465
|
|
|
public static function getBarMainHREF() : string { |
466
|
|
|
$container = Page::create('skeleton.php', 'bar_main.php'); |
467
|
|
|
$container->addVar('LocationID'); |
468
|
|
|
return $container->href(); |
469
|
|
|
} |
470
|
|
|
|
471
|
|
|
public static function getBarLottoPlayHREF() : string { |
472
|
|
|
$container = Page::create('skeleton.php', 'bar_lotto_buy.php'); |
473
|
|
|
$container->addVar('LocationID'); |
474
|
|
|
return $container->href(); |
475
|
|
|
} |
476
|
|
|
|
477
|
|
|
public static function getBarBlackjackHREF() : string { |
478
|
|
|
$container = Page::create('skeleton.php', 'bar_gambling_bet.php'); |
479
|
|
|
$container->addVar('LocationID'); |
480
|
|
|
return $container->href(); |
481
|
|
|
} |
482
|
|
|
|
483
|
|
|
public static function getBuyMessageNotificationsHREF() : string { |
484
|
|
|
return Page::create('skeleton.php', 'buy_message_notifications.php')->href(); |
485
|
|
|
} |
486
|
|
|
|
487
|
|
|
public static function getBuyShipNameHREF() : string { |
488
|
|
|
return Page::create('skeleton.php', 'buy_ship_name.php')->href(); |
489
|
|
|
} |
490
|
|
|
|
491
|
|
|
public static function getBuyShipNameCosts() : array { |
492
|
|
|
return [ |
493
|
|
|
'text' => CREDITS_PER_TEXT_SHIP_NAME, |
494
|
|
|
'html' => CREDITS_PER_HTML_SHIP_NAME, |
495
|
|
|
'logo' => CREDITS_PER_SHIP_LOGO, |
496
|
|
|
]; |
497
|
|
|
} |
498
|
|
|
|
499
|
|
|
public static function getSectorBBLink(int $sectorID) : string { |
500
|
|
|
return '[sector=' . $sectorID . ']'; |
501
|
|
|
} |
502
|
|
|
|
503
|
|
|
public static function getAvailableTemplates() : array { |
504
|
|
|
return array_keys(CSS_URLS); |
505
|
|
|
} |
506
|
|
|
|
507
|
|
|
public static function getAvailableColourSchemes(string $templateName) : array { |
508
|
|
|
return array_keys(CSS_COLOUR_URLS[$templateName]); |
509
|
|
|
} |
510
|
|
|
|
511
|
|
|
/** |
512
|
|
|
* Returns an array of history databases for which we have ancient saved |
513
|
|
|
* game data. Array keys are database names and values are the columns in |
514
|
|
|
* the `account` table with the linked historical account ID's. |
515
|
|
|
*/ |
516
|
|
|
public static function getHistoryDatabases() : array { |
517
|
|
|
if (defined('HISTORY_DATABASES')) { |
518
|
|
|
return HISTORY_DATABASES; |
|
|
|
|
519
|
|
|
} else { |
520
|
|
|
return array(); |
521
|
|
|
} |
522
|
|
|
} |
523
|
|
|
|
524
|
|
|
} |
525
|
|
|
|