From 434f162a01b584b4f91546852a33c4b85f07cd1f Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Wed, 28 May 2025 16:07:38 +0100 Subject: [PATCH 1/3] Update unclaimed card filter to fallback to any card if all cards are claimed (#452) #451 Reviewed-on: https://git.vylpes.xyz/External/card-drop/pulls/452 Co-authored-by: Ethan Lane Co-committed-by: Ethan Lane --- src/helpers/DropHelpers/GetUnclaimedCardsHelper.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/helpers/DropHelpers/GetUnclaimedCardsHelper.ts b/src/helpers/DropHelpers/GetUnclaimedCardsHelper.ts index 3264a98..94ce894 100644 --- a/src/helpers/DropHelpers/GetUnclaimedCardsHelper.ts +++ b/src/helpers/DropHelpers/GetUnclaimedCardsHelper.ts @@ -39,12 +39,11 @@ export default class GetUnclaimedCardsHelper { const allCards = CoreClient.Cards .flatMap(x => x.cards) .filter(x => x.type == rarity) - .filter(x => !claimedCards.find(y => y.CardNumber == x.id)); + .filter(x => !claimedCards.find(y => y.CardNumber == x.id && y.Quantity > 0)); - if (!allCards) { - AppLogger.LogError("CardDropHelperMetadata/GetRandomCardByRarityUnclaimed", `No cards found to randomise from, User Id: ${userId}, rarity: ${rarity}`); - - return undefined; + if (!allCards || allCards.length == 0) { + // There is no card left unclaimed, fallback to any card + return GetCardsHelper.GetRandomCardByRarity(rarity); }; const randomCardIndex = Math.floor(Math.random() * allCards.length); From c9f7c443cfa9a8e83a376d7800b82a7fd026c1fd Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Wed, 28 May 2025 16:14:42 +0100 Subject: [PATCH 2/3] Fix effects helper returning an error when the buttons are disabled (#454) -This caused an issue with the updated embed after confirming to buy an effect it checking you had enough currency after taking the currency away #453 Reviewed-on: https://git.vylpes.xyz/External/card-drop/pulls/454 Co-authored-by: Ethan Lane Co-committed-by: Ethan Lane --- src/helpers/EffectHelper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers/EffectHelper.ts b/src/helpers/EffectHelper.ts index 235ea08..09e096c 100644 --- a/src/helpers/EffectHelper.ts +++ b/src/helpers/EffectHelper.ts @@ -151,7 +151,7 @@ export default class EffectHelper { AppLogger.LogInfo("EffectHelper", `Created initial user entity for : ${userId}`); } - if (user.Currency < totalCost) { + if (!disabled && user.Currency < totalCost) { return `You don't have enough currency to buy this! You have \`${user.Currency} Currency\` and need \`${totalCost} Currency\`!`; } From fc3c98f1bba88e0da844561fb2c021ad8bec6a03 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Wed, 28 May 2025 18:17:48 +0100 Subject: [PATCH 3/3] v0.9.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 84734e7..b8c7536 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "card-drop", - "version": "0.9.1", + "version": "0.9.2", "main": "./dist/bot.js", "typings": "./dist", "scripts": {