osrs-json-hiscores
Version:
The Old School Runescape API wrapper that does more!
355 lines (354 loc) • 11.3 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.HiScoresError = exports.PlayerNotFoundError = exports.InvalidRSNError = exports.InvalidFormatError = exports.HISCORES_ERROR = exports.PLAYER_NOT_FOUND_ERROR = exports.INVALID_FORMAT_ERROR = exports.FORMATTED_COLLECTIONS_LOGGED = exports.FORMATTED_COLOSSEUM_GLORY = exports.FORMATTED_RIFTS_CLOSED = exports.FORMATTED_DEADMAN_POINTS = exports.FORMATTED_LEAGUE_POINTS = exports.FORMATTED_SOUL_WARS = exports.FORMATTED_PVP_ARENA = exports.FORMATTED_LMS = exports.FORMATTED_BH_NAMES = exports.FORMATTED_CLUE_NAMES = exports.FORMATTED_SKILL_NAMES = exports.FORMATTED_BOSS_NAMES = exports.ACTIVITIES = exports.BOSSES = exports.GAMEMODES = exports.BH_MODES = exports.CLUES = exports.SKILLS = exports.GAMEMODE_URL = exports.WHITESPACE_REGEX = exports.WHITESPACE_REGEX_STRING = exports.SCORES_URL = exports.JSON_STATS_URL = exports.STATS_URL = exports.BASE_URL = void 0;
exports.BASE_URL = 'https://secure.runescape.com/m=hiscore_oldschool';
exports.STATS_URL = 'index_lite.ws?player=';
exports.JSON_STATS_URL = 'index_lite.json?player=';
exports.SCORES_URL = 'overall.ws?';
exports.WHITESPACE_REGEX_STRING = '( |-|_)';
exports.WHITESPACE_REGEX = new RegExp(exports.WHITESPACE_REGEX_STRING, 'g');
exports.GAMEMODE_URL = {
main: "".concat(exports.BASE_URL, "/"),
ironman: "".concat(exports.BASE_URL, "_ironman/"),
hardcore: "".concat(exports.BASE_URL, "_hardcore_ironman/"),
ultimate: "".concat(exports.BASE_URL, "_ultimate/"),
deadman: "".concat(exports.BASE_URL, "_deadman/"),
seasonal: "".concat(exports.BASE_URL, "_seasonal/"),
tournament: "".concat(exports.BASE_URL, "_tournament/"),
skiller: "".concat(exports.BASE_URL, "_skiller/"),
oneDefence: "".concat(exports.BASE_URL, "_skiller_defence/"),
freshStart: "".concat(exports.BASE_URL, "_fresh_start/")
};
exports.SKILLS = [
'overall',
'attack',
'defence',
'strength',
'hitpoints',
'ranged',
'prayer',
'magic',
'cooking',
'woodcutting',
'fletching',
'fishing',
'firemaking',
'crafting',
'smithing',
'mining',
'herblore',
'agility',
'thieving',
'slayer',
'farming',
'runecraft',
'hunter',
'construction',
'sailing'
];
exports.CLUES = [
'all',
'beginner',
'easy',
'medium',
'hard',
'elite',
'master'
];
exports.BH_MODES = ['hunterV2', 'rogueV2', 'hunter', 'rogue'];
exports.GAMEMODES = [
'main',
'ironman',
'hardcore',
'ultimate',
'deadman',
'seasonal',
'tournament',
'skiller',
'oneDefence',
'freshStart'
];
exports.BOSSES = [
'abyssalSire',
'alchemicalHydra',
'amoxliatl',
'araxxor',
'artio',
'barrows',
'brutus',
'bryophyta',
'callisto',
'calvarion',
'cerberus',
'chambersOfXeric',
'chambersOfXericChallengeMode',
'chaosElemental',
'chaosFanatic',
'commanderZilyana',
'corporealBeast',
'crazyArchaeologist',
'dagannothPrime',
'dagannothRex',
'dagannothSupreme',
'derangedArchaeologist',
'doomOfMokhaiotl',
'dukeSucellus',
'generalGraardor',
'giantMole',
'grotesqueGuardians',
'hespori',
'kalphiteQueen',
'kingBlackDragon',
'kraken',
'kreeArra',
'krilTsutsaroth',
'lunarChests',
'mimic',
'nex',
'nightmare',
'phosanisNightmare',
'obor',
'phantomMuspah',
'sarachnis',
'scorpia',
'scurrius',
'shellbaneGryphon',
'skotizo',
'solHeredit',
'spindel',
'tempoross',
'gauntlet',
'corruptedGauntlet',
'hueycoatl',
'leviathan',
'royalTitans',
'whisperer',
'theatreOfBlood',
'theatreOfBloodHardMode',
'thermonuclearSmokeDevil',
'tombsOfAmascut',
'tombsOfAmascutExpertMode',
'tzKalZuk',
'tzTokJad',
'vardorvis',
'venenatis',
'vetion',
'vorkath',
'wintertodt',
'yama',
'zalcano',
'zulrah'
];
exports.ACTIVITIES = __spreadArray([
'leaguePoints',
'deadmanPoints',
'hunterBHV2',
'rogueBHV2',
'hunterBH',
'rogueBH',
'allClues',
'beginnerClues',
'easyClues',
'mediumClues',
'hardClues',
'eliteClues',
'masterClues',
'lastManStanding',
'pvpArena',
'soulWarsZeal',
'riftsClosed',
'colosseumGlory',
'collectionsLogged'
], exports.BOSSES, true);
exports.FORMATTED_BOSS_NAMES = {
abyssalSire: 'Abyssal Sire',
alchemicalHydra: 'Alchemical Hydra',
amoxliatl: 'Amoxliatl',
araxxor: 'Araxxor',
artio: 'Artio',
barrows: 'Barrows Chests',
brutus: 'Brutus',
bryophyta: 'Bryophyta',
callisto: 'Callisto',
calvarion: "Calvar'ion",
cerberus: 'Cerberus',
chambersOfXeric: 'Chambers of Xeric',
chambersOfXericChallengeMode: 'Chambers of Xeric: Challenge Mode',
chaosElemental: 'Chaos Elemental',
chaosFanatic: 'Chaos Fanatic',
commanderZilyana: 'Commander Zilyana',
corporealBeast: 'Corporeal Beast',
crazyArchaeologist: 'Crazy Archaeologist',
dagannothPrime: 'Dagannoth Prime',
dagannothRex: 'Dagannoth Rex',
dagannothSupreme: 'Dagannoth Supreme',
derangedArchaeologist: 'Deranged Archaeologist',
doomOfMokhaiotl: 'Doom of Mokhaiotl',
dukeSucellus: 'Duke Sucellus',
generalGraardor: 'General Graardor',
giantMole: 'Giant Mole',
grotesqueGuardians: 'Grotesque Guardians',
hespori: 'Hespori',
kalphiteQueen: 'Kalphite Queen',
kingBlackDragon: 'King Black Dragon',
kraken: 'Kraken',
kreeArra: "Kree'Arra",
krilTsutsaroth: "K'ril Tsutsaroth",
lunarChests: 'Lunar Chests',
mimic: 'Mimic',
nex: 'Nex',
nightmare: 'Nightmare',
phosanisNightmare: "Phosani's Nightmare",
obor: 'Obor',
phantomMuspah: 'Phantom Muspah',
sarachnis: 'Sarachnis',
scorpia: 'Scorpia',
scurrius: 'Scurrius',
shellbaneGryphon: 'Shellbane Gryphon',
skotizo: 'Skotizo',
solHeredit: 'Sol Heredit',
spindel: 'Spindel',
tempoross: 'Tempoross',
gauntlet: 'The Gauntlet',
corruptedGauntlet: 'The Corrupted Gauntlet',
hueycoatl: 'The Hueycoatl',
leviathan: 'The Leviathan',
royalTitans: 'The Royal Titans',
whisperer: 'The Whisperer',
theatreOfBlood: 'Theatre of Blood',
theatreOfBloodHardMode: 'Theatre of Blood: Hard Mode',
thermonuclearSmokeDevil: 'Thermonuclear Smoke Devil',
tombsOfAmascut: 'Tombs of Amascut',
tombsOfAmascutExpertMode: 'Tombs of Amascut: Expert Mode',
tzKalZuk: 'TzKal-Zuk',
tzTokJad: 'TzTok-Jad',
vardorvis: 'Vardorvis',
venenatis: 'Venenatis',
vetion: "Vet'ion",
vorkath: 'Vorkath',
wintertodt: 'Wintertodt',
yama: 'Yama',
zalcano: 'Zalcano',
zulrah: 'Zulrah'
};
exports.FORMATTED_SKILL_NAMES = {
overall: 'Overall',
attack: 'Attack',
defence: 'Defence',
strength: 'Strength',
hitpoints: 'Hitpoints',
ranged: 'Ranged',
prayer: 'Prayer',
magic: 'Magic',
cooking: 'Cooking',
woodcutting: 'Woodcutting',
fletching: 'Fletching',
fishing: 'Fishing',
firemaking: 'Firemaking',
crafting: 'Crafting',
smithing: 'Smithing',
mining: 'Mining',
herblore: 'Herblore',
agility: 'Agility',
thieving: 'Thieving',
slayer: 'Slayer',
farming: 'Farming',
runecraft: 'Runecraft',
hunter: 'Hunter',
construction: 'Construction',
sailing: 'Sailing'
};
exports.FORMATTED_CLUE_NAMES = {
all: 'Clue Scrolls (all)',
beginner: 'Clue Scrolls (beginner)',
easy: 'Clue Scrolls (easy)',
medium: 'Clue Scrolls (medium)',
hard: 'Clue Scrolls (hard)',
elite: 'Clue Scrolls (elite)',
master: 'Clue Scrolls (master)'
};
exports.FORMATTED_BH_NAMES = {
rogue: 'Bounty Hunter (Legacy) - Rogue',
hunter: 'Bounty Hunter (Legacy) - Hunter',
rogueV2: 'Bounty Hunter - Rogue',
hunterV2: 'Bounty Hunter - Hunter'
};
exports.FORMATTED_LMS = 'LMS - Rank';
exports.FORMATTED_PVP_ARENA = 'PvP Arena - Rank';
exports.FORMATTED_SOUL_WARS = 'Soul Wars Zeal';
exports.FORMATTED_LEAGUE_POINTS = 'League Points';
exports.FORMATTED_DEADMAN_POINTS = 'Deadman Points';
exports.FORMATTED_RIFTS_CLOSED = 'Rifts closed';
exports.FORMATTED_COLOSSEUM_GLORY = 'Colosseum Glory';
exports.FORMATTED_COLLECTIONS_LOGGED = 'Collections Logged';
exports.INVALID_FORMAT_ERROR = 'Invalid hiscores format';
exports.PLAYER_NOT_FOUND_ERROR = 'Player not found';
exports.HISCORES_ERROR = 'HiScores not responding';
var InvalidFormatError = /** @class */ (function (_super) {
__extends(InvalidFormatError, _super);
function InvalidFormatError() {
var _this = _super.call(this, exports.INVALID_FORMAT_ERROR) || this;
_this.__proto__ = Error;
Object.setPrototypeOf(_this, InvalidFormatError.prototype);
return _this;
}
return InvalidFormatError;
}(Error));
exports.InvalidFormatError = InvalidFormatError;
var InvalidRSNError = /** @class */ (function (_super) {
__extends(InvalidRSNError, _super);
function InvalidRSNError(message) {
var _this = _super.call(this, message) || this;
_this.__proto__ = Error;
Object.setPrototypeOf(_this, InvalidRSNError.prototype);
return _this;
}
return InvalidRSNError;
}(Error));
exports.InvalidRSNError = InvalidRSNError;
var PlayerNotFoundError = /** @class */ (function (_super) {
__extends(PlayerNotFoundError, _super);
function PlayerNotFoundError() {
var _this = _super.call(this, exports.PLAYER_NOT_FOUND_ERROR) || this;
_this.__proto__ = Error;
Object.setPrototypeOf(_this, PlayerNotFoundError.prototype);
return _this;
}
return PlayerNotFoundError;
}(Error));
exports.PlayerNotFoundError = PlayerNotFoundError;
var HiScoresError = /** @class */ (function (_super) {
__extends(HiScoresError, _super);
function HiScoresError() {
var _this = _super.call(this, exports.HISCORES_ERROR) || this;
_this.__proto__ = Error;
Object.setPrototypeOf(_this, HiScoresError.prototype);
return _this;
}
return HiScoresError;
}(Error));
exports.HiScoresError = HiScoresError;