XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

SpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 1 Star 0
返回提交历史

XFEstudio/SpaceNinjaServer

fix: use exact quantity when adding gear items by StoreItem (#2310)

Closes #2304 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2310 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

eb7b5185
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

2 个文件 +16 -3
Modified src/services/inventoryService.ts +1 -0
@@ -499,6 +499,7 @@ export const addItem = async (
499 499 // - Blueprints for Ancient Protector Specter, Shield Osprey Specter, etc. have num=1 despite giving their purchaseQuantity.
500 500 if (!exactQuantity) {
501 501 quantity *= ExportGear[typeName].purchaseQuantity ?? 1;
502 logger.debug(`non-exact acquisition of ${typeName}; factored quantity is ${quantity}`);
502 503 }
503 504 const consumablesChanges = [
504 505 {
Modified src/services/purchaseService.ts +15 -3
@@ -371,18 +371,28 @@ export const handleStoreItemAcquisition = async (
371 371 } else {
372 372 const storeCategory = getStoreItemCategory(storeItemName);
373 373 const internalName = fromStoreItem(storeItemName);
374 logger.debug(`store category ${storeCategory}`);
375 374 if (!ignorePurchaseQuantity) {
376 375 if (internalName in ExportGear) {
377 376 quantity *= ExportGear[internalName].purchaseQuantity || 1;
377 logger.debug(`factored quantity is ${quantity}`);
378 378 } else if (internalName in ExportResources) {
379 379 quantity *= ExportResources[internalName].purchaseQuantity || 1;
380 logger.debug(`factored quantity is ${quantity}`);
380 381 }
381 382 }
383 logger.debug(`store category ${storeCategory}`);
382 384 switch (storeCategory) {
383 385 default: {
384 386 purchaseResponse = {
385 InventoryChanges: await addItem(inventory, internalName, quantity, premiumPurchase, seed)
387 InventoryChanges: await addItem(
388 inventory,
389 internalName,
390 quantity,
391 premiumPurchase,
392 seed,
393 undefined,
394 true
395 )
386 396 };
387 397 break;
388 398 }
@@ -524,7 +534,9 @@ const handleTypesPurchase = async (
524 534 logger.debug(`type category ${typeCategory}`);
525 535 switch (typeCategory) {
526 536 default:
527 return { InventoryChanges: await addItem(inventory, typesName, quantity, premiumPurchase, seed) };
537 return {
538 InventoryChanges: await addItem(inventory, typesName, quantity, premiumPurchase, seed, undefined, true)
539 };
528 540 case "BoosterPacks":
529 541 return handleBoosterPackPurchase(typesName, inventory, quantity);
530 542 case "SlotItems":