BlueGit

timfa questward

fix crafting bench filters

timfa Tim Falken · pushed by timfa

Authored 2026-08-28 · 2 months ago

Hash
b0ea3281f91549352de48e263082935c199c17c2
Parent
67b0f198
2 files changed +35 −19
client/src/play/crafting.js +21 −8
@@ -1,4 +1,5 @@
1 import {
1 import
2 {
2 3 itemDefinition,
3 4 itemDisplayName,
4 5 itemAssetPathForStack,
@@ -6,7 +7,8 @@ import {
6 7 ItemId
7 8 } from "/shared/definitions/items.js";
8 9 import { craftingStationDefinition, CraftingStationId } from "/shared/definitions/craftingStations.js";
9 import {
10 import
11 {
10 12 CRAFT_DURATION_MS,
11 13 canStartCraft,
12 14 countItemInSlots,
@@ -14,7 +16,8 @@ import {
14 16 recipesForStation
15 17 } from "/shared/crafting/recipes.js";
16 18 import { resolveTailorCraft } from "/shared/crafting/tailor.js";
17 import {
19 import
20 {
18 21 CLOTH_TIER_ORDER,
19 22 CLOTH_DISPLAY_NAME,
20 23 ClothTier,
@@ -23,7 +26,8 @@ import {
23 26 WOOD_TIER_ORDER,
24 27 WoodTier,
25 28 MaterialTier,
26 woodTierForMetal
29 woodTierForMetal,
30 clothTierForWood
27 31 } from "/shared/definitions/materialTiers.js";
28 32 import { craftDurationMs } from "/shared/definitions/gathering.js";
29 33 import { applyItemIcon } from "../render/potionIcon.js";
@@ -162,8 +166,11 @@ export function initCrafting ({
162 166 /** Map UI material selection to a recipe's xpMaterial tier. */
163 167 function recipeXpMaterialForSelection (recipe, material = selectedMaterial)
164 168 {
165 if (isCraftingBenchStation() && recipe.craftGroup === "bow")
169 if (isCraftingBenchStation()
170 && (recipe.craftGroup === "bow" || recipe.craftGroup === "fishing-rod"))
166 171 { return woodTierForMetal(material); }
172 if (isCraftingBenchStation() && recipe.craftGroup === "fishing-net")
173 { return clothTierForWood(woodTierForMetal(material)); }
167 174 return material;
168 175 }
169 176
@@ -228,14 +235,17 @@ export function initCrafting ({
228 235 fallback: WoodTier.pine
229 236 };
230 237 }
231 // Crafting bench mixes metal tools and wood bows — show matched pairs.
238 // Crafting bench mixes metal tools, wood bows, and cloth fishing gear.
232 239 if (isCraftingBenchStation())
233 240 {
234 241 const names = {};
235 242 for (const metal of MATERIAL_TIER_ORDER)
236 243 {
237 244 const wood = woodTierForMetal(metal);
238 names[metal] = `${MATERIAL_DISPLAY_NAME[metal] ?? metal}/${MATERIAL_DISPLAY_NAME[wood] ?? wood}`;
245 const cloth = clothTierForWood(wood);
246 names[metal] = `${MATERIAL_DISPLAY_NAME[metal] ?? metal}/`
247 + `${MATERIAL_DISPLAY_NAME[wood] ?? wood}/`
248 + `${CLOTH_DISPLAY_NAME[cloth] ?? cloth}`;
239 249 }
240 250 return {
241 251 order: MATERIAL_TIER_ORDER,
@@ -308,7 +318,10 @@ export function initCrafting ({
308 318 if (!match)
309 319 {
310 320 match = variants[0];
311 if (match?.xpMaterial && !(isCraftingBenchStation() && match.craftGroup === "bow"))
321 if (match?.xpMaterial && !(isCraftingBenchStation()
322 && (match.craftGroup === "bow"
323 || match.craftGroup === "fishing-rod"
324 || match.craftGroup === "fishing-net")))
312 325 {
313 326 selectedMaterial = match.xpMaterial;
314 327 if (materialTierSelect)
@@ -1,4 +1,5 @@
1import {
1import
2{
2 itemDefinition,
3 itemDefinition,
3 itemDisplayName,
4 itemDisplayName,
4 itemAssetPathForStack,
5 itemAssetPathForStack,
@@ -6,7 +7,8 @@ import {
6 ItemId
7 ItemId
7} from "/shared/definitions/items.js";
8} from "/shared/definitions/items.js";
8import { craftingStationDefinition, CraftingStationId } from "/shared/definitions/craftingStations.js";
9import { craftingStationDefinition, CraftingStationId } from "/shared/definitions/craftingStations.js";
9import {
10import
11{
10 CRAFT_DURATION_MS,
12 CRAFT_DURATION_MS,
11 canStartCraft,
13 canStartCraft,
12 countItemInSlots,
14 countItemInSlots,
@@ -14,7 +16,8 @@ import {
14 recipesForStation
16 recipesForStation
15} from "/shared/crafting/recipes.js";
17} from "/shared/crafting/recipes.js";
16import { resolveTailorCraft } from "/shared/crafting/tailor.js";
18import { resolveTailorCraft } from "/shared/crafting/tailor.js";
17import {
19import
20{
18 CLOTH_TIER_ORDER,
21 CLOTH_TIER_ORDER,
19 CLOTH_DISPLAY_NAME,
22 CLOTH_DISPLAY_NAME,
20 ClothTier,
23 ClothTier,
@@ -23,7 +26,8 @@ import {
23 WOOD_TIER_ORDER,
26 WOOD_TIER_ORDER,
24 WoodTier,
27 WoodTier,
25 MaterialTier,
28 MaterialTier,
26 woodTierForMetal
29 woodTierForMetal,
30 clothTierForWood
27} from "/shared/definitions/materialTiers.js";
31} from "/shared/definitions/materialTiers.js";
28import { craftDurationMs } from "/shared/definitions/gathering.js";
32import { craftDurationMs } from "/shared/definitions/gathering.js";
29import { applyItemIcon } from "../render/potionIcon.js";
33import { applyItemIcon } from "../render/potionIcon.js";
@@ -162,8 +166,11 @@ export function initCrafting ({
162 /** Map UI material selection to a recipe's xpMaterial tier. */
166 /** Map UI material selection to a recipe's xpMaterial tier. */
163 function recipeXpMaterialForSelection (recipe, material = selectedMaterial)
167 function recipeXpMaterialForSelection (recipe, material = selectedMaterial)
164 {
168 {
165 if (isCraftingBenchStation() && recipe.craftGroup === "bow")
169 if (isCraftingBenchStation()
170 && (recipe.craftGroup === "bow" || recipe.craftGroup === "fishing-rod"))
166 { return woodTierForMetal(material); }
171 { return woodTierForMetal(material); }
172 if (isCraftingBenchStation() && recipe.craftGroup === "fishing-net")
173 { return clothTierForWood(woodTierForMetal(material)); }
167 return material;
174 return material;
168 }
175 }
169
176
@@ -228,14 +235,17 @@ export function initCrafting ({
228 fallback: WoodTier.pine
235 fallback: WoodTier.pine
229 };
236 };
230 }
237 }
231 // Crafting bench mixes metal tools and wood bows — show matched pairs.
238 // Crafting bench mixes metal tools, wood bows, and cloth fishing gear.
232 if (isCraftingBenchStation())
239 if (isCraftingBenchStation())
233 {
240 {
234 const names = {};
241 const names = {};
235 for (const metal of MATERIAL_TIER_ORDER)
242 for (const metal of MATERIAL_TIER_ORDER)
236 {
243 {
237 const wood = woodTierForMetal(metal);
244 const wood = woodTierForMetal(metal);
238 names[metal] = `${MATERIAL_DISPLAY_NAME[metal] ?? metal}/${MATERIAL_DISPLAY_NAME[wood] ?? wood}`;
245 const cloth = clothTierForWood(wood);
246 names[metal] = `${MATERIAL_DISPLAY_NAME[metal] ?? metal}/`
247 + `${MATERIAL_DISPLAY_NAME[wood] ?? wood}/`
248 + `${CLOTH_DISPLAY_NAME[cloth] ?? cloth}`;
239 }
249 }
240 return {
250 return {
241 order: MATERIAL_TIER_ORDER,
251 order: MATERIAL_TIER_ORDER,
@@ -308,7 +318,10 @@ export function initCrafting ({
308 if (!match)
318 if (!match)
309 {
319 {
310 match = variants[0];
320 match = variants[0];
311 if (match?.xpMaterial && !(isCraftingBenchStation() && match.craftGroup === "bow"))
321 if (match?.xpMaterial && !(isCraftingBenchStation()
322 && (match.craftGroup === "bow"
323 || match.craftGroup === "fishing-rod"
324 || match.craftGroup === "fishing-net")))
312 {
325 {
313 selectedMaterial = match.xpMaterial;
326 selectedMaterial = match.xpMaterial;
314 if (materialTierSelect)
327 if (materialTierSelect)
shared/definitions/fishItems.js +14 −11
@@ -1,15 +1,16 @@
1 1 import { ItemCategory } from "./itemCategories.js";
2 import {
3 ClothTier,
4 CLOTH_TIER_ORDER,
5 CLOTH_DISPLAY_NAME,
6 WoodTier,
7 WOOD_TIER_ORDER,
8 MATERIAL_DISPLAY_NAME,
9 tierRank,
10 tierMinSkillLevel,
11 clothTierForWood
12 } from "./materialTiers.js";
2 import
3 {
4 ClothTier,
5 CLOTH_TIER_ORDER,
6 CLOTH_DISPLAY_NAME,
7 WoodTier,
8 WOOD_TIER_ORDER,
9 MATERIAL_DISPLAY_NAME,
10 tierRank,
11 tierMinSkillLevel,
12 clothTierForWood
13 } from "./materialTiers.js";
13 14 import { EquipmentKind } from "./equipmentKinds.js";
14 15 import { SkillId } from "./skills.js";
15 16 import { CraftingStationId } from "./craftingStations.js";
@@ -450,6 +451,8 @@ export function fishingToolRecipes ()
450 451 const recipes = [
451 452 Object.freeze({
452 453 recipeId: "fishing-net",
454 craftGroup: "fishing-net",
455 craftGroupLabel: "Fishing net",
453 456 stationId: CraftingStationId.craftingBench,
454 457 output: { itemId: FishingToolItemId.net, quantity: 1 },
455 458 inputs: [{ itemId: yarnItemId(ClothTier.cotton), quantity: 3 }],
@@ -1,15 +1,16 @@
1import { ItemCategory } from "./itemCategories.js";
1import { ItemCategory } from "./itemCategories.js";
2import {
2import
3 ClothTier,
3 {
4 CLOTH_TIER_ORDER,
4 ClothTier,
5 CLOTH_DISPLAY_NAME,
5 CLOTH_TIER_ORDER,
6 WoodTier,
6 CLOTH_DISPLAY_NAME,
7 WOOD_TIER_ORDER,
7 WoodTier,
8 MATERIAL_DISPLAY_NAME,
8 WOOD_TIER_ORDER,
9 tierRank,
9 MATERIAL_DISPLAY_NAME,
10 tierMinSkillLevel,
10 tierRank,
11 clothTierForWood
11 tierMinSkillLevel,
12} from "./materialTiers.js";
12 clothTierForWood
13 } from "./materialTiers.js";
13import { EquipmentKind } from "./equipmentKinds.js";
14import { EquipmentKind } from "./equipmentKinds.js";
14import { SkillId } from "./skills.js";
15import { SkillId } from "./skills.js";
15import { CraftingStationId } from "./craftingStations.js";
16import { CraftingStationId } from "./craftingStations.js";
@@ -450,6 +451,8 @@ export function fishingToolRecipes ()
450 const recipes = [
451 const recipes = [
451 Object.freeze({
452 Object.freeze({
452 recipeId: "fishing-net",
453 recipeId: "fishing-net",
454 craftGroup: "fishing-net",
455 craftGroupLabel: "Fishing net",
453 stationId: CraftingStationId.craftingBench,
456 stationId: CraftingStationId.craftingBench,
454 output: { itemId: FishingToolItemId.net, quantity: 1 },
457 output: { itemId: FishingToolItemId.net, quantity: 1 },
455 inputs: [{ itemId: yarnItemId(ClothTier.cotton), quantity: 3 }],
458 inputs: [{ itemId: yarnItemId(ClothTier.cotton), quantity: 3 }],