From 7b1fd03f1d78c1f264e8d9f63ee5e9356343823d Mon Sep 17 00:00:00 2001 From: Dev Date: Mon, 12 Feb 2024 16:00:25 +0000 Subject: [PATCH] Delete amulet from inventory when charges is 0 or below --- project/src/controllers/InraidController.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/project/src/controllers/InraidController.ts b/project/src/controllers/InraidController.ts index 63975f18..14518f04 100644 --- a/project/src/controllers/InraidController.ts +++ b/project/src/controllers/InraidController.ts @@ -196,15 +196,24 @@ export class InraidController else { // Not dead + // Check for cultist amulets in special slot (only slot it can fit) const amuletOnPlayer = serverPmcProfile.Inventory.items.filter((item) => item.slotId?.startsWith("SpecialSlot") ).find((item) => item._tpl === "64d0b40fbe2eed70e254e2d4"); if (amuletOnPlayer) { - // Decrement usages remaing - if (amuletOnPlayer.upd.CultistAmulet.NumberOfUsages > 0) + // No charges left, delete it + if (amuletOnPlayer.upd.CultistAmulet.NumberOfUsages <= 0) { + serverPmcProfile.Inventory.items.splice( + serverPmcProfile.Inventory.items.indexOf(amuletOnPlayer), + 1, + ); + } + else if (amuletOnPlayer.upd.CultistAmulet.NumberOfUsages > 0) + { + // Charges left, reduce by 1 amuletOnPlayer.upd.CultistAmulet.NumberOfUsages--; } }