osrs-json-hiscores 2.5.0 → 2.7.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/LICENSE +4 -4
- package/README.md +219 -217
- package/lib/hiscores.d.ts +43 -43
- package/lib/hiscores.js +387 -384
- package/lib/index.d.ts +5 -5
- package/lib/index.js +17 -17
- package/lib/types.d.ts +54 -54
- package/lib/types.js +2 -2
- package/lib/utils/constants.d.ts +34 -33
- package/lib/utils/constants.js +222 -217
- package/lib/utils/helpers.d.ts +56 -56
- package/lib/utils/helpers.js +92 -92
- package/lib/utils/index.d.ts +2 -2
- package/lib/utils/index.js +14 -14
- package/package.json +114 -114
package/LICENSE
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
Copyright 2021 maxswa
|
2
|
-
|
3
|
-
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
4
|
-
|
1
|
+
Copyright 2021 maxswa
|
2
|
+
|
3
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
4
|
+
|
5
5
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
CHANGED
@@ -1,217 +1,219 @@
|
|
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) returns CSV.
|
13
|
-
This wrapper converts it to json 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.
|
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 should 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
|
-
---
|
26
|
-
|
27
|
-
## Installation
|
28
|
-
|
29
|
-
With npm:
|
30
|
-
|
31
|
-
```
|
32
|
-
$ npm install osrs-json-hiscores
|
33
|
-
```
|
34
|
-
|
35
|
-
With Yarn:
|
36
|
-
|
37
|
-
```
|
38
|
-
$ yarn add osrs-json-hiscores
|
39
|
-
```
|
40
|
-
|
41
|
-
## How to use
|
42
|
-
|
43
|
-
Install the package and then import it into your project:
|
44
|
-
|
45
|
-
```javascript
|
46
|
-
const hiscores = require('osrs-json-hiscores');
|
47
|
-
```
|
48
|
-
|
49
|
-
Once you import it you can call the functions asynchronously:
|
50
|
-
|
51
|
-
```javascript
|
52
|
-
hiscores
|
53
|
-
.getStats('Lynx Titan')
|
54
|
-
.then((res) => console.log(res))
|
55
|
-
.catch((err) => console.error(err));
|
56
|
-
```
|
57
|
-
|
58
|
-
If you are using TypeScript or transpiling your JS you can use ES6 syntax:
|
59
|
-
|
60
|
-
```javascript
|
61
|
-
import hiscores, { getSkillPage } from 'osrs-json-hiscores';
|
62
|
-
|
63
|
-
// ...
|
64
|
-
|
65
|
-
const stats = await hiscores.getStats('Lynx Titan');
|
66
|
-
const topPage = await getSkillPage('overall');
|
67
|
-
```
|
68
|
-
|
69
|
-
`getStats` will return a full player object with gamemode.
|
70
|
-
`getStatsByGameMode` will return a stats object and accepts a gamemode parameter:
|
71
|
-
|
72
|
-
| Game mode | Param |
|
73
|
-
| ---------------- | :----------: |
|
74
|
-
| Regular | `main` |
|
75
|
-
| Ironman | `ironman` |
|
76
|
-
| Hardcore Ironman | `hardcore` |
|
77
|
-
| Ultimate Ironman | `ultimate` |
|
78
|
-
| Deadman Mode | `deadman` |
|
79
|
-
| Tournament | `tournament` |
|
80
|
-
| Leagues | `seasonal` |
|
81
|
-
|
82
|
-
`getSkillPage` and `getActivityPage` require a skill / activity and optionally a gamemode and page:
|
83
|
-
|
84
|
-
```javascript
|
85
|
-
hiscores
|
86
|
-
.getSkillPage('attack', 'main', 1)
|
87
|
-
.then((res) => console.log(res))
|
88
|
-
.catch((err) => console.error(err));
|
89
|
-
```
|
90
|
-
|
91
|
-
Activities consist of all levels of clue scrolls as well as minigames and bosses:
|
92
|
-
|
93
|
-
### Clue Scrolls
|
94
|
-
|
95
|
-
| Type | Param |
|
96
|
-
| -------- | :-------------: |
|
97
|
-
| All | `allClues` |
|
98
|
-
| Beginner | `beginnerClues` |
|
99
|
-
| Easy | `easyClues` |
|
100
|
-
| Medium | `mediumClues` |
|
101
|
-
| Hard | `hardClues` |
|
102
|
-
| Elite | `eliteClues` |
|
103
|
-
| Master | `masterClues` |
|
104
|
-
|
105
|
-
### Minigames
|
106
|
-
|
107
|
-
| Minigame | Param |
|
108
|
-
| ---------------------- | :---------------: |
|
109
|
-
| Bounty Hunter (Rogue) | `rogueBH` |
|
110
|
-
| Bounty Hunter (Hunter) | `hunterBH` |
|
111
|
-
| Last Man Standing | `lastManStanding` |
|
112
|
-
| Soul Wars Zeal | `soulWarsZeal` |
|
113
|
-
|
114
|
-
### Leagues
|
115
|
-
|
116
|
-
| Activity | Param |
|
117
|
-
| ------------- | :------------: |
|
118
|
-
| League Points | `leaguePoints` |
|
119
|
-
|
120
|
-
### Bosses
|
121
|
-
|
122
|
-
| Boss Name | Param |
|
123
|
-
| --------------------------------- | :----------------------------: |
|
124
|
-
| Abyssal Sire | `abyssalSire` |
|
125
|
-
| Alchemical Hydra | `alchemicalHydra` |
|
126
|
-
| Barrows Chests | `barrows` |
|
127
|
-
| Bryophyta | `bryophyta` |
|
128
|
-
| Callisto | `callisto` |
|
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
|
-
| General Graardor | `generalGraardor` |
|
142
|
-
| Giant Mole | `giantMole` |
|
143
|
-
| Grotesque Guardians | `grotesqueGuardians` |
|
144
|
-
| Hespori | `hespori` |
|
145
|
-
| Kalphite Queen | `kalphiteQueen` |
|
146
|
-
| King Black Dragon | `kingBlackDragon` |
|
147
|
-
| Kraken | `kraken` |
|
148
|
-
| Kreearra | `kreeArra` |
|
149
|
-
| K'ril Tsutsaroth | `krilTsutsaroth` |
|
150
|
-
| Mimic | `mimic` |
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
171
|
-
|
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
|
-
|
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) returns CSV.
|
13
|
+
This wrapper converts it to json 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.
|
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 should 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
|
+
---
|
26
|
+
|
27
|
+
## Installation
|
28
|
+
|
29
|
+
With npm:
|
30
|
+
|
31
|
+
```
|
32
|
+
$ npm install osrs-json-hiscores
|
33
|
+
```
|
34
|
+
|
35
|
+
With Yarn:
|
36
|
+
|
37
|
+
```
|
38
|
+
$ yarn add osrs-json-hiscores
|
39
|
+
```
|
40
|
+
|
41
|
+
## How to use
|
42
|
+
|
43
|
+
Install the package and then import it into your project:
|
44
|
+
|
45
|
+
```javascript
|
46
|
+
const hiscores = require('osrs-json-hiscores');
|
47
|
+
```
|
48
|
+
|
49
|
+
Once you import it you can call the functions asynchronously:
|
50
|
+
|
51
|
+
```javascript
|
52
|
+
hiscores
|
53
|
+
.getStats('Lynx Titan')
|
54
|
+
.then((res) => console.log(res))
|
55
|
+
.catch((err) => console.error(err));
|
56
|
+
```
|
57
|
+
|
58
|
+
If you are using TypeScript or transpiling your JS you can use ES6 syntax:
|
59
|
+
|
60
|
+
```javascript
|
61
|
+
import hiscores, { getSkillPage } from 'osrs-json-hiscores';
|
62
|
+
|
63
|
+
// ...
|
64
|
+
|
65
|
+
const stats = await hiscores.getStats('Lynx Titan');
|
66
|
+
const topPage = await getSkillPage('overall');
|
67
|
+
```
|
68
|
+
|
69
|
+
`getStats` will return a full player object with gamemode.
|
70
|
+
`getStatsByGameMode` will return a stats object and accepts a gamemode parameter:
|
71
|
+
|
72
|
+
| Game mode | Param |
|
73
|
+
| ---------------- | :----------: |
|
74
|
+
| Regular | `main` |
|
75
|
+
| Ironman | `ironman` |
|
76
|
+
| Hardcore Ironman | `hardcore` |
|
77
|
+
| Ultimate Ironman | `ultimate` |
|
78
|
+
| Deadman Mode | `deadman` |
|
79
|
+
| Tournament | `tournament` |
|
80
|
+
| Leagues | `seasonal` |
|
81
|
+
|
82
|
+
`getSkillPage` and `getActivityPage` require a skill / activity and optionally a gamemode and page:
|
83
|
+
|
84
|
+
```javascript
|
85
|
+
hiscores
|
86
|
+
.getSkillPage('attack', 'main', 1)
|
87
|
+
.then((res) => console.log(res))
|
88
|
+
.catch((err) => console.error(err));
|
89
|
+
```
|
90
|
+
|
91
|
+
Activities consist of all levels of clue scrolls as well as minigames and bosses:
|
92
|
+
|
93
|
+
### Clue Scrolls
|
94
|
+
|
95
|
+
| Type | Param |
|
96
|
+
| -------- | :-------------: |
|
97
|
+
| All | `allClues` |
|
98
|
+
| Beginner | `beginnerClues` |
|
99
|
+
| Easy | `easyClues` |
|
100
|
+
| Medium | `mediumClues` |
|
101
|
+
| Hard | `hardClues` |
|
102
|
+
| Elite | `eliteClues` |
|
103
|
+
| Master | `masterClues` |
|
104
|
+
|
105
|
+
### Minigames
|
106
|
+
|
107
|
+
| Minigame | Param |
|
108
|
+
| ---------------------- | :---------------: |
|
109
|
+
| Bounty Hunter (Rogue) | `rogueBH` |
|
110
|
+
| Bounty Hunter (Hunter) | `hunterBH` |
|
111
|
+
| Last Man Standing | `lastManStanding` |
|
112
|
+
| Soul Wars Zeal | `soulWarsZeal` |
|
113
|
+
|
114
|
+
### Leagues
|
115
|
+
|
116
|
+
| Activity | Param |
|
117
|
+
| ------------- | :------------: |
|
118
|
+
| League Points | `leaguePoints` |
|
119
|
+
|
120
|
+
### Bosses
|
121
|
+
|
122
|
+
| Boss Name | Param |
|
123
|
+
| --------------------------------- | :----------------------------: |
|
124
|
+
| Abyssal Sire | `abyssalSire` |
|
125
|
+
| Alchemical Hydra | `alchemicalHydra` |
|
126
|
+
| Barrows Chests | `barrows` |
|
127
|
+
| Bryophyta | `bryophyta` |
|
128
|
+
| Callisto | `callisto` |
|
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
|
+
| General Graardor | `generalGraardor` |
|
142
|
+
| Giant Mole | `giantMole` |
|
143
|
+
| Grotesque Guardians | `grotesqueGuardians` |
|
144
|
+
| Hespori | `hespori` |
|
145
|
+
| Kalphite Queen | `kalphiteQueen` |
|
146
|
+
| King Black Dragon | `kingBlackDragon` |
|
147
|
+
| Kraken | `kraken` |
|
148
|
+
| Kreearra | `kreeArra` |
|
149
|
+
| K'ril Tsutsaroth | `krilTsutsaroth` |
|
150
|
+
| Mimic | `mimic` |
|
151
|
+
| Nex | `nex` |
|
152
|
+
| The Nightmare of Ashihama | `nightmare` |
|
153
|
+
| Phosani's Nightmare | `phosanisNightmare` |
|
154
|
+
| Obor | `obor` |
|
155
|
+
| Sarachnis | `sarachnis` |
|
156
|
+
| Scorpia | `scorpia` |
|
157
|
+
| Skotizo | `skotizo` |
|
158
|
+
| Tempoross | `tempoross` |
|
159
|
+
| The Gauntlet | `gauntlet` |
|
160
|
+
| The Corrupted Gauntlet | `corruptedGauntlet` |
|
161
|
+
| Theatre Of Blood | `theatreOfBlood` |
|
162
|
+
| Theatre Of Blood: Hard Mode | `theatreOfBloodHardMode` |
|
163
|
+
| Thermonuclear Smoke Devil | `thermonuclearSmokeDevil` |
|
164
|
+
| TzKal-Zuk | `tzKalZuk` |
|
165
|
+
| TzTok-Jad | `tzTokJad` |
|
166
|
+
| Venenatis | `venenatis` |
|
167
|
+
| Vetion | `vetion` |
|
168
|
+
| Vorkath | `vorkath` |
|
169
|
+
| Wintertodt | `wintertodt` |
|
170
|
+
| Zalcano | `zalcano` |
|
171
|
+
| Zulrah | `zulrah` |
|
172
|
+
|
173
|
+
## What you'll get
|
174
|
+
|
175
|
+
`getStats` returns a player object that looks like this:
|
176
|
+
|
177
|
+
```javascript
|
178
|
+
{
|
179
|
+
name: 'Lynx Titan',
|
180
|
+
mode: 'main',
|
181
|
+
dead: false,
|
182
|
+
deulted: false,
|
183
|
+
deironed: false,
|
184
|
+
main: {
|
185
|
+
skills: {
|
186
|
+
overall: {rank: 1, level: 2277, xp: 4600000000},
|
187
|
+
attack: {},
|
188
|
+
defence: {},
|
189
|
+
// ...
|
190
|
+
},
|
191
|
+
clues: {},
|
192
|
+
leaguePoints: {},
|
193
|
+
bountyHunter: {},
|
194
|
+
lastManStanding: {},
|
195
|
+
soulWarsZeal: {},
|
196
|
+
bosses: {}
|
197
|
+
}
|
198
|
+
}
|
199
|
+
```
|
200
|
+
|
201
|
+
`getSkillPage` returns and array of 25 players (This represents a page on the hiscores):
|
202
|
+
|
203
|
+
```javascript
|
204
|
+
[
|
205
|
+
{ rank: 1, name: 'Lynx Titan', level: 2277, xp: 4600000000, dead: false },
|
206
|
+
{},
|
207
|
+
{}
|
208
|
+
// ...
|
209
|
+
];
|
210
|
+
```
|
211
|
+
|
212
|
+
## Helpful Extras
|
213
|
+
|
214
|
+
Get the properly formatted name of any skill, boss, clue or other activity:
|
215
|
+
|
216
|
+
```javascript
|
217
|
+
// kril === "K'ril Tsutsaroth"
|
218
|
+
const kril = FORMATTED_BOSS_NAMES['krilTsutsaroth'];
|
219
|
+
```
|
package/lib/hiscores.d.ts
CHANGED
@@ -1,43 +1,43 @@
|
|
1
|
-
import { Player, Stats, Gamemode, SkillName, PlayerSkillRow, ActivityName, PlayerActivityRow } from './types';
|
2
|
-
/**
|
3
|
-
* Screen scrapes the hiscores to get the formatted rsn of a player.
|
4
|
-
*
|
5
|
-
* @param rsn Username of the player.
|
6
|
-
* @returns Formatted version of the rsn.
|
7
|
-
*/
|
8
|
-
export declare function getRSNFormat(rsn: string): Promise<string>;
|
9
|
-
/**
|
10
|
-
* Parses CSV string of raw stats and returns a stats object.
|
11
|
-
*
|
12
|
-
* @param csv Raw CSV from the official OSRS API.
|
13
|
-
* @returns Parsed stats object.
|
14
|
-
*/
|
15
|
-
export declare function parseStats(csv: string): Stats;
|
16
|
-
/**
|
17
|
-
* Fetches stats from the OSRS API and consolidates the info into a player object.
|
18
|
-
*
|
19
|
-
* **Note:** This function will make up to 5 separate network requests.
|
20
|
-
* As such, it is highly subject to the performance of the official OSRS API.
|
21
|
-
*
|
22
|
-
* @param rsn Username of the player.
|
23
|
-
* @returns Player object.
|
24
|
-
*/
|
25
|
-
export declare function getStats(rsn: string): Promise<Player>;
|
26
|
-
/**
|
27
|
-
* Fetches stats from the OSRS API and returns them as an object.
|
28
|
-
*
|
29
|
-
* @param rsn Username of the player.
|
30
|
-
* @param mode Gamemode to fetch ranks for.
|
31
|
-
* @returns Stats object.
|
32
|
-
*/
|
33
|
-
export declare function getStatsByGamemode(rsn: string, mode?: Gamemode): Promise<Stats>;
|
34
|
-
export declare function getSkillPage(skill: SkillName, mode?: Gamemode, page?: number): Promise<PlayerSkillRow[]>;
|
35
|
-
/**
|
36
|
-
* Screen scrapes a hiscores page of an activity or boss and returns an array of up to 25 players.
|
37
|
-
*
|
38
|
-
* @param activity Name of the activity or boss to fetch hiscores for.
|
39
|
-
* @param mode Gamemode to fetch ranks for.
|
40
|
-
* @param page Page number.
|
41
|
-
* @returns Array of `PlayerActivityRow` objects.
|
42
|
-
*/
|
43
|
-
export declare function getActivityPage(activity: ActivityName, mode?: Gamemode, page?: number): Promise<PlayerActivityRow[]>;
|
1
|
+
import { Player, Stats, Gamemode, SkillName, PlayerSkillRow, ActivityName, PlayerActivityRow } from './types';
|
2
|
+
/**
|
3
|
+
* Screen scrapes the hiscores to get the formatted rsn of a player.
|
4
|
+
*
|
5
|
+
* @param rsn Username of the player.
|
6
|
+
* @returns Formatted version of the rsn.
|
7
|
+
*/
|
8
|
+
export declare function getRSNFormat(rsn: string): Promise<string>;
|
9
|
+
/**
|
10
|
+
* Parses CSV string of raw stats and returns a stats object.
|
11
|
+
*
|
12
|
+
* @param csv Raw CSV from the official OSRS API.
|
13
|
+
* @returns Parsed stats object.
|
14
|
+
*/
|
15
|
+
export declare function parseStats(csv: string): Stats;
|
16
|
+
/**
|
17
|
+
* Fetches stats from the OSRS API and consolidates the info into a player object.
|
18
|
+
*
|
19
|
+
* **Note:** This function will make up to 5 separate network requests.
|
20
|
+
* As such, it is highly subject to the performance of the official OSRS API.
|
21
|
+
*
|
22
|
+
* @param rsn Username of the player.
|
23
|
+
* @returns Player object.
|
24
|
+
*/
|
25
|
+
export declare function getStats(rsn: string): Promise<Player>;
|
26
|
+
/**
|
27
|
+
* Fetches stats from the OSRS API and returns them as an object.
|
28
|
+
*
|
29
|
+
* @param rsn Username of the player.
|
30
|
+
* @param mode Gamemode to fetch ranks for.
|
31
|
+
* @returns Stats object.
|
32
|
+
*/
|
33
|
+
export declare function getStatsByGamemode(rsn: string, mode?: Gamemode): Promise<Stats>;
|
34
|
+
export declare function getSkillPage(skill: SkillName, mode?: Gamemode, page?: number): Promise<PlayerSkillRow[]>;
|
35
|
+
/**
|
36
|
+
* Screen scrapes a hiscores page of an activity or boss and returns an array of up to 25 players.
|
37
|
+
*
|
38
|
+
* @param activity Name of the activity or boss to fetch hiscores for.
|
39
|
+
* @param mode Gamemode to fetch ranks for.
|
40
|
+
* @param page Page number.
|
41
|
+
* @returns Array of `PlayerActivityRow` objects.
|
42
|
+
*/
|
43
|
+
export declare function getActivityPage(activity: ActivityName, mode?: Gamemode, page?: number): Promise<PlayerActivityRow[]>;
|