BlueGit

timfa questward

Files

questward / shared / definitions / craftingItems.js

craftingItems.js

craftingItems.js 4.8 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 * IDs 11 / 12 / 25 are cotton fibre / yarn / cloth (see clothItems.js).
11 */
12export const CraftingItemId = Object.freeze({
13 tinderbox: 10,
14 copperOre: 13,
15 bronzeBar: 14,
16 rawMeat: 15,
17 cookedMeat: 16,
18 leather: 17,
19 arrowTip: 18,
20 arrow: 19,
21 bronzeAxe: 20,
22 bronzePickaxe: 21,
23 fishingRod: 22,
24 fishingNet: 23,
25 rawFish: 24,
26 tinOre: 53
27});
28
29function stub (itemId, key, displayName, category, extra = {})
30{
31 return Object.freeze({
32 itemId,
33 key,
34 displayName,
35 description: extra.description ?? "An unfinished good awaiting a proper name.",
36 seedValue: extra.seedValue ?? 1,
37 stackable: extra.stackable ?? true,
38 maxStackSize: extra.maxStackSize ?? DEFAULT_STACK,
39 uniqueInstance: false,
40 category,
41 stub: true,
42 iconKey: extra.iconKey ?? "paper",
43 ...extra
44 });
45}
46
47/** Minimal defs so recipes and the craft UI can resolve names/icons before art exists. */
48export const CRAFTING_ITEM_STUBS = Object.freeze({
49 [CraftingItemId.tinderbox]: stub(CraftingItemId.tinderbox, "tinderbox", "Tinderbox", ItemCategory.tool, {
50 stackable: false,
51 maxStackSize: 1,
52 description: "A small kit for striking sparks onto dry tinder."
53 }),
54 [CraftingItemId.copperOre]: Object.freeze({
55 itemId: CraftingItemId.copperOre,
56 key: "copper-ore",
57 displayName: "Copper ore",
58 description: "Reddish copper ore. Smelt with tin at a furnace into bronze bars.",
59 seedValue: 5,
60 stackable: true,
61 maxStackSize: DEFAULT_STACK,
62 uniqueInstance: false,
63 category: ItemCategory.ingredient,
64 iconKey: "metal",
65 defaultState: "ore",
66 tier: GatherMaterialId.copper,
67 tintFromTier: true
68 }),
69 [CraftingItemId.tinOre]: Object.freeze({
70 itemId: CraftingItemId.tinOre,
71 key: "tin-ore",
72 displayName: "Tin ore",
73 description: "Pale tin ore. Smelt with copper at a furnace into bronze bars.",
74 seedValue: 5,
75 stackable: true,
76 maxStackSize: DEFAULT_STACK,
77 uniqueInstance: false,
78 category: ItemCategory.ingredient,
79 iconKey: "metal",
80 defaultState: "ore",
81 tier: GatherMaterialId.tin,
82 tintFromTier: true
83 }),
84 [CraftingItemId.bronzeBar]: Object.freeze({
85 itemId: CraftingItemId.bronzeBar,
86 key: "bronze-bar",
87 displayName: "Bronze bar",
88 description: "A solid bronze bar, ready for the anvil.",
89 seedValue: 4,
90 stackable: true,
91 maxStackSize: DEFAULT_STACK,
92 uniqueInstance: false,
93 category: ItemCategory.intermediate,
94 iconKey: "metal",
95 defaultState: "bar",
96 tier: MaterialTier.bronze,
97 tintFromTier: true
98 }),
99 [CraftingItemId.rawMeat]: stub(CraftingItemId.rawMeat, "raw-meat", "Raw meat", ItemCategory.ingredient, {
100 description: "Fresh meat. Cook at an oven or campfire."
101 }),
102 [CraftingItemId.cookedMeat]: stub(CraftingItemId.cookedMeat, "cooked-meat", "Cooked meat", ItemCategory.food, {
103 description: "Meat roasted until tender."
104 }),
105 [CraftingItemId.leather]: stub(CraftingItemId.leather, "leather", "Leather", ItemCategory.ingredient, {
106 description: "Cured hide, stout enough for armour and straps."
107 }),
108 [CraftingItemId.bronzeAxe]: Object.freeze({
109 itemId: CraftingItemId.bronzeAxe,
110 key: "bronze-axe",
111 displayName: "Bronze axe",
112 description: "A bronze axe for felling trees.",
113 seedValue: 8,
114 stackable: false,
115 maxStackSize: 1,
116 uniqueInstance: false,
117 category: ItemCategory.tool,
118 iconKey: "axe",
119 defaultState: "axe",
120 tintFromTier: true,
121 equipment: Object.freeze({
122 slot: "weapon",
123 tier: MaterialTier.bronze,
124 kind: EquipmentKind.axeTool
125 })
126 }),
127 [CraftingItemId.bronzePickaxe]: Object.freeze({
128 itemId: CraftingItemId.bronzePickaxe,
129 key: "bronze-pickaxe",
130 displayName: "Bronze pickaxe",
131 description: "A bronze pickaxe for breaking stone and ore.",
132 seedValue: 8,
133 stackable: false,
134 maxStackSize: 1,
135 uniqueInstance: false,
136 category: ItemCategory.tool,
137 iconKey: "pickaxe",
138 defaultState: "pickaxe",
139 tintFromTier: true,
140 equipment: Object.freeze({
141 slot: "weapon",
142 tier: MaterialTier.bronze,
143 kind: EquipmentKind.pickaxeTool
144 })
145 }),
146 [CraftingItemId.fishingRod]: stub(CraftingItemId.fishingRod, "fishing-rod", "Fishing rod", ItemCategory.tool, {
147 stackable: false,
148 maxStackSize: 1,
149 description: "A simple rod and line for still waters."
150 }),
151 [CraftingItemId.fishingNet]: stub(CraftingItemId.fishingNet, "fishing-net", "Fishing net", ItemCategory.tool, {
152 stackable: false,
153 maxStackSize: 1,
154 description: "A woven net for scooping fish."
155 }),
156 [CraftingItemId.rawFish]: stub(CraftingItemId.rawFish, "raw-fish", "Raw fish", ItemCategory.ingredient, {
157 description: "A fresh catch. Cook at an oven or campfire."
158 })
159});