Merge branch 'main' into chaos-token-updates

This commit is contained in:
Chr1Z 2023-03-05 03:41:15 +01:00 committed by GitHub
commit 1282c0094c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
86 changed files with 288 additions and 137 deletions

View File

@ -188,7 +188,8 @@
"Decoration-Ammo.b43845",
"Decoration-Ammo.d35ee9",
"ArkhamSCE300-1272023-Page1.f873a8",
"VictoryDisplay.6ccd6d"
"VictoryDisplay.6ccd6d",
"OptionPanelSource.830bd0"
],
"PlayArea": 1,
"PlayerCounts": [

View File

@ -14,22 +14,12 @@
"r": 1
},
"ContainedObjects_order": [
"ChaosBagManager.023240",
"TokenArranger.022907",
"CYOACampaignGuides.e87ea2",
"AttachmentHelper.7f4976",
"ArkhamFantasy-PixelArtMini-Cards.e17c9e",
"jaqenZannsNavigationOverlay.a8affa",
"DrawTokenButtonTooltipRenamer.cc77a8",
"GenericDifficultySelector.8112ff",
"SearchAssistant.17aed0",
"HandHelper.450688",
"DisplacementTool.0f1374",
"LuckyPenny.2ab443",
"Double-SidedResource.bc81cb",
"DescriptivePhaseTracker.b171c8",
"CleanUpHelper.26cf4b",
"CustomPlaymatImages.004fe7",
"CustomDataHelper.2547b3"
],
"ContainedObjects_path": "Fan-MadeAccessories.aa8b38",
@ -53,7 +43,7 @@
"NormalURL": "http://i.imgur.com/0qUEr3W.jpg",
"TypeIndex": 6
},
"Description": "",
"Description": "This barrel contains some miscelleaneous accessories.\n\nAlso take a look at the option panel (gear icon at the bottom right) for more tools.",
"DragSelectable": true,
"GMNotes": "",
"GUID": "aa8b38",

View File

@ -60,7 +60,7 @@
"LayoutGroupSortIndex": 0,
"Locked": true,
"LuaScript": "require(\"core/MythosArea\")",
"LuaScriptState": "[]",
"LuaScriptState": "{\"currentScenario\":\"\",\"tokenData\":[],\"useFrontData\":true}",
"MeasureMovement": false,
"Name": "Custom_Tile",
"Nickname": "Mythos Area",

View File

@ -0,0 +1,64 @@
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"Bag": {
"Order": 0
},
"ColorDiffuse": {
"b": 0,
"g": 0.36652,
"r": 0.70588
},
"ContainedObjects_order": [
"ChaosBagManager.023240",
"TokenArranger.022907",
"CYOACampaignGuides.e87ea2",
"AttachmentHelper.7f4976",
"jaqenZannsNavigationOverlay.a8affa",
"SearchAssistant.17aed0",
"HandHelper.450688",
"DisplacementTool.0f1374",
"CleanUpHelper.26cf4b",
"CustomPlaymatImages.004fe7"
],
"ContainedObjects_path": "OptionPanelSource.830bd0",
"Description": "Contains the objects that are spawnable via option panel",
"DragSelectable": true,
"GMNotes": "",
"GUID": "830bd0",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": true,
"LuaScript": "",
"LuaScriptState": "",
"MaterialIndex": -1,
"MeasureMovement": false,
"MeshIndex": -1,
"Name": "Bag",
"Nickname": "OptionPanel Source",
"Number": 0,
"Snap": true,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": 78,
"posY": 1.006,
"posZ": -4.596,
"rotX": 0,
"rotY": 0,
"rotZ": 0,
"scaleX": 0.75,
"scaleY": 0.75,
"scaleZ": 0.75
},
"Value": 0,
"XmlUI": ""
}

View File

