Skip to content

Commit

Permalink
Add support for PvP Arena activity
Browse files Browse the repository at this point in the history
  • Loading branch information
davidvorona committed Jul 15, 2022
1 parent eebf76a commit 2877b9c
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ Activities consist of all levels of clue scrolls as well as minigames and bosses
| Bounty Hunter (Rogue) | `rogueBH` |
| Bounty Hunter (Hunter) | `hunterBH` |
| Last Man Standing | `lastManStanding` |
| PvP Arena | `pvpArena` |
| Soul Wars Zeal | `soulWarsZeal` |
| Rifts Closed | `riftsClosed` |

Expand Down Expand Up @@ -193,6 +194,7 @@ Activities consist of all levels of clue scrolls as well as minigames and bosses
leaguePoints: {},
bountyHunter: {},
lastManStanding: {},
pvpArena: {},
soulWarsZeal: {},
riftsClosed: {},
bosses: {}
Expand Down
2 changes: 2 additions & 0 deletions __tests__/hiscores.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ test('Parse CSV to json', () => {
392,250
1,6143
4814,898
13,4057
37,225
25,1110
382,2780
Expand Down Expand Up @@ -171,6 +172,7 @@ test('Parse CSV to json', () => {
rogue: { rank: 89912, score: 37 }
},
lastManStanding: { rank: 4814, score: 898 },
pvpArena: { rank: 13, score: 4057 },
soulWarsZeal: { rank: 37, score: 225 },
riftsClosed: { rank: 25, score: 1110 },
clues: {
Expand Down
4 changes: 4 additions & 0 deletions __tests__/lynxTitanNamePage.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@
.lmsrank:before {
content: url('https://www.runescape.com/img/rsp777/game_icon_lmsrank.png?2');
}

.pvparenarank:before {
content: url('https://www.runescape.com/img/rsp777/game_icon_pvparenarank.png?2');
}

.soulwarszeal:before {
content: url('https://www.runescape.com/img/rsp777/game_icon_soulwarszeal.png?2');
Expand Down
1 change: 1 addition & 0 deletions __tests__/lynxTitanStats.csv
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,5 @@
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
5 changes: 3 additions & 2 deletions src/hiscores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 + 4) {
if (splitCSV.length !== SKILLS.length + BH_MODES.length + CLUES.length + BOSSES.length + 5) {
throw Error(INVALID_FORMAT_ERROR);
}

Expand Down Expand Up @@ -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, riftsClosed] = activityObjects.splice(0, 3);
const [lastManStanding, pvpArena, soulWarsZeal, riftsClosed] = activityObjects.splice(0, 4);
const bossObjects = activityObjects.splice(0, BOSSES.length);

const skills: Skills = skillObjects.reduce<Skills>((prev, curr, index) => {
Expand Down Expand Up @@ -137,6 +137,7 @@ export function parseStats(csv: string): Stats {
leaguePoints,
bountyHunter,
lastManStanding,
pvpArena,
soulWarsZeal,
riftsClosed,
clues,
Expand Down
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export type ActivityName =
| 'hunterBH'
| 'rogueBH'
| 'lastManStanding'
| 'pvpArena'
| 'soulWarsZeal'
| 'riftsClosed'
| 'allClues'
Expand All @@ -135,6 +136,7 @@ export interface Stats {
leaguePoints: Activity;
bountyHunter: BH;
lastManStanding: Activity;
pvpArena: Activity;
soulWarsZeal: Activity;
riftsClosed: Activity;
bosses: Bosses;
Expand Down
2 changes: 2 additions & 0 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export const ACTIVITIES: ActivityName[] = [
'eliteClues',
'masterClues',
'lastManStanding',
'pvpArena',
'soulWarsZeal',
'riftsClosed',
...BOSSES
Expand Down Expand Up @@ -246,6 +247,7 @@ export const FORMATTED_BH_NAMES: FormattedBHNames = {
};

export const FORMATTED_LMS = 'Last Man Standing';
export const FORMATTED_PVP_ARENA = 'PvP Arena';
export const FORMATTED_SOUL_WARS = 'Soul Wars Zeal';
export const FORMATTED_LEAGUE_POINTS = 'League Points';
export const FORMATTED_RIFTS_CLOSED = 'Rifts Closed';
Expand Down

0 comments on commit 2877b9c

Please sign in to comment.