BlueGit

timfa questward

Files

questward / shared / definitions / craftingItems.js

craftingItems.js

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