BlueGit

timfa questward

Files

questward / shared / definitions / craftingItems.js

craftingItems.js

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