delete seasonal changes

This commit is contained in:
NotJayden
2021-06-10 00:15:11 +08:00
parent 04e59cff04
commit 20c5c2f730
3 changed files with 5 additions and 111 deletions

View File

@@ -1,82 +0,0 @@
1,2277,4600000000
15,99,200000000
28,99,200000000
18,99,200000000
7,99,200000000
8,99,200000000
11,99,200000000
32,99,200000000
159,99,200000000
15,99,200000000
12,99,200000000
9,99,200000000
48,99,200000000
4,99,200000000
3,99,200000000
25,99,200000000
5,99,200000000
23,99,200000000
12,99,200000000
2,99,200000000
19,99,200000000
7,99,200000000
4,99,200000000
4,99,200000000
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
347584,22
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
Can't render this file because it has a wrong number of fields in line 25.

View File

@@ -11,8 +11,7 @@ import {
getPlayerTableURL,
getSkillPageURL,
getStatsURL,
BOSSES,
Boss
BOSSES
} from '../src/index';
const B0ATY_NAME = 'B0ATY';
@@ -21,7 +20,6 @@ const LYNX_TITAN_SPACE_NAME = 'lYnX tiTaN';
const LYNX_TITAN_UNDERSCORE_NAME = 'lYnX_tiTaN';
const LYNX_TITAN_HYPHEN_NAME = 'lYnX-tiTaN';
const LYNX_TITAN_FORMATTED_NAME = 'Lynx Titan';
const FYSAD_FORMATTED_NAME = 'Fysad';
const attackTopPage = readFileSync(`${__dirname}/attackTopPage.html`, 'utf8');
const b0atyNamePage = readFileSync(`${__dirname}/b0atyNamePage.html`, 'utf8');
@@ -30,7 +28,6 @@ const lynxTitanNamePage = readFileSync(
`${__dirname}/lynxTitanNamePage.html`,
'utf8'
);
const fysadStatsSeasonal = readFileSync(`${__dirname}/fysadStatsSeasonal.csv`, 'utf8');
jest.spyOn(axios, 'get').mockImplementation((url) => {
const lynxUrls = [
@@ -50,9 +47,6 @@ jest.spyOn(axios, 'get').mockImplementation((url) => {
if (getStatsURL('main', LYNX_TITAN_FORMATTED_NAME) === url) {
return Promise.resolve({ status: 200, data: lynxTitanStats });
}
if (getStatsURL('seasonal', FYSAD_FORMATTED_NAME) === url) {
return Promise.resolve({ status: 200, data: fysadStatsSeasonal });
}
throw new Error(`No mock response for URL: ${url}`);
});
@@ -482,15 +476,3 @@ test('Get stats by gamemode', async () => {
expect.assertions(2);
});
test('Get stats by game mode seasonal (omit TOB: Hard Mode from bosses)', async () => {
const {bosses} = await getStatsByGamemode(FYSAD_FORMATTED_NAME, 'seasonal');
const bossKeys = Object.keys(bosses);
const filteredBosses = BOSSES.filter(boss => boss !== 'theatreOfBloodHardMode');
expect(bossKeys).toStrictEqual(filteredBosses);
expect(bossKeys).not.toContain<Boss>('theatreOfBloodHardMode');
expect.assertions(2);
});

View File

@@ -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;
}