BlueGit

timfa questward

Files

questward / shared / definitions / craftingItems.js

craftingItems.js

craftingItems.js 5.1 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.arrowTip]: stub(CraftingItemId.arrowTip, "arrow-tip", "Arrow tip", ItemCategory.intermediate, {
109 description: "A sharp tip waiting to be fletched onto a shaft."
110 }),
111 [CraftingItemId.arrow]: stub(CraftingItemId.arrow, "arrow", "Arrow", ItemCategory.finished, {
112 description: "A fletched arrow for the bow."
113 }),
114 [CraftingItemId.bronzeAxe]: Object.freeze({
115 itemId: CraftingItemId.bronzeAxe,
116 key: "bronze-axe",
117 displayName: "Bronze axe",
118 description: "A bronze axe for felling trees.",
119 seedValue: 8,
120 stackable: false,
121 maxStackSize: 1,
122 uniqueInstance: false,
123 category: ItemCategory.tool,
124 iconKey: "axe",
125 defaultState: "axe",
126 tintFromTier: true,
127 equipment: Object.freeze({
128 slot: "weapon",
129 tier: MaterialTier.bronze,
130 kind: EquipmentKind.axeTool
131 })
132 }),
133 [CraftingItemId.bronzePickaxe]: Object.freeze({
134 itemId: CraftingItemId.bronzePickaxe,
135 key: "bronze-pickaxe",
136 displayName: "Bronze pickaxe",
137 description: "A bronze pickaxe for breaking stone and ore.",
138 seedValue: 8,
139 stackable: false,
140 maxStackSize: 1,
141 uniqueInstance: false,
142 category: ItemCategory.tool,
143 iconKey: "pickaxe",
144 defaultState: "pickaxe",
145 tintFromTier: true,
146 equipment: Object.freeze({
147 slot: "weapon",
148 tier: MaterialTier.bronze,
149 kind: EquipmentKind.pickaxeTool
150 })
151 }),
152 [CraftingItemId.fishingRod]: stub(CraftingItemId.fishingRod, "fishing-rod", "Fishing rod", ItemCategory.tool, {
153 stackable: false,
154 maxStackSize: 1,
155 description: "A simple rod and line for still waters."
156 }),
157 [CraftingItemId.fishingNet]: stub(CraftingItemId.fishingNet, "fishing-net", "Fishing net", ItemCategory.tool, {
158 stackable: false,
159 maxStackSize: 1,
160 description: "A woven net for scooping fish."
161 }),
162 [CraftingItemId.rawFish]: stub(CraftingItemId.rawFish, "raw-fish", "Raw fish", ItemCategory.ingredient, {
163 description: "A fresh catch. Cook at an oven or campfire."
164 })
165});