Add gemstone ores and craftable magic staves.
Gem nodes use the shared ore sprite with tier tints and need an equal-or-higher pickaxe; staves craft from matching log, gem, and ash with wood/gem dual tint, and ash reads a bit greyer.
timfa Tim Falken · pushed by timfa
Authored 2026-08-28 · 2 months ago
- Hash
92ded1722c2d4806b65cd62a96cf1ac265f97bc5- Parent
b125e032
13 files changed
+340
−31
The contents of this binary file are not shown.
The contents of this binary file are not shown.
@@ -167,7 +167,9 @@ export function initCrafting ({
167
167
function recipeXpMaterialForSelection (recipe, material = selectedMaterial)
168
168
{
169
169
if (isCraftingBenchStation()
170
&& (recipe.craftGroup === "bow" || recipe.craftGroup === "fishing-rod"))
170
&& (recipe.craftGroup === "bow"
171
|| recipe.craftGroup === "fishing-rod"
172
|| recipe.craftGroup === "staff"))
171
173
{ return woodTierForMetal(material); }
172
174
if (isCraftingBenchStation() && recipe.craftGroup === "fishing-net")
173
175
{ return clothTierForWood(woodTierForMetal(material)); }
@@ -321,7 +323,8 @@ export function initCrafting ({
321
323
if (match?.xpMaterial && !(isCraftingBenchStation()
322
324
&& (match.craftGroup === "bow"
323
325
|| match.craftGroup === "fishing-rod"
324
|| match.craftGroup === "fishing-net")))
326
|| match.craftGroup === "fishing-net"
327
|| match.craftGroup === "staff")))
325
328
{
326
329
selectedMaterial = match.xpMaterial;
327
330
if (materialTierSelect)
@@ -167,7 +167,9 @@ export function initCrafting ({167
function recipeXpMaterialForSelection (recipe, material = selectedMaterial)167
function recipeXpMaterialForSelection (recipe, material = selectedMaterial)168
{168
{169
if (isCraftingBenchStation()169
if (isCraftingBenchStation()170
&& (recipe.craftGroup === "bow" || recipe.craftGroup === "fishing-rod"))170
&& (recipe.craftGroup === "bow"171
|| recipe.craftGroup === "fishing-rod"172
|| recipe.craftGroup === "staff"))171
{ return woodTierForMetal(material); }173
{ return woodTierForMetal(material); }172
if (isCraftingBenchStation() && recipe.craftGroup === "fishing-net")174
if (isCraftingBenchStation() && recipe.craftGroup === "fishing-net")173
{ return clothTierForWood(woodTierForMetal(material)); }175
{ return clothTierForWood(woodTierForMetal(material)); }@@ -321,7 +323,8 @@ export function initCrafting ({321
if (match?.xpMaterial && !(isCraftingBenchStation()323
if (match?.xpMaterial && !(isCraftingBenchStation()322
&& (match.craftGroup === "bow"324
&& (match.craftGroup === "bow"323
|| match.craftGroup === "fishing-rod"325
|| match.craftGroup === "fishing-rod"324
|| match.craftGroup === "fishing-net")))326
|| match.craftGroup === "fishing-net"327
|| match.craftGroup === "staff")))325
{328
{326
selectedMaterial = match.xpMaterial;329
selectedMaterial = match.xpMaterial;327
if (materialTierSelect)330
if (materialTierSelect)@@ -144,6 +144,13 @@ test("canMineMaterial enforces skill and tool tier", () =>
144
144
assert.equal(canMineMaterial(10, MaterialTier.bronze, MaterialTier.steel).ok, false);
145
145
});
146
146
147
test("gemstones require equal or higher pickaxe tier", () =>
148
{
149
assert.equal(canMineMaterial(1, MaterialTier.bronze, GatherMaterialId.tourmaline).ok, true);
150
assert.equal(canMineMaterial(10, MaterialTier.iron, GatherMaterialId.opal).ok, false);
151
assert.equal(canMineMaterial(10, MaterialTier.steel, GatherMaterialId.opal).ok, true);
152
});
153
147
154
test("mining without a pickaxe is rejected", () =>
148
155
{
149
156
const harness = makeSimulation({ workerCount: 1 });
@@ -144,6 +144,13 @@ test("canMineMaterial enforces skill and tool tier", () =>144
assert.equal(canMineMaterial(10, MaterialTier.bronze, MaterialTier.steel).ok, false);144
assert.equal(canMineMaterial(10, MaterialTier.bronze, MaterialTier.steel).ok, false);145
});145
});146
146
147
test("gemstones require equal or higher pickaxe tier", () =>148
{149
assert.equal(canMineMaterial(1, MaterialTier.bronze, GatherMaterialId.tourmaline).ok, true);150
assert.equal(canMineMaterial(10, MaterialTier.iron, GatherMaterialId.opal).ok, false);151
assert.equal(canMineMaterial(10, MaterialTier.steel, GatherMaterialId.opal).ok, true);152
});153
147
test("mining without a pickaxe is rejected", () =>154
test("mining without a pickaxe is rejected", () =>148
{155
{149
const harness = makeSimulation({ workerCount: 1 });156
const harness = makeSimulation({ workerCount: 1 });@@ -12,6 +12,7 @@ import {
12
12
import { MaterialTier, GatherMaterialId, hexToRgb01, MATERIAL_TINT_HEX, rgb } from "../../shared/definitions/materialTiers.js";
13
13
import { ItemId } from "../../shared/definitions/items.js";
14
14
import { RangedItemId } from "../../shared/definitions/rangedItems.js";
15
import { GemItemId } from "../../shared/definitions/gemItems.js";
15
16
16
17
test("magenta tintable when R==B and G < R", () =>
17
18
{
@@ -118,6 +119,14 @@ test("bows dual-tint wood frame and cloth string; unstrung wood only", () =>
118
119
assert.equal(resolveItemTint({ itemId: RangedItemId.pineUnstrungBow }), null);
119
120
});
120
121
122
test("staff dual-tints wood shaft and gem tip", () =>
123
{
124
const staff = resolveItemDualTint({ itemId: GemItemId.pineStaff });
125
assert.deepEqual(staff.shaft, tierTintColor("pine"));
126
assert.deepEqual(staff.tip, tierTintColor("tourmaline"));
127
assert.equal(resolveItemTint({ itemId: GemItemId.pineStaff }), null);
128
});
129
121
130
test("material tint hex converts to 0-1 rgb at load", () =>
122
131
{
123
132
assert.deepEqual(MATERIAL_TINT_HEX[MaterialTier.bronze], rgb(184, 122, 71));
@@ -12,6 +12,7 @@ import {12
import { MaterialTier, GatherMaterialId, hexToRgb01, MATERIAL_TINT_HEX, rgb } from "../../shared/definitions/materialTiers.js";12
import { MaterialTier, GatherMaterialId, hexToRgb01, MATERIAL_TINT_HEX, rgb } from "../../shared/definitions/materialTiers.js";13
import { ItemId } from "../../shared/definitions/items.js";13
import { ItemId } from "../../shared/definitions/items.js";14
import { RangedItemId } from "../../shared/definitions/rangedItems.js";14
import { RangedItemId } from "../../shared/definitions/rangedItems.js";15
import { GemItemId } from "../../shared/definitions/gemItems.js";15
16
16
test("magenta tintable when R==B and G < R", () =>17
test("magenta tintable when R==B and G < R", () =>17
{18
{@@ -118,6 +119,14 @@ test("bows dual-tint wood frame and cloth string; unstrung wood only", () =>118
assert.equal(resolveItemTint({ itemId: RangedItemId.pineUnstrungBow }), null);119
assert.equal(resolveItemTint({ itemId: RangedItemId.pineUnstrungBow }), null);119
});120
});120
121
122
test("staff dual-tints wood shaft and gem tip", () =>123
{124
const staff = resolveItemDualTint({ itemId: GemItemId.pineStaff });125
assert.deepEqual(staff.shaft, tierTintColor("pine"));126
assert.deepEqual(staff.tip, tierTintColor("tourmaline"));127
assert.equal(resolveItemTint({ itemId: GemItemId.pineStaff }), null);128
});129
121
test("material tint hex converts to 0-1 rgb at load", () =>130
test("material tint hex converts to 0-1 rgb at load", () =>122
{131
{123
assert.deepEqual(MATERIAL_TINT_HEX[MaterialTier.bronze], rgb(184, 122, 71));132
assert.deepEqual(MATERIAL_TINT_HEX[MaterialTier.bronze], rgb(184, 122, 71));@@ -15,6 +15,7 @@ import {
15
15
} from "../definitions/materialTiers.js";
16
16
import { TIER_FAMILY_RECIPES } from "./tierRecipes.js";
17
17
import { fishingToolRecipes, fishingCookRecipes } from "../definitions/fishItems.js";
18
import { staffCraftRecipes } from "../definitions/gemItems.js";
18
19
19
20
/**
20
21
* Craft recipe schema (shared client + server):
@@ -193,7 +194,8 @@ export const CRAFT_RECIPES = Object.freeze([
193
194
}),
194
195
195
196
...fishingToolRecipes(),
196
...fishingCookRecipes()
197
...fishingCookRecipes(),
198
...staffCraftRecipes()
197
199
]);
198
200
199
201
const RECIPE_BY_ID = new Map(CRAFT_RECIPES.map((recipe) => [recipe.recipeId, recipe]));
@@ -15,6 +15,7 @@ import {15
} from "../definitions/materialTiers.js";15
} from "../definitions/materialTiers.js";16
import { TIER_FAMILY_RECIPES } from "./tierRecipes.js";16
import { TIER_FAMILY_RECIPES } from "./tierRecipes.js";17
import { fishingToolRecipes, fishingCookRecipes } from "../definitions/fishItems.js";17
import { fishingToolRecipes, fishingCookRecipes } from "../definitions/fishItems.js";18
import { staffCraftRecipes } from "../definitions/gemItems.js";18
19
19
/**20
/**20
* Craft recipe schema (shared client + server):21
* Craft recipe schema (shared client + server):@@ -193,7 +194,8 @@ export const CRAFT_RECIPES = Object.freeze([193
}),194
}),194
195
195
...fishingToolRecipes(),196
...fishingToolRecipes(),196
...fishingCookRecipes()197
...fishingCookRecipes(),198
...staffCraftRecipes()197
]);199
]);198
200
199
const RECIPE_BY_ID = new Map(CRAFT_RECIPES.map((recipe) => [recipe.recipeId, recipe]));201
const RECIPE_BY_ID = new Map(CRAFT_RECIPES.map((recipe) => [recipe.recipeId, recipe]));@@ -17,6 +17,7 @@ import { LeatherItemId } from "./leatherItems.js";
17
17
import { ItemId, itemDefinition, ITEM_DEFINITIONS } from "./items.js";
18
18
import { quarterstaffItemIdForWood } from "./woodItems.js";
19
19
import { arrowItemId, bowItemId } from "./rangedItems.js";
20
import { staffItemIdForWood } from "./gemItems.js";
20
21
21
22
/** Tier key for non-tiered singleton rows. */
22
23
export const SINGLETON_TIER_KEY = "_";
@@ -180,7 +181,13 @@ export const EQUIPMENT_STAT_CATEGORIES = Object.freeze([
180
181
id: "wood",
181
182
tierOrder: WOOD_TIER_ORDER,
182
183
tierDisplayName: woodDisplayName,
183
rows: Object.freeze([])
184
rows: Object.freeze([
185
Object.freeze({
186
pieceKey: "staff",
187
label: "Staff",
188
resolveItemId: (tier) => staffItemIdForWood(tier)
189
})
190
])
184
191
})
185
192
])
186
193
}),
@@ -17,6 +17,7 @@ import { LeatherItemId } from "./leatherItems.js";17
import { ItemId, itemDefinition, ITEM_DEFINITIONS } from "./items.js";17
import { ItemId, itemDefinition, ITEM_DEFINITIONS } from "./items.js";18
import { quarterstaffItemIdForWood } from "./woodItems.js";18
import { quarterstaffItemIdForWood } from "./woodItems.js";19
import { arrowItemId, bowItemId } from "./rangedItems.js";19
import { arrowItemId, bowItemId } from "./rangedItems.js";20
import { staffItemIdForWood } from "./gemItems.js";20
21
21
/** Tier key for non-tiered singleton rows. */22
/** Tier key for non-tiered singleton rows. */22
export const SINGLETON_TIER_KEY = "_";23
export const SINGLETON_TIER_KEY = "_";@@ -180,7 +181,13 @@ export const EQUIPMENT_STAT_CATEGORIES = Object.freeze([180
id: "wood",181
id: "wood",181
tierOrder: WOOD_TIER_ORDER,182
tierOrder: WOOD_TIER_ORDER,182
tierDisplayName: woodDisplayName,183
tierDisplayName: woodDisplayName,183
rows: Object.freeze([])184
rows: Object.freeze([185
Object.freeze({186
pieceKey: "staff",187
label: "Staff",188
resolveItemId: (tier) => staffItemIdForWood(tier)189
})190
])184
})191
})185
])192
])186
}),193
}),@@ -21,8 +21,10 @@ import {
21
21
EXHAUSTED_ORE_BOULDER_STATE,
22
22
oreBoulderState,
23
23
materialFromOreBoulderState,
24
isOreBoulderState
24
isOreBoulderState,
25
isGemstoneMaterial
25
26
} from "./materialTiers.js";
27
import { gemItemId } from "./gemItems.js";
26
28
import { herbDefinition, herbGatherSkillLevel } from "./herbs.js";
27
29
28
30
export {
@@ -38,6 +40,7 @@ export {
38
40
oreBoulderState,
39
41
materialFromOreBoulderState,
40
42
isOreBoulderState,
43
isGemstoneMaterial,
41
44
EquipmentKind,
42
45
WoodTier
43
46
};
@@ -59,7 +62,14 @@ export const ORE_ITEM_BY_MATERIAL = Object.freeze({
59
62
[MaterialTier.adamantium]: MetalItemId.adamantiumOre,
60
63
[MaterialTier.orichalcum]: MetalItemId.orichalcumOre,
61
64
[MaterialTier.dragon]: MetalItemId.dragonOre,
62
[GatherMaterialId.coal]: MetalItemId.coal
65
[GatherMaterialId.coal]: MetalItemId.coal,
66
[GatherMaterialId.tourmaline]: gemItemId(GatherMaterialId.tourmaline),
67
[GatherMaterialId.alexandrite]: gemItemId(GatherMaterialId.alexandrite),
68
[GatherMaterialId.opal]: gemItemId(GatherMaterialId.opal),
69
[GatherMaterialId.diamond]: gemItemId(GatherMaterialId.diamond),
70
[GatherMaterialId.emerald]: gemItemId(GatherMaterialId.emerald),
71
[GatherMaterialId.ruby]: gemItemId(GatherMaterialId.ruby),
72
[GatherMaterialId.jadeite]: gemItemId(GatherMaterialId.jadeite)
63
73
});
64
74
65
75
export const BAR_ITEM_BY_MATERIAL = Object.freeze({
@@ -137,21 +147,6 @@ export function gatherEquipTier (materialId)
137
147
return associatedBarTier(materialId);
138
148
}
139
149
140
export function canMineMaterial (miningLevel, toolTier, materialId)
141
{
142
const gateTier = gatherEquipTier(materialId);
143
const needSkill = tierMineSkillLevel(gateTier);
144
if ((miningLevel | 0) < needSkill)
145
{
146
return { ok: false, reason: `Requires Mining ${needSkill}.` };
147
}
148
if (!toolTierMeetsResource(toolTier, gateTier))
149
{
150
return { ok: false, reason: "You need a pickaxe to mine this!" };
151
}
152
return { ok: true };
153
}
154
155
150
export function canChopWood (woodcuttingLevel, toolTier, woodTier)
156
151
{
157
152
const needSkill = tierMineSkillLevel(woodTier);
@@ -169,12 +164,36 @@ export function canChopWood (woodcuttingLevel, toolTier, woodTier)
169
164
/**
170
165
* Gathering tools may be one material tier below the resource node.
171
166
* Pine/bronze (rank 1) still need a bronze tool; birch accepts bronze or iron, etc.
167
* Gemstones are stricter: pickaxe tier must be equal or higher.
172
168
*/
173
169
export function toolTierMeetsResource (toolTier, resourceTier)
174
170
{
175
171
return tierRank(toolTier) + 1 >= tierRank(resourceTier);
176
172
}
177
173
174
export function toolTierMeetsGemstone (toolTier, gemTier)
175
{
176
return tierRank(toolTier) >= tierRank(gemTier);
177
}
178
179
export function canMineMaterial (miningLevel, toolTier, materialId)
180
{
181
const gateTier = gatherEquipTier(materialId);
182
const needSkill = tierMineSkillLevel(gateTier);
183
if ((miningLevel | 0) < needSkill)
184
{
185
return { ok: false, reason: `Requires Mining ${needSkill}.` };
186
}
187
const toolOk = isGemstoneMaterial(materialId)
188
? toolTierMeetsGemstone(toolTier, gateTier)
189
: toolTierMeetsResource(toolTier, gateTier);
190
if (!toolOk)
191
{
192
return { ok: false, reason: "You need a pickaxe to mine this!" };
193
}
194
return { ok: true };
195
}
196
178
197
/**
179
198
* Tools of a given equipment kind in bag slots and/or the weapon slot.
180
199
* Gathering uses inventory tools without requiring them to be equipped.
@@ -214,9 +233,12 @@ export function resolveMiningPickaxe ({ inventorySlots, equipmentSlots, skills,
214
233
{ return { ok: false, reason: `Requires Mining ${needSkill}.` }; }
215
234
216
235
const tools = listGatherTools(inventorySlots, equipmentSlots, EquipmentKind.pickaxeTool);
236
const meetTool = isGemstoneMaterial(materialId)
237
? (tool) => toolTierMeetsGemstone(tool.tier, gateTier)
238
: (tool) => toolTierMeetsResource(tool.tier, gateTier);
217
239
const usable = tools
218
240
.filter((tool) => canEquipItem(skills, tool.def).ok)
219
.filter((tool) => toolTierMeetsResource(tool.tier, gateTier))
241
.filter(meetTool)
220
242
.sort((a, b) => tierRank(b.tier) - tierRank(a.tier));
221
243
222
244
if (!usable.length)
@@ -21,8 +21,10 @@ import {21
EXHAUSTED_ORE_BOULDER_STATE,21
EXHAUSTED_ORE_BOULDER_STATE,22
oreBoulderState,22
oreBoulderState,23
materialFromOreBoulderState,23
materialFromOreBoulderState,24
isOreBoulderState24
isOreBoulderState,25
isGemstoneMaterial25
} from "./materialTiers.js";26
} from "./materialTiers.js";27
import { gemItemId } from "./gemItems.js";26
import { herbDefinition, herbGatherSkillLevel } from "./herbs.js";28
import { herbDefinition, herbGatherSkillLevel } from "./herbs.js";27
29
28
export {30
export {@@ -38,6 +40,7 @@ export {38
oreBoulderState,40
oreBoulderState,39
materialFromOreBoulderState,41
materialFromOreBoulderState,40
isOreBoulderState,42
isOreBoulderState,43
isGemstoneMaterial,41
EquipmentKind,44
EquipmentKind,42
WoodTier45
WoodTier43
};46
};@@ -59,7 +62,14 @@ export const ORE_ITEM_BY_MATERIAL = Object.freeze({59
[MaterialTier.adamantium]: MetalItemId.adamantiumOre,62
[MaterialTier.adamantium]: MetalItemId.adamantiumOre,60
[MaterialTier.orichalcum]: MetalItemId.orichalcumOre,63
[MaterialTier.orichalcum]: MetalItemId.orichalcumOre,61
[MaterialTier.dragon]: MetalItemId.dragonOre,64
[MaterialTier.dragon]: MetalItemId.dragonOre,62
[GatherMaterialId.coal]: MetalItemId.coal65
[GatherMaterialId.coal]: MetalItemId.coal,66
[GatherMaterialId.tourmaline]: gemItemId(GatherMaterialId.tourmaline),67
[GatherMaterialId.alexandrite]: gemItemId(GatherMaterialId.alexandrite),68
[GatherMaterialId.opal]: gemItemId(GatherMaterialId.opal),69
[GatherMaterialId.diamond]: gemItemId(GatherMaterialId.diamond),70
[GatherMaterialId.emerald]: gemItemId(GatherMaterialId.emerald),71
[GatherMaterialId.ruby]: gemItemId(GatherMaterialId.ruby),72
[GatherMaterialId.jadeite]: gemItemId(GatherMaterialId.jadeite)63
});73
});64
74
65
export const BAR_ITEM_BY_MATERIAL = Object.freeze({75
export const BAR_ITEM_BY_MATERIAL = Object.freeze({@@ -137,21 +147,6 @@ export function gatherEquipTier (materialId)137
return associatedBarTier(materialId);147
return associatedBarTier(materialId);138
}148
}139
149
140
export function canMineMaterial (miningLevel, toolTier, materialId)141
{142
const gateTier = gatherEquipTier(materialId);143
const needSkill = tierMineSkillLevel(gateTier);144
if ((miningLevel | 0) < needSkill)145
{146
return { ok: false, reason: `Requires Mining ${needSkill}.` };147
}148
if (!toolTierMeetsResource(toolTier, gateTier))149
{150
return { ok: false, reason: "You need a pickaxe to mine this!" };151
}152
return { ok: true };153
}154
155
export function canChopWood (woodcuttingLevel, toolTier, woodTier)150
export function canChopWood (woodcuttingLevel, toolTier, woodTier)156
{151
{157
const needSkill = tierMineSkillLevel(woodTier);152
const needSkill = tierMineSkillLevel(woodTier);@@ -169,12 +164,36 @@ export function canChopWood (woodcuttingLevel, toolTier, woodTier)169
/**164
/**170
* Gathering tools may be one material tier below the resource node.165
* Gathering tools may be one material tier below the resource node.171
* Pine/bronze (rank 1) still need a bronze tool; birch accepts bronze or iron, etc.166
* Pine/bronze (rank 1) still need a bronze tool; birch accepts bronze or iron, etc.167
* Gemstones are stricter: pickaxe tier must be equal or higher.172
*/168
*/173
export function toolTierMeetsResource (toolTier, resourceTier)169
export function toolTierMeetsResource (toolTier, resourceTier)174
{170
{175
return tierRank(toolTier) + 1 >= tierRank(resourceTier);171
return tierRank(toolTier) + 1 >= tierRank(resourceTier);176
}172
}177
173
174
export function toolTierMeetsGemstone (toolTier, gemTier)175
{176
return tierRank(toolTier) >= tierRank(gemTier);177
}178
179
export function canMineMaterial (miningLevel, toolTier, materialId)180
{181
const gateTier = gatherEquipTier(materialId);182
const needSkill = tierMineSkillLevel(gateTier);183
if ((miningLevel | 0) < needSkill)184
{185
return { ok: false, reason: `Requires Mining ${needSkill}.` };186
}187
const toolOk = isGemstoneMaterial(materialId)188
? toolTierMeetsGemstone(toolTier, gateTier)189
: toolTierMeetsResource(toolTier, gateTier);190
if (!toolOk)191
{192
return { ok: false, reason: "You need a pickaxe to mine this!" };193
}194
return { ok: true };195
}196
178
/**197
/**179
* Tools of a given equipment kind in bag slots and/or the weapon slot.198
* Tools of a given equipment kind in bag slots and/or the weapon slot.180
* Gathering uses inventory tools without requiring them to be equipped.199
* Gathering uses inventory tools without requiring them to be equipped.@@ -214,9 +233,12 @@ export function resolveMiningPickaxe ({ inventorySlots, equipmentSlots, skills,214
{ return { ok: false, reason: `Requires Mining ${needSkill}.` }; }233
{ return { ok: false, reason: `Requires Mining ${needSkill}.` }; }215
234
216
const tools = listGatherTools(inventorySlots, equipmentSlots, EquipmentKind.pickaxeTool);235
const tools = listGatherTools(inventorySlots, equipmentSlots, EquipmentKind.pickaxeTool);236
const meetTool = isGemstoneMaterial(materialId)237
? (tool) => toolTierMeetsGemstone(tool.tier, gateTier)238
: (tool) => toolTierMeetsResource(tool.tier, gateTier);217
const usable = tools239
const usable = tools218
.filter((tool) => canEquipItem(skills, tool.def).ok)240
.filter((tool) => canEquipItem(skills, tool.def).ok)219
.filter((tool) => toolTierMeetsResource(tool.tier, gateTier))241
.filter(meetTool)220
.sort((a, b) => tierRank(b.tier) - tierRank(a.tier));242
.sort((a, b) => tierRank(b.tier) - tierRank(a.tier));221
243
222
if (!usable.length)244
if (!usable.length)@@ -0,0 +1,161 @@
1
import { ItemCategory } from "./itemCategories.js";
2
import {
3
GemTier,
4
GEM_TIER_ORDER,
5
MATERIAL_DISPLAY_NAME,
6
WOOD_TIER_ORDER,
7
gemTierForWood,
8
tierMinSkillLevel,
9
tierRank
10
} from "./materialTiers.js";
11
import { EquipmentKind } from "./equipmentKinds.js";
12
import { CraftingStationId } from "./craftingStations.js";
13
import { logItemIdForWood, ashItemIdForWood } from "./woodItems.js";
14
15
const DEFAULT_STACK = 99;
16
17
/**
18
* Raw gemstones (377–383) and magic staves (384–390).
19
* Staves: red = wood, blue = gem (dual-tint staff sprite).
20
*/
21
export const GemItemId = Object.freeze({
22
tourmaline: 377,
23
alexandrite: 378,
24
opal: 379,
25
diamond: 380,
26
emerald: 381,
27
ruby: 382,
28
jadeite: 383,
29
pineStaff: 384,
30
birchStaff: 385,
31
oakStaff: 386,
32
ebonyStaff: 387,
33
lignumStaff: 388,
34
heartwoodStaff: 389,
35
elderStaff: 390
36
});
37
38
export const GEM_ITEM_BY_TIER = Object.freeze({
39
[GemTier.tourmaline]: GemItemId.tourmaline,
40
[GemTier.alexandrite]: GemItemId.alexandrite,
41
[GemTier.opal]: GemItemId.opal,
42
[GemTier.diamond]: GemItemId.diamond,
43
[GemTier.emerald]: GemItemId.emerald,
44
[GemTier.ruby]: GemItemId.ruby,
45
[GemTier.jadeite]: GemItemId.jadeite
46
});
47
48
export const STAFF_ITEM_BY_WOOD = Object.freeze({
49
pine: GemItemId.pineStaff,
50
birch: GemItemId.birchStaff,
51
oak: GemItemId.oakStaff,
52
ebony: GemItemId.ebonyStaff,
53
lignum: GemItemId.lignumStaff,
54
heartwood: GemItemId.heartwoodStaff,
55
elder: GemItemId.elderStaff
56
});
57
58
export function gemItemId (gemTier)
59
{
60
return GEM_ITEM_BY_TIER[gemTier] ?? null;
61
}
62
63
export function staffItemIdForWood (woodTier)
64
{
65
return STAFF_ITEM_BY_WOOD[woodTier] ?? null;
66
}
67
68
function buildGemDefinitions ()
69
{
70
const out = {};
71
for (const gemTier of GEM_TIER_ORDER)
72
{
73
const itemId = GEM_ITEM_BY_TIER[gemTier];
74
const name = MATERIAL_DISPLAY_NAME[gemTier] ?? gemTier;
75
out[itemId] = Object.freeze({
76
itemId,
77
key: `${gemTier}-gem`,
78
displayName: name,
79
description: `A polished ${name.toLowerCase()}, cool and bright in the hand.`,
80
seedValue: tierRank(gemTier) * 3,
81
stackable: true,
82
maxStackSize: DEFAULT_STACK,
83
uniqueInstance: false,
84
category: ItemCategory.ingredient,
85
iconKey: "ore",
86
defaultState: "ore",
87
tier: gemTier,
88
tintFromTier: true,
89
gemstone: true,
90
npcShopAllowed: true
91
});
92
}
93
return out;
94
}
95
96
function buildStaffDefinitions ()
97
{
98
const out = {};
99
for (const woodTier of WOOD_TIER_ORDER)
100
{
101
const itemId = STAFF_ITEM_BY_WOOD[woodTier];
102
const gemTier = gemTierForWood(woodTier);
103
const woodName = MATERIAL_DISPLAY_NAME[woodTier] ?? woodTier;
104
const gemName = MATERIAL_DISPLAY_NAME[gemTier] ?? gemTier;
105
out[itemId] = Object.freeze({
106
itemId,
107
key: `${woodTier}-staff`,
108
displayName: `${woodName} staff`,
109
description: `A ${woodName.toLowerCase()} shaft capped with ${gemName.toLowerCase()}.`,
110
seedValue: tierRank(woodTier) * 4,
111
stackable: false,
112
maxStackSize: 1,
113
uniqueInstance: false,
114
category: ItemCategory.tool,
115
iconKey: "staff",
116
defaultState: "staff",
117
tier: woodTier,
118
gemTier,
119
tintFromTier: true,
120
dualTintFromTier: true,
121
equipment: Object.freeze({
122
slot: "weapon",
123
tier: woodTier,
124
kind: EquipmentKind.staff,
125
tintFromTier: true,
126
dualTintFromTier: true
127
}),
128
npcShopAllowed: true
129
});
130
}
131
return out;
132
}
133
134
export const GEM_ITEM_DEFINITIONS = Object.freeze({
135
...buildGemDefinitions(),
136
...buildStaffDefinitions()
137
});
138
139
/** Craft recipes: 1 log + 1 gem + 1 ash → staff (matching wood/gem tier). */
140
export function staffCraftRecipes ()
141
{
142
return WOOD_TIER_ORDER.map((woodTier) =>
143
{
144
const gemTier = gemTierForWood(woodTier);
145
return Object.freeze({
146
recipeId: `staff-${woodTier}`,
147
craftGroup: "staff",
148
craftGroupLabel: "Staff",
149
stationId: CraftingStationId.craftingBench,
150
output: { itemId: staffItemIdForWood(woodTier), quantity: 1 },
151
inputs: [
152
{ itemId: logItemIdForWood(woodTier), quantity: 1 },
153
{ itemId: gemItemId(gemTier), quantity: 1 },
154
{ itemId: ashItemIdForWood(woodTier), quantity: 1 }
155
],
156
minSkillLevel: tierMinSkillLevel(woodTier),
157
skillId: "crafting",
158
xpMaterial: woodTier
159
});
160
});
161
}
@@ -0,0 +1,161 @@1
import { ItemCategory } from "./itemCategories.js";2
import {3
GemTier,4
GEM_TIER_ORDER,5
MATERIAL_DISPLAY_NAME,6
WOOD_TIER_ORDER,7
gemTierForWood,8
tierMinSkillLevel,9
tierRank10
} from "./materialTiers.js";11
import { EquipmentKind } from "./equipmentKinds.js";12
import { CraftingStationId } from "./craftingStations.js";13
import { logItemIdForWood, ashItemIdForWood } from "./woodItems.js";14
15
const DEFAULT_STACK = 99;16
17
/**18
* Raw gemstones (377–383) and magic staves (384–390).19
* Staves: red = wood, blue = gem (dual-tint staff sprite).20
*/21
export const GemItemId = Object.freeze({22
tourmaline: 377,23
alexandrite: 378,24
opal: 379,25
diamond: 380,26
emerald: 381,27
ruby: 382,28
jadeite: 383,29
pineStaff: 384,30
birchStaff: 385,31
oakStaff: 386,32
ebonyStaff: 387,33
lignumStaff: 388,34
heartwoodStaff: 389,35
elderStaff: 39036
});37
38
export const GEM_ITEM_BY_TIER = Object.freeze({39
[GemTier.tourmaline]: GemItemId.tourmaline,40
[GemTier.alexandrite]: GemItemId.alexandrite,41
[GemTier.opal]: GemItemId.opal,42
[GemTier.diamond]: GemItemId.diamond,43
[GemTier.emerald]: GemItemId.emerald,44
[GemTier.ruby]: GemItemId.ruby,45
[GemTier.jadeite]: GemItemId.jadeite46
});47
48
export const STAFF_ITEM_BY_WOOD = Object.freeze({49
pine: GemItemId.pineStaff,50
birch: GemItemId.birchStaff,51
oak: GemItemId.oakStaff,52
ebony: GemItemId.ebonyStaff,53
lignum: GemItemId.lignumStaff,54
heartwood: GemItemId.heartwoodStaff,55
elder: GemItemId.elderStaff56
});57
58
export function gemItemId (gemTier)59
{60
return GEM_ITEM_BY_TIER[gemTier] ?? null;61
}62
63
export function staffItemIdForWood (woodTier)64
{65
return STAFF_ITEM_BY_WOOD[woodTier] ?? null;66
}67
68
function buildGemDefinitions ()69
{70
const out = {};71
for (const gemTier of GEM_TIER_ORDER)72
{73
const itemId = GEM_ITEM_BY_TIER[gemTier];74
const name = MATERIAL_DISPLAY_NAME[gemTier] ?? gemTier;75
out[itemId] = Object.freeze({76
itemId,77
key: `${gemTier}-gem`,78
displayName: name,79
description: `A polished ${name.toLowerCase()}, cool and bright in the hand.`,80
seedValue: tierRank(gemTier) * 3,81
stackable: true,82
maxStackSize: DEFAULT_STACK,83
uniqueInstance: false,84
category: ItemCategory.ingredient,85
iconKey: "ore",86
defaultState: "ore",87
tier: gemTier,88
tintFromTier: true,89
gemstone: true,90
npcShopAllowed: true91
});92
}93
return out;94
}95
96
function buildStaffDefinitions ()97
{98
const out = {};99
for (const woodTier of WOOD_TIER_ORDER)100
{101
const itemId = STAFF_ITEM_BY_WOOD[woodTier];102
const gemTier = gemTierForWood(woodTier);103
const woodName = MATERIAL_DISPLAY_NAME[woodTier] ?? woodTier;104
const gemName = MATERIAL_DISPLAY_NAME[gemTier] ?? gemTier;105
out[itemId] = Object.freeze({106
itemId,107
key: `${woodTier}-staff`,108
displayName: `${woodName} staff`,109
description: `A ${woodName.toLowerCase()} shaft capped with ${gemName.toLowerCase()}.`,110
seedValue: tierRank(woodTier) * 4,111
stackable: false,112
maxStackSize: 1,113
uniqueInstance: false,114
category: ItemCategory.tool,115
iconKey: "staff",116
defaultState: "staff",117
tier: woodTier,118
gemTier,119
tintFromTier: true,120
dualTintFromTier: true,121
equipment: Object.freeze({122
slot: "weapon",123
tier: woodTier,124
kind: EquipmentKind.staff,125
tintFromTier: true,126
dualTintFromTier: true127
}),128
npcShopAllowed: true129
});130
}131
return out;132
}133
134
export const GEM_ITEM_DEFINITIONS = Object.freeze({135
...buildGemDefinitions(),136
...buildStaffDefinitions()137
});138
139
/** Craft recipes: 1 log + 1 gem + 1 ash → staff (matching wood/gem tier). */140
export function staffCraftRecipes ()141
{142
return WOOD_TIER_ORDER.map((woodTier) =>143
{144
const gemTier = gemTierForWood(woodTier);145
return Object.freeze({146
recipeId: `staff-${woodTier}`,147
craftGroup: "staff",148
craftGroupLabel: "Staff",149
stationId: CraftingStationId.craftingBench,150
output: { itemId: staffItemIdForWood(woodTier), quantity: 1 },151
inputs: [152
{ itemId: logItemIdForWood(woodTier), quantity: 1 },153
{ itemId: gemItemId(gemTier), quantity: 1 },154
{ itemId: ashItemIdForWood(woodTier), quantity: 1 }155
],156
minSkillLevel: tierMinSkillLevel(woodTier),157
skillId: "crafting",158
xpMaterial: woodTier159
});160
});161
}@@ -17,6 +17,7 @@ import { RANGED_ITEM_DEFINITIONS, RangedItemId } from "./rangedItems.js";
17
17
import { POTION_MAX_STACK } from "./alchemy.js";
18
18
import { SpellbookItemId, SPELLBOOK_ITEM_DEFINITIONS } from "./spellItems.js";
19
19
import { FISH_ITEM_DEFINITIONS, FishingToolItemId } from "./fishItems.js";
20
import { GemItemId, GEM_ITEM_DEFINITIONS } from "./gemItems.js";
20
21
21
22
export const ItemId = Object.freeze({
22
23
paper: 1,
@@ -45,7 +46,8 @@ export const ItemId = Object.freeze({
45
46
...LeatherItemId,
46
47
...DyeItemId,
47
48
...HerbItemId,
48
...RangedItemId
49
...RangedItemId,
50
...GemItemId
49
51
});
50
52
51
53
export const EQUIPMENT_SLOT = Object.freeze({
@@ -279,6 +281,7 @@ export const ITEM_DEFINITIONS = Object.freeze({
279
281
...RANGED_ITEM_DEFINITIONS,
280
282
...SPELLBOOK_ITEM_DEFINITIONS,
281
283
...FISH_ITEM_DEFINITIONS,
284
...GEM_ITEM_DEFINITIONS,
282
285
[DyeItemId.flower]: FLOWER_ITEM_DEFINITION,
283
286
[DyeItemId.dye]: DYE_ITEM_DEFINITION
284
287
});
@@ -17,6 +17,7 @@ import { RANGED_ITEM_DEFINITIONS, RangedItemId } from "./rangedItems.js";17
import { POTION_MAX_STACK } from "./alchemy.js";17
import { POTION_MAX_STACK } from "./alchemy.js";18
import { SpellbookItemId, SPELLBOOK_ITEM_DEFINITIONS } from "./spellItems.js";18
import { SpellbookItemId, SPELLBOOK_ITEM_DEFINITIONS } from "./spellItems.js";19
import { FISH_ITEM_DEFINITIONS, FishingToolItemId } from "./fishItems.js";19
import { FISH_ITEM_DEFINITIONS, FishingToolItemId } from "./fishItems.js";20
import { GemItemId, GEM_ITEM_DEFINITIONS } from "./gemItems.js";20
21
21
export const ItemId = Object.freeze({22
export const ItemId = Object.freeze({22
paper: 1,23
paper: 1,@@ -45,7 +46,8 @@ export const ItemId = Object.freeze({45
...LeatherItemId,46
...LeatherItemId,46
...DyeItemId,47
...DyeItemId,47
...HerbItemId,48
...HerbItemId,48
...RangedItemId49
...RangedItemId,50
...GemItemId49
});51
});50
52
51
export const EQUIPMENT_SLOT = Object.freeze({53
export const EQUIPMENT_SLOT = Object.freeze({@@ -279,6 +281,7 @@ export const ITEM_DEFINITIONS = Object.freeze({279
...RANGED_ITEM_DEFINITIONS,281
...RANGED_ITEM_DEFINITIONS,280
...SPELLBOOK_ITEM_DEFINITIONS,282
...SPELLBOOK_ITEM_DEFINITIONS,281
...FISH_ITEM_DEFINITIONS,283
...FISH_ITEM_DEFINITIONS,284
...GEM_ITEM_DEFINITIONS,282
[DyeItemId.flower]: FLOWER_ITEM_DEFINITION,285
[DyeItemId.flower]: FLOWER_ITEM_DEFINITION,283
[DyeItemId.dye]: DYE_ITEM_DEFINITION286
[DyeItemId.dye]: DYE_ITEM_DEFINITION284
});287
});@@ -107,14 +107,40 @@ export const LEATHER_DISPLAY_NAME = Object.freeze({
107
107
[LeatherTier.dragonhide]: "Dragonhide"
108
108
});
109
109
110
/**
111
* Gemstone materials — mined for staves and jewellery.
112
* Ranks / equip gates match metal / wood (tourmaline↔pine/bronze … jadeite↔elder/dragon).
113
*/
114
export const GemTier = Object.freeze({
115
tourmaline: "tourmaline",
116
alexandrite: "alexandrite",
117
opal: "opal",
118
diamond: "diamond",
119
emerald: "emerald",
120
ruby: "ruby",
121
jadeite: "jadeite"
122
});
123
124
/** Ordered low → high (gem mining / jewellery). */
125
export const GEM_TIER_ORDER = Object.freeze([
126
GemTier.tourmaline,
127
GemTier.alexandrite,
128
GemTier.opal,
129
GemTier.diamond,
130
GemTier.emerald,
131
GemTier.ruby,
132
GemTier.jadeite
133
]);
134
110
135
/**
111
136
* Gatherable ores / fuels that are not always 1:1 with a gear tier.
112
137
* Tin + copper smelt into bronze; coal fuels steel. Gold and silver have ore +
113
138
* bars but no tools (jewelry / future recipes). Mine/smelt timing uses
114
* {@link associatedBarTier}.
139
* {@link associatedBarTier}. Gemstones map onto the matching metal gate.
115
140
*/
116
141
export const GatherMaterialId = Object.freeze({
117
142
...MaterialTier,
143
...GemTier,
118
144
tin: "tin",
119
145
copper: "copper",
120
146
coal: "coal",
@@ -133,6 +159,13 @@ export const TIER_MIN_SKILL_LEVEL = Object.freeze({
133
159
[MaterialTier.dragon]: 90,
134
160
[GatherMaterialId.silver]: 10,
135
161
[GatherMaterialId.gold]: 20,
162
[GemTier.tourmaline]: 1,
163
[GemTier.alexandrite]: 10,
164
[GemTier.opal]: 20,
165
[GemTier.diamond]: 35,
166
[GemTier.emerald]: 50,
167
[GemTier.ruby]: 70,
168
[GemTier.jadeite]: 90,
136
169
[WoodTier.pine]: 1,
137
170
[WoodTier.birch]: 10,
138
171
[WoodTier.oak]: 20,
@@ -167,6 +200,13 @@ export const TIER_RANK = Object.freeze({
167
200
[MaterialTier.dragon]: 7,
168
201
[GatherMaterialId.silver]: 2,
169
202
[GatherMaterialId.gold]: 3,
203
[GemTier.tourmaline]: 1,
204
[GemTier.alexandrite]: 2,
205
[GemTier.opal]: 3,
206
[GemTier.diamond]: 4,
207
[GemTier.emerald]: 5,
208
[GemTier.ruby]: 6,
209
[GemTier.jadeite]: 7,
170
210
[WoodTier.pine]: 1,
171
211
[WoodTier.birch]: 2,
172
212
[WoodTier.oak]: 3,
@@ -236,6 +276,13 @@ export const MATERIAL_DISPLAY_NAME = Object.freeze({
236
276
[GatherMaterialId.coal]: "Coal",
237
277
[GatherMaterialId.silver]: "Silver",
238
278
[GatherMaterialId.gold]: "Gold",
279
[GemTier.tourmaline]: "Tourmaline",
280
[GemTier.alexandrite]: "Alexandrite",
281
[GemTier.opal]: "Opal",
282
[GemTier.diamond]: "Diamond",
283
[GemTier.emerald]: "Emerald",
284
[GemTier.ruby]: "Ruby",
285
[GemTier.jadeite]: "Jadeite",
239
286
[WoodTier.pine]: "Pine",
240
287
[WoodTier.birch]: "Birch",
241
288
[WoodTier.oak]: "Oak",
@@ -288,6 +335,13 @@ export const MATERIAL_TINT_HEX = Object.freeze({
288
335
[GatherMaterialId.coal]: rgb(45, 45, 48),
289
336
[GatherMaterialId.silver]: rgb(214, 220, 230),
290
337
[GatherMaterialId.gold]: rgb(255, 200, 0),
338
[GemTier.tourmaline]: rgb(200, 55, 120),
339
[GemTier.alexandrite]: rgb(120, 70, 180),
340
[GemTier.opal]: rgb(230, 210, 220),
341
[GemTier.diamond]: rgb(200, 235, 255),
342
[GemTier.emerald]: rgb(35, 165, 95),
343
[GemTier.ruby]: rgb(190, 25, 45),
344
[GemTier.jadeite]: rgb(55, 145, 105),
291
345
[WoodTier.pine]: rgb(199, 158, 97),
292
346
[WoodTier.birch]: rgb(224, 209, 173),
293
347
[WoodTier.oak]: rgb(158, 107, 61),
@@ -412,6 +466,9 @@ export function associatedBarTier (materialId)
412
466
{ return MaterialTier.bronze; }
413
467
if (materialId === GatherMaterialId.coal)
414
468
{ return MaterialTier.steel; }
469
const gemIdx = GEM_TIER_ORDER.indexOf(materialId);
470
if (gemIdx >= 0)
471
{ return MATERIAL_TIER_ORDER[gemIdx] ?? MaterialTier.bronze; }
415
472
return materialId;
416
473
}
417
474
@@ -476,6 +533,25 @@ export function woodTierForMetal (metalTier)
476
533
return WOOD_TIER_FOR_METAL[metalTier] ?? WoodTier.pine;
477
534
}
478
535
536
/** Matching wood tier for a gemstone (tourmaline↔pine … jadeite↔elder). */
537
export function woodTierForGem (gemTier)
538
{
539
const idx = GEM_TIER_ORDER.indexOf(gemTier);
540
return WOOD_TIER_ORDER[idx >= 0 ? idx : 0] ?? WoodTier.pine;
541
}
542
543
/** Matching gemstone for a wood tier. */
544
export function gemTierForWood (woodTier)
545
{
546
const idx = WOOD_TIER_ORDER.indexOf(woodTier);
547
return GEM_TIER_ORDER[idx >= 0 ? idx : 0] ?? GemTier.tourmaline;
548
}
549
550
export function isGemstoneMaterial (materialId)
551
{
552
return GEM_TIER_ORDER.includes(materialId);
553
}
554
479
555
/** Matching cloth tier for a wood tier (pine↔cotton, birch↔wool, …). */
480
556
export function clothTierForWood (woodTier)
481
557
{
@@ -537,7 +613,8 @@ export const ORE_BEARING_MATERIALS = Object.freeze([
537
613
MaterialTier.adamantium,
538
614
MaterialTier.orichalcum,
539
615
MaterialTier.dragon,
540
GatherMaterialId.coal
616
GatherMaterialId.coal,
617
...GEM_TIER_ORDER
541
618
]);
542
619
543
620
/** Boulder visual state for a gatherable ore (editor / world). */
@@ -107,14 +107,40 @@ export const LEATHER_DISPLAY_NAME = Object.freeze({107
[LeatherTier.dragonhide]: "Dragonhide"107
[LeatherTier.dragonhide]: "Dragonhide"108
});108
});109
109
110
/**111
* Gemstone materials — mined for staves and jewellery.112
* Ranks / equip gates match metal / wood (tourmaline↔pine/bronze … jadeite↔elder/dragon).113
*/114
export const GemTier = Object.freeze({115
tourmaline: "tourmaline",116
alexandrite: "alexandrite",117
opal: "opal",118
diamond: "diamond",119
emerald: "emerald",120
ruby: "ruby",121
jadeite: "jadeite"122
});123
124
/** Ordered low → high (gem mining / jewellery). */125
export const GEM_TIER_ORDER = Object.freeze([126
GemTier.tourmaline,127
GemTier.alexandrite,128
GemTier.opal,129
GemTier.diamond,130
GemTier.emerald,131
GemTier.ruby,132
GemTier.jadeite133
]);134
110
/**135
/**111
* Gatherable ores / fuels that are not always 1:1 with a gear tier.136
* Gatherable ores / fuels that are not always 1:1 with a gear tier.112
* Tin + copper smelt into bronze; coal fuels steel. Gold and silver have ore +137
* Tin + copper smelt into bronze; coal fuels steel. Gold and silver have ore +113
* bars but no tools (jewelry / future recipes). Mine/smelt timing uses138
* bars but no tools (jewelry / future recipes). Mine/smelt timing uses114
* {@link associatedBarTier}.139
* {@link associatedBarTier}. Gemstones map onto the matching metal gate.115
*/140
*/116
export const GatherMaterialId = Object.freeze({141
export const GatherMaterialId = Object.freeze({117
...MaterialTier,142
...MaterialTier,143
...GemTier,118
tin: "tin",144
tin: "tin",119
copper: "copper",145
copper: "copper",120
coal: "coal",146
coal: "coal",@@ -133,6 +159,13 @@ export const TIER_MIN_SKILL_LEVEL = Object.freeze({133
[MaterialTier.dragon]: 90,159
[MaterialTier.dragon]: 90,134
[GatherMaterialId.silver]: 10,160
[GatherMaterialId.silver]: 10,135
[GatherMaterialId.gold]: 20,161
[GatherMaterialId.gold]: 20,162
[GemTier.tourmaline]: 1,163
[GemTier.alexandrite]: 10,164
[GemTier.opal]: 20,165
[GemTier.diamond]: 35,166
[GemTier.emerald]: 50,167
[GemTier.ruby]: 70,168
[GemTier.jadeite]: 90,136
[WoodTier.pine]: 1,169
[WoodTier.pine]: 1,137
[WoodTier.birch]: 10,170
[WoodTier.birch]: 10,138
[WoodTier.oak]: 20,171
[WoodTier.oak]: 20,@@ -167,6 +200,13 @@ export const TIER_RANK = Object.freeze({167
[MaterialTier.dragon]: 7,200
[MaterialTier.dragon]: 7,168
[GatherMaterialId.silver]: 2,201
[GatherMaterialId.silver]: 2,169
[GatherMaterialId.gold]: 3,202
[GatherMaterialId.gold]: 3,203
[GemTier.tourmaline]: 1,204
[GemTier.alexandrite]: 2,205
[GemTier.opal]: 3,206
[GemTier.diamond]: 4,207
[GemTier.emerald]: 5,208
[GemTier.ruby]: 6,209
[GemTier.jadeite]: 7,170
[WoodTier.pine]: 1,210
[WoodTier.pine]: 1,171
[WoodTier.birch]: 2,211
[WoodTier.birch]: 2,172
[WoodTier.oak]: 3,212
[WoodTier.oak]: 3,@@ -236,6 +276,13 @@ export const MATERIAL_DISPLAY_NAME = Object.freeze({236
[GatherMaterialId.coal]: "Coal",276
[GatherMaterialId.coal]: "Coal",237
[GatherMaterialId.silver]: "Silver",277
[GatherMaterialId.silver]: "Silver",238
[GatherMaterialId.gold]: "Gold",278
[GatherMaterialId.gold]: "Gold",279
[GemTier.tourmaline]: "Tourmaline",280
[GemTier.alexandrite]: "Alexandrite",281
[GemTier.opal]: "Opal",282
[GemTier.diamond]: "Diamond",283
[GemTier.emerald]: "Emerald",284
[GemTier.ruby]: "Ruby",285
[GemTier.jadeite]: "Jadeite",239
[WoodTier.pine]: "Pine",286
[WoodTier.pine]: "Pine",240
[WoodTier.birch]: "Birch",287
[WoodTier.birch]: "Birch",241
[WoodTier.oak]: "Oak",288
[WoodTier.oak]: "Oak",@@ -288,6 +335,13 @@ export const MATERIAL_TINT_HEX = Object.freeze({288
[GatherMaterialId.coal]: rgb(45, 45, 48),335
[GatherMaterialId.coal]: rgb(45, 45, 48),289
[GatherMaterialId.silver]: rgb(214, 220, 230),336
[GatherMaterialId.silver]: rgb(214, 220, 230),290
[GatherMaterialId.gold]: rgb(255, 200, 0),337
[GatherMaterialId.gold]: rgb(255, 200, 0),338
[GemTier.tourmaline]: rgb(200, 55, 120),339
[GemTier.alexandrite]: rgb(120, 70, 180),340
[GemTier.opal]: rgb(230, 210, 220),341
[GemTier.diamond]: rgb(200, 235, 255),342
[GemTier.emerald]: rgb(35, 165, 95),343
[GemTier.ruby]: rgb(190, 25, 45),344
[GemTier.jadeite]: rgb(55, 145, 105),291
[WoodTier.pine]: rgb(199, 158, 97),345
[WoodTier.pine]: rgb(199, 158, 97),292
[WoodTier.birch]: rgb(224, 209, 173),346
[WoodTier.birch]: rgb(224, 209, 173),293
[WoodTier.oak]: rgb(158, 107, 61),347
[WoodTier.oak]: rgb(158, 107, 61),@@ -412,6 +466,9 @@ export function associatedBarTier (materialId)412
{ return MaterialTier.bronze; }466
{ return MaterialTier.bronze; }413
if (materialId === GatherMaterialId.coal)467
if (materialId === GatherMaterialId.coal)414
{ return MaterialTier.steel; }468
{ return MaterialTier.steel; }469
const gemIdx = GEM_TIER_ORDER.indexOf(materialId);470
if (gemIdx >= 0)471
{ return MATERIAL_TIER_ORDER[gemIdx] ?? MaterialTier.bronze; }415
return materialId;472
return materialId;416
}473
}417
474
@@ -476,6 +533,25 @@ export function woodTierForMetal (metalTier)476
return WOOD_TIER_FOR_METAL[metalTier] ?? WoodTier.pine;533
return WOOD_TIER_FOR_METAL[metalTier] ?? WoodTier.pine;477
}534
}478
535
536
/** Matching wood tier for a gemstone (tourmaline↔pine … jadeite↔elder). */537
export function woodTierForGem (gemTier)538
{539
const idx = GEM_TIER_ORDER.indexOf(gemTier);540
return WOOD_TIER_ORDER[idx >= 0 ? idx : 0] ?? WoodTier.pine;541
}542
543
/** Matching gemstone for a wood tier. */544
export function gemTierForWood (woodTier)545
{546
const idx = WOOD_TIER_ORDER.indexOf(woodTier);547
return GEM_TIER_ORDER[idx >= 0 ? idx : 0] ?? GemTier.tourmaline;548
}549
550
export function isGemstoneMaterial (materialId)551
{552
return GEM_TIER_ORDER.includes(materialId);553
}554
479
/** Matching cloth tier for a wood tier (pine↔cotton, birch↔wool, …). */555
/** Matching cloth tier for a wood tier (pine↔cotton, birch↔wool, …). */480
export function clothTierForWood (woodTier)556
export function clothTierForWood (woodTier)481
{557
{@@ -537,7 +613,8 @@ export const ORE_BEARING_MATERIALS = Object.freeze([537
MaterialTier.adamantium,613
MaterialTier.adamantium,538
MaterialTier.orichalcum,614
MaterialTier.orichalcum,539
MaterialTier.dragon,615
MaterialTier.dragon,540
GatherMaterialId.coal616
GatherMaterialId.coal,617
...GEM_TIER_ORDER541
]);618
]);542
619
543
/** Boulder visual state for a gatherable ore (editor / world). */620
/** Boulder visual state for a gatherable ore (editor / world). */@@ -4,6 +4,7 @@ import
4
4
oreBoulderState,
5
5
materialFromOreBoulderState,
6
6
MATERIAL_DISPLAY_NAME,
7
isGemstoneMaterial,
7
8
WoodTier,
8
9
WOOD_TIER_ORDER
9
10
} from "./materialTiers.js";
@@ -543,7 +544,11 @@ export function oreBoulderDisplayName (state)
543
544
if (!material)
544
545
{ return null; }
545
546
const label = MATERIAL_DISPLAY_NAME[material] ?? material;
546
return material === "coal" ? "Coal boulder" : `${label} ore boulder`;
547
if (material === "coal")
548
{ return "Coal boulder"; }
549
if (isGemstoneMaterial(material))
550
{ return `${label} boulder`; }
551
return `${label} ore boulder`;
547
552
}
548
553
549
554
/**
@@ -4,6 +4,7 @@ import4
oreBoulderState,4
oreBoulderState,5
materialFromOreBoulderState,5
materialFromOreBoulderState,6
MATERIAL_DISPLAY_NAME,6
MATERIAL_DISPLAY_NAME,7
isGemstoneMaterial,7
WoodTier,8
WoodTier,8
WOOD_TIER_ORDER9
WOOD_TIER_ORDER9
} from "./materialTiers.js";10
} from "./materialTiers.js";@@ -543,7 +544,11 @@ export function oreBoulderDisplayName (state)543
if (!material)544
if (!material)544
{ return null; }545
{ return null; }545
const label = MATERIAL_DISPLAY_NAME[material] ?? material;546
const label = MATERIAL_DISPLAY_NAME[material] ?? material;546
return material === "coal" ? "Coal boulder" : `${label} ore boulder`;547
if (material === "coal")548
{ return "Coal boulder"; }549
if (isGemstoneMaterial(material))550
{ return `${label} boulder`; }551
return `${label} ore boulder`;547
}552
}548
553
549
/**554
/**@@ -112,6 +112,19 @@ export function resolveItemDualTint (stackOrDef, def = null)
112
112
};
113
113
}
114
114
115
// Magic staff: wood shaft (red) + gem tip (blue).
116
if (definition.gemTier)
117
{
118
const woodTier = definition.tier ?? definition.equipment?.tier ?? null;
119
const gemTier = definition.gemTier;
120
if (!woodTier || !gemTier)
121
{ return null; }
122
return {
123
shaft: tierTintColor(woodTier),
124
tip: tierTintColor(gemTier)
125
};
126
}
127
115
128
// Strung bow: wood frame + cloth string.
116
129
if (definition.clothTier)
117
130
{
@@ -158,15 +171,15 @@ export function tierTintColor (tier, { ore = false } = {})
158
171
return normalizeRgb(materialTintColor(tier, { ore }));
159
172
}
160
173
161
/** Halfway between very dark grey and the wood tier colour (shared ash sprite). */
174
/** Max towards grey between charcoal and the wood tier colour (shared ash sprite). */
162
175
export function ashTintColor (woodTier)
163
176
{
164
177
const wood = tierTintColor(woodTier);
165
const dark = { r: 0.12, g: 0.12, b: 0.12 };
178
const dark = { r: 0.22, g: 0.22, b: 0.22 };
166
179
return {
167
r: (dark.r + wood.r) * 0.5,
168
g: (dark.g + wood.g) * 0.5,
169
b: (dark.b + wood.b) * 0.5
180
r: dark.r * 0.65 + wood.r * 0.35,
181
g: dark.g * 0.65 + wood.g * 0.35,
182
b: dark.b * 0.65 + wood.b * 0.35
170
183
};
171
184
}
172
185
@@ -112,6 +112,19 @@ export function resolveItemDualTint (stackOrDef, def = null)112
};112
};113
}113
}114
114
115
// Magic staff: wood shaft (red) + gem tip (blue).116
if (definition.gemTier)117
{118
const woodTier = definition.tier ?? definition.equipment?.tier ?? null;119
const gemTier = definition.gemTier;120
if (!woodTier || !gemTier)121
{ return null; }122
return {123
shaft: tierTintColor(woodTier),124
tip: tierTintColor(gemTier)125
};126
}127
115
// Strung bow: wood frame + cloth string.128
// Strung bow: wood frame + cloth string.116
if (definition.clothTier)129
if (definition.clothTier)117
{130
{@@ -158,15 +171,15 @@ export function tierTintColor (tier, { ore = false } = {})158
return normalizeRgb(materialTintColor(tier, { ore }));171
return normalizeRgb(materialTintColor(tier, { ore }));159
}172
}160
173
161
/** Halfway between very dark grey and the wood tier colour (shared ash sprite). */174
/** Max towards grey between charcoal and the wood tier colour (shared ash sprite). */162
export function ashTintColor (woodTier)175
export function ashTintColor (woodTier)163
{176
{164
const wood = tierTintColor(woodTier);177
const wood = tierTintColor(woodTier);165
const dark = { r: 0.12, g: 0.12, b: 0.12 };178
const dark = { r: 0.22, g: 0.22, b: 0.22 };166
return {179
return {167
r: (dark.r + wood.r) * 0.5,180
r: dark.r * 0.65 + wood.r * 0.35,168
g: (dark.g + wood.g) * 0.5,181
g: dark.g * 0.65 + wood.g * 0.35,169
b: (dark.b + wood.b) * 0.5182
b: dark.b * 0.65 + wood.b * 0.35170
};183
};171
}184
}172
185