const { EmbedBuilder, SlashCommandBuilder, SlashCommandNumberOption, SlashCommandSubcommandBuilder } = require("discord.js"); module.exports = { data: new SlashCommandBuilder() .setName("craftcalculator") .setDescription("Calcula o craft de algum item") .addSubcommand(subcommand => subcommand.setName("flak") .setDescription("Calcula a armadura e durabilidade de uma BP de Flak.") .addNumberOption(option => option.setName("charlvl") .setDescription("Level do char usado para craftar a BP.") .setRequired(true) .setMinValue(1) .setMaxValue(205) ) .addNumberOption(option => option.setName("flakarmor") .setDescription("Armadura da flak.") .setRequired(true) .setMinValue(100) .setMaxValue(496) ) .addNumberOption(option => option.setName("dura") .setDescription("Durabilidade da flak.") .setRequired(true) .setMinValue(100) .setMaxValue(2096) )) .addSubcommand(subcommand => subcommand.setName("sela") .setDescription("Calcula a armadura e durabilidade de uma BP de Flak.") .addNumberOption(option => option.setName("charlvl") .setDescription("Level do char usado para craftar a BP.") .setRequired(true) .setMinValue(100) .setMaxValue(2096) ) .addNumberOption(option => option.setName("armor") .setDescription("Armadura da sela.") .setRequired(true) ) .addNumberOption(option => option.setName("prim") .setDescription("Armadura da sela primitiva") .setRequired(true) )) .addSubcommand(subcommand => subcommand.setName("arma") .setDescription("Calcula a armadura e durabilidade de uma BP de Flak.") .addNumberOption(option => option.setName("charlvl") .setDescription("Level do char usado para craftar a BP.") .setRequired(true) ) .addNumberOption(option => option.setName("dano") .setDescription("Dano da arma.") .setRequired(true) )), async execute(interaction) { const subcommand = options.getSubcommand(); const charlvl = options.getNumber("charlvl"); const flakarmor = options.geNumber("flakarmor"); const armor = options.geNumber("armor"); const damage = options.getNumber("dano"); const prim = options.getNumber("prim"); const dura = options.geNumber("dura"); const craftingSkill = 100 + [(charlvl - 1) * 10] const craftBonusPercentage = (craftingSkill - 100) / 2 const embed = new EmbedBuilder(); embed.setAuthor({ name: 'Sunflower-MusicPlayer', iconURL: 'https://i.imgur.com/Qy2XpGi.png' }) try { switch (subcommand) { case "flak": const posCraftFlakArmor = (flakarmor - 100) * (1 + craftBonusPercentage / 100) const posCraftDurabilidade = (dura - 120) * (1 + craftBonusPercentage / 100) embed .setColor(0x080000) .setDescription("✅│Calculo de Crafting concluido") .addFields( { name: 'Durability', value: `${posCraftDurabilidade}`, inline: true }, { name: 'Flak Armor', value: `${posCraftFlakArmor}`, inline: true }, { name: 'Crafting Bonus Percentage', value: `${craftBonusPercentage}`, inline: true }, ) return interaction.reply({ embeds: [embed], ephemeral: false }) case "sela": const posCraftArmor = (armor - prim) * (1 + craftBonusPercentage / 100) embed .setColor(0x080000) .setDescription("✅│Calculo de Crafting concluido") .addFields( { name: 'Saddle Armor', value: `${posCraftArmor}`, inline: true }, { name: 'Crafting Bonus Percentage', value: `${craftBonusPercentage}`, inline: true }, ) return interaction.reply({ embeds: [embed], ephemeral: false }) case "arma": const posCraftDamage = (damage - 100) * (1 + craftBonusPercentage / 100) embed .setColor(0x080000) .setDescription("✅│Calculo de Crafting concluido") .addFields( { name: 'Weapon Damage', value: `${posCraftDamage}`, inline: true }, { name: 'Crafting Bonus Percentage', value: `${craftBonusPercentage}`, inline: true }, ) return interaction.reply({ embeds: [embed], ephemeral: false }) } } catch (err) { console.log(err); embed.setColor("Red").setDescription("⛔│ Algo deu errado...").setAuthor({ name: 'Sunflower-Error', iconURL: 'https://i.imgur.com/Qy2XpGi.png' }) return interaction.reply({ embeds: [embed], ephemeral: true }); } } }