Added Playmat Image Support

Added the ability to import playmat images
This commit is contained in:
Entrox-Licher 2023-08-08 13:22:59 -04:00
parent e4dbbc29fe
commit 2e1ee1b2f8
2 changed files with 16 additions and 4 deletions

View File

@ -47,7 +47,7 @@ local DAMAGE_HORROR_GUIDS = {
}
local chaosBagApi = require("chaosbag/ChaosBagApi")
local playAreaAPI = require("core/PlayAreaApi")
local playAreaApi = require("core/PlayAreaApi")
local deckImporterApi = require("arkhamdb/DeckImporterApi")
local optionPanelApi = require("core/OptionPanelApi")
local blessCurseApi = require("chaosbag/BlessCurseManagerApi")
@ -149,7 +149,7 @@ function createCampaignFromToken(importData)
deckImporterApi.setUiState(importData["decks"])
end
--set investigator count
playAreaAPI.setInvestigatorCount(importData["clueCount"])
playAreaApi.setInvestigatorCount(importData["clueCount"])
--set campaign guide page
if findCampaignGuide() then
Wait.condition(
@ -171,6 +171,7 @@ function createCampaignFromToken(importData)
0.5
)
tourApi.deleteTour()
playAreaApi.updateSurface(importData["playmat"])
broadcastToAll("Campaign successfully imported!", Color.Green)
end
@ -226,9 +227,10 @@ function createCampaignToken(_, playerColor, _)
bag = chaosBagApi.getChaosBagState(),
trauma = traumaValues,
decks = deckImporterApi.getUiState(),
clueCount = playAreaAPI.getInvestigatorCount(),
clueCount = playAreaApi.getInvestigatorCount(),
guide = campaignGuidePage,
options = optionPanelApi.getOptions()
options = optionPanelApi.getOptions(),
playmat = playAreaApi.getSurface()
}
campaignTokenData.GMNotes = JSON.encode(campaignData)
campaignTokenData.Nickname = os.date("%b %d ") .. getObjectFromGUID(campaignBoxGUID).getName() .. " Save"

View File

@ -3,6 +3,8 @@ do
local PLAY_AREA_GUID = "721ba2"
local IMAGE_SWAPPER = "b7b45b"
-- Returns the current value of the investigator counter from the playmat
---@return Integer. Number of investigators currently set on the counter
PlayAreaApi.getInvestigatorCount = function()
@ -83,5 +85,13 @@ do
return getObjectFromGUID(PLAY_AREA_GUID).call("isInPlayArea", object)
end
PlayAreaApi.getSurface = function()
return getObjectFromGUID(PLAY_AREA_GUID).getCustomObject().image
end
PlayAreaApi.updateSurface = function(url)
return getObjectFromGUID(IMAGE_SWAPPER).call("updateSurface", url)
end
return PlayAreaApi
end