Skip to content

Commit

Permalink
Updated Fishing contest to attempt both locations by default (#5765)
Browse files Browse the repository at this point in the history
  • Loading branch information
I-am-TURBO authored May 2, 2024
1 parent 18e55df commit f88b20a
Showing 1 changed file with 27 additions and 20 deletions.
47 changes: 27 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 @@ -56,6 +36,33 @@ export async function fishingContestStartCommand(user: MUser, channelID: string,
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:982663098949304331> a Contest rod and a Beginner's tackle box to compete in the Fishing contest.";
}
if (user.minionIsBusy) {
return 'Your minion is busy.';
}

const result = await getUsersFishingContestDetails(user);
if (result.catchesFromToday.length > 0) {
Expand Down

0 comments on commit f88b20a

Please sign in to comment.