osrs-json-hiscores 2.14.2 → 2.16.0

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -110,10 +110,10 @@ Activities consist of all levels of clue scrolls as well as minigames and bosses
110
110
  | Bounty Hunter (Legacy - Hunter) | `hunterBH` |
111
111
  | Bounty Hunter (Rogue) | `rogueBHV2` |
112
112
  | Bounty Hunter (Hunter) | `hunterBHV2` |
113
- | Last Man Standing | `lastManStanding` |
114
- | PvP Arena | `pvpArena` |
113
+ | LMS - Rank | `lastManStanding` |
114
+ | PvP Arena - Rank | `pvpArena` |
115
115
  | Soul Wars Zeal | `soulWarsZeal` |
116
- | Rifts Closed | `riftsClosed` |
116
+ | Rifts closed | `riftsClosed` |
117
117
 
118
118
  ### Leagues
119
119
 
@@ -144,6 +144,7 @@ Activities consist of all levels of clue scrolls as well as minigames and bosses
144
144
  | Dagannoth Rex | `dagannothRex` |
145
145
  | Dagannoth Supreme | `dagannothSupreme` |
146
146
  | Deranged Archaeologist | `derangedArchaeologist` |
147
+ | Duke Sucellus | `dukeSucellus` |
147
148
  | General Graardor | `generalGraardor` |
148
149
  | Giant Mole | `giantMole` |
149
150
  | Grotesque Guardians | `grotesqueGuardians` |
@@ -155,7 +156,7 @@ Activities consist of all levels of clue scrolls as well as minigames and bosses
155
156
  | K'ril Tsutsaroth | `krilTsutsaroth` |
156
157
  | Mimic | `mimic` |
157
158
  | Nex | `nex` |
158
- | The Nightmare of Ashihama | `nightmare` |
159
+ | Nightmare | `nightmare` |
159
160
  | Phosani's Nightmare | `phosanisNightmare` |
160
161
  | Obor | `obor` |
161
162
  | Phantom Muspah | `phantomMuspah` |
@@ -166,6 +167,8 @@ Activities consist of all levels of clue scrolls as well as minigames and bosses
166
167
  | Tempoross | `tempoross` |
167
168
  | The Gauntlet | `gauntlet` |
168
169
  | The Corrupted Gauntlet | `corruptedGauntlet` |
170
+ | The Leviathan | `leviathan` |
171
+ | The Whisperer | `whisperer` |
169
172
  | Theatre Of Blood | `theatreOfBlood` |
170
173
  | Theatre Of Blood: Hard Mode | `theatreOfBloodHardMode` |
171
174
  | Thermonuclear Smoke Devil | `thermonuclearSmokeDevil` |
@@ -173,6 +176,7 @@ Activities consist of all levels of clue scrolls as well as minigames and bosses
173
176
  | Tombs of Amascut: Expert Mode | `tombsOfAmascutExpertMode` |
174
177
  | TzKal-Zuk | `tzKalZuk` |
175
178
  | TzTok-Jad | `tzTokJad` |
179
+ | Vardorvis | `vardorvis` |
176
180
  | Venenatis | `venenatis` |
177
181
  | Vetion | `vetion` |
178
182
  | Vorkath | `vorkath` |
package/lib/hiscores.d.ts CHANGED
@@ -1,5 +1,14 @@
1
1
  import { AxiosRequestConfig } from 'axios';
2
- import { Player, Stats, Gamemode, SkillName, PlayerSkillRow, ActivityName, PlayerActivityRow, GetStatsOptions } from './types';
2
+ import { Player, Stats, Gamemode, SkillName, PlayerSkillRow, ActivityName, PlayerActivityRow, GetStatsOptions, HiscoresResponse } from './types';
3
+ /**
4
+ * Gets a player's stats from the official OSRS JSON endpoint.
5
+ *
6
+ * @param rsn Username of the player.
7
+ * @param mode Gamemode to fetch ranks for.
8
+ * @param config Optional axios request config object.
9
+ * @returns Official JSON stats object.
10
+ */
11
+ export declare function getOfficialStats(rsn: string, mode?: Gamemode, config?: AxiosRequestConfig): Promise<HiscoresResponse>;
3
12
  /**
4
13
  * Screen scrapes the hiscores to get the formatted rsn of a player.
5
14
  *
@@ -8,6 +17,13 @@ import { Player, Stats, Gamemode, SkillName, PlayerSkillRow, ActivityName, Playe
8
17
  * @returns Formatted version of the rsn.
9
18
  */
