From 2e8a51e593b4b014d89d7947c656673a80a991c2 Mon Sep 17 00:00:00 2001 From: TastyPumPum <79149170+TastyPumPum@users.noreply.github.com> Date: Fri, 8 Nov 2024 18:19:39 +0000 Subject: [PATCH] Fixes --- src/lib/types/minions.ts | 2 +- src/lib/util/repeatStoredTrip.ts | 2 +- src/mahoji/lib/abstracted_commands/sepulchreCommand.ts | 7 ++++--- src/tasks/minions/minigames/sepulchreActivity.ts | 10 ++++++++-- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/lib/types/minions.ts b/src/lib/types/minions.ts index 79013aba60..a1010d8592 100644 --- a/src/lib/types/minions.ts +++ b/src/lib/types/minions.ts @@ -401,7 +401,7 @@ export interface SepulchreActivityTaskOptions extends MinigameActivityTaskOption type: 'Sepulchre'; floors: number[]; fletch?: { - fletchable: Fletchable; + fletchableName: string; fletchingQuantity: number; }; } diff --git a/src/lib/util/repeatStoredTrip.ts b/src/lib/util/repeatStoredTrip.ts index ba239efdcd..ef3ac1f524 100644 --- a/src/lib/util/repeatStoredTrip.ts +++ b/src/lib/util/repeatStoredTrip.ts @@ -541,7 +541,7 @@ const tripHandlers = { [activity_type_enum.Sepulchre]: { commandName: 'minigames', args: (data: SepulchreActivityTaskOptions) => { - const fletch = data.fletch?.fletchable ? data.fletch.fletchable.name : undefined; + const fletch = data.fletch?.fletchableName; return { sepulchre: { start: { fletching: fletch } } }; } }, diff --git a/src/mahoji/lib/abstracted_commands/sepulchreCommand.ts b/src/mahoji/lib/abstracted_commands/sepulchreCommand.ts index dd191adcaf..30f96aef02 100644 --- a/src/mahoji/lib/abstracted_commands/sepulchreCommand.ts +++ b/src/mahoji/lib/abstracted_commands/sepulchreCommand.ts @@ -33,7 +33,7 @@ export async function sepulchreCommand(user: MUser, channelID: string, fletching } if (!userHasGracefulEquipped(user)) { - return 'You need Graceful equipped in your Skilling setup to do the Hallowed Sepulchre.'; + return 'You need Graceful equipped in any setup to do the Hallowed Sepulchre.'; } let fletchingQuantity = 0; @@ -62,6 +62,7 @@ export async function sepulchreCommand(user: MUser, channelID: string, fletching const tripLength = maxLaps * lapLength; let itemsNeeded: Bank | undefined; + const userBank = user.bankWithGP; let sets = 'x'; let timeToFletchSingleItem = 0; @@ -107,7 +108,7 @@ export async function sepulchreCommand(user: MUser, channelID: string, fletching if (max < fletchingQuantity && max !== 0) fletchingQuantity = max; itemsNeeded = fletchable.inputItems.clone().multiply(fletchingQuantity); - if (!user.bank.has(itemsNeeded.bank)) { + if (!userBank.has(itemsNeeded)) { return `You don't have enough items. For ${fletchingQuantity}x ${fletchable.name}, you're missing **${itemsNeeded .clone() .remove(user.bank)}**.`; @@ -124,7 +125,7 @@ export async function sepulchreCommand(user: MUser, channelID: string, fletching type: 'Sepulchre', channelID: channelID.toString(), minigameID: 'sepulchre', - fletch: fletchable ? { fletchable, fletchingQuantity } : undefined + fletch: fletchable ? { fletchableName: fletchable.name, fletchingQuantity } : undefined }); let str = `${user.minionName} is now doing ${maxLaps} laps of the Sepulchre, in each lap they are doing floors ${ diff --git a/src/tasks/minions/minigames/sepulchreActivity.ts b/src/tasks/minions/minigames/sepulchreActivity.ts index 012d37e473..0b28e2076b 100644 --- a/src/tasks/minions/minigames/sepulchreActivity.ts +++ b/src/tasks/minions/minigames/sepulchreActivity.ts @@ -4,6 +4,7 @@ import { GrandHallowedCoffin } from 'oldschooljs/dist/simulation/misc/GrandHallo import { trackLoot } from '../../../lib/lootTrack'; import { openCoffin, sepulchreFloors } from '../../../lib/minions/data/sepulchre'; import { incrementMinigameScore } from '../../../lib/settings/settings'; +import { zeroTimeFletchables } from '../../../lib/skilling/skills/fletching/fletchables'; import { SkillsEnum } from '../../../lib/skilling/types'; import type { SepulchreActivityTaskOptions } from '../../../lib/types/minions'; import { roll } from '../../../lib/util'; @@ -49,7 +50,12 @@ export const sepulchreTask: MinionTask = { const fletchingLoot = new Bank(); if (fletch) { - const fletchable = fletch.fletchable; + const fletchable = zeroTimeFletchables.find(item => item.name === fletch.fletchableName); + + if (!fletchable) { + throw new Error(`Fletchable item ${fletch.fletchableName} not found.`); + } + fletchQuantity = fletch.fletchingQuantity; if (fletchable.outputMultiple) { @@ -123,7 +129,7 @@ export const sepulchreTask: MinionTask = { itemsToAdd: fletchingLoot }); - str += `\nYou also finished fletching ${fletchQuantity}${sets} ${fletch.fletchable.name}, and received ${fletchingLoot}. ${fletchXpRes}.`; + str += `\nYou also finished fletching ${fletchQuantity}${sets} ${fletch.fletchableName}, and received ${fletchingLoot}. ${fletchXpRes}.`; } handleTripFinish(user, channelID, str, image.file.attachment, data, itemsAdded);