Exact source used by this build. SHA-256: 25717b50164cd9f131a81e9fc35051a07254651c25173fed8d5d12d49b1e885d.
1 import type { Player, SimRules } from "../../types";
2 import { getCraftingContent } from "../crafting/model";
3 import { hasProfessionHook } from "../skills";
4 import type { BaitDefinition, FishingContent } from "./model";
5
6 /** Producer IDs remain stable in old inventories; fishing owns their behavior. */
7 export function fishingItemIds(rules: SimRules, kind: "bait" | "crabPot", targetItemId: string): string[] {
8 return [targetItemId, ...(getCraftingContent(rules)?.hooks.filter((hook) => hook.ownerSystem === "fishing" && hook.kind === kind && hook.targetItemId === targetItemId).map((hook) => hook.itemId) ?? [])];
9 }
10 export function fishingBaits<T extends BaitDefinition>(data: { baits: T[] }, rules: SimRules): T[] {
11 return data.baits.flatMap((bait) => fishingItemIds(rules, "bait", bait.itemId).map((itemId) => itemId === bait.itemId ? bait : { ...bait, id: itemId, itemId }));
12 }
13 export function crabPotIngredients(data: FishingContent, player: Player, rules: SimRules) {
14 return hasProfessionHook(player, "fishing_02", rules) ? data.crabPot.trapperIngredients : data.crabPot.ingredients;
15 }
16