From b5444858668af7f09f427383bdbcf036aa0d6634 Mon Sep 17 00:00:00 2001 From: TURB042O Date: Fri, 8 Mar 2024 09:00:37 -0600 Subject: [PATCH 1/7] updated the `fishingContestStartCommand()` function to check for the items of both locations --- .../fishingContestCommand.ts | 49 +++++++++++-------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts b/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts index b622943acd..b2e821c15d 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,35 @@ export async function fishingContestStartCommand(user: MUser, channelID: string, if (user.hasEquippedOrInBank('Crystal fishing rod')) { quantity++; quantityBoosts.push('1 for Crystal fishing rod'); + } if (true) { + + } + + if (!loc) { + for (const location of validLocs) { + if (user.bank.amount(location.bait.id) >= quanity) { + loc = location.name; + } + } + if (!loc) loc = validLocs[0].name; + } + 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 8df2af9fc77834a142210019678e10d24248bb3a Mon Sep 17 00:00:00 2001 From: TURBO Date: Fri, 8 Mar 2024 15:14:49 +0000 Subject: [PATCH 2/7] lint --- .../abstracted_commands/fishingContestCommand.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts b/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts index b2e821c15d..af3eb63b69 100644 --- a/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts +++ b/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts @@ -35,17 +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 (true) { - + } + if (true) { } if (!loc) { - for (const location of validLocs) { - if (user.bank.amount(location.bait.id) >= quanity) { - loc = location.name; - } - } - if (!loc) loc = validLocs[0].name; + for (const location of validLocs) { + if (user.bank.amount(location.bait.id) >= quanity) { + loc = location.name; + } + } + if (!loc) loc = validLocs[0].name; } if (!fishingLocation) { return `That's not a valid location to fish at, you can fish at these locations: ${fishingLocations From 3f85dd230a7527178b1f35b2f11d0dc724793989 Mon Sep 17 00:00:00 2001 From: TURB042O Date: Fri, 8 Mar 2024 09:50:46 -0600 Subject: [PATCH 3/7] spelling fix --- src/mahoji/lib/abstracted_commands/fishingContestCommand.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts b/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts index af3eb63b69..accf928ff4 100644 --- a/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts +++ b/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts @@ -41,7 +41,7 @@ export async function fishingContestStartCommand(user: MUser, channelID: string, if (!loc) { for (const location of validLocs) { - if (user.bank.amount(location.bait.id) >= quanity) { + if (user.bank.amount(location.bait.id) >= quantity) { loc = location.name; } } From cc2aa95599d0f9067c439d5244e9564715bea358 Mon Sep 17 00:00:00 2001 From: TURB042O Date: Fri, 8 Mar 2024 10:20:36 -0600 Subject: [PATCH 4/7] fix --- src/mahoji/lib/abstracted_commands/fishingContestCommand.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts b/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts index accf928ff4..a015106a99 100644 --- a/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts +++ b/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts @@ -44,8 +44,9 @@ export async function fishingContestStartCommand(user: MUser, channelID: string, if (user.bank.amount(location.bait.id) >= quantity) { loc = location.name; } - } - if (!loc) loc = validLocs[0].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 From a59c76f2544b924538338eb970c387c2b038c76a Mon Sep 17 00:00:00 2001 From: TURB042O Date: Fri, 8 Mar 2024 10:24:14 -0600 Subject: [PATCH 5/7] fix --- src/mahoji/lib/abstracted_commands/fishingContestCommand.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts b/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts index a015106a99..1f2e59e50c 100644 --- a/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts +++ b/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts @@ -36,8 +36,6 @@ export async function fishingContestStartCommand(user: MUser, channelID: string, quantity++; quantityBoosts.push('1 for Crystal fishing rod'); } - if (true) { - } if (!loc) { for (const location of validLocs) { From 6bc035d40ff7041e452abf0d51a805ec774f10fc Mon Sep 17 00:00:00 2001 From: TURB042O Date: Fri, 8 Mar 2024 10:33:25 -0600 Subject: [PATCH 6/7] fix --- src/mahoji/lib/abstracted_commands/fishingContestCommand.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts b/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts index 1f2e59e50c..ffdf29b8d8 100644 --- a/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts +++ b/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts @@ -35,7 +35,8 @@ export async function fishingContestStartCommand(user: MUser, channelID: string, if (user.hasEquippedOrInBank('Crystal fishing rod')) { quantity++; quantityBoosts.push('1 for Crystal fishing rod'); - } + }if (!loc) loc = validLocs[0].name; + const fishingLocation = fishingLocations.find(i => stringMatches(i.name, loc!)); if (!loc) { for (const location of validLocs) { @@ -44,7 +45,7 @@ export async function fishingContestStartCommand(user: MUser, channelID: string, } } if (!loc) loc = validLocs[0].name; - const fishingLocation = fishingLocations.find(i => stringMatches(i.name, loc!)); + 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 From 9536b1ded7183b33902f4e95bef133e166361d04 Mon Sep 17 00:00:00 2001 From: TURBO Date: Fri, 8 Mar 2024 16:40:19 +0000 Subject: [PATCH 7/7] lint --- .../lib/abstracted_commands/fishingContestCommand.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts b/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts index ffdf29b8d8..c7e03d21cc 100644 --- a/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts +++ b/src/mahoji/lib/abstracted_commands/fishingContestCommand.ts @@ -35,7 +35,8 @@ export async function fishingContestStartCommand(user: MUser, channelID: string, if (user.hasEquippedOrInBank('Crystal fishing rod')) { quantity++; quantityBoosts.push('1 for Crystal fishing rod'); - }if (!loc) loc = validLocs[0].name; + } + if (!loc) loc = validLocs[0].name; const fishingLocation = fishingLocations.find(i => stringMatches(i.name, loc!)); if (!loc) { @@ -43,9 +44,9 @@ export async function fishingContestStartCommand(user: MUser, channelID: string, 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) 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