10
19
  export declare function getRSNFormat(rsn: string, config?: AxiosRequestConfig): Promise<string>;
20
+ /**
21
+ * Parses official JSON object of raw stats and returns a stats object.
22
+ *
23
+ * @param csv Raw JSON from the official OSRS API.
24
+ * @returns Parsed stats object.
25
+ */
26
+ export declare function parseJsonStats(json: HiscoresResponse): Stats;
11
27
  /**
12
28
  * Parses CSV string of raw stats and returns a stats object.
13
29
  *
package/lib/hiscores.js CHANGED
@@ -47,9 +47,42 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
47
47
  }
48
48
  };
49
49
  Object.defineProperty(exports, "__esModule", { value: true });
50
- exports.getActivityPage = exports.getSkillPage = exports.getStatsByGamemode = exports.getStats = exports.parseStats = exports.getRSNFormat = void 0;
50
+ exports.getActivityPage = exports.getSkillPage = exports.getStatsByGamemode = exports.getStats = exports.parseStats = exports.parseJsonStats = exports.getRSNFormat = exports.getOfficialStats = void 0;
51
51
  var jsdom_1 = require("jsdom");
52
52
  var utils_1 = require("./utils");
53
+ /**
54
+ * Gets a player's stats from the official OSRS JSON endpoint.
55
+ *
56
+ * @param rsn Username of the player.
57
+ * @param mode Gamemode to fetch ranks for.
58
+ * @param config Optional axios request config object.
59
+ * @returns Official JSON stats object.
60
+ */
61
+ function getOfficialStats(rsn, mode, config) {
62
+ if (mode === void 0) { mode = 'main'; }
63
+ return __awaiter(this, void 0, void 0, function () {
64
+ var url, response, _a;
65
+ return __generator(this, function (_b) {
66
+ switch (_b.label) {
67
+ case 0:
68
+ (0, utils_1.validateRSN)(rsn);
69
+ url = (0, utils_1.getStatsURL)(mode, rsn, true);
70
+ _b.label = 1;
71
+ case 1:
72
+ _b.trys.push([1, 3, , 4]);
73
+ return [4 /*yield*/, (0, utils_1.httpGet)(url, config)];
74
+ case 2:
75
+ response = _b.sent();
76
+ return [2 /*return*/, response.data];
77
+ case 3:
78
+ _a = _b.sent();
79
+ throw Error(utils_1.PLAYER_NOT_FOUND_ERROR);
80
+ case 4: return [2 /*return*/];
81
+ }
82
+ });
83
+ });
84
+ }
85
+ exports.getOfficialStats = getOfficialStats;
53
86
  /**
54
87
  * Screen scrapes the hiscores to get the formatted rsn of a player.
55
88
  *
@@ -76,16 +109,79 @@ function getRSNFormat(rsn, config) {
76
109
  if (anchor) {
77
110
  return [2 /*return*/, (0, utils_1.rsnFromElement)(anchor)];
78
111
  }
79
- throw Error('Player not found');
112
+ throw Error(utils_1.PLAYER_NOT_FOUND_ERROR);
80
113
  case 3:
81
114
  _a = _b.sent();
82
- throw Error('Player not found');
115
+ throw Error(utils_1.PLAYER_NOT_FOUND_ERROR);
83
116
  case 4: return [2 /*return*/];
84
117
  }
85
118
  });
86
119
  });
87
120
  }
88
121
  exports.getRSNFormat = getRSNFormat;
