Skip to content

Commit

Permalink
Merge branch 'bso' of github.com:oldschoolgg/oldschoolbot into bso
Browse files Browse the repository at this point in the history
  • Loading branch information
gc committed Feb 27, 2024
2 parents b6c9ccf + 41b0828 commit a74912d
Show file tree
Hide file tree
Showing 19 changed files with 144 additions and 376 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@fastify/sensible": "^5.2.0",
"@napi-rs/canvas": "0.1.38",
"@octokit/graphql": "^4.8.0",
"@oldschoolgg/toolkit": "^0.0.23",
"@oldschoolgg/toolkit": "^0.0.24",
"@prisma/client": "^5.10.2",
"@sapphire/stopwatch": "^1.4.0",
"@sapphire/time-utilities": "^1.6.0",
Expand All @@ -47,7 +47,7 @@
"murmurhash": "^2.0.1",
"node-cron": "^3.0.3",
"node-fetch": "^2.6.7",
"oldschooljs": "^2.3.8",
"oldschooljs": "^2.5.0",
"p-queue": "^6.6.2",
"piscina": "^4.3.2",
"random-js": "^2.1.0",
Expand Down
4 changes: 4 additions & 0 deletions src/lib/bankImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ const forcedShortNameMap = new Map<number, string>([
[i('Holy scythe of vitur (uncharged)'), 'Unch.'],
[i('Sanguine scythe of vitur (uncharged)'), 'Unch.'],

// Ore Packs
[27_019, 'GF Pack'],
[27_693, 'VM Pack'],

// BSO exclusive misc
[i('Athelas'), 'athelas'],
[i('Athelas seed'), 'athelas'],
Expand Down
9 changes: 6 additions & 3 deletions src/lib/data/CollectionsExport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1662,7 +1662,12 @@ export const troubleBrewingCL = resolveItems([
'Blue rum (trouble brewing)',
'Jolly roger cape'
]);
export const volcanicMineCL = resolveItems(['Ash covered tome', 'Large water container', 'Volcanic mine teleport']);
export const volcanicMineCL = resolveItems([
'Ash covered tome',
'Large water container',
'Volcanic mine teleport',
'Dragon pickaxe (broken)'
]);
export const anglerOutfit = resolveItems(['Angler hat', 'Angler top', 'Angler waders', 'Angler boots']);
export const aerialFishingCL = resolveItems([
'Golden tench',
Expand Down Expand Up @@ -2893,8 +2898,6 @@ export const LMSBuyables: LMSBuyable[] = [
{ item: getOSItem('Guthixian icon'), cost: 500 },
{ item: getOSItem('Trouver parchment'), cost: 18 },
{ item: getOSItem('Wilderness crabs teleport'), cost: 1 },
{ item: getOSItem('Blighted bind sack'), quantity: 300, cost: 1 },
{ item: getOSItem('Blighted snare sack'), quantity: 150, cost: 1 },
{ item: getOSItem('Blighted entangle sack'), quantity: 70, cost: 1 },
{ item: getOSItem('Blighted teleport spell sack'), quantity: 50, cost: 1 },
{ item: getOSItem('Blighted vengeance sack'), quantity: 50, cost: 1 },
Expand Down
2 changes: 1 addition & 1 deletion src/lib/data/buyables/bsoBuyables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export const bsoBuyables: Buyable[] = [
},
{
name: 'Wooden spoon',
gpCost: 1000,
gpCost: 2000,
outputItems: new Bank().add('Wooden spoon')
}
];
10 changes: 5 additions & 5 deletions src/lib/data/buyables/buyables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ const questBuyables: Buyable[] = [
name: 'Berserker helm',
gpCost: 780_000,
qpRequired: 60,
ironmanPrice: 78_000
ironmanPrice: 98_000
},
{
name: 'Archer helm',
Expand Down Expand Up @@ -851,7 +851,7 @@ const Buyables: Buyable[] = [
{
name: 'Bucket',
gpCost: 30,
ironmanPrice: 5
ironmanPrice: 10
},
{
name: 'Cup of hot water',
Expand Down Expand Up @@ -990,7 +990,7 @@ const Buyables: Buyable[] = [
{
name: 'Steel pickaxe',
gpCost: 2000,
ironmanPrice: 500
ironmanPrice: 600
},
{
name: 'Mithril pickaxe',
Expand Down Expand Up @@ -1060,7 +1060,7 @@ const Buyables: Buyable[] = [
{
name: 'Adamant halberd',
gpCost: 100_000,
ironmanPrice: 9600,
ironmanPrice: 50_000,
qpRequired: 150,
skillsNeeded: soteSkillRequirements
},
Expand Down Expand Up @@ -1218,7 +1218,7 @@ for (const cape of allTeamCapes) {
Buyables.push({
name: cape.name,
outputItems: new Bank().add(cape.id),
gpCost: 5000
gpCost: 15_000
});
}

Expand Down
4 changes: 4 additions & 0 deletions src/lib/data/itemAliases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ setItemAlias(11_901, 'Decorative quiver');
// Lamp (Genie event)
setItemAlias(2528, 'Genie lamp');

// Ore Sack
setItemAlias(27_019, "Ore pack (Giant's Foundry)");
setItemAlias(27_693, 'Ore pack (Volcanic Mine)');

// Birds eggs
setItemAlias(5076, 'Red bird egg');
setItemAlias(5077, 'Blue bird egg');
Expand Down
1 change: 0 additions & 1 deletion src/lib/deletedItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export const itemsToDelete = [
[26_701, "Saika's hood (broken)"],
[26_702, "Saika's veil (broken)"],
[26_703, "Saika's shroud (broken)"],
[26_704, 'Blighted wave sack'],
[26_705, 'Blighted surge sack'],
[26_706, 'Scroll of imbuing'],
[26_707, 'Dragon claws ornament kit'],
Expand Down
16 changes: 12 additions & 4 deletions src/lib/openables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,12 +398,20 @@ const osjsOpenables: UnifiedOpenable[] = [
allItems: Openables.SinisterChest.table.allItems
},
{
name: 'Ore pack',
name: "Ore pack (Giant's Foundry)",
id: 27_019,
openedItem: getOSItem(27_019),
aliases: ['ore pack'],
output: Openables.OrePack.table,
allItems: Openables.OrePack.table.allItems
aliases: ["ore pack (giant's foundry)", 'giants', 'foundry', 'giants foundry'],
output: Openables.GiantsFoundryOrePack.table,
allItems: Openables.GiantsFoundryOrePack.table.allItems
},
{
name: 'Ore pack (Volcanic Mine)',
id: 27_693,
openedItem: getOSItem(27_693),
aliases: ['ore pack (volcanic mine)', 'volcanic', 'volcanic mine'],
output: Openables.VolcanicMineOrePack.table,
allItems: Openables.VolcanicMineOrePack.table.allItems
},
{
name: 'Intricate pouch',
Expand Down
10 changes: 2 additions & 8 deletions src/lib/simulation/tob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Bank, LootTable } from 'oldschooljs';
import { LootBank } from 'oldschooljs/dist/meta/types';
import { convertLootBanksToItemBanks, JSONClone } from 'oldschooljs/dist/util';

import { BOT_TYPE } from '../constants';
import { TOBRooms } from '../data/tob';
import { assert } from '../util/logError';

Expand Down Expand Up @@ -94,9 +93,6 @@ export class TheatreOfBloodClass {
return new Bank().add('Cabbage');
}

if (BOT_TYPE === 'BSO') {
NonUniqueTable.tertiary(25, 'Clue scroll (elite)');
}
const loot = new Bank();
for (let i = 0; i < 3; i++) {
loot.add(NonUniqueTable.roll());
Expand All @@ -111,10 +107,8 @@ export class TheatreOfBloodClass {
loot.add(HardModeExtraTable.roll());
}

if (BOT_TYPE === 'OSB') {
if (roll(25)) {
loot.add('Clue scroll (elite)');
}
if (roll(25)) {
loot.add('Clue scroll (elite)');
}

let petChance = isHardMode ? 500 : 650;
Expand Down
7 changes: 6 additions & 1 deletion src/mahoji/commands/sacrifice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ const noSacPrice = resolveItems([
'Helm of neitiznot',
'Cannon barrels',
'Broad arrowheads',
'Rope'
'Rope',
'Eye of newt',
'Bronze pickaxe',
'Iron pickaxe',
'Red dye',
'Cannon furnace'
]);

export function sacrificePriceOfItem(item: Item, qty: number) {
Expand Down
3 changes: 2 additions & 1 deletion src/mahoji/commands/tames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1529,6 +1529,7 @@ export function determineTameClueResult({
const base = exponentialPercentScale(50, 0.03);
const boostPercent = Math.max(0, s / 1.5 - base / 1.5);

timePerClue = reduceNumByPercent(timePerClue, boostPercent);
boosts.push(`${boostPercent.toFixed(2)}% faster for support level`);

if (equippedPrimary === itemID('Divine ring')) {
Expand All @@ -1540,7 +1541,7 @@ export function determineTameClueResult({
const duration = Math.floor(quantity * timePerClue);

const baseCost = (ClueTiers.indexOf(clueTier) + 1) * quantity;
const kibbleNeeded = Math.ceil(baseCost / 1.5);
const kibbleNeeded = Math.ceil(baseCost / 2);
const cost = new Bank().add('Extraordinary kibble', kibbleNeeded).add(clueTier.scrollID, quantity);

let costSavedByDemonicJibwings = null;
Expand Down
4 changes: 2 additions & 2 deletions src/mahoji/lib/abstracted_commands/giantsFoundryCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ export const giantsFoundryBuyables: { name: string; output: Bank; cost: number;
aliases: []
},
{
name: 'Ore pack',
output: new Bank().add('Ore pack', 1),
name: "Ore pack (Giant's Foundry)",
output: new Bank().add("Ore pack (Giant's Foundry)", 1),
cost: 200,
aliases: []
},
Expand Down
6 changes: 6 additions & 0 deletions src/mahoji/lib/abstracted_commands/volcanicMineCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ export const VolcanicMineShop: { name: string; output: Bank; cost: number; clOnl
output: new Bank({ Pyrophosphite: 1 }),
cost: 70
},
{
name: 'Ore pack (Volcanic Mine)',
output: new Bank({ 'Ore pack (Volcanic Mine)': 1 }),
cost: 4000,
addToCl: true
},
{
name: 'Volcanic mine teleport',
output: new Bank({ 'Volcanic mine teleport': 1 }),
Expand Down
12 changes: 6 additions & 6 deletions tests/integration/commands/sacrifice.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,28 @@ describe('Sacrifice Command', async () => {
expect(result).toEqual(
`${Emoji.Incinerator} **Your Sacrifice Stats** ${Emoji.Incinerator}\n\n` +
`**Current Minion Icon:** ${Emoji.Minion}\n` +
'**Sacrificed Value:** 1,635 GP\n' +
'**Sacrificed Value:** 1,909 GP\n' +
'**Unique Items Sacrificed:** 2 items'
);
});

test('No items provided', async () => {
const result = await user.runCommand(sacrificeCommand, { items: 'aaaa' });
expect(result).toEqual('No items were provided.\nYour current sacrificed value is: 1,635 (1.64k)');
expect(result).toEqual('No items were provided.\nYour current sacrificed value is: 1,909 (1.91k)');
});

test('Successful', async () => {
await user.addItemsToBank({ items: new Bank().add('Trout').add('Coal', 10) });
const result = await user.runCommand(sacrificeCommand, { items: '1 trout, 10 coal' });
expect(result).toEqual(
'You sacrificed 10x Coal, 1x Trout, with a value of 1,635gp (1.64k). Your total amount sacrificed is now: 3,270. '
'You sacrificed 10x Coal, 1x Trout, with a value of 1,909gp (1.91k). Your total amount sacrificed is now: 3,818. '
);
const stats = await user.fetchStats({ sacrificed_bank: true });
expect(user.bank.equals(new Bank())).toBe(true);
expect(new Bank(stats.sacrificed_bank as ItemBank).equals(new Bank().add('Coal', 20).add('Trout', 2))).toBe(
true
);
expect(user.user.sacrificedValue).toEqual(BigInt(3270));
expect(user.user.sacrificedValue).toEqual(BigInt(3818));
const clientSettings = await mahojiClientSettingsFetch({ economyStats_sacrificedBank: true });
expect(
new Bank(clientSettings.economyStats_sacrificedBank as ItemBank).equals(
Expand All @@ -49,15 +49,15 @@ describe('Sacrifice Command', async () => {
await user.addItemsToBank({ items: new Bank().add('Trout').add('Cake') });
const res = await user.runCommand(sacrificeCommand, { items: '1 trout, 1 cake' });
expect(res).toEqual(
'You sacrificed 1x Trout, 1x Cake, with a value of 206gp (206). Your total amount sacrificed is now: 3,476. '
'You sacrificed 1x Trout, 1x Cake, with a value of 156gp (156). Your total amount sacrificed is now: 3,974. '
);
await user.sync();
expect(user.bank.equals(new Bank())).toBe(true);
const stats2 = await user.fetchStats({ sacrificed_bank: true });
expect(
new Bank(stats2.sacrificed_bank as ItemBank).equals(new Bank().add('Coal', 20).add('Trout', 3).add('Cake'))
).toBe(true);
expect(user.user.sacrificedValue).toEqual(BigInt(3476));
expect(user.user.sacrificedValue).toEqual(BigInt(3974));

const clientSettings2 = await mahojiClientSettingsFetch({ economyStats_sacrificedBank: true });
expect(
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/parseStringBank.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,21 +394,21 @@ describe('Bank Parsers', () => {
expect(
parseBank({
inputBank: usersBank,
inputStr: 'snakeweed mixture, 1 an indigo pentagon, an indigo square, tmb'
inputStr: 'snakeweed mixture, 1 indigo pentagon, indigo square, tmb'
}).toString()
).toEqual('6x Tradeable Mystery Box');

expect(
parseBank({
inputBank: usersBank,
inputStr: 'snakeweed mixture, 1 an indigo pentagon, an indigo square, mystery box'
inputStr: 'snakeweed mixture, 1 indigo pentagon, indigo square, mystery box'
}).toString()
).toEqual('No items');

expect(
parseBank({
inputBank: usersBank,
inputStr: 'snake@w-eed miXture, 0 doug, 1 lil lamb, 1 an indigo pentagon, an indigo square, mystery box'
inputStr: 'snake@w-eed miXture, 0 doug, 1 lil lamb, 1 indigo pentagon, indigo square, mystery box'
}).toString()
).toEqual('3x Doug, 1x Lil Lamb');

Expand Down
Loading

0 comments on commit a74912d

Please sign in to comment.