osrs-json-hiscores 2.25.0 → 2.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +240 -238
- package/lib/src/hiscores.d.ts +64 -0
- package/lib/src/hiscores.js +502 -0
- package/lib/src/index.d.ts +5 -0
- package/lib/src/index.js +43 -0
- package/lib/src/types.d.ts +116 -0
- package/lib/src/types.js +2 -0
- package/lib/src/utils/constants.d.ts +65 -0
- package/lib/src/utils/constants.js +356 -0
- package/lib/src/utils/helpers.d.ts +64 -0
- package/lib/src/utils/helpers.js +157 -0
- package/lib/src/utils/index.d.ts +2 -0
- package/lib/src/utils/index.js +18 -0
- package/lib/utils/constants.d.ts +2 -2
- package/lib/utils/constants.js +4 -0
- package/package.json +119 -119
package/README.md
CHANGED
|
@@ -1,238 +1,240 @@
|
|
|
1
|
-
# OSRS .json Hiscores
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/osrs-json-hiscores)
|
|
4
|
-
[](https://npm-stat.com/charts.html?package=osrs-json-hiscores)
|
|
5
|
-
[](https://github.com/maxswa/osrs-json-hiscores/blob/master/src/types.ts)
|
|
6
|
-
[](https://github.com/maxswa/osrs-json-hiscores/actions/workflows/main.yml?query=branch%3Amain)
|
|
7
|
-
|
|
8
|
-
**The Old School RuneScape API wrapper that does more!**
|
|
9
|
-
|
|
10
|
-
## What it does
|
|
11
|
-
|
|
12
|
-
The official hiscores API for Old School RuneScape (OSRS) can return CSV or a simple JSON array.
|
|
13
|
-
This wrapper converts the hiscores data into a more usable JSON object and provides extra information about the given player. By comparing player info it infers the player's game mode, as well as any previous modes (de-ultimated, de-ironed and/or died as a hardcore ironman).
|
|
14
|
-
|
|
15
|
-
Additional functions are provided that screen-scrape the OSRS leaderboards and return a list of players as json. Also simple utility functions are provided to fetch the raw responses from Jagex's APIs, if desired.
|
|
16
|
-
|
|
17
|
-
`osrs-json-hiscores` has TypeScript support, with full definitions for all functions and custom data types.
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
### ⚠ Disclaimer ⚠
|
|
22
|
-
|
|
23
|
-
Jagex does not provide `Access-Control-Allow-Origin` headers in their responses. This means that [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) will block all browser requests to their hiscores API. In order to get around this, osrs-json-hiscores needs to be installed on the server side and exposed to the front end via a simple API. Here is an example of this in use: [codesandbox.io/s/osrs-json-hiscores-demo](https://codesandbox.io/s/osrs-json-hiscores-demo-qz656)
|
|
24
|
-
|
|
25
|
-
TLDR: You cannot use this library directly in your client side app e.g. React or Vue, you must set up a server which uses this lib internally and have your client fetch data from your server.
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
## Installation
|
|
30
|
-
|
|
31
|
-
With npm:
|
|
32
|
-
|
|
33
|
-
```
|
|
34
|
-
$ npm install osrs-json-hiscores
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
With Yarn:
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
$ yarn add osrs-json-hiscores
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## How to use
|
|
44
|
-
|
|
45
|
-
Install the package and then import it into your project:
|
|
46
|
-
|
|
47
|
-
```typescript
|
|
48
|
-
import { getStatsByGamemode, getSkillPage } from 'osrs-json-hiscores';
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Once you import it you can call the functions asynchronously:
|
|
52
|
-
|
|
53
|
-
```typescript
|
|
54
|
-
const stats = await getStatsByGamemode('Lynx Titan');
|
|
55
|
-
const topPage = await getSkillPage('overall');
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
`getStats` will return a full player object with gamemode.
|
|
59
|
-
`getStatsByGameMode` will return a stats object and accepts a gamemode parameter:
|
|
60
|
-
|
|
61
|
-
| Game mode | Param |
|
|
62
|
-
| ---------------- | :----------: |
|
|
63
|
-
| Regular | `main` |
|
|
64
|
-
| Ironman | `ironman` |
|
|
65
|
-
| Hardcore Ironman | `hardcore` |
|
|
66
|
-
| Ultimate Ironman | `ultimate` |
|
|
67
|
-
| Deadman Mode | `deadman` |
|
|
68
|
-
| Tournament | `tournament` |
|
|
69
|
-
| Leagues | `seasonal` |
|
|
70
|
-
|
|
71
|
-
`getSkillPage` and `getActivityPage` require a skill / activity and optionally a gamemode and page:
|
|
72
|
-
|
|
73
|
-
```typescript
|
|
74
|
-
getSkillPage('attack', 'main', 1)
|
|
75
|
-
.then((res) => console.log(res))
|
|
76
|
-
.catch((err) => console.error(err));
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
Activities consist of all levels of clue scrolls as well as minigames and bosses:
|
|
80
|
-
|
|
81
|
-
### Clue Scrolls
|
|
82
|
-
|
|
83
|
-
| Type | Param |
|
|
84
|
-
| -------- | :-------------: |
|
|
85
|
-
| All | `allClues` |
|
|
86
|
-
| Beginner | `beginnerClues` |
|
|
87
|
-
| Easy | `easyClues` |
|
|
88
|
-
| Medium | `mediumClues` |
|
|
89
|
-
| Hard | `hardClues` |
|
|
90
|
-
| Elite | `eliteClues` |
|
|
91
|
-
| Master | `masterClues` |
|
|
92
|
-
|
|
93
|
-
### Minigames
|
|
94
|
-
|
|
95
|
-
| Minigame | Param |
|
|
96
|
-
| ------------------------------- | :-----------------: |
|
|
97
|
-
| Bounty Hunter (Legacy - Rogue) | `rogueBH` |
|
|
98
|
-
| Bounty Hunter (Legacy - Hunter) | `hunterBH` |
|
|
99
|
-
| Bounty Hunter (Rogue) | `rogueBHV2` |
|
|
100
|
-
| Bounty Hunter (Hunter) | `hunterBHV2` |
|
|
101
|
-
| LMS - Rank | `lastManStanding` |
|
|
102
|
-
| PvP Arena - Rank | `pvpArena` |
|
|
103
|
-
| Soul Wars Zeal | `soulWarsZeal` |
|
|
104
|
-
| Rifts closed | `riftsClosed` |
|
|
105
|
-
| Colosseum Glory | `colosseumGlory` |
|
|
106
|
-
| Collections Logged | `collectionsLogged` |
|
|
107
|
-
|
|
108
|
-
### Points
|
|
109
|
-
|
|
110
|
-
| Activity | Param |
|
|
111
|
-
| -------------- | :-------------: |
|
|
112
|
-
| League Points | `leaguePoints` |
|
|
113
|
-
| Deadman Points | `deadmanPoints` |
|
|
114
|
-
|
|
115
|
-
### Bosses
|
|
116
|
-
|
|
117
|
-
| Boss Name | Param |
|
|
118
|
-
| --------------------------------- | :----------------------------: |
|
|
119
|
-
| Abyssal Sire | `abyssalSire` |
|
|
120
|
-
| Alchemical Hydra | `alchemicalHydra` |
|
|
121
|
-
| Amoxliatl | `amoxliatl` |
|
|
122
|
-
| Araxxor | `araxxor` |
|
|
123
|
-
| Artio | `artio` |
|
|
124
|
-
| Barrows Chests | `barrows` |
|
|
125
|
-
| Brutus | `brutus` |
|
|
126
|
-
| Bryophyta | `bryophyta` |
|
|
127
|
-
| Callisto | `callisto` |
|
|
128
|
-
| Calvar'ion | `calvarion` |
|
|
129
|
-
| Cerberus | `cerberus` |
|
|
130
|
-
| Chambers Of Xeric | `chambersOfXeric` |
|
|
131
|
-
| Chambers Of Xeric: Challenge Mode | `chambersOfXericChallengeMode` |
|
|
132
|
-
| Chaos Elemental | `chaosElemental` |
|
|
133
|
-
| Chaos Fanatic | `chaosFanatic` |
|
|
134
|
-
| Commander Zilyana | `commanderZilyana` |
|
|
135
|
-
| Corporeal Beast | `corporealBeast` |
|
|
136
|
-
| Crazy Archaeologist | `crazyArchaeologist` |
|
|
137
|
-
| Dagannoth Prime | `dagannothPrime` |
|
|
138
|
-
| Dagannoth Rex | `dagannothRex` |
|
|
139
|
-
| Dagannoth Supreme | `dagannothSupreme` |
|
|
140
|
-
| Deranged Archaeologist | `derangedArchaeologist` |
|
|
141
|
-
| Doom of Mokhaiotl | `doomOfMokhaiotl` |
|
|
142
|
-
| Duke Sucellus | `dukeSucellus` |
|
|
143
|
-
| General Graardor | `generalGraardor` |
|
|
144
|
-
| Giant Mole | `giantMole` |
|
|
145
|
-
| Grotesque Guardians | `grotesqueGuardians` |
|
|
146
|
-
| Hespori | `hespori` |
|
|
147
|
-
| Kalphite Queen | `kalphiteQueen` |
|
|
148
|
-
| King Black Dragon | `kingBlackDragon` |
|
|
149
|
-
| Kraken | `kraken` |
|
|
150
|
-
| Kreearra | `kreeArra` |
|
|
151
|
-
| K'ril Tsutsaroth | `krilTsutsaroth` |
|
|
152
|
-
| Lunar Chests | `lunarChests` |
|
|
153
|
-
|
|
|
154
|
-
|
|
|
155
|
-
|
|
|
156
|
-
|
|
|
157
|
-
|
|
|
158
|
-
|
|
|
159
|
-
|
|
|
160
|
-
|
|
|
161
|
-
|
|
|
162
|
-
|
|
|
163
|
-
|
|
|
164
|
-
|
|
|
165
|
-
|
|
|
166
|
-
|
|
|
167
|
-
|
|
|
168
|
-
| The
|
|
169
|
-
| The
|
|
170
|
-
| The
|
|
171
|
-
| The
|
|
172
|
-
|
|
|
173
|
-
|
|
|
174
|
-
|
|
|
175
|
-
|
|
|
176
|
-
|
|
|
177
|
-
|
|
|
178
|
-
|
|
|
179
|
-
|
|
|
180
|
-
|
|
|
181
|
-
|
|
|
182
|
-
|
|
|
183
|
-
|
|
|
184
|
-
|
|
|
185
|
-
|
|
|
186
|
-
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
{}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
1
|
+
# OSRS .json Hiscores
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/osrs-json-hiscores)
|
|
4
|
+
[](https://npm-stat.com/charts.html?package=osrs-json-hiscores)
|
|
5
|
+
[](https://github.com/maxswa/osrs-json-hiscores/blob/master/src/types.ts)
|
|
6
|
+
[](https://github.com/maxswa/osrs-json-hiscores/actions/workflows/main.yml?query=branch%3Amain)
|
|
7
|
+
|
|
8
|
+
**The Old School RuneScape API wrapper that does more!**
|
|
9
|
+
|
|
10
|
+
## What it does
|
|
11
|
+
|
|
12
|
+
The official hiscores API for Old School RuneScape (OSRS) can return CSV or a simple JSON array.
|
|
13
|
+
This wrapper converts the hiscores data into a more usable JSON object and provides extra information about the given player. By comparing player info it infers the player's game mode, as well as any previous modes (de-ultimated, de-ironed and/or died as a hardcore ironman).
|
|
14
|
+
|
|
15
|
+
Additional functions are provided that screen-scrape the OSRS leaderboards and return a list of players as json. Also simple utility functions are provided to fetch the raw responses from Jagex's APIs, if desired.
|
|
16
|
+
|
|
17
|
+
`osrs-json-hiscores` has TypeScript support, with full definitions for all functions and custom data types.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
### ⚠ Disclaimer ⚠
|
|
22
|
+
|
|
23
|
+
Jagex does not provide `Access-Control-Allow-Origin` headers in their responses. This means that [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) will block all browser requests to their hiscores API. In order to get around this, osrs-json-hiscores needs to be installed on the server side and exposed to the front end via a simple API. Here is an example of this in use: [codesandbox.io/s/osrs-json-hiscores-demo](https://codesandbox.io/s/osrs-json-hiscores-demo-qz656)
|
|
24
|
+
|
|
25
|
+
TLDR: You cannot use this library directly in your client side app e.g. React or Vue, you must set up a server which uses this lib internally and have your client fetch data from your server.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
With npm:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
$ npm install osrs-json-hiscores
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
With Yarn:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
$ yarn add osrs-json-hiscores
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## How to use
|
|
44
|
+
|
|
45
|
+
Install the package and then import it into your project:
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import { getStatsByGamemode, getSkillPage } from 'osrs-json-hiscores';
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Once you import it you can call the functions asynchronously:
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
const stats = await getStatsByGamemode('Lynx Titan');
|
|
55
|
+
const topPage = await getSkillPage('overall');
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`getStats` will return a full player object with gamemode.
|
|
59
|
+
`getStatsByGameMode` will return a stats object and accepts a gamemode parameter:
|
|
60
|
+
|
|
61
|
+
| Game mode | Param |
|
|
62
|
+
| ---------------- | :----------: |
|
|
63
|
+
| Regular | `main` |
|
|
64
|
+
| Ironman | `ironman` |
|
|
65
|
+
| Hardcore Ironman | `hardcore` |
|
|
66
|
+
| Ultimate Ironman | `ultimate` |
|
|
67
|
+
| Deadman Mode | `deadman` |
|
|
68
|
+
| Tournament | `tournament` |
|
|
69
|
+
| Leagues | `seasonal` |
|
|
70
|
+
|
|
71
|
+
`getSkillPage` and `getActivityPage` require a skill / activity and optionally a gamemode and page:
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
getSkillPage('attack', 'main', 1)
|
|
75
|
+
.then((res) => console.log(res))
|
|
76
|
+
.catch((err) => console.error(err));
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Activities consist of all levels of clue scrolls as well as minigames and bosses:
|
|
80
|
+
|
|
81
|
+
### Clue Scrolls
|
|
82
|
+
|
|
83
|
+
| Type | Param |
|
|
84
|
+
| -------- | :-------------: |
|
|
85
|
+
| All | `allClues` |
|
|
86
|
+
| Beginner | `beginnerClues` |
|
|
87
|
+
| Easy | `easyClues` |
|
|
88
|
+
| Medium | `mediumClues` |
|
|
89
|
+
| Hard | `hardClues` |
|
|
90
|
+
| Elite | `eliteClues` |
|
|
91
|
+
| Master | `masterClues` |
|
|
92
|
+
|
|
93
|
+
### Minigames
|
|
94
|
+
|
|
95
|
+
| Minigame | Param |
|
|
96
|
+
| ------------------------------- | :-----------------: |
|
|
97
|
+
| Bounty Hunter (Legacy - Rogue) | `rogueBH` |
|
|
98
|
+
| Bounty Hunter (Legacy - Hunter) | `hunterBH` |
|
|
99
|
+
| Bounty Hunter (Rogue) | `rogueBHV2` |
|
|
100
|
+
| Bounty Hunter (Hunter) | `hunterBHV2` |
|
|
101
|
+
| LMS - Rank | `lastManStanding` |
|
|
102
|
+
| PvP Arena - Rank | `pvpArena` |
|
|
103
|
+
| Soul Wars Zeal | `soulWarsZeal` |
|
|
104
|
+
| Rifts closed | `riftsClosed` |
|
|
105
|
+
| Colosseum Glory | `colosseumGlory` |
|
|
106
|
+
| Collections Logged | `collectionsLogged` |
|
|
107
|
+
|
|
108
|
+
### Points
|
|
109
|
+
|
|
110
|
+
| Activity | Param |
|
|
111
|
+
| -------------- | :-------------: |
|
|
112
|
+
| League Points | `leaguePoints` |
|
|
113
|
+
| Deadman Points | `deadmanPoints` |
|
|
114
|
+
|
|
115
|
+
### Bosses
|
|
116
|
+
|
|
117
|
+
| Boss Name | Param |
|
|
118
|
+
| --------------------------------- | :----------------------------: |
|
|
119
|
+
| Abyssal Sire | `abyssalSire` |
|
|
120
|
+
| Alchemical Hydra | `alchemicalHydra` |
|
|
121
|
+
| Amoxliatl | `amoxliatl` |
|
|
122
|
+
| Araxxor | `araxxor` |
|
|
123
|
+
| Artio | `artio` |
|
|
124
|
+
| Barrows Chests | `barrows` |
|
|
125
|
+
| Brutus | `brutus` |
|
|
126
|
+
| Bryophyta | `bryophyta` |
|
|
127
|
+
| Callisto | `callisto` |
|
|
128
|
+
| Calvar'ion | `calvarion` |
|
|
129
|
+
| Cerberus | `cerberus` |
|
|
130
|
+
| Chambers Of Xeric | `chambersOfXeric` |
|
|
131
|
+
| Chambers Of Xeric: Challenge Mode | `chambersOfXericChallengeMode` |
|
|
132
|
+
| Chaos Elemental | `chaosElemental` |
|
|
133
|
+
| Chaos Fanatic | `chaosFanatic` |
|
|
134
|
+
| Commander Zilyana | `commanderZilyana` |
|
|
135
|
+
| Corporeal Beast | `corporealBeast` |
|
|
136
|
+
| Crazy Archaeologist | `crazyArchaeologist` |
|
|
137
|
+
| Dagannoth Prime | `dagannothPrime` |
|
|
138
|
+
| Dagannoth Rex | `dagannothRex` |
|
|
139
|
+
| Dagannoth Supreme | `dagannothSupreme` |
|
|
140
|
+
| Deranged Archaeologist | `derangedArchaeologist` |
|
|
141
|
+
| Doom of Mokhaiotl | `doomOfMokhaiotl` |
|
|
142
|
+
| Duke Sucellus | `dukeSucellus` |
|
|
143
|
+
| General Graardor | `generalGraardor` |
|
|
144
|
+
| Giant Mole | `giantMole` |
|
|
145
|
+
| Grotesque Guardians | `grotesqueGuardians` |
|
|
146
|
+
| Hespori | `hespori` |
|
|
147
|
+
| Kalphite Queen | `kalphiteQueen` |
|
|
148
|
+
| King Black Dragon | `kingBlackDragon` |
|
|
149
|
+
| Kraken | `kraken` |
|
|
150
|
+
| Kreearra | `kreeArra` |
|
|
151
|
+
| K'ril Tsutsaroth | `krilTsutsaroth` |
|
|
152
|
+
| Lunar Chests | `lunarChests` |
|
|
153
|
+
| Mad Angel | `madAngel` |
|
|
154
|
+
| Maggot King | `maggotKing` |
|
|
155
|
+
| Mimic | `mimic` |
|
|
156
|
+
| Nex | `nex` |
|
|
157
|
+
| Nightmare | `nightmare` |
|
|
158
|
+
| Phosani's Nightmare | `phosanisNightmare` |
|
|
159
|
+
| Obor | `obor` |
|
|
160
|
+
| Phantom Muspah | `phantomMuspah` |
|
|
161
|
+
| Sarachnis | `sarachnis` |
|
|
162
|
+
| Scorpia | `scorpia` |
|
|
163
|
+
| Scurrius | `scurrius` |
|
|
164
|
+
| Skotizo | `skotizo` |
|
|
165
|
+
| Sol Heredit | `solHeredit` |
|
|
166
|
+
| Spindel | `spindel` |
|
|
167
|
+
| Tempoross | `tempoross` |
|
|
168
|
+
| The Gauntlet | `gauntlet` |
|
|
169
|
+
| The Corrupted Gauntlet | `corruptedGauntlet` |
|
|
170
|
+
| The Hueycoatl | `hueycoatl` |
|
|
171
|
+
| The Leviathan | `leviathan` |
|
|
172
|
+
| The Royal Titans | `royalTitans` |
|
|
173
|
+
| The Whisperer | `whisperer` |
|
|
174
|
+
| Theatre Of Blood | `theatreOfBlood` |
|
|
175
|
+
| Theatre Of Blood: Hard Mode | `theatreOfBloodHardMode` |
|
|
176
|
+
| Thermonuclear Smoke Devil | `thermonuclearSmokeDevil` |
|
|
177
|
+
| Tombs of Amascut | `tombsOfAmascut` |
|
|
178
|
+
| Tombs of Amascut: Expert Mode | `tombsOfAmascutExpertMode` |
|
|
179
|
+
| TzKal-Zuk | `tzKalZuk` |
|
|
180
|
+
| TzTok-Jad | `tzTokJad` |
|
|
181
|
+
| Vardorvis | `vardorvis` |
|
|
182
|
+
| Venenatis | `venenatis` |
|
|
183
|
+
| Vetion | `vetion` |
|
|
184
|
+
| Vorkath | `vorkath` |
|
|
185
|
+
| Wintertodt | `wintertodt` |
|
|
186
|
+
| Yama | `yama` |
|
|
187
|
+
| Zalcano | `zalcano` |
|
|
188
|
+
| Zulrah | `zulrah` |
|
|
189
|
+
|
|
190
|
+
## What you'll get
|
|
191
|
+
|
|
192
|
+
`getStats` returns a player object that looks like this:
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
{
|
|
196
|
+
name: 'Lynx Titan',
|
|
197
|
+
mode: 'main',
|
|
198
|
+
dead: false,
|
|
199
|
+
deulted: false,
|
|
200
|
+
deironed: false,
|
|
201
|
+
main: {
|
|
202
|
+
skills: {
|
|
203
|
+
overall: {rank: 1, level: 2277, xp: 4600000000},
|
|
204
|
+
attack: {},
|
|
205
|
+
defence: {},
|
|
206
|
+
// ...
|
|
207
|
+
},
|
|
208
|
+
clues: {},
|
|
209
|
+
leaguePoints: {},
|
|
210
|
+
bountyHunter: {},
|
|
211
|
+
lastManStanding: {},
|
|
212
|
+
pvpArena: {},
|
|
213
|
+
soulWarsZeal: {},
|
|
214
|
+
riftsClosed: {},
|
|
215
|
+
colosseumGlory: {},
|
|
216
|
+
collectionsLogged: {},
|
|
217
|
+
bosses: {}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
`getSkillPage` returns and array of 25 players (This represents a page on the hiscores):
|
|
223
|
+
|
|
224
|
+
```typescript
|
|
225
|
+
[
|
|
226
|
+
{ rank: 1, name: 'Lynx Titan', level: 2277, xp: 4600000000, dead: false },
|
|
227
|
+
{},
|
|
228
|
+
{}
|
|
229
|
+
// ...
|
|
230
|
+
];
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## Helpful Extras
|
|
234
|
+
|
|
235
|
+
Get the properly formatted name of any skill, boss, clue or other activity:
|
|
236
|
+
|
|
237
|
+
```typescript
|
|
238
|
+
// kril === "K'ril Tsutsaroth"
|
|
239
|
+
const kril = FORMATTED_BOSS_NAMES['krilTsutsaroth'];
|
|
240
|
+
```
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
import { Player, Stats, PlayerSkillRow, PlayerActivityRow, GetStatsOptions, HiscoresResponse } from './types';
|
|
3
|
+
import { Gamemode, SkillName, ActivityName } from './utils';
|
|
4
|
+
/**
|
|
5
|
+
* Gets a player's stats from the official OSRS JSON endpoint.
|
|
6
|
+
*
|
|
7
|
+
* @param rsn Username of the player.
|
|
8
|
+
* @param mode Gamemode to fetch ranks for.
|
|
9
|
+
* @param config Optional axios request config object.
|
|
10
|
+
* @returns Official JSON stats object.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getOfficialStats(rsn: string, mode?: Gamemode, config?: AxiosRequestConfig): Promise<HiscoresResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* Screen scrapes the hiscores to get the formatted rsn of a player.
|
|
15
|
+
*
|
|
16
|
+
* @param rsn Username of the player.
|
|
17
|
+
* @param config Optional axios request config object.
|
|
18
|
+
* @returns Formatted version of the rsn.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getRSNFormat(rsn: string, config?: AxiosRequestConfig, mode?: Gamemode): Promise<string>;
|
|
21
|
+
/**
|
|
22
|
+
* Parses official JSON object of raw stats and returns a stats object.
|
|
23
|
+
*
|
|
24
|
+
* @param csv Raw JSON from the official OSRS API.
|
|
25
|
+
* @returns Parsed stats object.
|
|
26
|
+
*/
|
|
27
|
+
export declare function parseJsonStats(json: HiscoresResponse): Stats;
|
|
28
|
+
/**
|
|
29
|
+
* Parses CSV string of raw stats and returns a stats object.
|
|
30
|
+
*
|
|
31
|
+
* @param csv Raw CSV from the official OSRS API.
|
|
32
|
+
* @returns Parsed stats object.
|
|
33
|
+
*/
|
|
34
|
+
export declare function parseStats(csv: string): Stats;
|
|
35
|
+
/**
|
|
36
|
+
* Fetches stats from the OSRS API and consolidates the info into a player object.
|
|
37
|
+
*
|
|
38
|
+
* **Note:** This function will make up to 5 separate network requests.
|
|
39
|
+
* As such, it is highly subject to the performance of the official OSRS API.
|
|
40
|
+
*
|
|
41
|
+
* @param rsn Username of the player.
|
|
42
|
+
* @returns Player object.
|
|
43
|
+
*/
|
|
44
|
+
export declare function getStats(rsn: string, options?: GetStatsOptions): Promise<Player>;
|
|
45
|
+
/**
|
|
46
|
+
* Fetches stats from the OSRS API and returns them as an object.
|
|
47
|
+
*
|
|
48
|
+
* @param rsn Username of the player.
|
|
49
|
+
* @param mode Gamemode to fetch ranks for.
|
|
50
|
+
* @param config Optional axios request config object.
|
|
51
|
+
* @returns Stats object.
|
|
52
|
+
*/
|
|
53
|
+
export declare function getStatsByGamemode(rsn: string, mode?: Gamemode, config?: AxiosRequestConfig): Promise<Stats>;
|
|
54
|
+
export declare function getSkillPage(skill: SkillName, mode?: Gamemode, page?: number, config?: AxiosRequestConfig): Promise<PlayerSkillRow[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Screen scrapes a hiscores page of an activity or boss and returns an array of up to 25 players.
|
|
57
|
+
*
|
|
58
|
+
* @param activity Name of the activity or boss to fetch hiscores for.
|
|
59
|
+
* @param mode Gamemode to fetch ranks for.
|
|
60
|
+
* @param page Page number.
|
|
61
|
+
* @param config Optional axios request config object.
|
|
62
|
+
* @returns Array of `PlayerActivityRow` objects.
|
|
63
|
+
*/
|
|
64
|
+
export declare function getActivityPage(activity: ActivityName, mode?: Gamemode, page?: number, config?: AxiosRequestConfig): Promise<PlayerActivityRow[]>;
|