handle minicard / missing name

This commit is contained in:
Chr1Z93 2024-10-20 13:04:59 +02:00
parent 79bdeff129
commit 3a78375989

View File

@ -76,7 +76,6 @@ function generate(_, playerColor)
-- create the main part of the instructions
local createGallery = false
for _, entry in ipairs(idList) do
-- start a new line and add first part of instruction
table.insert(descriptionParts, "\n- add: " .. entry.id .. " (")
-- maybe add hyperlink to card face
@ -85,7 +84,6 @@ function generate(_, playerColor)
table.insert(descriptionParts, '<a href="' .. entry.face .. '">')
end
-- name of the card
table.insert(descriptionParts, "**" .. entry.name .. "**")
-- maybe close hyperlink
@ -93,7 +91,6 @@ function generate(_, playerColor)
table.insert(descriptionParts, "</a>")
end
-- closing bracket
table.insert(descriptionParts, ")")
-- maybe add hyperlink for back
@ -145,9 +142,10 @@ function getIdFromData(metadata)
end
function addGallery(t)
addedImages = {}
table.insert(t, "\n\n" .. galleryTemplateStart .. "\n")
addedImages = {}
for _, entry in ipairs(idList) do
maybeAddImageToGallery(t, entry)
end
@ -208,12 +206,19 @@ function processCard(cardData, playerColor)
if id then
local cardDetails = {
id = id,
name = cardData.Nickname,
metadata = md,
cardId = math.floor(cardData.CardID % 100),
sideways = cardData["SidewaysCard"]
}
if cardData.Nickname ~= "" then
cardDetails.name = cardData.Nickname
elseif md.type == "Minicard" then
cardDetails.name = "Minicard"
else
cardDetails.name = "-"
end
-- add images unless minicard
if md.type ~= "Minicard" then
local _, customDeckData = next(cardData["CustomDeck"])