122
+ /**
123
+ * Parses official JSON object of raw stats and returns a stats object.
124
+ *
125
+ * @param csv Raw JSON from the official OSRS API.
126
+ * @returns Parsed stats object.
127
+ */
128
+ function parseJsonStats(json) {
129
+ var getActivity = function (formattedName) {
130
+ var _a, _b;
131
+ var hiscoresActivity = json.activities.find(
132
+ // We must match on name here since id is not guaranteed to be the same between updates
133
+ function (_a) {
134
+ var name = _a.name;
135
+ return name.toLowerCase() === formattedName.toLowerCase();
136
+ });
137
+ return {
138
+ rank: (_a = hiscoresActivity === null || hiscoresActivity === void 0 ? void 0 : hiscoresActivity.rank) !== null && _a !== void 0 ? _a : -1,
139
+ score: (_b = hiscoresActivity === null || hiscoresActivity === void 0 ? void 0 : hiscoresActivity.score) !== null && _b !== void 0 ? _b : -1
140
+ };
141
+ };
142
+ var reduceActivity = function (keys, formattedNames) {
143
+ return keys.reduce(function (reducer, key) {
144
+ var _a;
145
+ return (__assign(__assign({}, reducer), (_a = {}, _a[key] = getActivity(formattedNames[key]), _a)));
146
+ }, {});
147
+ };
148
+ var skills = utils_1.SKILLS.reduce(function (skillsObject, skillName) {
149
+ var _a;
150
+ var _b, _c, _d;
151
+ var hiscoresSkill = json.skills.find(
152
+ // We must match on name here since id is not guaranteed to be the same between updates
153
+ function (_a) {
154
+ var name = _a.name;
155
+ return name.toLowerCase() === utils_1.FORMATTED_SKILL_NAMES[skillName].toLowerCase();
156
+ });
157
+ return __assign(__assign({}, skillsObject), (_a = {}, _a[skillName] = {
158
+ rank: (_b = hiscoresSkill === null || hiscoresSkill === void 0 ? void 0 : hiscoresSkill.rank) !== null && _b !== void 0 ? _b : -1,
159
+ level: (_c = hiscoresSkill === null || hiscoresSkill === void 0 ? void 0 : hiscoresSkill.level) !== null && _c !== void 0 ? _c : -1,
160
+ xp: (_d = hiscoresSkill === null || hiscoresSkill === void 0 ? void 0 : hiscoresSkill.xp) !== null && _d !== void 0 ? _d : -1
161
+ }, _a));
162
+ }, {});
163
+ var bountyHunter = reduceActivity(utils_1.BH_MODES, utils_1.FORMATTED_BH_NAMES);
164
+ var clues = reduceActivity(utils_1.CLUES, utils_1.FORMATTED_CLUE_NAMES);
165
+ var bosses = reduceActivity(utils_1.BOSSES, utils_1.FORMATTED_BOSS_NAMES);
166
+ var leaguePoints = getActivity(utils_1.FORMATTED_LEAGUE_POINTS);
167
+ var lastManStanding = getActivity(utils_1.FORMATTED_LMS);
168
+ var pvpArena = getActivity(utils_1.FORMATTED_PVP_ARENA);
169
+ var soulWarsZeal = getActivity(utils_1.FORMATTED_SOUL_WARS);
170
+ var riftsClosed = getActivity(utils_1.FORMATTED_RIFTS_CLOSED);
171
+ var stats = {
172
+ skills: skills,
173
+ leaguePoints: leaguePoints,
174
+ bountyHunter: bountyHunter,
175
+ lastManStanding: lastManStanding,
176
+ pvpArena: pvpArena,
177
+ soulWarsZeal: soulWarsZeal,
178
+ riftsClosed: riftsClosed,
179
+ clues: clues,
180
+ bosses: bosses
181
+ };
182
+ return stats;
183
+ }
184
+ exports.parseJsonStats = parseJsonStats;
89
185
  /**
90
186
  * Parses CSV string of raw stats and returns a stats object.
91
187
  *
@@ -185,13 +281,13 @@ function getStats(rsn, options) {
185
281
  'ultimate'
186
282
  ];
187
283
  shouldGetFormattedRsn = (_b = options === null || options === void 0 ? void 0 : options.shouldGetFormattedRsn) !== null && _b !== void 0 ? _b : true;
188
- return [4 /*yield*/, (0, utils_1.httpGet)((0, utils_1.getStatsURL)('main', rsn), (_c = options === null || options === void 0 ? void 0 : options.axiosConfigs) === null || _c === void 0 ? void 0 : _c.main)];
284
+ return [4 /*yield*/, (0, utils_1.httpGet)((0, utils_1.getStatsURL)('main', rsn, true), (_c = options === null || options === void 0 ? void 0 : options.axiosConfigs) === null || _c === void 0 ? void 0 : _c.main)];
189
285
  case 1:
190
286
  mainRes = _f.sent();
191
287
  if (!(mainRes.status === 200)) return [3 /*break*/, 9];
