updated attachment helper
This commit is contained in:
parent
21cbeb220d
commit
3c631c1718
@ -49,6 +49,12 @@ local BACKGROUNDS = {
|
|||||||
fontcolor = { 1, 1, 1 },
|
fontcolor = { 1, 1, 1 },
|
||||||
icons = false
|
icons = false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title = "Hunting Jacket",
|
||||||
|
url = "http://cloud-3.steamusercontent.com/ugc/2450601762292308846/0E171E3F3F0D016EEC574F3CA25738A46D95595C/",
|
||||||
|
fontcolor = { 1, 1, 1 },
|
||||||
|
icons = false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title = "Ikiaq",
|
title = "Ikiaq",
|
||||||
url = "http://cloud-3.steamusercontent.com/ugc/2021606446228198966/5A408D8D760221DEA164E986B9BE1F79C4803071/",
|
url = "http://cloud-3.steamusercontent.com/ugc/2021606446228198966/5A408D8D760221DEA164E986B9BE1F79C4803071/",
|
||||||
@ -110,6 +116,7 @@ function onLoad(savedData)
|
|||||||
printToColor("Show skill icons of cards: " .. tostring(showIcons), color, "White")
|
printToColor("Show skill icons of cards: " .. tostring(showIcons), color, "White")
|
||||||
refresh()
|
refresh()
|
||||||
end)
|
end)
|
||||||
|
self.addContextMenuItem("Draw all cards", function(color) self.deal(self.getQuantity(), color) end)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- gets the font color based on background url
|
-- gets the font color based on background url
|
||||||
@ -232,38 +239,30 @@ end
|
|||||||
|
|
||||||
-- gets cost and icons for a card
|
-- gets cost and icons for a card
|
||||||
function findCard(guid, name, GMNotes)
|
function findCard(guid, name, GMNotes)
|
||||||
local icons = {}
|
|
||||||
local metadata = JSON.decode(GMNotes) or {}
|
local metadata = JSON.decode(GMNotes) or {}
|
||||||
local buttonLabel = name or "unnamed"
|
local buttonLabel = name or "unnamed"
|
||||||
|
local hasIcons = false
|
||||||
|
|
||||||
if metadata.cost then
|
if metadata.cost then
|
||||||
buttonLabel = "[" .. metadata.cost .. "] " .. buttonLabel
|
buttonLabel = "[" .. metadata.cost .. "] " .. buttonLabel
|
||||||
end
|
end
|
||||||
|
|
||||||
if showIcons then
|
if showIcons then
|
||||||
if metadata ~= {} then
|
local iconTypes = { "Wild", "Willpower", "Intellect", "Combat", "Agility" }
|
||||||
icons[1] = metadata.wildIcons
|
for _, iconName in ipairs(iconTypes) do
|
||||||
icons[2] = metadata.willpowerIcons
|
local mdName = string.lower(iconName) .. "Icons"
|
||||||
icons[3] = metadata.intellectIcons
|
if metadata[mdName] ~= nil then
|
||||||
icons[4] = metadata.combatIcons
|
if hasIcons == false then
|
||||||
icons[5] = metadata.agilityIcons
|
|
||||||
end
|
|
||||||
|
|
||||||
local IconTypes = { "Wild", "Willpower", "Intellect", "Combat", "Agility" }
|
|
||||||
local found = false
|
|
||||||
for i = 1, 5 do
|
|
||||||
if icons[i] ~= nil and icons[i] ~= "" then
|
|
||||||
if found == false then
|
|
||||||
buttonLabel = buttonLabel .. "\n"
|
buttonLabel = buttonLabel .. "\n"
|
||||||
found = true
|
hasIcons = true
|
||||||
else
|
else
|
||||||
buttonLabel = buttonLabel .. " "
|
buttonLabel = buttonLabel .. " "
|
||||||
end
|
end
|
||||||
buttonLabel = buttonLabel .. IconTypes[i] .. ": " .. icons[i]
|
buttonLabel = buttonLabel .. iconName .. ": " .. metadata[mdName]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
table.insert(cardsInBag, { buttonLabel = buttonLabel, hasIcons = (#icons > 0), name = name, guid = guid })
|
table.insert(cardsInBag, { buttonLabel = buttonLabel, hasIcons = hasIcons, name = name, guid = guid })
|
||||||
end
|
end
|
||||||
|
|
||||||
-- recreates buttons with up-to-date labels
|
-- recreates buttons with up-to-date labels
|
||||||
|
Loading…
Reference in New Issue
Block a user