Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gc committed Sep 25, 2024
1 parent 83f3be9 commit 2375c00
Show file tree
Hide file tree
Showing 19 changed files with 134 additions and 186 deletions.
26 changes: 22 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,26 @@
"name": "oldschooljs",
"version": "2.6.0",
"description": "Allows you to interact with the OSRS Hiscores, Wiki, Items, & more.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/types/index.d.ts",
"exports": {
".": {
"require": "./dist/cjs/index.js",
"import": "./dist/esm/index.js",
"types": "./dist/types/index.d.ts"
},
"./dist/*": {
"require": "./dist/cjs/*.js",
"import": "./dist/esm/*.js",
"types": "./dist/types/*.d.ts"
},
"./dist/util/": {
"require": "./dist/cjs/*.js",
"import": "./dist/esm/*.js",
"types": "./dist/types/util/util.d.ts"
}
},
"license": "MIT",
"repository": {
"type": "git",
Expand All @@ -12,7 +30,7 @@
"scripts": {
"test": "tsc --noEmit -p src && concurrently \"yarn test:lint\" \"yarn test:unit\" \"tsc --noEmit -p test\"",
"test:unit": "vitest run --coverage",
"build": "tsc -p src && tsx scripts/minifyDist.ts",
"build": "tsc -p src && node esbuild.js",
"prepare": "tsx scripts/prepare",
"dev": "yarn prepare && yarn lint && yarn build && yarn test",
"lint": "biome check --write --diagnostic-level=error",
Expand All @@ -35,6 +53,6 @@
"vitest": "^1.6.0"
},
"keywords": ["runescape"],
"files": ["dist", "package.json"],
"files": ["dist/", "dist/cjs", "dist/esm", "dist/types"],
"packageManager": "[email protected]"
}
13 changes: 0 additions & 13 deletions scripts/minifyDist.ts

This file was deleted.

14 changes: 12 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { EMonster } from "./EMonster";
import * as constants from "./constants";
import { MonsterSlayerMaster } from "./meta/monsterData";
import { MonsterKillOptions } from "./meta/types";
import * as Clues from "./simulation/clues";
import * as Misc from "./simulation/misc";
import Monsters from "./simulation/monsters/index";
import Openables from "./simulation/openables/index";
Expand All @@ -12,12 +11,13 @@ import Hiscores from "./structures/Hiscores";
import Items from "./structures/Items";
import LootTable from "./structures/LootTable";
import Player from "./structures/Player";
import SimpleMonster from "./structures/SimpleMonster";
import Wiki from "./structures/Wiki";
import * as Util from "./util/";
export * from "./simulation/clues";

