diff --git a/src/lib/colosseum.ts b/src/lib/colosseum.ts index 79b081cf38..00f713c7e0 100644 --- a/src/lib/colosseum.ts +++ b/src/lib/colosseum.ts @@ -666,7 +666,7 @@ export async function colosseumCommand(user: MUser, channelID: string) { } const degradeResults = await degradeChargeBank(user, chargeBank); - messages.push(degradeResults.map(i => i.userMessage).join(', ')); + messages.push(degradeResults); } await addSubTaskToActivityTask({ diff --git a/src/lib/degradeableItems.ts b/src/lib/degradeableItems.ts index 9d29701cd5..c5627e4692 100644 --- a/src/lib/degradeableItems.ts +++ b/src/lib/degradeableItems.ts @@ -399,9 +399,8 @@ export async function degradeItem({ const chargesAfter = user.user[degItem.settingsKey]; assert(typeof chargesAfter === 'number' && chargesAfter > 0); return { - userMessage: `Your ${item.name} degraded by ${chargesToDegrade} charges, and now has ${chargesAfter} remaining${ - pennyReduction > 0 ? `. Your Ghommal's lucky penny saved ${pennyReduction} charges` : '' - }` + chargesToDegrade: chargesToDegrade, + userMessage: `Your ${item.name} degraded by ${chargesToDegrade} charges` }; } @@ -429,10 +428,12 @@ export async function degradeChargeBank(user: MUser, chargeBank: ChargeBank) { for (const [key, chargesToDegrade] of chargeBank.entries()) { const { item } = degradeableItems.find(i => i.settingsKey === key)!; const result = await degradeItem({ item, chargesToDegrade, user }); - results.push(result); + results.push(result.userMessage); } - return results; + if (user.hasEquipped("Ghommal's lucky penny")) results.push("5% reduced charges for Ghommal's lucky penny"); + + return results.join(', '); } export async function refundChargeBank(user: MUser, chargeBank: ChargeBank): Promise { diff --git a/src/lib/structures/UpdateBank.ts b/src/lib/structures/UpdateBank.ts index 0e3f2e5889..dab712eef3 100644 --- a/src/lib/structures/UpdateBank.ts +++ b/src/lib/structures/UpdateBank.ts @@ -72,17 +72,17 @@ export class UpdateBank { // Charges if (this.chargeBank.length() > 0) { - const res = await degradeChargeBank(user, this.chargeBank).then(res => - res.map(p => p.userMessage).join(', ') - ); - if (res) { - results.push(res); + const degradeResults = await degradeChargeBank(user, this.chargeBank); + if (degradeResults) { + results.push(degradeResults); } } // Loot/Cost + const totalCost = new Bank(); if (this.itemCostBank.length > 0) { - await user.specialRemoveItems(this.itemCostBank, { isInWilderness }); + const { realCost } = await user.specialRemoveItems(this.itemCostBank, { isInWilderness }); + totalCost.add(realCost); } let itemTransactionResult: Awaited> | null = null; if (this.itemLootBank.length > 0) { @@ -142,6 +142,7 @@ export class UpdateBank { await user.sync(); return { itemTransactionResult, + totalCost, rawResults: results, message: results.filter(r => typeof r === 'string').join(', ') }; diff --git a/src/mahoji/lib/abstracted_commands/minionKill/minionKill.ts b/src/mahoji/lib/abstracted_commands/minionKill/minionKill.ts index b874105d7e..630568ec61 100644 --- a/src/mahoji/lib/abstracted_commands/minionKill/minionKill.ts +++ b/src/mahoji/lib/abstracted_commands/minionKill/minionKill.ts @@ -97,6 +97,12 @@ export async function minionKillCommand( return updateResult; } + if (updateResult.message.length > 0) result.messages.push(updateResult.message); + + if (updateResult.totalCost.length > 0) { + result.messages.push(`Removing items: ${updateResult.totalCost}`); + } + if (result.updateBank.itemCostBank.length > 0) { await updateBankSetting('economyStats_PVMCost', result.updateBank.itemCostBank); await trackLoot({ diff --git a/src/mahoji/lib/abstracted_commands/minionKill/newMinionKill.ts b/src/mahoji/lib/abstracted_commands/minionKill/newMinionKill.ts index ad5c3be427..1a2c8fc276 100644 --- a/src/mahoji/lib/abstracted_commands/minionKill/newMinionKill.ts +++ b/src/mahoji/lib/abstracted_commands/minionKill/newMinionKill.ts @@ -263,10 +263,6 @@ export function newMinionKillCommand(args: MinionKillOptions) { speedDurationResult.updateBank.itemCostBank.freeze(); speedDurationResult.updateBank.itemLootBank.freeze(); - if (speedDurationResult.updateBank.itemCostBank.length > 0) { - speedDurationResult.messages.push(`Removing items: ${speedDurationResult.updateBank.itemCostBank}`); - } - const result = newMinionKillReturnSchema.parse({ duration, quantity, diff --git a/src/mahoji/lib/abstracted_commands/minionKill/speedBoosts.ts b/src/mahoji/lib/abstracted_commands/minionKill/speedBoosts.ts index 96c798bebc..5e481f3348 100644 --- a/src/mahoji/lib/abstracted_commands/minionKill/speedBoosts.ts +++ b/src/mahoji/lib/abstracted_commands/minionKill/speedBoosts.ts @@ -397,7 +397,7 @@ export const mainBoostEffects: (Boost | Boost[])[] = [ const actualDegItem = degradeableItems.find(i => i.item.id === degItem.item.id); if (!actualDegItem) throw new Error(`Missing actual degradeable item for ${rawItem.item.name}`); charges.add(actualDegItem.settingsKey, chargesNeeded); - messages.push(`${rawItem.boostPercent}% for ${rawItem.item.name} (${chargesNeeded} charges)`); + messages.push(`${rawItem.boostPercent}% for ${rawItem.item.name}`); } return {