Create ability to drop multiple cards in a row #376
3 changed files with 20 additions and 5 deletions
|
@ -16,7 +16,7 @@ export default class Multidrop extends Command {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.CommandBuilder = new SlashCommandBuilder()
|
this.CommandBuilder = new SlashCommandBuilder()
|
||||||
.setName("mutlidrop")
|
.setName("multidrop")
|
||||||
.setDescription("Drop 11 cards for the price of 10!");
|
.setDescription("Drop 11 cards for the price of 10!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,6 +70,18 @@ export default class Multidrop extends Command {
|
||||||
const quantityClaimed = inventory ? inventory.Quantity : 0;
|
const quantityClaimed = inventory ? inventory.Quantity : 0;
|
||||||
|
|
||||||
const embed = CardDropHelperMetadata.GenerateMultidropEmbed(randomCard, quantityClaimed, imageFileName, cardsRemaining, undefined, user.Currency);
|
const embed = CardDropHelperMetadata.GenerateMultidropEmbed(randomCard, quantityClaimed, imageFileName, cardsRemaining, undefined, user.Currency);
|
||||||
|
|
||||||
|
const row = CardDropHelperMetadata.GenerateMultidropButtons(randomCard, cardsRemaining, interaction.user.id);
|
||||||
|
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [ embed ],
|
||||||
|
files: [ attachment ],
|
||||||
|
components: [ row ],
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
AppLogger.LogError("Commands/Multidrop", `Error sending next drop for card ${randomCard.card.id}: ${e}`);
|
||||||
|
|
||||||
|
await interaction.editReply(`Unable to send next drop. Please try again, and report this if it keeps happening. (${randomCard.card.id})`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder } from "discord.js";
|
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder } from "discord.js";
|
||||||
import { CardRarity, CardRarityToColour, CardRarityToString } from "../constants/CardRarity";
|
import { CardRarity, CardRarityToColour, CardRarityToString, GetSacrificeAmount } from "../constants/CardRarity";
|
||||||
import CardRarityChances from "../constants/CardRarityChances";
|
import CardRarityChances from "../constants/CardRarityChances";
|
||||||
import { DropResult } from "../contracts/SeriesMetadata";
|
import { DropResult } from "../contracts/SeriesMetadata";
|
||||||
import { CoreClient } from "../client/client";
|
import { CoreClient } from "../client/client";
|
||||||
|
@ -158,16 +158,17 @@ export default class CardDropHelperMetadata {
|
||||||
return dropEmbed;
|
return dropEmbed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GenerateMultidropButtons(drop: DropResult, cardsRemaining: number, disabled = false): ActionRowBuilder<ButtonBuilder> {
|
public static GenerateMultidropButtons(drop: DropResult, cardsRemaining: number, userId: string, disabled = false): ActionRowBuilder<ButtonBuilder> {
|
||||||
return new ActionRowBuilder<ButtonBuilder>()
|
return new ActionRowBuilder<ButtonBuilder>()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`multidrop keep ${drop.card.id} ${cardsRemaining}`)
|
.setCustomId(`multidrop keep ${drop.card.id} ${cardsRemaining} ${userId}`)
|
||||||
.setLabel("Keep")
|
.setLabel("Keep")
|
||||||
.setStyle(ButtonStyle.Primary)
|
.setStyle(ButtonStyle.Primary)
|
||||||
.setDisabled(disabled),
|
.setDisabled(disabled),
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setCustomId(`multidrop sacrifice ${drop.card.id} ${cardsRemaining}`)
|
.setCustomId(`multidrop sacrifice ${drop.card.id} ${cardsRemaining} ${userId}`)
|
||||||
|
.setLabel(`Sacrifice (+${GetSacrificeAmount(drop.card.type)} 🪙)`)
|
||||||
.setStyle(ButtonStyle.Secondary));
|
.setStyle(ButtonStyle.Secondary));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import Gdrivesync from "./commands/gdrivesync";
|
||||||
import Give from "./commands/give";
|
import Give from "./commands/give";
|
||||||
import Id from "./commands/id";
|
import Id from "./commands/id";
|
||||||
import Inventory from "./commands/inventory";
|
import Inventory from "./commands/inventory";
|
||||||
|
import Multidrop from "./commands/multidrop";
|
||||||
import Resync from "./commands/resync";
|
import Resync from "./commands/resync";
|
||||||
import Sacrifice from "./commands/sacrifice";
|
import Sacrifice from "./commands/sacrifice";
|
||||||
import Series from "./commands/series";
|
import Series from "./commands/series";
|
||||||
|
@ -46,6 +47,7 @@ export default class Registry {
|
||||||
CoreClient.RegisterCommand("give", new Give());
|
CoreClient.RegisterCommand("give", new Give());
|
||||||
CoreClient.RegisterCommand("id", new Id());
|
CoreClient.RegisterCommand("id", new Id());
|
||||||
CoreClient.RegisterCommand("inventory", new Inventory());
|
CoreClient.RegisterCommand("inventory", new Inventory());
|
||||||
|
CoreClient.RegisterCommand("multidrop", new Multidrop());
|
||||||
CoreClient.RegisterCommand("resync", new Resync());
|
CoreClient.RegisterCommand("resync", new Resync());
|
||||||
CoreClient.RegisterCommand("sacrifice", new Sacrifice());
|
CoreClient.RegisterCommand("sacrifice", new Sacrifice());
|
||||||
CoreClient.RegisterCommand("series", new Series());
|
CoreClient.RegisterCommand("series", new Series());
|
||||||
|
|
Loading…
Reference in a new issue