diff --git a/src/lib/constants.ts b/src/lib/constants.ts index abb085ff39..50b28b0fac 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -260,7 +260,8 @@ export enum BitField { SelfGamblingLocked = 36, DisabledFarmingReminders = 37, DisableClueButtons = 38, - DisableAutoSlayButton = 39 + DisableAutoSlayButton = 39, + DisableHighPeakTimeWarning = 40 } interface BitFieldData { @@ -350,6 +351,11 @@ export const BitFieldData: Record = { name: 'Disable Auto Slay Button', protected: false, userConfigurable: true + }, + [BitField.DisableHighPeakTimeWarning]: { + name: 'Disable Wilderness High Peak Time Warning', + protected: false, + userConfigurable: true } } as const; diff --git a/src/lib/data/Collections.ts b/src/lib/data/Collections.ts index 469215519e..c3dd7a8bd3 100644 --- a/src/lib/data/Collections.ts +++ b/src/lib/data/Collections.ts @@ -143,7 +143,7 @@ function kcProg(mon: Monster): FormatProgressFunction { } function mgProg(minigameName: MinigameName): FormatProgressFunction { - return ({ minigames }) => `${minigames[minigameName]} KC`; + return ({ minigames }) => `${minigames[minigameName]} Completions`; } function skillProg(skillName: SkillsEnum): FormatProgressFunction { @@ -807,7 +807,7 @@ export const allCollectionLogs: ICollection = { "Shades of Mort'ton": { items: shadesOfMorttonCL, isActivity: true, - fmtProg: () => '0 KC' + fmtProg: mgProg('shades_of_morton') }, 'Soul Wars': { alias: ['soul wars', 'sw'], diff --git a/src/lib/slayer/tasks/index.ts b/src/lib/slayer/tasks/index.ts index a514c6c844..b33c3dccc0 100644 --- a/src/lib/slayer/tasks/index.ts +++ b/src/lib/slayer/tasks/index.ts @@ -18,3 +18,5 @@ export const allSlayerTasks: AssignableSlayerTask[] = [ ...vannakaTasks, ...duradelTasks ]; + +export const allSlayerMonsters = allSlayerTasks.map(m => m.monster); diff --git a/src/mahoji/commands/config.ts b/src/mahoji/commands/config.ts index ac07d20f93..6c22feff83 100644 --- a/src/mahoji/commands/config.ts +++ b/src/mahoji/commands/config.ts @@ -127,6 +127,10 @@ const toggles: UserConfigToggle[] = [ { name: 'Disable Clue Buttons', bit: BitField.DisableClueButtons + }, + { + name: 'Disable wilderness high peak time warning', + bit: BitField.DisableHighPeakTimeWarning } ]; diff --git a/src/mahoji/commands/testpotato.ts b/src/mahoji/commands/testpotato.ts index 11e9f306af..3006ae867a 100644 --- a/src/mahoji/commands/testpotato.ts +++ b/src/mahoji/commands/testpotato.ts @@ -24,6 +24,10 @@ import { prisma } from '../../lib/settings/prisma'; import { getFarmingInfo } from '../../lib/skilling/functions/getFarmingInfo'; import Skills from '../../lib/skilling/skills'; import Farming from '../../lib/skilling/skills/farming'; +import { slayerMasterChoices } from '../../lib/slayer/constants'; +import { slayerMasters } from '../../lib/slayer/slayerMasters'; +import { getUsersCurrentSlayerInfo } from '../../lib/slayer/slayerUtil'; +import { allSlayerMonsters } from '../../lib/slayer/tasks'; import { stringMatches } from '../../lib/util'; import { calcDropRatesFromBankWithoutUniques } from '../../lib/util/calcDropRatesFromBank'; import { @@ -514,6 +518,46 @@ export const testPotatoCommand: OSBMahojiCommand | null = production } } ] + }, + { + type: ApplicationCommandOptionType.Subcommand, + name: 'setslayertask', + description: 'Set slayer task.', + options: [ + { + type: ApplicationCommandOptionType.String, + name: 'master', + description: 'The master you wish to set your task.', + required: true, + choices: slayerMasterChoices + }, + { + type: ApplicationCommandOptionType.String, + name: 'monster', + description: 'The monster you want to set your task as.', + required: true, + autocomplete: async value => { + const filteredMonsters = [...new Set(allSlayerMonsters)].filter(monster => { + if (!value) return true; + return [monster.name.toLowerCase(), ...monster.aliases].some(aliases => + aliases.includes(value.toLowerCase()) + ); + }); + return filteredMonsters.map(monster => ({ + name: monster.name, + value: monster.name + })); + } + }, + { + type: ApplicationCommandOptionType.Integer, + name: 'quantity', + description: 'The task quantity you want to assign.', + required: false, + min_value: 0, + max_value: 1000 + } + ] } ], run: async ({ @@ -534,6 +578,7 @@ export const testPotatoCommand: OSBMahojiCommand | null = production set?: { qp?: number; all_ca_tasks?: boolean }; check?: { monster_droprates?: string }; bingo_tools?: { start_bingo: string }; + setslayertask?: { master: string; monster: string; quantity: number }; }>) => { if (production) { logError('Test command ran in production', { userID: userID.toString() }); @@ -832,6 +877,61 @@ ${droprates.join('\n')}`), return userGrowingProgressStr((await getFarmingInfo(userID)).patchesDetailed); } + if (options.setslayertask) { + const user = await mUserFetch(userID); + const usersTask = await getUsersCurrentSlayerInfo(user.id); + + const { monster, master } = options.setslayertask; + + const selectedMonster = allSlayerMonsters.find(m => stringMatches(m.name, monster)); + const selectedMaster = slayerMasters.find( + sm => stringMatches(master, sm.name) || sm.aliases.some(alias => stringMatches(master, alias)) + ); + + // Set quantity to 50 if user doesn't assign a quantity + const quantity = options.setslayertask?.quantity ?? 50; + + const assignedTask = selectedMaster!.tasks.find(m => m.monster.id === selectedMonster?.id)!; + + if (!selectedMaster) return 'Invalid slayer master.'; + if (!selectedMonster) return 'Invalid monster.'; + if (!assignedTask) return `${selectedMaster.name} can not assign ${selectedMonster.name}.`; + + // Update an existing slayer task for the user + if (usersTask.currentTask?.id) { + await prisma.slayerTask.update({ + where: { + id: usersTask.currentTask?.id + }, + data: { + quantity, + quantity_remaining: quantity, + slayer_master_id: selectedMaster.id, + monster_id: selectedMonster.id, + skipped: false + } + }); + } else { + // Create a new slayer task for the user + await prisma.slayerTask.create({ + data: { + user_id: user.id, + quantity, + quantity_remaining: quantity, + slayer_master_id: selectedMaster.id, + monster_id: selectedMonster.id, + skipped: false + } + }); + } + + await user.update({ + slayer_last_task: selectedMonster.id + }); + + return `You set your slayer task to ${selectedMonster.name} using ${selectedMaster.name}.`; + } + return 'Nothin!'; } }; diff --git a/src/mahoji/lib/abstracted_commands/minionKill.ts b/src/mahoji/lib/abstracted_commands/minionKill.ts index c1f71fdebb..12b1068142 100644 --- a/src/mahoji/lib/abstracted_commands/minionKill.ts +++ b/src/mahoji/lib/abstracted_commands/minionKill.ts @@ -15,7 +15,7 @@ import { Bank, Monsters } from 'oldschooljs'; import { MonsterAttribute } from 'oldschooljs/dist/meta/monsterData'; import { itemID } from 'oldschooljs/dist/util'; -import { PeakTier, PvMMethod } from '../../../lib/constants'; +import { BitField, PeakTier, PvMMethod } from '../../../lib/constants'; import { Eatables } from '../../../lib/data/eatables'; import { getSimilarItems } from '../../../lib/data/similarItems'; import { checkUserCanUseDegradeableItem, degradeablePvmBoostItems, degradeItem } from '../../../lib/degradeableItems'; @@ -689,7 +689,7 @@ export async function minionKillCommand( break; } } - if (wildyPeak?.peakTier === PeakTier.High) { + if (wildyPeak?.peakTier === PeakTier.High && !user.bitfield.includes(BitField.DisableHighPeakTimeWarning)) { if (interaction) { await handleMahojiConfirmation( interaction,