More fixes and features to the card-creator #67

Merged
waifu merged 8 commits from card-creator into dev 2025-07-19 21:42:52 -07:00
Showing only changes of commit a248eb4864 - Show all commits

View file

@ -40,6 +40,8 @@
<p>Use this tool to create custom Kemoverse cards! Fill in the details below, upload your art, and generate a card image.</p>
<p>Note: The card ID is generated based on the details, so make sure to fill them out!</p>
<div style="margin-bottom: 0.5rem;">
<input type="checkbox" id="restrictStatsToggle" checked>
@ -51,6 +53,7 @@
<input type="number" id="powerInput" placeholder="⚡ Power" min="0" max="999" style="width: 100%; margin-bottom: 0.5rem;"><br>
<input type="number" id="charmInput" placeholder="❤️ Charm" min="0" max="999" style="width: 100%; margin-bottom: 0.5rem;"><br>
<input type="number" id="witInput" placeholder="💫 Wit" min="0" max="999" style="width: 100%; margin-bottom: 0.5rem;"><br>
<input type="number" id="packIdInput" placeholder="Pack Index" min="0" max="9999" style="width: 100%; margin-bottom: 0.5rem;"><br>
<textarea id="flavorInput" placeholder="Flavor text..." rows="4" style="width: 100%; margin-bottom: 0.5rem;"></textarea><br>
<input type="text" id="artistInput" placeholder="Artist Name" style="width: 100%; margin-bottom: 0.5rem;"><br>
<input type="file" id="uploadArt" style="margin-bottom: 0.5rem;"><br>
@ -62,6 +65,8 @@
<option value="v1_legendary.png">Legendary (250)</option>
</select>
<button id="downloadBtn" onclick="generateCard()">✨ Create Card</button>
<p>PI: Pack Index is used to identify the card within a pack.</p>
<p>SHA: Secure Hash Algorithm is used to generate a unique ID for the card based on its attributes.</p>
<p>All the processing is done in your browser, no data is sent to the server.</p>
</div>
<!-- Right: SVG Card Output -->
@ -209,9 +214,9 @@ function drawCard() {
}
async function drawCardId() {
const id = await generateCardId(packInput.value, nameInput.value, powerInput.value, charmInput.value, witInput.value, artistInput.value);
const id = await generateCardId(packInput.value, nameInput.value, powerInput.value, charmInput.value, witInput.value, artistInput.value,packIdInput.value);
ctx.font = "15px sans-serif";
ctx.fillText("Kemoverse - " + id, canvas.width/2, canvas.height - 30);
ctx.fillText("Kemoverse - SHA: " + id + " - PI:" + packIdInput.value, canvas.width/2, canvas.height - 30);
}
@ -238,7 +243,7 @@ function wrapText(text, x, y, maxWidth, lineHeight) {
}
// Update card live when inputs change
[nameInput, powerInput, charmInput, witInput, flavorInput,packInput,artistInput].forEach(input => {
[nameInput, powerInput, charmInput, witInput, flavorInput, packInput, artistInput, packIdInput].forEach(input => {
input.addEventListener("input", drawCard);
});
@ -306,13 +311,14 @@ jsonBtn.onclick = () => {
const cardData = {
name: nameInput.value,
pack: packInput.value,
pack_id: packIdInput.value,
power: powerInput.value,
charm: charmInput.value,
wit: witInput.value,
flavor: flavorInput.value,
artist: artistInput.value,
frame: frameSelect.value,
id: generateCardId(packInput.value, nameInput.value, powerInput.value, charmInput.value, witInput.value, artistInput.value)
id: generateCardId(packInput.value, nameInput.value, powerInput.value, charmInput.value, witInput.value, artistInput.value, packIdInput.value)
};
const safeName = (nameInput.value || "card").replace(/[^a-z0-9_\-]/gi, "_");
const safePack = (packInput.value || "pack").replace(/[^a-z0-9_\-]/gi, "_");
@ -335,6 +341,7 @@ zipBtn.onclick = async () => {
const cardData = {
name: nameInput.value,
pack: packInput.value,
pack_id: packIdInput.value,
power: powerInput.value,
charm: charmInput.value,
wit: witInput.value,