| 1 | import { ItemCategory } from "./itemCategories.js"; |
| 2 | import { MaterialTier } from "./materialTiers.js"; |
| 3 | import { EquipmentKind } from "./equipmentKinds.js"; |
| 4 | |
| 5 | const DEFAULT_STACK = 99; |
| 6 | |
| 7 | /** |
| 8 | * Reserved numeric IDs for gathering, crafting, and cooking content (9–25). |
| 9 | * Metal ores/bars/pickaxes above bronze live in metalItems.js (35+). |
| 10 | */ |
| 11 | export const CraftingItemId = Object.freeze({ |
| 12 | log: 9, |
| 13 | tinderbox: 10, |
| 14 | wool: 11, |
| 15 | thread: 12, |
| 16 | bronzeOre: 13, |
| 17 | bronzeBar: 14, |
| 18 | rawMeat: 15, |
| 19 | cookedMeat: 16, |
| 20 | leather: 17, |
| 21 | arrowTip: 18, |
| 22 | arrow: 19, |
| 23 | bronzeAxe: 20, |
| 24 | bronzePickaxe: 21, |
| 25 | fishingRod: 22, |
| 26 | fishingNet: 23, |
| 27 | rawFish: 24, |
| 28 | cloth: 25 |
| 29 | }); |
| 30 | |
| 31 | function stub (itemId, key, displayName, category, extra = {}) |
| 32 | { |
| 33 | return Object.freeze({ |
| 34 | itemId, |
| 35 | key, |
| 36 | displayName, |
| 37 | description: extra.description ?? "Placeholder — complete this definition when content rules are set.", |
| 38 | seedValue: extra.seedValue ?? 1, |
| 39 | stackable: extra.stackable ?? true, |
| 40 | maxStackSize: extra.maxStackSize ?? DEFAULT_STACK, |
| 41 | uniqueInstance: false, |
| 42 | category, |
| 43 | stub: true, |
| 44 | iconKey: extra.iconKey ?? "paper", |
| 45 | ...extra |
| 46 | }); |
| 47 | } |
| 48 | |
| 49 | /** Minimal defs so recipes and the craft UI can resolve names/icons before art exists. */ |
| 50 | export const CRAFTING_ITEM_STUBS = Object.freeze({ |
| 51 | [CraftingItemId.log]: stub(CraftingItemId.log, "log", "Log", ItemCategory.ingredient, { |
| 52 | description: "Firewood. Drop on the ground and light with a tinderbox (see Crafting stations)." |
| 53 | }), |
| 54 | [CraftingItemId.tinderbox]: stub(CraftingItemId.tinderbox, "tinderbox", "Tinderbox", ItemCategory.tool, { |
| 55 | stackable: false, |
| 56 | maxStackSize: 1, |
| 57 | description: "Lights campfires from dropped logs." |
| 58 | }), |
| 59 | [CraftingItemId.wool]: stub(CraftingItemId.wool, "wool", "Wool", ItemCategory.ingredient, { |
| 60 | description: "Shorn from sheep. Spin into thread at a spinning wheel." |
| 61 | }), |
| 62 | [CraftingItemId.thread]: stub(CraftingItemId.thread, "thread", "Thread", ItemCategory.intermediate, { |
| 63 | description: "Spun wool. Used at a loom." |
| 64 | }), |
| 65 | [CraftingItemId.bronzeOre]: Object.freeze({ |
| 66 | itemId: CraftingItemId.bronzeOre, |
| 67 | key: "bronze-ore", |
| 68 | displayName: "Bronze ore", |
| 69 | description: "Mined ore. Smelt at a furnace into bars.", |
| 70 | seedValue: 2, |
| 71 | stackable: true, |
| 72 | maxStackSize: DEFAULT_STACK, |
| 73 | uniqueInstance: false, |
| 74 | category: ItemCategory.ingredient, |
| 75 | iconKey: "ore", |
| 76 | defaultState: "ore", |
| 77 | tier: MaterialTier.bronze, |
| 78 | tintFromTier: true |
| 79 | }), |
| 80 | [CraftingItemId.bronzeBar]: Object.freeze({ |
| 81 | itemId: CraftingItemId.bronzeBar, |
| 82 | key: "bronze-bar", |
| 83 | displayName: "Bronze bar", |
| 84 | description: "Smelted metal. Smith at an anvil.", |
| 85 | seedValue: 4, |
| 86 | stackable: true, |
| 87 | maxStackSize: DEFAULT_STACK, |
| 88 | uniqueInstance: false, |
| 89 | category: ItemCategory.intermediate, |
| 90 | iconKey: "bar", |
| 91 | defaultState: "bar", |
| 92 | tier: MaterialTier.bronze, |
| 93 | tintFromTier: true |
| 94 | }), |
| 95 | [CraftingItemId.rawMeat]: stub(CraftingItemId.rawMeat, "raw-meat", "Raw meat", ItemCategory.ingredient, { |
| 96 | description: "Cook at an oven or campfire." |
| 97 | }), |
| 98 | [CraftingItemId.cookedMeat]: stub(CraftingItemId.cookedMeat, "cooked-meat", "Cooked meat", ItemCategory.food, { |
| 99 | description: "Cooked food. Eating rules TBD." |
| 100 | }), |
| 101 | [CraftingItemId.leather]: stub(CraftingItemId.leather, "leather", "Leather", ItemCategory.ingredient, { |
| 102 | description: "Dropped from certain mobs. Craft leather goods at a leatherworking station." |
| 103 | }), |
| 104 | [CraftingItemId.arrowTip]: stub(CraftingItemId.arrowTip, "arrow-tip", "Arrow tip", ItemCategory.intermediate, { |
| 105 | description: "Smithed tip. Fletch into arrows at a crafting bench." |
| 106 | }), |
| 107 | [CraftingItemId.arrow]: stub(CraftingItemId.arrow, "arrow", "Arrow", ItemCategory.finished, { |
| 108 | description: "Ammunition for bows." |
| 109 | }), |
| 110 | [CraftingItemId.bronzeAxe]: stub(CraftingItemId.bronzeAxe, "bronze-axe", "Bronze axe", ItemCategory.tool, { |
| 111 | stackable: false, |
| 112 | maxStackSize: 1, |
| 113 | description: "Woodcutting tool.", |
| 114 | iconKey: "axe", |
| 115 | defaultState: "axe", |
| 116 | tintFromTier: true, |
| 117 | equipment: Object.freeze({ |
| 118 | slot: "weapon", |
| 119 | tier: MaterialTier.bronze, |
| 120 | kind: EquipmentKind.axeTool |
| 121 | }) |
| 122 | }), |
| 123 | [CraftingItemId.bronzePickaxe]: Object.freeze({ |
| 124 | itemId: CraftingItemId.bronzePickaxe, |
| 125 | key: "bronze-pickaxe", |
| 126 | displayName: "Bronze pickaxe", |
| 127 | description: "Mining tool. Bronze may be equipped at any Mining level.", |
| 128 | seedValue: 8, |
| 129 | stackable: false, |
| 130 | maxStackSize: 1, |
| 131 | uniqueInstance: false, |
| 132 | category: ItemCategory.tool, |
| 133 | iconKey: "pickaxe", |
| 134 | defaultState: "pickaxe", |
| 135 | tintFromTier: true, |
| 136 | equipment: Object.freeze({ |
| 137 | slot: "weapon", |
| 138 | tier: MaterialTier.bronze, |
| 139 | kind: EquipmentKind.pickaxeTool |
| 140 | }) |
| 141 | }), |
| 142 | [CraftingItemId.fishingRod]: stub(CraftingItemId.fishingRod, "fishing-rod", "Fishing rod", ItemCategory.tool, { |
| 143 | stackable: false, |
| 144 | maxStackSize: 1, |
| 145 | description: "Fishing tool." |
| 146 | }), |
| 147 | [CraftingItemId.fishingNet]: stub(CraftingItemId.fishingNet, "fishing-net", "Fishing net", ItemCategory.tool, { |
| 148 | stackable: false, |
| 149 | maxStackSize: 1, |
| 150 | description: "Fishing tool." |
| 151 | }), |
| 152 | [CraftingItemId.rawFish]: stub(CraftingItemId.rawFish, "raw-fish", "Raw fish", ItemCategory.ingredient, { |
| 153 | description: "Caught fish. Cook like raw meat." |
| 154 | }), |
| 155 | [CraftingItemId.cloth]: stub(CraftingItemId.cloth, "cloth", "Cloth", ItemCategory.intermediate, { |
| 156 | description: "Woven fabric. Tailor into clothing at a loom." |
| 157 | }) |
| 158 | }); |