Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add quantity to Zalcano #5937

Merged
merged 2 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/lib/util/repeatStoredTrip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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]: {
Expand Down
2 changes: 1 addition & 1 deletion src/mahoji/lib/abstracted_commands/minionKill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
14 changes: 12 additions & 2 deletions src/mahoji/lib/abstracted_commands/zalcanoCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}.`;
Expand Down Expand Up @@ -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 Zalcano is ${Math.floor(
maxTripLength / baseTime
)}.`;
}

const { foodRemoved } = await removeFoodFromUser({
user,
totalHealingNeeded: healAmountNeeded * quantity,
Expand Down
Loading