added no dupe for lootbox

This commit is contained in:
MasterGordon 2024-10-19 23:50:15 +02:00
parent 47f4ee6464
commit 6a1b9ef890
1 changed files with 4 additions and 2 deletions

View File

@ -147,9 +147,11 @@ export const userController = createController({
if (!lootbox) {
throw new Error("Lootbox not found");
}
const itemsCopy = [...lootbox.items];
let itemsCopy = [...lootbox.items];
if (lootbox.noDuplicates) {
itemsCopy.filter((i) => !collection.entries.some((e) => e.id === i.id));
itemsCopy = itemsCopy.filter(
(i) => !collection.entries.some((e) => e.id === i.id),
);
}
if (itemsCopy.length === 0) {
throw new Error("No items left");