updated documentation

This commit is contained in:
Chr1Z93 2022-12-22 02:28:33 +01:00
parent 1fd6f8bd48
commit 2cc1b7f518

View File

@ -114,10 +114,10 @@ do
-- passes to loadCards to actually spawn the defined deck. -- passes to loadCards to actually spawn the defined deck.
---@param deck ArkhamImportDeck ---@param deck ArkhamImportDeck
---@param playerColor String Color name of the player mat to place this deck on (e.g. "Red") ---@param playerColor String Color name of the player mat to place this deck on (e.g. "Red")
---@param loadNewest Boolean. Whether the newest version of this deck should be loaded ---@param loadNewest Boolean Whether the newest version of this deck should be loaded
---@param loadInvestigators Boolean. Whether investigator cards should be loaded as part of this ---@param loadInvestigators Boolean Whether investigator cards should be loaded as part of this
--- deck --- deck
---@param callback Function. Callback which will be sent the results of this load. Parameters ---@param callback Function Callback which will be sent the results of this load. Parameters
--- to the callback will be: --- to the callback will be:
--- slots Table. A map of card ID to count in the deck --- slots Table. A map of card ID to count in the deck
--- investigatorCode String. ID of the investigator in this deck --- investigatorCode String. ID of the investigator in this deck
@ -160,7 +160,9 @@ do
-- get upgrades for customizable cards -- get upgrades for customizable cards
local meta = deck.meta local meta = deck.meta
local customizations = {} local customizations = {}
if meta then customizations = JSON.decode(deck.meta) end if meta then
customizations = JSON.decode(meta)
end
callback(slots, deck.investigator_code, bondList, customizations, playerColor) callback(slots, deck.investigator_code, bondList, customizations, playerColor)
end end
@ -168,9 +170,9 @@ do
-- Checks to see if the slot list includes the random weakness ID. If it does, -- Checks to see if the slot list includes the random weakness ID. If it does,
-- removes it from the deck and replaces it with the ID of a random basic weakness provided by the -- removes it from the deck and replaces it with the ID of a random basic weakness provided by the
-- all cards bag -- all cards bag
---@param slots The slot list for cards in this deck. Table key is the cardId, value is the number ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number
--- of those cards which will be spawned --- of those cards which will be spawned
---@param playerColor Color name of the player this deck is being loaded for. Used for broadcast ---@param playerColor String Color of the player this deck is being loaded for. Used for broadcast
--- if a weakness is added. --- if a weakness is added.
internal.maybeDrawRandomWeakness = function(slots, playerColor) internal.maybeDrawRandomWeakness = function(slots, playerColor)
local allCardsBag = getObjectFromGUID(configuration.card_bag_guid) local allCardsBag = getObjectFromGUID(configuration.card_bag_guid)
@ -190,8 +192,8 @@ do
end end
-- Adds both the investigator (XXXXX) and minicard (XXXXX-m) slots with one copy each -- Adds both the investigator (XXXXX) and minicard (XXXXX-m) slots with one copy each
---@param deck The processed ArkhamDB deck response ---@param deck Table The processed ArkhamDB deck response
---@param slots The slot list for cards in this deck. Table key is the cardId, value is the ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the
--- number of those cards which will be spawned --- number of those cards which will be spawned
internal.addInvestigatorCards = function(deck, slots) internal.addInvestigatorCards = function(deck, slots)
local investigatorId = deck.investigator_code local investigatorId = deck.investigator_code
@ -215,7 +217,7 @@ do
end end
-- Process the card list looking for the customizable cards, and add their upgrade sheets if needed -- Process the card list looking for the customizable cards, and add their upgrade sheets if needed
---@param slots The slot list for cards in this deck. Table key is the cardId, value is the number ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number
-- of those cards which will be spawned -- of those cards which will be spawned
internal.maybeAddCustomizeUpgradeSheets = function(slots) internal.maybeAddCustomizeUpgradeSheets = function(slots)
local allCardsBag = getObjectFromGUID(configuration.card_bag_guid) local allCardsBag = getObjectFromGUID(configuration.card_bag_guid)
@ -230,7 +232,7 @@ do
-- Process the card list looking for the Summoned Servitor, and add its minicard to the list if -- Process the card list looking for the Summoned Servitor, and add its minicard to the list if
-- needed -- needed
---@param slots The slot list for cards in this deck. Table key is the cardId, value is the number ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number
-- of those cards which will be spawned -- of those cards which will be spawned
internal.maybeAddSummonedServitor = function(slots) internal.maybeAddSummonedServitor = function(slots)
if slots["09080"] ~= nil then if slots["09080"] ~= nil then
@ -240,9 +242,9 @@ do
-- On the Mend should have 1-per-investigator copies set aside, but ArkhamDB always sends 1. Update -- On the Mend should have 1-per-investigator copies set aside, but ArkhamDB always sends 1. Update
-- the count based on the investigator count -- the count based on the investigator count
---@param slots The slot list for cards in this deck. Table key is the cardId, value is the number ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number
-- of those cards which will be spawned -- of those cards which will be spawned
---@param playerColor Color name of the player this deck is being loaded for. Used for broadcast if an error occurs ---@param playerColor String Color of the player this deck is being loaded for. Used for broadcast if an error occurs
internal.maybeAddOnTheMend = function(slots, playerColor) internal.maybeAddOnTheMend = function(slots, playerColor)
if slots["09006"] ~= nil then if slots["09006"] ~= nil then
local investigatorCount = playAreaApi.getInvestigatorCount() local investigatorCount = playAreaApi.getInvestigatorCount()
@ -256,7 +258,7 @@ do
end end
-- Process the slot list and looks for any cards which are bonded to those in the deck. Adds those cards to the slot list. -- Process the slot list and looks for any cards which are bonded to those in the deck. Adds those cards to the slot list.
---@param slots The slot list for cards in this deck. Table key is the cardId, value is the number of those cards which will be spawned ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number of those cards which will be spawned
internal.extractBondedCards = function(slots) internal.extractBondedCards = function(slots)
local allCardsBag = getObjectFromGUID(configuration.card_bag_guid) local allCardsBag = getObjectFromGUID(configuration.card_bag_guid)
-- Create a list of bonded cards first so we don't modify slots while iterating -- Create a list of bonded cards first so we don't modify slots while iterating
@ -281,8 +283,8 @@ do
end end
-- Check the deck for cards on its taboo list. If they're found, replace the entry in the slot with the Taboo id (i.e. "XXXX" becomes "XXXX-t") -- Check the deck for cards on its taboo list. If they're found, replace the entry in the slot with the Taboo id (i.e. "XXXX" becomes "XXXX-t")
---@param tabooId The deck's taboo ID, taken from the deck response taboo_id field. May be nil, indicating that no taboo list should be used ---@param tabooId String The deck's taboo ID, taken from the deck response taboo_id field. May be nil, indicating that no taboo list should be used
---@param slots The slot list for cards in this deck. Table key is the cardId, value is the number of those cards which will be spawned ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number of those cards which will be spawned
internal.checkTaboos = function(tabooId, slots, playerColor) internal.checkTaboos = function(tabooId, slots, playerColor)
if tabooId then if tabooId then
local allCardsBag = getObjectFromGUID(configuration.card_bag_guid) local allCardsBag = getObjectFromGUID(configuration.card_bag_guid)