mirror of
https://github.com/maxswa/osrs-json-hiscores.git
synced 2025-10-15 10:19:04 +00:00
delete seasonal changes
This commit is contained in:
@@ -68,7 +68,7 @@ export async function getRSNFormat(rsn: string): Promise<string> {
|
||||
* @param csv Raw CSV from the official OSRS API.
|
||||
* @returns Parsed stats object.
|
||||
*/
|
||||
export function parseStats(csv: string, mode: Gamemode = 'main'): Stats {
|
||||
export function parseStats(csv: string): Stats {
|
||||
const splitCSV = csv
|
||||
.split('\n')
|
||||
.filter((entry) => !!entry)
|
||||
@@ -97,17 +97,11 @@ export function parseStats(csv: string, mode: Gamemode = 'main'): Stats {
|
||||
return activity;
|
||||
});
|
||||
|
||||
/** `seasonal` API results don't currently include TOB: Hard Mode, so it needs to be filtered out in that case. */
|
||||
const filteredBosses =
|
||||
mode === 'seasonal'
|
||||
? BOSSES.filter((boss) => boss !== 'theatreOfBloodHardMode')
|
||||
: BOSSES;
|
||||
|
||||
const [leaguePoints] = activityObjects.splice(0, 1);
|
||||
const bhObjects = activityObjects.splice(0, BH_MODES.length);
|
||||
const clueObjects = activityObjects.splice(0, CLUES.length);
|
||||
const [lastManStanding, soulWarsZeal] = activityObjects.splice(0, 2);
|
||||
const bossObjects = activityObjects.splice(0, filteredBosses.length);
|
||||
const bossObjects = activityObjects.splice(0, BOSSES.length);
|
||||
|
||||
const skills: Skills = skillObjects.reduce<Skills>((prev, curr, index) => {
|
||||
const newSkills = { ...prev };
|
||||
@@ -129,7 +123,7 @@ export function parseStats(csv: string, mode: Gamemode = 'main'): Stats {
|
||||
|
||||
const bosses: Bosses = bossObjects.reduce<Bosses>((prev, curr, index) => {
|
||||
const newBosses = { ...prev };
|
||||
newBosses[filteredBosses[index]] = curr;
|
||||
newBosses[BOSSES[index]] = curr;
|
||||
return newBosses;
|
||||
}, {} as Bosses);
|
||||
|
||||
@@ -256,7 +250,7 @@ export async function getStatsByGamemode(
|
||||
if (response.status !== 200) {
|
||||
throw Error('Player not found');
|
||||
}
|
||||
const stats = parseStats(response.data, mode);
|
||||
const stats = parseStats(response.data);
|
||||
|
||||
return stats;
|
||||
}
|
||||
|
Reference in New Issue
Block a user