Update drop mechanic to take currency on drop instead of claim
This commit is contained in:
parent
5089ad6ab6
commit
f98f15b06a
4 changed files with 15 additions and 14 deletions
|
@ -36,11 +36,6 @@ export default class Claim extends ButtonEvent {
|
|||
|
||||
AppLogger.LogSilly("Button/Claim", `${user.Id} has ${user.Currency} currency`);
|
||||
|
||||
if (!user.RemoveCurrency(CardConstants.ClaimCost)) {
|
||||
await interaction.channel.send(`${interaction.user}, Not enough currency! You need ${CardConstants.ClaimCost} currency, you have ${user.Currency}!`);
|
||||
return;
|
||||
}
|
||||
|
||||
const claimed = await eClaim.FetchOneByClaimId(claimId);
|
||||
|
||||
if (claimed) {
|
||||
|
@ -53,8 +48,6 @@ export default class Claim extends ButtonEvent {
|
|||
return;
|
||||
}
|
||||
|
||||
await user.Save(User, user);
|
||||
|
||||
let inventory = await Inventory.FetchOneByCardNumberAndUserId(userId, cardNumber);
|
||||
|
||||
if (!inventory) {
|
||||
|
|
|
@ -35,11 +35,13 @@ export default class Reroll extends ButtonEvent {
|
|||
AppLogger.LogInfo("Commands/Drop", `New user (${interaction.user.id}) saved to the database`);
|
||||
}
|
||||
|
||||
if (user.Currency < CardConstants.ClaimCost) {
|
||||
if (!user.RemoveCurrency(CardConstants.ClaimCost)) {
|
||||
await interaction.reply(`Not enough currency! You need ${CardConstants.ClaimCost} currency, you have ${user.Currency}!`);
|
||||
return;
|
||||
}
|
||||
|
||||
await user.Save(User, user);
|
||||
|
||||
const randomCard = await GetCardsHelper.FetchCard(interaction.user.id);
|
||||
|
||||
if (!randomCard) {
|
||||
|
|
|
@ -43,11 +43,13 @@ export default class Drop extends Command {
|
|||
AppLogger.LogInfo("Commands/Drop", `New user (${interaction.user.id}) saved to the database`);
|
||||
}
|
||||
|
||||
if (user.Currency < CardConstants.ClaimCost) {
|
||||
if (!user.RemoveCurrency(CardConstants.ClaimCost)) {
|
||||
await interaction.reply(ErrorMessages.NotEnoughCurrency(CardConstants.ClaimCost, user.Currency));
|
||||
return;
|
||||
}
|
||||
|
||||
await user.Save(User, user);
|
||||
|
||||
const randomCard = await GetCardsHelper.FetchCard(interaction.user.id);
|
||||
|
||||
if (!randomCard) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder } from "discord.js";
|
||||
import { DropResult } from "../../contracts/SeriesMetadata";
|
||||
import AppLogger from "../../client/appLogger";
|
||||
import { CardRarityToColour, CardRarityToString } from "../../constants/CardRarity";
|
||||
import { CardRarityToColour, CardRarityToString, GetSacrificeAmount } from "../../constants/CardRarity";
|
||||
import StringTools from "../StringTools";
|
||||
import CardConstants from "../../constants/CardConstants";
|
||||
|
||||
|
@ -74,12 +74,16 @@ export default class DropEmbedHelper {
|
|||
.addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId(`claim ${drop.card.id} ${claimId} ${userId}`)
|
||||
.setLabel(`Claim (${CardConstants.ClaimCost} 🪙)`)
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
.setLabel("Claim")
|
||||
.setStyle(ButtonStyle.Success)
|
||||
.setDisabled(disabled),
|
||||
new ButtonBuilder()
|
||||
.setCustomId(`sacrifice confirm ${userId} ${drop.card.id} 1`)
|
||||
.setLabel(`Sacrifice`)
|
||||
.setStyle(ButtonStyle.Danger),
|
||||
new ButtonBuilder()
|
||||
.setCustomId("reroll")
|
||||
.setLabel("Reroll")
|
||||
.setStyle(ButtonStyle.Secondary));
|
||||
.setEmoji("🔁")
|
||||
.setStyle(ButtonStyle.Primary),);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue