Skip to content

Commit 86f10bf

Browse files
PatchRequestclaude
andcommitted
Add time-based loot drop weight multipliers
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 <noreply@anthropic.com>
1 parent 4f4527c commit 86f10bf

1 file changed

Lines changed: 48 additions & 1 deletion

File tree

src/service/lootDrop.ts

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,36 @@ type AdjustmentResult = {
362362
weights: number[];
363363
};
364364

365+
function getTimeOfDayMultipliers(weights: readonly number[]): number[] {
366+
const now = new Date();
367+
const hour = Number(
368+
now.toLocaleString("de-DE", { timeZone: "Europe/Berlin", hour: "numeric", hour12: false }),
369+
);
370+
371+
const multipliers = new Array(weights.length).fill(1);
372+
373+
// Morgens (6:00 - 12:00): Höhere Wahrscheinlichkeit für Frühstücks-Items
374+
const isMorning = hour >= 6 && hour < 12;
375+
// Abends (18:00 - 24:00): Höhere Wahrscheinlichkeit für Feierabend-Items
376+
const isEvening = hour >= 18 && hour < 24;
377+
378+
if (isMorning) {
379+
multipliers[LootKind.KAFFEEMUEHLE] = 2;
380+
multipliers[LootKind.KRANKSCHREIBUNG] = 2;
381+
multipliers[LootKind.OETTINGER] = 2;
382+
}
383+
384+
if (isEvening) {
385+
multipliers[LootKind.DOENER] = 2;
386+
multipliers[LootKind.AYRAN] = 2;
387+
multipliers[LootKind.SAHNE] = 2;
388+
multipliers[LootKind.TRICHTER] = 2;
389+
multipliers[LootKind.GAULOISES_BLAU] = 2;
390+
}
391+
392+
return multipliers;
393+
}
394+
365395
async function getDropWeightAdjustments(
366396
user: User,
367397
weights: readonly number[],
@@ -385,9 +415,26 @@ async function getDropWeightAdjustments(
385415
messages.push("Da du privat versichert bist, hast du die doppelte Chance auf eine AU.");
386416
}
387417

418+
const timeMultipliers = getTimeOfDayMultipliers(weights);
419+
388420
const newWeights = [...weights];
389421
newWeights[LootKind.NICHTS] = Math.ceil(weights[LootKind.NICHTS] * wasteFactor) | 0;
390-
newWeights[LootKind.KRANKSCHREIBUNG] = (weights[LootKind.KRANKSCHREIBUNG] * pkvFactor) | 0;
422+
newWeights[LootKind.KRANKSCHREIBUNG] =
423+
(weights[LootKind.KRANKSCHREIBUNG] * pkvFactor * timeMultipliers[LootKind.KRANKSCHREIBUNG]) |
424+
0;
425+
426+
// Tageszeitabhängige Anpassungen
427+
newWeights[LootKind.KAFFEEMUEHLE] =
428+
(weights[LootKind.KAFFEEMUEHLE] * timeMultipliers[LootKind.KAFFEEMUEHLE]) | 0;
429+
newWeights[LootKind.OETTINGER] =
430+
(weights[LootKind.OETTINGER] * timeMultipliers[LootKind.OETTINGER]) | 0;
431+
newWeights[LootKind.DOENER] = (weights[LootKind.DOENER] * timeMultipliers[LootKind.DOENER]) | 0;
432+
newWeights[LootKind.AYRAN] = (weights[LootKind.AYRAN] * timeMultipliers[LootKind.AYRAN]) | 0;
433+
newWeights[LootKind.SAHNE] = (weights[LootKind.SAHNE] * timeMultipliers[LootKind.SAHNE]) | 0;
434+
newWeights[LootKind.TRICHTER] =
435+
(weights[LootKind.TRICHTER] * timeMultipliers[LootKind.TRICHTER]) | 0;
436+
newWeights[LootKind.GAULOISES_BLAU] =
437+
(weights[LootKind.GAULOISES_BLAU] * timeMultipliers[LootKind.GAULOISES_BLAU]) | 0;
391438

392439
return {
393440
messages,

0 commit comments

Comments
 (0)