From 803e61db5970798a0485a92c121da715825e9fe4 Mon Sep 17 00:00:00 2001 From: TURB042O Date: Fri, 8 Mar 2024 11:54:42 -0600 Subject: [PATCH 1/3] Updated fishing contest button to check for the items of both locations --- .../fishingContestCommand.ts | 48 +++++++++++-------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts b/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts index b622943acd..a76d760c8e 100644 --- a/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts +++ b/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts @@ -18,26 +18,6 @@ import { updateBankSetting } from '../../../lib/util/updateBankSetting'; export async function fishingContestStartCommand(user: MUser, channelID: string, loc: string | undefined) { const currentFishType = getCurrentFishType(); const validLocs = getValidLocationsForFishType(currentFishType); - if (!loc) loc = validLocs[0].name; - const fishingLocation = fishingLocations.find(i => stringMatches(i.name, loc!)); - if (!fishingLocation) { - return `That's not a valid location to fish at, you can fish at these locations: ${fishingLocations - .map(i => `${i.name}(${i.temperature} ${i.water})`) - .join(', ')}.`; - } - - if (!validLocs.includes(fishingLocation)) { - return `This Fishing Location isn't valid for todays catch! These ones are: ${validLocs - .map(i => i.name) - .join(', ')}`; - } - - if (!['Contest rod', "Beginner's tackle box"].every(i => user.hasEquippedOrInBank(i))) { - return 'You need to buy a Contest rod and a tackle box to compete in the Fishing contest.'; - } - if (user.minionIsBusy) { - return 'Your minion is busy.'; - } let quantity = 1; let duration = Math.floor(quantity * Time.Minute * 1.69); let quantityBoosts = []; @@ -55,6 +35,34 @@ export async function fishingContestStartCommand(user: MUser, channelID: string, if (user.hasEquippedOrInBank('Crystal fishing rod')) { quantity++; quantityBoosts.push('1 for Crystal fishing rod'); + + } + + if (!loc) { + for (const location of validLocs) { + if (user.bank.amount(location.bait.id) >= quantity) { + loc = location.name; + } + } + if (!loc) loc = validLocs[0].name; + const fishingLocation = fishingLocations.find(i => stringMatches(i.name, loc!)); + if (!fishingLocation) { + return `That's not a valid location to fish at, you can fish at these locations: ${fishingLocations + .map(i => `${i.name}(${i.temperature} ${i.water})`) + .join(', ')}.`; + } + + if (!validLocs.includes(fishingLocation)) { + return `This Fishing Location isn't valid for todays catch! These ones are: ${validLocs + .map(i => i.name) + .join(', ')}`; + } + + if (!['Contest rod', "Beginner's tackle box"].every(i => user.hasEquippedOrInBank(i))) { + return 'You need to buy a Contest rod and a tackle box to compete in the Fishing contest.'; + } + if (user.minionIsBusy) { + return 'Your minion is busy.'; } const result = await getUsersFishingContestDetails(user); From 8e4631b79867db201b68e8c2a4d98d4be7709584 Mon Sep 17 00:00:00 2001 From: TURB042O Date: Fri, 8 Mar 2024 12:13:40 -0600 Subject: [PATCH 2/3] fix --- src/mahoji/lib/abstracted_commands/fishingContestCommand.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts b/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts index a76d760c8e..73bc895641 100644 --- a/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts +++ b/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts @@ -35,6 +35,7 @@ export async function fishingContestStartCommand(user: MUser, channelID: string, if (user.hasEquippedOrInBank('Crystal fishing rod')) { quantity++; quantityBoosts.push('1 for Crystal fishing rod'); + } } From 11a6e204d9f73762e1cdea196cfae6ce56ac96bc Mon Sep 17 00:00:00 2001 From: TURBO Date: Fri, 8 Mar 2024 18:25:33 +0000 Subject: [PATCH 3/3] lin --- .../fishingContestCommand.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts b/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts index 73bc895641..eebbe91c34 100644 --- a/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts +++ b/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts @@ -35,18 +35,17 @@ export async function fishingContestStartCommand(user: MUser, channelID: string, if (user.hasEquippedOrInBank('Crystal fishing rod')) { quantity++; quantityBoosts.push('1 for Crystal fishing rod'); - } - } +} - if (!loc) { - for (const location of validLocs) { - if (user.bank.amount(location.bait.id) >= quantity) { - loc = location.name; - } - } - if (!loc) loc = validLocs[0].name; - const fishingLocation = fishingLocations.find(i => stringMatches(i.name, loc!)); +if (!loc) { + for (const location of validLocs) { + if (user.bank.amount(location.bait.id) >= quantity) { + loc = location.name; + } + } + if (!loc) loc = validLocs[0].name; + const fishingLocation = fishingLocations.find(i => stringMatches(i.name, loc!)); if (!fishingLocation) { return `That's not a valid location to fish at, you can fish at these locations: ${fishingLocations .map(i => `${i.name}(${i.temperature} ${i.water})`)