| 1 | import { ItemCategory } from "./itemCategories.js"; |
| 2 | import { MaterialTier, GatherMaterialId } from "./materialTiers.js"; |
| 3 | |
| 4 | const DEFAULT_STACK = 99; |
| 5 | |
| 6 | /** |
| 7 | * Reserved numeric IDs for gathering, crafting, and cooking content (9–25). |
| 8 | * Metal ores/bars/pickaxes above bronze live in metalItems.js (35+). |
| 9 | * IDs 11 / 12 / 25 are cotton fibre / yarn / cloth (see clothItems.js). |
| 10 | */ |
| 11 | export const CraftingItemId = Object.freeze({ |
| 12 | tinderbox: 10, |
| 13 | copperOre: 13, |
| 14 | bronzeBar: 14, |
| 15 | rawMeat: 15, |
| 16 | cookedMeat: 16, |
| 17 | leather: 17, |
| 18 | arrowTip: 18, |
| 19 | arrow: 19, |
| 20 | bronzeAxe: 20, |
| 21 | bronzePickaxe: 21, |
| 22 | fishingRod: 22, |
| 23 | fishingNet: 23, |
| 24 | rawFish: 24, |
| 25 | tinOre: 53 |
| 26 | }); |
| 27 | |
| 28 | function stub (itemId, key, displayName, category, extra = {}) |
| 29 | { |
| 30 | return Object.freeze({ |
| 31 | itemId, |
| 32 | key, |
| 33 | displayName, |
| 34 | description: extra.description ?? "An unfinished good awaiting a proper name.", |
| 35 | seedValue: extra.seedValue ?? 1, |
| 36 | stackable: extra.stackable ?? true, |
| 37 | maxStackSize: extra.maxStackSize ?? DEFAULT_STACK, |
| 38 | uniqueInstance: false, |
| 39 | category, |
| 40 | stub: true, |
| 41 | iconKey: extra.iconKey ?? "paper", |
| 42 | ...extra |
| 43 | }); |
| 44 | } |
| 45 | |
| 46 | /** Minimal defs so recipes and the craft UI can resolve names/icons before art exists. */ |
| 47 | export const CRAFTING_ITEM_STUBS = Object.freeze({ |
| 48 | [CraftingItemId.tinderbox]: stub(CraftingItemId.tinderbox, "tinderbox", "Tinderbox", ItemCategory.tool, { |
| 49 | stackable: false, |
| 50 | maxStackSize: 1, |
| 51 | description: "A small kit for striking sparks onto dry tinder." |
| 52 | }), |
| 53 | [CraftingItemId.copperOre]: Object.freeze({ |
| 54 | itemId: CraftingItemId.copperOre, |
| 55 | key: "copper-ore", |
| 56 | displayName: "Copper ore", |
| 57 | description: "Reddish copper ore. Smelt with tin at a furnace into bronze bars.", |
| 58 | seedValue: 5, |
| 59 | stackable: true, |
| 60 | maxStackSize: DEFAULT_STACK, |
| 61 | uniqueInstance: false, |
| 62 | category: ItemCategory.ingredient, |
| 63 | iconKey: "metal", |
| 64 | defaultState: "ore", |
| 65 | tier: GatherMaterialId.copper, |
| 66 | tintFromTier: true |
| 67 | }), |
| 68 | [CraftingItemId.tinOre]: Object.freeze({ |
| 69 | itemId: CraftingItemId.tinOre, |
| 70 | key: "tin-ore", |
| 71 | displayName: "Tin ore", |
| 72 | description: "Pale tin ore. Smelt with copper at a furnace into bronze bars.", |
| 73 | seedValue: 5, |
| 74 | stackable: true, |
| 75 | maxStackSize: DEFAULT_STACK, |
| 76 | uniqueInstance: false, |
| 77 | category: ItemCategory.ingredient, |
| 78 | iconKey: "metal", |
| 79 | defaultState: "ore", |
| 80 | tier: GatherMaterialId.tin, |
| 81 | tintFromTier: true |
| 82 | }), |
| 83 | [CraftingItemId.bronzeBar]: Object.freeze({ |
| 84 | itemId: CraftingItemId.bronzeBar, |
| 85 | key: "bronze-bar", |
| 86 | displayName: "Bronze bar", |
| 87 | description: "A solid bronze bar, ready for the anvil.", |
| 88 | seedValue: 4, |
| 89 | stackable: true, |
| 90 | maxStackSize: DEFAULT_STACK, |
| 91 | uniqueInstance: false, |
| 92 | category: ItemCategory.intermediate, |
| 93 | iconKey: "metal", |
| 94 | defaultState: "bar", |
| 95 | tier: MaterialTier.bronze, |
| 96 | tintFromTier: true |
| 97 | }), |
| 98 | [CraftingItemId.rawMeat]: stub(CraftingItemId.rawMeat, "raw-meat", "Raw meat", ItemCategory.ingredient, { |
| 99 | description: "Fresh meat. Cook at an oven or campfire." |
| 100 | }), |
| 101 | [CraftingItemId.cookedMeat]: stub(CraftingItemId.cookedMeat, "cooked-meat", "Cooked meat", ItemCategory.food, { |
| 102 | description: "Meat roasted until tender." |
| 103 | }), |
| 104 | [CraftingItemId.leather]: stub(CraftingItemId.leather, "leather", "Leather", ItemCategory.ingredient, { |
| 105 | description: "Cured hide, stout enough for armour and straps." |
| 106 | }), |
| 107 | [CraftingItemId.fishingRod]: stub(CraftingItemId.fishingRod, "fishing-rod", "Fishing rod", ItemCategory.tool, { |
| 108 | stackable: false, |
| 109 | maxStackSize: 1, |
| 110 | description: "A simple rod and line for still waters." |
| 111 | }), |
| 112 | [CraftingItemId.fishingNet]: stub(CraftingItemId.fishingNet, "fishing-net", "Fishing net", ItemCategory.tool, { |
| 113 | stackable: false, |
| 114 | maxStackSize: 1, |
| 115 | description: "A woven net for scooping fish." |
| 116 | }), |
| 117 | [CraftingItemId.rawFish]: stub(CraftingItemId.rawFish, "raw-fish", "Raw fish", ItemCategory.ingredient, { |
| 118 | description: "A fresh catch. Cook at an oven or campfire." |
| 119 | }) |
| 120 | }); |