BlueGit

timfa questward

Allow tailor dyes on wizard robes, tinting cloth channel only.

Wizard pieces are dyeable at the bench; dual-tint art keeps leather on red
and applies instance dye colour to the blue cloth channel on equip and icons.

timfa Tim Falken · pushed by timfa

Authored 2026-09-01 · 2 months ago

Hash
d28ade46aa86410d41c94f1dec493c4896a1a377
Parent
ee9ea685
8 files changed +84 −14
client/src/play/characterPreview.js +20 −4
@@ -27,7 +27,7 @@ export async function paintCharacterPreview (canvas, {
27 27 if (!url)
28 28 { continue; }
29 29 const img = await loadHtmlImage(url);
30 images.push({ img, tint: layer.tint ?? null });
30 images.push({ img, tint: layer.tint ?? null, dualTint: layer.dualTint ?? null });
31 31 }
32 32 if (!images.length)
33 33 { return; }
@@ -50,7 +50,9 @@ export async function paintCharacterPreview (canvas, {
50 50 const pivotY = maxH - PIVOT_FROM_BOTTOM_PX;
51 51 for (const entry of images)
52 52 {
53 const source = entry.tint ? tintedCanvas(entry.img, entry.tint) : entry.img;
53 const source = entry.dualTint
54 ? dualTintedCanvas(entry.img, entry.dualTint)
55 : (entry.tint ? tintedCanvas(entry.img, entry.tint) : entry.img);
54 56 const sw = source.naturalWidth || source.width || 1;
55 57 const sh = source.naturalHeight || source.height || 1;
56 58 const ox = (pivotX - sw * 0.5) * scale;
@@ -83,7 +85,7 @@ export function paintAppearanceSnapshot (canvas, layers, {
83 85 const entry = resolveImage?.(name);
84 86 if (!entry)
85 87 { continue; }
86 draws.push({ entry, tint: layer.tint ?? null, frame });
88 draws.push({ entry, tint: layer.tint ?? null, dualTint: layer.dualTint ?? null, frame });
87 89 }
88 90 return paintDrawListSnapshot(canvas, draws, { size });
89 91 }
@@ -143,7 +145,7 @@ export async function paintLayersFromUrls (canvas, layers, {
143 145 try
144 146 {
145 147 const img = await loadHtmlImage(url);
146 draws.push({ entry: img, tint: layer.tint ?? null, frame: 0 });
148 draws.push({ entry: img, tint: layer.tint ?? null, dualTint: layer.dualTint ?? null, frame: 0 });
147 149 }
148 150 catch
149 151 { /* skip missing art */ }
@@ -239,6 +241,20 @@ function loadHtmlImage (url)
239 241 });
240 242 }
241 243
244 function dualTintedCanvas (sourceImg, dualTint)
245 {
246 const canvas = document.createElement("canvas");
247 canvas.width = sourceImg.naturalWidth || sourceImg.width;
248 canvas.height = sourceImg.naturalHeight || sourceImg.height;
249 const ctx = canvas.getContext("2d");
250 ctx.imageSmoothingEnabled = false;
251 ctx.drawImage(sourceImg, 0, 0);
252 const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
253 applyDualChannelTintToImageData(imageData, dualTint);
254 ctx.putImageData(imageData, 0, 0);
255 return canvas;
256 }
257
242 258 function tintedCanvas (sourceImg, tintRgb)
243 259 {
244 260 const canvas = document.createElement("canvas");
@@ -27,7 +27,7 @@ export async function paintCharacterPreview (canvas, {
27 if (!url)
27 if (!url)
28 { continue; }
28 { continue; }
29 const img = await loadHtmlImage(url);
29 const img = await loadHtmlImage(url);
30 images.push({ img, tint: layer.tint ?? null });
30 images.push({ img, tint: layer.tint ?? null, dualTint: layer.dualTint ?? null });
31 }
31 }
32 if (!images.length)
32 if (!images.length)
33 { return; }
33 { return; }
@@ -50,7 +50,9 @@ export async function paintCharacterPreview (canvas, {
50 const pivotY = maxH - PIVOT_FROM_BOTTOM_PX;
50 const pivotY = maxH - PIVOT_FROM_BOTTOM_PX;
51 for (const entry of images)
51 for (const entry of images)
52 {
52 {
53 const source = entry.tint ? tintedCanvas(entry.img, entry.tint) : entry.img;
53 const source = entry.dualTint
54 ? dualTintedCanvas(entry.img, entry.dualTint)
55 : (entry.tint ? tintedCanvas(entry.img, entry.tint) : entry.img);
54 const sw = source.naturalWidth || source.width || 1;
56 const sw = source.naturalWidth || source.width || 1;
55 const sh = source.naturalHeight || source.height || 1;
57 const sh = source.naturalHeight || source.height || 1;
56 const ox = (pivotX - sw * 0.5) * scale;
58 const ox = (pivotX - sw * 0.5) * scale;
@@ -83,7 +85,7 @@ export function paintAppearanceSnapshot (canvas, layers, {
83 const entry = resolveImage?.(name);
85 const entry = resolveImage?.(name);
84 if (!entry)
86 if (!entry)
85 { continue; }
87 { continue; }
86 draws.push({ entry, tint: layer.tint ?? null, frame });
88 draws.push({ entry, tint: layer.tint ?? null, dualTint: layer.dualTint ?? null, frame });
87 }
89 }
88 return paintDrawListSnapshot(canvas, draws, { size });
90 return paintDrawListSnapshot(canvas, draws, { size });
89}
91}
@@ -143,7 +145,7 @@ export async function paintLayersFromUrls (canvas, layers, {
143 try
145 try
144 {
146 {
145 const img = await loadHtmlImage(url);
147 const img = await loadHtmlImage(url);
146 draws.push({ entry: img, tint: layer.tint ?? null, frame: 0 });
148 draws.push({ entry: img, tint: layer.tint ?? null, dualTint: layer.dualTint ?? null, frame: 0 });
147 }
149 }
148 catch
150 catch
149 { /* skip missing art */ }
151 { /* skip missing art */ }
@@ -239,6 +241,20 @@ function loadHtmlImage (url)
239 });
241 });
240}
242}
241
243
244function dualTintedCanvas (sourceImg, dualTint)
245{
246 const canvas = document.createElement("canvas");
247 canvas.width = sourceImg.naturalWidth || sourceImg.width;
248 canvas.height = sourceImg.naturalHeight || sourceImg.height;
249 const ctx = canvas.getContext("2d");
250 ctx.imageSmoothingEnabled = false;
251 ctx.drawImage(sourceImg, 0, 0);
252 const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
253 applyDualChannelTintToImageData(imageData, dualTint);
254 ctx.putImageData(imageData, 0, 0);
255 return canvas;
256}
257
242function tintedCanvas (sourceImg, tintRgb)
258function tintedCanvas (sourceImg, tintRgb)
243{
259{
244 const canvas = document.createElement("canvas");
260 const canvas = document.createElement("canvas");
client/src/render/worldView.js +11 −3
@@ -2473,9 +2473,17 @@ export class WorldView
2473 2473 entity.overlays.push(object);
2474 2474 const layerDef = layer.itemId != null ? itemDefinition(layer.itemId) : null;
2475 2475 entity.overlayTightFit.push(!!layerDef?.tightFit);
2476 const dualTint = layer.itemId != null
2477 ? resolveEquipDualTint({ itemId: layer.itemId }, layerDef)
2478 : null;
2476 const dualTint = layer.dualTint
2477 ? {
2478 shaft: normalizeRgb(layer.dualTint.shaft),
2479 tip: normalizeRgb(layer.dualTint.tip),
2480 ...(layer.dualTint.coat
2481 ? { coat: normalizeRgb(layer.dualTint.coat) }
2482 : {})
2483 }
2484 : (layer.itemId != null
2485 ? resolveEquipDualTint({ itemId: layer.itemId }, layerDef)
2486 : null);
2479 2487 entity.overlayDualTints.push(dualTint);
2480 2488 entity.overlayTints.push(
2481 2489 dualTint
@@ -2473,9 +2473,17 @@ export class WorldView
2473 entity.overlays.push(object);
2473 entity.overlays.push(object);
2474 const layerDef = layer.itemId != null ? itemDefinition(layer.itemId) : null;
2474 const layerDef = layer.itemId != null ? itemDefinition(layer.itemId) : null;
2475 entity.overlayTightFit.push(!!layerDef?.tightFit);
2475 entity.overlayTightFit.push(!!layerDef?.tightFit);
2476 const dualTint = layer.itemId != null
2476 const dualTint = layer.dualTint
2477 ? resolveEquipDualTint({ itemId: layer.itemId }, layerDef)
2477 ? {
2478 : null;
2478 shaft: normalizeRgb(layer.dualTint.shaft),
2479 tip: normalizeRgb(layer.dualTint.tip),
2480 ...(layer.dualTint.coat
2481 ? { coat: normalizeRgb(layer.dualTint.coat) }
2482 : {})
2483 }
2484 : (layer.itemId != null
2485 ? resolveEquipDualTint({ itemId: layer.itemId }, layerDef)
2486 : null);
2479 entity.overlayDualTints.push(dualTint);
2487 entity.overlayDualTints.push(dualTint);
2480 entity.overlayTints.push(
2488 entity.overlayTints.push(
2481 dualTint
2489 dualTint
server/tests/crafting.test.js +12 −0
@@ -542,4 +542,16 @@ test("tailor wizard robe recipes resolve cloth and leather inputs", () =>
542 542 assert.equal(bottoms.ok, true);
543 543 assert.equal(bottoms.recipe.output.itemId, WizardItemId.cottonRobeBottoms);
544 544 assert.deepEqual(bottoms.recipe.inputs, [{ itemId: ClothItemId.cottonCloth, quantity: 4 }]);
545 const dyed = resolveTailorCraft({
546 templateId: "wizard-hat",
547 clothTier: "cotton",
548 dyeStack: {
549 itemId: ItemId.dye,
550 instance: { kind: "dye", color: { r: 0.2, g: 0.5, b: 0.9 }, fillLevel: 5 }
551 }
552 });
553 assert.equal(dyed.ok, true);
554 assert.equal(dyed.recipe.consumeDye, true);
555 assert.deepEqual(dyed.recipe.dyeColor, { r: 0.2, g: 0.5, b: 0.9 });
556 assert.equal(dyed.recipe.output.itemId, WizardItemId.cottonHat);
545 557 });
@@ -542,4 +542,16 @@ test("tailor wizard robe recipes resolve cloth and leather inputs", () =>
542 assert.equal(bottoms.ok, true);
542 assert.equal(bottoms.ok, true);
543 assert.equal(bottoms.recipe.output.itemId, WizardItemId.cottonRobeBottoms);
543 assert.equal(bottoms.recipe.output.itemId, WizardItemId.cottonRobeBottoms);
544 assert.deepEqual(bottoms.recipe.inputs, [{ itemId: ClothItemId.cottonCloth, quantity: 4 }]);
544 assert.deepEqual(bottoms.recipe.inputs, [{ itemId: ClothItemId.cottonCloth, quantity: 4 }]);
545 const dyed = resolveTailorCraft({
546 templateId: "wizard-hat",
547 clothTier: "cotton",
548 dyeStack: {
549 itemId: ItemId.dye,
550 instance: { kind: "dye", color: { r: 0.2, g: 0.5, b: 0.9 }, fillLevel: 5 }
551 }
552 });
553 assert.equal(dyed.ok, true);
554 assert.equal(dyed.recipe.consumeDye, true);
555 assert.deepEqual(dyed.recipe.dyeColor, { r: 0.2, g: 0.5, b: 0.9 });
556 assert.equal(dyed.recipe.output.itemId, WizardItemId.cottonHat);
545});
557});
server/tests/tint.test.js +24 −0
@@ -15,6 +15,9 @@ import { MaterialTier, GatherMaterialId, hexToRgb01, MATERIAL_TINT_HEX, rgb } fr
15 15 import { ItemId } from "../../shared/definitions/items.js";
16 16 import { RangedItemId } from "../../shared/definitions/rangedItems.js";
17 17 import { GemItemId } from "../../shared/definitions/gemItems.js";
18 import { WizardItemId } from "../../shared/definitions/wizardItems.js";
19 import { LeatherTier } from "../../shared/definitions/materialTiers.js";
20 import { normalizeRgb } from "../../shared/render/tint.js";
18 21
19 22 test("magenta tintable when R==B and G < R", () =>
20 23 {
@@ -154,3 +157,24 @@ test("material tint hex converts to 0-1 rgb at load", () =>
154 157 assert.deepEqual(MATERIAL_TINT_HEX[MaterialTier.mithril], rgb(3, 120, 255));
155 158 assert.deepEqual(hexToRgb01("rgb(3, 120, 255)"), rgb(3, 120, 255));
156 159 });
160
161 test("wizard robe dye tints cloth channel only on dual-tint pieces", () =>
162 {
163 const dye = { r: 0.85, g: 0.15, b: 0.35 };
164 const stack = {
165 itemId: WizardItemId.cottonHat,
166 instance: { kind: "clothing", dyeColor: dye }
167 };
168 const dual = resolveItemDualTint(stack);
169 assert.deepEqual(dual.shaft, tierTintColor(LeatherTier.softLeather));
170 assert.deepEqual(dual.tip, normalizeRgb(dye));
171 assert.equal(resolveEquipTint(WizardItemId.cottonHat, stack.instance), null);
172 assert.equal(resolveItemTint(stack), null);
173
174 const bottoms = {
175 itemId: WizardItemId.cottonRobeBottoms,
176 instance: { kind: "clothing", dyeColor: dye }
177 };
178 assert.deepEqual(resolveEquipTint(WizardItemId.cottonRobeBottoms, bottoms.instance), normalizeRgb(dye));
179 assert.equal(resolveEquipDualTint(bottoms), null);
180 });
@@ -15,6 +15,9 @@ import { MaterialTier, GatherMaterialId, hexToRgb01, MATERIAL_TINT_HEX, rgb } fr
15import { ItemId } from "../../shared/definitions/items.js";
15import { ItemId } from "../../shared/definitions/items.js";
16import { RangedItemId } from "../../shared/definitions/rangedItems.js";
16import { RangedItemId } from "../../shared/definitions/rangedItems.js";
17import { GemItemId } from "../../shared/definitions/gemItems.js";
17import { GemItemId } from "../../shared/definitions/gemItems.js";
18import { WizardItemId } from "../../shared/definitions/wizardItems.js";
19import { LeatherTier } from "../../shared/definitions/materialTiers.js";
20import { normalizeRgb } from "../../shared/render/tint.js";
18
21
19test("magenta tintable when R==B and G < R", () =>
22test("magenta tintable when R==B and G < R", () =>
20{
23{
@@ -154,3 +157,24 @@ test("material tint hex converts to 0-1 rgb at load", () =>
154 assert.deepEqual(MATERIAL_TINT_HEX[MaterialTier.mithril], rgb(3, 120, 255));
157 assert.deepEqual(MATERIAL_TINT_HEX[MaterialTier.mithril], rgb(3, 120, 255));
155 assert.deepEqual(hexToRgb01("rgb(3, 120, 255)"), rgb(3, 120, 255));
158 assert.deepEqual(hexToRgb01("rgb(3, 120, 255)"), rgb(3, 120, 255));
156});
159});
160
161test("wizard robe dye tints cloth channel only on dual-tint pieces", () =>
162{
163 const dye = { r: 0.85, g: 0.15, b: 0.35 };
164 const stack = {
165 itemId: WizardItemId.cottonHat,
166 instance: { kind: "clothing", dyeColor: dye }
167 };
168 const dual = resolveItemDualTint(stack);
169 assert.deepEqual(dual.shaft, tierTintColor(LeatherTier.softLeather));
170 assert.deepEqual(dual.tip, normalizeRgb(dye));
171 assert.equal(resolveEquipTint(WizardItemId.cottonHat, stack.instance), null);
172 assert.equal(resolveItemTint(stack), null);
173
174 const bottoms = {
175 itemId: WizardItemId.cottonRobeBottoms,
176 instance: { kind: "clothing", dyeColor: dye }
177 };
178 assert.deepEqual(resolveEquipTint(WizardItemId.cottonRobeBottoms, bottoms.instance), normalizeRgb(dye));
179 assert.equal(resolveEquipDualTint(bottoms), null);
180});
shared/appearance/hair.js +5 −2
@@ -5,7 +5,7 @@ import {
5 5 itemDefinition,
6 6 itemEquipSprite
7 7 } from "../definitions/items.js";
8 import { normalizeRgb, resolveEquipTint } from "../render/tint.js";
8 import { normalizeRgb, resolveEquipTint, resolveEquipDualTint } from "../render/tint.js";
9 9
10 10 /** Hair style ids per sex (PNG stems under `characters/player-body-*`). */
11 11 export const HAIR_STYLES_BY_SEX = Object.freeze({
@@ -258,10 +258,13 @@ export function composeAppearanceLayers (appearance, equipmentSlots)
258 258 const overlay = itemEquipSprite(worn.itemId);
259 259 if (!overlay)
260 260 { continue; }
261 const tint = resolveEquipTint(worn.itemId, worn.instance);
261 const def = itemDefinition(worn.itemId);
262 const dualTint = resolveEquipDualTint(worn, def);
263 const tint = dualTint ? null : resolveEquipTint(worn.itemId, worn.instance);
262 264 layers.push({
263 265 sprite: overlay,
264 266 itemId: worn.itemId,
267 ...(dualTint ? { dualTint } : {}),
265 268 ...(tint ? { tint } : {})
266 269 });
267 270 }
@@ -5,7 +5,7 @@ import {
5 itemDefinition,
5 itemDefinition,
6 itemEquipSprite
6 itemEquipSprite
7} from "../definitions/items.js";
7} from "../definitions/items.js";
8import { normalizeRgb, resolveEquipTint } from "../render/tint.js";
8import { normalizeRgb, resolveEquipTint, resolveEquipDualTint } from "../render/tint.js";
9
9
10/** Hair style ids per sex (PNG stems under `characters/player-body-*`). */
10/** Hair style ids per sex (PNG stems under `characters/player-body-*`). */
11export const HAIR_STYLES_BY_SEX = Object.freeze({
11export const HAIR_STYLES_BY_SEX = Object.freeze({
@@ -258,10 +258,13 @@ export function composeAppearanceLayers (appearance, equipmentSlots)
258 const overlay = itemEquipSprite(worn.itemId);
258 const overlay = itemEquipSprite(worn.itemId);
259 if (!overlay)
259 if (!overlay)
260 { continue; }
260 { continue; }
261 const tint = resolveEquipTint(worn.itemId, worn.instance);
261 const def = itemDefinition(worn.itemId);
262 const dualTint = resolveEquipDualTint(worn, def);
263 const tint = dualTint ? null : resolveEquipTint(worn.itemId, worn.instance);
262 layers.push({
264 layers.push({
263 sprite: overlay,
265 sprite: overlay,
264 itemId: worn.itemId,
266 itemId: worn.itemId,
267 ...(dualTint ? { dualTint } : {}),
265 ...(tint ? { tint } : {})
268 ...(tint ? { tint } : {})
266 });
269 });
267 }
270 }
shared/crafting/tailor.js +1 −2
@@ -13,7 +13,6 @@ export function resolveTailorCraft ({ templateId, clothTier, dyeStack = null })
13 13 const template = clothingTemplate(templateId) ?? wizardTemplate(templateId);
14 14 if (!template)
15 15 { return { ok: false, reason: "Unknown garment template." }; }
16 const isWizardGarment = wizardTemplate(templateId) != null;
17 16 const tier = CLOTH_TIER_ORDER.includes(clothTier) ? clothTier : ClothTier.cotton;
18 17 const outputItemId = template.outputItemIdForTier(tier);
19 18 if (!outputItemId)
@@ -39,7 +38,7 @@ export function resolveTailorCraft ({ templateId, clothTier, dyeStack = null })
39 38 }
40 39
41 40 let dyeColor = null;
42 if (dyeStack && !isWizardGarment)
41 if (dyeStack)
43 42 {
44 43 if (dyeStack.itemId !== ItemId.dye || dyeStack.instance?.kind !== "dye")
45 44 { return { ok: false, reason: "That is not a dye." }; }
@@ -13,7 +13,6 @@ export function resolveTailorCraft ({ templateId, clothTier, dyeStack = null })
13 const template = clothingTemplate(templateId) ?? wizardTemplate(templateId);
13 const template = clothingTemplate(templateId) ?? wizardTemplate(templateId);
14 if (!template)
14 if (!template)
15 { return { ok: false, reason: "Unknown garment template." }; }
15 { return { ok: false, reason: "Unknown garment template." }; }
16 const isWizardGarment = wizardTemplate(templateId) != null;
17 const tier = CLOTH_TIER_ORDER.includes(clothTier) ? clothTier : ClothTier.cotton;
16 const tier = CLOTH_TIER_ORDER.includes(clothTier) ? clothTier : ClothTier.cotton;
18 const outputItemId = template.outputItemIdForTier(tier);
17 const outputItemId = template.outputItemIdForTier(tier);
19 if (!outputItemId)
18 if (!outputItemId)
@@ -39,7 +38,7 @@ export function resolveTailorCraft ({ templateId, clothTier, dyeStack = null })
39 }
38 }
40
39
41 let dyeColor = null;
40 let dyeColor = null;
42 if (dyeStack && !isWizardGarment)
41 if (dyeStack)
43 {
42 {
44 if (dyeStack.itemId !== ItemId.dye || dyeStack.instance?.kind !== "dye")
43 if (dyeStack.itemId !== ItemId.dye || dyeStack.instance?.kind !== "dye")
45 { return { ok: false, reason: "That is not a dye." }; }
44 { return { ok: false, reason: "That is not a dye." }; }
shared/definitions/wizardItems.js +1 −0
@@ -104,6 +104,7 @@ function wizardPieceDef (itemId, clothTier, piece)
104 104 iconKey: "magicrobes",
105 105 defaultState: piece.suffix,
106 106 tier: clothTier,
107 dyeable: true,
107 108 equipment: Object.freeze({
108 109 slot: piece.slot,
109 110 tier: clothTier,
@@ -104,6 +104,7 @@ function wizardPieceDef (itemId, clothTier, piece)
104 iconKey: "magicrobes",
104 iconKey: "magicrobes",
105 defaultState: piece.suffix,
105 defaultState: piece.suffix,
106 tier: clothTier,
106 tier: clothTier,
107 dyeable: true,
107 equipment: Object.freeze({
108 equipment: Object.freeze({
108 slot: piece.slot,
109 slot: piece.slot,
109 tier: clothTier,
110 tier: clothTier,
shared/render/tint.js +10 −3
@@ -153,7 +153,7 @@ export function resolveItemDualTint (stackOrDef, def = null)
153 153 { return null; }
154 154 return {
155 155 shaft: tierTintColor(leatherTier),
156 tip: tierTintColor(clothTier)
156 tip: clothChannelTint(definition, stack, clothTier)
157 157 };
158 158 }
159 159
@@ -273,7 +273,7 @@ export function resolveItemTint (stackOrDef, def = null)
273 273 { return normalizeRgb(stack.instance.color); }
274 274 if (stack?.instance?.kind === "flower" && stack.instance.color)
275 275 { return normalizeRgb(stack.instance.color); }
276 if (stack?.instance?.dyeColor)
276 if (stack?.instance?.dyeColor && !definition?.dualTintLeatherCloth)
277 277 { return normalizeRgb(stack.instance.dyeColor); }
278 278 if (definition?.tint)
279 279 { return normalizeRgb(definition.tint); }
@@ -294,7 +294,7 @@ export function resolveEquipTint (itemIdOrDef, instance = null)
294 294 : itemIdOrDef;
295 295 if (!definition)
296 296 { return null; }
297 if (instance?.dyeColor)
297 if (instance?.dyeColor && !definition?.dualTintLeatherCloth)
298 298 { return normalizeRgb(instance.dyeColor); }
299 299 if (definition?.tint)
300 300 { return normalizeRgb(definition.tint); }
@@ -327,6 +327,13 @@ function equipUsesMagentaOnly (definition)
327 327 return !!definition?.equipment?.tintFromTier && !definition?.equipment?.dualTintFromTier;
328 328 }
329 329
330 function clothChannelTint (definition, stack, clothTier)
331 {
332 if (stack?.instance?.dyeColor)
333 { return normalizeRgb(stack.instance.dyeColor); }
334 return tierTintColor(clothTier);
335 }
336
330 337 function isOreItemDefinition (definition)
331 338 {
332 339 return definition?.defaultState === "ore";
@@ -153,7 +153,7 @@ export function resolveItemDualTint (stackOrDef, def = null)
153 { return null; }
153 { return null; }
154 return {
154 return {
155 shaft: tierTintColor(leatherTier),
155 shaft: tierTintColor(leatherTier),
156 tip: tierTintColor(clothTier)
156 tip: clothChannelTint(definition, stack, clothTier)
157 };
157 };
158 }
158 }
159
159
@@ -273,7 +273,7 @@ export function resolveItemTint (stackOrDef, def = null)
273 { return normalizeRgb(stack.instance.color); }
273 { return normalizeRgb(stack.instance.color); }
274 if (stack?.instance?.kind === "flower" && stack.instance.color)
274 if (stack?.instance?.kind === "flower" && stack.instance.color)
275 { return normalizeRgb(stack.instance.color); }
275 { return normalizeRgb(stack.instance.color); }
276 if (stack?.instance?.dyeColor)
276 if (stack?.instance?.dyeColor && !definition?.dualTintLeatherCloth)
277 { return normalizeRgb(stack.instance.dyeColor); }
277 { return normalizeRgb(stack.instance.dyeColor); }
278 if (definition?.tint)
278 if (definition?.tint)
279 { return normalizeRgb(definition.tint); }
279 { return normalizeRgb(definition.tint); }
@@ -294,7 +294,7 @@ export function resolveEquipTint (itemIdOrDef, instance = null)
294 : itemIdOrDef;
294 : itemIdOrDef;
295 if (!definition)
295 if (!definition)
296 { return null; }
296 { return null; }
297 if (instance?.dyeColor)
297 if (instance?.dyeColor && !definition?.dualTintLeatherCloth)
298 { return normalizeRgb(instance.dyeColor); }
298 { return normalizeRgb(instance.dyeColor); }
299 if (definition?.tint)
299 if (definition?.tint)
300 { return normalizeRgb(definition.tint); }
300 { return normalizeRgb(definition.tint); }
@@ -327,6 +327,13 @@ function equipUsesMagentaOnly (definition)
327 return !!definition?.equipment?.tintFromTier && !definition?.equipment?.dualTintFromTier;
327 return !!definition?.equipment?.tintFromTier && !definition?.equipment?.dualTintFromTier;
328}
328}
329
329
330function clothChannelTint (definition, stack, clothTier)
331{
332 if (stack?.instance?.dyeColor)
333 { return normalizeRgb(stack.instance.dyeColor); }
334 return tierTintColor(clothTier);
335}
336
330function isOreItemDefinition (definition)
337function isOreItemDefinition (definition)
331{
338{
332 return definition?.defaultState === "ore";
339 return definition?.defaultState === "ore";