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

chore: fix wording of error when an item goes negative (#3054)

It would say "subtracting -1" instead of "adding -1" or "subtracting 1". Also mentioned the absolute count (that would be) after the operation. Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3054 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

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

代码差异

1 个文件 +6 -4
Modified src/services/inventoryService.ts +6 -4
@@ -1920,7 +1920,9 @@ export const addMiscItems = (inventory: TInventoryDatabaseDocument, itemsArray:
1920 1920 if (MiscItems[itemIndex].ItemCount == 0) {
1921 1921 MiscItems.splice(itemIndex, 1);
1922 1922 } else if (MiscItems[itemIndex].ItemCount < 0) {
1923 throw new Error(`inventory.MiscItems has a negative count for ${ItemType} after subtracting ${ItemCount}`);
1923 throw new Error(
1924 `Cannot remove ${ItemCount * -1}x ${ItemType} from MiscItems, would be left with ${MiscItems[itemIndex].ItemCount}`
1925 );
1924 1926 }
1925 1927 });
1926 1928 };
@@ -1943,7 +1945,7 @@ const applyArrayChanges = (
1943 1945 arr.splice(itemIndex, 1);
1944 1946 } else if (arr[itemIndex].ItemCount < 0) {
1945 1947 throw new Error(
1946 `inventory.${key} has a negative count for ${change.ItemType} after subtracting ${change.ItemCount}`
1948 `Cannot remove ${change.ItemCount * -1}x ${change.ItemType} from ${key}, would be left with ${arr[itemIndex].ItemCount}`
1947 1949 );
1948 1950 }
1949 1951 }
@@ -1992,7 +1994,7 @@ export const addMods = (inventory: TInventoryDatabaseDocument, itemsArray: IRawU
1992 1994 RawUpgrades.splice(itemIndex, 1);
1993 1995 } else if (RawUpgrades[itemIndex].ItemCount < 0) {
1994 1996 throw new Error(
1995 `inventory.RawUpgrades has a negative count for ${ItemType} after subtracting ${ItemCount}`
1997 `Cannot remove ${ItemCount * -1}x ${ItemType} from RawUpgrades, would be left with ${RawUpgrades[itemIndex].ItemCount}`
1996 1998 );
1997 1999 }
1998 2000 });
@@ -2009,7 +2011,7 @@ export const addFusionTreasures = (inventory: TInventoryDatabaseDocument, itemsA
2009 2011 FusionTreasures.splice(itemIndex, 1);
2010 2012 } else if (FusionTreasures[itemIndex].ItemCount <= 0) {
2011 2013 throw new Error(
2012 `inventory.FusionTreasures has a negative count for ${ItemType} after subtracting ${ItemCount}`
2014 `Cannot remove ${ItemCount * -1}x ${ItemType} from FusionTreasures, would be left with ${FusionTreasures[itemIndex].ItemCount}`
2013 2015 );
2014 2016 }
2015 2017 } else {