Card Creator #51

Merged
waifu merged 16 commits from card-creator into dev 2025-07-16 20:04:09 -07:00
Showing only changes of commit 18b1eef26e - Show all commits

View file

@ -72,9 +72,9 @@ const artistInput = document.getElementById("artistInput");
const downloadBtn = document.getElementById("downloadBtn"); const downloadBtn = document.getElementById("downloadBtn");
// Generate a unique ID for the card based on pack and card name // Generate a unique ID for the card based on pack and card name
async function generateCardId(packName, cardName) { async function generateCardId(...args) {
const encoder = new TextEncoder(); const encoder = new TextEncoder();
const data = encoder.encode(packName + ':' + cardName); const data = encoder.encode(args.join(':'));
const hashBuffer = await crypto.subtle.digest('SHA-1', data); const hashBuffer = await crypto.subtle.digest('SHA-1', data);
// Convert hash to hex // Convert hash to hex
@ -130,7 +130,7 @@ function drawCard() {
} }
async function drawCardId() { async function drawCardId() {
const id = await generateCardId(packInput.value, nameInput.value); const id = await generateCardId(packInput.value, nameInput.value, powerInput.value, charmInput.value, witInput.value, artistInput.value);
ctx.font = "15px sans-serif"; ctx.font = "15px sans-serif";
ctx.fillText("KC-" + id, canvas.width/2, canvas.height - 30); ctx.fillText("KC-" + id, canvas.width/2, canvas.height - 30);
} }