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