Compare commits

..

7 Commits

Author SHA1 Message Date
maxswa
e77737f422 Add Guardians of the Rift. 2022-04-18 15:44:45 -04:00
Max Swartwout
3a72315498 Merge pull request #49 from maxswa/dependabot/npm_and_yarn/follow-redirects-1.14.8
Bump follow-redirects from 1.14.7 to 1.14.8
2022-02-15 14:37:28 -05:00
dependabot[bot]
c1c9833ad0 Bump follow-redirects from 1.14.7 to 1.14.8
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.7 to 1.14.8.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.7...v1.14.8)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-12 12:01:29 +00:00
Max Swartwout
9fe03746e1 Merge pull request #48 from maxswa/dependabot/npm_and_yarn/follow-redirects-1.14.7
Bump follow-redirects from 1.14.4 to 1.14.7
2022-01-18 10:42:22 -05:00
dependabot[bot]
66a4fb47a6 Bump follow-redirects from 1.14.4 to 1.14.7
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.4 to 1.14.7.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.4...v1.14.7)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-13 14:22:21 +00:00
Max Swartwout
83c44148a7 Merge pull request #47 from maxswa/fix-tests-nex
Fix tests
2022-01-05 21:54:48 -05:00
maxswa
44dea6b35c Add line for nex in lynxTitanStats.csv 2022-01-05 21:50:28 -05:00
7 changed files with 37 additions and 8 deletions

View File

@@ -110,6 +110,7 @@ Activities consist of all levels of clue scrolls as well as minigames and bosses
| Bounty Hunter (Hunter) | `hunterBH` | | Bounty Hunter (Hunter) | `hunterBH` |
| Last Man Standing | `lastManStanding` | | Last Man Standing | `lastManStanding` |
| Soul Wars Zeal | `soulWarsZeal` | | Soul Wars Zeal | `soulWarsZeal` |
| Rifts Closed | `riftsClosed` |
### Leagues ### Leagues
@@ -193,6 +194,7 @@ Activities consist of all levels of clue scrolls as well as minigames and bosses
bountyHunter: {}, bountyHunter: {},
lastManStanding: {}, lastManStanding: {},
soulWarsZeal: {}, soulWarsZeal: {},
riftsClosed: {},
bosses: {} bosses: {}
} }
} }

View File

