From a2a34a46e3e5a6d285e599ead79eb1017e0e3194 Mon Sep 17 00:00:00 2001 From: molo-pl <62616086+molo-pl@users.noreply.github.com> Date: Fri, 15 Apr 2022 11:30:56 +0200 Subject: [PATCH] Add support for Rifts Closed --- README.md | 2 ++ __tests__/hiscores.test.ts | 2 ++ __tests__/lynxTitanStats.csv | 1 + src/hiscores.ts | 5 +++-- src/types.ts | 2 ++ src/utils/constants.ts | 2 ++ 6 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c1a52b9..ea3e4e7 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,7 @@ Activities consist of all levels of clue scrolls as well as minigames and bosses | Bounty Hunter (Hunter) | `hunterBH` | | Last Man Standing | `lastManStanding` | | Soul Wars Zeal | `soulWarsZeal` | +| Rifts Closed | `riftsClosed` | ### Leagues @@ -193,6 +194,7 @@ Activities consist of all levels of clue scrolls as well as minigames and bosses bountyHunter: {}, lastManStanding: {}, soulWarsZeal: {}, + riftsClosed: {}, bosses: {} } } diff --git a/__tests__/hiscores.test.ts b/__tests__/hiscores.test.ts index a029ac1..7bce9ca 100644 --- a/__tests__/hiscores.test.ts +++ b/__tests__/hiscores.test.ts @@ -88,6 +88,7 @@ test('Parse CSV to json', () => { 1,6143 4814,898 37,225 + 25,1110 382,2780 944,3000 1981,1452 @@ -171,6 +172,7 @@ test('Parse CSV to json', () => { }, lastManStanding: { rank: 4814, score: 898 }, soulWarsZeal: { rank: 37, score: 225 }, + riftsClosed: { rank: 25, score: 1110 }, clues: { all: { rank: 32, score: 12148 }, beginner: { rank: 3105, score: 76 }, diff --git a/__tests__/lynxTitanStats.csv b/__tests__/lynxTitanStats.csv index 7435c27..7908a3d 100644 --- a/__tests__/lynxTitanStats.csv +++ b/__tests__/lynxTitanStats.csv @@ -81,4 +81,5 @@ -1,-1 -1,-1 -1,-1 +-1,-1 -1,-1 \ No newline at end of file diff --git a/src/hiscores.ts b/src/hiscores.ts index 28501b1..95b468a 100644 --- a/src/hiscores.ts +++ b/src/hiscores.ts @@ -75,7 +75,7 @@ export function parseStats(csv: string): Stats { .filter((entry) => !!entry) .map((stat) => stat.split(',')); - if (splitCSV.length !== SKILLS.length + BH_MODES.length + CLUES.length + BOSSES.length + 3) { + if (splitCSV.length !== SKILLS.length + BH_MODES.length + CLUES.length + BOSSES.length + 4) { throw Error(INVALID_FORMAT_ERROR); } @@ -105,7 +105,7 @@ export function parseStats(csv: string): Stats { 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 [lastManStanding, soulWarsZeal, riftsClosed] = activityObjects.splice(0, 3); const bossObjects = activityObjects.splice(0, BOSSES.length); const skills: Skills = skillObjects.reduce((prev, curr, index) => { @@ -138,6 +138,7 @@ export function parseStats(csv: string): Stats { bountyHunter, lastManStanding, soulWarsZeal, + riftsClosed, clues, bosses }; diff --git a/src/types.ts b/src/types.ts index 2c5e9cb..215ba4e 100644 --- a/src/types.ts +++ b/src/types.ts @@ -119,6 +119,7 @@ export type ActivityName = | 'rogueBH' | 'lastManStanding' | 'soulWarsZeal' + | 'riftsClosed' | 'allClues' | 'beginnerClues' | 'easyClues' @@ -135,6 +136,7 @@ export interface Stats { bountyHunter: BH; lastManStanding: Activity; soulWarsZeal: Activity; + riftsClosed: Activity; bosses: Bosses; } export type Modes = { [M in Gamemode]?: Stats }; diff --git a/src/utils/constants.ts b/src/utils/constants.ts index b38e8f6..b2f3937 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -132,6 +132,7 @@ export const ACTIVITIES: ActivityName[] = [ 'masterClues', 'lastManStanding', 'soulWarsZeal', + 'riftsClosed', ...BOSSES ]; @@ -247,5 +248,6 @@ export const FORMATTED_BH_NAMES: FormattedBHNames = { export const FORMATTED_LMS = 'Last Man Standing'; export const FORMATTED_SOUL_WARS = 'Soul Wars Zeal'; export const FORMATTED_LEAGUE_POINTS = 'League Points'; +export const FORMATTED_RIFTS_CLOSED = 'Rifts Closed'; export const INVALID_FORMAT_ERROR = 'Invalid hiscores format';