BlueGit

timfa questward

Sync equipment after bow shots and show arrow qty.

Push an inventory snapshot when arrows are consumed, and render stack counts on equipped slots like the bag.

timfa Tim Falken · pushed by timfa

Authored 2026-09-06 · 2 months ago

Hash
7b9fdb764998bb4e3a1f2eaa20a0b6ba664006c6
Parent
cd5aeb4f
2 files changed +16 −0
client/src/play/inventory.js +7 −0
@@ -351,6 +351,13 @@ export function initInventory ({
351 351 applyItemIcon(img, worn, itemAssetPathForStack(worn));
352 352 img.alt = itemDisplayName(worn);
353 353 button.append(img);
354 if (worn.quantity > 1)
355 {
356 const count = document.createElement("span");
357 count.className = "qty";
358 count.textContent = formatQuantity(worn.quantity);
359 button.append(count);
360 }
354 361 }
355 362 button.addEventListener("click", () =>
356 363 {
@@ -351,6 +351,13 @@ export function initInventory ({
351 applyItemIcon(img, worn, itemAssetPathForStack(worn));
351 applyItemIcon(img, worn, itemAssetPathForStack(worn));
352 img.alt = itemDisplayName(worn);
352 img.alt = itemDisplayName(worn);
353 button.append(img);
353 button.append(img);
354 if (worn.quantity > 1)
355 {
356 const count = document.createElement("span");
357 count.className = "qty";
358 count.textContent = formatQuantity(worn.quantity);
359 button.append(count);
360 }
354 }
361 }
355 button.addEventListener("click", () =>
362 button.addEventListener("click", () =>
356 {
363 {
server/src/combat/service.js +9 −0
@@ -1757,6 +1757,15 @@ export function resolveRangedShot (world, attackerId, targetId, profile, now = D
1757 1757 })();
1758 1758 if (!isCreature && !consumeArrow(world.ecs, attackerHandle))
1759 1759 { return events; }
1760 const character = world.ecs.get(attackerHandle, Component.character);
1761 if (character?.characterId != null)
1762 {
1763 events.push({
1764 type: "inventory",
1765 characterId: character.characterId,
1766 ...bagView(world.ecs, attackerHandle)
1767 });
1768 }
1760 1769
1761 1770 const shotProfile = tipElement
1762 1771 ? { ...profile, attackType: tipElement }
@@ -1757,6 +1757,15 @@ export function resolveRangedShot (world, attackerId, targetId, profile, now = D
1757 })();
1757 })();
1758 if (!isCreature && !consumeArrow(world.ecs, attackerHandle))
1758 if (!isCreature && !consumeArrow(world.ecs, attackerHandle))
1759 { return events; }
1759 { return events; }
1760 const character = world.ecs.get(attackerHandle, Component.character);
1761 if (character?.characterId != null)
1762 {
1763 events.push({
1764 type: "inventory",
1765 characterId: character.characterId,
1766 ...bagView(world.ecs, attackerHandle)
1767 });
1768 }
1760
1769
1761 const shotProfile = tipElement
1770 const shotProfile = tipElement
1762 ? { ...profile, attackType: tipElement }
1771 ? { ...profile, attackType: tipElement }