42 lines
1.8 KiB
Plaintext
42 lines
1.8 KiB
Plaintext
do
|
|
local DeckImporterApi = {}
|
|
local guidReferenceApi = require("core/GUIDReferenceApi")
|
|
|
|
local function getDeckImporter()
|
|
return guidReferenceApi.getObjectByOwnerAndType("Mythos", "DeckImporter")
|
|
end
|
|
|
|
-- Returns a table with the full state of the UI, including options and deck IDs.
|
|
-- This can be used to persist via onSave(), or provide values for a load operation
|
|
-- Table values:
|
|
-- redDeck: Deck ID to load for the red player
|
|
-- orangeDeck: Deck ID to load for the orange player
|
|
-- whiteDeck: Deck ID to load for the white player
|
|
-- greenDeck: Deck ID to load for the green player
|
|
-- private: True to load a private deck, false to load a public deck
|
|
-- loadNewest: True if the most upgraded version of the deck should be loaded
|
|
-- investigators: True if investigator cards should be spawned
|
|
DeckImporterApi.getUiState = function()
|
|
local passthroughTable = {}
|
|
for k,v in pairs(getDeckImporter().call("getUiState")) do
|
|
passthroughTable[k] = v
|
|
end
|
|
return passthroughTable
|
|
end
|
|
|
|
-- Updates the state of the UI based on the provided table. Any values not provided will be left the same.
|
|
---@param uiStateTable Table of values to update on importer
|
|
-- Table values:
|
|
-- redDeck: Deck ID to load for the red player
|
|
-- orangeDeck: Deck ID to load for the orange player
|
|
-- whiteDeck: Deck ID to load for the white player
|
|
-- greenDeck: Deck ID to load for the green player
|
|
-- private: True to load a private deck, false to load a public deck
|
|
-- loadNewest: True if the most upgraded version of the deck should be loaded
|
|
-- investigators: True if investigator cards should be spawned
|
|
DeckImporterApi.setUiState = function(uiStateTable)
|
|
return getDeckImporter().call("setUiState", uiStateTable)
|
|
end
|
|
|
|
return DeckImporterApi
|
|
end |