@@ -88,6 +88,7 @@ test('Parse CSV to json', () => {
1,6143 1,6143
4814,898 4814,898
37,225 37,225
23,467
382,2780 382,2780
944,3000 944,3000
1981,1452 1981,1452
@@ -171,6 +172,7 @@ test('Parse CSV to json', () => {
}, },
lastManStanding: { rank: 4814, score: 898 }, lastManStanding: { rank: 4814, score: 898 },
soulWarsZeal: { rank: 37, score: 225 }, soulWarsZeal: { rank: 37, score: 225 },
riftsClosed: { rank: 23, score: 467 },
clues: { clues: {
all: { rank: 32, score: 12148 }, all: { rank: 32, score: 12148 },
beginner: { rank: 3105, score: 76 }, beginner: { rank: 3105, score: 76 },
@@ -236,9 +238,11 @@ test('Parse CSV to json', () => {
}); });
test('Parse CSV with unknown activity', () => { test('Parse CSV with unknown activity', () => {
const statsWithUnknownActivity = lynxTitanStats + ` const statsWithUnknownActivity = `${lynxTitanStats}
-1,-1`; -1,-1`;
expect(() => parseStats(statsWithUnknownActivity)).toThrow(INVALID_FORMAT_ERROR); expect(() => parseStats(statsWithUnknownActivity)).toThrow(
INVALID_FORMAT_ERROR
);
}); });
test('Parse invalid CSV', () => { test('Parse invalid CSV', () => {

View File

@@ -29,6 +29,7 @@
-1,-1 -1,-1
-1,-1 -1,-1
-1,-1 -1,-1
-1,-1
347584,22 347584,22
-1,-1 -1,-1
-1,-1 -1,-1
@@ -81,3 +82,4 @@
-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

@@ -28,7 +28,8 @@ import {
getActivityPageURL, getActivityPageURL,
httpGet, httpGet,
BOSSES, BOSSES,
INVALID_FORMAT_ERROR INVALID_FORMAT_ERROR,
EXTRA_ACTIVITY_COUNT
} from './utils'; } from './utils';
/** /**
@@ -75,7 +76,14 @@ export function parseStats(csv: string): Stats {
.filter((entry) => !!entry) .filter((entry) => !!entry)
.map((stat) => stat.split(',')); .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 +
EXTRA_ACTIVITY_COUNT
) {
throw Error(INVALID_FORMAT_ERROR); throw Error(INVALID_FORMAT_ERROR);
} }
@@ -105,7 +113,10 @@ export function parseStats(csv: string): Stats {
const [leaguePoints] = activityObjects.splice(0, 1); const [leaguePoints] = activityObjects.splice(0, 1);
const bhObjects = activityObjects.splice(0, BH_MODES.length); const bhObjects = activityObjects.splice(0, BH_MODES.length);
const clueObjects = activityObjects.splice(0, CLUES.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 bossObjects = activityObjects.splice(0, BOSSES.length);
const skills: Skills = skillObjects.reduce<Skills>((prev, curr, index) => { const skills: Skills = skillObjects.reduce<Skills>((prev, curr, index) => {
@@ -138,6 +149,7 @@ export function parseStats(csv: string): Stats {
bountyHunter, bountyHunter,
lastManStanding, lastManStanding,
soulWarsZeal, soulWarsZeal,
riftsClosed,
clues, clues,
bosses bosses
}; };

View File

@@ -119,6 +119,7 @@ export type ActivityName =
| 'rogueBH' | 'rogueBH'
| 'lastManStanding' | 'lastManStanding'
| 'soulWarsZeal' | 'soulWarsZeal'
| 'riftsClosed'
| 'allClues' | 'allClues'
| 'beginnerClues' | 'beginnerClues'
| 'easyClues' | 'easyClues'
@@ -135,6 +136,7 @@ export interface Stats {
bountyHunter: BH; bountyHunter: BH;
lastManStanding: Activity; lastManStanding: Activity;
soulWarsZeal: Activity; soulWarsZeal: Activity;
riftsClosed: Activity;
bosses: Bosses; bosses: Bosses;
} }
export type Modes = { [M in Gamemode]?: Stats }; export type Modes = { [M in Gamemode]?: Stats };

View File

@@ -132,6 +132,7 @@ export const ACTIVITIES: ActivityName[] = [
'masterClues', 'masterClues',
'lastManStanding', 'lastManStanding',
'soulWarsZeal', 'soulWarsZeal',
'riftsClosed',
...BOSSES ...BOSSES
]; ];
@@ -247,5 +248,11 @@ export const FORMATTED_BH_NAMES: FormattedBHNames = {
export const FORMATTED_LMS = 'Last Man Standing'; export const FORMATTED_LMS = 'Last Man Standing';
export const FORMATTED_SOUL_WARS = 'Soul Wars Zeal'; export const FORMATTED_SOUL_WARS = 'Soul Wars Zeal';
export const FORMATTED_LEAGUE_POINTS = 'League Points'; export const FORMATTED_LEAGUE_POINTS = 'League Points';
export const FORMATTED_RIFTS_CLOSED = 'Rifts Closed';
/**
* Count of activities not including bosses, bounty hunter, or clues.
*/
export const EXTRA_ACTIVITY_COUNT = 4;
export const INVALID_FORMAT_ERROR = 'Invalid hiscores format'; export const INVALID_FORMAT_ERROR = 'Invalid hiscores format';

View File

@@ -2460,9 +2460,9 @@ flatted@^3.1.0:
integrity sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA== integrity sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==
follow-redirects@^1.14.0: follow-redirects@^1.14.0:
version "1.14.4" version "1.14.8"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.4.tgz#838fdf48a8bbdd79e52ee51fb1c94e3ed98b9379" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.8.tgz#016996fb9a11a100566398b1c6839337d7bfa8fc"
integrity sha512-zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g== integrity sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA==
for-in@^1.0.2: for-in@^1.0.2:
version "1.0.2" version "1.0.2"