diff --git a/src/lib/types/minions.ts b/src/lib/types/minions.ts index 555f0eb4b1..03c7937b75 100644 --- a/src/lib/types/minions.ts +++ b/src/lib/types/minions.ts @@ -147,6 +147,7 @@ export interface MonsterActivityTaskOptions extends ActivityTaskOptions { hasWildySupplies?: boolean; isInWilderness?: boolean; attackStyles?: AttackStyles[]; + onTask?: boolean; } export interface ClueActivityTaskOptions extends ActivityTaskOptions { diff --git a/src/mahoji/commands/k.ts b/src/mahoji/commands/k.ts index 7432ba58e6..9157d07aa6 100644 --- a/src/mahoji/commands/k.ts +++ b/src/mahoji/commands/k.ts @@ -148,6 +148,7 @@ export const minionKCommand: OSBMahojiCommand = { show_info?: boolean; wilderness?: boolean; solo?: boolean; + onTask?: boolean; }>) => { const user = await mUserFetch(userID); if (options.show_info) { @@ -161,7 +162,8 @@ export const minionKCommand: OSBMahojiCommand = { options.quantity, options.method, options.wilderness, - options.solo + options.solo, + options.onTask ); } }; diff --git a/src/mahoji/lib/abstracted_commands/minionKill/minionKill.ts b/src/mahoji/lib/abstracted_commands/minionKill/minionKill.ts index 630568ec61..c8dda9ea5a 100644 --- a/src/mahoji/lib/abstracted_commands/minionKill/minionKill.ts +++ b/src/mahoji/lib/abstracted_commands/minionKill/minionKill.ts @@ -31,7 +31,8 @@ export async function minionKillCommand( inputQuantity: number | undefined, method: PvMMethod | undefined, wilderness: boolean | undefined, - solo: boolean | undefined + solo: boolean | undefined, + onTask: boolean | undefined ): Promise { if (user.minionIsBusy) { return 'Your minion is busy.'; @@ -63,12 +64,16 @@ export async function minionKillCommand( return typeof reason === 'string' ? reason : "You don't have the requirements to fight this monster"; } + const slayerInfo = await getUsersCurrentSlayerInfo(user.id); + + if (slayerInfo.assignedTask === null && onTask) return 'You are no longer on a slayer task for this monster!'; + const stats: { pk_evasion_exp: number } = await user.fetchStats({ pk_evasion_exp: true }); const result = newMinionKillCommand({ gearBank: user.gearBank, attackStyles: user.getAttackStyles(), - currentSlayerTask: await getUsersCurrentSlayerInfo(user.id), + currentSlayerTask: slayerInfo, monster, isTryingToUseWildy: wilderness ?? false, monsterKC: await user.getKC(monster.id), @@ -134,7 +139,8 @@ export async function minionKillCommand( bob: !bob ? undefined : bob, hasWildySupplies, isInWilderness: result.isInWilderness, - attackStyles: result.attackStyles + attackStyles: result.attackStyles, + onTask: slayerInfo.assignedTask !== null }); let response = `${minionName} is now killing ${result.quantity}x ${monster.name}, it'll take around ${formatDuration( result.duration