export {
Bank,
Clues,
constants,
Hiscores,
Items,
Expand All @@ -32,9 +32,19 @@ export {
Wiki,
EItem,
EMonster,
SimpleMonster,
};

export * from "./simulation/monsters";
export * from "./constants";
export * from "./util";
export * from "./data/itemConstants";
export * from "./structures/Items";
export * from "./meta/types";
export type { default as Monster } from "./structures/Monster";
export * from "./simulation/clues";
export * from "./simulation/openables";
export * from "./simulation/misc";
export * from "./simulation/openables/Implings";
export * from "./meta/monsterData";
export * from "./simulation/subtables/index";
17 changes: 1 addition & 16 deletions src/simulation/clues/Beginner.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import Bank from "../../structures/Bank";
import Clue from "../../structures/Clue";
import LootTable from "../../structures/LootTable";

export const RareTable = new LootTable()
Expand Down Expand Up @@ -85,17 +83,4 @@ export const StandardTable = new LootTable()
.add(RareTable);

export const BeginnerClueTable = new LootTable().add(StandardTable, 1, 11).add(UniqueTable, 1, 1);

const MainTable = new LootTable().add(BeginnerClueTable, [1, 3]);

export class BeginnerCasket extends Clue {
open(quantity: number, targetBank?: undefined): Bank;
open(quantity: number, targetBank: Bank): null;
public open(quantity: number, targetBank?: Bank): Bank | null {
const loot = targetBank ?? new Bank();
MainTable.roll(quantity, { targetBank: loot });
return loot;
}
}

export default new BeginnerCasket({ table: BeginnerClueTable });
export const BeginnerCasket = new LootTable().add(BeginnerClueTable, [1, 3]);
19 changes: 2 additions & 17 deletions src/simulation/clues/Easy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import Bank from "../../structures/Bank";
import Clue from "../../structures/Clue";
import LootTable from "../../structures/LootTable";
import { itemID } from "../../util";
import { BlessingTable, FirelighterTable, PrayerPageTable, TeleportScrollTable } from "./General";
Expand Down Expand Up @@ -186,18 +184,5 @@ export const EasyStandardTable = new LootTable()
.add(TeleportScrollTable);

export const EasyClueTable = new LootTable().add(EasyStandardTable, 1, 11).add(EasyRareTable, 1, 1);

const MainTable = new LootTable().add(EasyClueTable, [2, 4]).tertiary(50, "Clue scroll (master)");
export class EasyCasket extends Clue {
open(quantity: number, targetBank?: undefined): Bank;
open(quantity: number, targetBank: Bank): null;
public open(quantity: number, targetBank?: Bank): Bank | null {
const loot = targetBank ?? new Bank();
MainTable.roll(quantity, { targetBank: loot });
return loot;
}
}

const easyCasket = new EasyCasket({ table: EasyClueTable });
easyCasket.allItems.push(itemID("Clue scroll (master)"));
export default easyCasket;
export const EasyCasket = new LootTable().add(EasyClueTable, [2, 4]).tertiary(50, "Clue scroll (master)");
EasyCasket.allItems.push(itemID("Clue scroll (master)"));
19 changes: 2 additions & 17 deletions src/simulation/clues/Elite.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import Bank from "../../structures/Bank";
import Clue from "../../structures/Clue";
import LootTable from "../../structures/LootTable";
import { itemID } from "../../util";
import {
Expand Down Expand Up @@ -150,18 +148,5 @@ export const EliteStandardTable = new LootTable()
.add(BlessingTable);

export const EliteClueTable = new LootTable().add(EliteStandardTable, 1, 24).add(EliteRareTable, 1, 1);
const MainTable = new LootTable().add(EliteClueTable, [4, 6]).tertiary(5, "Clue scroll (master)");

export class EliteCasket extends Clue {
open(quantity: number, targetBank?: undefined): Bank;
open(quantity: number, targetBank: Bank): null;
public open(quantity: number, targetBank?: Bank): Bank | null {
const loot = targetBank ?? new Bank();
MainTable.roll(quantity, { targetBank: loot });
return loot;
}
}

const eliteCasket = new EliteCasket({ table: EliteClueTable });
eliteCasket.allItems.push(itemID("Clue scroll (master)"));
export default eliteCasket;
export const EliteCasket = new LootTable().add(EliteClueTable, [4, 6]).tertiary(5, "Clue scroll (master)");
EliteCasket.allItems.push(itemID("Clue scroll (master)"));
19 changes: 2 additions & 17 deletions src/simulation/clues/Hard.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import Bank from "../../structures/Bank";
import Clue from "../../structures/Clue";
import LootTable from "../../structures/LootTable";
import { itemID, itemTupleToTable } from "../../util";
import { BlessingTable, FirelighterTable, GildedTable, PrayerPageTable, TeleportScrollTable } from "./General";
Expand Down Expand Up @@ -206,18 +204,5 @@ export const HardStandardTable = new LootTable()
.add(HardBowTable);

export const HardClueTable = new LootTable().add(HardStandardTable, 1, 12).add(HardRareTable, 1, 1);
const MainTable = new LootTable().add(HardClueTable, [4, 6]).tertiary(15, "Clue scroll (master)");

export class HardCasket extends Clue {
open(quantity: number, targetBank?: undefined): Bank;
open(quantity: number, targetBank: Bank): null;
public open(quantity: number, targetBank?: Bank): Bank | null {
const loot = targetBank ?? new Bank();
MainTable.roll(quantity, { targetBank: loot });
return loot;
}
}

const hardCasket = new HardCasket({ table: HardClueTable });
hardCasket.allItems.push(itemID("Clue scroll (master)"));
export default hardCasket;
export const HardCasket = new LootTable().add(HardClueTable, [4, 6]).tertiary(15, "Clue scroll (master)");
HardCasket.allItems.push(itemID("Clue scroll (master)"));
16 changes: 1 addition & 15 deletions src/simulation/clues/Master.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import Bank from "../../structures/Bank";
import Clue from "../../structures/Clue";
import LootTable from "../../structures/LootTable";
import {
BlessingTable,
Expand Down Expand Up @@ -159,16 +157,4 @@ export const MasterStandardTable = new LootTable()

export const MasterClueTable = new LootTable().add(MasterStandardTable, 1, 22).add(MasterRareTable, 1, 1);

const MainTable = new LootTable().add(MasterClueTable, [5, 7]).tertiary(1000, "Bloodhound");

export class MasterCasket extends Clue {
open(quantity: number, targetBank?: undefined): Bank;
open(quantity: number, targetBank: Bank): null;
public open(quantity: number, targetBank?: Bank): Bank | null {
const loot = targetBank ?? new Bank();
MainTable.roll(quantity, { targetBank: loot });
return loot;
}
}

export default new MasterCasket({ table: MasterClueTable });
export const MasterCasket = new LootTable().add(MasterClueTable, [5, 7]).tertiary(1000, "Bloodhound");
19 changes: 1 addition & 18 deletions src/simulation/clues/Medium.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import Bank from "../../structures/Bank";
import Clue from "../../structures/Clue";
import LootTable from "../../structures/LootTable";
import { itemID } from "../../util";
import { BlessingTable, PrayerPageTable, TeleportScrollTable } from "./General";

export const MediumUnicornTable = new LootTable().add("White unicorn mask").add("Black unicorn mask");
Expand Down Expand Up @@ -171,18 +168,4 @@ export const MediumStandardTable = new LootTable()

export const MediumClueTable = new LootTable().add(MediumStandardTable, 1, 10).add(MediumRareTable, 1, 1);

const MainTable = new LootTable().add(MediumClueTable, [3, 5]).tertiary(30, "Clue scroll (master)");

export class MediumCasket extends Clue {
open(quantity: number, targetBank?: undefined): Bank;
open(quantity: number, targetBank: Bank): null;
public open(quantity: number, targetBank?: Bank): Bank | null {
const loot = targetBank ?? new Bank();
MainTable.roll(quantity, { targetBank: loot });
return loot;
}
}

const mediumCasket = new MediumCasket({ table: MediumClueTable });
mediumCasket.allItems.push(itemID("Clue scroll (master)"));
export default mediumCasket;
export const MediumCasket = new LootTable().add(MediumClueTable, [3, 5]).tertiary(30, "Clue scroll (master)");
22 changes: 15 additions & 7 deletions src/simulation/clues/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
import Beginner from "./Beginner";
import Easy from "./Easy";
import Elite from "./Elite";
import Hard from "./Hard";
import Master from "./Master";
import Medium from "./Medium";
import { BeginnerCasket as Beginner } from "./Beginner";
import { EasyCasket as Easy } from "./Easy";
import { EliteCasket as Elite } from "./Elite";
import { HardCasket as Hard } from "./Hard";
import { MasterCasket as Master } from "./Master";
import { MediumCasket as Medium } from "./Medium";

export const Clues = {
Beginner,
Easy,
Elite,
Hard,
Master,
Medium,
};

export * from "./Beginner";
export * from "./Easy";
export * from "./Elite";
export * from "./Hard";
export * from "./Master";
export * from "./Medium";
export { Beginner, Easy, Elite, Hard, Master, Medium };
16 changes: 0 additions & 16 deletions src/simulation/misc/GrandHallowedCoffin.ts

This file was deleted.

16 changes: 0 additions & 16 deletions src/simulation/misc/Mimic.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import Bank from "../../structures/Bank";
import Clue from "../../structures/Clue";
import LootTable from "../../structures/LootTable";

type MimicClueTier = "master" | "elite";

export const Mimic3rdAgeTable = new LootTable()
.add("3rd age range coif")
.add("3rd age range top")
Expand Down Expand Up @@ -52,15 +48,3 @@ export const MasterMimicTable = new LootTable()
.add("Grimy ranarr weed", 25, 2)
.add("Raw manta ray", 15, 2)
.add("Wine of zamorak", 25, 2);

class MimicCasket extends Clue {
public open(tier: MimicClueTier = "master", quantity = 1) {
const loot = new Bank();
for (let i = 0; i < quantity; i++) {
loot.add(tier.toLowerCase() === "elite" ? EliteMimicTable.roll() : MasterMimicTable.roll());
}
return loot;
}
}

export default new MimicCasket({ table: MasterMimicTable });
34 changes: 21 additions & 13 deletions src/simulation/misc/index.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
import LootTable from "../../structures/LootTable";
import { BarbarianAssault } from "./BarbarianAssault";
import { ChambersOfXeric } from "./ChambersOfXeric";
import { FishingTrawler } from "./FishingTrawler";
import { Gauntlet } from "./Gauntlet";
import Mimic from "./Mimic";
import Nightmare from "./Nightmare";
import { Tempoross } from "./Tempoross";
import { TheatreOfBlood } from "./TheatreOfBlood";
import Zalcano from "./Zalcano";

export {
BarbarianAssault,
ChambersOfXeric,
FishingTrawler,
Gauntlet,
Mimic,
Nightmare,
Tempoross,
TheatreOfBlood,
Zalcano,
};
export const GrandHallowedCoffin = new LootTable()
.every("Hallowed mark", [8, 10])
.tertiary(200, "Ring of endurance (uncharged)")
.tertiary(30, "Clue scroll (elite)")
.add("Rune 2h sword")
.add("Rune platebody")
.add("Law rune", [150, 250])
.add("Blood rune", [150, 250])
.add("Soul rune", [150, 250])
.add("Runite bolts", [100, 300])
.add("Monkfish", [2, 6])
.add("Sanfew serum(4)", [1, 2])
.add("Ranarr seed", [1, 2])
.add("Coins", [17_500, 25_000]);

export { BarbarianAssault, ChambersOfXeric, FishingTrawler, Gauntlet, Nightmare, Tempoross, Zalcano };

export * from "./Mimic";
export * from "./TheatreOfBlood";
export type { ChambersOfXericOptions } from "./ChambersOfXeric";
Loading

0 comments on commit 2375c00

Please sign in to comment.