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 9, 2024
1 parent e47e1bb commit ed86107
Showing 1 changed file with 26 additions and 19 deletions.
45 changes: 26 additions & 19 deletions src/mahoji/lib/abstracted_commands/fishingContestCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,32 @@ 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;
let quantity = 1;

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

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Delete `↹`
let duration = Math.floor(quantity * Time.Minute * 1.69);

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

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Delete `↹`
let quantityBoosts = [];

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

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Delete `↹`

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

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Delete `↹`
const tackleBoxes = ["Champion's tackle box", 'Professional tackle box', 'Standard tackle box', 'Basic tackle box'];

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

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Delete `↹`
for (let i = 0; i < tackleBoxes.length; i++) {

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

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Delete `↹`
if (user.hasEquippedOrInBank(tackleBoxes[i])) {

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

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Delete `↹`
let num = tackleBoxes.length - i;

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

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Delete `↹`
quantityBoosts.push(`${num} for ${tackleBoxes[i]}`);

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

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Delete `↹`
quantity += num;

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

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Delete `↹`
break;
}
}

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
Expand All @@ -38,24 +63,6 @@ export async function fishingContestStartCommand(user: MUser, channelID: string,
if (user.minionIsBusy) {
return 'Your minion is busy.';
}
let quantity = 1;
let duration = Math.floor(quantity * Time.Minute * 1.69);
let quantityBoosts = [];

const tackleBoxes = ["Champion's tackle box", 'Professional tackle box', 'Standard tackle box', 'Basic tackle box'];
for (let i = 0; i < tackleBoxes.length; i++) {
if (user.hasEquippedOrInBank(tackleBoxes[i])) {
let num = tackleBoxes.length - i;
quantityBoosts.push(`${num} for ${tackleBoxes[i]}`);
quantity += num;
break;
}
}

if (user.hasEquippedOrInBank('Crystal fishing rod')) {
quantity++;
quantityBoosts.push('1 for Crystal fishing rod');
}

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

0 comments on commit ed86107

Please sign in to comment.