Skip to content

Commit

Permalink
Updated fishing contest button to check for the items of both locations
Browse files Browse the repository at this point in the history
  • Loading branch information
I-am-TURBO committed Mar 8, 2024
1 parent e47e1bb commit 803e61d
Showing 1 changed file with 28 additions and 20 deletions.
48 changes: 28 additions & 20 deletions src/mahoji/lib/abstracted_commands/fishingContestCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand All @@ -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);
Expand Down

0 comments on commit 803e61d

Please sign in to comment.