@ -63,8 +63,8 @@
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScriptState_path": "Fan-MadeAccessories.aa8b38/CYOACampaignGuides.e87ea2.luascriptstate",
"LuaScript_path": "Fan-MadeAccessories.aa8b38/CYOACampaignGuides.e87ea2.ttslua",
"LuaScriptState_path": "OptionPanelSource.830bd0/CYOACampaignGuides.e87ea2.luascriptstate",
"LuaScript_path": "OptionPanelSource.830bd0/CYOACampaignGuides.e87ea2.ttslua",
"MaterialIndex": -1,
"MeasureMovement": false,
"MeshIndex": -1,
@ -86,4 +86,4 @@
},
"Value": 0,
"XmlUI": ""
}
}

View File

@ -73,5 +73,5 @@
"scaleZ": 1.5
},
"Value": 0,
"XmlUI_path": "Fan-MadeAccessories.aa8b38/CleanUpHelper.26cf4b.xml"
}
"XmlUI_path": "OptionPanelSource.830bd0/CleanUpHelper.26cf4b.xml"
}

View File

@ -34,7 +34,7 @@
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "require(\"accessories/CustomPlaymatImages\")",
"LuaScriptState_path": "Fan-MadeAccessories.aa8b38/CustomPlaymatImages.004fe7.luascriptstate",
"LuaScriptState_path": "OptionPanelSource.830bd0/CustomPlaymatImages.004fe7.luascriptstate",
"MeasureMovement": false,
"Name": "Custom_Token",
"Nickname": "Custom Playmat Images",
@ -54,4 +54,4 @@
},
"Value": 0,
"XmlUI": ""
}
}

View File

@ -29,7 +29,7 @@
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScriptState": "{\"distance\":15,\"pitch\":75}",
"LuaScript_path": "Fan-MadeAccessories.aa8b38/jaqenZannsNavigationOverlay.a8affa/Custom_Assetbundle.cecc3e.ttslua",
"LuaScript_path": "OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/Custom_Assetbundle.cecc3e.ttslua",
"MeasureMovement": false,
"Name": "Custom_Assetbundle",
"Nickname": "",
@ -49,4 +49,4 @@
},
"Value": 0,
"XmlUI": ""
}
}

View File

@ -33,8 +33,8 @@
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScriptState_path": "Fan-MadeAccessories.aa8b38/jaqenZannsNavigationOverlay.a8affa/jaqenZannsNavigationOverlayTile.0ffbc5.luascriptstate",
"LuaScript_path": "Fan-MadeAccessories.aa8b38/jaqenZannsNavigationOverlay.a8affa/jaqenZannsNavigationOverlayTile.0ffbc5.ttslua",
"LuaScriptState_path": "OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/jaqenZannsNavigationOverlayTile.0ffbc5.luascriptstate",
"LuaScript_path": "OptionPanelSource.830bd0/jaqenZannsNavigationOverlay.a8affa/jaqenZannsNavigationOverlayTile.0ffbc5.ttslua",
"MeasureMovement": false,
"Name": "Custom_Tile",
"Nickname": "jaqenZann's Navigation Overlay Tile",
@ -54,4 +54,4 @@
},
"Value": 0,
"XmlUI": ""
}
}

View File

@ -42,4 +42,4 @@
},
"Value": 0,
"XmlUI": ""
}
}

View File

@ -162,10 +162,10 @@
"Nickname": "Victory Display",
"Snap": false,
"Sticky": true,
"Tooltip": true,
"Tags": [
"CleanUpHelper_ignore"
],
"Tooltip": true,
"Transform": {
"posX": -1.5,
"posY": 1.531,

View File

@ -1,3 +1,5 @@
local mythosAreaApi = require("core/MythosAreaApi")
-- common parameters
local buttonParameters = {}
buttonParameters.function_owner = self
@ -89,10 +91,7 @@ function onLoad(saveState)
end)
-- grab token metadata from mythos area
local mythosArea = getObjectFromGUID("9f334f")
Wait.time(function() mythosArea.call("fireTokenDataChangedEvent") end, 0.5)
Wait.time(layout, 2)
Wait.time(function() onTokenDataChanged(mythosAreaApi.returnTokenData()) end, 0.5)
end
-- delete temporary tokens when destroyed
@ -263,10 +262,10 @@ end
function onTokenDataChanged(parameters)
local tokenData = parameters.tokenData or {}
local currentScenario = parameters.currentScenario or ""
local useFrontData = parameters.useFrontData or "true"
local useFrontData = parameters.useFrontData or true
-- only update if this data is new
local info = currentScenario .. useFrontData
local info = currentScenario .. tostring(useFrontData)
if latestLoad == info then return end
latestLoad = info

