added signature detection

This commit is contained in:
Chr1Z93 2024-08-08 21:25:30 +02:00
parent fd93df1996
commit 56e1746f54

View File

@ -4,6 +4,7 @@ local guidReferenceApi = require("core/GUIDReferenceApi")
local cardIdIndex = {} local cardIdIndex = {}
local classAndLevelIndex = {} local classAndLevelIndex = {}
local customInvestigatorData = {} local customInvestigatorData = {}
local customSignatureDict = {}
local basicWeaknessList = {} local basicWeaknessList = {}
local uniqueWeaknessList = {} local uniqueWeaknessList = {}
local cycleIndex = {} local cycleIndex = {}
@ -66,6 +67,7 @@ function clearIndexes()
classAndLevelIndex = {} classAndLevelIndex = {}
cycleIndex = {} cycleIndex = {}
customInvestigatorData = {} customInvestigatorData = {}
customSignatureDict = {}
basicWeaknessList = {} basicWeaknessList = {}
uniqueWeaknessList = {} uniqueWeaknessList = {}
end end
@ -237,6 +239,16 @@ function buildSupplementalIndexes()
if card.metadata.type == "Investigator" then if card.metadata.type == "Investigator" then
writeToNestedTable(customInvestigatorData, "InvestigatorGroup", cardId) writeToNestedTable(customInvestigatorData, "InvestigatorGroup", cardId)
writeToNestedTable(customInvestigatorData, "InvestigatorSubdata", cardId, "cards", cardId) writeToNestedTable(customInvestigatorData, "InvestigatorSubdata", cardId, "cards", cardId)
-- read the signatures
if card.metadata.signatures then
for sigId, sigCount in pairs(card.metadata.signatures[1]) do
customSignatureDict[sigId] = true
for i = 1, sigCount do
writeToNestedTable(customInvestigatorData, "InvestigatorSubdata", cardId, "signatures", sigId)
end
end
end
elseif card.metadata.type == "Minicard" then elseif card.metadata.type == "Minicard" then
local parentId = getParentId(cardId) local parentId = getParentId(cardId)
writeToNestedTable(customInvestigatorData, "InvestigatorSubdata", parentId, "minicards", cardId) writeToNestedTable(customInvestigatorData, "InvestigatorSubdata", parentId, "minicards", cardId)
@ -387,8 +399,8 @@ function getCardsByCycle(params)
local cardList = {} local cardList = {}
for _, id in ipairs(cycleData) do for _, id in ipairs(cycleData) do
local md = cardIdIndex[id].metadata local md = cardIdIndex[id].metadata
-- only include cards without level if requested (don't include investigators / minicards though) -- only include cards without level if requested (don't include investigators / minicards / signatures though)
if (md.level or params.includeNoLevelCards) and md.type ~= "Investigator" and md.type ~= "Minicard" then if (md.level or params.includeNoLevelCards) and md.type ~= "Investigator" and md.type ~= "Minicard" and customSignatureDict[id] ~= true then
table.insert(cardList, id) table.insert(cardList, id)
end end
end end