192
288
  emptyResponse_1 = {
193
289
  status: 404,
194
- data: '',
290
+ data: { skills: [], activities: [] },
195
291
  statusText: '',
196
292
  headers: {},
197
293
  config: {}
@@ -200,7 +296,7 @@ function getStats(rsn, options) {
200
296
  var _a;
201
297
  return __generator(this, function (_b) {
202
298
  return [2 /*return*/, otherGamemodes.includes(mode)
203
- ? (0, utils_1.httpGet)((0, utils_1.getStatsURL)(mode, rsn), (_a = options === null || options === void 0 ? void 0 : options.axiosConfigs) === null || _a === void 0 ? void 0 : _a[mode]).catch(function (err) { return err; })
299
+ ? (0, utils_1.httpGet)((0, utils_1.getStatsURL)(mode, rsn, true), (_a = options === null || options === void 0 ? void 0 : options.axiosConfigs) === null || _a === void 0 ? void 0 : _a[mode]).catch(function (err) { return err; })
204
300
  : emptyResponse_1];
205
301
  });
206
302
  }); };
@@ -221,12 +317,12 @@ function getStats(rsn, options) {
221
317
  deulted: false,
222
318
  deironed: false
223
319
  };
224
- player.main = parseStats(mainRes.data);
320
+ player.main = parseJsonStats(mainRes.data);
225
321
  return [4 /*yield*/, getModeStats('ironman')];
226
322
  case 5:
227
323
  ironRes = _f.sent();
228
324
  if (!(ironRes.status === 200)) return [3 /*break*/, 8];
229
- player.ironman = parseStats(ironRes.data);
325
+ player.ironman = parseJsonStats(ironRes.data);
230
326
  return [4 /*yield*/, getModeStats('hardcore')];
231
327
  case 6:
232
328
  hcRes = _f.sent();
@@ -235,7 +331,7 @@ function getStats(rsn, options) {
235
331
  ultRes = _f.sent();
236
332
  if (hcRes.status === 200) {
237
333
  player.mode = 'hardcore';
238
- player.hardcore = parseStats(hcRes.data);
334
+ player.hardcore = parseJsonStats(hcRes.data);
239
335
  if (player.ironman.skills.overall.xp !== player.hardcore.skills.overall.xp) {
240
336
  player.dead = true;
241
337
  player.mode = 'ironman';
@@ -247,7 +343,7 @@ function getStats(rsn, options) {
247
343
  }
248
344
  else if (ultRes.status === 200) {
249
345
  player.mode = 'ultimate';
250
- player.ultimate = parseStats(ultRes.data);
346
+ player.ultimate = parseJsonStats(ultRes.data);
251
347
  if (player.ironman.skills.overall.xp !== player.ultimate.skills.overall.xp) {
252
348
  player.deulted = true;
253
349
  player.mode = 'ironman';
@@ -266,7 +362,7 @@ function getStats(rsn, options) {
266
362
  }
267
363
  _f.label = 8;
268
364
  case 8: return [2 /*return*/, player];
269
- case 9: throw Error('Player not found');
365
+ case 9: throw Error(utils_1.PLAYER_NOT_FOUND_ERROR);
270
366
  }
271
367
  });
272
368
  });
@@ -291,13 +387,10 @@ function getStatsByGamemode(rsn, mode, config) {
291
387
  if (!utils_1.GAMEMODES.includes(mode)) {
292
388
  throw Error('Invalid game mode');
293
389
  }
294
- return [4 /*yield*/, (0, utils_1.httpGet)((0, utils_1.getStatsURL)(mode, rsn), config)];
390
+ return [4 /*yield*/, getOfficialStats(rsn, mode, config)];
295
391
  case 1:
296
392
  response = _a.sent();
297
- if (response.status !== 200) {
298
- throw Error('Player not found');
299
- }
300
- stats = parseStats(response.data);
393
+ stats = parseJsonStats(response);
301
394
  return [2 /*return*/, stats];
302
395
  }
303
396
  });
package/lib/types.d.ts CHANGED
@@ -21,7 +21,7 @@ export type BHType = 'rogue' | 'hunter' | 'rogueV2' | 'hunterV2';
21
21
  export type BH = {
22
22
  [Type in BHType]: Activity;
23
23
  };
