Added import functionality to deal with trauma, ArkhamDB deck IDs, investigator count, campaign guide page, and options menu settings. Additionally, reduced reliance on scripting zones by adding tags to promote future extensibility.

This commit is contained in:
Jorge Parra 2023-04-05 14:46:52 -04:00
parent 2f46f54e13
commit 240e198df5
79 changed files with 246 additions and 167 deletions

View File

@ -191,9 +191,7 @@
"VictoryDisplay.6ccd6d",
"OptionPanelSource.830bd0",
"CampaignImporterExporter.334ee3",
"ScriptingTrigger.ef3b5f",
"ScriptingTrigger.b6e806",
"ScriptingTrigger.cc3540"
"ScriptingTrigger.ef3b5f"
],
"PlayArea": 1,
"PlayerCounts": [

View File

@ -75,6 +75,10 @@
{
"displayed": "ActionToken",
"normalized": "actiontoken"
},
{
"displayed": "CampaignBox",
"normalized": "campaignbox"
}
]
}

View File

@ -1556,6 +1556,5 @@
"scaleY": 1,
"scaleZ": 1
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -52,6 +52,5 @@
"scaleY": 1,
"scaleZ": 10
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -43,6 +43,5 @@
"scaleY": 0.25,
"scaleZ": 0.25
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -56,6 +56,5 @@
"scaleY": 1,
"scaleZ": 0.8
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -52,6 +52,5 @@
"scaleY": 1,
"scaleZ": 3.38
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -87,6 +87,5 @@
"scaleY": 3,
"scaleZ": 3
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -55,6 +55,5 @@
"scaleY": 1,
"scaleZ": 0.4
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -61,6 +61,5 @@
"scaleY": 0.33,
"scaleZ": 0.33
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -61,6 +61,5 @@
"scaleY": 0.33,
"scaleZ": 0.33
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -61,6 +61,5 @@
"scaleY": 0.33,
"scaleZ": 0.33
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -61,6 +61,5 @@
"scaleY": 0.33,
"scaleZ": 0.33
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -55,6 +55,5 @@
"scaleY": 1,
"scaleZ": 0.26
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -55,6 +55,5 @@
"scaleY": 1,
"scaleZ": 0.26
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -55,6 +55,5 @@
"scaleY": 1,
"scaleZ": 0.26
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -55,6 +55,5 @@
"scaleY": 1,
"scaleZ": 0.26
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -43,6 +43,5 @@
"scaleY": 1,
"scaleZ": 1
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -49,6 +49,9 @@
"Nickname": "Core/Night of the Zealot",
"Snap": true,
"Sticky": true,
"Tags": [
"CampaignBox"
],
"Tooltip": true,
"Transform": {
"posX": 65,
@ -61,6 +64,5 @@
"scaleY": 0.14,
"scaleZ": 1
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -52,6 +52,5 @@
"scaleY": 1,
"scaleZ": 0.26
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -52,6 +52,5 @@
"scaleY": 1,
"scaleZ": 0.26
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -52,6 +52,5 @@
"scaleY": 1,
"scaleZ": 0.26
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -52,6 +52,5 @@
"scaleY": 1,
"scaleZ": 0.26
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -52,6 +52,5 @@
"scaleY": 1,
"scaleZ": 1
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -52,6 +52,5 @@
"scaleY": 1,
"scaleZ": 0.14
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -49,6 +49,9 @@
"Nickname": "Edge of the Earth",
"Snap": true,
"Sticky": true,
"Tags": [
"CampaignBox"
],
"Tooltip": true,
"Transform": {
"posX": 39,
@ -61,6 +64,5 @@
"scaleY": 0.14,
"scaleZ": 1
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -60,6 +60,5 @@
"scaleY": 3,
"scaleZ": 3
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -71,6 +71,5 @@
"scaleY": 0.11,
"scaleZ": 1.49
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -41,6 +41,5 @@
"scaleY": 1.65,
"scaleZ": 1.65
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -6,7 +6,7 @@
},
"Autoraise": true,
"ColorDiffuse": {
"a": 0.25,
"a": 0.75,
"b": 0.168,
"g": 0.701,
"r": 0.192

View File

@ -6,7 +6,7 @@
},
"Autoraise": true,
"ColorDiffuse": {
"a": 0.25,
"a": 0.75,
"b": 0.25,
"g": 0.25,
"r": 0.25

View File

@ -52,6 +52,5 @@
"scaleY": 1,
"scaleZ": 0.26
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -52,6 +52,5 @@
"scaleY": 1,
"scaleZ": 0.26
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -52,6 +52,5 @@
"scaleY": 1,
"scaleZ": 0.26
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -52,6 +52,5 @@
"scaleY": 1,
"scaleZ": 0.26
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -52,6 +52,5 @@
"scaleY": 1,
"scaleZ": 0.3
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -56,6 +56,5 @@
"scaleY": 1,
"scaleZ": 0.95
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -56,6 +56,5 @@
"scaleY": 1,
"scaleZ": 0.95
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -56,6 +56,5 @@
"scaleY": 1,
"scaleZ": 0.95
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -56,6 +56,5 @@
"scaleY": 1,
"scaleZ": 0.95
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -52,6 +52,5 @@
"scaleY": 1,
"scaleZ": 0.4
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -78,6 +78,5 @@
"scaleY": 1,
"scaleZ": 6.5
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -70,6 +70,5 @@
"scaleY": 0.11,
"scaleZ": 1.49
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -55,6 +55,5 @@
"scaleY": 1,
"scaleZ": 0.25
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -237,6 +237,5 @@
"scaleY": 1,
"scaleZ": 1.5
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -989,6 +989,5 @@
"scaleY": 1,
"scaleZ": 10
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -362,6 +362,5 @@
"scaleY": 1,
"scaleZ": 6.43
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -362,6 +362,5 @@
"scaleY": 1,
"scaleZ": 6.43
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -362,6 +362,5 @@
"scaleY": 1,
"scaleZ": 6.43
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -362,6 +362,5 @@
"scaleY": 1,
"scaleZ": 6.43
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -52,6 +52,5 @@
"scaleY": 1,
"scaleZ": 0.5
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -52,6 +52,5 @@
"scaleY": 1,
"scaleZ": 0.26
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -52,6 +52,5 @@
"scaleY": 1,
"scaleZ": 0.26
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -52,6 +52,5 @@
"scaleY": 1,
"scaleZ": 0.26
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -52,6 +52,5 @@
"scaleY": 1,
"scaleZ": 0.26
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -49,6 +49,9 @@
"Nickname": "Return to The Circle Undone",
"Snap": true,
"Sticky": true,
"Tags": [
"CampaignBox"
],
"Tooltip": true,
"Transform": {
"posX": 13,
@ -61,6 +64,5 @@
"scaleY": 0.11,
"scaleZ": 1.69
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -49,6 +49,9 @@
"Nickname": "Return to The Dunwich Legacy",
"Snap": true,
"Sticky": true,
"Tags": [
"CampaignBox"
],
"Tooltip": true,
"Transform": {
"posX": 52,
@ -61,6 +64,5 @@
"scaleY": 0.11,
"scaleZ": 1.69
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -49,6 +49,9 @@
"Nickname": "Return to The Forgotten Age",
"Snap": true,
"Sticky": true,
"Tags": [
"CampaignBox"
],
"Tooltip": true,
"Transform": {
"posX": 26,
@ -61,6 +64,5 @@
"scaleY": 0.11,
"scaleZ": 1.69
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -49,6 +49,9 @@
"Nickname": "Return to The Path to Carcosa",
"Snap": true,
"Sticky": true,
"Tags": [
"CampaignBox"
],
"Tooltip": true,
"Transform": {
"posX": 39,
@ -61,6 +64,5 @@
"scaleY": 0.11,
"scaleZ": 1.69
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -49,6 +49,9 @@
"Nickname": "Return to the Night of the Zealot",
"Snap": true,
"Sticky": true,
"Tags": [
"CampaignBox"
],
"Tooltip": true,
"Transform": {
"posX": 65,
@ -61,6 +64,5 @@
"scaleY": 0.11,
"scaleZ": 1.69
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -52,6 +52,5 @@
"scaleY": 1,
"scaleZ": 4
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -52,6 +52,5 @@
"scaleY": 1,
"scaleZ": 1.35
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -70,6 +70,5 @@
"scaleY": 0.45,
"scaleZ": 0.45
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -49,6 +49,9 @@
"Nickname": "The Circle Undone",
"Snap": true,
"Sticky": true,
"Tags": [
"CampaignBox"
],
"Tooltip": true,
"Transform": {
"posX": 13,
@ -61,6 +64,5 @@
"scaleY": 0.14,
"scaleZ": 1
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -49,6 +49,9 @@
"Nickname": "The Dream-Eaters",
"Snap": true,
"Sticky": true,
"Tags": [
"CampaignBox"
],
"Tooltip": true,
"Transform": {
"posX": 65,
@ -61,6 +64,5 @@
"scaleY": 0.14,
"scaleZ": 1
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -49,6 +49,9 @@
"Nickname": "The Dunwich Legacy",
"Snap": true,
"Sticky": true,
"Tags": [
"CampaignBox"
],
"Tooltip": true,
"Transform": {
"posX": 52,
@ -61,6 +64,5 @@
"scaleY": 0.14,
"scaleZ": 1
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -49,6 +49,9 @@
"Nickname": "The Forgotten Age",
"Snap": true,
"Sticky": true,
"Tags": [
"CampaignBox"
],
"Tooltip": true,
"Transform": {
"posX": 26,
@ -61,6 +64,5 @@
"scaleY": 0.14,
"scaleZ": 1
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -49,6 +49,9 @@
"Nickname": "The Innsmouth Conspiracy",
"Snap": true,
"Sticky": true,
"Tags": [
"CampaignBox"
],
"Tooltip": true,
"Transform": {
"posX": 52,
@ -61,6 +64,5 @@
"scaleY": 0.14,
"scaleZ": 1
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -49,6 +49,9 @@
"Nickname": "The Path to Carcosa",
"Snap": true,
"Sticky": true,
"Tags": [
"CampaignBox"
],
"Tooltip": true,
"Transform": {
"posX": 39,
@ -61,6 +64,5 @@
"scaleY": 0.14,
"scaleZ": 1
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -49,6 +49,9 @@
"Nickname": "The Scarlet Keys",
"Snap": true,
"Sticky": true,
"Tags": [
"CampaignBox"
],
"Tooltip": true,
"Transform": {
"posX": 26,
@ -61,6 +64,5 @@
"scaleY": 0.14,
"scaleZ": 1
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -55,6 +55,5 @@
"scaleY": 1,
"scaleZ": 0.8
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -55,6 +55,5 @@
"scaleY": 1,
"scaleZ": 0.8
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -55,6 +55,5 @@
"scaleY": 1,
"scaleZ": 0.8
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -40,6 +40,5 @@
"scaleY": 0.25,
"scaleZ": 0.25
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -40,6 +40,5 @@
"scaleY": 1,
"scaleZ": 1
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -177,6 +177,5 @@
"scaleY": 1,
"scaleZ": 4.5
},
"Value": 0,
"XmlUI": ""
"Value": 0
}

View File

@ -67,23 +67,25 @@ local campaignTokenData = {
XmlUI = ""
}
-- values for physics.cast
local PHYSICS_POSITION = { -00.0, 2, -27 }
local PHYSICS_ROTATION = 0
local PHYSICS_SCALE = { 05.0, 1, 05.0 }
-- colors and order for following tables
local COLORS = { "White"; "Orange"; "Green"; "Red"; "Agenda" }
-- enable this for debugging
local SHOW_RAYS = false
-- counter GUIDS (4x damage and 4x horror)
local DAMAGE_HORROR_GUIDS = {
"eb08d6"; "e64eec"; "1f5a0a"; "591a45";
"468e88"; "0257d9"; "7b5729"; "beb964";
}
local campaignData = {}
local campaignZone = getObjectFromGUID("b6e806")
local tokenZone = getObjectFromGUID("ef3b5f")
local logZone = getObjectFromGUID("cc3540")
local deckImporter = getObjectFromGUID("a28140")
local investigatorCounter = getObjectFromGUID("f182ee")
local campaignBoxGUID = ""
local traumaValues = false
local deckIds = false
local campaignGuidePage = false
function onLoad(save_state)
self.createButton({
@ -157,15 +159,44 @@ end
function createCampaignFromToken(importData)
findCampaignLog().destruct()
findChaosBag().destruct()
--create campaign log
spawnObjectData({data = importData[2]})
--create chaos bag
spawnObjectData({data = importData[3]})
--populate trauma values
if importData[4] then
updateCounters(importData[4])
end
--populate ArkhamDB deck IDs
if importData[5] then
deckImporter.call("updateDeckIds", importData[5])
end
--set investigator count
investigatorCounter.call("updateVal", importData[6])
--set campaign guide page
if findCampaignGuide() then
Wait.condition(
function()
--log("Campaign Guide import successful!")
end,
function()
findCampaignGuide().Book.setPage(importData[7])
return findCampaignGuide().Book.getPage() == importData[7]
end,
1,
function()
--log("Campaign Guide import failed!")
end
)
end
Global.call("loadSettings", importData[8])
broadcastToAll("Campaign successfully imported!", Color.Green)
end
function createCampaignToken(_, _, _)
local campaignBoxGUID = ""
-- find active campaign
for _, obj in ipairs(campaignZone.getObjects()) do
for _, obj in ipairs(getObjectsWithTag("CampaignBox")) do
if obj.type == "Bag" and #obj.getObjects() == 0 then
campaignBoxGUID = obj.getGUID()
end
@ -176,7 +207,7 @@ function createCampaignToken(_, _, _)
end
local campaignLog = findCampaignLog()
if campaignLog == nil then
broadcastToAll("Campaign log not found in standard position!", Color.Red)
broadcastToAll("Campaign log not found!", Color.Red)
return
end
local chaosBag = findChaosBag()
@ -184,7 +215,36 @@ function createCampaignToken(_, _, _)
broadcastToAll("Chaos bag not found in standard position!", Color.Red)
return
end
campaignData = {campaignBoxGUID, campaignLog.getData(), chaosBag.getData()}
local counterData = campaignLog.getVar("ref_buttonData")
if counterData ~= nil then
traumaValues = {}
printToAll("Trauma values found in campaign log!", "Green")
for i = 1, 10, 3 do
traumaValues[1 + (i - 1) / 3] = counterData.counter[i].value
traumaValues[5 + (i - 1) / 3] = counterData.counter[i + 1].value
end
else
printToAll("Trauma values could not be found in campaign log!", "Yellow")
printToAll("Default values for health and sanity loaded.", "Yellow")
end
deckIds = {deckImporter.getInputs()[1].value, deckImporter.getInputs()[2].value, deckImporter.getInputs()[3].value, deckImporter.getInputs()[4].value}
local campaignGuide = findCampaignGuide()
if campaignGuide == nil then
broadcastToAll("Campaign loguideg not found!", Color.Red)
return
end
local campaignGuidePage = campaignGuide.Book.getPage()
campaignData = {
campaignBoxGUID,
campaignLog.getData(),
chaosBag.getData(),
traumaValues,
deckIds,
investigatorCounter.getVar("val"),
campaignGuidePage,
Global.getTable("optionPanel")
}
campaignTokenData.GMNotes = JSON.encode(campaignData)
campaignTokenData.Nickname = getObjectFromGUID(campaignBoxGUID).getName() .. os.date(" Save: %b %d")
spawnObjectData({
@ -198,12 +258,19 @@ end
-- helper functions
function findCampaignLog()
for _, obj in ipairs(logZone.getObjects()) do
if string.find(obj.getName(), "Campaign Log") ~= nil then
return obj
end
if getObjectsWithTag("CampaignLog") then
return getObjectsWithTag("CampaignLog")[1]
else
return nil
end
end
function findCampaignGuide()
if getObjectsWithTag("CampaignGuide") then
return getObjectsWithTag("CampaignGuide")[1]
else
return nil
end
return nil
end
-- checks scripting zone for chaos bag
function findChaosBag()
@ -213,3 +280,23 @@ function findChaosBag()
end
end
end
function updateCounters(tableOfNewValues)
if tonumber(tableOfNewValues) then
local value = tableOfNewValues
tableOfNewValues = {}
for i = 1, #DAMAGE_HORROR_GUIDS do
table.insert(tableOfNewValues, value)
end
end
for i, guid in ipairs(DAMAGE_HORROR_GUIDS) do
local TOKEN = getObjectFromGUID(guid)
if TOKEN ~= nil then
TOKEN.call("updateVal", tableOfNewValues[i])
else
printToAll(": No. " .. i .. " could not be found.", "Yellow")
end
end
end

View File

@ -154,6 +154,17 @@ function whiteDeckChanged(_, _, inputValue) whiteDeckId = inputValue end
function greenDeckChanged(_, _, inputValue) greenDeckId = inputValue end
function updateDeckIds(idList)
greenDeckId = idList[1]
redDeckId = idList[2]
whiteDeckId = idList[3]
orangeDeckId = idList[4]
self.editInput({index=0, value=greenDeckId})
self.editInput({index=1, value=redDeckId})
self.editInput({index=2, value=whiteDeckId})
self.editInput({index=3, value=orangeDeckId})
end
-- Event handlers for toggle buttons
function publicPrivateChanged()
privateDeck = not privateDeck

View File

@ -964,6 +964,15 @@ function removeHelperObject(name)
end
end
-- loads saved options
function loadSettings(newOptions)
optionPanel = newOptions
updateOptionPanelState()
for id, state in pairs(optionPanel) do
applyOptionPanelChange(id, state)
end
end
-- loads the default options
function onClick_defaultSettings()
for id, _ in pairs(optionPanel) do