Guard source gear namespaces and retain recoverable legacy records (#9)

This commit is contained in:
warren committed 2026-10-10 11:36:10 -04:00
1 parent ab37006932
commit e567910c04
23 files changed
+1203 -66

No files matched your search

+6 -1
View File
@@ -1,4 +1,5 @@
import generatedLootCatalog from "./generated/lootCatalog.json";
import type { ContentCategoryId } from "../app/contentCategories";
import {
itemStatsFor,
type SourceItemStats,
@@ -48,6 +49,8 @@ export interface LootRollOptions {
readonly now?: number;
/** A single additional weighted item roll after the authored boss rolls. */
readonly bonusItemChance?: number;
/** Saved character/party category; source identity is never inferred from dungeon. */
readonly ownerCategory?: ContentCategoryId;
}
export const LOOT_CATALOG = generatedLootCatalog as LootCatalog;
@@ -104,6 +107,7 @@ export function rollBossLoot(
if (!table?.items.length) {
return rollRunewakerBossLoot(bossKey, playerLevel, options);
}
if (options.ownerCategory !== undefined && options.ownerCategory !== "wow") return [];
const random = options.random ?? Math.random;
const acquiredAt = options.now ?? Date.now();
const rolls = randomInteger(table.rollsMin, table.rollsMax, random);
@@ -117,6 +121,7 @@ export function rollBossLoot(
itemInstanceSequence += 1;
const scaledItemLevel = template.scalable ? itemLevel : template.sourceItemLevel;
drops.push({
contentCategory: "wow",
instanceId: `${bossKey}:${acquiredAt}:${itemInstanceSequence}`,
itemId: template.itemId,
itemKey: template.itemKey,
@@ -154,5 +159,5 @@ export function rollBossLoot(
addWeightedDrop();
}
return allowedLootDrops(drops, playerLevel);
return allowedLootDrops(drops, playerLevel, options.ownerCategory);
}