24
- export type Boss = 'abyssalSire' | 'alchemicalHydra' | 'artio' | 'barrows' | 'bryophyta' | 'callisto' | 'calvarion' | 'cerberus' | 'chambersOfXeric' | 'chambersOfXericChallengeMode' | 'chaosElemental' | 'chaosFanatic' | 'commanderZilyana' | 'corporealBeast' | 'crazyArchaeologist' | 'dagannothPrime' | 'dagannothRex' | 'dagannothSupreme' | 'derangedArchaeologist' | 'generalGraardor' | 'giantMole' | 'grotesqueGuardians' | 'hespori' | 'kalphiteQueen' | 'kingBlackDragon' | 'kraken' | 'kreeArra' | 'krilTsutsaroth' | 'mimic' | 'nex' | 'nightmare' | 'phosanisNightmare' | 'obor' | 'phantomMuspah' | 'sarachnis' | 'scorpia' | 'skotizo' | 'spindel' | 'tempoross' | 'gauntlet' | 'corruptedGauntlet' | 'theatreOfBlood' | 'theatreOfBloodHardMode' | 'thermonuclearSmokeDevil' | 'tombsOfAmascut' | 'tombsOfAmascutExpertMode' | 'tzKalZuk' | 'tzTokJad' | 'venenatis' | 'vetion' | 'vorkath' | 'wintertodt' | 'zalcano' | 'zulrah';
24
+ export type Boss = 'abyssalSire' | 'alchemicalHydra' | 'artio' | 'barrows' | 'bryophyta' | 'callisto' | 'calvarion' | 'cerberus' | 'chambersOfXeric' | 'chambersOfXericChallengeMode' | 'chaosElemental' | 'chaosFanatic' | 'commanderZilyana' | 'corporealBeast' | 'crazyArchaeologist' | 'dagannothPrime' | 'dagannothRex' | 'dagannothSupreme' | 'derangedArchaeologist' | 'dukeSucellus' | 'generalGraardor' | 'giantMole' | 'grotesqueGuardians' | 'hespori' | 'kalphiteQueen' | 'kingBlackDragon' | 'kraken' | 'kreeArra' | 'krilTsutsaroth' | 'mimic' | 'nex' | 'nightmare' | 'phosanisNightmare' | 'obor' | 'phantomMuspah' | 'sarachnis' | 'scorpia' | 'skotizo' | 'spindel' | 'tempoross' | 'gauntlet' | 'corruptedGauntlet' | 'leviathan' | 'whisperer' | 'theatreOfBlood' | 'theatreOfBloodHardMode' | 'thermonuclearSmokeDevil' | 'tombsOfAmascut' | 'tombsOfAmascutExpertMode' | 'tzKalZuk' | 'tzTokJad' | 'vardorvis' | 'venenatis' | 'vetion' | 'vorkath' | 'wintertodt' | 'zalcano' | 'zulrah';
25
25
  export type Bosses = {
26
26
  [Type in Boss]: Activity;
27
27
  };
@@ -76,3 +76,37 @@ export interface GetStatsOptions {
76
76
  rsn?: AxiosRequestConfig;
77
77
  };
78
78
  }
79
+ export interface HiscoresCommon {
80
+ /**
81
+ * This field behaves more like an index than a true unique ID.
82
+ */
83
+ id: number;
84
+ /**
85
+ * The display name of this skill / activity.
86
+ */
87
+ name: string;
88
+ /**
89
+ * The player's official hiscores rank in this skill / activity.
90
+ */
91
+ rank: number;
92
+ }
93
+ export interface HiscoresSkill extends HiscoresCommon {
94
+ /**
95
+ * The player's current level in this skill.
96
+ */
97
+ level: number;
98
+ /**
99
+ * The player's current experience in this skill.
100
+ */
101
+ xp: number;
102
+ }
103
+ export interface HiscoresActivity extends HiscoresCommon {
104
+ /**
105
+ * The player's current score in this activity.
106
+ */
107
+ score: number;
108
+ }
109
+ export interface HiscoresResponse {
110
+ skills: HiscoresSkill[];
111
+ activities: HiscoresActivity[];
112
+ }
@@ -1,6 +1,7 @@
1
1
  import { BHType, Boss, ClueType, Gamemode, SkillName, ActivityName } from '../types';
2
2
  export declare const BASE_URL = "https://secure.runescape.com/m=hiscore_oldschool";
