BlueGit

timfa questward

Drop bronze shears, fix spell favourites on login, add fairy silk mob.

Bronze shears matched cotton with nothing to shear; favourites now render without opening the spell panel; fairies drop fairy silk (70%) with temp sprite art.

timfa Tim Falken · pushed by timfa

Authored 2026-08-31 · 2 months ago

Hash
5d5a8ff547e1b5931aee95720321acc6b743a3b7
Parent
1823a2b4
5 files changed +77 −22
client/src/play/spells.js +3 −4
@@ -48,10 +48,9 @@ export function initSpells ({ socket, MessageType, getSkillLevel } = {})
48 48 }
49 49 }
50 50 if (changed || !panel.hidden)
51 {
52 renderList();
53 renderBar();
54 }
51 { renderList(); }
52 /** Favourites sit outside the panel — always sync so they show after login. */
53 renderBar();
55 54 }
56 55
57 56 function disarmLocal ()
@@ -48,10 +48,9 @@ export function initSpells ({ socket, MessageType, getSkillLevel } = {})
48 }
48 }
49 }
49 }
50 if (changed || !panel.hidden)
50 if (changed || !panel.hidden)
51 {
51 { renderList(); }
52 renderList();
52 /** Favourites sit outside the panel — always sync so they show after login. */
53 renderBar();
53 renderBar();
54 }
55 }
54 }
56
55
57 function disarmLocal ()
56 function disarmLocal ()
server/tests/shearing.test.js +14 −1
@@ -95,8 +95,9 @@ test("shears are magenta-tinted metal and craft from one bar", () =>
95 95 assert.deepEqual(recipe.inputs, [{ itemId: ItemId.ironBar, quantity: 1 }]);
96 96 assert.equal(
97 97 recipesForStation(CraftingStationId.anvil).filter((r) => r.craftGroup === "shears").length,
98 7
98 6
99 99 );
100 assert.equal(recipeDefinition("shears-bronze"), null);
100 101 });
101 102
102 103 test("sheep and cashmere goat are shearable with fleece/shorn sprites", () =>
@@ -110,6 +111,18 @@ test("sheep and cashmere goat are shearable with fleece/shorn sprites", () =>
110 111 assert.equal(mobSpriteName(MobId.cashmereGoat, "fleece"), "mob:cashmere-goat:fleece");
111 112 });
112 113
114 test("fairy reuses sprite art and drops fairy silk", () =>
115 {
116 const fairy = mobDefinition(MobId.fairy);
117 assert.equal(fairy.spriteKey, "sprite");
118 assert.equal(mobSpriteName(MobId.fairy), "mob:sprite:sprite");
119 assert.equal(fairy.drops.length, 1);
120 assert.equal(fairy.drops[0].itemId, ClothItemId.fairySilk);
121 assert.equal(fairy.drops[0].chance, 0.7);
122 assert.equal(MetalItemId.bronzeShears, undefined);
123 assert.equal(itemDefinition(MetalItemId.ironShears)?.equipment?.kind, EquipmentKind.shears);
124 });
125
113 126 test("flax needs steel-or-better clippers; linen fibre is named Flax", () =>
114 127 {
115 128 assert.equal(itemDefinition(ClothItemId.linen).displayName, "Flax");
@@ -95,8 +95,9 @@ test("shears are magenta-tinted metal and craft from one bar", () =>
95 assert.deepEqual(recipe.inputs, [{ itemId: ItemId.ironBar, quantity: 1 }]);
95 assert.deepEqual(recipe.inputs, [{ itemId: ItemId.ironBar, quantity: 1 }]);
96 assert.equal(
96 assert.equal(
97 recipesForStation(CraftingStationId.anvil).filter((r) => r.craftGroup === "shears").length,
97 recipesForStation(CraftingStationId.anvil).filter((r) => r.craftGroup === "shears").length,
98 7
98 6
99 );
99 );
100 assert.equal(recipeDefinition("shears-bronze"), null);
100});
101});
101
102
102test("sheep and cashmere goat are shearable with fleece/shorn sprites", () =>
103test("sheep and cashmere goat are shearable with fleece/shorn sprites", () =>
@@ -110,6 +111,18 @@ test("sheep and cashmere goat are shearable with fleece/shorn sprites", () =>
110 assert.equal(mobSpriteName(MobId.cashmereGoat, "fleece"), "mob:cashmere-goat:fleece");
111 assert.equal(mobSpriteName(MobId.cashmereGoat, "fleece"), "mob:cashmere-goat:fleece");
111});
112});
112
113
114test("fairy reuses sprite art and drops fairy silk", () =>
115{
116 const fairy = mobDefinition(MobId.fairy);
117 assert.equal(fairy.spriteKey, "sprite");
118 assert.equal(mobSpriteName(MobId.fairy), "mob:sprite:sprite");
119 assert.equal(fairy.drops.length, 1);
120 assert.equal(fairy.drops[0].itemId, ClothItemId.fairySilk);
121 assert.equal(fairy.drops[0].chance, 0.7);
122 assert.equal(MetalItemId.bronzeShears, undefined);
123 assert.equal(itemDefinition(MetalItemId.ironShears)?.equipment?.kind, EquipmentKind.shears);
124});
125
113test("flax needs steel-or-better clippers; linen fibre is named Flax", () =>
126test("flax needs steel-or-better clippers; linen fibre is named Flax", () =>
114{
127{
115 assert.equal(itemDefinition(ClothItemId.linen).displayName, "Flax");
128 assert.equal(itemDefinition(ClothItemId.linen).displayName, "Flax");
shared/crafting/tierRecipes.js +16 −12
@@ -10,6 +10,7 @@ import
10 10 CLOTH_TIER_ORDER,
11 11 LEATHER_TIER_ORDER,
12 12 MATERIAL_DISPLAY_NAME,
13 MaterialTier,
13 14 WoodTier,
14 15 woodTierForMetal,
15 16 leatherTierForMetal,
@@ -215,18 +216,21 @@ function plantClippersRecipes ()
215 216
216 217 function shearsRecipes ()
217 218 {
218 return MATERIAL_TIER_ORDER.map((metalTier) => tierRecipe({
219 recipeId: `shears-${metalTier}`,
220 craftGroup: "shears",
221 craftGroupLabel: "Shears",
222 stationId: CraftingStationId.anvil,
223 outputFamily: ItemFamilyId.shears,
224 outputTier: metalTier,
225 inputs: [{ itemId: familyItemId(ItemFamilyId.bar, metalTier), quantity: 1 }],
226 minSkillLevel: tierSmeltSkillLevel(metalTier),
227 skillId: "smithing",
228 xpMaterial: metalTier
229 }));
219 /** Bronze mirrors cotton; wool (sheep) is the lowest shearable tier → iron+. */
220 return MATERIAL_TIER_ORDER
221 .filter((metalTier) => metalTier !== MaterialTier.bronze)
222 .map((metalTier) => tierRecipe({
223 recipeId: `shears-${metalTier}`,
224 craftGroup: "shears",
225 craftGroupLabel: "Shears",
226 stationId: CraftingStationId.anvil,
227 outputFamily: ItemFamilyId.shears,
228 outputTier: metalTier,
229 inputs: [{ itemId: familyItemId(ItemFamilyId.bar, metalTier), quantity: 1 }],
230 minSkillLevel: tierSmeltSkillLevel(metalTier),
231 skillId: "smithing",
232 xpMaterial: metalTier
233 }));
230 234 }
231 235
232 236 function swordBladeRecipes ()
@@ -10,6 +10,7 @@ import
10 CLOTH_TIER_ORDER,
10 CLOTH_TIER_ORDER,
11 LEATHER_TIER_ORDER,
11 LEATHER_TIER_ORDER,
12 MATERIAL_DISPLAY_NAME,
12 MATERIAL_DISPLAY_NAME,
13 MaterialTier,
13 WoodTier,
14 WoodTier,
14 woodTierForMetal,
15 woodTierForMetal,
15 leatherTierForMetal,
16 leatherTierForMetal,
@@ -215,18 +216,21 @@ function plantClippersRecipes ()
215
216
216function shearsRecipes ()
217function shearsRecipes ()
217{
218{
218 return MATERIAL_TIER_ORDER.map((metalTier) => tierRecipe({
219 /** Bronze mirrors cotton; wool (sheep) is the lowest shearable tier → iron+. */
219 recipeId: `shears-${metalTier}`,
220 return MATERIAL_TIER_ORDER
220 craftGroup: "shears",
221 .filter((metalTier) => metalTier !== MaterialTier.bronze)
221 craftGroupLabel: "Shears",
222 .map((metalTier) => tierRecipe({
222 stationId: CraftingStationId.anvil,
223 recipeId: `shears-${metalTier}`,
223 outputFamily: ItemFamilyId.shears,
224 craftGroup: "shears",
224 outputTier: metalTier,
225 craftGroupLabel: "Shears",
225 inputs: [{ itemId: familyItemId(ItemFamilyId.bar, metalTier), quantity: 1 }],
226 stationId: CraftingStationId.anvil,
226 minSkillLevel: tierSmeltSkillLevel(metalTier),
227 outputFamily: ItemFamilyId.shears,
227 skillId: "smithing",
228 outputTier: metalTier,
228 xpMaterial: metalTier
229 inputs: [{ itemId: familyItemId(ItemFamilyId.bar, metalTier), quantity: 1 }],
229 }));
230 minSkillLevel: tierSmeltSkillLevel(metalTier),
231 skillId: "smithing",
232 xpMaterial: metalTier
233 }));
230}
234}
231
235
232function swordBladeRecipes ()
236function swordBladeRecipes ()
shared/definitions/metalItems.js +1 −3
@@ -67,7 +67,6 @@ export const MetalItemId = Object.freeze({
67 67 adamantiumPlantClippers: 187,
68 68 orichalcumPlantClippers: 188,
69 69 dragonPlantClippers: 189,
70 bronzeShears: 497,
71 70 ironShears: 498,
72 71 steelShears: 499,
73 72 mithrilShears: 500,
@@ -159,9 +158,8 @@ export const PLANT_CLIPPERS_ITEM_BY_METAL = Object.freeze({
159 158 [MaterialTier.dragon]: MetalItemId.dragonPlantClippers
160 159 });
161 160
162 /** Shears item id by metal tier. */
161 /** Shears item id by metal tier (iron+; wool is the lowest shearable cloth). */
163 162 export const SHEARS_ITEM_BY_METAL = Object.freeze({
164 [MaterialTier.bronze]: MetalItemId.bronzeShears,
165 163 [MaterialTier.iron]: MetalItemId.ironShears,
166 164 [MaterialTier.steel]: MetalItemId.steelShears,
167 165 [MaterialTier.mithril]: MetalItemId.mithrilShears,
@@ -67,7 +67,6 @@ export const MetalItemId = Object.freeze({
67 adamantiumPlantClippers: 187,
67 adamantiumPlantClippers: 187,
68 orichalcumPlantClippers: 188,
68 orichalcumPlantClippers: 188,
69 dragonPlantClippers: 189,
69 dragonPlantClippers: 189,
70 bronzeShears: 497,
71 ironShears: 498,
70 ironShears: 498,
72 steelShears: 499,
71 steelShears: 499,
73 mithrilShears: 500,
72 mithrilShears: 500,
@@ -159,9 +158,8 @@ export const PLANT_CLIPPERS_ITEM_BY_METAL = Object.freeze({
159 [MaterialTier.dragon]: MetalItemId.dragonPlantClippers
158 [MaterialTier.dragon]: MetalItemId.dragonPlantClippers
160});
159});
161
160
162/** Shears item id by metal tier. */
161/** Shears item id by metal tier (iron+; wool is the lowest shearable cloth). */
163export const SHEARS_ITEM_BY_METAL = Object.freeze({
162export const SHEARS_ITEM_BY_METAL = Object.freeze({
164 [MaterialTier.bronze]: MetalItemId.bronzeShears,
165 [MaterialTier.iron]: MetalItemId.ironShears,
163 [MaterialTier.iron]: MetalItemId.ironShears,
166 [MaterialTier.steel]: MetalItemId.steelShears,
164 [MaterialTier.steel]: MetalItemId.steelShears,
167 [MaterialTier.mithril]: MetalItemId.mithrilShears,
165 [MaterialTier.mithril]: MetalItemId.mithrilShears,
shared/definitions/mobs.js +43 −2
@@ -8,6 +8,7 @@ import { WoodItemId } from "./woodItems.js";
8 8 import { ItemId } from "./items.js";
9 9 import { spellDefinition } from "./spells.js";
10 10 import { ClothTier } from "./materialTiers.js";
11 import { ClothItemId } from "./clothItems.js";
11 12
12 13 export const MobId = Object.freeze({
13 14 deer: "deer",
@@ -24,7 +25,9 @@ export const MobId = Object.freeze({
24 25 /** Temporary Shade summon (spell). */
25 26 shade: "shade",
26 27 /** Elemental sprite — random element on spawn, drops essence, emits light. */
27 sprite: "sprite"
28 sprite: "sprite",
29 /** Fairy — drops fairy silk fibre on death. */
30 fairy: "fairy"
28 31 });
29 32
30 33 /** @typedef {{ itemId: number, chance: number, quantity?: number, quantityMin?: number, quantityMax?: number }} MobDrop */
@@ -281,6 +284,40 @@ export const MOB_DEFINITIONS = Object.freeze({
281 284 framesPerRow: 2,
282 285 animationSpeed: 0.5
283 286 }),
287 [MobId.fairy]: Object.freeze({
288 mobTypeId: MobId.fairy,
289 key: "fairy",
290 assetFolder: "mobs",
291 displayName: "Fairy",
292 health: 40,
293 maxHealth: 40,
294 maxHealthFromLevel: "levelPlus10",
295 attackSkill: 55,
296 attackCooldownMs: 1000,
297 drops: Object.freeze([
298 { itemId: ClothItemId.fairySilk, chance: 0.7 }
299 ]),
300 sells: Object.freeze([]),
301 dialogue: Object.freeze([]),
302 persistent: false,
303 flying: true,
304 freeFlight: false,
305 ambient: false,
306 talkable: false,
307 untargetable: false,
308 aggressive: true,
309 aggroRangeTiles: 5,
310 lightRadiusTiles: 1,
311 bloomBody: true,
312 /** Temp art until dedicated fairy sprites exist. */
313 spriteKey: "sprite",
314 gait: "walk",
315 sex: "female",
316 frames: 2,
317 framesPerRow: 2,
318 animationSpeed: 0.45,
319 defaultState: "sprite"
320 }),
284 321 [MobId.humanoid]: Object.freeze({
285 322 mobTypeId: MobId.humanoid,
286 323 key: "humanoid",
@@ -393,7 +430,11 @@ export function defaultSpawnerConfig (spawnerId, mobTypeId = MobId.deer)
393 430 const townGuard = mobTypeId === MobId.townGuard;
394 431 const centralExchange = mobTypeId === MobId.centralExchange;
395 432 const bodyNpc = humanoid || townGuard || centralExchange;
396 const level = townGuard ? 30 : (mobTypeId === MobId.sprite ? 25 : 1);
433 const level = townGuard
434 ? 30
435 : (mobTypeId === MobId.sprite
436 ? 25
437 : (mobTypeId === MobId.fairy ? 70 : 1));
397 438 const bounty = townGuard ? 500 : 0;
398 439 return {
399 440 spawnerId,
@@ -8,6 +8,7 @@ import { WoodItemId } from "./woodItems.js";
8import { ItemId } from "./items.js";
8import { ItemId } from "./items.js";
9import { spellDefinition } from "./spells.js";
9import { spellDefinition } from "./spells.js";
10import { ClothTier } from "./materialTiers.js";
10import { ClothTier } from "./materialTiers.js";
11import { ClothItemId } from "./clothItems.js";
11
12
12export const MobId = Object.freeze({
13export const MobId = Object.freeze({
13 deer: "deer",
14 deer: "deer",
@@ -24,7 +25,9 @@ export const MobId = Object.freeze({
24 /** Temporary Shade summon (spell). */
25 /** Temporary Shade summon (spell). */
25 shade: "shade",
26 shade: "shade",
26 /** Elemental sprite — random element on spawn, drops essence, emits light. */
27 /** Elemental sprite — random element on spawn, drops essence, emits light. */
27 sprite: "sprite"
28 sprite: "sprite",
29 /** Fairy — drops fairy silk fibre on death. */
30 fairy: "fairy"
28});
31});
29
32
30/** @typedef {{ itemId: number, chance: number, quantity?: number, quantityMin?: number, quantityMax?: number }} MobDrop */
33/** @typedef {{ itemId: number, chance: number, quantity?: number, quantityMin?: number, quantityMax?: number }} MobDrop */
@@ -281,6 +284,40 @@ export const MOB_DEFINITIONS = Object.freeze({
281 framesPerRow: 2,
284 framesPerRow: 2,
282 animationSpeed: 0.5
285 animationSpeed: 0.5
283 }),
286 }),
287 [MobId.fairy]: Object.freeze({
288 mobTypeId: MobId.fairy,
289 key: "fairy",
290 assetFolder: "mobs",
291 displayName: "Fairy",
292 health: 40,
293 maxHealth: 40,
294 maxHealthFromLevel: "levelPlus10",
295 attackSkill: 55,
296 attackCooldownMs: 1000,
297 drops: Object.freeze([
298 { itemId: ClothItemId.fairySilk, chance: 0.7 }
299 ]),
300 sells: Object.freeze([]),
301 dialogue: Object.freeze([]),
302 persistent: false,
303 flying: true,
304 freeFlight: false,
305 ambient: false,
306 talkable: false,
307 untargetable: false,
308 aggressive: true,
309 aggroRangeTiles: 5,
310 lightRadiusTiles: 1,
311 bloomBody: true,
312 /** Temp art until dedicated fairy sprites exist. */
313 spriteKey: "sprite",
314 gait: "walk",
315 sex: "female",
316 frames: 2,
317 framesPerRow: 2,
318 animationSpeed: 0.45,
319 defaultState: "sprite"
320 }),
284 [MobId.humanoid]: Object.freeze({
321 [MobId.humanoid]: Object.freeze({
285 mobTypeId: MobId.humanoid,
322 mobTypeId: MobId.humanoid,
286 key: "humanoid",
323 key: "humanoid",
@@ -393,7 +430,11 @@ export function defaultSpawnerConfig (spawnerId, mobTypeId = MobId.deer)
393 const townGuard = mobTypeId === MobId.townGuard;
430 const townGuard = mobTypeId === MobId.townGuard;
394 const centralExchange = mobTypeId === MobId.centralExchange;
431 const centralExchange = mobTypeId === MobId.centralExchange;
395 const bodyNpc = humanoid || townGuard || centralExchange;
432 const bodyNpc = humanoid || townGuard || centralExchange;
396 const level = townGuard ? 30 : (mobTypeId === MobId.sprite ? 25 : 1);
433 const level = townGuard
434 ? 30
435 : (mobTypeId === MobId.sprite
436 ? 25
437 : (mobTypeId === MobId.fairy ? 70 : 1));
397 const bounty = townGuard ? 500 : 0;
438 const bounty = townGuard ? 500 : 0;
398 return {
439 return {
399 spawnerId,
440 spawnerId,