more dynamic references
This commit is contained in:
parent
889f0af13f
commit
c11ef5daba
@ -101,7 +101,7 @@
|
|||||||
"ClueCounter.d86b7c",
|
"ClueCounter.d86b7c",
|
||||||
"MasterClueCounter.4a3aa4",
|
"MasterClueCounter.4a3aa4",
|
||||||
"LegacyAssets.7165a9",
|
"LegacyAssets.7165a9",
|
||||||
"Playarea.721ba2",
|
"PlayArea.721ba2",
|
||||||
"BarkhamHorror.308439",
|
"BarkhamHorror.308439",
|
||||||
"ScriptingTrigger.fb28e1",
|
"ScriptingTrigger.fb28e1",
|
||||||
"ScriptingTrigger.7af2cf",
|
"ScriptingTrigger.7af2cf",
|
||||||
|
@ -72,10 +72,6 @@
|
|||||||
"displayed": "LargeBox",
|
"displayed": "LargeBox",
|
||||||
"normalized": "largebox"
|
"normalized": "largebox"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"displayed": "SoundCube",
|
|
||||||
"normalized": "soundcube"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"displayed": "CampaignBox",
|
"displayed": "CampaignBox",
|
||||||
"normalized": "campaignbox"
|
"normalized": "campaignbox"
|
||||||
|
@ -1575,6 +1575,7 @@
|
|||||||
"LuaScriptState": "",
|
"LuaScriptState": "",
|
||||||
"MaterialIndex": -1,
|
"MaterialIndex": -1,
|
||||||
"MeasureMovement": false,
|
"MeasureMovement": false,
|
||||||
|
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"AllCardsBag\"}",
|
||||||
"MeshIndex": -1,
|
"MeshIndex": -1,
|
||||||
"Name": "Bag",
|
"Name": "Bag",
|
||||||
"Nickname": "All Player Cards",
|
"Nickname": "All Player Cards",
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
"LuaScript": "require(\"arkhamdb/DeckImporterMain\")",
|
"LuaScript": "require(\"arkhamdb/DeckImporterMain\")",
|
||||||
"LuaScriptState_path": "ArkhamDBDeckImporter.a28140.luascriptstate",
|
"LuaScriptState_path": "ArkhamDBDeckImporter.a28140.luascriptstate",
|
||||||
"MeasureMovement": false,
|
"MeasureMovement": false,
|
||||||
|
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"DeckImporter\"}",
|
||||||
"Name": "Custom_Tile",
|
"Name": "Custom_Tile",
|
||||||
"Nickname": "ArkhamDB Deck Importer",
|
"Nickname": "ArkhamDB Deck Importer",
|
||||||
"Snap": false,
|
"Snap": false,
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
"LuaScript": "require(\"core/ActiveInvestigatorCounter\")",
|
"LuaScript": "require(\"core/ActiveInvestigatorCounter\")",
|
||||||
"LuaScriptState": "2",
|
"LuaScriptState": "2",
|
||||||
"MeasureMovement": false,
|
"MeasureMovement": false,
|
||||||
|
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"InvestigatorCounter\"}",
|
||||||
"Name": "Custom_Token",
|
"Name": "Custom_Token",
|
||||||
"Nickname": "Investigator Count",
|
"Nickname": "Investigator Count",
|
||||||
"Snap": true,
|
"Snap": true,
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
"LuaScript": "require(\"core/NavigationOverlayHandler\")",
|
"LuaScript": "require(\"core/NavigationOverlayHandler\")",
|
||||||
"LuaScriptState_path": "NavigationOverlayHandler.797ede.luascriptstate",
|
"LuaScriptState_path": "NavigationOverlayHandler.797ede.luascriptstate",
|
||||||
"MeasureMovement": false,
|
"MeasureMovement": false,
|
||||||
|
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"NavigationOverlayHandler\"}",
|
||||||
"Name": "go_game_piece_black",
|
"Name": "go_game_piece_black",
|
||||||
"Nickname": "Navigation Overlay Handler",
|
"Nickname": "Navigation Overlay Handler",
|
||||||
"Snap": true,
|
"Snap": true,
|
||||||
|
@ -975,7 +975,7 @@
|
|||||||
"MeasureMovement": false,
|
"MeasureMovement": false,
|
||||||
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"PlayArea\"}",
|
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"PlayArea\"}",
|
||||||
"Name": "Custom_Token",
|
"Name": "Custom_Token",
|
||||||
"Nickname": "Playarea",
|
"Nickname": "Play Area",
|
||||||
"Snap": true,
|
"Snap": true,
|
||||||
"Sticky": true,
|
"Sticky": true,
|
||||||
"Tags": [
|
"Tags": [
|
||||||
|
@ -31,13 +31,11 @@
|
|||||||
"LuaScript": "",
|
"LuaScript": "",
|
||||||
"LuaScriptState": "",
|
"LuaScriptState": "",
|
||||||
"MeasureMovement": false,
|
"MeasureMovement": false,
|
||||||
|
"Memo": "{\"matColor\":\"Mythos\",\"type\":\"SoundCube\"}",
|
||||||
"Name": "Custom_Assetbundle",
|
"Name": "Custom_Assetbundle",
|
||||||
"Nickname": "SoundCube",
|
"Nickname": "SoundCube",
|
||||||
"Snap": true,
|
"Snap": true,
|
||||||
"Sticky": true,
|
"Sticky": true,
|
||||||
"Tags": [
|
|
||||||
"SoundCube"
|
|
||||||
],
|
|
||||||
"Tooltip": true,
|
"Tooltip": true,
|
||||||
"Transform": {
|
"Transform": {
|
||||||
"posX": 78,
|
"posX": 78,
|
||||||
|
@ -1,32 +1,11 @@
|
|||||||
do
|
do
|
||||||
local TokenArrangerApi = {}
|
local TokenArrangerApi = {}
|
||||||
|
|
||||||
-- gets the first object that matches the provided information
|
|
||||||
---@param matColor String Color of the playermat
|
|
||||||
---@param type String Object to look for (usually name without spaces)
|
|
||||||
local function getObjectFromMemo(matColor, type)
|
|
||||||
if matColor == nil or type == nil then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
for _, obj in ipairs(getObjects()) do
|
|
||||||
local memo = obj.getMemo()
|
|
||||||
if memo then
|
|
||||||
local decoded = JSON.decode(memo) or {}
|
|
||||||
if decoded.matColor == matColor and decoded.type == type then
|
|
||||||
return obj
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
-- local function to call the token arranger, if it is on the table
|
-- local function to call the token arranger, if it is on the table
|
||||||
---@param functionName String Name of the function to cal
|
---@param functionName String Name of the function to cal
|
||||||
---@param argument Variant Parameter to pass
|
---@param argument Variant Parameter to pass
|
||||||
local function callIfExistent(functionName, argument)
|
local function callIfExistent(functionName, argument)
|
||||||
local tokenArranger = getObjectFromMemo("Mythos", "TokenArranger")
|
local tokenArranger = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "TokenArranger"})
|
||||||
if tokenArranger ~= nil then
|
if tokenArranger ~= nil then
|
||||||
tokenArranger.call(functionName, argument)
|
tokenArranger.call(functionName, argument)
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
do
|
do
|
||||||
local DeckImporterApi = {}
|
local DeckImporterApi = {}
|
||||||
local DECK_IMPORTER_GUID = "a28140"
|
|
||||||
|
|
||||||
-- Returns a table with the full state of the UI, including options and deck IDs.
|
-- Returns a table with the full state of the UI, including options and deck IDs.
|
||||||
-- This can be used to persist via onSave(), or provide values for a load operation
|
-- This can be used to persist via onSave(), or provide values for a load operation
|
||||||
-- Table values:
|
-- Table values:
|
||||||
@ -14,7 +13,8 @@ do
|
|||||||
-- investigators: True if investigator cards should be spawned
|
-- investigators: True if investigator cards should be spawned
|
||||||
DeckImporterApi.getUiState = function()
|
DeckImporterApi.getUiState = function()
|
||||||
local passthroughTable = {}
|
local passthroughTable = {}
|
||||||
for k,v in pairs(getObjectFromGUID(DECK_IMPORTER_GUID).call("getUiState")) do
|
local DeckImporter = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "DeckImporter"})
|
||||||
|
for k,v in pairs(DeckImporter.call("getUiState")) do
|
||||||
passthroughTable[k] = v
|
passthroughTable[k] = v
|
||||||
end
|
end
|
||||||
return passthroughTable
|
return passthroughTable
|
||||||
@ -31,7 +31,8 @@ do
|
|||||||
-- loadNewest: True if the most upgraded version of the deck should be loaded
|
-- loadNewest: True if the most upgraded version of the deck should be loaded
|
||||||
-- investigators: True if investigator cards should be spawned
|
-- investigators: True if investigator cards should be spawned
|
||||||
DeckImporterApi.setUiState = function(uiStateTable)
|
DeckImporterApi.setUiState = function(uiStateTable)
|
||||||
return getObjectFromGUID(DECK_IMPORTER_GUID).call("setUiState", uiStateTable)
|
local DeckImporter = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "DeckImporter"})
|
||||||
|
return DeckImporter.call("setUiState", uiStateTable)
|
||||||
end
|
end
|
||||||
|
|
||||||
return DeckImporterApi
|
return DeckImporterApi
|
||||||
|
@ -1,30 +1,9 @@
|
|||||||
do
|
do
|
||||||
local BlessCurseManagerApi = {}
|
local BlessCurseManagerApi = {}
|
||||||
|
|
||||||
-- gets the first object that matches the provided information
|
|
||||||
---@param matColor String Color of the playermat
|
|
||||||
---@param type String Object to look for (usually name without spaces)
|
|
||||||
local function getObjectFromMemo(matColor, type)
|
|
||||||
if matColor == nil or type == nil then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
for _, obj in ipairs(getObjects()) do
|
|
||||||
local memo = obj.getMemo()
|
|
||||||
if memo then
|
|
||||||
local decoded = JSON.decode(memo) or {}
|
|
||||||
if decoded.matColor == matColor and decoded.type == type then
|
|
||||||
return obj
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
-- removes all taken tokens and resets the counts
|
-- removes all taken tokens and resets the counts
|
||||||
BlessCurseManagerApi.removeTakenTokensAndReset = function()
|
BlessCurseManagerApi.removeTakenTokensAndReset = function()
|
||||||
local BlessCurseManager = getObjectFromMemo("Mythos", "BlessCurseManager")
|
local BlessCurseManager = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "BlessCurseManager"})
|
||||||
Wait.time(function() BlessCurseManager.call("removeTakenTokens", "Bless") end, 0.05)
|
Wait.time(function() BlessCurseManager.call("removeTakenTokens", "Bless") end, 0.05)
|
||||||
Wait.time(function() BlessCurseManager.call("removeTakenTokens", "Curse") end, 0.10)
|
Wait.time(function() BlessCurseManager.call("removeTakenTokens", "Curse") end, 0.10)
|
||||||
Wait.time(function() BlessCurseManager.call("doReset", "White") end, 0.15)
|
Wait.time(function() BlessCurseManager.call("doReset", "White") end, 0.15)
|
||||||
@ -32,30 +11,35 @@ do
|
|||||||
|
|
||||||
-- updates the internal count (called by cards that seal bless/curse tokens)
|
-- updates the internal count (called by cards that seal bless/curse tokens)
|
||||||
BlessCurseManagerApi.sealedToken = function(type, guid)
|
BlessCurseManagerApi.sealedToken = function(type, guid)
|
||||||
getObjectFromMemo("Mythos", "BlessCurseManager").call("sealedToken", { type = type, guid = guid })
|
local BlessCurseManager = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "BlessCurseManager"})
|
||||||
|
BlessCurseManager.call("sealedToken", { type = type, guid = guid })
|
||||||
end
|
end
|
||||||
|
|
||||||
-- updates the internal count (called by cards that seal bless/curse tokens)
|
-- updates the internal count (called by cards that seal bless/curse tokens)
|
||||||
BlessCurseManagerApi.releasedToken = function(type, guid)
|
BlessCurseManagerApi.releasedToken = function(type, guid)
|
||||||
getObjectFromMemo("Mythos", "BlessCurseManager").call("releasedToken", { type = type, guid = guid })
|
local BlessCurseManager = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "BlessCurseManager"})
|
||||||
|
BlessCurseManager.call("releasedToken", { type = type, guid = guid })
|
||||||
end
|
end
|
||||||
|
|
||||||
-- broadcasts the current status for bless/curse tokens
|
-- broadcasts the current status for bless/curse tokens
|
||||||
---@param playerColor String Color of the player to show the broadcast to
|
---@param playerColor String Color of the player to show the broadcast to
|
||||||
BlessCurseManagerApi.broadcastStatus = function(playerColor)
|
BlessCurseManagerApi.broadcastStatus = function(playerColor)
|
||||||
getObjectFromMemo("Mythos", "BlessCurseManager").call("broadcastStatus", playerColor)
|
local BlessCurseManager = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "BlessCurseManager"})
|
||||||
|
BlessCurseManager.call("broadcastStatus", playerColor)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- removes all bless / curse tokens from the chaos bag and play
|
-- removes all bless / curse tokens from the chaos bag and play
|
||||||
---@param playerColor String Color of the player to show the broadcast to
|
---@param playerColor String Color of the player to show the broadcast to
|
||||||
BlessCurseManagerApi.removeAll = function(playerColor)
|
BlessCurseManagerApi.removeAll = function(playerColor)
|
||||||
getObjectFromMemo("Mythos", "BlessCurseManager").call("doRemove", playerColor)
|
local BlessCurseManager = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "BlessCurseManager"})
|
||||||
|
BlessCurseManager.call("doRemove", playerColor)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- adds Wendy's menu to the hovered card (allows sealing of tokens)
|
-- adds Wendy's menu to the hovered card (allows sealing of tokens)
|
||||||
---@param color String Color of the player to show the broadcast to
|
---@param color String Color of the player to show the broadcast to
|
||||||
BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)
|
BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)
|
||||||
getObjectFromMemo("Mythos", "BlessCurseManager").call("addMenuOptions", { playerColor = playerColor, hoveredObject = hoveredObject })
|
local BlessCurseManager = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "BlessCurseManager"})
|
||||||
|
BlessCurseManager.call("addMenuOptions", { playerColor = playerColor, hoveredObject = hoveredObject })
|
||||||
end
|
end
|
||||||
|
|
||||||
return BlessCurseManagerApi
|
return BlessCurseManagerApi
|
||||||
|
@ -170,6 +170,57 @@ function tryObjectEnterContainer(container, object)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- gets the first object that matches the provided information
|
||||||
|
---@param searchParam Table Contains matColor and type to search for
|
||||||
|
function getObjectFromMemo(searchParam)
|
||||||
|
local matColor = searchParam.matColor
|
||||||
|
local type = searchParam.type
|
||||||
|
if matColor == nil or type == nil then return nil end
|
||||||
|
for _, obj in ipairs(getObjects()) do
|
||||||
|
local memo = obj.getMemo()
|
||||||
|
if memo then
|
||||||
|
local decoded = JSON.decode(memo) or {}
|
||||||
|
if decoded.matColor == matColor and decoded.type == type then
|
||||||
|
return obj
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
-- gets all objects that match the provided matcolor
|
||||||
|
---@param matColor String Color of the playermat
|
||||||
|
function getObjectsForMatColor(matColor)
|
||||||
|
if matColor == nil then return nil end
|
||||||
|
local objList = {}
|
||||||
|
for _, obj in ipairs(getObjects()) do
|
||||||
|
local memo = obj.getMemo()
|
||||||
|
if memo then
|
||||||
|
local decoded = JSON.decode(memo) or {}
|
||||||
|
if decoded.matColor == matColor then
|
||||||
|
table.insert(objList, obj)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return objList
|
||||||
|
end
|
||||||
|
|
||||||
|
-- gets all objects that match the provided type
|
||||||
|
---@param type String Object to look for (usually name without spaces)
|
||||||
|
function getObjectForType(type)
|
||||||
|
if type == nil then return nil end
|
||||||
|
for _, obj in ipairs(getObjects()) do
|
||||||
|
local memo = obj.getMemo()
|
||||||
|
if memo then
|
||||||
|
local decoded = JSON.decode(memo) or {}
|
||||||
|
if decoded.type == type then
|
||||||
|
table.insert(objList, obj)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return objList
|
||||||
|
end
|
||||||
|
|
||||||
---------------------------------------------------------
|
---------------------------------------------------------
|
||||||
-- chaos token drawing
|
-- chaos token drawing
|
||||||
---------------------------------------------------------
|
---------------------------------------------------------
|
||||||
@ -963,8 +1014,12 @@ function spawnHelperObject(name, position, rotation, color)
|
|||||||
for _, obj in ipairs(sourceBag.getData().ContainedObjects) do
|
for _, obj in ipairs(sourceBag.getData().ContainedObjects) do
|
||||||
if obj["Nickname"] == name then
|
if obj["Nickname"] == name then
|
||||||
spawnTable.data = obj
|
spawnTable.data = obj
|
||||||
|
|
||||||
-- this set the memo to identify the object at a later point (type = name without spaces)
|
-- this set the memo to identify the object at a later point (type = name without spaces)
|
||||||
spawnTable.data["Memo"] = "{\"matColor\":\"" .. color .. "\",\"type\":\"" .. name:gsub("%s+", "") .. "\"}"
|
if color then
|
||||||
|
spawnTable.data["Memo"] = "{\"matColor\":\"" .. color .. "\",\"type\":\"" .. name:gsub("%s+", "") .. "\"}"
|
||||||
|
end
|
||||||
|
|
||||||
spawnTable.callback_function = function(spawnedObj)
|
spawnTable.callback_function = function(spawnedObj)
|
||||||
Wait.time(function() spawnedObj.setLock(true) end, 2)
|
Wait.time(function() spawnedObj.setLock(true) end, 2)
|
||||||
end
|
end
|
||||||
|
@ -1,21 +1,22 @@
|
|||||||
do
|
do
|
||||||
local NavigationOverlayApi = {}
|
local NavigationOverlayApi = {}
|
||||||
local HANDLER_GUID = "797ede"
|
|
||||||
|
|
||||||
-- Copies the visibility for the Navigation overlay
|
-- Copies the visibility for the Navigation overlay
|
||||||
---@param startColor String Color of the player to copy from
|
---@param startColor String Color of the player to copy from
|
||||||
---@param targetColor String Color of the targeted player
|
---@param targetColor String Color of the targeted player
|
||||||
NavigationOverlayApi.copyVisibility = function(startColor, targetColor)
|
NavigationOverlayApi.copyVisibility = function(startColor, targetColor)
|
||||||
getObjectFromGUID(HANDLER_GUID).call("copyVisibility", {
|
local handler = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "NavigationOverlayHandler"})
|
||||||
|
handler.call("copyVisibility", {
|
||||||
startColor = startColor,
|
startColor = startColor,
|
||||||
targetColor = targetColor
|
targetColor = targetColor
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Changes the Navigation Overlay view ("Full View" --> "Play Areas" --> "Closed" etc.)
|
-- Changes the Navigation Overlay view ("Full View" --> "Play Areas" --> "Closed" etc.)
|
||||||
---@param playerColor String Color of the player to update the visibility for
|
---@param playerColor String Color of the player to update the visibility for
|
||||||
NavigationOverlayApi.cycleVisibility = function(playerColor)
|
NavigationOverlayApi.cycleVisibility = function(playerColor)
|
||||||
getObjectFromGUID(HANDLER_GUID).call("cycleVisibility", playerColor)
|
local handler = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "NavigationOverlayHandler"})
|
||||||
|
handler.call("cycleVisibility", playerColor)
|
||||||
end
|
end
|
||||||
|
|
||||||
return NavigationOverlayApi
|
return NavigationOverlayApi
|
||||||
|
@ -1,18 +1,16 @@
|
|||||||
do
|
do
|
||||||
local PlayAreaApi = { }
|
local PlayAreaApi = { }
|
||||||
local PLAY_AREA_GUID = "721ba2"
|
|
||||||
local INVESTIGATOR_COUNTER_GUID = "f182ee"
|
|
||||||
|
|
||||||
-- Returns the current value of the investigator counter from the playmat
|
-- Returns the current value of the investigator counter from the playmat
|
||||||
---@return Integer. Number of investigators currently set on the counter
|
---@return Integer. Number of investigators currently set on the counter
|
||||||
PlayAreaApi.getInvestigatorCount = function()
|
PlayAreaApi.getInvestigatorCount = function()
|
||||||
return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).getVar("val")
|
return Global.call("getObjectFromMemo", {matColor = "Mythos", type = "InvestigatorCounter"}).getVar("val")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Updates the current value of the investigator counter from the playmat
|
-- Updates the current value of the investigator counter from the playmat
|
||||||
---@param count Number of investigators to set on the counter
|
---@param count Number of investigators to set on the counter
|
||||||
PlayAreaApi.setInvestigatorCount = function(count)
|
PlayAreaApi.setInvestigatorCount = function(count)
|
||||||
return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).call("updateVal", count)
|
return Global.call("getObjectFromMemo", {matColor = "Mythos", type = "InvestigatorCounter"}).call("updateVal", count)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain
|
-- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain
|
||||||
@ -21,85 +19,85 @@ do
|
|||||||
---@param playerColor Color of the player requesting the shift. Used solely to send an error
|
---@param playerColor Color of the player requesting the shift. Used solely to send an error
|
||||||
--- message in the unlikely case that the scripting zone has been deleted
|
--- message in the unlikely case that the scripting zone has been deleted
|
||||||
PlayAreaApi.shiftContentsUp = function(playerColor)
|
PlayAreaApi.shiftContentsUp = function(playerColor)
|
||||||
return getObjectFromGUID(PLAY_AREA_GUID).call("shiftContentsUp", playerColor)
|
return Global.call("getObjectFromMemo", {matColor = "Mythos", type = "PlayArea"}).call("shiftContentsUp", playerColor)
|
||||||
end
|
end
|
||||||
|
|
||||||
PlayAreaApi.shiftContentsDown = function(playerColor)
|
PlayAreaApi.shiftContentsDown = function(playerColor)
|
||||||
return getObjectFromGUID(PLAY_AREA_GUID).call("shiftContentsDown", playerColor)
|
return Global.call("getObjectFromMemo", {matColor = "Mythos", type = "PlayArea"}).call("shiftContentsDown", playerColor)
|
||||||
end
|
end
|
||||||
|
|
||||||
PlayAreaApi.shiftContentsLeft = function(playerColor)
|
PlayAreaApi.shiftContentsLeft = function(playerColor)
|
||||||
return getObjectFromGUID(PLAY_AREA_GUID).call("shiftContentsLeft", playerColor)
|
return Global.call("getObjectFromMemo", {matColor = "Mythos", type = "PlayArea"}).call("shiftContentsLeft", playerColor)
|
||||||
end
|
end
|
||||||
|
|
||||||
PlayAreaApi.shiftContentsRight = function(playerColor)
|
PlayAreaApi.shiftContentsRight = function(playerColor)
|
||||||
return getObjectFromGUID(PLAY_AREA_GUID).call("shiftContentsRight", playerColor)
|
return Global.call("getObjectFromMemo", {matColor = "Mythos", type = "PlayArea"}).call("shiftContentsRight", playerColor)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Reset the play area's tracking of which cards have had tokens spawned.
|
-- Reset the play area's tracking of which cards have had tokens spawned.
|
||||||
PlayAreaApi.resetSpawnedCards = function()
|
PlayAreaApi.resetSpawnedCards = function()
|
||||||
return getObjectFromGUID(PLAY_AREA_GUID).call("resetSpawnedCards")
|
return Global.call("getObjectFromMemo", {matColor = "Mythos", type = "PlayArea"}).call("resetSpawnedCards")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Event to be called when the current scenario has changed.
|
-- Event to be called when the current scenario has changed.
|
||||||
---@param scenarioName Name of the new scenario
|
---@param scenarioName Name of the new scenario
|
||||||
PlayAreaApi.onScenarioChanged = function(scenarioName)
|
PlayAreaApi.onScenarioChanged = function(scenarioName)
|
||||||
getObjectFromGUID(PLAY_AREA_GUID).call("onScenarioChanged", scenarioName)
|
Global.call("getObjectFromMemo", {matColor = "Mythos", type = "PlayArea"}).call("onScenarioChanged", scenarioName)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Sets this playmat's snap points to limit snapping to locations or not.
|
-- Sets this playmat's snap points to limit snapping to locations or not.
|
||||||
-- If matchTypes is false, snap points will be reset to snap all cards.
|
-- If matchTypes is false, snap points will be reset to snap all cards.
|
||||||
---@param matchTypes Boolean Whether snap points should only snap for the matching card types.
|
---@param matchTypes Boolean Whether snap points should only snap for the matching card types.
|
||||||
PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)
|
PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)
|
||||||
getObjectFromGUID(PLAY_AREA_GUID).call("setLimitSnapsByType", matchCardTypes)
|
Global.call("getObjectFromMemo", {matColor = "Mythos", type = "PlayArea"}).call("setLimitSnapsByType", matchCardTypes)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged
|
-- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged
|
||||||
-- cards before they're destroyed by entering the container
|
-- cards before they're destroyed by entering the container
|
||||||
PlayAreaApi.tryObjectEnterContainer = function(container, object)
|
PlayAreaApi.tryObjectEnterContainer = function(container, object)
|
||||||
getObjectFromGUID(PLAY_AREA_GUID).call("tryObjectEnterContainer",
|
Global.call("getObjectFromMemo", {matColor = "Mythos", type = "PlayArea"}).call("tryObjectEnterContainer",
|
||||||
{ container = container, object = object })
|
{ container = container, object = object })
|
||||||
end
|
end
|
||||||
|
|
||||||
-- counts the VP on locations in the play area
|
-- counts the VP on locations in the play area
|
||||||
PlayAreaApi.countVP = function()
|
PlayAreaApi.countVP = function()
|
||||||
return getObjectFromGUID(PLAY_AREA_GUID).call("countVP")
|
return Global.call("getObjectFromMemo", {matColor = "Mythos", type = "PlayArea"}).call("countVP")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- highlights all locations in the play area without metadata
|
-- highlights all locations in the play area without metadata
|
||||||
---@param state Boolean True if highlighting should be enabled
|
---@param state Boolean True if highlighting should be enabled
|
||||||
PlayAreaApi.highlightMissingData = function(state)
|
PlayAreaApi.highlightMissingData = function(state)
|
||||||
return getObjectFromGUID(PLAY_AREA_GUID).call("highlightMissingData", state)
|
return Global.call("getObjectFromMemo", {matColor = "Mythos", type = "PlayArea"}).call("highlightMissingData", state)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- highlights all locations in the play area with VP
|
-- highlights all locations in the play area with VP
|
||||||
---@param state Boolean True if highlighting should be enabled
|
---@param state Boolean True if highlighting should be enabled
|
||||||
PlayAreaApi.highlightCountedVP = function(state)
|
PlayAreaApi.highlightCountedVP = function(state)
|
||||||
return getObjectFromGUID(PLAY_AREA_GUID).call("highlightCountedVP", state)
|
return Global.call("getObjectFromMemo", {matColor = "Mythos", type = "PlayArea"}).call("highlightCountedVP", state)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Checks if an object is in the play area (returns true or false)
|
-- Checks if an object is in the play area (returns true or false)
|
||||||
PlayAreaApi.isInPlayArea = function(object)
|
PlayAreaApi.isInPlayArea = function(object)
|
||||||
return getObjectFromGUID(PLAY_AREA_GUID).call("isInPlayArea", object)
|
return Global.call("getObjectFromMemo", {matColor = "Mythos", type = "PlayArea"}).call("isInPlayArea", object)
|
||||||
end
|
end
|
||||||
|
|
||||||
PlayAreaApi.getSurface = function()
|
PlayAreaApi.getSurface = function()
|
||||||
return getObjectFromGUID(PLAY_AREA_GUID).getCustomObject().image
|
return Global.call("getObjectFromMemo", {matColor = "Mythos", type = "PlayArea"}).getCustomObject().image
|
||||||
end
|
end
|
||||||
|
|
||||||
PlayAreaApi.updateSurface = function(url)
|
PlayAreaApi.updateSurface = function(url)
|
||||||
return getObjectFromGUID(PLAY_AREA_GUID).call("updateSurface", url)
|
return Global.call("getObjectFromMemo", {matColor = "Mythos", type = "PlayArea"}).call("updateSurface", url)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the
|
-- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the
|
||||||
-- data to the local token manager instance.
|
-- data to the local token manager instance.
|
||||||
---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call
|
---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call
|
||||||
PlayAreaApi.updateLocations = function(args)
|
PlayAreaApi.updateLocations = function(args)
|
||||||
getObjectFromGUID(PLAY_AREA_GUID).call("updateLocations", args)
|
Global.call("getObjectFromMemo", {matColor = "Mythos", type = "PlayArea"}).call("updateLocations", args)
|
||||||
end
|
end
|
||||||
|
|
||||||
PlayAreaApi.getCustomDataHelper = function()
|
PlayAreaApi.getCustomDataHelper = function()
|
||||||
return getObjectFromGUID(PLAY_AREA_GUID).getVar("customDataHelper")
|
return Global.call("getObjectFromMemo", {matColor = "Mythos", type = "PlayArea"}).getVar("customDataHelper")
|
||||||
end
|
end
|
||||||
|
|
||||||
return PlayAreaApi
|
return PlayAreaApi
|
||||||
|
@ -9,7 +9,8 @@ do
|
|||||||
}
|
}
|
||||||
|
|
||||||
local function playTriggerEffect(index)
|
local function playTriggerEffect(index)
|
||||||
getObjectsWithTag("SoundCube")[1].AssetBundle.playTriggerEffect(index)
|
local SoundCube = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "SoundCube"})
|
||||||
|
SoundCube.AssetBundle.playTriggerEffect(index)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- plays the by name requested sound
|
-- plays the by name requested sound
|
||||||
|
@ -11,11 +11,10 @@ local highlightMissing = false
|
|||||||
local highlightCounted = false
|
local highlightCounted = false
|
||||||
|
|
||||||
local TRASHCAN
|
local TRASHCAN
|
||||||
local TRASHCAN_GUID = "70b9f6"
|
|
||||||
|
|
||||||
-- button creation when loading the game
|
-- button creation when loading the game
|
||||||
function onLoad()
|
function onLoad()
|
||||||
TRASHCAN = getObjectFromGUID(TRASHCAN_GUID)
|
TRASHCAN = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "Trash"})
|
||||||
|
|
||||||
-- index 0: VP - "Display"
|
-- index 0: VP - "Display"
|
||||||
local buttonParameters = {}
|
local buttonParameters = {}
|
||||||
|
@ -1,18 +1,19 @@
|
|||||||
do
|
do
|
||||||
local VictoryDisplayApi = {}
|
local VictoryDisplayApi = {}
|
||||||
local VD_GUID = "6ccd6d"
|
|
||||||
|
|
||||||
-- triggers an update of the Victory count
|
-- triggers an update of the Victory count
|
||||||
---@param delay Number Delay in seconds after which the update call is executed
|
---@param delay Number Delay in seconds after which the update call is executed
|
||||||
VictoryDisplayApi.update = function(delay)
|
VictoryDisplayApi.update = function(delay)
|
||||||
getObjectFromGUID(VD_GUID).call("startUpdate", delay)
|
local VictoryDisplay = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "VictoryDisplay"})
|
||||||
|
VictoryDisplay.call("startUpdate", delay)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- moves a card to the victory display (in the first empty spot)
|
-- moves a card to the victory display (in the first empty spot)
|
||||||
---@param object Object Object that should be checked and potentially moved
|
---@param object Object Object that should be checked and potentially moved
|
||||||
VictoryDisplayApi.placeCard = function(object)
|
VictoryDisplayApi.placeCard = function(object)
|
||||||
if object ~= nil and object.tag == "Card" then
|
if object ~= nil and object.tag == "Card" then
|
||||||
getObjectFromGUID(VD_GUID).call("placeCard", object)
|
local VictoryDisplay = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "VictoryDisplay"})
|
||||||
|
VictoryDisplay.call("placeCard", object)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,29 +1,31 @@
|
|||||||
do
|
do
|
||||||
local AllCardsBagApi = {}
|
local AllCardsBagApi = {}
|
||||||
local ALL_CARDS_BAG_GUID = "15bb07"
|
|
||||||
|
|
||||||
-- Returns a specific card from the bag, based on ArkhamDB ID
|
-- Returns a specific card from the bag, based on ArkhamDB ID
|
||||||
-- @param table:
|
---@param id table String ID of the card to retrieve
|
||||||
-- id: String ID of the card to retrieve
|
---@return table table
|
||||||
-- @return: If the indexes are still being constructed, an empty table is
|
-- If the indexes are still being constructed, an empty table is
|
||||||
-- returned. Otherwise, a single table with the following fields
|
-- returned. Otherwise, a single table with the following fields
|
||||||
-- cardData: TTS object data, suitable for spawning the card
|
-- cardData: TTS object data, suitable for spawning the card
|
||||||
-- cardMetadata: Table of parsed metadata
|
-- cardMetadata: Table of parsed metadata
|
||||||
AllCardsBagApi.getCardById = function(id)
|
AllCardsBagApi.getCardById = function(id)
|
||||||
return getObjectFromGUID(ALL_CARDS_BAG_GUID).call("getCardById", {id = id})
|
local AllCardsBag = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "AllCardsBag"})
|
||||||
|
return AllCardsBag.call("getCardById", {id = id})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Gets a random basic weakness from the bag. Once a given ID has been returned
|
-- Gets a random basic weakness from the bag. Once a given ID has been returned
|
||||||
-- it will be removed from the list and cannot be selected again until a reload
|
-- it will be removed from the list and cannot be selected again until a reload
|
||||||
-- occurs or the indexes are rebuilt, which will refresh the list to include all
|
-- occurs or the indexes are rebuilt, which will refresh the list to include all
|
||||||
-- weaknesses.
|
-- weaknesses.
|
||||||
-- @return: String ID of the selected weakness.
|
---@return id String ID of the selected weakness.
|
||||||
AllCardsBagApi.getRandomWeaknessId = function()
|
AllCardsBagApi.getRandomWeaknessId = function()
|
||||||
return getObjectFromGUID(ALL_CARDS_BAG_GUID).call("getRandomWeaknessId")
|
local AllCardsBag = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "AllCardsBag"})
|
||||||
|
return AllCardsBag.call("getRandomWeaknessId")
|
||||||
end
|
end
|
||||||
|
|
||||||
AllCardsBagApi.isIndexReady = function()
|
AllCardsBagApi.isIndexReady = function()
|
||||||
return getObjectFromGUID(ALL_CARDS_BAG_GUID).call("isIndexReady")
|
local AllCardsBag = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "AllCardsBag"})
|
||||||
|
return AllCardsBag.call("isIndexReady")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Called by Hotfix bags when they load. If we are still loading indexes, then
|
-- Called by Hotfix bags when they load. If we are still loading indexes, then
|
||||||
@ -32,40 +34,44 @@ do
|
|||||||
-- called once indexing is complete it means the hotfix bag has been added
|
-- called once indexing is complete it means the hotfix bag has been added
|
||||||
-- later, and we should rebuild the index to integrate the hotfix bag.
|
-- later, and we should rebuild the index to integrate the hotfix bag.
|
||||||
AllCardsBagApi.rebuildIndexForHotfix = function()
|
AllCardsBagApi.rebuildIndexForHotfix = function()
|
||||||
return getObjectFromGUID(ALL_CARDS_BAG_GUID).call("rebuildIndexForHotfix")
|
local AllCardsBag = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "AllCardsBag"})
|
||||||
|
return AllCardsBag.call("rebuildIndexForHotfix")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Searches the bag for cards which match the given name and returns a list. Note that this is
|
-- Searches the bag for cards which match the given name and returns a list. Note that this is
|
||||||
-- an O(n) search without index support. It may be slow.
|
-- an O(n) search without index support. It may be slow.
|
||||||
-- @param
|
---@param name String or string fragment to search for names
|
||||||
-- name String or string fragment to search for names
|
---@param exact Boolean Whether the name match should be exact
|
||||||
-- exact Whether the name match should be exact
|
|
||||||
AllCardsBagApi.getCardsByName = function(name, exact)
|
AllCardsBagApi.getCardsByName = function(name, exact)
|
||||||
return getObjectFromGUID(ALL_CARDS_BAG_GUID).call("getCardsByName", {name = name, exact = exact})
|
local AllCardsBag = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "AllCardsBag"})
|
||||||
|
return AllCardsBag.call("getCardsByName", {name = name, exact = exact})
|
||||||
end
|
end
|
||||||
|
|
||||||
AllCardsBagApi.isBagPresent = function()
|
AllCardsBagApi.isBagPresent = function()
|
||||||
return getObjectFromGUID(ALL_CARDS_BAG_GUID) and true
|
local AllCardsBag = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "AllCardsBag"})
|
||||||
|
return AllCardsBag and true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Returns a list of cards from the bag matching a class and level (0 or upgraded)
|
-- Returns a list of cards from the bag matching a class and level (0 or upgraded)
|
||||||
-- @param
|
---@param class String class to retrieve ("Guardian", "Seeker", etc)
|
||||||
-- class: String class to retrieve ("Guardian", "Seeker", etc)
|
---@param upgraded Boolean true for upgraded cards (Level 1-5), false for Level 0
|
||||||
-- upgraded: true for upgraded cards (Level 1-5), false for Level 0
|
---@return: If the indexes are still being constructed, returns an empty table.
|
||||||
-- @return: If the indexes are still being constructed, returns an empty table.
|
|
||||||
-- Otherwise, a list of tables, each with the following fields
|
-- Otherwise, a list of tables, each with the following fields
|
||||||
-- cardData: TTS object data, suitable for spawning the card
|
-- cardData: TTS object data, suitable for spawning the card
|
||||||
-- cardMetadata: Table of parsed metadata
|
-- cardMetadata: Table of parsed metadata
|
||||||
AllCardsBagApi.getCardsByClassAndLevel = function(class, upgraded)
|
AllCardsBagApi.getCardsByClassAndLevel = function(class, upgraded)
|
||||||
return getObjectFromGUID(ALL_CARDS_BAG_GUID).call("getCardsByClassAndLevel", {class = class, upgraded = upgraded})
|
local AllCardsBag = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "AllCardsBag"})
|
||||||
|
return AllCardsBag.call("getCardsByClassAndLevel", {class = class, upgraded = upgraded})
|
||||||
end
|
end
|
||||||
|
|
||||||
AllCardsBagApi.getCardsByCycle = function(cycle)
|
AllCardsBagApi.getCardsByCycle = function(cycle)
|
||||||
return getObjectFromGUID(ALL_CARDS_BAG_GUID).call("getCardsByCycle", cycle)
|
local AllCardsBag = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "AllCardsBag"})
|
||||||
|
return AllCardsBag.call("getCardsByCycle", cycle)
|
||||||
end
|
end
|
||||||
|
|
||||||
AllCardsBagApi.getUniqueWeaknesses = function()
|
AllCardsBagApi.getUniqueWeaknesses = function()
|
||||||
return getObjectFromGUID(ALL_CARDS_BAG_GUID).call("getUniqueWeaknesses")
|
local AllCardsBag = Global.call("getObjectFromMemo", {matColor = "Mythos", type = "AllCardsBag"})
|
||||||
|
return AllCardsBag.call("getUniqueWeaknesses")
|
||||||
end
|
end
|
||||||
|
|
||||||
return AllCardsBagApi
|
return AllCardsBagApi
|
||||||
|
@ -7,7 +7,7 @@ local validCountItemList = {
|
|||||||
["Clue"] = 1,
|
["Clue"] = 1,
|
||||||
[""] = 1
|
[""] = 1
|
||||||
}
|
}
|
||||||
local trashGUID = "70b9f6"
|
local MATCOLOR, TRASH
|
||||||
exposedValue = 0
|
exposedValue = 0
|
||||||
|
|
||||||
function onLoad()
|
function onLoad()
|
||||||
@ -21,6 +21,9 @@ function onLoad()
|
|||||||
font_color = { 0, 0, 0 },
|
font_color = { 0, 0, 0 },
|
||||||
font_size = 2000
|
font_size = 2000
|
||||||
})
|
})
|
||||||
|
-- set MATCOLOR based on memo
|
||||||
|
MATCOLOR = JSON.decode(self.getMemo()).matColor
|
||||||
|
TRASH = Global.call("getObjectFromMemo", {matColor = MATCOLOR, type = "Trash"})
|
||||||
loopID = Wait.time(countItems, 1, -1)
|
loopID = Wait.time(countItems, 1, -1)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -79,7 +82,7 @@ function clueRemovalCoroutine()
|
|||||||
for k = 1, 10 do
|
for k = 1, 10 do
|
||||||
coroutine.yield(0)
|
coroutine.yield(0)
|
||||||
end
|
end
|
||||||
getObjectFromGUID(trashGUID).putObject(entry.hit_object)
|
TRASH.putObject(entry.hit_object)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return 1
|
return 1
|
||||||
|
@ -61,7 +61,7 @@ local ENCOUNTER_DISCARD_POSITION = { x = -3.85, y = 1.5, z = 10.38}
|
|||||||
-- global variable so it can be reset by the Clean Up Helper
|
-- global variable so it can be reset by the Clean Up Helper
|
||||||
activeInvestigatorId = "00000"
|
activeInvestigatorId = "00000"
|
||||||
|
|
||||||
local MATCOLOR, TRASHCAN, STAT_TRACKER, RESOURCE_COUNTER
|
local MATCOLOR, TRASHCAN, STAT_TRACKER, RESOURCE_COUNTER, CLUE_COUNTER, CLUE_CLICKER
|
||||||
local isDrawButtonVisible = false
|
local isDrawButtonVisible = false
|
||||||
|
|
||||||
-- global variable to report "Dream-Enhancing Serum" status
|
-- global variable to report "Dream-Enhancing Serum" status
|
||||||
@ -82,9 +82,11 @@ function onLoad(save_state)
|
|||||||
-- set MATCOLOR based on memo
|
-- set MATCOLOR based on memo
|
||||||
MATCOLOR = JSON.decode(self.getMemo()).matColor
|
MATCOLOR = JSON.decode(self.getMemo()).matColor
|
||||||
|
|
||||||
TRASHCAN = getObjectFromMemo(MATCOLOR, "Trash")
|
TRASHCAN = Global.call("getObjectFromMemo", {matColor = MATCOLOR, type = "Trash"})
|
||||||
STAT_TRACKER = getObjectFromMemo(MATCOLOR, "InvestigatorSkillTracker")
|
STAT_TRACKER = Global.call("getObjectFromMemo", {matColor = MATCOLOR, type = "InvestigatorSkillTracker"})
|
||||||
RESOURCE_COUNTER = getObjectFromMemo(MATCOLOR, "ResourceCounter")
|
RESOURCE_COUNTER = Global.call("getObjectFromMemo", {matColor = MATCOLOR, type = "ResourceCounter"})
|
||||||
|
CLUE_COUNTER = Global.call("getObjectFromMemo", {matColor = MATCOLOR, type = "ClueCounter"})
|
||||||
|
CLUE_CLICKER = Global.call("getObjectFromMemo", {matColor = MATCOLOR, type = "ClickableClueCounter"})
|
||||||
|
|
||||||
-- button creation
|
-- button creation
|
||||||
for i = 1, 6 do
|
for i = 1, 6 do
|
||||||
@ -220,27 +222,6 @@ function round(num, numDecimalPlaces)
|
|||||||
return math.floor(num * mult + 0.5) / mult
|
return math.floor(num * mult + 0.5) / mult
|
||||||
end
|
end
|
||||||
|
|
||||||
-- gets the first object that matches the provided information
|
|
||||||
---@param matColor String Color of the playermat
|
|
||||||
---@param type String Object to look for (usually name without spaces)
|
|
||||||
function getObjectFromMemo(matColor, type)
|
|
||||||
if matColor == nil or type == nil then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
for _, obj in ipairs(getObjects()) do
|
|
||||||
local memo = obj.getMemo()
|
|
||||||
if memo then
|
|
||||||
local decoded = JSON.decode(memo) or {}
|
|
||||||
if decoded.matColor == matColor and decoded.type == type then
|
|
||||||
return obj
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
---------------------------------------------------------
|
---------------------------------------------------------
|
||||||
-- Discard buttons
|
-- Discard buttons
|
||||||
---------------------------------------------------------
|
---------------------------------------------------------
|
||||||
@ -603,7 +584,7 @@ function changeColor(clickedByColor)
|
|||||||
-- show the option dialog for color selection to the player that triggered this
|
-- show the option dialog for color selection to the player that triggered this
|
||||||
Player[clickedByColor].showOptionsDialog("Select a new color:", colorList, _, function(color)
|
Player[clickedByColor].showOptionsDialog("Select a new color:", colorList, _, function(color)
|
||||||
-- update the color of the hand zone
|
-- update the color of the hand zone
|
||||||
local handZone = getObjectFromMemo(MATCOLOR, "HandZone")
|
local handZone = Global.call("getObjectFromMemo", {matColor = MATCOLOR, "HandZone"})
|
||||||
handZone.setValue(color)
|
handZone.setValue(color)
|
||||||
|
|
||||||
-- if the seated player clicked this, reseat him to the new color
|
-- if the seated player clicked this, reseat him to the new color
|
||||||
@ -888,8 +869,6 @@ end
|
|||||||
-- Spawns / destroys a clickable clue counter for this playmat with the correct amount of clues
|
-- Spawns / destroys a clickable clue counter for this playmat with the correct amount of clues
|
||||||
---@param showCounter Boolean Whether the clickable clue counter should be present
|
---@param showCounter Boolean Whether the clickable clue counter should be present
|
||||||
function clickableClues(showCounter)
|
function clickableClues(showCounter)
|
||||||
local CLUE_COUNTER = getObjectFromMemo(MATCOLOR, "ClueCounter")
|
|
||||||
local CLUE_CLICKER = getObjectFromMemo(MATCOLOR, "ClickableClueCounter")
|
|
||||||
local clickerPos = CLUE_CLICKER.getPosition()
|
local clickerPos = CLUE_CLICKER.getPosition()
|
||||||
local clueCount = 0
|
local clueCount = 0
|
||||||
|
|
||||||
@ -925,9 +904,6 @@ end
|
|||||||
|
|
||||||
-- removes all clues (moving tokens to the trash and setting counters to 0)
|
-- removes all clues (moving tokens to the trash and setting counters to 0)
|
||||||
function removeClues()
|
function removeClues()
|
||||||
local CLUE_COUNTER = getObjectFromMemo(MATCOLOR, "ClueCounter")
|
|
||||||
local CLUE_CLICKER = getObjectFromMemo(MATCOLOR, "ClickableClueCounter")
|
|
||||||
|
|
||||||
CLUE_COUNTER.call("removeAllClues")
|
CLUE_COUNTER.call("removeAllClues")
|
||||||
CLUE_CLICKER.call("updateVal", 0)
|
CLUE_CLICKER.call("updateVal", 0)
|
||||||
end
|
end
|
||||||
@ -938,10 +914,8 @@ function getClueCount(useClickableCounters)
|
|||||||
local count = 0
|
local count = 0
|
||||||
|
|
||||||
if useClickableCounters then
|
if useClickableCounters then
|
||||||
local CLUE_CLICKER = getObjectFromMemo(MATCOLOR, "ClickableClueCounter")
|
|
||||||
count = tonumber(CLUE_CLICKER.getVar("val"))
|
count = tonumber(CLUE_CLICKER.getVar("val"))
|
||||||
else
|
else
|
||||||
local CLUE_COUNTER = getObjectFromMemo(MATCOLOR, "ClueCounter")
|
|
||||||
count = tonumber(CLUE_COUNTER.getVar("exposedValue"))
|
count = tonumber(CLUE_COUNTER.getVar("exposedValue"))
|
||||||
end
|
end
|
||||||
return count
|
return count
|
||||||
|
@ -2,27 +2,6 @@ do
|
|||||||
local PlaymatApi = { }
|
local PlaymatApi = { }
|
||||||
local internal = { }
|
local internal = { }
|
||||||
|
|
||||||
-- gets the first object that matches the provided information
|
|
||||||
---@param matColor String Color of the playermat
|
|
||||||
---@param type String Object to look for (usually name without spaces)
|
|
||||||
internal.getObjectFromMemo = function(matColor, type)
|
|
||||||
if matColor == nil or type == nil then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
for _, obj in ipairs(getObjects()) do
|
|
||||||
local memo = obj.getMemo()
|
|
||||||
if memo then
|
|
||||||
local decoded = JSON.decode(memo) or {}
|
|
||||||
if decoded.matColor == matColor and decoded.type == type then
|
|
||||||
return obj
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Returns the color of the by position requested playermat as string
|
-- Returns the color of the by position requested playermat as string
|
||||||
---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat
|
---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat
|
||||||
PlaymatApi.getMatColorByPosition = function(startPos)
|
PlaymatApi.getMatColorByPosition = function(startPos)
|
||||||
@ -44,7 +23,7 @@ do
|
|||||||
-- Returns the color of the player's hand that is seated next to the playermat
|
-- Returns the color of the player's hand that is seated next to the playermat
|
||||||
---@param matColor String Color of the playermat
|
---@param matColor String Color of the playermat
|
||||||
PlaymatApi.getPlayerColor = function(matColor)
|
PlaymatApi.getPlayerColor = function(matColor)
|
||||||
local mat = internal.getObjectFromMemo(matColor, "Playermat")
|
local mat = Global.call("getObjectFromMemo", {matColor = matColor, type = "Playermat"})
|
||||||
return mat.getVar("playerColor")
|
return mat.getVar("playerColor")
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -62,21 +41,21 @@ do
|
|||||||
-- Returns the result of a cast in the specificed playermat's area
|
-- Returns the result of a cast in the specificed playermat's area
|
||||||
---@param matColor String Color of the playermat
|
---@param matColor String Color of the playermat
|
||||||
PlaymatApi.searchPlaymat = function(matColor)
|
PlaymatApi.searchPlaymat = function(matColor)
|
||||||
local mat = internal.getObjectFromMemo(matColor, "Playermat")
|
local mat = Global.call("getObjectFromMemo", {matColor = matColor, type = "Playermat"})
|
||||||
return mat.call("searchAroundSelf")
|
return mat.call("searchAroundSelf")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Returns if there is the card "Dream-Enhancing Serum" on the requested playermat
|
-- Returns if there is the card "Dream-Enhancing Serum" on the requested playermat
|
||||||
---@param matColor String Color of the playermat
|
---@param matColor String Color of the playermat
|
||||||
PlaymatApi.isDES = function(matColor)
|
PlaymatApi.isDES = function(matColor)
|
||||||
local mat = internal.getObjectFromMemo(matColor, "Playermat")
|
local mat = Global.call("getObjectFromMemo", {matColor = matColor, type = "Playermat"})
|
||||||
return mat.getVar("isDES")
|
return mat.getVar("isDES")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Returns the draw deck of the requested playmat
|
-- Returns the draw deck of the requested playmat
|
||||||
---@param matColor String Color of the playermat
|
---@param matColor String Color of the playermat
|
||||||
PlaymatApi.getDrawDeck = function(matColor)
|
PlaymatApi.getDrawDeck = function(matColor)
|
||||||
local mat = internal.getObjectFromMemo(matColor, "Playermat")
|
local mat = Global.call("getObjectFromMemo", {matColor = matColor, type = "Playermat"})
|
||||||
mat.call("getDrawDiscardDecks")
|
mat.call("getDrawDiscardDecks")
|
||||||
return mat.getVar("drawDeck")
|
return mat.getVar("drawDeck")
|
||||||
end
|
end
|
||||||
@ -84,7 +63,7 @@ do
|
|||||||
-- Returns the position of the discard pile of the requested playmat
|
-- Returns the position of the discard pile of the requested playmat
|
||||||
---@param matColor String Color of the playermat
|
---@param matColor String Color of the playermat
|
||||||
PlaymatApi.getDiscardPosition = function(matColor)
|
PlaymatApi.getDiscardPosition = function(matColor)
|
||||||
local mat = internal.getObjectFromMemo(matColor, "Playermat")
|
local mat = Global.call("getObjectFromMemo", {matColor = matColor, type = "Playermat"})
|
||||||
return mat.call("returnGlobalDiscardPosition")
|
return mat.call("returnGlobalDiscardPosition")
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -92,14 +71,14 @@ do
|
|||||||
---@param localPos Table Local position to be transformed
|
---@param localPos Table Local position to be transformed
|
||||||
---@param matColor String Color of the playermat
|
---@param matColor String Color of the playermat
|
||||||
PlaymatApi.transformLocalPosition = function(localPos, matColor)
|
PlaymatApi.transformLocalPosition = function(localPos, matColor)
|
||||||
local mat = internal.getObjectFromMemo(matColor, "Playermat")
|
local mat = Global.call("getObjectFromMemo", {matColor = matColor, type = "Playermat"})
|
||||||
return mat.positionToWorld(localPos)
|
return mat.positionToWorld(localPos)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Returns the rotation of the requested playmat
|
-- Returns the rotation of the requested playmat
|
||||||
---@param matColor String Color of the playermat
|
---@param matColor String Color of the playermat
|
||||||
PlaymatApi.returnRotation = function(matColor)
|
PlaymatApi.returnRotation = function(matColor)
|
||||||
local mat = internal.getObjectFromMemo(matColor, "Playermat")
|
local mat = Global.call("getObjectFromMemo", {matColor = matColor, type = "Playermat"})
|
||||||
return mat.getRotation()
|
return mat.getRotation()
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -107,14 +86,14 @@ do
|
|||||||
---@param matColor String Color of the playermat
|
---@param matColor String Color of the playermat
|
||||||
---@param playerColor String Color of the calling player (for messages)
|
---@param playerColor String Color of the calling player (for messages)
|
||||||
PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)
|
PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)
|
||||||
local mat = internal.getObjectFromMemo(matColor, "Playermat")
|
local mat = Global.call("getObjectFromMemo", {matColor = matColor, type = "Playermat"})
|
||||||
return mat.call("doUpkeepFromHotkey", playerColor)
|
return mat.call("doUpkeepFromHotkey", playerColor)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Returns the active investigator id
|
-- Returns the active investigator id
|
||||||
---@param matColor String Color of the playermat
|
---@param matColor String Color of the playermat
|
||||||
PlaymatApi.returnInvestigatorId = function(matColor)
|
PlaymatApi.returnInvestigatorId = function(matColor)
|
||||||
local mat = internal.getObjectFromMemo(matColor, "Playermat")
|
local mat = Global.call("getObjectFromMemo", {matColor = matColor, type = "Playermat"})
|
||||||
return mat.getVar("activeInvestigatorId")
|
return mat.getVar("activeInvestigatorId")
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -180,7 +159,7 @@ do
|
|||||||
|
|
||||||
-- Returns the resource counter amount for the requested playermat
|
-- Returns the resource counter amount for the requested playermat
|
||||||
PlaymatApi.getResourceCount = function(matColor)
|
PlaymatApi.getResourceCount = function(matColor)
|
||||||
local mat = internal.getObjectFromMemo(matColor, "Playermat")
|
local mat = Global.call("getObjectFromMemo", {matColor = matColor, type = "Playermat"})
|
||||||
return mat.call("getResourceCount")
|
return mat.call("getResourceCount")
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -198,7 +177,7 @@ do
|
|||||||
end
|
end
|
||||||
|
|
||||||
PlaymatApi.updateClueClicker = function(matColor, val)
|
PlaymatApi.updateClueClicker = function(matColor, val)
|
||||||
return internal.getObjectFromMemo(matColor, "ClickableClueCounter").call("updateVal", val)
|
return Global.call("getObjectFromMemo", {matColor = matColor, type = "ClickableClueCounter"}).call("updateVal", val)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Convenience function to look up a mat's object by color, or get all mats.
|
-- Convenience function to look up a mat's object by color, or get all mats.
|
||||||
@ -207,16 +186,16 @@ do
|
|||||||
---@return: Array of playermat objects. If a single mat is requested, will return a single-element
|
---@return: Array of playermat objects. If a single mat is requested, will return a single-element
|
||||||
-- array to simplify processing by consumers.
|
-- array to simplify processing by consumers.
|
||||||
internal.getMatForColor = function(matColor)
|
internal.getMatForColor = function(matColor)
|
||||||
local targetMat = internal.getObjectFromMemo(matColor, "Playermat")
|
local targetMat = Global.call("getObjectFromMemo", {matColor = matColor, type = "Playermat"})
|
||||||
if targetMat != nil then
|
if targetMat != nil then
|
||||||
return { targetMatGuid }
|
return { targetMatGuid }
|
||||||
end
|
end
|
||||||
if matColor == "All" then
|
if matColor == "All" then
|
||||||
return {
|
return {
|
||||||
internal.getObjectFromMemo("White", "Playermat"),
|
Global.call("getObjectFromMemo", {matColor = White, type = "Playermat"}),
|
||||||
internal.getObjectFromMemo("Orange", "Playermat"),
|
Global.call("getObjectFromMemo", {matColor = Orange, type = "Playermat"}),
|
||||||
internal.getObjectFromMemo("Green", "Playermat"),
|
Global.call("getObjectFromMemo", {matColor = Green, type = "Playermat"}),
|
||||||
internal.getObjectFromMemo("Red", "Playermat"),
|
Global.call("getObjectFromMemo", {matColor = Red, type = "Playermat"})
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user