Delete amulet from inventory when charges is 0 or below
This commit is contained in:
parent
ae1bc9ad3a
commit
7b1fd03f1d
@ -196,15 +196,24 @@ export class InraidController
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Not dead
|
// Not dead
|
||||||
|
|
||||||
// Check for cultist amulets in special slot (only slot it can fit)
|
// Check for cultist amulets in special slot (only slot it can fit)
|
||||||
const amuletOnPlayer = serverPmcProfile.Inventory.items.filter((item) =>
|
const amuletOnPlayer = serverPmcProfile.Inventory.items.filter((item) =>
|
||||||
item.slotId?.startsWith("SpecialSlot")
|
item.slotId?.startsWith("SpecialSlot")
|
||||||
).find((item) => item._tpl === "64d0b40fbe2eed70e254e2d4");
|
).find((item) => item._tpl === "64d0b40fbe2eed70e254e2d4");
|
||||||
if (amuletOnPlayer)
|
if (amuletOnPlayer)
|
||||||
{
|
{
|
||||||
// Decrement usages remaing
|
// No charges left, delete it
|
||||||
if (amuletOnPlayer.upd.CultistAmulet.NumberOfUsages > 0)
|
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--;
|
amuletOnPlayer.upd.CultistAmulet.NumberOfUsages--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user