Skip to content

Commit

Permalink
updated the fishingContestStartCommand() function to check for the …
Browse files Browse the repository at this point in the history
…items of both locations
  • Loading branch information
I-am-TURBO committed Mar 8, 2024
1 parent e47e1bb commit b544485
Showing 1 changed file with 29 additions and 20 deletions.
49 changes: 29 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,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) {

Check failure on line 38 in src/mahoji/lib/abstracted_commands/fishingContestCommand.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Replace `·if·(true)·{⏎↹↹` with `⏎↹if·(true)·{`

Check failure on line 38 in src/mahoji/lib/abstracted_commands/fishingContestCommand.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

This line has 2 statements. Maximum allowed is 1

}

if (!loc) {
for (const location of validLocs) {

Check failure on line 43 in src/mahoji/lib/abstracted_commands/fishingContestCommand.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Replace `····` with `↹↹`
if (user.bank.amount(location.bait.id) >= quanity) {

Check failure on line 44 in src/mahoji/lib/abstracted_commands/fishingContestCommand.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Replace `········` with `↹↹↹`
loc = location.name;

Check failure on line 45 in src/mahoji/lib/abstracted_commands/fishingContestCommand.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Replace `············` with `↹↹↹↹`
}

Check failure on line 46 in src/mahoji/lib/abstracted_commands/fishingContestCommand.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Replace `········` with `↹↹↹`
}

Check failure on line 47 in src/mahoji/lib/abstracted_commands/fishingContestCommand.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Replace `····` with `↹↹`
if (!loc) loc = validLocs[0].name;

Check failure on line 48 in src/mahoji/lib/abstracted_commands/fishingContestCommand.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Replace `····` with `↹↹`
}
if (!fishingLocation) {

Check warning on line 50 in src/mahoji/lib/abstracted_commands/fishingContestCommand.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Unexpected any value in conditional. An explicit comparison or type cast is required
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 b544485

Please sign in to comment.