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