BlueGit

timfa questward

Files

questward / shared / definitions / craftingItems.js

craftingItems.js

craftingItems.js 5.4 KiB Download Raw
1import { ItemCategory } from "./itemCategories.js";
2import { MaterialTier, GatherMaterialId } from "./materialTiers.js";
3import { EquipmentKind } from "./equipmentKinds.js";
4
5const 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 */
11export const CraftingItemId = Object.freeze({
12 tinderbox: 10,
13 wool: 11,
14 thread: 12,
15 copperOre: 13,
16 bronzeBar: 14,
17 rawMeat: 15,
18 cookedMeat: 16,
19 leather: 17,
20 arrowTip: 18,
21 arrow: 19,
22 bronzeAxe: 20,
23 bronzePickaxe: 21,
24 fishingRod: 22,
25 fishingNet: 23,
26 rawFish: 24,
27 cloth: 25,
28 tinOre: 53
29});
30
31function 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. */
50export const CRAFTING_ITEM_STUBS = Object.freeze({
51 [CraftingItemId.tinderbox]: stub(CraftingItemId.tinderbox, "tinderbox", "Tinderbox", ItemCategory.tool, {
52 stackable: false,
53 maxStackSize: 1,
54 description: "Lights campfires from dropped logs."
55 }),
56 [CraftingItemId.wool]: stub(CraftingItemId.wool, "wool", "Wool", ItemCategory.ingredient, {
57 description: "Shorn from sheep. Spin into thread at a spinning wheel."
58 }),
59 [CraftingItemId.thread]: stub(CraftingItemId.thread, "thread", "Thread", ItemCategory.intermediate, {
60 description: "Spun wool. Used at a loom."
61 }),
62 [CraftingItemId.copperOre]: Object.freeze({
63 itemId: CraftingItemId.copperOre,
64 key: "copper-ore",
65 displayName: "Copper ore",
66 description: "Mined copper. Smelt with tin at a furnace into bronze bars.",
67 seedValue: 5,
68 stackable: true,
69 maxStackSize: DEFAULT_STACK,
70 uniqueInstance: false,
71 category: ItemCategory.ingredient,
72 iconKey: "metal",
73 defaultState: "ore",
74 tier: GatherMaterialId.copper,
75 tintFromTier: true
76 }),
77 [CraftingItemId.tinOre]: Object.freeze({
78 itemId: CraftingItemId.tinOre,
79 key: "tin-ore",
80 displayName: "Tin ore",
81 description: "Mined tin. Smelt with copper at a furnace into bronze bars.",
82 seedValue: 5,
83 stackable: true,
84 maxStackSize: DEFAULT_STACK,
85 uniqueInstance: false,
86 category: ItemCategory.ingredient,
87 iconKey: "metal",
88 defaultState: "ore",
89 tier: GatherMaterialId.tin,
90 tintFromTier: true
91 }),
92 [CraftingItemId.bronzeBar]: Object.freeze({
93 itemId: CraftingItemId.bronzeBar,
94 key: "bronze-bar",
95 displayName: "Bronze bar",
96 description: "Smelted from tin and copper. Smith at an anvil.",
97 seedValue: 4,
98 stackable: true,
99 maxStackSize: DEFAULT_STACK,
100 uniqueInstance: false,
101 category: ItemCategory.intermediate,
102 iconKey: "metal",
103 defaultState: "bar",
104 tier: MaterialTier.bronze,
105 tintFromTier: true
106 }),
107 [CraftingItemId.rawMeat]: stub(CraftingItemId.rawMeat, "raw-meat", "Raw meat", ItemCategory.ingredient, {
108 description: "Cook at an oven or campfire."
109 }),
110 [CraftingItemId.cookedMeat]: stub(CraftingItemId.cookedMeat, "cooked-meat", "Cooked meat", ItemCategory.food, {
111 description: "Cooked food. Eating rules TBD."
112 }),
113 [CraftingItemId.leather]: stub(CraftingItemId.leather, "leather", "Leather", ItemCategory.ingredient, {
114 description: "Dropped from certain mobs. Craft leather goods at a leatherworking station."
115 }),
116 [CraftingItemId.arrowTip]: stub(CraftingItemId.arrowTip, "arrow-tip", "Arrow tip", ItemCategory.intermediate, {
117 description: "Smithed tip. Fletch into arrows at a crafting bench."
118 }),
119 [CraftingItemId.arrow]: stub(CraftingItemId.arrow, "arrow", "Arrow", ItemCategory.finished, {
120 description: "Ammunition for bows."
121 }),
122 [CraftingItemId.bronzeAxe]: stub(CraftingItemId.bronzeAxe, "bronze-axe", "Bronze axe", ItemCategory.tool, {
123 stackable: false,
124 maxStackSize: 1,
125 description: "Woodcutting tool.",
126 iconKey: "axe",
127 defaultState: "axe",
128 tintFromTier: true,
129 equipment: Object.freeze({
130 slot: "weapon",
131 tier: MaterialTier.bronze,
132 kind: EquipmentKind.axeTool
133 })
134 }),
135 [CraftingItemId.bronzePickaxe]: Object.freeze({
136 itemId: CraftingItemId.bronzePickaxe,
137 key: "bronze-pickaxe",
138 displayName: "Bronze pickaxe",
139 description: "Mining tool. Bronze may be equipped at any Mining level.",
140 seedValue: 8,
141 stackable: false,
142 maxStackSize: 1,
143 uniqueInstance: false,
144 category: ItemCategory.tool,
145 iconKey: "pickaxe",
146 defaultState: "pickaxe",
147 tintFromTier: true,
148 equipment: Object.freeze({
149 slot: "weapon",
150 tier: MaterialTier.bronze,
151 kind: EquipmentKind.pickaxeTool
152 })
153 }),
154 [CraftingItemId.fishingRod]: stub(CraftingItemId.fishingRod, "fishing-rod", "Fishing rod", ItemCategory.tool, {
155 stackable: false,
156 maxStackSize: 1,
157 description: "Fishing tool."
158 }),
159 [CraftingItemId.fishingNet]: stub(CraftingItemId.fishingNet, "fishing-net", "Fishing net", ItemCategory.tool, {
160 stackable: false,
161 maxStackSize: 1,
162 description: "Fishing tool."
163 }),
164 [CraftingItemId.rawFish]: stub(CraftingItemId.rawFish, "raw-fish", "Raw fish", ItemCategory.ingredient, {
165 description: "Caught fish. Cook like raw meat."
166 }),
167 [CraftingItemId.cloth]: stub(CraftingItemId.cloth, "cloth", "Cloth", ItemCategory.intermediate, {
168 description: "Woven fabric. Tailor into clothing at a loom."
169 })
170});