Skip to content

Commit

Permalink
fix(hiscore-parser): add varlamore p1 support
Browse files Browse the repository at this point in the history
  • Loading branch information
FreekMencke committed Mar 20, 2024
1 parent efd3dc5 commit 8f82554
Show file tree
Hide file tree
Showing 17 changed files with 316 additions and 9 deletions.
4 changes: 4 additions & 0 deletions @osrs-tracker/hiscores/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v0.3.0 - 2024/03/20

- Added new hiscore parse order for Varlamore Part 1.

## v0.2.0 - 2024/02/27

- Added methods for XP calculation
Expand Down
5 changes: 4 additions & 1 deletion @osrs-tracker/hiscores/dist/models/hiscore.enum.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export declare enum ClueScrollsEnum {
}
export declare enum MiniGameEnum {
SoulWarsZeal = "Soul Wars Zeal",
RiftsClosed = "Rifts Closed"
RiftsClosed = "Rifts Closed",
ColosseumGlory = "Colosseum Glory"
}
export declare enum RaidEnum {
ChambersOfXeric = "Chambers of Xeric",
Expand Down Expand Up @@ -87,6 +88,7 @@ export declare enum BossEnum {
Kraken = "Kraken",
KreeArra = "Kree'Arra",
KrilTsutsaroth = "K'ril Tsutsaroth",
LunarChests = "Lunar Chests",
Mimic = "Mimic",
Nex = "Nex",
Nightmare = "Nightmare",
Expand All @@ -97,6 +99,7 @@ export declare enum BossEnum {
Scorpia = "Scorpia",
Scurrius = "Scurrius",
Skotizo = "Skotizo",
SolHeredit = "Sol Heredit",
Spindel = "Spindel",
Tempoross = "Tempoross",
TheLeviathan = "The Leviathan",
Expand Down
3 changes: 3 additions & 0 deletions @osrs-tracker/hiscores/dist/models/hiscore.enum.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export var MiniGameEnum;
(function (MiniGameEnum) {
MiniGameEnum["SoulWarsZeal"] = "Soul Wars Zeal";
MiniGameEnum["RiftsClosed"] = "Rifts Closed";
MiniGameEnum["ColosseumGlory"] = "Colosseum Glory";
})(MiniGameEnum || (MiniGameEnum = {}));
export var RaidEnum;
(function (RaidEnum) {
Expand Down Expand Up @@ -94,6 +95,7 @@ export var BossEnum;
BossEnum["Kraken"] = "Kraken";
BossEnum["KreeArra"] = "Kree'Arra";
BossEnum["KrilTsutsaroth"] = "K'ril Tsutsaroth";
BossEnum["LunarChests"] = "Lunar Chests";
BossEnum["Mimic"] = "Mimic";
BossEnum["Nex"] = "Nex";
BossEnum["Nightmare"] = "Nightmare";
Expand All @@ -104,6 +106,7 @@ export var BossEnum;
BossEnum["Scorpia"] = "Scorpia";
BossEnum["Scurrius"] = "Scurrius";
BossEnum["Skotizo"] = "Skotizo";
BossEnum["SolHeredit"] = "Sol Heredit";
BossEnum["Spindel"] = "Spindel";
BossEnum["Tempoross"] = "Tempoross";
BossEnum["TheLeviathan"] = "The Leviathan";
Expand Down
2 changes: 2 additions & 0 deletions @osrs-tracker/hiscores/dist/parser/parse-order/parse-order.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import { PO_2023_05_25 } from './po-2023-05-24';
import { PO_2023_07_27 } from './po-2023-07-27';
import { PO_2023_08_23 } from './po-2023-08-23';
import { PO_2024_01_24 } from './po-2024-01-24';
import { PO_2024_03_20 } from './po-2024-03-20';
import { PO_DEFAULT } from './po-default';
export const ParseOrderMap = {
'2024-03-20': PO_2024_03_20,
'2024-01-24': PO_2024_01_24,
'2023-08-23': PO_2023_08_23,
'2023-07-27': PO_2023_07_27,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { ParseOrder } from './parse-order';
export declare const PO_2024_03_20: ParseOrder;
106 changes: 106 additions & 0 deletions @osrs-tracker/hiscores/dist/parser/parse-order/po-2024-03-20.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import { BossEnum, BountyHunterEnum, ClueScrollsEnum, CompetitiveEnum, MiniGameEnum, RaidEnum, SkillEnum, } from '../../models/hiscore.enum';
export const PO_2024_03_20 = [
SkillEnum.Overall,
SkillEnum.Attack,
SkillEnum.Defence,
SkillEnum.Strength,
SkillEnum.Hitpoints,
SkillEnum.Ranged,
SkillEnum.Prayer,
SkillEnum.Magic,
SkillEnum.Cooking,
SkillEnum.Woodcutting,
SkillEnum.Fletching,
SkillEnum.Fishing,
SkillEnum.Firemaking,
SkillEnum.Crafting,
SkillEnum.Smithing,
SkillEnum.Mining,
SkillEnum.Herblore,
SkillEnum.Agility,
SkillEnum.Thieving,
SkillEnum.Slayer,
SkillEnum.Farming,
SkillEnum.Runecraft,
SkillEnum.Hunter,
SkillEnum.Construction,
CompetitiveEnum.LeaguePoints,
CompetitiveEnum.Unknown,
BountyHunterEnum.BountyHunter,
BountyHunterEnum.BountyHunterRogues,
BountyHunterEnum.BountyHunterLegacy,
BountyHunterEnum.BountyHunterLegacyRogues,
ClueScrollsEnum.ClueScrollsAll,
ClueScrollsEnum.ClueScrollsBeginner,
ClueScrollsEnum.ClueScrollsEasy,
ClueScrollsEnum.ClueScrollsMedium,
ClueScrollsEnum.ClueScrollsHard,
ClueScrollsEnum.ClueScrollsElite,
ClueScrollsEnum.ClueScrollsMaster,
CompetitiveEnum.LastManStanding,
CompetitiveEnum.PvpArena,
MiniGameEnum.SoulWarsZeal,
MiniGameEnum.RiftsClosed,
MiniGameEnum.ColosseumGlory,
BossEnum.AbyssalSire,
BossEnum.AlchemicalHydra,
BossEnum.Artio,
BossEnum.BarrowsChests,
BossEnum.Bryophyta,
BossEnum.Callisto,
BossEnum.Calvarion,
BossEnum.Cerberus,
RaidEnum.ChambersOfXeric,
RaidEnum.ChambersOfXericChallengeMode,
BossEnum.ChaosElemental,
BossEnum.ChaosFanatic,
BossEnum.CommanderZilyana,
BossEnum.CorporealBeast,
BossEnum.CrazyArchaeologist,
BossEnum.DagannothPrime,
BossEnum.DagannothRex,
BossEnum.DagannothSupreme,
BossEnum.DerangedArchaeologist,
BossEnum.DukeSucellus,
BossEnum.GeneralGraardor,
BossEnum.GiantMole,
BossEnum.GrotesqueGuardians,
BossEnum.Hespori,
BossEnum.KalphiteQueen,
BossEnum.KingBlackDragon,
BossEnum.Kraken,
BossEnum.KreeArra,
BossEnum.KrilTsutsaroth,
BossEnum.LunarChests,
BossEnum.Mimic,
BossEnum.Nex,
BossEnum.Nightmare,
BossEnum.PhosanisNightmare,
BossEnum.Obor,
BossEnum.PhantomMuspah,
BossEnum.Sarachnis,
BossEnum.Scorpia,
BossEnum.Scurrius,
BossEnum.Skotizo,
BossEnum.SolHeredit,
BossEnum.Spindel,
BossEnum.Tempoross,
RaidEnum.TheGauntlet,
RaidEnum.TheCorruptedGauntlet,
BossEnum.TheLeviathan,
BossEnum.TheWhisperer,
RaidEnum.TheatreOfBlood,
RaidEnum.TheatreOfBloodHardMode,
BossEnum.ThermoNuclearSmokeDevil,
RaidEnum.TombsOfAmascut,
RaidEnum.TombsOfAmascutExpertMode,
BossEnum.TzKalZuk,
BossEnum.TzTokJad,
BossEnum.Vardorvis,
BossEnum.Venenatis,
BossEnum.Vetion,
BossEnum.Vorkath,
BossEnum.Wintertodt,
BossEnum.Zalcano,
BossEnum.Zulrah,
];
1 change: 1 addition & 0 deletions @osrs-tracker/hiscores/dist/parser/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export function parseHiscoreString(hiscoreString, date) {
return (hiscore.bountyHunter[miniGame.name] = miniGame);
if (Object.values(MiniGameEnum).includes(miniGame.name))
return (hiscore.miniGames[miniGame.name] = miniGame);
console.log(miniGame, Object.values(MiniGameEnum));
throw new Error('Unknown minigame detected:' + miniGame.name);
});
return hiscore;
Expand Down
2 changes: 1 addition & 1 deletion @osrs-tracker/hiscores/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@osrs-tracker/hiscores",
"version": "0.2.0",
"version": "0.3.0",
"description": "Logic for parsing OSRS hiscores",
"license": "MIT",
"author": "Freek Mencke",
Expand Down
3 changes: 3 additions & 0 deletions @osrs-tracker/hiscores/src/models/hiscore.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export enum ClueScrollsEnum {
export enum MiniGameEnum {
SoulWarsZeal = 'Soul Wars Zeal',
RiftsClosed = 'Rifts Closed',
ColosseumGlory = 'Colosseum Glory', // New minigame 20/03/2024
}

export enum RaidEnum {
Expand Down Expand Up @@ -93,6 +94,7 @@ export enum BossEnum {
Kraken = 'Kraken',
KreeArra = "Kree'Arra",
KrilTsutsaroth = "K'ril Tsutsaroth",
LunarChests = 'Lunar Chests', // New boss 20/03/2024
Mimic = 'Mimic',
Nex = 'Nex',
Nightmare = 'Nightmare',
Expand All @@ -103,6 +105,7 @@ export enum BossEnum {
Scorpia = 'Scorpia',
Scurrius = 'Scurrius', // New boss 24/01/2024
Skotizo = 'Skotizo',
SolHeredit = 'Sol Heredit', // New boss 20/03/2024
Spindel = 'Spindel', // New boss 13/04/2023
Tempoross = 'Tempoross',
TheLeviathan = 'The Leviathan', // New boss 31/07/2023
Expand Down
2 changes: 2 additions & 0 deletions @osrs-tracker/hiscores/src/parser/parse-order/parse-order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import { PO_2023_05_25 } from './po-2023-05-24';
import { PO_2023_07_27 } from './po-2023-07-27';
import { PO_2023_08_23 } from './po-2023-08-23';
import { PO_2024_01_24 } from './po-2024-01-24';
import { PO_2024_03_20 } from './po-2024-03-20';
import { PO_DEFAULT } from './po-default';

export type ParseOrder = HiscoreLineType[];

export const ParseOrderMap: { [date: string]: ParseOrder } = {
'2024-03-20': PO_2024_03_20,
'2024-01-24': PO_2024_01_24,
'2023-08-23': PO_2023_08_23,
'2023-07-27': PO_2023_07_27,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { BossEnum, BountyHunterEnum } from '../../models/hiscore.enum';
import { parseHiscoreString } from '../parser';

describe('Parser with 2024-01-24 parse order', () => {
it('should parse new scurries', () => {
it('should parse new scurris', () => {
const hiscoreString =
'29662,2277,412893314\n60733,99,21973569\n37363,99,21038715\n51220,99,33114139\n57327,99,44221838\n70048,99,39958954\n34499,99,13373152\n78574,99,20610579\n78127,99,14436977\n59847,99,13788559\n86251,99,13184630\n51249,99,13650444\n65642,99,13933700\n37083,99,14410362\n85067,99,13038084\n77902,99,13095989\n25776,99,13460001\n17417,99,13911338\n58982,99,13750029\n77538,99,14736808\n140480,99,13686733\n44726,99,13087967\n64775,99,13080480\n14895,99,13350267\n-1,-1\n-1,-1\n-1,-1\n-1,-1\n159115,7\n-1,-1\n14635,1512\n890029,2\n12263,403\n31643,386\n13416,449\n5594,204\n29859,68\n-1,-1\n-1,-1\n-1,-1\n109537,188\n91086,249\n92002,592\n-1,-1\n64961,596\n3419,156\n207907,6\n-1,-1\n75687,762\n41830,455\n-1,-1\n130828,25\n164821,25\n100946,118\n6563,1000\n202760,28\n133125,179\n171104,217\n130469,184\n108439,25\n-1,-1\n88128,413\n68299,466\n177094,54\n50015,110\n103760,115\n126853,258\n165022,1428\n46729,270\n27133,342\n21062,8\n-1,-1\n-1,-1\n27037,20\n215320,6\n-1,-1\n154289,42\n104259,30\n-1,-1\n218294,22\n-1,-1\n197906,86\n-1,-1\n86572,177\n-1,-1\n-1,-1\n28689,179\n-1,-1\n223859,23\n34128,113\n23940,165\n61722,1\n62789,14\n10282,1051\n-1,-1\n142826,9\n248070,232\n27721,688\n10186,638\n67481,1459';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '../../models/hiscore.enum';
import { ParseOrder } from './parse-order';

/** Deadman: Apocalypse */
/** Scurrius */
export const PO_2024_01_24: ParseOrder = [
SkillEnum.Overall,
SkillEnum.Attack,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { describe, expect, it } from '@jest/globals';
import { BossEnum, MiniGameEnum } from '../../models/hiscore.enum';
import { parseHiscoreString } from '../parser';

describe('Parser with 2024-03-20 parse order', () => {
it('should parse new varlamore p1', () => {
const hiscoreString =
'5438,2277,771059571\n29994,99,28726468\n24068,99,24138705\n4138,99,118840880\n5163,99,114462745\n5476,99,121240041\n4728,99,15105170\n3522,99,63232991\n75127,99,14633301\n17789,99,20856483\n24818,99,14527396\n18871,99,17825689\n28593,99,16436735\n17497,99,15195490\n9333,99,17559129\n24624,99,15386266\n10921,99,14753059\n5175,99,16985186\n36656,99,15348274\n6643,99,32472129\n25900,99,25046544\n12581,99,16085099\n28820,99,14656276\n1508,99,17545515\n-1,-1\n-1,-1\n1414,558\n456,101\n7812,501\n513,800\n1045,5535\n1474,737\n757,2012\n4188,1139\n2201,845\n734,429\n1987,373\n7607,4205\n103,4460\n24587,3616\n130570,176\n1,10050\n67819,375\n79227,751\n10214,703\n15970,1104\n9761,87\n5067,1633\n54518,102\n16067,2093\n81147,218\n8560,241\n28921,165\n764,1322\n49528,320\n49486,164\n21252,200\n50516,511\n60398,555\n55057,478\n20617,50\n17781,519\n31066,965\n79837,402\n15244,753\n10412,233\n35007,325\n28096,889\n14405,4903\n22268,566\n23241,388\n-1,-1\n4791,19\n22948,900\n21430,154\n16282,101\n13729,56\n13113,407\n33866,270\n3102,1177\n44891,127\n2931,114\n-1,-1\n5661,947\n21462,420\n50287,53\n103207,134\n8890,527\n12025,282\n20039,330\n550,635\n1889,5268\n43438,100\n19072,222\n8178,5\n28219,23\n19252,641\n7414,1196\n8339,610\n247228,245\n215871,510\n65643,150\n16910,3752';

const hiscore = parseHiscoreString(hiscoreString, new Date(2024, 2, 20, 12));

expect(hiscore.miniGames[MiniGameEnum.ColosseumGlory]).toEqual({
name: MiniGameEnum.ColosseumGlory,
rank: 1,
score: 10050,
});
expect(hiscore.bosses[BossEnum.KrilTsutsaroth]).toEqual({
name: BossEnum.KrilTsutsaroth,
rank: 23241,
score: 388,
});
expect(hiscore.bosses[BossEnum.LunarChests]).toEqual({
name: BossEnum.LunarChests,
rank: -1,
score: -1,
});
expect(hiscore.bosses[BossEnum.Mimic]).toEqual({
name: BossEnum.Mimic,
rank: 4791,
score: 19,
});
expect(hiscore.bosses[BossEnum.Scurrius]).toEqual({
name: BossEnum.Scurrius,
rank: 44891,
score: 127,
});
expect(hiscore.bosses[BossEnum.SolHeredit]).toEqual({
name: BossEnum.SolHeredit,
rank: -1,
score: -1,
});
expect(hiscore.bosses[BossEnum.Skotizo]).toEqual({
name: BossEnum.Skotizo,
rank: 2931,
score: 114,
});
});
});
Loading

0 comments on commit 8f82554

Please sign in to comment.