From c424e998307d33b1921cd3950bffc83bf0d66060 Mon Sep 17 00:00:00 2001 From: Arodab Date: Fri, 11 Oct 2024 13:52:07 -0300 Subject: [PATCH 01/10] clues --- src/lib/clues/clueTiers.ts | 10 +-- src/mahoji/commands/clue.ts | 152 +++++++++++++++++++++++------------- 2 files changed, 101 insertions(+), 61 deletions(-) diff --git a/src/lib/clues/clueTiers.ts b/src/lib/clues/clueTiers.ts index f71e477b84..5e427f69dd 100644 --- a/src/lib/clues/clueTiers.ts +++ b/src/lib/clues/clueTiers.ts @@ -53,7 +53,7 @@ export const ClueTiers: ClueTier[] = [ table: Beginner, id: 23_245, scrollID: 23_182, - timeToFinish: Time.Minute * 2.5, + timeToFinish: Time.Minute * 2.1, mimicChance: false, allItems: BeginnerCasket.allItems, stashUnits: beginnerStashes, @@ -66,7 +66,7 @@ export const ClueTiers: ClueTier[] = [ table: Easy, id: 20_546, scrollID: 2677, - timeToFinish: Time.Minute * 5.5, + timeToFinish: Time.Minute * 3.5, milestoneReward: { itemReward: itemID('Large spade'), scoreNeeded: 500 @@ -83,7 +83,7 @@ export const ClueTiers: ClueTier[] = [ table: Medium, id: 20_545, scrollID: 2801, - timeToFinish: Time.Minute * 7, + timeToFinish: Time.Minute * 5.0, milestoneReward: { itemReward: itemID('Clueless scroll'), scoreNeeded: 400 @@ -100,7 +100,7 @@ export const ClueTiers: ClueTier[] = [ table: Hard, id: 20_544, scrollID: 2722, - timeToFinish: Time.Minute * 12.5, + timeToFinish: Time.Minute * 8.0, mimicChance: false, allItems: HardCasket.allItems, stashUnits: hardStashes, @@ -130,7 +130,7 @@ export const ClueTiers: ClueTier[] = [ table: Master, id: 19_836, scrollID: 19_835, - timeToFinish: Time.Minute * 19.3, + timeToFinish: Time.Minute * 21.0, milestoneReward: { itemReward: itemID('Scroll sack'), scoreNeeded: 100 diff --git a/src/mahoji/commands/clue.ts b/src/mahoji/commands/clue.ts index 511e301d24..89717af895 100644 --- a/src/mahoji/commands/clue.ts +++ b/src/mahoji/commands/clue.ts @@ -9,7 +9,7 @@ import { ClueTiers } from '../../lib/clues/clueTiers'; import { allOpenables, getOpenableLoot } from '../../lib/openables'; import { getPOHObject } from '../../lib/poh'; import type { ClueActivityTaskOptions } from '../../lib/types/minions'; -import { formatDuration, isWeekend, stringMatches } from '../../lib/util'; +import { formatDuration, stringMatches } from '../../lib/util'; import addSubTaskToActivityTask from '../../lib/util/addSubTaskToActivityTask'; import { calcMaxTripLength } from '../../lib/util/calcMaxTripLength'; import getOSItem, { getItem } from '../../lib/util/getOSItem'; @@ -18,8 +18,8 @@ import type { OSBMahojiCommand } from '../lib/util'; import { addToOpenablesScores, getMahojiBank, mahojiUsersSettingsFetch } from '../mahojiSettings'; function reducedClueTime(clueTier: ClueTier, score: number) { - // Every 3 hours become 1% better to a cap of 10% - const percentReduced = Math.min(Math.floor(score / ((Time.Hour * 3) / clueTier.timeToFinish)), 10); + // Every 1 hour become 1% better to a cap of 25% + const percentReduced = Math.min(Math.floor(score / ((Time.Hour * 1) / clueTier.timeToFinish)), 25); const amountReduced = (clueTier.timeToFinish * percentReduced) / 100; const reducedTime = clueTier.timeToFinish - amountReduced; @@ -156,20 +156,15 @@ export const clueCommand: OSBMahojiCommand = { // Global Boosts const globalBoosts = [ - { - condition: isWeekend, - boost: '10% for Weekend', - durationMultiplier: 0.9 - }, { condition: () => user.hasEquippedOrInBank('Max cape'), - boost: '10% for Max cape', - durationMultiplier: 0.9 + boost: '15% for Max cape', + durationMultiplier: 0.85 }, { condition: () => !user.hasEquippedOrInBank('Max cape') && user.hasEquippedOrInBank('Construct. cape'), - boost: '6% for Construction cape', - durationMultiplier: 0.94 + boost: '10% for Construction cape', + durationMultiplier: 0.9 }, { condition: () => hasOrnateJewelleryBox, @@ -192,8 +187,8 @@ export const clueCommand: OSBMahojiCommand = { // Xeric's Talisman boost if (clueTier.name === 'Medium' && hasXericTalisman) { - boosts.push("2% for Mounted Xeric's Talisman"); - duration *= 0.98; + boosts.push("10% for Mounted Xeric's Talisman"); + duration *= 0.9; } // Specific boosts @@ -201,118 +196,163 @@ export const clueCommand: OSBMahojiCommand = { Beginner: [ { item: getOSItem('Ring of the elements'), - boost: '10% for Ring of the elements', - durationMultiplier: 0.9 + boost: '5% for Ring of the elements', + durationMultiplier: 0.95 + }, + { + item: getOSItem('Skull sceptre'), + boost: '5% for Skull sceptre', + durationMultiplier: 0.95 } ], Easy: [ { item: getOSItem('Achievement diary cape'), - boost: '10% for Achievement diary cape', - durationMultiplier: 0.9 + boost: '15% for Achievement diary cape', + durationMultiplier: 0.85 }, { item: getOSItem('Ring of the elements'), - boost: '6% for Ring of the elements', - durationMultiplier: 0.94 + boost: '10% for Ring of the elements', + durationMultiplier: 0.9 + }, + { + item: getOSItem('Skull sceptre'), + boost: '10% for Skull sceptre', + durationMultiplier: 0.9 + }, + { + item: getOSItem('Music cape'), + boost: '10% for Music cape', + durationMultiplier: 0.9 } ], Medium: [ + { + item: getOSItem('Achievement diary cape'), + boost: '15% for Achievement diary cape', + durationMultiplier: 0.85 + }, { item: getOSItem('Ring of the elements'), - boost: '8% for Ring of the elements', - durationMultiplier: 0.92 + boost: '15% for Ring of the elements', + durationMultiplier: 0.85 + }, + { + item: getOSItem('Skull sceptre'), + boost: '10% for Skull sceptre', + durationMultiplier: 0.9 + }, + { + item: getOSItem('Music cape'), + boost: '10% for Music cape', + durationMultiplier: 0.9 } ], Hard: [ { item: getOSItem('Achievement diary cape'), - boost: '10% for Achievement diary cape', - durationMultiplier: 0.9 + boost: '15% for Achievement diary cape', + durationMultiplier: 0.85 }, { item: getOSItem('Wilderness sword 3'), - boost: '8% for Wilderness sword 3', - durationMultiplier: 0.92 + boost: '10% for Wilderness sword 3', + durationMultiplier: 0.9 }, { item: getOSItem('Royal seed pod'), - boost: '6% for Royal seed pod', - durationMultiplier: 0.94 + boost: '5% for Royal seed pod', + durationMultiplier: 0.95 }, { item: getOSItem('Eternal teleport crystal'), - boost: '4% for Eternal teleport crystal', - durationMultiplier: 0.96 + boost: '5% for Eternal teleport crystal', + durationMultiplier: 0.95 }, { item: getOSItem("Pharaoh's sceptre"), - boost: "4% for Pharaoh's sceptre", - durationMultiplier: 0.96 + boost: "5% for Pharaoh's sceptre", + durationMultiplier: 0.95 }, { item: getOSItem('Toxic blowpipe'), - boost: '4% for Toxic blowpipe', - durationMultiplier: 0.96 + boost: '10% for Toxic blowpipe', + durationMultiplier: 0.9 + }, + { + item: getOSItem('Book of the dead'), + boost: '10% for Book of the dead', + durationMultiplier: 0.9 } ], Elite: [ { item: getOSItem('Achievement diary cape'), - boost: '10% for Achievement diary cape', - durationMultiplier: 0.9 + boost: '15% for Achievement diary cape', + durationMultiplier: 0.85 }, { item: getOSItem('Kandarin headgear 4'), - boost: '7% for Kandarin headgear 4', - durationMultiplier: 0.93 + boost: '10% for Kandarin headgear 4', + durationMultiplier: 0.9 }, { item: getOSItem('Fremennik sea boots 4'), - boost: '3% for Fremennik sea boots 4', - durationMultiplier: 0.97 + boost: '5% for Fremennik sea boots 4', + durationMultiplier: 0.95 }, { item: getOSItem("Pharaoh's sceptre"), - boost: "4% for Pharaoh's sceptre", - durationMultiplier: 0.96 + boost: "5% for Pharaoh's sceptre", + durationMultiplier: 0.95 }, { item: getOSItem('Toxic blowpipe'), - boost: '4% for Toxic blowpipe', - durationMultiplier: 0.96 + boost: '10% for Toxic blowpipe', + durationMultiplier: 0.95 + }, + { + item: getOSItem('Book of the dead'), + boost: '10% for Book of the dead', + durationMultiplier: 0.9 } ], Master: [ { item: getOSItem('Achievement diary cape'), - boost: '10% for Achievement diary cape', - durationMultiplier: 0.9 + boost: '15% for Achievement diary cape', + durationMultiplier: 0.85 }, { item: getOSItem('Kandarin headgear 4'), - boost: '6% for Kandarin headgear 4', - durationMultiplier: 0.94 + boost: '10% for Kandarin headgear 4', + durationMultiplier: 0.9 }, { item: getOSItem('Music cape'), - boost: '5% for Music cape', - durationMultiplier: 0.95 + boost: '10% for Music cape', + durationMultiplier: 0.9 }, { item: getOSItem('Eternal teleport crystal'), - boost: '3% for Eternal teleport crystal', - durationMultiplier: 0.97 + boost: '5% for Eternal teleport crystal', + durationMultiplier: 0.95 }, { item: getOSItem('Toxic blowpipe'), - boost: '2% for Toxic blowpipe', - durationMultiplier: 0.98 + boost: '10% for Toxic blowpipe', + durationMultiplier: 0.9 }, { item: getOSItem('Dragon claws'), - boost: '1% for Dragon claws', - durationMultiplier: 0.99 + boost: '5% for Dragon claws', + durationMultiplier: 0.95 + }, + { + item: getOSItem('Book of the dead'), + boost: '10% for Book of the dead', + durationMultiplier: 0.9 } ] }; From fa40e7220f90bd04683f2564612d48a16df0728c Mon Sep 17 00:00:00 2001 From: Arodab Date: Sat, 12 Oct 2024 12:25:50 -0300 Subject: [PATCH 02/10] some tiers were slightly faster than they should be --- src/lib/clues/clueTiers.ts | 6 +++--- src/mahoji/commands/clue.ts | 37 +++++++++++++++++-------------------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/src/lib/clues/clueTiers.ts b/src/lib/clues/clueTiers.ts index 5e427f69dd..1ca021792f 100644 --- a/src/lib/clues/clueTiers.ts +++ b/src/lib/clues/clueTiers.ts @@ -83,7 +83,7 @@ export const ClueTiers: ClueTier[] = [ table: Medium, id: 20_545, scrollID: 2801, - timeToFinish: Time.Minute * 5.0, + timeToFinish: Time.Minute * 6.0, milestoneReward: { itemReward: itemID('Clueless scroll'), scoreNeeded: 400 @@ -113,7 +113,7 @@ export const ClueTiers: ClueTier[] = [ table: Elite, id: 20_543, scrollID: 12_073, - timeToFinish: Time.Minute * 14, + timeToFinish: Time.Minute * 13.5, milestoneReward: { itemReward: itemID('Heavy casket'), scoreNeeded: 200 @@ -130,7 +130,7 @@ export const ClueTiers: ClueTier[] = [ table: Master, id: 19_836, scrollID: 19_835, - timeToFinish: Time.Minute * 21.0, + timeToFinish: Time.Minute * 25.5, milestoneReward: { itemReward: itemID('Scroll sack'), scoreNeeded: 100 diff --git a/src/mahoji/commands/clue.ts b/src/mahoji/commands/clue.ts index 89717af895..4a2cf2d963 100644 --- a/src/mahoji/commands/clue.ts +++ b/src/mahoji/commands/clue.ts @@ -147,7 +147,7 @@ export const clueCommand: OSBMahojiCommand = { )}.`; } - const randomAddedDuration = randInt(1, 20); + const randomAddedDuration = 10.5; //randInt(1, 20); duration += (randomAddedDuration * duration) / 100; const poh = await getPOH(user.id); const hasOrnateJewelleryBox = poh.jewellery_box === getPOHObject('Ornate jewellery box').id; @@ -278,19 +278,19 @@ export const clueCommand: OSBMahojiCommand = { { item: getOSItem('Toxic blowpipe'), boost: '10% for Toxic blowpipe', - durationMultiplier: 0.9 + durationMultiplier: 0.90 }, { item: getOSItem('Book of the dead'), boost: '10% for Book of the dead', - durationMultiplier: 0.9 + durationMultiplier: 0.90 } ], Elite: [ { item: getOSItem('Achievement diary cape'), - boost: '15% for Achievement diary cape', - durationMultiplier: 0.85 + boost: '12% for Achievement diary cape', + durationMultiplier: 0.88 }, { item: getOSItem('Kandarin headgear 4'), @@ -309,7 +309,7 @@ export const clueCommand: OSBMahojiCommand = { }, { item: getOSItem('Toxic blowpipe'), - boost: '10% for Toxic blowpipe', + boost: '5% for Toxic blowpipe', durationMultiplier: 0.95 }, { @@ -321,8 +321,8 @@ export const clueCommand: OSBMahojiCommand = { Master: [ { item: getOSItem('Achievement diary cape'), - boost: '15% for Achievement diary cape', - durationMultiplier: 0.85 + boost: '12% for Achievement diary cape', + durationMultiplier: 0.88 }, { item: getOSItem('Kandarin headgear 4'), @@ -341,13 +341,13 @@ export const clueCommand: OSBMahojiCommand = { }, { item: getOSItem('Toxic blowpipe'), - boost: '10% for Toxic blowpipe', - durationMultiplier: 0.9 + boost: '5% for Toxic blowpipe', + durationMultiplier: 0.95 }, { item: getOSItem('Dragon claws'), - boost: '5% for Dragon claws', - durationMultiplier: 0.95 + boost: '3% for Dragon claws', + durationMultiplier: 0.97 }, { item: getOSItem('Book of the dead'), @@ -399,9 +399,8 @@ export const clueCommand: OSBMahojiCommand = { return `You don't have any clues, and didn't find any in ${openedImplings}x ${clueImpling.name}s. At least you received the following loot: ${implingLoot}.`; } quantity = bankedClues + implingClues; - implingLootString = `\n\nYou will find ${implingClues} clue${ - implingClues === 0 || implingClues > 1 ? 's' : '' - } from ${openedImplings}x ${clueImpling.name}s, and receive the following loot: ${implingLoot}.`; + implingLootString = `\n\nYou will find ${implingClues} clue${implingClues === 0 || implingClues > 1 ? 's' : '' + } from ${openedImplings}x ${clueImpling.name}s, and receive the following loot: ${implingLoot}.`; } duration = timeToFinish * quantity; @@ -416,10 +415,8 @@ export const clueCommand: OSBMahojiCommand = { duration, type: 'ClueCompletion' }); - return `${user.minionName} is now completing ${quantity}x ${ - clueTier.name - } clues, it'll take around ${formatDuration(duration)} to finish.${ - boosts.length > 0 ? `\n\n**Boosts:** ${boosts.join(', ')}.` : '' - }${implingLootString}`; + return `${user.minionName} is now completing ${quantity}x ${clueTier.name + } clues, it'll take around ${formatDuration(duration)} to finish.${boosts.length > 0 ? `\n\n**Boosts:** ${boosts.join(', ')}.` : '' + }${implingLootString}`; } }; From 39b3b0afd03e485639f0dbf550c95f2306d42f26 Mon Sep 17 00:00:00 2001 From: Arodab Date: Sat, 12 Oct 2024 12:34:17 -0300 Subject: [PATCH 03/10] forgot to remove comment --- src/mahoji/commands/clue.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mahoji/commands/clue.ts b/src/mahoji/commands/clue.ts index 4a2cf2d963..d4ccbfbcf1 100644 --- a/src/mahoji/commands/clue.ts +++ b/src/mahoji/commands/clue.ts @@ -147,7 +147,7 @@ export const clueCommand: OSBMahojiCommand = { )}.`; } - const randomAddedDuration = 10.5; //randInt(1, 20); + const randomAddedDuration = randInt(1, 20); duration += (randomAddedDuration * duration) / 100; const poh = await getPOH(user.id); const hasOrnateJewelleryBox = poh.jewellery_box === getPOHObject('Ornate jewellery box').id; From 72acb2495e396763caf72140fad3598f58ebcd40 Mon Sep 17 00:00:00 2001 From: Arodab Date: Sat, 12 Oct 2024 12:54:30 -0300 Subject: [PATCH 04/10] lint --- src/mahoji/commands/clue.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/mahoji/commands/clue.ts b/src/mahoji/commands/clue.ts index d4ccbfbcf1..3ab6b2754d 100644 --- a/src/mahoji/commands/clue.ts +++ b/src/mahoji/commands/clue.ts @@ -278,12 +278,12 @@ export const clueCommand: OSBMahojiCommand = { { item: getOSItem('Toxic blowpipe'), boost: '10% for Toxic blowpipe', - durationMultiplier: 0.90 + durationMultiplier: 0.9 }, { item: getOSItem('Book of the dead'), boost: '10% for Book of the dead', - durationMultiplier: 0.90 + durationMultiplier: 0.9 } ], Elite: [ @@ -399,8 +399,9 @@ export const clueCommand: OSBMahojiCommand = { return `You don't have any clues, and didn't find any in ${openedImplings}x ${clueImpling.name}s. At least you received the following loot: ${implingLoot}.`; } quantity = bankedClues + implingClues; - implingLootString = `\n\nYou will find ${implingClues} clue${implingClues === 0 || implingClues > 1 ? 's' : '' - } from ${openedImplings}x ${clueImpling.name}s, and receive the following loot: ${implingLoot}.`; + implingLootString = `\n\nYou will find ${implingClues} clue${ + implingClues === 0 || implingClues > 1 ? 's' : '' + } from ${openedImplings}x ${clueImpling.name}s, and receive the following loot: ${implingLoot}.`; } duration = timeToFinish * quantity; @@ -415,8 +416,10 @@ export const clueCommand: OSBMahojiCommand = { duration, type: 'ClueCompletion' }); - return `${user.minionName} is now completing ${quantity}x ${clueTier.name - } clues, it'll take around ${formatDuration(duration)} to finish.${boosts.length > 0 ? `\n\n**Boosts:** ${boosts.join(', ')}.` : '' - }${implingLootString}`; + return `${user.minionName} is now completing ${quantity}x ${ + clueTier.name + } clues, it'll take around ${formatDuration(duration)} to finish.${ + boosts.length > 0 ? `\n\n**Boosts:** ${boosts.join(', ')}.` : '' + }${implingLootString}`; } }; From 940b7e0327cf34f22d8b993f6519c59d0c29ea9a Mon Sep 17 00:00:00 2001 From: Arodab Date: Wed, 16 Oct 2024 20:01:09 -0300 Subject: [PATCH 05/10] boost for stashes and combat stats --- src/lib/clues/clueTiers.ts | 10 +-- src/mahoji/commands/clue.ts | 170 ++++++++++++++++++++++-------------- 2 files changed, 109 insertions(+), 71 deletions(-) diff --git a/src/lib/clues/clueTiers.ts b/src/lib/clues/clueTiers.ts index 1ca021792f..6a9367959d 100644 --- a/src/lib/clues/clueTiers.ts +++ b/src/lib/clues/clueTiers.ts @@ -53,7 +53,7 @@ export const ClueTiers: ClueTier[] = [ table: Beginner, id: 23_245, scrollID: 23_182, - timeToFinish: Time.Minute * 2.1, + timeToFinish: Time.Minute * 2.5, mimicChance: false, allItems: BeginnerCasket.allItems, stashUnits: beginnerStashes, @@ -66,7 +66,7 @@ export const ClueTiers: ClueTier[] = [ table: Easy, id: 20_546, scrollID: 2677, - timeToFinish: Time.Minute * 3.5, + timeToFinish: Time.Minute * 3.2, milestoneReward: { itemReward: itemID('Large spade'), scoreNeeded: 500 @@ -83,7 +83,7 @@ export const ClueTiers: ClueTier[] = [ table: Medium, id: 20_545, scrollID: 2801, - timeToFinish: Time.Minute * 6.0, + timeToFinish: Time.Minute * 5.1, milestoneReward: { itemReward: itemID('Clueless scroll'), scoreNeeded: 400 @@ -100,7 +100,7 @@ export const ClueTiers: ClueTier[] = [ table: Hard, id: 20_544, scrollID: 2722, - timeToFinish: Time.Minute * 8.0, + timeToFinish: Time.Minute * 8.5, mimicChance: false, allItems: HardCasket.allItems, stashUnits: hardStashes, @@ -113,7 +113,7 @@ export const ClueTiers: ClueTier[] = [ table: Elite, id: 20_543, scrollID: 12_073, - timeToFinish: Time.Minute * 13.5, + timeToFinish: Time.Minute * 15.0, milestoneReward: { itemReward: itemID('Heavy casket'), scoreNeeded: 200 diff --git a/src/mahoji/commands/clue.ts b/src/mahoji/commands/clue.ts index 3ab6b2754d..fc017b603a 100644 --- a/src/mahoji/commands/clue.ts +++ b/src/mahoji/commands/clue.ts @@ -9,17 +9,33 @@ import { ClueTiers } from '../../lib/clues/clueTiers'; import { allOpenables, getOpenableLoot } from '../../lib/openables'; import { getPOHObject } from '../../lib/poh'; import type { ClueActivityTaskOptions } from '../../lib/types/minions'; -import { formatDuration, stringMatches } from '../../lib/util'; +import { formatDuration, isWeekend, stringMatches } from '../../lib/util'; import addSubTaskToActivityTask from '../../lib/util/addSubTaskToActivityTask'; import { calcMaxTripLength } from '../../lib/util/calcMaxTripLength'; import getOSItem, { getItem } from '../../lib/util/getOSItem'; import { getPOH } from '../lib/abstracted_commands/pohCommand'; import type { OSBMahojiCommand } from '../lib/util'; import { addToOpenablesScores, getMahojiBank, mahojiUsersSettingsFetch } from '../mahojiSettings'; +import { getParsedStashUnits } from '../../mahoji/lib/abstracted_commands/stashUnitsCommand'; +import { SkillsEnum } from '../../lib/skilling/types'; + +async function getStashBoost(userID: string, tierName: string): Promise { + const parsedUnits = await getParsedStashUnits(userID); + + // Filter parsed units based on the found stash tier + const tierSpecificUnits = parsedUnits.filter(unit => unit.tier.tier === tierName); + const filledUnits = tierSpecificUnits.filter(unit => unit.builtUnit !== undefined && unit.builtUnit.items_contained.length > 0).length; + const totalUnits = tierSpecificUnits.length; + const percentageFilled = totalUnits > 0 ? (filledUnits / totalUnits) * 100 : 0; + + const boost = Math.min((percentageFilled / 100) * 15, 15); + + return boost; +} function reducedClueTime(clueTier: ClueTier, score: number) { - // Every 1 hour become 1% better to a cap of 25% - const percentReduced = Math.min(Math.floor(score / ((Time.Hour * 1) / clueTier.timeToFinish)), 25); + // Every 2 hours become 1% better to a cap of 25% + const percentReduced = Math.min(Math.floor(score / ((Time.Hour * 2) / clueTier.timeToFinish)), 25); const amountReduced = (clueTier.timeToFinish * percentReduced) / 100; const reducedTime = clueTier.timeToFinish - amountReduced; @@ -154,17 +170,42 @@ export const clueCommand: OSBMahojiCommand = { const hasJewelleryBox = poh.jewellery_box !== null; const hasXericTalisman = poh.amulet === getPOHObject("Mounted xeric's talisman").id; + // Stash Unit boost + const stashBoost = await getStashBoost(userID, clueTier.name); + boosts.push(`${stashBoost.toFixed(2)}% for built STASH Units`); + duration *= (1 - stashBoost / 100); + + // Combat stats boost + if (['Hard', 'Elite', 'Master'].includes(clueTier.name)) { + const totalCombatStats = user.skillLevel(SkillsEnum.Attack) + user.skillLevel(SkillsEnum.Strength) + user.skillLevel(SkillsEnum.Ranged); + let combatBoost = totalCombatStats / (3 * 99) * 100; + + if (combatBoost < 50) { + combatBoost = combatBoost - 50; + } else { + combatBoost = Math.min(10, combatBoost / 6.5); + } + + boosts.push(`${combatBoost.toFixed(2)}% for combat stats`); // Add boost to the boosts array + duration *= (1 - combatBoost / 100); // Adjust duration based on the combat boost + } + // Global Boosts const globalBoosts = [ + { + condition: isWeekend, + boost: '10% for Weekend', + durationMultiplier: 0.9 + }, { condition: () => user.hasEquippedOrInBank('Max cape'), - boost: '15% for Max cape', - durationMultiplier: 0.85 + boost: '10% for Max cape', + durationMultiplier: 0.90 }, { condition: () => !user.hasEquippedOrInBank('Max cape') && user.hasEquippedOrInBank('Construct. cape'), - boost: '10% for Construction cape', - durationMultiplier: 0.9 + boost: '6% for Construction cape', + durationMultiplier: 0.94 }, { condition: () => hasOrnateJewelleryBox, @@ -187,8 +228,8 @@ export const clueCommand: OSBMahojiCommand = { // Xeric's Talisman boost if (clueTier.name === 'Medium' && hasXericTalisman) { - boosts.push("10% for Mounted Xeric's Talisman"); - duration *= 0.9; + boosts.push("5% for Mounted Xeric's Talisman"); + duration *= 0.95; } // Specific boosts @@ -196,8 +237,8 @@ export const clueCommand: OSBMahojiCommand = { Beginner: [ { item: getOSItem('Ring of the elements'), - boost: '5% for Ring of the elements', - durationMultiplier: 0.95 + boost: '10% for Ring of the elements', + durationMultiplier: 0.90 }, { item: getOSItem('Skull sceptre'), @@ -208,57 +249,57 @@ export const clueCommand: OSBMahojiCommand = { Easy: [ { item: getOSItem('Achievement diary cape'), - boost: '15% for Achievement diary cape', - durationMultiplier: 0.85 + boost: '10% for Achievement diary cape', + durationMultiplier: 0.90 }, { item: getOSItem('Ring of the elements'), boost: '10% for Ring of the elements', - durationMultiplier: 0.9 + durationMultiplier: 0.90 }, { item: getOSItem('Skull sceptre'), - boost: '10% for Skull sceptre', - durationMultiplier: 0.9 + boost: '5% for Skull sceptre', + durationMultiplier: 0.95 }, { item: getOSItem('Music cape'), - boost: '10% for Music cape', - durationMultiplier: 0.9 + boost: '5% for Music cape', + durationMultiplier: 0.95 } ], Medium: [ { item: getOSItem('Achievement diary cape'), - boost: '15% for Achievement diary cape', - durationMultiplier: 0.85 + boost: '10% for Achievement diary cape', + durationMultiplier: 0.90 }, { item: getOSItem('Ring of the elements'), - boost: '15% for Ring of the elements', - durationMultiplier: 0.85 + boost: '10% for Ring of the elements', + durationMultiplier: 0.90 }, { item: getOSItem('Skull sceptre'), - boost: '10% for Skull sceptre', - durationMultiplier: 0.9 + boost: '5% for Skull sceptre', + durationMultiplier: 0.95 }, { item: getOSItem('Music cape'), - boost: '10% for Music cape', - durationMultiplier: 0.9 + boost: '5% for Music cape', + durationMultiplier: 0.95 } ], Hard: [ { item: getOSItem('Achievement diary cape'), - boost: '15% for Achievement diary cape', - durationMultiplier: 0.85 + boost: '10% for Achievement diary cape', + durationMultiplier: 0.90 }, { item: getOSItem('Wilderness sword 3'), - boost: '10% for Wilderness sword 3', - durationMultiplier: 0.9 + boost: '5% for Wilderness sword 3', + durationMultiplier: 0.95 }, { item: getOSItem('Royal seed pod'), @@ -277,30 +318,30 @@ export const clueCommand: OSBMahojiCommand = { }, { item: getOSItem('Toxic blowpipe'), - boost: '10% for Toxic blowpipe', - durationMultiplier: 0.9 + boost: '5% for Toxic blowpipe', + durationMultiplier: 0.95 }, { item: getOSItem('Book of the dead'), - boost: '10% for Book of the dead', - durationMultiplier: 0.9 + boost: '5% for Book of the dead', + durationMultiplier: 0.95 } ], Elite: [ { item: getOSItem('Achievement diary cape'), - boost: '12% for Achievement diary cape', - durationMultiplier: 0.88 + boost: '10% for Achievement diary cape', + durationMultiplier: 0.90 }, { item: getOSItem('Kandarin headgear 4'), - boost: '10% for Kandarin headgear 4', - durationMultiplier: 0.9 + boost: '5% for Kandarin headgear 4', + durationMultiplier: 0.95 }, { item: getOSItem('Fremennik sea boots 4'), - boost: '5% for Fremennik sea boots 4', - durationMultiplier: 0.95 + boost: '3% for Fremennik sea boots 4', + durationMultiplier: 0.97 }, { item: getOSItem("Pharaoh's sceptre"), @@ -309,50 +350,50 @@ export const clueCommand: OSBMahojiCommand = { }, { item: getOSItem('Toxic blowpipe'), - boost: '5% for Toxic blowpipe', - durationMultiplier: 0.95 + boost: '4% for Toxic blowpipe', + durationMultiplier: 0.96 }, { item: getOSItem('Book of the dead'), - boost: '10% for Book of the dead', - durationMultiplier: 0.9 + boost: '5% for Book of the dead', + durationMultiplier: 0.95 } ], Master: [ { item: getOSItem('Achievement diary cape'), - boost: '12% for Achievement diary cape', - durationMultiplier: 0.88 + boost: '10% for Achievement diary cape', + durationMultiplier: 0.90 }, { item: getOSItem('Kandarin headgear 4'), - boost: '10% for Kandarin headgear 4', - durationMultiplier: 0.9 + boost: '6% for Kandarin headgear 4', + durationMultiplier: 0.94 }, { item: getOSItem('Music cape'), - boost: '10% for Music cape', - durationMultiplier: 0.9 + boost: '5% for Music cape', + durationMultiplier: 0.95 }, { item: getOSItem('Eternal teleport crystal'), - boost: '5% for Eternal teleport crystal', - durationMultiplier: 0.95 + boost: '3% for Eternal teleport crystal', + durationMultiplier: 0.97 }, { item: getOSItem('Toxic blowpipe'), - boost: '5% for Toxic blowpipe', - durationMultiplier: 0.95 + boost: '2% for Toxic blowpipe', + durationMultiplier: 0.98 }, { item: getOSItem('Dragon claws'), - boost: '3% for Dragon claws', - durationMultiplier: 0.97 + boost: '1% for Dragon claws', + durationMultiplier: 0.99 }, { item: getOSItem('Book of the dead'), - boost: '10% for Book of the dead', - durationMultiplier: 0.9 + boost: '5% for Book of the dead', + durationMultiplier: 0.95 } ] }; @@ -399,9 +440,8 @@ export const clueCommand: OSBMahojiCommand = { return `You don't have any clues, and didn't find any in ${openedImplings}x ${clueImpling.name}s. At least you received the following loot: ${implingLoot}.`; } quantity = bankedClues + implingClues; - implingLootString = `\n\nYou will find ${implingClues} clue${ - implingClues === 0 || implingClues > 1 ? 's' : '' - } from ${openedImplings}x ${clueImpling.name}s, and receive the following loot: ${implingLoot}.`; + implingLootString = `\n\nYou will find ${implingClues} clue${implingClues === 0 || implingClues > 1 ? 's' : '' + } from ${openedImplings}x ${clueImpling.name}s, and receive the following loot: ${implingLoot}.`; } duration = timeToFinish * quantity; @@ -416,10 +456,8 @@ export const clueCommand: OSBMahojiCommand = { duration, type: 'ClueCompletion' }); - return `${user.minionName} is now completing ${quantity}x ${ - clueTier.name - } clues, it'll take around ${formatDuration(duration)} to finish.${ - boosts.length > 0 ? `\n\n**Boosts:** ${boosts.join(', ')}.` : '' - }${implingLootString}`; + return `${user.minionName} is now completing ${quantity}x ${clueTier.name + } clues, it'll take around ${formatDuration(duration)} to finish (${(quantity / duration * 3600000).toFixed(1)}/hr).${boosts.length > 0 ? `\n\n**Boosts:** ${boosts.join(', ')}.` : '' + }${implingLootString}`; } }; From 4120f944ab1e8ee4ebaf4ddf816e62aeeb662132 Mon Sep 17 00:00:00 2001 From: Arodab Date: Wed, 16 Oct 2024 20:02:09 -0300 Subject: [PATCH 06/10] comments --- src/mahoji/commands/clue.ts | 50 +++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/src/mahoji/commands/clue.ts b/src/mahoji/commands/clue.ts index fc017b603a..8544601d68 100644 --- a/src/mahoji/commands/clue.ts +++ b/src/mahoji/commands/clue.ts @@ -8,23 +8,25 @@ import type { ClueTier } from '../../lib/clues/clueTiers'; import { ClueTiers } from '../../lib/clues/clueTiers'; import { allOpenables, getOpenableLoot } from '../../lib/openables'; import { getPOHObject } from '../../lib/poh'; +import { SkillsEnum } from '../../lib/skilling/types'; import type { ClueActivityTaskOptions } from '../../lib/types/minions'; import { formatDuration, isWeekend, stringMatches } from '../../lib/util'; import addSubTaskToActivityTask from '../../lib/util/addSubTaskToActivityTask'; import { calcMaxTripLength } from '../../lib/util/calcMaxTripLength'; import getOSItem, { getItem } from '../../lib/util/getOSItem'; +import { getParsedStashUnits } from '../../mahoji/lib/abstracted_commands/stashUnitsCommand'; import { getPOH } from '../lib/abstracted_commands/pohCommand'; import type { OSBMahojiCommand } from '../lib/util'; import { addToOpenablesScores, getMahojiBank, mahojiUsersSettingsFetch } from '../mahojiSettings'; -import { getParsedStashUnits } from '../../mahoji/lib/abstracted_commands/stashUnitsCommand'; -import { SkillsEnum } from '../../lib/skilling/types'; async function getStashBoost(userID: string, tierName: string): Promise { const parsedUnits = await getParsedStashUnits(userID); // Filter parsed units based on the found stash tier const tierSpecificUnits = parsedUnits.filter(unit => unit.tier.tier === tierName); - const filledUnits = tierSpecificUnits.filter(unit => unit.builtUnit !== undefined && unit.builtUnit.items_contained.length > 0).length; + const filledUnits = tierSpecificUnits.filter( + unit => unit.builtUnit !== undefined && unit.builtUnit.items_contained.length > 0 + ).length; const totalUnits = tierSpecificUnits.length; const percentageFilled = totalUnits > 0 ? (filledUnits / totalUnits) * 100 : 0; @@ -173,12 +175,15 @@ export const clueCommand: OSBMahojiCommand = { // Stash Unit boost const stashBoost = await getStashBoost(userID, clueTier.name); boosts.push(`${stashBoost.toFixed(2)}% for built STASH Units`); - duration *= (1 - stashBoost / 100); + duration *= 1 - stashBoost / 100; // Combat stats boost if (['Hard', 'Elite', 'Master'].includes(clueTier.name)) { - const totalCombatStats = user.skillLevel(SkillsEnum.Attack) + user.skillLevel(SkillsEnum.Strength) + user.skillLevel(SkillsEnum.Ranged); - let combatBoost = totalCombatStats / (3 * 99) * 100; + const totalCombatStats = + user.skillLevel(SkillsEnum.Attack) + + user.skillLevel(SkillsEnum.Strength) + + user.skillLevel(SkillsEnum.Ranged); + let combatBoost = (totalCombatStats / (3 * 99)) * 100; if (combatBoost < 50) { combatBoost = combatBoost - 50; @@ -187,7 +192,7 @@ export const clueCommand: OSBMahojiCommand = { } boosts.push(`${combatBoost.toFixed(2)}% for combat stats`); // Add boost to the boosts array - duration *= (1 - combatBoost / 100); // Adjust duration based on the combat boost + duration *= 1 - combatBoost / 100; // Adjust duration based on the combat boost } // Global Boosts @@ -200,7 +205,7 @@ export const clueCommand: OSBMahojiCommand = { { condition: () => user.hasEquippedOrInBank('Max cape'), boost: '10% for Max cape', - durationMultiplier: 0.90 + durationMultiplier: 0.9 }, { condition: () => !user.hasEquippedOrInBank('Max cape') && user.hasEquippedOrInBank('Construct. cape'), @@ -238,7 +243,7 @@ export const clueCommand: OSBMahojiCommand = { { item: getOSItem('Ring of the elements'), boost: '10% for Ring of the elements', - durationMultiplier: 0.90 + durationMultiplier: 0.9 }, { item: getOSItem('Skull sceptre'), @@ -250,12 +255,12 @@ export const clueCommand: OSBMahojiCommand = { { item: getOSItem('Achievement diary cape'), boost: '10% for Achievement diary cape', - durationMultiplier: 0.90 + durationMultiplier: 0.9 }, { item: getOSItem('Ring of the elements'), boost: '10% for Ring of the elements', - durationMultiplier: 0.90 + durationMultiplier: 0.9 }, { item: getOSItem('Skull sceptre'), @@ -272,12 +277,12 @@ export const clueCommand: OSBMahojiCommand = { { item: getOSItem('Achievement diary cape'), boost: '10% for Achievement diary cape', - durationMultiplier: 0.90 + durationMultiplier: 0.9 }, { item: getOSItem('Ring of the elements'), boost: '10% for Ring of the elements', - durationMultiplier: 0.90 + durationMultiplier: 0.9 }, { item: getOSItem('Skull sceptre'), @@ -294,7 +299,7 @@ export const clueCommand: OSBMahojiCommand = { { item: getOSItem('Achievement diary cape'), boost: '10% for Achievement diary cape', - durationMultiplier: 0.90 + durationMultiplier: 0.9 }, { item: getOSItem('Wilderness sword 3'), @@ -331,7 +336,7 @@ export const clueCommand: OSBMahojiCommand = { { item: getOSItem('Achievement diary cape'), boost: '10% for Achievement diary cape', - durationMultiplier: 0.90 + durationMultiplier: 0.9 }, { item: getOSItem('Kandarin headgear 4'), @@ -363,7 +368,7 @@ export const clueCommand: OSBMahojiCommand = { { item: getOSItem('Achievement diary cape'), boost: '10% for Achievement diary cape', - durationMultiplier: 0.90 + durationMultiplier: 0.9 }, { item: getOSItem('Kandarin headgear 4'), @@ -440,8 +445,9 @@ export const clueCommand: OSBMahojiCommand = { return `You don't have any clues, and didn't find any in ${openedImplings}x ${clueImpling.name}s. At least you received the following loot: ${implingLoot}.`; } quantity = bankedClues + implingClues; - implingLootString = `\n\nYou will find ${implingClues} clue${implingClues === 0 || implingClues > 1 ? 's' : '' - } from ${openedImplings}x ${clueImpling.name}s, and receive the following loot: ${implingLoot}.`; + implingLootString = `\n\nYou will find ${implingClues} clue${ + implingClues === 0 || implingClues > 1 ? 's' : '' + } from ${openedImplings}x ${clueImpling.name}s, and receive the following loot: ${implingLoot}.`; } duration = timeToFinish * quantity; @@ -456,8 +462,10 @@ export const clueCommand: OSBMahojiCommand = { duration, type: 'ClueCompletion' }); - return `${user.minionName} is now completing ${quantity}x ${clueTier.name - } clues, it'll take around ${formatDuration(duration)} to finish (${(quantity / duration * 3600000).toFixed(1)}/hr).${boosts.length > 0 ? `\n\n**Boosts:** ${boosts.join(', ')}.` : '' - }${implingLootString}`; + return `${user.minionName} is now completing ${quantity}x ${ + clueTier.name + } clues, it'll take around ${formatDuration(duration)} to finish (${((quantity / duration) * 3600000).toFixed(1)}/hr).${ + boosts.length > 0 ? `\n\n**Boosts:** ${boosts.join(', ')}.` : '' + }${implingLootString}`; } }; From 37e590768d06d33dcf0a773d5a732f1100a9c172 Mon Sep 17 00:00:00 2001 From: Arodab Date: Wed, 23 Oct 2024 21:09:43 -0300 Subject: [PATCH 07/10] boost structure --- src/lib/clues/clueTiers.ts | 2 +- src/mahoji/commands/clue.ts | 191 +++++++++++++----------------------- 2 files changed, 71 insertions(+), 122 deletions(-) diff --git a/src/lib/clues/clueTiers.ts b/src/lib/clues/clueTiers.ts index 6a9367959d..c85a613208 100644 --- a/src/lib/clues/clueTiers.ts +++ b/src/lib/clues/clueTiers.ts @@ -53,7 +53,7 @@ export const ClueTiers: ClueTier[] = [ table: Beginner, id: 23_245, scrollID: 23_182, - timeToFinish: Time.Minute * 2.5, + timeToFinish: Time.Minute * 2.8, mimicChance: false, allItems: BeginnerCasket.allItems, stashUnits: beginnerStashes, diff --git a/src/mahoji/commands/clue.ts b/src/mahoji/commands/clue.ts index 8544601d68..279b334161 100644 --- a/src/mahoji/commands/clue.ts +++ b/src/mahoji/commands/clue.ts @@ -2,7 +2,7 @@ import type { CommandRunOptions } from '@oldschoolgg/toolkit/util'; import { ApplicationCommandOptionType } from 'discord.js'; import { Time, notEmpty, randInt } from 'e'; import { Bank } from 'oldschooljs'; -import type { Item, ItemBank } from 'oldschooljs/dist/meta/types'; +import type { ItemBank } from 'oldschooljs/dist/meta/types'; import type { ClueTier } from '../../lib/clues/clueTiers'; import { ClueTiers } from '../../lib/clues/clueTiers'; @@ -13,7 +13,7 @@ import type { ClueActivityTaskOptions } from '../../lib/types/minions'; import { formatDuration, isWeekend, stringMatches } from '../../lib/util'; import addSubTaskToActivityTask from '../../lib/util/addSubTaskToActivityTask'; import { calcMaxTripLength } from '../../lib/util/calcMaxTripLength'; -import getOSItem, { getItem } from '../../lib/util/getOSItem'; +import { getItem } from '../../lib/util/getOSItem'; import { getParsedStashUnits } from '../../mahoji/lib/abstracted_commands/stashUnitsCommand'; import { getPOH } from '../lib/abstracted_commands/pohCommand'; import type { OSBMahojiCommand } from '../lib/util'; @@ -44,41 +44,6 @@ function reducedClueTime(clueTier: ClueTier, score: number) { return [reducedTime, percentReduced]; } -function shouldApplyBoost(clueTier: ClueTier, item: string, hasAchievementDiaryCape: boolean) { - switch (clueTier.name) { - case 'Elite': - return (item !== 'Kandarin headgear 4' && item !== 'Fremennik sea boots 4') || !hasAchievementDiaryCape; - case 'Master': - return item !== 'Kandarin headgear 4' || !hasAchievementDiaryCape; - case 'Hard': - return item !== 'Wilderness sword 3' || !hasAchievementDiaryCape; - default: - return true; - } -} - -interface ClueBoost { - item: Item; - boost: string; - durationMultiplier: number; -} - -function applyClueBoosts(user: MUser, boostList: ClueBoost[], boosts: string[], duration: number, clueTier: ClueTier) { - let hasAchievementDiaryCape = false; - for (const boost of boostList) { - if (user.hasEquippedOrInBank(boost.item.name)) { - if (shouldApplyBoost(clueTier, boost.item.name, hasAchievementDiaryCape)) { - boosts.push(boost.boost); - duration *= boost.durationMultiplier; - } - if (boost.item.name === 'Achievement diary cape') { - hasAchievementDiaryCape = true; - } - } - } - return { duration, boosts }; -} - export const clueCommand: OSBMahojiCommand = { name: 'clue', description: 'Send your minion to complete clue scrolls.', @@ -171,6 +136,7 @@ export const clueCommand: OSBMahojiCommand = { const hasOrnateJewelleryBox = poh.jewellery_box === getPOHObject('Ornate jewellery box').id; const hasJewelleryBox = poh.jewellery_box !== null; const hasXericTalisman = poh.amulet === getPOHObject("Mounted xeric's talisman").id; + const hasAchievementDiaryCape = user.hasEquippedOrInBank('Achievement diary cape'); // Stash Unit boost const stashBoost = await getStashBoost(userID, clueTier.name); @@ -191,12 +157,12 @@ export const clueCommand: OSBMahojiCommand = { combatBoost = Math.min(10, combatBoost / 6.5); } - boosts.push(`${combatBoost.toFixed(2)}% for combat stats`); // Add boost to the boosts array - duration *= 1 - combatBoost / 100; // Adjust duration based on the combat boost + boosts.push(`${combatBoost.toFixed(2)}% for combat stats`); + duration *= 1 - combatBoost / 100; } // Global Boosts - const globalBoosts = [ + const clueBoosts = [ { condition: isWeekend, boost: '10% for Weekend', @@ -221,193 +187,179 @@ export const clueCommand: OSBMahojiCommand = { condition: () => !hasOrnateJewelleryBox && hasJewelleryBox, boost: '5% for Basic/Fancy jewellery box', durationMultiplier: 0.95 + }, + { + condition: () => hasAchievementDiaryCape, + boost: '10% for Achievement diary cape', + durationMultiplier: 0.9 } ]; - for (const { condition, boost, durationMultiplier } of globalBoosts) { + for (const { condition, boost, durationMultiplier } of clueBoosts) { if (condition()) { boosts.push(boost); duration *= durationMultiplier; } } - // Xeric's Talisman boost - if (clueTier.name === 'Medium' && hasXericTalisman) { - boosts.push("5% for Mounted Xeric's Talisman"); - duration *= 0.95; - } - - // Specific boosts - const clueTierBoosts: Record = { + // Specific tier boosts + const clueTierBoosts: Record< + ClueTier['name'], + { condition: () => boolean; boost: string; durationMultiplier: number }[] + > = { Beginner: [ { - item: getOSItem('Ring of the elements'), + condition: () => user.hasEquippedOrInBank('Ring of the elements'), boost: '10% for Ring of the elements', durationMultiplier: 0.9 }, { - item: getOSItem('Skull sceptre'), + condition: () => user.hasEquippedOrInBank('Skull sceptre'), boost: '5% for Skull sceptre', durationMultiplier: 0.95 } ], Easy: [ { - item: getOSItem('Achievement diary cape'), - boost: '10% for Achievement diary cape', - durationMultiplier: 0.9 - }, - { - item: getOSItem('Ring of the elements'), + condition: () => user.hasEquippedOrInBank('Ring of the elements'), boost: '10% for Ring of the elements', durationMultiplier: 0.9 }, { - item: getOSItem('Skull sceptre'), + condition: () => user.hasEquippedOrInBank('Skull sceptre'), boost: '5% for Skull sceptre', durationMultiplier: 0.95 }, { - item: getOSItem('Music cape'), + condition: () => user.hasEquippedOrInBank('Music cape'), boost: '5% for Music cape', durationMultiplier: 0.95 } ], Medium: [ { - item: getOSItem('Achievement diary cape'), - boost: '10% for Achievement diary cape', - durationMultiplier: 0.9 + condition: () => hasXericTalisman, + boost: "5% for Mounted Xeric's Talisman", + durationMultiplier: 0.95 }, { - item: getOSItem('Ring of the elements'), + condition: () => user.hasEquippedOrInBank('Ring of the elements'), boost: '10% for Ring of the elements', durationMultiplier: 0.9 }, { - item: getOSItem('Skull sceptre'), + condition: () => user.hasEquippedOrInBank('Skull sceptre'), boost: '5% for Skull sceptre', durationMultiplier: 0.95 }, { - item: getOSItem('Music cape'), + condition: () => user.hasEquippedOrInBank('Music cape'), boost: '5% for Music cape', durationMultiplier: 0.95 } ], Hard: [ { - item: getOSItem('Achievement diary cape'), - boost: '10% for Achievement diary cape', - durationMultiplier: 0.9 + condition: () => user.hasEquippedOrInBank('Book of the dead'), + boost: '5% for Book of the dead', + durationMultiplier: 0.95 }, { - item: getOSItem('Wilderness sword 3'), + condition: () => user.hasEquippedOrInBank('Wilderness sword 3') && !hasAchievementDiaryCape, boost: '5% for Wilderness sword 3', durationMultiplier: 0.95 }, { - item: getOSItem('Royal seed pod'), + condition: () => user.hasEquippedOrInBank('Royal seed pod'), boost: '5% for Royal seed pod', durationMultiplier: 0.95 }, { - item: getOSItem('Eternal teleport crystal'), + condition: () => user.hasEquippedOrInBank('Eternal teleport crystal'), boost: '5% for Eternal teleport crystal', durationMultiplier: 0.95 }, { - item: getOSItem("Pharaoh's sceptre"), + condition: () => user.hasEquippedOrInBank("Pharaoh's sceptre"), boost: "5% for Pharaoh's sceptre", durationMultiplier: 0.95 }, { - item: getOSItem('Toxic blowpipe'), + condition: () => user.hasEquippedOrInBank('Toxic blowpipe'), boost: '5% for Toxic blowpipe', durationMultiplier: 0.95 - }, - { - item: getOSItem('Book of the dead'), - boost: '5% for Book of the dead', - durationMultiplier: 0.95 } ], Elite: [ { - item: getOSItem('Achievement diary cape'), - boost: '10% for Achievement diary cape', - durationMultiplier: 0.9 + condition: () => user.hasEquippedOrInBank('Book of the dead'), + boost: '5% for Book of the dead', + durationMultiplier: 0.95 + }, + { + condition: () => user.hasEquippedOrInBank("Pharaoh's sceptre"), + boost: "5% for Pharaoh's sceptre", + durationMultiplier: 0.95 }, { - item: getOSItem('Kandarin headgear 4'), + condition: () => user.hasEquippedOrInBank('Kandarin headgear 4') && !hasAchievementDiaryCape, boost: '5% for Kandarin headgear 4', durationMultiplier: 0.95 }, { - item: getOSItem('Fremennik sea boots 4'), + condition: () => user.hasEquippedOrInBank('Fremennik sea boots 4') && !hasAchievementDiaryCape, boost: '3% for Fremennik sea boots 4', durationMultiplier: 0.97 }, { - item: getOSItem("Pharaoh's sceptre"), - boost: "5% for Pharaoh's sceptre", - durationMultiplier: 0.95 - }, - { - item: getOSItem('Toxic blowpipe'), + condition: () => user.hasEquippedOrInBank('Toxic blowpipe'), boost: '4% for Toxic blowpipe', durationMultiplier: 0.96 - }, - { - item: getOSItem('Book of the dead'), - boost: '5% for Book of the dead', - durationMultiplier: 0.95 } ], Master: [ { - item: getOSItem('Achievement diary cape'), - boost: '10% for Achievement diary cape', - durationMultiplier: 0.9 - }, - { - item: getOSItem('Kandarin headgear 4'), + condition: () => user.hasEquippedOrInBank('Kandarin headgear 4') && !hasAchievementDiaryCape, boost: '6% for Kandarin headgear 4', durationMultiplier: 0.94 }, { - item: getOSItem('Music cape'), + condition: () => user.hasEquippedOrInBank('Book of the dead'), + boost: '5% for Book of the dead', + durationMultiplier: 0.95 + }, + { + condition: () => user.hasEquippedOrInBank('Music cape'), boost: '5% for Music cape', durationMultiplier: 0.95 }, { - item: getOSItem('Eternal teleport crystal'), + condition: () => user.hasEquippedOrInBank('Eternal teleport crystal'), boost: '3% for Eternal teleport crystal', durationMultiplier: 0.97 }, { - item: getOSItem('Toxic blowpipe'), + condition: () => user.hasEquippedOrInBank('Toxic blowpipe'), boost: '2% for Toxic blowpipe', durationMultiplier: 0.98 }, { - item: getOSItem('Dragon claws'), + condition: () => user.hasEquippedOrInBank('Dragon claws'), boost: '1% for Dragon claws', durationMultiplier: 0.99 - }, - { - item: getOSItem('Book of the dead'), - boost: '5% for Book of the dead', - durationMultiplier: 0.95 } ] }; - const clueTierName = clueTier.name; - const boostList = clueTierBoosts[clueTierName]; - const result = applyClueBoosts(user, boostList, boosts, duration, clueTier); + for (const tierBoost of clueTierBoosts[clueTier.name]) { + const { condition, boost, durationMultiplier } = tierBoost; + if (condition()) { + boosts.push(boost); + duration *= durationMultiplier; + } + } - timeToFinish = result.duration; + timeToFinish = duration; let implingLootString = ''; let implingClues = 0; @@ -445,9 +397,8 @@ export const clueCommand: OSBMahojiCommand = { return `You don't have any clues, and didn't find any in ${openedImplings}x ${clueImpling.name}s. At least you received the following loot: ${implingLoot}.`; } quantity = bankedClues + implingClues; - implingLootString = `\n\nYou will find ${implingClues} clue${ - implingClues === 0 || implingClues > 1 ? 's' : '' - } from ${openedImplings}x ${clueImpling.name}s, and receive the following loot: ${implingLoot}.`; + implingLootString = `\n\nYou will find ${implingClues} clue${implingClues === 0 || implingClues > 1 ? 's' : '' + } from ${openedImplings}x ${clueImpling.name}s, and receive the following loot: ${implingLoot}.`; } duration = timeToFinish * quantity; @@ -462,10 +413,8 @@ export const clueCommand: OSBMahojiCommand = { duration, type: 'ClueCompletion' }); - return `${user.minionName} is now completing ${quantity}x ${ - clueTier.name - } clues, it'll take around ${formatDuration(duration)} to finish (${((quantity / duration) * 3600000).toFixed(1)}/hr).${ - boosts.length > 0 ? `\n\n**Boosts:** ${boosts.join(', ')}.` : '' - }${implingLootString}`; + return `${user.minionName} is now completing ${quantity}x ${clueTier.name + } clues, it'll take around ${formatDuration(duration)} to finish (${((quantity / duration) * 3600000).toFixed(1)}/hr).${boosts.length > 0 ? `\n\n**Boosts:** ${boosts.join(', ')}.` : '' + }${implingLootString}`; } }; From b29f88a730bba4f9123d32b0da2ad7903e9cf33c Mon Sep 17 00:00:00 2001 From: Arodab Date: Wed, 23 Oct 2024 21:12:06 -0300 Subject: [PATCH 08/10] lint --- src/mahoji/commands/clue.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/mahoji/commands/clue.ts b/src/mahoji/commands/clue.ts index 279b334161..c3a77c06d0 100644 --- a/src/mahoji/commands/clue.ts +++ b/src/mahoji/commands/clue.ts @@ -397,8 +397,9 @@ export const clueCommand: OSBMahojiCommand = { return `You don't have any clues, and didn't find any in ${openedImplings}x ${clueImpling.name}s. At least you received the following loot: ${implingLoot}.`; } quantity = bankedClues + implingClues; - implingLootString = `\n\nYou will find ${implingClues} clue${implingClues === 0 || implingClues > 1 ? 's' : '' - } from ${openedImplings}x ${clueImpling.name}s, and receive the following loot: ${implingLoot}.`; + implingLootString = `\n\nYou will find ${implingClues} clue${ + implingClues === 0 || implingClues > 1 ? 's' : '' + } from ${openedImplings}x ${clueImpling.name}s, and receive the following loot: ${implingLoot}.`; } duration = timeToFinish * quantity; @@ -413,8 +414,10 @@ export const clueCommand: OSBMahojiCommand = { duration, type: 'ClueCompletion' }); - return `${user.minionName} is now completing ${quantity}x ${clueTier.name - } clues, it'll take around ${formatDuration(duration)} to finish (${((quantity / duration) * 3600000).toFixed(1)}/hr).${boosts.length > 0 ? `\n\n**Boosts:** ${boosts.join(', ')}.` : '' - }${implingLootString}`; + return `${user.minionName} is now completing ${quantity}x ${ + clueTier.name + } clues, it'll take around ${formatDuration(duration)} to finish (${((quantity / duration) * 3600000).toFixed(1)}/hr).${ + boosts.length > 0 ? `\n\n**Boosts:** ${boosts.join(', ')}.` : '' + }${implingLootString}`; } }; From 52588e1a6f1f898c242d7c31a55b09ef5bd6c1b6 Mon Sep 17 00:00:00 2001 From: Badora II <79532596+Arodab@users.noreply.github.com> Date: Wed, 23 Oct 2024 22:00:13 -0300 Subject: [PATCH 09/10] revert function name --- src/mahoji/commands/clue.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mahoji/commands/clue.ts b/src/mahoji/commands/clue.ts index c3a77c06d0..aa91ff305f 100644 --- a/src/mahoji/commands/clue.ts +++ b/src/mahoji/commands/clue.ts @@ -162,7 +162,7 @@ export const clueCommand: OSBMahojiCommand = { } // Global Boosts - const clueBoosts = [ + const globalBoosts = [ { condition: isWeekend, boost: '10% for Weekend', @@ -195,7 +195,7 @@ export const clueCommand: OSBMahojiCommand = { } ]; - for (const { condition, boost, durationMultiplier } of clueBoosts) { + for (const { condition, boost, durationMultiplier } of globalBoosts) { if (condition()) { boosts.push(boost); duration *= durationMultiplier; From fe229f815424cf29ef8b9981be8cab88bd066fa8 Mon Sep 17 00:00:00 2001 From: Arodab Date: Thu, 31 Oct 2024 19:24:08 -0300 Subject: [PATCH 10/10] update elite/master --- src/lib/clues/clueTiers.ts | 4 ++-- src/mahoji/commands/clue.ts | 13 +++++-------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/lib/clues/clueTiers.ts b/src/lib/clues/clueTiers.ts index c85a613208..fd312d3b49 100644 --- a/src/lib/clues/clueTiers.ts +++ b/src/lib/clues/clueTiers.ts @@ -113,7 +113,7 @@ export const ClueTiers: ClueTier[] = [ table: Elite, id: 20_543, scrollID: 12_073, - timeToFinish: Time.Minute * 15.0, + timeToFinish: Time.Minute * 8.5, milestoneReward: { itemReward: itemID('Heavy casket'), scoreNeeded: 200 @@ -130,7 +130,7 @@ export const ClueTiers: ClueTier[] = [ table: Master, id: 19_836, scrollID: 19_835, - timeToFinish: Time.Minute * 25.5, + timeToFinish: Time.Minute * 19.5, milestoneReward: { itemReward: itemID('Scroll sack'), scoreNeeded: 100 diff --git a/src/mahoji/commands/clue.ts b/src/mahoji/commands/clue.ts index c3a77c06d0..279b334161 100644 --- a/src/mahoji/commands/clue.ts +++ b/src/mahoji/commands/clue.ts @@ -397,9 +397,8 @@ export const clueCommand: OSBMahojiCommand = { return `You don't have any clues, and didn't find any in ${openedImplings}x ${clueImpling.name}s. At least you received the following loot: ${implingLoot}.`; } quantity = bankedClues + implingClues; - implingLootString = `\n\nYou will find ${implingClues} clue${ - implingClues === 0 || implingClues > 1 ? 's' : '' - } from ${openedImplings}x ${clueImpling.name}s, and receive the following loot: ${implingLoot}.`; + implingLootString = `\n\nYou will find ${implingClues} clue${implingClues === 0 || implingClues > 1 ? 's' : '' + } from ${openedImplings}x ${clueImpling.name}s, and receive the following loot: ${implingLoot}.`; } duration = timeToFinish * quantity; @@ -414,10 +413,8 @@ export const clueCommand: OSBMahojiCommand = { duration, type: 'ClueCompletion' }); - return `${user.minionName} is now completing ${quantity}x ${ - clueTier.name - } clues, it'll take around ${formatDuration(duration)} to finish (${((quantity / duration) * 3600000).toFixed(1)}/hr).${ - boosts.length > 0 ? `\n\n**Boosts:** ${boosts.join(', ')}.` : '' - }${implingLootString}`; + return `${user.minionName} is now completing ${quantity}x ${clueTier.name + } clues, it'll take around ${formatDuration(duration)} to finish (${((quantity / duration) * 3600000).toFixed(1)}/hr).${boosts.length > 0 ? `\n\n**Boosts:** ${boosts.join(', ')}.` : '' + }${implingLootString}`; } };