Add support for Rifts Closed

This commit is contained in:
molo-pl
2022-04-15 11:30:56 +02:00
parent 3a72315498
commit a2a34a46e3
6 changed files with 12 additions and 2 deletions

View File

@@ -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<Skills>((prev, curr, index) => {
@@ -138,6 +138,7 @@ export function parseStats(csv: string): Stats {
bountyHunter,
lastManStanding,
soulWarsZeal,
riftsClosed,
clues,
bosses
};

View File

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

View File

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