View File

@ -13,12 +13,8 @@ do
-- updates the token modifiers with the provided data
---@param tokenData Table Contains the chaos token metadata
TokenArrangerApi.onTokenDataChanged = function(tokenData, currentScenario, useFrontData)
callIfExistent("onTokenDataChanged", {
tokenData = tokenData,
currentScenario = currentScenario,
useFrontData = useFrontData
})
TokenArrangerApi.onTokenDataChanged = function(fullData)
callIfExistent("onTokenDataChanged", fullData)
end
-- deletes already laid out tokens

View File

@ -11,9 +11,6 @@ optionPanel = {}
-- GUID of data helper
DATA_HELPER_GUID = "708279"
-- GUID of fan-made accessories bag (also just called "barrel")
BARREL_GUID = "aa8b38"
-- GUIDs that will not be interactable (e.g. parts of the table)
local NOT_INTERACTABLE = {
"6161b4", -- Decoration-Map
@ -903,15 +900,16 @@ function spawnOrRemoveHelper(state, name, position, rotation)
end
end
-- copies the specified tool (by name) from the barrel
-- copies the specified tool (by name) from the option panel source bag
---@param name String Name of the object that should be copied
---@param position Table Desired position of the object
function spawnHelperObject(name, position, rotation)
local barrel = getObjectFromGUID(BARREL_GUID)
-- error handling for missing barrel
if not barrel then
broadcastToAll("'Barrel' with fan-made accessories could not be found!", "Red")
local sourceBag = getObjectFromGUID("830bd0")
-- error handling for missing sourceBag
if not sourceBag then
broadcastToAll("Option panel source bag could not be found!", "Red")
return
end
@ -922,7 +920,7 @@ function spawnHelperObject(name, position, rotation)
spawnTable.rotation = rotation
end
for _, obj in ipairs(barrel.getData().ContainedObjects) do
for _, obj in ipairs(sourceBag.getData().ContainedObjects) do
if obj["Nickname"] == name then
spawnTable.data = obj
return spawnObjectData(spawnTable)

View File

@ -91,7 +91,17 @@ end
-- fires if the scenario title or the difficulty changes
function fireTokenDataChangedEvent()
tokenArrangerApi.onTokenDataChanged(tokenData, currentScenario, tostring(useFrontData))
local fullData = returnTokenData()
tokenArrangerApi.onTokenDataChanged(fullData)
end
-- returns the chaos token metadata (if provided)
function returnTokenData()
return {
tokenData = tokenData,
currentScenario = currentScenario,
useFrontData = useFrontData
}
end
-- Simple method to check if the given point is in a specified area. Local use only,

View File

@ -0,0 +1,11 @@
do
local MythosAreaApi = {}
local MYTHOS_AREA_GUID = "9f334f"
-- returns the chaos token metadata (if provided through scenario reference card)
MythosAreaApi.returnTokenData = function()
return getObjectFromGUID("9f334f").call("returnTokenData")
end
return MythosAreaApi
end

View File

@ -57,6 +57,7 @@ local locationData
local currentScenario
local missingData = {}
local countedVP = {}
---------------------------------------------------------
-- general code
@ -569,6 +570,9 @@ function countVP()
local cardVP = tonumber(metadata.victory) or 0
if cardVP ~= 0 and not cardHasClues(cardId) then
totalVP = totalVP + cardVP
if cardVP >0 then
table.insert(countedVP, getObjectFromGUID(cardId))
end
end
end
end
@ -617,6 +621,22 @@ function highlightMissingData(state)
end
end
-- highlights all locations in the play area with VP
---@param state Boolean True if highlighting should be enabled
function highlightCountedVP(state)
for i, obj in pairs(countedVP) do
if obj ~= nil then
if state then
obj.highlightOff("Green")
else
obj.highlightOn("Green")
end
else
countedVP[i] = nil
end
end
end
-- rebuilds local snap points (could be useful in the future again)
function buildSnaps()
local upperleft = { x = 1.53, z = -1.09}

View File

@ -66,6 +66,12 @@ do
return getObjectFromGUID(PLAY_AREA_GUID).call("highlightMissingData", state)
end
-- highlights all locations in the play area with VP
---@param state Boolean True if highlighting should be enabled
PlayAreaApi.highlightCountedVP = function(state)
return getObjectFromGUID(PLAY_AREA_GUID).call("highlightCountedVP", state)
end
-- Checks if an object is in the play area (returns true or false)
PlayAreaApi.isInPlayArea = function(object)
return getObjectFromGUID(PLAY_AREA_GUID).call("isInPlayArea", object)

View File

@ -1,8 +1,10 @@
local playAreaApi = require("core/PlayAreaApi")
local pendingCall = false
local messageSent = {}
local currentlyHighlighting = false
local missingData = {}
local countedVP = {}
local highlightMissing = false
local highlightCounted = false
-- button creation when loading the game
function onLoad()
@ -27,7 +29,7 @@ function onLoad()
buttonParameters.position.x = 1.69
self.createButton(buttonParameters)
-- index 3: highlighting button
-- index 3: highlighting button (missing data)
self.createButton({
label = "!",
click_function = "highlightMissingData",
@ -41,6 +43,22 @@ function onLoad()
font_color = { 1, 1, 1 },
position = { x = 1.82, y = 0.06, z = -1.32 }
})
-- index 4: highlighting button (counted VP)
self.createButton({
label = "?",
click_function = "highlightCountedVP",
tooltip = "Enable highlighting of cards with VP.",
function_owner = self,
scale = { 0.15, 0.15, 0.15 },
color = { 0, 1, 0 },
width = 700,
height = 800,
font_size = 700,
font_color = { 1, 1, 1 },
position = { x = 1.5, y = 0.06, z = -1.32 }
})
-- update the display label once
Wait.time(updateCount, 1)
end
@ -121,6 +139,7 @@ end
-- counts the VP in the victory display and request the VP count from the play area
function updateCount()
missingData = {}
countedVP = {}
local victoryPoints = {}
victoryPoints.display = 0
victoryPoints.playArea = playAreaApi.countVP()
@ -131,12 +150,24 @@ function updateCount()
-- check metadata for VP
if obj.tag == "Card" then
victoryPoints.display = victoryPoints.display + getCardVP(obj, JSON.decode(obj.getGMNotes()))
local VP = getCardVP(obj, JSON.decode(obj.getGMNotes()))
victoryPoints.display = victoryPoints.display + VP
if VP > 0 then
table.insert(countedVP, obj)
end
-- handling for stacked cards
elseif obj.tag == "Deck" then
local VP = 0
for _, deepObj in ipairs(obj.getObjects()) do
victoryPoints.display = victoryPoints.display + getCardVP(obj, JSON.decode(deepObj.gm_notes))
local deepVP = getCardVP(obj, JSON.decode(deepObj.gm_notes))
victoryPoints.display = victoryPoints.display + deepVP
if deepVP > 0 then
VP = VP + 1
end
end
if VP > 0 then
table.insert(countedVP, obj)
end
end
end
@ -166,6 +197,9 @@ function getCardVP(obj, notes)
cardVP = tonumber(notes.locationBack.victory)
end
end
if cardVP > 0 then
table.insert(countedVP, obj)
end
else
table.insert(missingData, obj)
end
@ -176,20 +210,40 @@ end
function highlightMissingData()
self.editButton({
index = 3,
tooltip = (currentlyHighlighting and "Enable" or "Disable") ..
tooltip = (highlightMissing and "Enable" or "Disable") ..
" highlighting of cards without metadata (VP on these is not counted)."
})
for _, obj in pairs(missingData) do
if obj ~= nil then
if currentlyHighlighting then
if highlightMissing then
obj.highlightOff("Red")
else
obj.highlightOn("Red")
end
end
end
playAreaApi.highlightMissingData(currentlyHighlighting)
currentlyHighlighting = not currentlyHighlighting
playAreaApi.highlightMissingData(highlightMissing)
highlightMissing = not highlightMissing
end
-- toggles the highlight for objects that were counted
function highlightCountedVP()
self.editButton({
index = 4,
tooltip = (highlightCounted and "Enable" or "Disable") ..
" highlighting of cards with VP."
})
for _, obj in pairs(countedVP) do
if obj ~= nil then
if highlightCounted then
obj.highlightOff("Green")
else
obj.highlightOn("Green")
end
end
end
playAreaApi.highlightCountedVP(highlightCounted)
highlightCounted = not highlightCounted
end
---------------------------------------------------------

View File

@ -205,59 +205,17 @@
</Cell>
</Row>
<!-- Option: show token arranger -->
<!-- Option: show attachment helper -->
<Row class="option-text">
<Cell class="option-text">
<VerticalLayout class="text-column">
<Text class="option-header">Token Arranger</Text>
<Text class="description">See the contents of the chaos bag at a glance! This tool displays a sorted table of the tokens to allow easier guessing of your odds.</Text>
<Text class="option-header">Attachment Helper</Text>
<Text class="description">Provides a card-sized bag for cards that are attached to other cards (e.g. Backpack).</Text>
</VerticalLayout>
</Cell>
<Cell class="option-button">
<Toggle id="showTokenArranger"
onValueChanged="onClick_toggleOption(showTokenArranger)"/>
</Cell>
</Row>
<!-- Option: show clean up helper -->
<Row class="option-text">
<Cell class="option-text">
<VerticalLayout class="text-column">
<Text class="option-header">Clean Up Helper</Text>
<Text class="description">Useful for campaign-play: It resets play areas to allow continuous gameplay in the same savegame.</Text>
</VerticalLayout>
</Cell>
<Cell class="option-button">
<Toggle id="showCleanUpHelper"
onValueChanged="onClick_toggleOption(showCleanUpHelper)"/>
</Cell>
</Row>
<!-- Option: show hand helper -->
<Row class="option-text">
<Cell class="option-text">
<VerticalLayout class="text-column">
<Text class="option-header">Hand Helper</Text>
<Text class="description">Never count your hand cards again! This tool does that for you and additionally enables easy discarding of random cards.</Text>
</VerticalLayout>
</Cell>
<Cell class="option-button">
<Toggle id="showHandHelper"
onValueChanged="onClick_toggleOption(showHandHelper)"/>
</Cell>
</Row>
<!-- Option: show search assistant -->
<Row class="option-text">
<Cell class="option-text">
<VerticalLayout class="text-column">
<Text class="option-header">Search Assistant</Text>
<Text class="description">Quickly search 3, 6, 9 or the top X cards of your deck!</Text>
</VerticalLayout>
</Cell>
<Cell class="option-button">
<Toggle id="showSearchAssistant"
onValueChanged="onClick_toggleOption(showSearchAssistant)"/>
<Toggle id="showAttachmentHelper"
onValueChanged="onClick_toggleOption(showAttachmentHelper)"/>
</Cell>
</Row>
@ -275,45 +233,17 @@
</Cell>
</Row>
<!-- Option: show attachment helper -->
<!-- Option: show clean up helper -->
<Row class="option-text">
<Cell class="option-text">
<VerticalLayout class="text-column">
<Text class="option-header">Attachment Helper</Text>
<Text class="description">Provides a card-sized bag for cards that are attached to other cards (e.g. Backpack).</Text>
<Text class="option-header">Clean Up Helper</Text>
<Text class="description">Useful for campaign-play: It resets play areas to allow continuous gameplay in the same savegame.</Text>
</VerticalLayout>
</Cell>
<Cell class="option-button">
<Toggle id="showAttachmentHelper"
onValueChanged="onClick_toggleOption(showAttachmentHelper)"/>
</Cell>
</Row>
<!-- Option: show navigation overlay -->
<Row class="option-text">
<Cell class="option-text">
<VerticalLayout class="text-column">
<Text class="option-header">Navigation Overlay</Text>
<Text class="description">This enables an overlay for quickly moving the camera to various points on the table.</Text>
</VerticalLayout>
</Cell>
<Cell class="option-button">
<Toggle id="showNavigationOverlay"
onValueChanged="onClick_toggleOption(showNavigationOverlay)"/>
</Cell>
</Row>
<!-- Option: show CYOA campaign guides -->
<Row class="option-text">
<Cell class="option-text">
<VerticalLayout class="text-column">
<Text class="option-header">CYOA Campaign Guides</Text>
<Text class="description">Displays in a "Choose Your Own Adventure" style redesigned campaign guides.</Text>
</VerticalLayout>
</Cell>
<Cell class="option-button">
<Toggle id="showCYOA"
onValueChanged="onClick_toggleOption(showCYOA)"/>
<Toggle id="showCleanUpHelper"
onValueChanged="onClick_toggleOption(showCleanUpHelper)"/>
</Cell>
</Row>
@ -331,6 +261,20 @@
</Cell>
</Row>
<!-- Option: show CYOA campaign guides -->
<Row class="option-text">
<Cell class="option-text">
<VerticalLayout class="text-column">
<Text class="option-header">CYOA Campaign Guides</Text>
<Text class="description">Displays in a "Choose Your Own Adventure" style redesigned campaign guides.</Text>
</VerticalLayout>
</Cell>
<Cell class="option-button">
<Toggle id="showCYOA"
onValueChanged="onClick_toggleOption(showCYOA)"/>
</Cell>
</Row>
<!-- Option: show displacement tool -->
<Row class="option-text">
<Cell class="option-text">
@ -344,6 +288,64 @@
onValueChanged="onClick_toggleOption(showDisplacementTool)"/>
</Cell>
</Row>
<!-- Option: show hand helper -->
<Row class="option-text">
<Cell class="option-text">
<VerticalLayout class="text-column">
<Text class="option-header">Hand Helper</Text>
<Text class="description">Never count your hand cards again! This tool does that for you and additionally enables easy discarding of random cards.</Text>
</VerticalLayout>
</Cell>
<Cell class="option-button">
<Toggle id="showHandHelper"
onValueChanged="onClick_toggleOption(showHandHelper)"/>
</Cell>
</Row>
<!-- Option: show navigation overlay -->
<Row class="option-text">
<Cell class="option-text">
<VerticalLayout class="text-column">
<Text class="option-header">Navigation Overlay</Text>
<Text class="description">This enables an overlay for quickly moving the camera to various points on the table.</Text>
</VerticalLayout>
</Cell>
<Cell class="option-button">
<Toggle id="showNavigationOverlay"
onValueChanged="onClick_toggleOption(showNavigationOverlay)"/>
</Cell>
</Row>
<!-- Option: show search assistant -->
<Row class="option-text">
<Cell class="option-text">
<VerticalLayout class="text-column">
<Text class="option-header">Search Assistant</Text>
<Text class="description">Quickly search 3, 6, 9 or the top X cards of your deck!</Text>
</VerticalLayout>
</Cell>
<Cell class="option-button">
<Toggle id="showSearchAssistant"
onValueChanged="onClick_toggleOption(showSearchAssistant)"/>
</Cell>
</Row>
<!-- Option: show token arranger -->
<Row class="option-text">
<Cell class="option-text">
<VerticalLayout class="text-column">
<Text class="option-header">Token Arranger</Text>
<Text class="description">See the contents of the chaos bag at a glance! This tool displays a sorted table of the tokens to allow easier guessing of your odds.</Text>
</VerticalLayout>
</Cell>
<Cell class="option-button">
<Toggle id="showTokenArranger"
onValueChanged="onClick_toggleOption(showTokenArranger)"/>
</Cell>
</Row>
</TableLayout>
</VerticalScrollView>
</Cell>