BlueGit

timfa questward

Give Magic Missile spellbook a free item id.

402 already belongs to cut tourmaline, so the book was overwritten in ITEM_DEFINITIONS and missing from shop stock pickers.

timfa Tim Falken · pushed by timfa

Authored 2026-08-30 · 2 months ago

Hash
35c27d8db7f8f1bef6fec7c001dfb2dcf816d9a0
Parent
f451b762
2 files changed +11 −2
server/tests/shop.test.js +10 −1
@@ -15,7 +15,7 @@ import
15 15 shopRestockDayKey,
16 16 lerp
17 17 } from "../../shared/shop/pricing.js";
18 import { ItemId, listAllItemPickerEntries } from "../../shared/definitions/items.js";
18 import { ItemId, itemDefinition, listAllItemPickerEntries } from "../../shared/definitions/items.js";
19 19 import { CraftingItemId } from "../../shared/definitions/craftingItems.js";
20 20 import { MobId, normalizeSpawnerConfig, isHumanoidMob } from "../../shared/definitions/mobs.js";
21 21 import { makeCharacter, makeSimulation } from "./helpers/simulationHarness.js";
@@ -48,6 +48,15 @@ test("listAllItemPickerEntries includes paper and bronze gather tools", () =>
48 48 assert.equal(canSellInNpcShop(CraftingItemId.bronzeAxe), false);
49 49 });
50 50
51 test("listAllItemPickerEntries includes Magic Missile spellbook", () =>
52 {
53 const entry = listAllItemPickerEntries().find((e) => e.displayName === "Spellbook: Magic Missile");
54 assert.ok(entry);
55 assert.equal(entry.itemId, 489);
56 assert.equal(itemDefinition(489)?.consumableSpellId, "magic-missile");
57 assert.notEqual(itemDefinition(402)?.key, "spellbook-magic-missile");
58 });
59
51 60 test("buy paper from a shopkeeper with explicit catalog", () =>
52 61 {
53 62 const harness = makeSimulation({ workerCount: 1 });
@@ -15,7 +15,7 @@ import
15 shopRestockDayKey,
15 shopRestockDayKey,
16 lerp
16 lerp
17 } from "../../shared/shop/pricing.js";
17 } from "../../shared/shop/pricing.js";
18import { ItemId, listAllItemPickerEntries } from "../../shared/definitions/items.js";
18import { ItemId, itemDefinition, listAllItemPickerEntries } from "../../shared/definitions/items.js";
19import { CraftingItemId } from "../../shared/definitions/craftingItems.js";
19import { CraftingItemId } from "../../shared/definitions/craftingItems.js";
20import { MobId, normalizeSpawnerConfig, isHumanoidMob } from "../../shared/definitions/mobs.js";
20import { MobId, normalizeSpawnerConfig, isHumanoidMob } from "../../shared/definitions/mobs.js";
21import { makeCharacter, makeSimulation } from "./helpers/simulationHarness.js";
21import { makeCharacter, makeSimulation } from "./helpers/simulationHarness.js";
@@ -48,6 +48,15 @@ test("listAllItemPickerEntries includes paper and bronze gather tools", () =>
48 assert.equal(canSellInNpcShop(CraftingItemId.bronzeAxe), false);
48 assert.equal(canSellInNpcShop(CraftingItemId.bronzeAxe), false);
49});
49});
50
50
51test("listAllItemPickerEntries includes Magic Missile spellbook", () =>
52{
53 const entry = listAllItemPickerEntries().find((e) => e.displayName === "Spellbook: Magic Missile");
54 assert.ok(entry);
55 assert.equal(entry.itemId, 489);
56 assert.equal(itemDefinition(489)?.consumableSpellId, "magic-missile");
57 assert.notEqual(itemDefinition(402)?.key, "spellbook-magic-missile");
58});
59
51test("buy paper from a shopkeeper with explicit catalog", () =>
60test("buy paper from a shopkeeper with explicit catalog", () =>
52{
61{
53 const harness = makeSimulation({ workerCount: 1 });
62 const harness = makeSimulation({ workerCount: 1 });
shared/definitions/spellItems.js +1 −1
@@ -7,7 +7,7 @@ import { SpellId, spellDefinition, learnableSpellIds } from "./spells.js";
7 7 */
8 8 const SPELLBOOK_ID_BY_SPELL = Object.freeze({
9 9 [SpellId.dark]: 391,
10 [SpellId.magicMissile]: 402,
10 [SpellId.magicMissile]: 489,
11 11 [SpellId.firebolt]: 392,
12 12 [SpellId.fireball]: 393,
13 13 [SpellId.blaze]: 394,
@@ -7,7 +7,7 @@ import { SpellId, spellDefinition, learnableSpellIds } from "./spells.js";
7 */
7 */
8const SPELLBOOK_ID_BY_SPELL = Object.freeze({
8const SPELLBOOK_ID_BY_SPELL = Object.freeze({
9 [SpellId.dark]: 391,
9 [SpellId.dark]: 391,
10 [SpellId.magicMissile]: 402,
10 [SpellId.magicMissile]: 489,
11 [SpellId.firebolt]: 392,
11 [SpellId.firebolt]: 392,
12 [SpellId.fireball]: 393,
12 [SpellId.fireball]: 393,
13 [SpellId.blaze]: 394,
13 [SpellId.blaze]: 394,