Merge pull request #286 from argonui/alt-art

DeckImporter: cleaned up code for alt art import
This commit is contained in:
Tikatoy 2023-05-23 15:42:26 -07:00 committed by GitHub
commit 90cfc37a25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -428,45 +428,17 @@ end
---@param card Object Card which needs to be set the state for ---@param card Object Card which needs to be set the state for
---@param loadAltInvestigator String Contains the name of alternative art for the investigator ("normal", "revised" or "promo") ---@param loadAltInvestigator String Contains the name of alternative art for the investigator ("normal", "revised" or "promo")
function loadAltArt(card, loadAltInvestigator) function loadAltArt(card, loadAltInvestigator)
if loadAltInvestigator == "normal" then return end -- states are set up this way:
-- 1 - normal, 2 - revised/promo, 3 - promo (if 2 is revised)
-- lookup correct stateId for investigator and alt art state -- This means we can always load the 2nd state for revised and just get the last state for promo
local baseId = string.gsub(JSON.decode(card.getGMNotes()).id, "-m", "") if loadAltInvestigator == "normal" then
return
local stateIdTable = {} elseif loadAltInvestigator == "revised" then
-- Roland Banks card.setState(2)
stateIdTable["01001"] = {} elseif loadAltInvestigator == "promo" then
stateIdTable["01001"]["revised"] = 2 local states = card.getStates()
stateIdTable["01001"]["promo"] = 3 card.setState(#states)
-- Daisy Walker end
stateIdTable["01002"] = {}
stateIdTable["01002"]["revised"] = 2
-- "Skids" O'Toole
stateIdTable["01003"] = {}
stateIdTable["01003"]["revised"] = 2
-- Agnes Baker
stateIdTable["01004"] = {}
stateIdTable["01004"]["revised"] = 2
-- Wendy Adams
stateIdTable["01005"] = {}
stateIdTable["01005"]["revised"] = 2
-- Jenny Barnes
stateIdTable["02003"] = {}
stateIdTable["02003"]["promo"] = 2
-- Carolyn Fern
stateIdTable["05001"] = {}
stateIdTable["05001"]["promo"] = 2
-- Dexter Drake
stateIdTable["07004"] = {}
stateIdTable["07004"]["promo"] = 2
-- Silas Marsh
stateIdTable["07005"] = {}
stateIdTable["07005"]["promo"] = 2
-- Norman Withers
stateIdTable["08004"] = {}
stateIdTable["08004"]["promo"] = 2
card.setState(stateIdTable[baseId][loadAltInvestigator])
end end
function log(message) function log(message)