Addressed final PR comments

This commit is contained in:
Entrox-Licher 2023-07-04 12:01:23 -04:00
parent b6d74ac205
commit b4b9e49baf
3 changed files with 18 additions and 4 deletions

View File

@ -22,7 +22,7 @@
"ImageURL": "http://cloud-3.steamusercontent.com/ugc/254843371583173230/BECDC34EB4D2C8C5F9F9933C97085F82A2F21AE3/", "ImageURL": "http://cloud-3.steamusercontent.com/ugc/254843371583173230/BECDC34EB4D2C8C5F9F9933C97085F82A2F21AE3/",
"WidthScale": 0 "WidthScale": 0
}, },
"Description": "Saves the state of the table to enable loading the campaign into a new save and keep all current progress.\n\nThis tool will track which campaign you're playing, the entire contents of your campaign log, the contents of your chaos bag, update your health/sanity according to trauma, your ArkhamDB deck IDs, the number of investigators, the page of your campaign guide, and any options you have selected in the options panel.", "Description": "Saves the state of the table to enable loading the campaign into a new save and keep all current progress.\n\nThis tool will track which campaign you're playing, the entire contents of your campaign log, the contents of your chaos bag, update your health/sanity according to trauma, your ArkhamDB deck IDs, the number of investigators, the page of your campaign guide, and any options you have selected in the options panel.\n\nFor saving trauma values to correct seats, ensure investigators in the campaign log are in the following order: White, Orange, Green, Red\n\n(For custom campaigns, ensure: 1) Campaign Box, Campaign Log, and Campaign Guide each have the corresponding tag, 2)The Campaign Box is on the table when you import or export.",
"DragSelectable": true, "DragSelectable": true,
"GMNotes": "", "GMNotes": "",
"GUID": "334ee3", "GUID": "334ee3",

View File

@ -187,6 +187,10 @@ function createCampaignToken(_, playerColor, _)
-- find active campaign -- find active campaign
for _, obj in ipairs(getObjectsWithTag("CampaignBox")) do for _, obj in ipairs(getObjectsWithTag("CampaignBox")) do
if obj.type == "Bag" and #obj.getObjects() == 0 then if obj.type == "Bag" and #obj.getObjects() == 0 then
if campaignBoxGUID ~= "" then
broadcastToAll("Multiple empty campaign box detected; delete all but one.", Color.Red)
return
end
campaignBoxGUID = obj.getGUID() campaignBoxGUID = obj.getGUID()
end end
end end
@ -226,7 +230,7 @@ function createCampaignToken(_, playerColor, _)
decks = deckImporterApi.getUiState(), decks = deckImporterApi.getUiState(),
clueCount = playAreaAPI.getInvestigatorCount(), clueCount = playAreaAPI.getInvestigatorCount(),
guide = campaignGuidePage, guide = campaignGuidePage,
options = optionPanelApi.getOptionPanel() options = optionPanelApi.getOptions()
} }
campaignTokenData.GMNotes = JSON.encode(campaignData) campaignTokenData.GMNotes = JSON.encode(campaignData)
campaignTokenData.Nickname = os.date("%b %d ") .. getObjectFromGUID(campaignBoxGUID).getName() .. " Save" campaignTokenData.Nickname = os.date("%b %d ") .. getObjectFromGUID(campaignBoxGUID).getName() .. " Save"
@ -242,7 +246,12 @@ end
function findCampaignLog() function findCampaignLog()
if getObjectsWithTag("CampaignLog") then if getObjectsWithTag("CampaignLog") then
if #getObjectsWithTag("CampaignLog") == 1 then
return getObjectsWithTag("CampaignLog")[1] return getObjectsWithTag("CampaignLog")[1]
else
broadcastToAll("More than 1 campaign log detected; delete all but one.", Color.Red)
return nil
end
else else
return nil return nil
end end
@ -250,7 +259,12 @@ end
function findCampaignGuide() function findCampaignGuide()
if getObjectsWithTag("CampaignGuide") then if getObjectsWithTag("CampaignGuide") then
return getObjectsWithTag("CampaignGuide")[1] if #getObjectsWithTag("CampaignGuide") == 1 then
return getObjectsWithTag("CampaignGuide")[1]
else
broadcastToAll("More than 1 campaign guide detected; delete all but one.", Color.Red)
return nil
end
else else
return nil return nil
end end

View File

@ -8,7 +8,7 @@ do
end end
-- returns option panel table -- returns option panel table
OptionPanelApi.getOptionPanel = function() OptionPanelApi.getOptions = function()
return Global.getTable("optionPanel") return Global.getTable("optionPanel")
end end