SCED/src/arkhamdb/DeckImporterApi.ttslua

36 lines
1.5 KiB
Plaintext
Raw Normal View History

do
local DeckImporterApi = {}
2023-10-18 14:55:38 -04:00
local guidReferenceApi = require("core/GUIDReferenceApi")
local function getDeckImporter()
2023-10-18 14:55:38 -04:00
return guidReferenceApi.getObjectByOwnerAndType("Mythos", "DeckImporter")
end
2023-09-29 07:41:43 -04:00
2024-02-01 20:03:25 -05:00
---@class uiStateTable
---@field redDeck string Deck ID to load for the red player
---@field orangeDeck string Deck ID to load for the orange player
---@field whiteDeck string Deck ID to load for the white player
---@field greenDeck string Deck ID to load for the green player
---@field privateDeck boolean True to load a private deck, false to load a public deck
---@field loadNewest boolean True if the most upgraded version of the deck should be loaded
---@field investigators boolean True if investigator cards should be spawned
-- 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
2024-02-01 20:03:25 -05:00
---@return uiStateTable uiStateTable Contains data about the current UI state
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.
2024-02-01 20:03:25 -05:00
---@return uiStateTable uiStateTable Contains data about the current UI state
DeckImporterApi.setUiState = function(uiStateTable)
return getDeckImporter().call("setUiState", uiStateTable)
end
return DeckImporterApi
end