/** * Metal materials (and coal) — name, tint, rank, and skill gates. * Equip min level is the tier gate; mining = half (ceil), smelting = 75% (ceil). */ export const MaterialTier = Object.freeze({ bronze: "bronze", iron: "iron", steel: "steel", mithril: "mithril", adamantium: "adamantium", orichalcum: "orichalcum", dragon: "dragon" }); /** * Wood materials — same ranks / skill gates as metals (gather with axe later). * Matching metal: pine↔bronze … elder↔dragon. */ export const WoodTier = Object.freeze({ pine: "pine", birch: "birch", oak: "oak", ebony: "ebony", lignum: "lignum", heartwood: "heartwood", elder: "elder" }); /** * Cloth / fibre tiers (tailoring). Gathering methods vary (plant / shear / drop); * ranks and equip gates match metal / wood. */ export const ClothTier = Object.freeze({ cotton: "cotton", wool: "wool", linen: "linen", cashmere: "cashmere", silk: "silk", fairySilk: "fairySilk", dragonweave: "dragonweave" }); /** Ordered low → high (metal smithing / tools). */ export const MATERIAL_TIER_ORDER = Object.freeze([ MaterialTier.bronze, MaterialTier.iron, MaterialTier.steel, MaterialTier.mithril, MaterialTier.adamantium, MaterialTier.orichalcum, MaterialTier.dragon ]); /** Ordered low → high (woodcutting / woodcraft). */ export const WOOD_TIER_ORDER = Object.freeze([ WoodTier.pine, WoodTier.birch, WoodTier.oak, WoodTier.ebony, WoodTier.lignum, WoodTier.heartwood, WoodTier.elder ]); /** Ordered low → high (tailoring). */ export const CLOTH_TIER_ORDER = Object.freeze([ ClothTier.cotton, ClothTier.wool, ClothTier.linen, ClothTier.cashmere, ClothTier.silk, ClothTier.fairySilk, ClothTier.dragonweave ]); /** * Leather tiers (leatherworking). Rank gates mirror cloth/metal families. */ export const LeatherTier = Object.freeze({ softLeather: "softLeather", hardLeather: "hardLeather", studdedLeather: "studdedLeather", reinforcedLeather: "reinforcedLeather", scaledLeather: "scaledLeather", wyvernHide: "wyvernHide", dragonhide: "dragonhide" }); /** Ordered low → high (leatherworking). */ export const LEATHER_TIER_ORDER = Object.freeze([ LeatherTier.softLeather, LeatherTier.hardLeather, LeatherTier.studdedLeather, LeatherTier.reinforcedLeather, LeatherTier.scaledLeather, LeatherTier.wyvernHide, LeatherTier.dragonhide ]); export const LEATHER_DISPLAY_NAME = Object.freeze({ [LeatherTier.softLeather]: "Soft leather", [LeatherTier.hardLeather]: "Hard leather", [LeatherTier.studdedLeather]: "Studded leather", [LeatherTier.reinforcedLeather]: "Reinforced leather", [LeatherTier.scaledLeather]: "Scaled leather", [LeatherTier.wyvernHide]: "Wyvern hide", [LeatherTier.dragonhide]: "Dragonhide" }); /** * Gemstone materials — mined for staves and jewellery. * Ranks / equip gates match metal / wood (tourmaline↔pine/bronze … jadeite↔elder/dragon). */ export const GemTier = Object.freeze({ tourmaline: "tourmaline", alexandrite: "alexandrite", opal: "opal", diamond: "diamond", emerald: "emerald", ruby: "ruby", jadeite: "jadeite" }); /** Ordered low → high (gem mining / jewellery). */ export const GEM_TIER_ORDER = Object.freeze([ GemTier.tourmaline, GemTier.alexandrite, GemTier.opal, GemTier.diamond, GemTier.emerald, GemTier.ruby, GemTier.jadeite ]); /** * Gatherable ores / fuels that are not always 1:1 with a gear tier. * Tin + copper smelt into bronze; coal fuels steel. Gold and silver have ore + * bars but no tools (jewelry). Electrum is furnace-only (gold + silver + coal). * Mine/smelt timing uses {@link associatedBarTier}. Gemstones map onto the * matching metal gate. */ export const GatherMaterialId = Object.freeze({ ...MaterialTier, ...GemTier, tin: "tin", copper: "copper", coal: "coal", silver: "silver", gold: "gold", /** Smelted only: 1 gold ore + 1 silver ore + 3 coal → electrum bar. */ electrum: "electrum", /** Rock-salt boulder; mines with a bronze pickaxe or better. */ salt: "salt" }); /** Minimum relevant skill level required to equip tools/gear of this tier. */ export const TIER_MIN_SKILL_LEVEL = Object.freeze({ [MaterialTier.bronze]: 1, [MaterialTier.iron]: 10, [MaterialTier.steel]: 20, [MaterialTier.mithril]: 35, [MaterialTier.adamantium]: 50, [MaterialTier.orichalcum]: 70, [MaterialTier.dragon]: 90, [GatherMaterialId.silver]: 10, [GatherMaterialId.gold]: 20, [GatherMaterialId.electrum]: 90, [GemTier.tourmaline]: 1, [GemTier.alexandrite]: 10, [GemTier.opal]: 20, [GemTier.diamond]: 35, [GemTier.emerald]: 50, [GemTier.ruby]: 70, [GemTier.jadeite]: 90, [WoodTier.pine]: 1, [WoodTier.birch]: 10, [WoodTier.oak]: 20, [WoodTier.ebony]: 35, [WoodTier.lignum]: 50, [WoodTier.heartwood]: 70, [WoodTier.elder]: 90, [ClothTier.cotton]: 1, [ClothTier.wool]: 10, [ClothTier.linen]: 20, [ClothTier.cashmere]: 35, [ClothTier.silk]: 50, [ClothTier.fairySilk]: 70, [ClothTier.dragonweave]: 90, [LeatherTier.softLeather]: 1, [LeatherTier.hardLeather]: 10, [LeatherTier.studdedLeather]: 20, [LeatherTier.reinforcedLeather]: 35, [LeatherTier.scaledLeather]: 50, [LeatherTier.wyvernHide]: 70, [LeatherTier.dragonhide]: 90 }); /** Rank used for mining duration and relative power (1 = bronze/pine … 7 = dragon/elder). */ export const TIER_RANK = Object.freeze({ [MaterialTier.bronze]: 1, [MaterialTier.iron]: 2, [MaterialTier.steel]: 3, [MaterialTier.mithril]: 4, [MaterialTier.adamantium]: 5, [MaterialTier.orichalcum]: 6, [MaterialTier.dragon]: 7, [GatherMaterialId.silver]: 2, [GatherMaterialId.gold]: 3, [GatherMaterialId.electrum]: 7, [GatherMaterialId.salt]: 1, [GemTier.tourmaline]: 1, [GemTier.alexandrite]: 2, [GemTier.opal]: 3, [GemTier.diamond]: 4, [GemTier.emerald]: 5, [GemTier.ruby]: 6, [GemTier.jadeite]: 7, [WoodTier.pine]: 1, [WoodTier.birch]: 2, [WoodTier.oak]: 3, [WoodTier.ebony]: 4, [WoodTier.lignum]: 5, [WoodTier.heartwood]: 6, [WoodTier.elder]: 7, [ClothTier.cotton]: 1, [ClothTier.wool]: 2, [ClothTier.linen]: 3, [ClothTier.cashmere]: 4, [ClothTier.silk]: 5, [ClothTier.fairySilk]: 6, [ClothTier.dragonweave]: 7, [LeatherTier.softLeather]: 1, [LeatherTier.hardLeather]: 2, [LeatherTier.studdedLeather]: 3, [LeatherTier.reinforcedLeather]: 4, [LeatherTier.scaledLeather]: 5, [LeatherTier.wyvernHide]: 6, [LeatherTier.dragonhide]: 7 }); /** Stat bonus granted by tier for the equipment's bonus category. */ export const TIER_STAT_BONUS = Object.freeze({ [MaterialTier.bronze]: 1, [MaterialTier.iron]: 2, [MaterialTier.steel]: 4, [MaterialTier.mithril]: 6, [MaterialTier.adamantium]: 8, [MaterialTier.orichalcum]: 10, [MaterialTier.dragon]: 12, [WoodTier.pine]: 1, [WoodTier.birch]: 2, [WoodTier.oak]: 4, [WoodTier.ebony]: 6, [WoodTier.lignum]: 8, [WoodTier.heartwood]: 10, [WoodTier.elder]: 12, [ClothTier.cotton]: 1, [ClothTier.wool]: 2, [ClothTier.linen]: 4, [ClothTier.cashmere]: 6, [ClothTier.silk]: 8, [ClothTier.fairySilk]: 10, [ClothTier.dragonweave]: 12, [LeatherTier.softLeather]: 1, [LeatherTier.hardLeather]: 2, [LeatherTier.studdedLeather]: 4, [LeatherTier.reinforcedLeather]: 6, [LeatherTier.scaledLeather]: 8, [LeatherTier.wyvernHide]: 10, [LeatherTier.dragonhide]: 12 }); /** Display names for UI / editor. */ export const MATERIAL_DISPLAY_NAME = Object.freeze({ [MaterialTier.bronze]: "Bronze", [MaterialTier.iron]: "Iron", [MaterialTier.steel]: "Steel", [MaterialTier.mithril]: "Mithril", [MaterialTier.adamantium]: "Adamantium", [MaterialTier.orichalcum]: "Orichalcum", [MaterialTier.dragon]: "Dragon", [GatherMaterialId.tin]: "Tin", [GatherMaterialId.copper]: "Copper", [GatherMaterialId.coal]: "Coal", [GatherMaterialId.silver]: "Silver", [GatherMaterialId.gold]: "Gold", [GatherMaterialId.electrum]: "Electrum", [GatherMaterialId.salt]: "Rock salt", [GemTier.tourmaline]: "Tourmaline", [GemTier.alexandrite]: "Alexandrite", [GemTier.opal]: "Opal", [GemTier.diamond]: "Diamond", [GemTier.emerald]: "Emerald", [GemTier.ruby]: "Ruby", [GemTier.jadeite]: "Jadeite", [WoodTier.pine]: "Pine", [WoodTier.birch]: "Birch", [WoodTier.oak]: "Oak", [WoodTier.ebony]: "Ebony", [WoodTier.lignum]: "Lignum", [WoodTier.heartwood]: "Heartwood", [WoodTier.elder]: "Elder" }); export const CLOTH_DISPLAY_NAME = Object.freeze({ [ClothTier.cotton]: "Cotton", [ClothTier.wool]: "Wool", [ClothTier.linen]: "Linen", [ClothTier.cashmere]: "Cashmere", [ClothTier.silk]: "Silk", [ClothTier.fairySilk]: "Fairy silk", [ClothTier.dragonweave]: "Dragonweave" }); /** * Author tint swatches via {@link rgb} (0–255) so editors can offer a colour picker. * Also accepts `0xRRGGBB` / `"#RRGGBB"`; all forms become 0–1 RGB at module load. * Steel is slightly darker than iron; silver is bright gray; gold is yellow; * orichalcum is coppery; dragon is red. */ export function rgb (r, g, b) { return Object.freeze({ r: clampByte(r) / 255, g: clampByte(g) / 255, b: clampByte(b) / 255 }); } function clampByte (n) { return Math.min(255, Math.max(0, Math.round(Number(n) || 0))); } export const MATERIAL_TINT_HEX = Object.freeze({ [MaterialTier.bronze]: rgb(184, 122, 71), [MaterialTier.iron]: rgb(158, 163, 173), [MaterialTier.steel]: rgb(75, 76, 80), [MaterialTier.mithril]: rgb(3, 120, 255), [MaterialTier.adamantium]: rgb(108, 202, 132), [MaterialTier.orichalcum]: rgb(230, 140, 31), [MaterialTier.dragon]: rgb(228, 19, 15), [GatherMaterialId.tin]: rgb(221, 221, 221), [GatherMaterialId.copper]: rgb(255, 94, 0), [GatherMaterialId.coal]: rgb(45, 45, 48), [GatherMaterialId.silver]: rgb(214, 220, 230), [GatherMaterialId.gold]: rgb(255, 200, 0), [GatherMaterialId.electrum]: rgb(232, 198, 128), /** Pale pinkish crystalline rock salt. */ [GatherMaterialId.salt]: rgb(228, 198, 186), [GemTier.tourmaline]: rgb(200, 55, 120), [GemTier.alexandrite]: rgb(120, 70, 180), [GemTier.opal]: rgb(230, 210, 220), [GemTier.diamond]: rgb(200, 235, 255), [GemTier.emerald]: rgb(35, 165, 95), [GemTier.ruby]: rgb(190, 25, 45), [GemTier.jadeite]: rgb(55, 145, 105), [WoodTier.pine]: rgb(199, 158, 97), [WoodTier.birch]: rgb(224, 209, 173), [WoodTier.oak]: rgb(158, 107, 61), [WoodTier.ebony]: rgb(56, 41, 51), [WoodTier.lignum]: rgb(107, 97, 56), [WoodTier.heartwood]: rgb(184, 71, 56), [WoodTier.elder]: rgb(184, 189, 199), [ClothTier.cotton]: rgb(245, 240, 230), [ClothTier.wool]: rgb(220, 210, 195), [ClothTier.linen]: rgb(200, 185, 140), [ClothTier.cashmere]: rgb(210, 175, 150), [ClothTier.silk]: rgb(230, 220, 240), [ClothTier.fairySilk]: rgb(180, 230, 255), [ClothTier.dragonweave]: rgb(200, 60, 50), [LeatherTier.softLeather]: rgb(210, 180, 140), [LeatherTier.hardLeather]: rgb(140, 90, 50), [LeatherTier.studdedLeather]: rgb(110, 70, 40), [LeatherTier.reinforcedLeather]: rgb(120, 100, 85), [LeatherTier.scaledLeather]: rgb(150, 70, 55), [LeatherTier.wyvernHide]: rgb(70, 85, 75), [LeatherTier.dragonhide]: rgb(180, 40, 35) }); /** * Optional ore-only tint overrides (boulders + ore items). * Missing entries fall back to {@link MATERIAL_TINT_HEX}. */ export const MATERIAL_ORE_TINT_HEX = Object.freeze({ [MaterialTier.iron]: rgb(210, 118, 48), [GatherMaterialId.copper]: rgb(81, 153, 105), [GatherMaterialId.salt]: rgb(236, 205, 192) }); /** * Normalize tint authoring forms to frozen 0–1 `{ r, g, b }`: * - number `0xRRGGBB` * - string `"#RGB"` / `"#RRGGBB"` / `"rgb(r,g,b)"` * - object from {@link rgb} */ export function hexToRgb01 (hex) { if (hex && typeof hex === "object" && "r" in hex && "g" in hex && "b" in hex) { return Object.freeze({ r: clamp01Channel(hex.r), g: clamp01Channel(hex.g), b: clamp01Channel(hex.b) }); } if (typeof hex === "number" && Number.isFinite(hex)) { const value = hex >>> 0; return Object.freeze({ r: ((value >> 16) & 255) / 255, g: ((value >> 8) & 255) / 255, b: (value & 255) / 255 }); } const text = String(hex ?? "").trim(); const rgbMatch = /^rgba?\(\s*([0-9.]+)\s*,\s*([0-9.]+)\s*,\s*([0-9.]+)/i.exec(text); if (rgbMatch) { return rgb(rgbMatch[1], rgbMatch[2], rgbMatch[3]); } const raw = text.replace(/^#/, ""); const full = raw.length === 3 ? raw.split("").map((ch) => ch + ch).join("") : raw; if (!/^[0-9a-fA-F]{6}$/.test(full)) { return Object.freeze({ r: 0.7, g: 0.7, b: 0.7 }); } const value = Number.parseInt(full, 16); return Object.freeze({ r: ((value >> 16) & 255) / 255, g: ((value >> 8) & 255) / 255, b: (value & 255) / 255 }); } function clamp01Channel (n) { const value = Number(n); if (!Number.isFinite(value)) { return 0; } if (value > 1) { return clampByte(value) / 255; } return Math.min(1, Math.max(0, value)); } /** 0–1 RGB map derived from {@link MATERIAL_TINT_HEX}. */ export const MATERIAL_TINT_COLOR = Object.freeze( Object.fromEntries( Object.entries(MATERIAL_TINT_HEX).map(([id, hex]) => [id, hexToRgb01(hex)]) ) ); /** 0–1 RGB map derived from {@link MATERIAL_ORE_TINT_HEX}. */ export const MATERIAL_ORE_TINT_COLOR = Object.freeze( Object.fromEntries( Object.entries(MATERIAL_ORE_TINT_HEX).map(([id, hex]) => [id, hexToRgb01(hex)]) ) ); /** Wood tier that matches a metal tier's rank (for tool hafts). */ export const WOOD_TIER_FOR_METAL = Object.freeze({ [MaterialTier.bronze]: WoodTier.pine, [MaterialTier.iron]: WoodTier.birch, [MaterialTier.steel]: WoodTier.oak, [MaterialTier.mithril]: WoodTier.ebony, [MaterialTier.adamantium]: WoodTier.lignum, [MaterialTier.orichalcum]: WoodTier.heartwood, [MaterialTier.dragon]: WoodTier.elder }); export const METAL_TIER_FOR_WOOD = Object.freeze(Object.fromEntries( Object.entries(WOOD_TIER_FOR_METAL).map(([metal, wood]) => [wood, metal]) )); /** * Bar tier that drives mine/smelt duration and gates for a gatherable. * Tin/copper → bronze; coal → steel; gold/silver and gear metals map to themselves. */ export function associatedBarTier (materialId) { if (materialId === GatherMaterialId.tin || materialId === GatherMaterialId.copper) { return MaterialTier.bronze; } if (materialId === GatherMaterialId.coal) { return MaterialTier.steel; } if (materialId === GatherMaterialId.salt) { return MaterialTier.bronze; } const gemIdx = GEM_TIER_ORDER.indexOf(materialId); if (gemIdx >= 0) { return MATERIAL_TIER_ORDER[gemIdx] ?? MaterialTier.bronze; } return materialId; } export function materialDisplayName (materialId) { return MATERIAL_DISPLAY_NAME[materialId] ?? materialId; } /** * Tint for a material. When `ore` is true, prefer {@link MATERIAL_ORE_TINT_COLOR} * if defined for that material; otherwise the normal material tint. */ export function materialTintColor (materialId, { ore = false } = {}) { if (ore) { const oreTint = MATERIAL_ORE_TINT_COLOR[materialId]; if (oreTint) { return oreTint; } } return MATERIAL_TINT_COLOR[materialId] ?? MATERIAL_TINT_COLOR[MaterialTier.bronze]; } export function tierStatBonus (tier) { return TIER_STAT_BONUS[tier] ?? TIER_STAT_BONUS[MaterialTier.bronze]; } /** Alias for equipment combat boosts derived from material tier. */ export const statBoostPerTier = tierStatBonus; export function tierMinSkillLevel (tier) { return TIER_MIN_SKILL_LEVEL[tier] ?? TIER_MIN_SKILL_LEVEL[MaterialTier.bronze]; } export function tierRank (tier) { return TIER_RANK[associatedBarTier(tier)] ?? TIER_RANK[tier] ?? 1; } /** Mining / woodcutting skill required (half of equip gate, ceil). */ export function tierMineSkillLevel (tier) { return Math.max(1, Math.ceil(tierMinSkillLevel(associatedBarTier(tier)) / 2)); } /** Smithing / woodcraft skill required to process this material (75% of equip gate, ceil). */ export function tierSmeltSkillLevel (tier) { return Math.max(1, Math.ceil(tierMinSkillLevel(associatedBarTier(tier)) * 0.75)); } /** Alias for woodworking / general craft gates (same curve as smelting). */ export function tierCraftSkillLevel (tier) { return tierSmeltSkillLevel(tier); } export function woodTierForMetal (metalTier) { return WOOD_TIER_FOR_METAL[metalTier] ?? WoodTier.pine; } /** Matching leather material for a metal tier (bronze↔soft … dragon↔dragonhide). */ export function leatherTierForMetal (metalTier) { const idx = MATERIAL_TIER_ORDER.indexOf(metalTier); return LEATHER_TIER_ORDER[idx >= 0 ? idx : 0] ?? LeatherTier.softLeather; } export function metalTierForLeather (leatherTier) { const idx = LEATHER_TIER_ORDER.indexOf(leatherTier); return MATERIAL_TIER_ORDER[idx >= 0 ? idx : 0] ?? MaterialTier.bronze; } /** Matching wood tier for a gemstone (tourmaline↔pine … jadeite↔elder). */ export function woodTierForGem (gemTier) { const idx = GEM_TIER_ORDER.indexOf(gemTier); return WOOD_TIER_ORDER[idx >= 0 ? idx : 0] ?? WoodTier.pine; } /** Matching gemstone for a wood tier. */ export function gemTierForWood (woodTier) { const idx = WOOD_TIER_ORDER.indexOf(woodTier); return GEM_TIER_ORDER[idx >= 0 ? idx : 0] ?? GemTier.tourmaline; } export function isGemstoneMaterial (materialId) { return GEM_TIER_ORDER.includes(materialId); } /** Matching cloth tier for a wood tier (pine↔cotton, birch↔wool, …). */ export function clothTierForWood (woodTier) { const idx = WOOD_TIER_ORDER.indexOf(woodTier); return CLOTH_TIER_ORDER[idx >= 0 ? idx : 0] ?? ClothTier.cotton; } /** Matching cloth fibre for a gemstone (tourmaline↔cotton … jadeite↔dragonweave). */ export function clothTierForGem (gemTier) { const idx = GEM_TIER_ORDER.indexOf(gemTier); return CLOTH_TIER_ORDER[idx >= 0 ? idx : 0] ?? ClothTier.cotton; } export function metalTierForWood (woodTier) { return METAL_TIER_FOR_WOOD[woodTier] ?? MaterialTier.bronze; } /** Matching metal tier for a cloth fibre (cotton↔bronze … dragonweave↔dragon). */ export function metalTierForCloth (clothTier) { const idx = CLOTH_TIER_ORDER.indexOf(clothTier); return MATERIAL_TIER_ORDER[idx >= 0 ? idx : 0] ?? MaterialTier.bronze; } /** Matching metal tier for a folklore herb tier (1→bronze … 7→dragon). */ export function metalTierForHerbTier (herbTier) { const idx = Math.max(1, herbTier | 0) - 1; return MATERIAL_TIER_ORDER[idx] ?? MaterialTier.bronze; } /** Matching leather tier for a cloth tier (cotton↔soft … dragonweave↔dragonhide). */ export function leatherTierForCloth (clothTier) { const idx = CLOTH_TIER_ORDER.indexOf(clothTier); return LEATHER_TIER_ORDER[idx >= 0 ? idx : 0] ?? LeatherTier.softLeather; } /** Matching cloth tier for a leather tier. */ export function clothTierForLeather (leatherTier) { const idx = LEATHER_TIER_ORDER.indexOf(leatherTier); return CLOTH_TIER_ORDER[idx >= 0 ? idx : 0] ?? ClothTier.cotton; } /** Fleece / plant fibre node exhaust duration (same curve as ore/trees). */ export function clothExhaustDurationMs (clothTier) { return oreExhaustDurationMs(clothTier); } /** * Mining action duration in ms. * (resourceRank * 8s) − (toolRank * 3s), floored at 0.5s. * Tin/copper/coal use their associated bar's rank. */ export function miningDurationMs (resourceMaterialId, toolTier) { const resourceRank = tierRank(resourceMaterialId); const toolRank = tierRank(toolTier); const seconds = Math.max(0.5, resourceRank * 8 - toolRank * 3); return Math.round(seconds * 1000); } /** After a successful mine, nodes stay exhausted for 10s × associated bar rank. */ export function oreExhaustDurationMs (materialId) { return Math.max(1, tierRank(materialId)) * 10_000; } /** Base craft duration per bar rank (bronze = 2s, iron = 4s, …). */ export const SMELT_DURATION_PER_RANK_MS = 2000; /** * Furnace smelt duration from the output bar's associated tier rank. * Tin/copper/coal map to bronze/steel so ingredient timing matches that bar. */ export function smeltingDurationMs (barOrMaterialId) { return Math.max(1, tierRank(barOrMaterialId)) * SMELT_DURATION_PER_RANK_MS; } /** Visual / interact state while an ore boulder is depleted (plain rock). */ export const EXHAUSTED_ORE_BOULDER_STATE = "boulder"; /** * Materials that have an ore boulder node. * Bronze has no ore (tin + copper); steel has no ore (iron + coal). * Gold and silver are precious only (ore + bars, no tools). */ export const ORE_BEARING_MATERIALS = Object.freeze([ GatherMaterialId.tin, GatherMaterialId.copper, MaterialTier.iron, GatherMaterialId.silver, GatherMaterialId.gold, MaterialTier.mithril, MaterialTier.adamantium, MaterialTier.orichalcum, MaterialTier.dragon, GatherMaterialId.coal, GatherMaterialId.salt, ...GEM_TIER_ORDER ]); /** Boulder visual state for a gatherable ore (editor / world). */ export function oreBoulderState (materialId) { if (materialId === GatherMaterialId.coal) { return "coal"; } if (materialId === GatherMaterialId.salt) { return "salt-ore"; } return `${materialId}-ore`; } export function materialFromOreBoulderState (state) { if (!state || state === "boulder") { return null; } if (state === "coal") { return GatherMaterialId.coal; } if (state === "salt-ore") { return GatherMaterialId.salt; } if (state.endsWith("-ore")) { const id = state.slice(0, -"-ore".length); if (ORE_BEARING_MATERIALS.includes(id)) { return id; } } return null; } export function isOreBoulderState (state) { return materialFromOreBoulderState(state) != null; }