BlueGit

timfa questward

Fix shop interact crash and cut NPC buy offers to 50%.

Talk/shop pending interact now returns after clear so shear never reads null; vendors pay half market instead of 80%.

timfa Tim Falken · pushed by timfa

Authored 2026-08-31 · 2 months ago

Hash
490277c60112497ff13217eb99c79427a9b17ee8
Parent
f7255255
4 files changed +5 −4
client/src/editor/tileConfigModal.js +1 −1
@@ -766,7 +766,7 @@ export function initTileConfigModal ({
766 766
767 767 const hint = document.createElement("p");
768 768 hint.className = "hint";
769 hint.textContent = "Quantity 0 = infinite stock. Limited stock restocks daily at 00:00 server time. Any item can be listed for sale. Buys items: pays 80% market for transferable bag goods (not blank cheques); filled cheques sell as reserved goods with a 5% admin fee; extras resell at 120% until restock.";
769 hint.textContent = "Quantity 0 = infinite stock. Limited stock restocks daily at 00:00 server time. Any item can be listed for sale. Buys items: pays 50% market for transferable bag goods (not blank cheques); filled cheques sell as reserved goods with a 5% admin fee; extras resell at 120% until restock.";
770 770 wrap.append(hint);
771 771
772 772 sellsDraft = (config.sells ?? []).map((line) =>
@@ -766,7 +766,7 @@ export function initTileConfigModal ({
766
766
767 const hint = document.createElement("p");
767 const hint = document.createElement("p");
768 hint.className = "hint";
768 hint.className = "hint";
769 hint.textContent = "Quantity 0 = infinite stock. Limited stock restocks daily at 00:00 server time. Any item can be listed for sale. Buys items: pays 80% market for transferable bag goods (not blank cheques); filled cheques sell as reserved goods with a 5% admin fee; extras resell at 120% until restock.";
769 hint.textContent = "Quantity 0 = infinite stock. Limited stock restocks daily at 00:00 server time. Any item can be listed for sale. Buys items: pays 50% market for transferable bag goods (not blank cheques); filled cheques sell as reserved goods with a 5% admin fee; extras resell at 120% until restock.";
770 wrap.append(hint);
770 wrap.append(hint);
771
771
772 sellsDraft = (config.sells ?? []).map((line) =>
772 sellsDraft = (config.sells ?? []).map((line) =>
client/src/play/main.js +1 −0
@@ -927,6 +927,7 @@ function flushPendingInteract ()
927 927 entityId: pendingInteract.targetEntityId
928 928 });
929 929 clearPendingInteract();
930 return;
930 931 }
931 932
932 933 if (pendingInteract.kind === "shear")
@@ -927,6 +927,7 @@ function flushPendingInteract ()
927 entityId: pendingInteract.targetEntityId
927 entityId: pendingInteract.targetEntityId
928 });
928 });
929 clearPendingInteract();
929 clearPendingInteract();
930 return;
930 }
931 }
931
932
932 if (pendingInteract.kind === "shear")
933 if (pendingInteract.kind === "shear")
server/tests/shop.test.js +1 −1
@@ -191,7 +191,7 @@ test("charge-worn tools scale merchant buy and resale prices by remaining uses",
191 191 const wornBuy = shopBuyFromPlayerPrice(CraftingItemId.tinderbox, { stack: worn });
192 192 assert.equal(fullBuy, shopBuyFromPlayerPrice(CraftingItemId.tinderbox));
193 193 assert.equal(wornBuy, marketValueAsCoins(
194 undiscountedMarketValue(CraftingItemId.tinderbox) * 0.8 * (1 / 6)
194 undiscountedMarketValue(CraftingItemId.tinderbox) * 0.5 * (1 / 6)
195 195 ));
196 196 const fullResale = shopBoughtResalePrice(CraftingItemId.tinderbox, { stack: full });
197 197 const wornResale = shopBoughtResalePrice(CraftingItemId.tinderbox, { stack: worn });
@@ -191,7 +191,7 @@ test("charge-worn tools scale merchant buy and resale prices by remaining uses",
191 const wornBuy = shopBuyFromPlayerPrice(CraftingItemId.tinderbox, { stack: worn });
191 const wornBuy = shopBuyFromPlayerPrice(CraftingItemId.tinderbox, { stack: worn });
192 assert.equal(fullBuy, shopBuyFromPlayerPrice(CraftingItemId.tinderbox));
192 assert.equal(fullBuy, shopBuyFromPlayerPrice(CraftingItemId.tinderbox));
193 assert.equal(wornBuy, marketValueAsCoins(
193 assert.equal(wornBuy, marketValueAsCoins(
194 undiscountedMarketValue(CraftingItemId.tinderbox) * 0.8 * (1 / 6)
194 undiscountedMarketValue(CraftingItemId.tinderbox) * 0.5 * (1 / 6)
195 ));
195 ));
196 const fullResale = shopBoughtResalePrice(CraftingItemId.tinderbox, { stack: full });
196 const fullResale = shopBoughtResalePrice(CraftingItemId.tinderbox, { stack: full });
197 const wornResale = shopBoughtResalePrice(CraftingItemId.tinderbox, { stack: worn });
197 const wornResale = shopBoughtResalePrice(CraftingItemId.tinderbox, { stack: worn });
shared/shop/pricing.js +2 −2
@@ -125,7 +125,7 @@ export function shopUnitPrice (itemId, {
125 125 return marketValueAsCoins(undiscounted * discount);
126 126 }
127 127
128 /** NPC pays the player this much when buying (80% of market). */
128 /** NPC pays the player this much when buying (50% of market). */
129 129 export function shopBuyFromPlayerPrice (itemId, {
130 130 lastSale = null,
131 131 now = Date.now(),
@@ -136,7 +136,7 @@ export function shopBuyFromPlayerPrice (itemId, {
136 136 {
137 137 const frac = stack ? chargeFractionRemaining(stack) : 1;
138 138 return marketValueAsCoins(
139 undiscountedMarketValue(itemId, lastSale, now, lerpDurationMs, settings) * 0.8 * frac
139 undiscountedMarketValue(itemId, lastSale, now, lerpDurationMs, settings) * 0.5 * frac
140 140 );
141 141 }
142 142
@@ -125,7 +125,7 @@ export function shopUnitPrice (itemId, {
125 return marketValueAsCoins(undiscounted * discount);
125 return marketValueAsCoins(undiscounted * discount);
126}
126}
127
127
128/** NPC pays the player this much when buying (80% of market). */
128/** NPC pays the player this much when buying (50% of market). */
129export function shopBuyFromPlayerPrice (itemId, {
129export function shopBuyFromPlayerPrice (itemId, {
130 lastSale = null,
130 lastSale = null,
131 now = Date.now(),
131 now = Date.now(),
@@ -136,7 +136,7 @@ export function shopBuyFromPlayerPrice (itemId, {
136{
136{
137 const frac = stack ? chargeFractionRemaining(stack) : 1;
137 const frac = stack ? chargeFractionRemaining(stack) : 1;
138 return marketValueAsCoins(
138 return marketValueAsCoins(
139 undiscountedMarketValue(itemId, lastSale, now, lerpDurationMs, settings) * 0.8 * frac
139 undiscountedMarketValue(itemId, lastSale, now, lerpDurationMs, settings) * 0.5 * frac
140 );
140 );
141}
141}
142
142