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

XFESpaceNinjaServer

A simple server for a small space ninja game

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

XFEstudio/XFESpaceNinjaServer

fix: check addItems quantity for Drones & EmailItems (#1612)

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

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

代码差异

1 个文件 +11 -2
Modified src/services/inventoryService.ts +11 -2
@@ -381,7 +381,7 @@ export const addItem = async (
381 381 } else if (ExportResources[typeName].productCategory == "KubrowPetEggs") {
382 382 const changes: IKubrowPetEggClient[] = [];
383 383 if (quantity < 0 || quantity > 100) {
384 throw new Error(`unexpected acquisition quantity of KubrowPetEggs: ${quantity}`);
384 throw new Error(`unexpected acquisition quantity of KubrowPetEggs: got ${quantity}, expected 0..100`);
385 385 }
386 386 for (let i = 0; i != quantity; ++i) {
387 387 const egg: IKubrowPetEggDatabase = {
@@ -548,9 +548,18 @@ export const addItem = async (
548 548 }
549 549 }
550 550 if (typeName in ExportDrones) {
551 return addDrone(inventory, typeName);
551 // Can only get 1 at a time from crafting, but for convenience's sake, allow up 100 to via the WebUI.
552 if (quantity < 0 || quantity > 100) {
553 throw new Error(`unexpected acquisition quantity of Drones: got ${quantity}, expected 0..100`);
554 }
555 for (let i = 0; i != quantity; ++i) {
556 return addDrone(inventory, typeName);
557 }
552 558 }
553 559 if (typeName in ExportEmailItems) {
560 if (quantity != 1) {
561 throw new Error(`unexpected acquisition quantity of EmailItems: got ${quantity}, expected 1`);
562 }
554 563 return await addEmailItem(inventory, typeName);
555 564 }
556 565