diff --git a/src/commands/loot.ts b/src/commands/loot.ts index 13aec08f..dbbec583 100644 --- a/src/commands/loot.ts +++ b/src/commands/loot.ts @@ -10,7 +10,7 @@ import type { ApplicationCommand } from "@/commands/command.js"; import { ensureChatInputCommand } from "@/utils/interactionUtils.js"; import * as lootDataService from "@/service/lootData.js"; -import { adjustLootWithBuffsFromUser } from "@/service/lootDrop.js"; +import { adjustLootWithWeightEffectsFromUser } from "@/service/lootDrop.js"; export default class LootCommand implements ApplicationCommand { name = "loot"; @@ -47,7 +47,10 @@ export default class LootCommand implements ApplicationCommand { // TODO: Lowperformer solution. A diagram with graphviz or something would be cooler const loot = ( - await adjustLootWithBuffsFromUser(interaction.user, lootDataService.lootTemplates) + await adjustLootWithWeightEffectsFromUser( + interaction.user, + lootDataService.lootTemplates, + ) ).loot.filter(l => l.weight > 0); const totalWeight = loot.reduce((acc, curr) => acc + curr.weight, 0); const lootWithProbabilitiy = loot diff --git a/src/service/lootDrop.ts b/src/service/lootDrop.ts index 00c1422f..9d16c8ba 100644 --- a/src/service/lootDrop.ts +++ b/src/service/lootDrop.ts @@ -152,7 +152,10 @@ export async function postLootDrop( return; } - const { messages, loot } = await adjustLootWithBuffsFromUser(interaction.user, lootTemplates); + const { messages, loot } = await adjustLootWithWeightEffectsFromUser( + interaction.user, + lootTemplates, + ); const rarityWeights = lootAttributeTemplates.map(a => a.initialDropWeight ?? 0); const initialAttribute = randomEntryWeighted(lootAttributeTemplates, rarityWeights); @@ -233,7 +236,7 @@ type AdjustmentResult = { loot: LootTemplate[]; }; -export async function adjustLootWithBuffsFromUser( +export async function adjustLootWithWeightEffectsFromUser( user: User, loot: readonly LootTemplate[], ): Promise {