3
3
  export declare const STATS_URL = "index_lite.ws?player=";
4
+ export declare const JSON_STATS_URL = "index_lite.json?player=";
4
5
  export declare const SCORES_URL = "overall.ws?";
5
6
  export type GamemodeUrl = {
6
7
  [key in Gamemode]: string;
@@ -28,9 +29,10 @@ export type FormattedBHNames = {
28
29
  [key in BHType]: string;
29
30
  };
30
31
  export declare const FORMATTED_BH_NAMES: FormattedBHNames;
31
- export declare const FORMATTED_LMS = "Last Man Standing";
32
- export declare const FORMATTED_PVP_ARENA = "PvP Arena";
32
+ export declare const FORMATTED_LMS = "LMS - Rank";
33
+ export declare const FORMATTED_PVP_ARENA = "PvP Arena - Rank";
33
34
  export declare const FORMATTED_SOUL_WARS = "Soul Wars Zeal";
34
35
  export declare const FORMATTED_LEAGUE_POINTS = "League Points";
35
- export declare const FORMATTED_RIFTS_CLOSED = "Rifts Closed";
36
+ export declare const FORMATTED_RIFTS_CLOSED = "Rifts closed";
36
37
  export declare const INVALID_FORMAT_ERROR = "Invalid hiscores format";
38
+ export declare const PLAYER_NOT_FOUND_ERROR = "Player not found";
@@ -9,9 +9,10 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
9
9
  return to.concat(ar || Array.prototype.slice.call(from));
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.INVALID_FORMAT_ERROR = exports.FORMATTED_RIFTS_CLOSED = 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.SCORES_URL = exports.STATS_URL = exports.BASE_URL = void 0;
12
+ exports.PLAYER_NOT_FOUND_ERROR = exports.INVALID_FORMAT_ERROR = exports.FORMATTED_RIFTS_CLOSED = 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.SCORES_URL = exports.JSON_STATS_URL = exports.STATS_URL = exports.BASE_URL = void 0;
13
13
  exports.BASE_URL = 'https://secure.runescape.com/m=hiscore_oldschool';
14
14
  exports.STATS_URL = 'index_lite.ws?player=';
15
+ exports.JSON_STATS_URL = 'index_lite.json?player=';
15
16
  exports.SCORES_URL = 'overall.ws?';
16
17
  exports.GAMEMODE_URL = {
17
18
  main: "".concat(exports.BASE_URL, "/"),
@@ -90,6 +91,7 @@ exports.BOSSES = [
90
91
  'dagannothRex',
91
92
  'dagannothSupreme',
92
93
  'derangedArchaeologist',
94
+ 'dukeSucellus',
93
95
  'generalGraardor',
94
96
  'giantMole',
95
97
  'grotesqueGuardians',
@@ -112,6 +114,8 @@ exports.BOSSES = [
112
114
  'tempoross',
113
115
  'gauntlet',
114
116
  'corruptedGauntlet',
117
+ 'leviathan',
118
+ 'whisperer',
115
119
  'theatreOfBlood',
116
120
  'theatreOfBloodHardMode',
117
121
  'thermonuclearSmokeDevil',
@@ -119,6 +123,7 @@ exports.BOSSES = [
119
123
  'tombsOfAmascutExpertMode',
120
124
  'tzKalZuk',
121
125
  'tzTokJad',
126
+ 'vardorvis',
122
127
  'venenatis',
123
128
  'vetion',
124
129
  'vorkath',
@@ -164,6 +169,7 @@ exports.FORMATTED_BOSS_NAMES = {
164
169
  dagannothRex: 'Dagannoth Rex',
165
170
  dagannothSupreme: 'Dagannoth Supreme',
166
171
  derangedArchaeologist: 'Deranged Archaeologist',
172
+ dukeSucellus: 'Duke Sucellus',
167
173
  generalGraardor: 'General Graardor',
168
174
  giantMole: 'Giant Mole',
169
175
  grotesqueGuardians: 'Grotesque Guardians',
@@ -175,7 +181,7 @@ exports.FORMATTED_BOSS_NAMES = {
175
181
  krilTsutsaroth: "K'ril Tsutsaroth",
176
182
  mimic: 'Mimic',
177
183
  nex: 'Nex',
178
- nightmare: 'The Nightmare of Ashihama',
184
+ nightmare: 'Nightmare',
179
185
  phosanisNightmare: "Phosani's Nightmare",
180
186
  obor: 'Obor',
181
187
  phantomMuspah: 'Phantom Muspah',
@@ -186,6 +192,8 @@ exports.FORMATTED_BOSS_NAMES = {
186
192
  tempoross: 'Tempoross',
187
193
  gauntlet: 'The Gauntlet',
188
194
  corruptedGauntlet: 'The Corrupted Gauntlet',
195
+ leviathan: 'The Leviathan',
196
+ whisperer: 'The Whisperer',
189
197
  theatreOfBlood: 'Theatre of Blood',
190
198
  theatreOfBloodHardMode: 'Theatre of Blood: Hard Mode',
191
199
  thermonuclearSmokeDevil: 'Thermonuclear Smoke Devil',
@@ -193,6 +201,7 @@ exports.FORMATTED_BOSS_NAMES = {
193
201
  tombsOfAmascutExpertMode: 'Tombs of Amascut: Expert Mode',
194
202
  tzKalZuk: 'TzKal-Zuk',
195
203
  tzTokJad: 'TzTok-Jad',
204
+ vardorvis: 'Vardorvis',
196
205
  venenatis: 'Venenatis',
197
206
  vetion: "Vet'ion",
198
207
  vorkath: 'Vorkath',
@@ -241,9 +250,10 @@ exports.FORMATTED_BH_NAMES = {
241
250
  rogueV2: 'Bounty Hunter - Rogue',
242
251
  hunterV2: 'Bounty Hunter - Hunter'
243
252
  };
244
- exports.FORMATTED_LMS = 'Last Man Standing';
245
- exports.FORMATTED_PVP_ARENA = 'PvP Arena';
253
+ exports.FORMATTED_LMS = 'LMS - Rank';
254
+ exports.FORMATTED_PVP_ARENA = 'PvP Arena - Rank';
246
255
  exports.FORMATTED_SOUL_WARS = 'Soul Wars Zeal';
247
256
  exports.FORMATTED_LEAGUE_POINTS = 'League Points';
248
- exports.FORMATTED_RIFTS_CLOSED = 'Rifts Closed';
257
+ exports.FORMATTED_RIFTS_CLOSED = 'Rifts closed';
249
258
  exports.INVALID_FORMAT_ERROR = 'Invalid hiscores format';
259
+ exports.PLAYER_NOT_FOUND_ERROR = 'Player not found';
@@ -5,9 +5,10 @@ import { Gamemode, SkillName, ActivityName } from '../types';
5
5
  *
6
6
  * @param gamemode Gamemode to fetch ranks for.
7
7
  * @param rsn Username of the player.
8
+ * @param json If the JSON endpoint is desired instead of CSV.
8
9
  * @returns Encoded stats URL.
9
10
  */
10
- export declare const getStatsURL: (gamemode: Gamemode, rsn: string) => string;
11
+ export declare const getStatsURL: (gamemode: Gamemode, rsn: string, json?: boolean) => string;
11
12
  /**
12
13
  * Will generate a player table URL for the official OSRS hiscores website.
13
14
  *
@@ -20,10 +20,12 @@ var constants_1 = require("./constants");
20
20
  *
21
21
  * @param gamemode Gamemode to fetch ranks for.
22
22
  * @param rsn Username of the player.
23
+ * @param json If the JSON endpoint is desired instead of CSV.
23
24
  * @returns Encoded stats URL.
24
25
  */
25
- var getStatsURL = function (gamemode, rsn) {
26
- return "".concat(constants_1.GAMEMODE_URL[gamemode]).concat(constants_1.STATS_URL).concat(encodeURIComponent(rsn));
26
+ var getStatsURL = function (gamemode, rsn, json) {
27
+ if (json === void 0) { json = false; }
28
+ return "".concat(constants_1.GAMEMODE_URL[gamemode]).concat(json ? constants_1.JSON_STATS_URL : constants_1.STATS_URL).concat(encodeURIComponent(rsn));
27
29
  };
28
30
  exports.getStatsURL = getStatsURL;
29
31
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "osrs-json-hiscores",
3
- "version": "2.14.2",
3
+ "version": "2.16.0",
4
4
  "description": "The Old School Runescape API wrapper that does more!",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",