Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix baxtorian Bathhouses loot image #5932

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions src/lib/baxtorianBathhouses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import { calcMaxTripLength } from './util/calcMaxTripLength';
import getOSItem from './util/getOSItem';
import { handleTripFinish } from './util/handleTripFinish';
import { makeBankImage } from './util/makeBankImage';
import resolveItems, { resolveOSItems } from './util/resolveItems';
import { updateBankSetting } from './util/updateBankSetting';

Expand Down Expand Up @@ -292,7 +293,7 @@
const warmthNeeded = bathHouseTier.warmthPerBath * quantity;
const herbsNeeded = calcHerbsNeeded(quantity);

let oreToUse = ore

Check warning on line 296 in src/lib/baxtorianBathhouses.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Unexpected value in conditional. A boolean expression is required

Check warning on line 296 in src/lib/baxtorianBathhouses.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Unexpected value in conditional. A boolean expression is required
? typeof ore === 'number'
? BathhouseOres.find(o => stringMatches(o.item.id, ore))
: BathhouseOres.find(o => stringMatches(o.item.name, ore))
Expand Down Expand Up @@ -358,7 +359,7 @@
if (!user.owns(cost)) {
return `You don't have enough supplies to do a trip, for ${quantity}x ${bathHouseTier.name} baths, you need: ${cost}.`;
}
updateBankSetting('bb_cost', cost);
await updateBankSetting('bb_cost', cost);
await user.removeItemsFromBank(cost);

await addSubTaskToActivityTask<BathhouseTaskOptions>({
Expand Down Expand Up @@ -473,7 +474,12 @@
}
}

await user.addItemsToBank({ items: loot, collectionLog: true });
const { previousCL, itemsAdded } = await transactItems({
userID: user.id,
collectionLog: true,
itemsToAdd: loot
});

let xpStr = await user.addXP({ skillName: SkillsEnum.Herblore, amount: herbXP, duration });
xpStr += '\n';
xpStr += await user.addXP({
Expand All @@ -483,15 +489,16 @@
});

let uniqSpecies = uniqueArr(speciesServed);
updateBankSetting('bb_loot', loot);
await updateBankSetting('bb_loot', loot);

const bankImage = await bankImageGenerator.generateBankImage({
bank: loot,
const bankImage = await makeBankImage({
bank: itemsAdded,
title: 'Baxtorian Bathhouses Loot',
user,
title: 'Baxtorian Bathhouses Loot'
previousCL
});

handleTripFinish(
return handleTripFinish(
user,
channelID,
`${userMention(userID)}, ${user.minionName} finished running ${quantity}x ${tier.name} baths for ${
Expand All @@ -502,7 +509,7 @@
: ''
}
${xpStr}`,
bankImage.image,
bankImage.file.attachment,
data,
loot
);
Expand Down
Loading