From 021cf45fdcf3c60bac1d7da2b8cf7dc497e17d67 Mon Sep 17 00:00:00 2001 From: TastyPumPum <79149170+TastyPumPum@users.noreply.github.com> Date: Wed, 3 Jul 2024 20:37:39 +0100 Subject: [PATCH 1/2] Add quantity to Zalcano Allows users to specify the quantity of Zalcano. If no quantity is provided do a max trip as before. --- src/lib/util/repeatStoredTrip.ts | 8 +++++--- src/mahoji/lib/abstracted_commands/minionKill.ts | 2 +- .../lib/abstracted_commands/zalcanoCommand.ts | 14 ++++++++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/lib/util/repeatStoredTrip.ts b/src/lib/util/repeatStoredTrip.ts index 15bd678cb5..5d58af6f27 100644 --- a/src/lib/util/repeatStoredTrip.ts +++ b/src/lib/util/repeatStoredTrip.ts @@ -56,7 +56,8 @@ import type { TempleTrekkingActivityTaskOptions, TheatreOfBloodTaskOptions, TiaraRunecraftActivityTaskOptions, - WoodcuttingActivityTaskOptions + WoodcuttingActivityTaskOptions, + ZalcanoActivityTaskOptions } from '../types/minions'; import { itemNameFromID } from '../util'; import { giantsFoundryAlloys } from './../../mahoji/lib/abstracted_commands/giantsFoundryCommand'; @@ -424,8 +425,9 @@ export const tripHandlers = { }, [activity_type_enum.Zalcano]: { commandName: 'k', - args: () => ({ - name: 'zalcano' + args: (data: ZalcanoActivityTaskOptions) => ({ + name: 'zalcano', + quantity: data.quantity }) }, [activity_type_enum.Tempoross]: { diff --git a/src/mahoji/lib/abstracted_commands/minionKill.ts b/src/mahoji/lib/abstracted_commands/minionKill.ts index 984e7d0852..f5c305f927 100644 --- a/src/mahoji/lib/abstracted_commands/minionKill.ts +++ b/src/mahoji/lib/abstracted_commands/minionKill.ts @@ -157,7 +157,7 @@ export async function minionKillCommand( if (stringMatches(name, 'colosseum')) return colosseumCommand(user, channelID); if (stringMatches(name, 'nex')) return nexCommand(interaction, user, channelID, solo); - if (stringMatches(name, 'zalcano')) return zalcanoCommand(user, channelID); + if (stringMatches(name, 'zalcano')) return zalcanoCommand(user, channelID, quantity); if (stringMatches(name, 'tempoross')) return temporossCommand(user, channelID, quantity); if (name.toLowerCase().includes('nightmare')) return nightmareCommand(user, channelID, name, quantity); if (name.toLowerCase().includes('wintertodt')) return wintertodtCommand(user, channelID); diff --git a/src/mahoji/lib/abstracted_commands/zalcanoCommand.ts b/src/mahoji/lib/abstracted_commands/zalcanoCommand.ts index b524f482ec..07e850f2d7 100644 --- a/src/mahoji/lib/abstracted_commands/zalcanoCommand.ts +++ b/src/mahoji/lib/abstracted_commands/zalcanoCommand.ts @@ -21,7 +21,7 @@ function calcPerformance(kcLearned: number, skillPercentage: number) { return Math.min(100, basePerformance); } -export async function zalcanoCommand(user: MUser, channelID: string) { +export async function zalcanoCommand(user: MUser, channelID: string, quantity?: number) { const [hasReqs, reason] = hasSkillReqs(user, soteSkillRequirements); if (!hasReqs) { return `To fight Zalcano, you need: ${reason}.`; @@ -54,9 +54,19 @@ export async function zalcanoCommand(user: MUser, channelID: string) { else if (kc > 50) healAmountNeeded = 3 * 12; else if (kc > 20) healAmountNeeded = 5 * 12; - const quantity = Math.floor(calcMaxTripLength(user, 'Zalcano') / baseTime); + const maxTripLength = calcMaxTripLength(user, 'Zalcano'); + if (!quantity) quantity = Math.floor(maxTripLength / baseTime); + quantity = Math.max(1, quantity); const duration = quantity * baseTime; + if (quantity > 1 && duration > maxTripLength) { + return `${user.minionName} can't go on PvM trips longer than ${formatDuration( + maxTripLength + )}, try a lower quantity. The highest amount you can do for Wintertodt is ${Math.floor( + maxTripLength / baseTime + )}.`; + } + const { foodRemoved } = await removeFoodFromUser({ user, totalHealingNeeded: healAmountNeeded * quantity, From 4ca6bf0d1bab4de49606723360dff0c85105fcfb Mon Sep 17 00:00:00 2001 From: TastyPumPum <79149170+TastyPumPum@users.noreply.github.com> Date: Wed, 3 Jul 2024 20:40:02 +0100 Subject: [PATCH 2/2] Update src/mahoji/lib/abstracted_commands/zalcanoCommand.ts Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> --- src/mahoji/lib/abstracted_commands/zalcanoCommand.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mahoji/lib/abstracted_commands/zalcanoCommand.ts b/src/mahoji/lib/abstracted_commands/zalcanoCommand.ts index 07e850f2d7..b5434292ae 100644 --- a/src/mahoji/lib/abstracted_commands/zalcanoCommand.ts +++ b/src/mahoji/lib/abstracted_commands/zalcanoCommand.ts @@ -62,7 +62,7 @@ export async function zalcanoCommand(user: MUser, channelID: string, quantity?: if (quantity > 1 && duration > maxTripLength) { return `${user.minionName} can't go on PvM trips longer than ${formatDuration( maxTripLength - )}, try a lower quantity. The highest amount you can do for Wintertodt is ${Math.floor( + )}, try a lower quantity. The highest amount you can do for Zalcano is ${Math.floor( maxTripLength / baseTime )}.`; }