From 86f10bfa15c283ccd5f2096304e031bdaca9c6f7 Mon Sep 17 00:00:00 2001 From: PatchRequest Date: Tue, 27 Jan 2026 19:48:51 +0100 Subject: [PATCH] Add time-based loot drop weight multipliers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Morgens (6-12 Uhr): Kaffeemühle, Krankschreibung, Oettinger Abends (18-24 Uhr): Döner, Ayran, Sahne, Trichter, Gauloises Co-Authored-By: Claude Opus 4.5 --- src/service/lootDrop.ts | 49 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/src/service/lootDrop.ts b/src/service/lootDrop.ts index ce31f4b8..91a3791a 100644 --- a/src/service/lootDrop.ts +++ b/src/service/lootDrop.ts @@ -362,6 +362,36 @@ type AdjustmentResult = { weights: number[]; }; +function getTimeOfDayMultipliers(weights: readonly number[]): number[] { + const now = new Date(); + const hour = Number( + now.toLocaleString("de-DE", { timeZone: "Europe/Berlin", hour: "numeric", hour12: false }), + ); + + const multipliers = new Array(weights.length).fill(1); + + // Morgens (6:00 - 12:00): Höhere Wahrscheinlichkeit für Frühstücks-Items + const isMorning = hour >= 6 && hour < 12; + // Abends (18:00 - 24:00): Höhere Wahrscheinlichkeit für Feierabend-Items + const isEvening = hour >= 18 && hour < 24; + + if (isMorning) { + multipliers[LootKind.KAFFEEMUEHLE] = 2; + multipliers[LootKind.KRANKSCHREIBUNG] = 2; + multipliers[LootKind.OETTINGER] = 2; + } + + if (isEvening) { + multipliers[LootKind.DOENER] = 2; + multipliers[LootKind.AYRAN] = 2; + multipliers[LootKind.SAHNE] = 2; + multipliers[LootKind.TRICHTER] = 2; + multipliers[LootKind.GAULOISES_BLAU] = 2; + } + + return multipliers; +} + async function getDropWeightAdjustments( user: User, weights: readonly number[], @@ -385,9 +415,26 @@ async function getDropWeightAdjustments( messages.push("Da du privat versichert bist, hast du die doppelte Chance auf eine AU."); } + const timeMultipliers = getTimeOfDayMultipliers(weights); + const newWeights = [...weights]; newWeights[LootKind.NICHTS] = Math.ceil(weights[LootKind.NICHTS] * wasteFactor) | 0; - newWeights[LootKind.KRANKSCHREIBUNG] = (weights[LootKind.KRANKSCHREIBUNG] * pkvFactor) | 0; + newWeights[LootKind.KRANKSCHREIBUNG] = + (weights[LootKind.KRANKSCHREIBUNG] * pkvFactor * timeMultipliers[LootKind.KRANKSCHREIBUNG]) | + 0; + + // Tageszeitabhängige Anpassungen + newWeights[LootKind.KAFFEEMUEHLE] = + (weights[LootKind.KAFFEEMUEHLE] * timeMultipliers[LootKind.KAFFEEMUEHLE]) | 0; + newWeights[LootKind.OETTINGER] = + (weights[LootKind.OETTINGER] * timeMultipliers[LootKind.OETTINGER]) | 0; + newWeights[LootKind.DOENER] = (weights[LootKind.DOENER] * timeMultipliers[LootKind.DOENER]) | 0; + newWeights[LootKind.AYRAN] = (weights[LootKind.AYRAN] * timeMultipliers[LootKind.AYRAN]) | 0; + newWeights[LootKind.SAHNE] = (weights[LootKind.SAHNE] * timeMultipliers[LootKind.SAHNE]) | 0; + newWeights[LootKind.TRICHTER] = + (weights[LootKind.TRICHTER] * timeMultipliers[LootKind.TRICHTER]) | 0; + newWeights[LootKind.GAULOISES_BLAU] = + (weights[LootKind.GAULOISES_BLAU] * timeMultipliers[LootKind.GAULOISES_BLAU]) | 0; return { messages,