From 9573350fb79e4cb8ea87ab20e8f559932887f747 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Fri, 12 Jun 2020 10:38:53 -0400 Subject: [PATCH] Add Attack/Defense --- commands/edit-image/yu-gi-oh-gen.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/commands/edit-image/yu-gi-oh-gen.js b/commands/edit-image/yu-gi-oh-gen.js index f6b2c2f7..b052d617 100644 --- a/commands/edit-image/yu-gi-oh-gen.js +++ b/commands/edit-image/yu-gi-oh-gen.js @@ -75,6 +75,20 @@ module.exports = class YuGiOhGenCommand extends Command { min: 1, max: 12 }, + { + key: 'attack', + prompt: 'How much attack should the card have?', + type: 'integer', + min: 0, + max: 9999 + }, + { + key: 'defense', + prompt: 'How much defense should the card have?', + type: 'integer', + min: 0, + max: 9999 + }, { key: 'image', prompt: 'What image would you like to edit?', @@ -85,14 +99,14 @@ module.exports = class YuGiOhGenCommand extends Command { }); } - async run(msg, { name, effect, type, level, image }) { + async run(msg, { name, effect, type, level, attack, defense, image }) { const id = Math.floor(Math.random() * 100000000); const setID = Math.floor(Math.random() * 1000); try { const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'yu-gi-oh-gen', 'base.png')); const atr = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'yu-gi-oh-gen', 'atr.png')); const levelI = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'yu-gi-oh-gen', 'level.png')); - const line = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'yu-gi-oh-gen', 'line.png')) + const line = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'yu-gi-oh-gen', 'line.png')); const { body } = await request.get(image); const data = await loadImage(body); const canvas = createCanvas(base.width, base.height); @@ -119,6 +133,9 @@ module.exports = class YuGiOhGenCommand extends Command { ctx.font = '22px Stone Serif'; ctx.fillText(id.toString().padStart(8, '0'), 37, 1128); ctx.fillText(`XIAO-EN${setID.toString().padStart(3, '0')}`, 572, 850); + ctx.font = '30px Stone Serif'; + ctx.fillText(`ATK/${attack}`, 419, 1076); + ctx.fillText(`DEF/${defense}`, 578, 1076); ctx.drawImage(line, 80, 1073); return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'yu-gi-oh-gen.png' }] }); } catch (err) {