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);