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

Prevent repeating kill trips when slayer task is finished #6213

Merged
merged 5 commits into from
Dec 27, 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
1 change: 1 addition & 0 deletions src/lib/types/minions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export interface MonsterActivityTaskOptions extends ActivityTaskOptions {
hasWildySupplies?: boolean;
isInWilderness?: boolean;
attackStyles?: AttackStyles[];
onTask?: boolean;
}

export interface ClueActivityTaskOptions extends ActivityTaskOptions {
Expand Down
4 changes: 3 additions & 1 deletion src/mahoji/commands/k.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -161,7 +162,8 @@ export const minionKCommand: OSBMahojiCommand = {
options.quantity,
options.method,
options.wilderness,
options.solo
options.solo,
options.onTask
);
}
};
Expand Down
12 changes: 9 additions & 3 deletions src/mahoji/lib/abstracted_commands/minionKill/minionKill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string | InteractionReplyOptions> {
if (user.minionIsBusy) {
return 'Your minion is busy.';
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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
Expand Down
Loading