From 42dc9fa169a43b3fc3d55413e8a9690db3f8733d Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Sat, 6 Jan 2024 21:31:04 -0500 Subject: [PATCH] 3.4.0 --- Arkham SCE.json | 20903 +++++++++++++++------------------------------- 1 file changed, 6869 insertions(+), 14034 deletions(-) diff --git a/Arkham SCE.json b/Arkham SCE.json index 94e6598..52f5ce5 100644 --- a/Arkham SCE.json +++ b/Arkham SCE.json @@ -2,38 +2,57 @@ "CameraStates": [ { "AbsolutePosition": { - "x": -67.59604, - "y": 91.87675, - "z": 5.521103 + "x": -67.6, + "y": 91.88, + "z": 5.52 }, - "Distance": 104.699272, + "Distance": 104, "Position": { - "x": -22.2649822, + "x": -22.26, "y": -2.5, - "z": 5.25747156 + "z": 5.26 }, "Rotation": { - "x": 64.34372, - "y": 90.3332, + "x": 64.34, + "y": 90.33, "z": 0 }, "Zoomed": false }, { "AbsolutePosition": { - "x": -47.7179832, - "y": 86.18371, - "z": -0.000006780735 + "x": -39.1, + "y": 29.7, + "z": 0 }, - "Distance": 97.85165, + "Distance": 29.14, "Position": { - "x": -6.36408234, - "y": -2.5, - "z": -9.483223e-7 + "x": -31.54, + "y": 1.55, + "z": 0 }, "Rotation": { - "x": 64.99999, - "y": 89.99999, + "x": 75, + "y": 90, + "z": 0 + }, + "Zoomed": false + }, + { + "AbsolutePosition": { + "x": -10.16, + "y": 18.95, + "z": 0 + }, + "Distance": 18, + "Position": { + "x": -5.5, + "y": 1.55, + "z": 0 + }, + "Rotation": { + "x": 75, + "y": 90, "z": 0 }, "Zoomed": false @@ -53,10 +72,6 @@ "displayed": "LinkedPhaseTracker", "normalized": "linkedphasetracker" }, - { - "displayed": "chaosBag", - "normalized": "chaosBag" - }, { "displayed": "displacement_excluded", "normalized": "displacement_excluded" @@ -101,10 +116,6 @@ "displayed": "chaosBag", "normalized": "chaosbag" }, - { - "displayed": "arkham_setup_memory_object", - "normalized": "arkham_setup_memory_object" - }, { "displayed": "ActionToken", "normalized": "actiontoken" @@ -113,10 +124,6 @@ "displayed": "LargeBox", "normalized": "largebox" }, - { - "displayed": "SoundCube", - "normalized": "soundcube" - }, { "displayed": "CampaignBox", "normalized": "campaignbox" @@ -124,10 +131,6 @@ { "displayed": "CameraZoom_ignore", "normalized": "camerazoom_ignore" - }, - { - "displayed": "TokenArranger", - "normalized": "tokenarranger" } ] }, @@ -351,9 +354,24 @@ "Name": "FinnIcon", "Type": 0, "URL": "http://cloud-3.steamusercontent.com/ugc/2037357792052848566/5DA900C430E97D3DFF2C9B8A3DB1CB2271791FC7/" + }, + { + "Name": "box-cover-mask-small", + "Type": 0, + "URL": "http://cloud-3.steamusercontent.com/ugc/2115061298536631564/F29C2ED9DD8431A1D1E21C7FFAFF1FFBC0AF0BF3/" + }, + { + "Name": "box-cover-mask-big", + "Type": 0, + "URL": "http://cloud-3.steamusercontent.com/ugc/2115061298536631429/D075D2EECE6EE091AD3BEA5800DEF9C7B02B745B/" + }, + { + "Name": "box-cover-mask-wide", + "Type": 0, + "URL": "http://cloud-3.steamusercontent.com/ugc/2115061298538827369/A20C2ECB8ECDC1B0AD8B2B38F68CA1C1F5E07D37/" } ], - "Date": "Mon Oct 9 14:03:26 CDT 2023", + "Date": "Sat Nov 18 18:06:45 CST 2023", "DecalPallet": [ { "ImageURL": "http://cloud-3.steamusercontent.com/ugc/1474319121424323663/BC5570ECF747F1B30224461B576E8B0FE7FA5F33/", @@ -367,7 +385,7 @@ } ], "Decals": [], - "EpochTime": 1696878206, + "EpochTime": 1700352405, "GameComplexity": "", "GameMode": "Arkham Horror LCG - Super Complete Edition", "GameType": "", @@ -426,8 +444,8 @@ "LutIndex": 0, "ReflectionIntensity": 1 }, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/SoundCubeApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local SoundCubeApi = {}\n\n -- this table links the name of a trigger effect to its index\n local soundIndices = {\n [\"Vacuum\"] = 0,\n [\"Deep Bell\"] = 1,\n [\"Dark Souls\"] = 2\n }\n\n local function playTriggerEffect(index)\n getObjectsWithTag(\"SoundCube\")[1].AssetBundle.playTriggerEffect(index)\n end\n\n -- plays the by name requested sound\n ---@param soundName String Name of the sound to play\n SoundCubeApi.playSoundByName = function(soundName)\n playTriggerEffect(soundIndices[soundName])\n end\n\n return SoundCubeApi\nend\nend)\n__bundle_register(\"core/token/TokenChecker\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local CHAOS_TOKEN_NAMES = {\n [\"Elder Sign\"] = true,\n [\"+1\"] = true,\n [\"0\"] = true,\n [\"-1\"] = true,\n [\"-2\"] = true,\n [\"-3\"] = true,\n [\"-4\"] = true,\n [\"-5\"] = true,\n [\"-6\"] = true,\n [\"-7\"] = true,\n [\"-8\"] = true,\n [\"Skull\"] = true,\n [\"Cultist\"] = true,\n [\"Tablet\"] = true,\n [\"Elder Thing\"] = true,\n [\"Auto-fail\"] = true,\n [\"Bless\"] = true,\n [\"Curse\"] = true,\n [\"Frost\"] = true\n }\n\n local TokenChecker = {}\n\n -- returns true if the passed object is a chaos token (by name)\n TokenChecker.isChaosToken = function(obj)\n if CHAOS_TOKEN_NAMES[obj.getName()] then\n return true\n else\n return false\n end\n end\n\n return TokenChecker\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/Global\")\nend)\n__bundle_register(\"core/Global\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal mythosAreaApi = require(\"core/MythosAreaApi\")\nlocal navigationOverlayApi = require(\"core/NavigationOverlayApi\")\nlocal playAreaApi = require(\"core/PlayAreaApi\")\nlocal playmatApi = require(\"playermat/PlaymatApi\")\nlocal soundCubeApi = require(\"core/SoundCubeApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\nlocal tokenChecker = require(\"core/token/TokenChecker\")\nlocal tokenManager = require(\"core/token/TokenManager\")\n\n---------------------------------------------------------\n-- general setup\n---------------------------------------------------------\n\nENCOUNTER_DECK_POS = {-3.93, 1, 5.76}\nENCOUNTER_DECK_DISCARD_POSITION = {-3.85, 1, 10.38}\n\n-- GUID of data helper\nDATA_HELPER_GUID = \"708279\"\n\n-- GUIDs that will not be interactable (e.g. parts of the table)\nlocal NOT_INTERACTABLE = {\n \"6161b4\", -- Decoration-Map\n \"721ba2\", -- PlayArea\n \"9f334f\", -- MythosArea\n \"463022\", -- Panel behind tentacle stand\n \"f182ee\", -- InvestigatorCount\n \"7bff34\", -- Tentacle stand\n \"8646eb\", -- horizontal border left\n \"75937e\", -- horizontal border right\n \"612072\", -- vertical border left\n \"975c39\", -- vertical border right\n}\n\n-- global variable for access\nchaosTokens = {}\nlocal chaosTokensLastMat = nil\n\nlocal bagSearchers = {}\nlocal MAT_COLORS = {\"White\", \"Orange\", \"Green\", \"Red\"}\nlocal hideTitleSplashWaitFunctionId = nil\n\n-- online functionality related variables\nlocal MOD_VERSION = \"3.3.0\"\nlocal SOURCE_REPO = 'https://raw.githubusercontent.com/chr1z93/loadable-objects/main'\nlocal library, requestObj, modMeta, notificationVisible\nlocal acknowledgedUpgradeVersions = {}\n\n-- optionPanel data\noptionPanel = {}\nlocal LANGUAGES = {\n { code = \"zh_CN\", name = \"简体中文\" },\n { code = \"zh_TW\", name = \"繁體中文\" },\n { code = \"de\", name = \"Deutsch\" },\n { code = \"en\", name = \"English\" },\n { code = \"es\", name = \"Español\" },\n { code = \"fr\", name = \"Français\" },\n { code = \"it\", name = \"Italiano\" }\n}\nlocal RESOURCE_OPTIONS = {\n \"enabled\",\n \"custom\",\n \"disabled\"\n}\n\n---------------------------------------------------------\n-- data for tokens\n---------------------------------------------------------\n\nTOKEN_DATA = {\n damage = {image = \"http://cloud-3.steamusercontent.com/ugc/1758068501357115146/903D11AAE7BD5C254C8DC136E9202EE516289DEA/\", scale = {0.17, 0.17, 0.17}},\n horror = {image = \"http://cloud-3.steamusercontent.com/ugc/1758068501357163535/6D9E0756503664D65BDB384656AC6D4BD713F5FC/\", scale = {0.17, 0.17, 0.17}},\n resource = {image = \"http://cloud-3.steamusercontent.com/ugc/1758068501357192910/11DDDC7EF621320962FDCF3AE3211D5EDC3D1573/\", scale = {0.17, 0.17, 0.17}},\n doom = {image = \"https://i.imgur.com/EoL7yaZ.png\", scale = {0.17, 0.17, 0.17}},\n clue = {image = \"http://cloud-3.steamusercontent.com/ugc/1758068501357164917/1D06F1DC4D6888B6F57124BD2AFE20D0B0DA15A8/\", scale = {0.15, 0.15, 0.15}}\n}\n\nID_URL_MAP = {\n ['blue'] = {name = \"Elder Sign\", url = 'https://i.imgur.com/nEmqjmj.png'},\n ['p1'] = {name = \"+1\", url = 'https://i.imgur.com/uIx8jbY.png'},\n ['0'] = {name = \"0\", url = 'https://i.imgur.com/btEtVfd.png'},\n ['m1'] = {name = \"-1\", url = 'https://i.imgur.com/w3XbrCC.png'},\n ['m2'] = {name = \"-2\", url = 'https://i.imgur.com/bfTg2hb.png'},\n ['m3'] = {name = \"-3\", url = 'https://i.imgur.com/yfs8gHq.png'},\n ['m4'] = {name = \"-4\", url = 'https://i.imgur.com/qrgGQRD.png'},\n ['m5'] = {name = \"-5\", url = 'https://i.imgur.com/3Ym1IeG.png'},\n ['m6'] = {name = \"-6\", url = 'https://i.imgur.com/c9qdSzS.png'},\n ['m7'] = {name = \"-7\", url = 'https://i.imgur.com/4WRD42n.png'},\n ['m8'] = {name = \"-8\", url = 'https://i.imgur.com/9t3rPTQ.png'},\n ['skull'] = {name = \"Skull\", url = 'https://i.imgur.com/stbBxtx.png'},\n ['cultist'] = {name = \"Cultist\", url = 'https://i.imgur.com/VzhJJaH.png'},\n ['tablet'] = {name = \"Tablet\", url = 'https://i.imgur.com/1plY463.png'},\n ['elder'] = {name = \"Elder Thing\", url = 'https://i.imgur.com/ttnspKt.png'},\n ['red'] = {name = \"Auto-fail\", url = 'https://i.imgur.com/lns4fhz.png'},\n ['bless'] = {name = \"Bless\", url = 'http://cloud-3.steamusercontent.com/ugc/1655601092778627699/339FB716CB25CA6025C338F13AFDFD9AC6FA8356/'},\n ['curse'] = {name = \"Curse\", url = 'http://cloud-3.steamusercontent.com/ugc/1655601092778636039/2A25BD38E8C44701D80DD96BF0121DA21843672E/'},\n\t['frost'] = {name = \"Frost\", url = 'http://cloud-3.steamusercontent.com/ugc/1858293462583104677/195F93C063A8881B805CE2FD4767A9718B27B6AE/'}\n}\n\n---------------------------------------------------------\n-- data for chaos token stat tracker\n---------------------------------------------------------\n\nlocal MAT_GUID_TO_COLOR = {\n [\"Overall\"] = \"Overall\",\n [\"8b081b\"] = \"White\",\n [\"bd0ff4\"] = \"Orange\",\n [\"383d8b\"] = \"Green\",\n [\"0840d5\"] = \"Red\"\n}\n\nlocal tokenDrawingStats = {\n [\"Overall\"] = {},\n [\"8b081b\"] = {},\n [\"bd0ff4\"] = {},\n [\"383d8b\"] = {},\n [\"0840d5\"] = {}\n}\n\n---------------------------------------------------------\n-- general code\n---------------------------------------------------------\n\n-- saving state of optionPanel to restore later\nfunction onSave() return JSON.encode({ optionPanel = optionPanel, acknowledgedUpgradeVersions = acknowledgedUpgradeVersions }) end\n\nfunction onLoad(savedData)\n if savedData then\n loadedData = JSON.decode(savedData)\n optionPanel = loadedData.optionPanel\n acknowledgedUpgradeVersions = loadedData.acknowledgedUpgradeVersions\n updateOptionPanelState()\n else\n print(\"Saved state could not be found!\")\n end\n\n for _, guid in ipairs(NOT_INTERACTABLE) do\n local obj = getObjectFromGUID(guid)\n if obj ~= nil then obj.interactable = false end\n end\n\n resetChaosTokenStatTracker()\n getModVersion()\n math.randomseed(os.time())\nend\n\n-- Event hook for any object search. When chaos tokens are manipulated while the chaos bag\n-- container is being searched, a TTS bug can cause tokens to duplicate or vanish. We lock the\n-- chaos bag during search operations to avoid this.\nfunction onObjectSearchStart(object, playerColor)\n chaosbag = findChaosBag()\n if object == chaosbag then\n bagSearchers[playerColor] = true\n end\nend\n\n-- Event hook for any object search. When chaos tokens are manipulated while the chaos bag\n-- container is being searched, a TTS bug can cause tokens to duplicate or vanish. We lock the\n-- chaos bag during search operations to avoid this.\nfunction onObjectSearchEnd(object, playerColor)\n chaosbag = findChaosBag()\n if object == chaosbag then\n bagSearchers[playerColor] = nil\n end\nend\n\n-- Pass object enter container events to the PlayArea to clear vector lines from dragged cards.\n-- This requires the try method as cards won't exist any more after they enter a deck, so the lines\n-- can't be cleared.\nfunction tryObjectEnterContainer(container, object)\n playAreaApi.tryObjectEnterContainer(container, object)\n return true\nend\n\n---------------------------------------------------------\n-- chaos token drawing\n---------------------------------------------------------\n\n-- checks scripting zone for chaos bag (also called by a lot of objects!)\nfunction findChaosBag()\n local chaosbag_zone = getObjectFromGUID(\"83ef06\")\n\n -- error handling: scripting zone not found\n if chaosbag_zone == nil then\n printToAll(\"Zone for chaos bag detection couldn't be found.\", \"Red\")\n return\n end\n\n for _, item in ipairs(chaosbag_zone.getObjects()) do\n if item.getDescription() == \"Chaos Bag\" then\n return item\n end\n end\n\n -- error handling: chaos bag not found\n printToAll(\"Chaos bag couldn't be found.\", \"Red\")\nend\n\nfunction returnChaosTokens()\n for _, token in pairs(chaosTokens) do\n if token ~= nil then chaosbag.putObject(token) end\n end\n chaosTokens = {}\nend\n\n-- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n-- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n-- contents of the bag should check this method before doing so.\n-- This method will broadcast a message to all players if the bag is being searched.\n---@return Boolean. True if the bag is manipulated, false if it should be blocked.\nfunction canTouchChaosTokens()\n for color, searching in pairs(bagSearchers) do\n if searching then\n broadcastToAll(\"Someone is searching the chaos bag, can't touch the tokens.\", \"Red\")\n return false\n end\n end\n return true\nend\n\n-- called by playermats (by the \"Draw chaos token\" button)\nfunction drawChaosToken(params)\n if not canTouchChaosTokens() then return end\n\n local mat = params[1]\n local tokenOffset = params[2]\n local isRightClick = params[3]\n chaosbag = findChaosBag()\n\n -- return token(s) on other playmat first\n if chaosTokensLastMat ~= nil and chaosTokensLastMat ~= mat and #chaosTokens ~= 0 then\n returnChaosTokens()\n chaosTokensLastMat = nil\n return\n end\n\n chaosTokensLastMat = mat\n\n -- if we have left clicked and have no tokens OR if we have right clicked\n if isRightClick or #chaosTokens == 0 then\n if #chaosbag.getObjects() == 0 then return end\n chaosbag.shuffle()\n\n -- add the token to the list, compute new position based on list length\n tokenOffset[1] = tokenOffset[1] + (0.17 * #chaosTokens)\n local token = chaosbag.takeObject({\n index = 0,\n position = mat.positionToWorld(tokenOffset),\n rotation = mat.getRotation()\n })\n\n -- get data for token description\n local name = token.getName()\n local tokenData = mythosAreaApi.returnTokenData().tokenData or {}\n local specificData = tokenData[name] or {}\n token.setDescription(specificData.description or \"\")\n\n -- track the chaos token (for stat tracker and future returning)\n trackChaosToken(name, mat.getGUID())\n chaosTokens[#chaosTokens + 1] = token\n return\n else\n returnChaosTokens()\n end\nend\n\n---------------------------------------------------------\n-- token spawning\n---------------------------------------------------------\n\n-- DEPRECATED. Use TokenManager instead.\n-- Spawns a single token.\n---@param params Table. Array with arguments to the method. 1 = position, 2 = type, 3 = rotation\nfunction spawnToken(params)\n return tokenManager.spawnToken(params[1], params[2], params[3])\nend\n\n---------------------------------------------------------\n-- chaos token stat tracker\n---------------------------------------------------------\n\nfunction trackChaosToken(tokenName, matGUID)\n tokenDrawingStats[\"Overall\"][tokenName] = (tokenDrawingStats[\"Overall\"][tokenName] or 0) + 1\n tokenDrawingStats[matGUID][tokenName] = (tokenDrawingStats[matGUID][tokenName] or 0) + 1\nend\n\n-- Left-click: print stats, Right-click: reset stats\nfunction handleStatTrackerClick(_, _, isRightClick)\n if isRightClick then\n resetChaosTokenStatTracker()\n else\n local squidKing = \"Nobody\"\n local maxSquid = 0\n local foundAnyStats = false\n\n for key, personalStats in pairs(tokenDrawingStats) do\n local playerColor, playerName\n\n if key == \"Overall\" then\n playerColor = \"White\"\n playerName = \"Overall\"\n else\n playerColor = playmatApi.getPlayerColor(MAT_GUID_TO_COLOR[key])\n playerName = Player[playerColor].steam_name or playerColor\n\n local playerSquidCount = personalStats[\"Auto-fail\"]\n if playerSquidCount \u003e maxSquid then\n squidKing = playerName\n maxSquid = playerSquidCount\n end\n end\n\n -- get the total count of drawn tokens for the player\n local totalCount = 0\n for tokenName, value in pairs(personalStats) do\n totalCount = totalCount + value\n end\n\n -- only print the personal stats if any tokens were drawn\n if totalCount \u003e 0 then\n foundAnyStats = true\n printToAll(\"------------------------------\")\n printToAll(playerName .. \" Stats\", playerColor)\n \n for tokenName, value in pairs(personalStats) do\n if value ~= 0 then\n printToAll(tokenName .. ': ' .. tostring(value))\n end\n end\n printToAll('Total: ' .. tostring(totalCount))\n end\n end\n\n -- detect if any player drew tokens\n if foundAnyStats then\n printToAll(\"------------------------------\")\n printToAll(squidKing .. \" is an auto-fail magnet.\", {255, 0, 0})\n else\n printToAll(\"No tokens have been drawn yet.\", \"Yellow\")\n end\n end\nend\n\n-- resets the count for each token to 0\nfunction resetChaosTokenStatTracker()\n for key, _ in pairs(tokenDrawingStats) do\n tokenDrawingStats[key] = {}\n for _, token in pairs(ID_URL_MAP) do\n tokenDrawingStats[key][token.name] = 0\n end\n end\nend\n\n---------------------------------------------------------\n-- Difficulty selector script\n---------------------------------------------------------\n\n-- called for button creation on the difficulty selectors\n---@param object object Usually \"self\"\n---@param key string Name of the scenario\nfunction createSetupButtons(args)\n local data = getDataValue('modeData', args.key)\n if data ~= nil then\n local buttonParameters = {}\n buttonParameters.function_owner = args.object\n buttonParameters.position = {0, 0.1, -0.15}\n buttonParameters.scale = {0.47, 1, 0.47}\n buttonParameters.height = 200\n buttonParameters.width = 1150\n buttonParameters.color = {0.87, 0.8, 0.7}\n\n if data.easy ~= nil then\n buttonParameters.label = \"Easy\"\n buttonParameters.click_function = \"easyClick\"\n args.object.createButton(buttonParameters)\n buttonParameters.position[3] = buttonParameters.position[3] + 0.20\n end\n\n if data.normal ~= nil then\n buttonParameters.label = \"Standard\"\n buttonParameters.click_function = \"normalClick\"\n args.object.createButton(buttonParameters)\n buttonParameters.position[3] = buttonParameters.position[3] + 0.20\n end\n\n if data.hard ~= nil then\n buttonParameters.label = \"Hard\"\n buttonParameters.click_function = \"hardClick\"\n args.object.createButton(buttonParameters)\n buttonParameters.position[3] = buttonParameters.position[3] + 0.20\n end\n\n if data.expert ~= nil then\n buttonParameters.label = \"Expert\"\n buttonParameters.click_function = \"expertClick\"\n args.object.createButton(buttonParameters)\n buttonParameters.position[3] = buttonParameters.position[3] + 0.20\n end\n\n if data.standalone ~= nil then\n buttonParameters.label = \"Standalone\"\n buttonParameters.click_function = \"standaloneClick\"\n args.object.createButton(buttonParameters)\n end\n end\nend\n\n-- called for adding chaos tokens\n---@param object object Usually \"self\"\n---@param key string Name of the scenario\n---@param mode string difficulty (e.g. \"hard\" or \"expert\")\nfunction fillContainer(args)\n local data = getDataValue('modeData', args.key)\n if data == nil then return end\n\n local value = data[args.mode]\n if value == nil or value.token == nil then return end\n\n local tokenList = {}\n\n for _, tokenId in ipairs(value.token) do\n table.insert(tokenList, tokenId)\n end\n\n if value.append ~= nil then\n for _, tokenId in ipairs(value.append) do\n table.insert(tokenList, tokenId)\n end\n end\n\n -- randomly choose tokens for specific Carcosa scenarios in standalone\n if value.random then\n local n = #value.random\n if n \u003e 0 then\n for _, tokenId in ipairs(value.random[math.random(1, n)]) do\n table.insert(tokenList, tokenId)\n end\n end\n end\n\n setChaosBagState(tokenList)\n\n if value.message then\n broadcastToAll(value.message)\n end\n\n if value.warning then\n broadcastToAll(value.warning, { 1, 0.5, 0.5 })\n end\nend\n\nfunction getDataValue(storage, key)\n local data = getObjectFromGUID(DATA_HELPER_GUID).getTable(storage)\n if data ~= nil then\n local value = data[key]\n if value ~= nil then\n local res = {}\n for m, v in pairs(value) do\n res[m] = v\n if res[m].parent ~= nil then\n local parentData = getDataValue(storage, res[m].parent)\n if parentData ~= nil and parentData[m] ~= nil and parentData[m].token ~= nil then\n res[m].token = parentData[m].token\n end\n res[m].parent = nil\n end\n end\n return res\n end\n end\nend\n\nfunction createChaosTokenNameLookupTable()\n local namesToIds = {}\n for k, v in pairs(ID_URL_MAP) do\n namesToIds[v.name] = k\n end\n return namesToIds\nend\n\n-- returns a Table List of chaos token ids in the current chaos bag\n---@api chaosbag/ChaosBagApi\nfunction getChaosBagState()\n local tokens = {}\n local invertedTable = createChaosTokenNameLookupTable()\n local chaosbag = findChaosBag()\n\n for _, v in ipairs(chaosbag.getObjects()) do\n local id = invertedTable[v.name]\n if id then\n table.insert(tokens, id)\n else\n printToAll(v.name .. \" token not recognized. Will not be recorded.\", \"Yellow\")\n end\n end\n\n return tokens\n\nend\n\n-- respawns the chaos bag with a new state of tokens\n---@param tokenList Table List of chaos token ids\n---@api chaosbag/ChaosBagApi\nfunction setChaosBagState(tokenList)\n if not canTouchChaosTokens() then return end\n\n local chaosbag = findChaosBag()\n local chaosbagData = chaosbag.getData()\n local reserveData = getObjectFromGUID(\"106418\").getData()\n local tokenCache = {}\n local containedObjects = {}\n\n -- create a temporary copy of the data for each chaos token\n for _, objData in ipairs(reserveData.ContainedObjects) do\n tokenCache[objData.Nickname] = objData\n end\n\n -- iterate over tokenlist and insert specified tokens into new table\n for _, tokenId in ipairs(tokenList) do\n local tokenName = ID_URL_MAP[tokenId].name\n table.insert(containedObjects, tokenCache[tokenName])\n end\n\n -- overwrite chaos bag content and respawn it\n chaosbagData.ContainedObjects = containedObjects\n chaosbag.destruct()\n spawnObjectData({data = chaosbagData})\n\n -- remove tokens that are still in play\n for _, token in pairs(chaosTokens) do\n if token ~= nil then token.destruct() end\n end\n chaosTokens = {}\n chaosTokensLastMat = nil\n\n -- reset bless / curse manager\n blessCurseManagerApi.removeTakenTokensAndReset()\n\n printToAll(\"Chaos bag set to chosen difficulty.\", \"Green\")\nend\n\n-- spawns the specified chaos token and puts it into the chaos bag\n---@param id String ID of the chaos token\nfunction spawnChaosToken(id)\n if not canTouchChaosTokens() then return end\n\n id = id:lower()\n local chaosbag = findChaosBag()\n local url = ID_URL_MAP[id].url or \"\"\n\n if url ~= \"\" then\n return spawnObject({\n type = 'Custom_Tile',\n position = { 0.49, 3, 0 },\n scale = { 0.81, 1.0, 0.81 },\n rotation = {0, 270, 0},\n callback_function = function(obj)\n obj.setName(ID_URL_MAP[id].name)\n chaosbag.putObject(obj)\n tokenArrangerApi.layout()\n end\n }).setCustomObject({\n type = 2,\n image = url,\n thickness = 0.1\n })\n end\nend\n\n-- removes the specified chaos token from the chaos bag\n---@param id String ID of the chaos token\nfunction removeChaosToken(id)\n if not canTouchChaosTokens() then return end\n\n local tokens = {}\n local chaosbag = findChaosBag()\n local name = ID_URL_MAP[id].name\n\n for _, v in ipairs(chaosbag.getObjects()) do\n if v.name == name then table.insert(tokens, v.guid) end\n end\n\n -- error handling: no matching token found\n if #tokens == 0 then\n printToAll(\"No \" .. name .. \" tokens in the chaos bag.\", \"Yellow\")\n return\n end\n\n chaosbag.takeObject({\n guid = tokens[1],\n smooth = false,\n callback_function = function(obj)\n obj.destruct()\n tokenArrangerApi.layout()\n end\n })\n printToAll(\"Removing \" .. name .. \" token (in bag: \" .. #tokens - 1 .. \")\", \"White\")\nend\n\n-- empty the chaos bag\nfunction emptyChaosBag()\n if not canTouchChaosTokens() then return end\n\n local chaosbag = findChaosBag()\n for _, object in ipairs(chaosbag.getObjects()) do\n chaosbag.takeObject({callback_function = function(item) item.destruct() end})\n end\nend\n\n-- returns all sealed tokens on cards to the chaos bag\nfunction releaseAllSealedTokens(playerColor)\n local chaosbag = findChaosBag()\n for _, obj in ipairs(getObjectsWithTag(\"CardThatSeals\")) do\n obj.call(\"releaseAllTokens\", playerColor)\n end\nend\n\n---------------------------------------------------------\n-- Content Importing and XML functions\n---------------------------------------------------------\n\nfunction onClick_refreshList()\n local request = WebRequest.get(SOURCE_REPO .. '/library.json', completed_list_update)\n requestObj = request\n startLuaCoroutine(Global, 'downloadCoroutine')\nend\n\nfunction onClick_select(player, params)\n params = JSON.decode(urldecode(params))\n local url = SOURCE_REPO .. '/' .. params.url\n local request = WebRequest.get(url, function (request) complete_obj_download(request, params) end )\n requestObj = request\n startLuaCoroutine(Global, 'downloadCoroutine')\nend\n\nfunction onClick_load()\n UI.show('progress_display')\n UI.hide('load_button')\nend\n\nfunction onClick_toggleUi(player, title)\n if title == \"Navigation Overlay\" then\n navigationOverlayApi.cycleVisibility(player.color)\n return\n end\n\n UI.hide('optionPanel')\n UI.hide('load_ui')\n\n -- when same button is clicked or close window button is pressed, don't open UI\n if UI.getValue('title') ~= title and title ~= 'Hidden' then\n UI.setValue('title', title)\n\n if title == \"Options\" then\n UI.show('optionPanel')\n else\n update_window_content(title)\n UI.show('load_ui')\n end\n else\n UI.setValue('title', \"Hidden\")\n end\nend\n\nfunction downloadCoroutine()\n while requestObj do\n UI.setAttribute('download_progress', 'percentage', requestObj.download_progress * 100)\n coroutine.yield(0)\n end\n return 1\nend\n\nfunction update_list(objects)\n local ui = UI.getXmlTable()\n local update_height = find_tag_with_id(ui, 'ui_update_height')\n local update_children = find_tag_with_id(update_height.children, 'ui_update_point')\n\n update_children.children = {}\n\n for _, v in ipairs(objects) do\n local s = JSON.encode(v);\n table.insert(update_children.children,\n { tag = 'Text',\n value = v.name,\n attributes = { onClick = 'onClick_select(' .. urlencode(JSON.encode(v)) .. ')', alignment = 'MiddleLeft' }\n })\n end\n\n update_height.attributes.height = #(update_children.children) * 24\n UI.setXmlTable(ui)\nend\n\nfunction update_window_content(new_title)\n if not library then return end\n\n if new_title == 'Campaigns' then\n update_list(library.campaigns)\n elseif new_title == 'Standalone Scenarios' then\n update_list(library.scenarios)\n elseif new_title == 'Investigators' then\n update_list(library.investigators)\n elseif new_title == 'Community Content' then\n update_list(library.community)\n elseif new_title == 'Extras' then\n update_list(library.extras)\n else\n update_list({})\n end\nend\n\nfunction complete_obj_download(request, params)\n assert(request.is_done)\n if request.is_error or request.response_code ~= 200 then\n print('error: ' .. request.error)\n else\n if pcall(function()\n local replaced_object\n pcall(function()\n if params.replace then\n replaced_object = getObjectFromGUID(params.replace)\n end\n end)\n local json = request.text\n if replaced_object then\n local pos = replaced_object.getPosition()\n local rot = replaced_object.getRotation()\n destroyObject(replaced_object)\n Wait.frames(function()\n spawnObjectJSON({json = json, position = pos, rotation = rot})\n end, 1)\n else\n spawnObjectJSON({json = json})\n end\n end) then\n print('Object loaded.')\n else\n print('Error loading object.')\n end\n end\n\n requestObj = nil\n UI.setAttribute('download_progress', 'percentage', 100)\nend\n\n-- the download button on the placeholder objects calls this to directly initiate a download\n-- params is a table with url and guid of replacement object, which happens to match what onClick_select wants\nfunction placeholder_download(params)\n onClick_select(nil, JSON.encode(params))\nend\n\nfunction completed_list_update(request)\n assert(request.is_done)\n if request.is_error or request.response_code ~= 200 then\n print('error: ' .. request.error)\n else\n local json_response = nil\n if pcall(function () json_response = JSON.decode(request.text) end) then\n library = json_response\n update_window_content(UI.getValue('title'))\n else\n print('error parsing downloaded library')\n end\n end\n\n requestObj = nil\n UI.setAttribute('download_progress', 'percentage', 100)\nend\n\nfunction find_tag_with_id(ui, id)\n for _, obj in ipairs(ui) do\n if obj.attributes and obj.attributes.id and obj.attributes.id == id then return obj end\n if obj.children then\n local result = find_tag_with_id(obj.children, id)\n if result then return result end\n end\n end\n return nil\nend\n\nfunction urlencode(str)\n local str = string.gsub(str, \"([^A-Za-z0-9-_.~])\",\n function (c) return string.format(\"%%%02X\", string.byte(c)) end)\n return str\nend\n\nfunction urldecode(str)\n local str = string.gsub(str, \"%%(%x%x)\",\n function (h) return string.char(tonumber(h, 16)) end)\n return str\nend\n\n---------------------------------------------------------\n-- Option Panel related functionality\n---------------------------------------------------------\n\n-- called by toggling an option\nfunction onClick_toggleOption(_, id)\n local state = self.UI.getAttribute(id, \"isOn\")\n\n -- flip state (and handle stupid \"False\" value)\n if state == \"False\" then\n state = true\n else\n state = false\n end\n\n self.UI.setAttribute(id, \"isOn\", state)\n applyOptionPanelChange(id, state)\nend\n\n-- called by the language selection dropdown\nfunction languageSelected(_, selectedIndex, id)\n optionPanel[id] = LANGUAGES[tonumber(selectedIndex) + 1].code\nend\n\n-- returns the ID (position in the table) for a provided language code\nfunction returnLanguageId(code)\n for index, tbl in ipairs(LANGUAGES) do\n if tbl.code == code then\n return index\n end\n end\nend\n\n-- called by the resource counter selection dropdown\nfunction resourceCounterSelected(_, selectedIndex, id)\n optionPanel[id] = RESOURCE_OPTIONS[tonumber(selectedIndex) + 1]\nend\n\n-- returns the ID for the provided option name\nfunction returnResourceCounterId(name)\n for index, optionName in ipairs(RESOURCE_OPTIONS) do\n if optionName == name then\n return index\n end\n end\nend\n\n-- sets the option panel to the correct state (corresponding to 'optionPanel')\nfunction updateOptionPanelState()\n for id, optionValue in pairs(optionPanel) do\n if id == \"cardLanguage\" and type(optionValue) == \"string\" then\n local dropdownId = returnLanguageId(optionValue) - 1\n UI.setAttribute(id, \"value\", dropdownId)\n elseif id == \"useResourceCounters\" and type(optionValue) == \"string\" then\n local dropdownId = returnResourceCounterId(optionValue) - 1\n UI.setAttribute(id, \"value\", dropdownId)\n elseif (type(optionValue) == \"boolean\" and optionValue)\n or (type(optionValue) == \"string\" and optionValue)\n or (type(optionValue) == \"table\" and #optionValue ~= 0) then\n UI.setAttribute(id, \"isOn\", true)\n else\n UI.setAttribute(id, \"isOn\", \"False\")\n end\n end\nend\n\n-- handles the applying of option selections and calls the respective functions based\n---@param id String ID of the option that was selected or deselected\n---@param state Boolean State of the option (true = enabled)\nfunction applyOptionPanelChange(id, state)\n -- option: Snap tags\n if id == \"useSnapTags\" then\n playmatApi.setLimitSnapsByType(state, \"All\")\n optionPanel[id] = state\n\n -- option: Draw 1 button\n elseif id == \"showDrawButton\" then\n playmatApi.showDrawButton(state, \"All\")\n optionPanel[id] = state\n\n -- option: Clickable clue counters\n elseif id == \"useClueClickers\" then\n playmatApi.clickableClues(state, \"All\")\n optionPanel[id] = state\n\n -- update master clue counter\n getObjectFromGUID(\"4a3aa4\").setVar(\"useClickableCounters\", state)\n\n -- option: Play area snap tags\n elseif id == \"playAreaSnapTags\" then\n playAreaApi.setLimitSnapsByType(state)\n optionPanel[id] = state\n\n -- option: Show Title on placing scenarios\n elseif id == \"showTitleSplash\" then\n optionPanel[id] = state\n\n -- option: Show clean up helper\n elseif id == \"showCleanUpHelper\" then\n optionPanel[id] = spawnOrRemoveHelper(state, \"Clean Up Helper\", {-66, 1.6, 46})\n\n -- option: Show hand helper for each player\n elseif id == \"showHandHelper\" then\n for i, color in ipairs(MAT_COLORS) do\n local pos = playmatApi.transformLocalPosition({0.05, 0, -1.182}, color)\n local rot = playmatApi.returnRotation(color)\n optionPanel[id][i] = spawnOrRemoveHelper(state, \"Hand Helper\", pos, rot)\n end\n\n -- option: Show search assistant for each player\n elseif id == \"showSearchAssistant\" then\n for i, color in ipairs(MAT_COLORS) do\n local pos = playmatApi.transformLocalPosition({-0.3, 0, -1.182}, color)\n local rot = playmatApi.returnRotation(color)\n optionPanel[id][i] = spawnOrRemoveHelper(state, \"Search Assistant\", pos, rot)\n end\n\n -- option: Show attachment helper\n elseif id == \"showAttachmentHelper\" then\n optionPanel[id] = spawnOrRemoveHelper(state, \"Attachment Helper\", {-62, 1.4, 0})\n\n -- option: Show CYOA campaign guides\n elseif id == \"showCYOA\" then\n optionPanel[id] = spawnOrRemoveHelper(state, \"CYOA Campaign Guides\", {39, 1.3, -20})\n\n -- option: Show custom playmat images\n elseif id == \"showCustomPlaymatImages\" then\n optionPanel[id] = spawnOrRemoveHelper(state, \"Custom Playmat Images\", {67.5, 1.6, 37})\n\n -- option: Show displacement tool\n elseif id == \"showDisplacementTool\" then\n optionPanel[id] = spawnOrRemoveHelper(state, \"Displacement Tool\", {-57, 1.6, 46})\n end\nend\n\n-- handler for spawn / remove functions of helper objects\n---@param state Boolean Contains the state of the option: true = spawn it, false = remove it\n---@param name String Name of the helper object\n---@param position Vector Position of the object (where it will spawn)\n---@param rotation Vector Rotation of the object for spawning (default: {0, 270, 0})\n---@return. GUID of the spawnedObj (or nil if object was removed)\nfunction spawnOrRemoveHelper(state, name, position, rotation)\n if (type(state) == \"table\" and #state == 0) then\n return removeHelperObject(name)\n elseif state then\n Player.getPlayers()[1].pingTable(position)\n return spawnHelperObject(name, position, rotation).getGUID()\n else\n return removeHelperObject(name)\n end\nend\n\n-- copies the specified tool (by name) from the option panel source bag\n---@param name String Name of the object that should be copied\n---@param position Table Desired position of the object\nfunction spawnHelperObject(name, position, rotation)\n local sourceBag = getObjectFromGUID(\"830bd0\")\n\n -- error handling for missing sourceBag\n if not sourceBag then\n broadcastToAll(\"Option panel source bag could not be found!\", \"Red\")\n return\n end\n\n local spawnTable = {position = position}\n\n -- only overrride rotation if there is one provided (object's rotation used instead)\n if rotation then\n spawnTable.rotation = rotation\n end\n\n for _, obj in ipairs(sourceBag.getData().ContainedObjects) do\n if obj[\"Nickname\"] == name then\n spawnTable.data = obj\n spawnTable.callback_function = function(spawnedObj)\n Wait.time(function() spawnedObj.setLock(true) end, 2)\n end\n return spawnObjectData(spawnTable)\n end\n end\nend\n\n-- removes the specified tool (by name)\n---@param name String Object that should be removed\nfunction removeHelperObject(name)\n -- links objects name to the respective option name (to grab the GUID for removal)\n local referenceTable = {\n [\"Clean Up Helper\"] = \"showCleanUpHelper\",\n [\"Hand Helper\"] = \"showHandHelper\",\n [\"Search Assistant\"] = \"showSearchAssistant\",\n [\"Displacement Tool\"] = \"showDisplacementTool\",\n [\"Custom Playmat Images\"] = \"showCustomPlaymatImages\",\n [\"Attachment Helper\"] = \"showAttachmentHelper\",\n [\"CYOA Campaign Guides\"] = \"showCYOA\"\n }\n\n local data = optionPanel[referenceTable[name]]\n\n -- if there is a GUID stored, remove that object\n if type(data) == \"string\" then\n local obj = getObjectFromGUID(data)\n if obj then obj.destruct() end\n\n -- if it is a table (e.g. for the \"Hand Helper\", remove all of them)\n elseif type(data) == \"table\" then\n for _, guid in pairs(data) do\n local obj = getObjectFromGUID(guid)\n if obj then obj.destruct() end\n end\n end\nend\n\n-- loads saved options\nfunction loadSettings(newOptions)\n optionPanel = newOptions\n updateOptionPanelState()\n for id, state in pairs(optionPanel) do\n applyOptionPanelChange(id, state)\n end\nend\n\n-- loads the default options\nfunction onClick_defaultSettings()\n for id, _ in pairs(optionPanel) do\n local state = false\n -- override for settings that are enabled by default\n if id == \"useSnapTags\" or id == \"showTitleSplash\" then\n state = true\n end\n applyOptionPanelChange(id, state)\n end\n\n -- clean reset of variables\n optionPanel = {\n cardLanguage = \"en\",\n playAreaSnapTags = true,\n showAttachmentHelper = false,\n showCleanUpHelper = false,\n showCustomPlaymatImages = false,\n showCYOA = false,\n showDisplacementTool = false,\n showDrawButton = false,\n showHandHelper = {},\n showSearchAssistant = {},\n showTitleSplash = true,\n useClueClickers = false,\n useResourceCounters = \"disabled\",\n useSnapTags = true\n }\n\n -- update UI\n updateOptionPanelState()\nend\n\n-- splash scenario title on setup\nfunction titleSplash(scenarioName)\n if optionPanel['showTitleSplash'] then\n\n -- if there's any ongoing title being displayed, hide it and cancel the waiting function\n if hideTitleSplashWaitFunctionId then\n Wait.stop(hideTitleSplashWaitFunctionId)\n hideTitleSplashWaitFunctionId = nil\n UI.setAttribute('title_splash', 'active', false)\n end\n\n -- display scenario name and set a 4 seconds (2 seconds animation and 2 seconds on screen)\n -- wait timer to hide the scenario name\n UI.setValue('title_splash_text', scenarioName)\n UI.show('title_splash')\n hideTitleSplashWaitFunctionId = Wait.time(function()\n UI.hide('title_splash')\n hideTitleSplashWaitFunctionId = nil\n end, 4)\n\n soundCubeApi.playSoundByName(\"Deep Bell\")\n end\nend\n\n---------------------------------------------------------\n-- Update notification related functionality\n---------------------------------------------------------\n\n-- grabs the latest mod version and release notes from GitHub (called onLoad())\nfunction getModVersion()\n WebRequest.get(SOURCE_REPO .. '/modversion.json', compareVersion)\nend\n\n-- compares the modversion with GitHub and possibly shows the update notification\nfunction compareVersion(request)\n if request.is_error then\n log(request.error)\n return\n end\n\n -- global variable to make it accessible for other functions\n modMeta = JSON.decode(request.text)\n\n -- stop here if on latest version\n if MOD_VERSION == modMeta[\"latestVersion\"] then return end\n \n -- stop here if \"don't show again\" was clicked for this version before\n if acknowledgedUpgradeVersions[modMeta[\"latestVersion\"]] then return end\n\n updateNotificationLoading()\n\n -- delay to avoid lagging during onLoad()\n Wait.time(function() UI.show(\"FinnIcon\") end, 1)\nend\n\n-- updates the XML update notification based on the mod metadata\nfunction updateNotificationLoading()\n -- grab data\n local highlights = modMeta[\"releaseHighlights\"]\n\n -- concatenate the release highlights\n local highlightText = \"• \" .. highlights[1]\n for i, entry in pairs(highlights) do\n if i ~= 1 then\n highlightText = highlightText .. \"\\n• \" .. entry\n end\n end\n \n -- update the XML UI\n UI.setValue(\"notificationHeader\", \"New version available: \".. modMeta[\"latestVersion\"])\n UI.setValue(\"releaseHighlightText\", highlightText)\n UI.setAttribute(\"highlightRow\", \"preferredHeight\", 20*#highlights)\n UI.setAttribute(\"updateNotification\", \"height\", 20*#highlights + 125)\nend\n\n-- triggered by clicking on the Finn Icon\nfunction onClick_FinnIcon()\n if notificationVisible then\n UI.hide(\"updateNotification\")\n notificationVisible = false\n else\n UI.show(\"updateNotification\")\n notificationVisible = true\n end\nend\n\n-- close / don't show again buttons on the update notification\nfunction onClick_notification(_, parameter)\n if parameter == \"dontShowAgain\" then\n -- this variable tracks if \"don't show again\" was pressed for a version\n acknowledgedUpgradeVersions[modMeta[\"latestVersion\"]] = true\n end\n UI.hide(\"FinnIcon\")\n UI.hide(\"updateNotification\")\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = getObjectsWithTag(\"TokenArranger\")[1]\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local MANAGER_GUID = \"5933fb\"\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getObjectFromGUID(MANAGER_GUID)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getObjectFromGUID(MANAGER_GUID).call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"core/NavigationOverlayApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local NavigationOverlayApi = {}\n local HANDLER_GUID = \"797ede\"\n\n -- Copies the visibility for the Navigation overlay\n ---@param startColor String Color of the player to copy from\n ---@param targetColor String Color of the targeted player\n NavigationOverlayApi.copyVisibility = function(startColor, targetColor)\n getObjectFromGUID(HANDLER_GUID).call(\"copyVisibility\", {\n startColor = startColor,\n targetColor = targetColor\n })\n end\n\n -- Changes the Navigation Overlay view (\"Full View\" --\u003e \"Play Areas\" --\u003e \"Closed\" etc.)\n ---@param playerColor String Color of the player to update the visibility for\n NavigationOverlayApi.cycleVisibility = function(playerColor)\n getObjectFromGUID(HANDLER_GUID).call(\"cycleVisibility\", playerColor)\n end\n\n return NavigationOverlayApi\nend\nend)\n__bundle_register(\"core/token/TokenSpawnTrackerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenSpawnTracker = { }\n local SPAWN_TRACKER_GUID = \"e3ffc9\"\n\n TokenSpawnTracker.hasSpawnedTokens = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"hasSpawnedTokens\", cardGuid)\n end\n\n TokenSpawnTracker.markTokensSpawned = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"markTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetTokensSpawned = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetAllAssetAndEvents = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAllAssetAndEvents\")\n end\n\n TokenSpawnTracker.resetAllLocations = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAllLocations\")\n end\n\n TokenSpawnTracker.resetAll = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAll\")\n end\n\n return TokenSpawnTracker\nend\nend)\n__bundle_register(\"core/MythosAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local MythosAreaApi = {}\n local MYTHOS_AREA_GUID = \"9f334f\"\n\n -- returns the chaos token metadata (if provided through scenario reference card)\n MythosAreaApi.returnTokenData = function()\n return getObjectFromGUID(MYTHOS_AREA_GUID).call(\"returnTokenData\")\n end\n\n -- draw an encounter card to the requested position/rotation\n MythosAreaApi.drawEncounterCard = function(pos, rotY, alwaysFaceUp)\n getObjectFromGUID(MYTHOS_AREA_GUID).call(\"drawEncounterCard\", {\n pos = pos,\n rotY = rotY,\n alwaysFaceUp = alwaysFaceUp\n })\n end\n\n return MythosAreaApi\nend\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = { }\n local PLAY_AREA_GUID = \"721ba2\"\n local INVESTIGATOR_COUNTER_GUID = \"f182ee\"\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with\n -- 'displacement_excluded'\n ---@param playerColor Color of the player requesting the shift. Used solely to send an error\n --- message in the unlikely case that the scripting zone has been deleted\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"tryObjectEnterContainer\",\n { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightCountedVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\n__bundle_register(\"core/token/TokenManager\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local optionPanelApi = require(\"core/OptionPanelApi\")\n local playAreaApi = require(\"core/PlayAreaApi\")\n local tokenSpawnTrackerApi = require(\"core/token/TokenSpawnTrackerApi\")\n\n local PLAYER_CARD_TOKEN_OFFSETS = {\n [1] = {\n Vector(0, 3, -0.2)\n },\n [2] = {\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [3] = {\n Vector(0, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [4] = {\n Vector(0.4, 3, -0.9),\n Vector(-0.4, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [5] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [6] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2)\n },\n [7] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0, 3, 0.5)\n },\n [8] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(-0.35, 3, 0.5),\n Vector(0.35, 3, 0.5)\n },\n [9] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5)\n },\n [10] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0, 3, 1.2)\n },\n [11] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(-0.35, 3, 1.2),\n Vector(0.35, 3, 1.2)\n },\n [12] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0.7, 3, 1.2),\n Vector(0, 3, 1.2),\n Vector(-0.7, 3, 1.2)\n }\n }\n\n -- stateIDs for the multi-stated resource tokens\n local stateTable = {\n [\"resource\"] = 1,\n [\"ammo\"] = 2,\n [\"bounty\"] = 3,\n [\"charge\"] = 4,\n [\"evidence\"] = 5,\n [\"secret\"] = 6,\n [\"supply\"] = 7\n }\n\n -- Source for tokens\n local TOKEN_SOURCE_GUID = \"124381\"\n\n -- Table of data extracted from the token source bag, keyed by the Memo on each token which\n -- should match the token type keys (\"resource\", \"clue\", etc)\n local tokenTemplates\n\n local DATA_HELPER_GUID = \"708279\"\n\n local playerCardData\n local locationData\n\n local TokenManager = { }\n local internal = { }\n\n -- Spawns tokens for the card. This function is built to just throw a card at it and let it do\n -- the work once a card has hit an area where it might spawn tokens. It will check to see if\n -- the card has already spawned, find appropriate data from either the uses metadata or the Data\n -- Helper, and spawn the tokens.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n TokenManager.spawnForCard = function(card, extraUses)\n if tokenSpawnTrackerApi.hasSpawnedTokens(card.getGUID()) then\n return\n end\n local metadata = JSON.decode(card.getGMNotes())\n if metadata ~= nil then\n internal.spawnTokensFromUses(card, extraUses)\n else\n internal.spawnTokensFromDataHelper(card)\n end\n end\n\n -- Spawns a set of tokens on the given card.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String Type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param tokenCount Number How many tokens to spawn. For damage or horror this value will be set to the\n -- spawned state object rather than spawning multiple tokens\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnTokenGroup = function(card, tokenType, tokenCount, shiftDown, subType)\n local optionPanel = optionPanelApi.getOptions()\n\n if tokenType == \"damage\" or tokenType == \"horror\" then\n TokenManager.spawnCounterToken(card, tokenType, tokenCount, shiftDown)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"enabled\" then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"custom\" and tokenCount == 0 then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n else\n TokenManager.spawnMultipleTokens(card, tokenType, tokenCount, shiftDown, subType)\n end\n end\n\n -- Spawns a single counter token and sets the value to tokenValue. Used for damage and horror\n -- tokens.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String type of token to spawn, valid values are \"damage\" and \"horror\". Other\n -- types should use spawnMultipleTokens()\n ---@param tokenValue Number Value to set the damage/horror to\n TokenManager.spawnCounterToken = function(card, tokenType, tokenValue, shiftDown)\n if tokenValue \u003c 1 or tokenValue \u003e 50 then return end\n\n local pos = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[1][1] + Vector(0, 0, shiftDown))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, tokenType, rot, function(spawned) spawned.setState(tokenValue) end)\n end\n\n TokenManager.spawnResourceCounterToken = function(card, tokenCount)\n local pos = card.positionToWorld(card.positionToLocal(card.getPosition()) + Vector(0, 0.2, -0.5))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, \"resourceCounter\", rot, function(spawned)\n spawned.call(\"updateVal\", tokenCount)\n end)\n end\n\n -- Spawns a number of tokens.\n ---@param tokenType String type of token to spawn, valid values are resource\", \"doom\", or \"clue\".\n -- Other types should use spawnCounterToken()\n ---@param tokenCount Number How many tokens to spawn\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnMultipleTokens = function(card, tokenType, tokenCount, shiftDown, subType)\n -- not checking the max at this point since clue offsets are calculated dynamically\n if tokenCount \u003c 1 then return end\n\n local offsets = {}\n if tokenType == \"clue\" then\n offsets = internal.buildClueOffsets(card, tokenCount)\n else\n -- only up to 12 offset tables defined\n if tokenCount \u003e 12 then return end\n for i = 1, tokenCount do\n offsets[i] = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[tokenCount][i])\n -- Fix the y-position for the spawn, since positionToWorld considers rotation which can\n -- have bad results for face up/down differences\n offsets[i].y = card.getPosition().y + 0.15\n end\n end\n\n if shiftDown ~= nil then\n -- Copy the offsets to make sure we don't change the static values\n local baseOffsets = offsets\n offsets = { }\n for i, baseOffset in ipairs(baseOffsets) do\n offsets[i] = baseOffset\n offsets[i][3] = offsets[i][3] + shiftDown\n end\n end\n\n if offsets == nil then\n error(\"couldn't find offsets for \" .. tokenCount .. ' tokens')\n return\n end\n\n -- handling for not provided subtype (for example when spawning from custom data helpers)\n if subType == nil then\n subType = \"\"\n end\n \n -- this is used to load the correct state for additional resource tokens (e.g. \"Ammo\")\n local callback = nil\n local stateID = stateTable[string.lower(subType)]\n if tokenType == \"resource\" and stateID ~= nil and stateID ~= 1 then\n callback = function(spawned) spawned.setState(stateID) end\n end\n\n for i = 1, tokenCount do\n TokenManager.spawnToken(offsets[i], tokenType, card.getRotation(), callback)\n end\n end\n\n -- Spawns a single token at the given global position by copying it from the template bag.\n ---@param position Global position to spawn the token\n ---@param tokenType String type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param rotation Vector Rotation to be used for the new token. Only the y-value will be used,\n -- x and z will use the default rotation from the source bag\n ---@param callback function A callback function triggered after the new token is spawned\n TokenManager.spawnToken = function(position, tokenType, rotation, callback)\n internal.initTokenTemplates()\n local loadTokenType = tokenType\n if tokenType == \"clue\" or tokenType == \"doom\" then\n loadTokenType = \"clueDoom\"\n end\n if tokenTemplates[loadTokenType] == nil then\n error(\"Unknown token type '\" .. tokenType .. \"'\")\n return\n end\n local tokenTemplate = tokenTemplates[loadTokenType]\n\n -- Take ONLY the Y-value for rotation, so we don't flip the token coming out of the bag\n local rot = Vector(tokenTemplate.Transform.rotX,\n 270,\n tokenTemplate.Transform.rotZ)\n if rotation ~= nil then\n rot.y = rotation.y\n end\n if tokenType == \"doom\" then\n rot.z = 180\n end\n\n tokenTemplate.Nickname = \"\"\n return spawnObjectData({\n data = tokenTemplate,\n position = position,\n rotation = rot,\n callback_function = callback\n })\n end\n\n -- Checks a card for metadata to maybe replenish it\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n TokenManager.maybeReplenishCard = function(card, uses, mat)\n -- TODO: support for cards with multiple uses AND replenish (as of yet, no official card needs that)\n if uses[1].count and uses[1].replenish then\n internal.replenishTokens(card, uses, mat)\n end\n end\n\n -- Delegate function to the token spawn tracker. Exists to avoid circular dependencies in some\n -- callers.\n ---@param card Object Card object to reset the tokens for\n TokenManager.resetTokensSpawned = function(card)\n tokenSpawnTrackerApi.resetTokensSpawned(card.getGUID())\n end\n\n -- Pushes new player card data into the local copy of the Data Helper player data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addPlayerCardData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n playerCardData[k] = v\n end\n end\n\n -- Pushes new location data into the local copy of the Data Helper location data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addLocationData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n locationData[k] = v\n end\n end\n\n -- Checks to see if the given card has location data in the DataHelper\n ---@param card Object Card to check for data\n ---@return Boolean True if this card has data in the helper, false otherwise\n TokenManager.hasLocationData = function(card)\n internal.initDataHelperData()\n return internal.getLocationData(card) ~= nil\n end\n\n internal.initTokenTemplates = function()\n if tokenTemplates ~= nil then\n return\n end\n tokenTemplates = { }\n local tokenSource = getObjectFromGUID(TOKEN_SOURCE_GUID)\n for _, tokenTemplate in ipairs(tokenSource.getData().ContainedObjects) do\n local tokenName = tokenTemplate.Memo\n tokenTemplates[tokenName] = tokenTemplate\n end\n end\n\n -- Copies the data from the DataHelper. Will only happen once.\n internal.initDataHelperData = function()\n if playerCardData ~= nil then\n return\n end\n local dataHelper = getObjectFromGUID(DATA_HELPER_GUID)\n playerCardData = dataHelper.getTable('PLAYER_CARD_DATA')\n locationData = dataHelper.getTable('LOCATIONS_DATA')\n end\n\n -- Spawn tokens for a card based on the uses metadata. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n internal.spawnTokensFromUses = function(card, extraUses)\n local uses = internal.getUses(card)\n if uses == nil then return end\n\n -- go through tokens to spawn\n local type, token, tokenCount\n for i, useInfo in ipairs(uses) do\n type = useInfo.type\n token = useInfo.token\n tokenCount = (useInfo.count or 0)\n + (useInfo.countPerInvestigator or 0) * playAreaApi.getInvestigatorCount()\n if extraUses ~= nil and extraUses[type] ~= nil then\n tokenCount = tokenCount + extraUses[type]\n end\n -- Shift each spawned group after the first down so they don't pile on each other\n TokenManager.spawnTokenGroup(card, token, tokenCount, (i - 1) * 0.8, type)\n end\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a card based on the data helper data. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n internal.spawnTokensFromDataHelper = function(card)\n internal.initDataHelperData()\n local playerData = internal.getPlayerCardData(card)\n if playerData ~= nil then\n internal.spawnPlayerCardTokensFromDataHelper(card, playerData)\n end\n local locationData = internal.getLocationData(card)\n if locationData ~= nil then\n internal.spawnLocationTokensFromDataHelper(card, locationData)\n end\n end\n\n -- Spawn tokens for a player card using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Player card data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnPlayerCardTokensFromDataHelper = function(card, playerData)\n token = playerData.tokenType\n tokenCount = playerData.tokenCount\n --log(\"Spawning data helper tokens for \"..card.getName()..'['..card.getDescription()..']: '..tokenCount..\"x \"..token)\n TokenManager.spawnTokenGroup(card, token, tokenCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a location using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Location data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnLocationTokensFromDataHelper = function(card, locationData)\n local clueCount = internal.getClueCountFromData(card, locationData)\n if clueCount \u003e 0 then\n TokenManager.spawnTokenGroup(card, \"clue\", clueCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n end\n\n internal.getPlayerCardData = function(card)\n return playerCardData[card.getName() .. ':' .. card.getDescription()]\n or playerCardData[card.getName()]\n end\n\n internal.getLocationData = function(card)\n return locationData[card.getName() .. '_' .. card.getGUID()] or locationData[card.getName()]\n end\n\n internal.getClueCountFromData = function(card, locationData)\n -- Return the number of clues to spawn on this location\n if locationData == nil then\n error('attempted to get clue for unexpected object: ' .. card.getName())\n return 0\n end\n\n --log(card.getName() .. ' : ' .. locationData.type .. ' : ' .. locationData.value .. ' : ' .. locationData.clueSide)\n if ((card.is_face_down and locationData.clueSide == 'back')\n or (not card.is_face_down and locationData.clueSide == 'front')) then\n if locationData.type == 'fixed' then\n return locationData.value\n elseif locationData.type == 'perPlayer' then\n return locationData.value * playAreaApi.getInvestigatorCount()\n end\n error('unexpected location type: ' .. locationData.type)\n end\n return 0\n end\n\n -- Gets the right uses structure for this card, based on metadata and face up/down state\n ---@param card Object Card to pull the uses from\n internal.getUses = function(card)\n local metadata = JSON.decode(card.getGMNotes()) or { }\n if metadata.type == \"Location\" then\n if card.is_face_down and metadata.locationBack ~= nil then\n return metadata.locationBack.uses\n elseif not card.is_face_down and metadata.locationFront ~= nil then\n return metadata.locationFront.uses\n end\n elseif not card.is_face_down then\n return metadata.uses\n end\n\n return nil\n end\n\n -- Dynamically create positions for clues on a card.\n ---@param card Object Card the clues will be placed on\n ---@param count Integer How many clues?\n ---@return Table Array of global positions to spawn the clues at\n internal.buildClueOffsets = function(card, count)\n local pos = card.getPosition()\n local cluePositions = { }\n for i = 1, count do\n local row = math.floor(1 + (i - 1) / 4)\n local column = (i - 1) % 4\n table.insert(cluePositions, Vector(pos.x + 1.5 - 0.55 * row, pos.y + 0.15, pos.z - 0.825 + 0.55 * column))\n end\n return cluePositions\n end\n\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n internal.replenishTokens = function(card, uses, mat)\n local cardPos = card.getPosition()\n\n -- don't continue for cards on the deck (Norman) or in the discard pile\n if mat.positionToLocal(cardPos).x \u003c -1 then return end\n\n -- get current amount of resource tokens on the card\n local search = internal.searchOnCard(cardPos, card.getRotation())\n local clickableResourceCounter = nil\n local foundTokens = 0\n\n for _, obj in ipairs(search) do\n local obj = obj.hit_object\n local memo = obj.getMemo()\n\n if (stateTable[memo] or 0) \u003e 0 then\n foundTokens = foundTokens + math.abs(obj.getQuantity())\n obj.destruct()\n elseif memo == \"resourceCounter\" then\n foundTokens = obj.getVar(\"val\")\n clickableResourceCounter = obj\n break\n end\n end\n\n -- this is the theoretical new amount of uses (to be checked below)\n local newCount = foundTokens + uses[1].replenish\n\n -- if there are already more uses than the replenish amount, keep them\n if foundTokens \u003e uses[1].count then\n newCount = foundTokens\n -- only replenish up until the replenish amount\n elseif newCount \u003e uses[1].count then\n newCount = uses[1].count\n end\n\n -- update the clickable counter or spawn a group of tokens\n if clickableResourceCounter then\n clickableResourceCounter.call(\"updateVal\", newCount)\n else\n TokenManager.spawnTokenGroup(card, uses[1].token, newCount, _, uses[1].type)\n end\n end\n\n -- searches on a card (standard size) and returns the result\n ---@param position Table Position of the card\n ---@param rotation Table Rotation of the card\n internal.searchOnCard = function(position, rotation)\n return Physics.cast({\n origin = position,\n direction = {0, 1, 0},\n orientation = rotation,\n type = 3,\n size = { 2.5, 0.5, 3.5 },\n max_distance = 1,\n debug = false\n })\n end\n\n return TokenManager\nend\nend)\n__bundle_register(\"core/OptionPanelApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local OptionPanelApi = {}\n\n -- loads saved options\n ---@param options Table New options table\n OptionPanelApi.loadSettings = function(options)\n return Global.call(\"loadSettings\", options)\n end\n\n -- returns option panel table\n OptionPanelApi.getOptions = function()\n return Global.getTable(\"optionPanel\")\n end\n\n return OptionPanelApi\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "{\"acknowledgedUpgradeVersions\":[],\"optionPanel\":{\"cardLanguage\":\"en\",\"playAreaSnapTags\":true,\"showAttachmentHelper\":false,\"showCleanUpHelper\":false,\"showCustomPlaymatImages\":false,\"showCYOA\":false,\"showDisplacementTool\":false,\"showDrawButton\":false,\"showHandHelper\":[],\"showSearchAssistant\":[],\"showTitleSplash\":true,\"useClueClickers\":false,\"useResourceCounters\":\"disabled\",\"useSnapTags\":true}}", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/Global\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal guidReferenceApi = require(\"core/GUIDReferenceApi\")\nlocal mythosAreaApi = require(\"core/MythosAreaApi\")\nlocal navigationOverlayApi = require(\"core/NavigationOverlayApi\")\nlocal playAreaApi = require(\"core/PlayAreaApi\")\nlocal playmatApi = require(\"playermat/PlaymatApi\")\nlocal soundCubeApi = require(\"core/SoundCubeApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\nlocal tokenChecker = require(\"core/token/TokenChecker\")\nlocal tokenManager = require(\"core/token/TokenManager\")\n\n---------------------------------------------------------\n-- general setup\n---------------------------------------------------------\n\nENCOUNTER_DECK_POS = { -3.93, 1, 5.76 }\nENCOUNTER_DECK_DISCARD_POSITION = { -3.85, 1, 10.38 }\n\n-- GUIDs that will not be interactable (e.g. parts of the table)\nlocal NOT_INTERACTABLE = {\n \"6161b4\", -- Decoration-Map\n \"721ba2\", -- PlayArea\n \"9f334f\", -- MythosArea\n \"463022\", -- Panel behind tentacle stand\n \"f182ee\", -- InvestigatorCount\n \"7bff34\", -- Tentacle stand\n \"8646eb\", -- horizontal border left\n \"75937e\", -- horizontal border right\n \"612072\", -- vertical border left\n \"975c39\", -- vertical border right\n}\n\n-- global variable for access\nchaosTokens = {}\nlocal chaosTokensLastMat = nil\n\nlocal bagSearchers = {}\nlocal MAT_COLORS = { \"White\", \"Orange\", \"Green\", \"Red\" }\nlocal hideTitleSplashWaitFunctionId = nil\n\n-- online functionality related variables\nlocal MOD_VERSION = \"3.4.0\"\nlocal SOURCE_REPO = 'https://raw.githubusercontent.com/chr1z93/loadable-objects/main'\nlocal library, requestObj, modMeta\nlocal acknowledgedUpgradeVersions = {}\nlocal contentToShow = \"campaigns\"\nlocal currentListItem = 1\nlocal xmlVisibility = {\n downloadWindow = false,\n optionPanel = false,\n playareaGallery = false,\n updateNotification = false\n}\nlocal tabIdTable = {\n tab1 = \"campaigns\",\n tab2 = \"scenarios\",\n tab3 = \"fanmadeCampaigns\",\n tab4 = \"fanmadeScenarios\",\n tab5 = \"fanmadePlayerCards\"\n}\n\n-- optionPanel data\noptionPanel = {}\nlocal LANGUAGES = {\n { code = \"zh_CN\", name = \"简体中文\" },\n { code = \"zh_TW\", name = \"繁體中文\" },\n { code = \"de\", name = \"Deutsch\" },\n { code = \"en\", name = \"English\" },\n { code = \"es\", name = \"Español\" },\n { code = \"fr\", name = \"Français\" },\n { code = \"it\", name = \"Italiano\" }\n}\nlocal RESOURCE_OPTIONS = {\n \"enabled\",\n \"custom\",\n \"disabled\"\n}\n\n---------------------------------------------------------\n-- data for tokens\n---------------------------------------------------------\n\nTOKEN_DATA = {\n damage = {image = \"http://cloud-3.steamusercontent.com/ugc/1758068501357115146/903D11AAE7BD5C254C8DC136E9202EE516289DEA/\", scale = {0.17, 0.17, 0.17}},\n horror = {image = \"http://cloud-3.steamusercontent.com/ugc/1758068501357163535/6D9E0756503664D65BDB384656AC6D4BD713F5FC/\", scale = {0.17, 0.17, 0.17}},\n resource = {image = \"http://cloud-3.steamusercontent.com/ugc/1758068501357192910/11DDDC7EF621320962FDCF3AE3211D5EDC3D1573/\", scale = {0.17, 0.17, 0.17}},\n doom = {image = \"https://i.imgur.com/EoL7yaZ.png\", scale = {0.17, 0.17, 0.17}},\n clue = {image = \"http://cloud-3.steamusercontent.com/ugc/1758068501357164917/1D06F1DC4D6888B6F57124BD2AFE20D0B0DA15A8/\", scale = {0.15, 0.15, 0.15}}\n}\n\nID_URL_MAP = {\n ['blue'] = {name = \"Elder Sign\", url = 'https://i.imgur.com/nEmqjmj.png'},\n ['p1'] = {name = \"+1\", url = 'https://i.imgur.com/uIx8jbY.png'},\n ['0'] = {name = \"0\", url = 'https://i.imgur.com/btEtVfd.png'},\n ['m1'] = {name = \"-1\", url = 'https://i.imgur.com/w3XbrCC.png'},\n ['m2'] = {name = \"-2\", url = 'https://i.imgur.com/bfTg2hb.png'},\n ['m3'] = {name = \"-3\", url = 'https://i.imgur.com/yfs8gHq.png'},\n ['m4'] = {name = \"-4\", url = 'https://i.imgur.com/qrgGQRD.png'},\n ['m5'] = {name = \"-5\", url = 'https://i.imgur.com/3Ym1IeG.png'},\n ['m6'] = {name = \"-6\", url = 'https://i.imgur.com/c9qdSzS.png'},\n ['m7'] = {name = \"-7\", url = 'https://i.imgur.com/4WRD42n.png'},\n ['m8'] = {name = \"-8\", url = 'https://i.imgur.com/9t3rPTQ.png'},\n ['skull'] = {name = \"Skull\", url = 'https://i.imgur.com/stbBxtx.png'},\n ['cultist'] = {name = \"Cultist\", url = 'https://i.imgur.com/VzhJJaH.png'},\n ['tablet'] = {name = \"Tablet\", url = 'https://i.imgur.com/1plY463.png'},\n ['elder'] = {name = \"Elder Thing\", url = 'https://i.imgur.com/ttnspKt.png'},\n ['red'] = {name = \"Auto-fail\", url = 'https://i.imgur.com/lns4fhz.png'},\n ['bless'] = {name = \"Bless\", url = 'http://cloud-3.steamusercontent.com/ugc/1655601092778627699/339FB716CB25CA6025C338F13AFDFD9AC6FA8356/'},\n ['curse'] = {name = \"Curse\", url = 'http://cloud-3.steamusercontent.com/ugc/1655601092778636039/2A25BD38E8C44701D80DD96BF0121DA21843672E/'},\n\t['frost'] = {name = \"Frost\", url = 'http://cloud-3.steamusercontent.com/ugc/1858293462583104677/195F93C063A8881B805CE2FD4767A9718B27B6AE/'}\n}\n\n---------------------------------------------------------\n-- data for chaos token stat tracker\n---------------------------------------------------------\n\nlocal tokenDrawingStats = {\n [\"Overall\"] = {},\n [\"8b081b\"] = {},\n [\"bd0ff4\"] = {},\n [\"383d8b\"] = {},\n [\"0840d5\"] = {}\n}\n\n---------------------------------------------------------\n-- general code\n---------------------------------------------------------\n\n-- saving state of optionPanel to restore later\nfunction onSave()\n return JSON.encode({\n optionPanel = optionPanel,\n acknowledgedUpgradeVersions = acknowledgedUpgradeVersions\n })\nend\n\nfunction onLoad(savedData)\n if savedData then\n loadedData = JSON.decode(savedData)\n optionPanel = loadedData.optionPanel\n acknowledgedUpgradeVersions = loadedData.acknowledgedUpgradeVersions\n updateOptionPanelState()\n else\n print(\"Saved state could not be found!\")\n end\n\n for _, guid in ipairs(NOT_INTERACTABLE) do\n local obj = getObjectFromGUID(guid)\n if obj ~= nil then obj.interactable = false end\n end\n\n resetChaosTokenStatTracker()\n getModVersion()\n math.randomseed(os.time())\n\n -- initialization of loadable objects library (delay to let Navigation Overlay build)\n Wait.time(function()\n WebRequest.get(SOURCE_REPO .. '/library.json', libraryDownloadCallback)\n end, 1)\nend\n\n-- Event hook for any object search. When chaos tokens are manipulated while the chaos bag\n-- container is being searched, a TTS bug can cause tokens to duplicate or vanish. We lock the\n-- chaos bag during search operations to avoid this.\nfunction onObjectSearchStart(object, playerColor)\n chaosbag = findChaosBag()\n if object == chaosbag then\n bagSearchers[playerColor] = true\n end\nend\n\n-- Event hook for any object search. When chaos tokens are manipulated while the chaos bag\n-- container is being searched, a TTS bug can cause tokens to duplicate or vanish. We lock the\n-- chaos bag during search operations to avoid this.\nfunction onObjectSearchEnd(object, playerColor)\n chaosbag = findChaosBag()\n if object == chaosbag then\n bagSearchers[playerColor] = nil\n end\nend\n\n-- Pass object enter container events to the PlayArea to clear vector lines from dragged cards.\n-- This requires the try method as cards won't exist any more after they enter a deck, so the lines\n-- can't be cleared.\nfunction tryObjectEnterContainer(container, object)\n playAreaApi.tryObjectEnterContainer(container, object)\n return true\nend\n\n-- TTS event for objects that enter zones\n-- used to detect the \"token discard zones\" beneath the hand zones\nfunction onObjectEnterZone(zone, enteringObj)\n if zone.getName() ~= \"TokenDiscardZone\" then return end\n if tokenChecker.isChaosToken(enteringObj) then return end\n \n if enteringObj.type == \"Tile\" and enteringObj.getMemo() and enteringObj.getLock() == false then\n local matcolor = playmatApi.getMatColorByPosition(enteringObj.getPosition())\n local trash = guidReferenceApi.getObjectByOwnerAndType(matcolor, \"Trash\")\n trash.putObject(enteringObj)\n end\nend\n\n---------------------------------------------------------\n-- chaos token drawing\n---------------------------------------------------------\n\n-- checks scripting zone for chaos bag (also called by a lot of objects!)\nfunction findChaosBag()\n local chaosbag_zone = getObjectFromGUID(\"83ef06\")\n\n -- error handling: scripting zone not found\n if chaosbag_zone == nil then\n printToAll(\"Zone for chaos bag detection couldn't be found.\", \"Red\")\n return\n end\n\n for _, item in ipairs(chaosbag_zone.getObjects()) do\n if item.getDescription() == \"Chaos Bag\" then\n return item\n end\n end\n\n -- error handling: chaos bag not found\n printToAll(\"Chaos bag couldn't be found.\", \"Red\")\nend\n\nfunction returnChaosTokens()\n for _, token in pairs(chaosTokens) do\n if token ~= nil then chaosbag.putObject(token) end\n end\n chaosTokens = {}\nend\n\n-- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n-- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n-- contents of the bag should check this method before doing so.\n-- This method will broadcast a message to all players if the bag is being searched.\n---@return Boolean. True if the bag is manipulated, false if it should be blocked.\nfunction canTouchChaosTokens()\n for color, searching in pairs(bagSearchers) do\n if searching then\n broadcastToAll(\"Someone is searching the chaos bag, can't touch the tokens.\", \"Red\")\n return false\n end\n end\n return true\nend\n\n-- called by playermats (by the \"Draw chaos token\" button)\nfunction drawChaosToken(params)\n if not canTouchChaosTokens() then return end\n\n local mat = params[1]\n local tokenOffset = params[2]\n local isRightClick = params[3]\n chaosbag = findChaosBag()\n\n -- return token(s) on other playmat first\n if chaosTokensLastMat ~= nil and chaosTokensLastMat ~= mat and #chaosTokens ~= 0 then\n returnChaosTokens()\n chaosTokensLastMat = nil\n return\n end\n\n chaosTokensLastMat = mat\n\n -- if we have left clicked and have no tokens OR if we have right clicked\n if isRightClick or #chaosTokens == 0 then\n if #chaosbag.getObjects() == 0 then return end\n chaosbag.shuffle()\n\n -- add the token to the list, compute new position based on list length\n tokenOffset[1] = tokenOffset[1] + (0.17 * #chaosTokens)\n local token = chaosbag.takeObject({\n index = 0,\n position = mat.positionToWorld(tokenOffset),\n rotation = mat.getRotation()\n })\n\n -- get data for token description\n local name = token.getName()\n local tokenData = mythosAreaApi.returnTokenData().tokenData or {}\n local specificData = tokenData[name] or {}\n token.setDescription(specificData.description or \"\")\n\n -- track the chaos token (for stat tracker and future returning)\n trackChaosToken(name, mat.getGUID())\n chaosTokens[#chaosTokens + 1] = token\n return\n else\n returnChaosTokens()\n end\nend\n\n---------------------------------------------------------\n-- token spawning\n---------------------------------------------------------\n\n-- DEPRECATED. Use TokenManager instead.\n-- Spawns a single token.\n---@param params Table. Array with arguments to the method. 1 = position, 2 = type, 3 = rotation\nfunction spawnToken(params)\n return tokenManager.spawnToken(params[1], params[2], params[3])\nend\n\n---------------------------------------------------------\n-- chaos token stat tracker\n---------------------------------------------------------\n\nfunction trackChaosToken(tokenName, matGUID)\n tokenDrawingStats[\"Overall\"][tokenName] = (tokenDrawingStats[\"Overall\"][tokenName] or 0) + 1\n tokenDrawingStats[matGUID][tokenName] = (tokenDrawingStats[matGUID][tokenName] or 0) + 1\nend\n\n-- Left-click: print stats, Right-click: reset stats\nfunction handleStatTrackerClick(_, _, isRightClick)\n if isRightClick then\n resetChaosTokenStatTracker()\n else\n local squidKing = \"Nobody\"\n local maxSquid = 0\n local foundAnyStats = false\n\n for key, personalStats in pairs(tokenDrawingStats) do\n local playerColor, playerName\n\n if key == \"Overall\" then\n playerColor = \"White\"\n playerName = \"Overall\"\n else\n -- get mat color\n local matColor = playmatApi.getMatColorByPosition(getObjectFromGUID(key).getPosition())\n playerColor = playmatApi.getPlayerColor(matColor)\n playerName = Player[playerColor].steam_name or playerColor\n\n local playerSquidCount = personalStats[\"Auto-fail\"]\n if playerSquidCount \u003e maxSquid then\n squidKing = playerName\n maxSquid = playerSquidCount\n end\n end\n\n -- get the total count of drawn tokens for the player\n local totalCount = 0\n for tokenName, value in pairs(personalStats) do\n totalCount = totalCount + value\n end\n\n -- only print the personal stats if any tokens were drawn\n if totalCount \u003e 0 then\n foundAnyStats = true\n printToAll(\"------------------------------\")\n printToAll(playerName .. \" Stats\", playerColor)\n\n for tokenName, value in pairs(personalStats) do\n if value ~= 0 then\n printToAll(tokenName .. ': ' .. tostring(value))\n end\n end\n printToAll('Total: ' .. tostring(totalCount))\n end\n end\n\n -- detect if any player drew tokens\n if foundAnyStats then\n printToAll(\"------------------------------\")\n printToAll(squidKing .. \" is an auto-fail magnet.\", { 255, 0, 0 })\n else\n printToAll(\"No tokens have been drawn yet.\", \"Yellow\")\n end\n end\nend\n\n-- resets the count for each token to 0\nfunction resetChaosTokenStatTracker()\n for key, _ in pairs(tokenDrawingStats) do\n tokenDrawingStats[key] = {}\n for _, token in pairs(ID_URL_MAP) do\n tokenDrawingStats[key][token.name] = 0\n end\n end\nend\n\n---------------------------------------------------------\n-- Difficulty selector script\n---------------------------------------------------------\n\n-- called for button creation on the difficulty selectors\n---@param object object Usually \"self\"\n---@param key string Name of the scenario\nfunction createSetupButtons(args)\n local data = getDataValue('modeData', args.key)\n if data ~= nil then\n local buttonParameters = {}\n buttonParameters.function_owner = args.object\n buttonParameters.position = { 0, 0.1, -0.15 }\n buttonParameters.scale = { 0.47, 1, 0.47 }\n buttonParameters.height = 200\n buttonParameters.width = 1150\n buttonParameters.color = { 0.87, 0.8, 0.7 }\n\n if data.easy ~= nil then\n buttonParameters.label = \"Easy\"\n buttonParameters.click_function = \"easyClick\"\n args.object.createButton(buttonParameters)\n buttonParameters.position[3] = buttonParameters.position[3] + 0.20\n end\n\n if data.normal ~= nil then\n buttonParameters.label = \"Standard\"\n buttonParameters.click_function = \"normalClick\"\n args.object.createButton(buttonParameters)\n buttonParameters.position[3] = buttonParameters.position[3] + 0.20\n end\n\n if data.hard ~= nil then\n buttonParameters.label = \"Hard\"\n buttonParameters.click_function = \"hardClick\"\n args.object.createButton(buttonParameters)\n buttonParameters.position[3] = buttonParameters.position[3] + 0.20\n end\n\n if data.expert ~= nil then\n buttonParameters.label = \"Expert\"\n buttonParameters.click_function = \"expertClick\"\n args.object.createButton(buttonParameters)\n buttonParameters.position[3] = buttonParameters.position[3] + 0.20\n end\n\n if data.standalone ~= nil then\n buttonParameters.label = \"Standalone\"\n buttonParameters.click_function = \"standaloneClick\"\n args.object.createButton(buttonParameters)\n end\n end\nend\n\n-- called for adding chaos tokens\n---@param object object Usually \"self\"\n---@param key string Name of the scenario\n---@param mode string difficulty (e.g. \"hard\" or \"expert\")\nfunction fillContainer(args)\n local data = getDataValue('modeData', args.key)\n if data == nil then return end\n\n local value = data[args.mode]\n if value == nil or value.token == nil then return end\n\n local tokenList = {}\n\n for _, tokenId in ipairs(value.token) do\n table.insert(tokenList, tokenId)\n end\n\n if value.append ~= nil then\n for _, tokenId in ipairs(value.append) do\n table.insert(tokenList, tokenId)\n end\n end\n\n -- randomly choose tokens for specific Carcosa scenarios in standalone\n if value.random then\n local n = #value.random\n if n \u003e 0 then\n for _, tokenId in ipairs(value.random[math.random(1, n)]) do\n table.insert(tokenList, tokenId)\n end\n end\n end\n\n setChaosBagState(tokenList)\n\n if value.message then\n broadcastToAll(value.message)\n end\n\n if value.warning then\n broadcastToAll(value.warning, { 1, 0.5, 0.5 })\n end\nend\n\nfunction getDataValue(storage, key)\n local DATA_HELPER = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"DataHelper\")\n local data = DATA_HELPER.getTable(storage)\n if data ~= nil then\n local value = data[key]\n if value ~= nil then\n local res = {}\n for m, v in pairs(value) do\n res[m] = v\n if res[m].parent ~= nil then\n local parentData = getDataValue(storage, res[m].parent)\n if parentData ~= nil and parentData[m] ~= nil and parentData[m].token ~= nil then\n res[m].token = parentData[m].token\n end\n res[m].parent = nil\n end\n end\n return res\n end\n end\nend\n\nfunction createChaosTokenNameLookupTable()\n local namesToIds = {}\n for k, v in pairs(ID_URL_MAP) do\n namesToIds[v.name] = k\n end\n return namesToIds\nend\n\n-- returns a Table List of chaos token ids in the current chaos bag\n---@api chaosbag/ChaosBagApi\nfunction getChaosBagState()\n local tokens = {}\n local invertedTable = createChaosTokenNameLookupTable()\n local chaosbag = findChaosBag()\n\n for _, v in ipairs(chaosbag.getObjects()) do\n local id = invertedTable[v.name]\n if id then\n table.insert(tokens, id)\n else\n printToAll(v.name .. \" token not recognized. Will not be recorded.\", \"Yellow\")\n end\n end\n\n return tokens\nend\n\n-- respawns the chaos bag with a new state of tokens\n---@param tokenList Table List of chaos token ids\n---@api chaosbag/ChaosBagApi\nfunction setChaosBagState(tokenList)\n if not canTouchChaosTokens() then return end\n\n local chaosbag = findChaosBag()\n local chaosbagData = chaosbag.getData()\n local reserveData = getObjectFromGUID(\"106418\").getData()\n local tokenCache = {}\n local containedObjects = {}\n\n -- create a temporary copy of the data for each chaos token\n for _, objData in ipairs(reserveData.ContainedObjects) do\n tokenCache[objData.Nickname] = objData\n end\n\n -- iterate over tokenlist and insert specified tokens into new table\n for _, tokenId in ipairs(tokenList) do\n local tokenName = ID_URL_MAP[tokenId].name\n table.insert(containedObjects, tokenCache[tokenName])\n end\n\n -- overwrite chaos bag content and respawn it\n chaosbagData.ContainedObjects = containedObjects\n chaosbag.destruct()\n spawnObjectData({ data = chaosbagData })\n\n -- remove tokens that are still in play\n for _, token in pairs(chaosTokens) do\n if token ~= nil then token.destruct() end\n end\n chaosTokens = {}\n chaosTokensLastMat = nil\n\n -- reset bless / curse manager\n blessCurseManagerApi.removeTakenTokensAndReset()\n\n printToAll(\"Chaos bag set to chosen difficulty.\", \"Green\")\nend\n\n-- spawns the specified chaos token and puts it into the chaos bag\n---@param id String ID of the chaos token\nfunction spawnChaosToken(id)\n if not canTouchChaosTokens() then return end\n\n id = id:lower()\n local chaosbag = findChaosBag()\n local url = ID_URL_MAP[id].url or \"\"\n\n if url ~= \"\" then\n return spawnObject({\n type = 'Custom_Tile',\n position = { 0.49, 3, 0 },\n scale = { 0.81, 1.0, 0.81 },\n rotation = { 0, 270, 0 },\n callback_function = function(obj)\n obj.setName(ID_URL_MAP[id].name)\n chaosbag.putObject(obj)\n tokenArrangerApi.layout()\n end\n }).setCustomObject({\n type = 2,\n image = url,\n thickness = 0.1\n })\n end\nend\n\n-- removes the specified chaos token from the chaos bag\n---@param id String ID of the chaos token\nfunction removeChaosToken(id)\n if not canTouchChaosTokens() then return end\n\n local tokens = {}\n local chaosbag = findChaosBag()\n local name = ID_URL_MAP[id].name\n\n for _, v in ipairs(chaosbag.getObjects()) do\n if v.name == name then table.insert(tokens, v.guid) end\n end\n\n -- error handling: no matching token found\n if #tokens == 0 then\n printToAll(\"No \" .. name .. \" tokens in the chaos bag.\", \"Yellow\")\n return\n end\n\n chaosbag.takeObject({\n guid = tokens[1],\n smooth = false,\n callback_function = function(obj)\n obj.destruct()\n tokenArrangerApi.layout()\n end\n })\n printToAll(\"Removing \" .. name .. \" token (in bag: \" .. #tokens - 1 .. \")\", \"White\")\nend\n\n-- empty the chaos bag\nfunction emptyChaosBag()\n if not canTouchChaosTokens() then return end\n\n local chaosbag = findChaosBag()\n for _, object in ipairs(chaosbag.getObjects()) do\n chaosbag.takeObject({ callback_function = function(item) item.destruct() end })\n end\nend\n\n-- returns all sealed tokens on cards to the chaos bag\nfunction releaseAllSealedTokens(playerColor)\n local chaosbag = findChaosBag()\n for _, obj in ipairs(getObjectsWithTag(\"CardThatSeals\")) do\n obj.call(\"releaseAllTokens\", playerColor)\n end\nend\n\n---------------------------------------------------------\n-- Content Importing and XML functions\n---------------------------------------------------------\n\n-- forwards the requested content type to the update function and sets highlight to clicked tab\n---@param tabId String Id of the clicked tab\nfunction onClick_tab(_, _, tabId)\n for listId, listContent in pairs(tabIdTable) do\n if listId == tabId then\n UI.setClass(listId, 'downloadTab activeTab')\n contentToShow = listContent\n else\n UI.setClass(listId, 'downloadTab')\n end\n end\n currentListItem = 1\n updateDownloadItemList()\nend\n\n-- click function for the items in the download window\n-- updates backgroundcolor for row panel and fontcolor for list item\nfunction onClick_select(_, _, identificationKey)\n UI.setAttribute(\"panel\" .. currentListItem, \"color\", \"clear\")\n UI.setAttribute(contentToShow .. \"_\" .. currentListItem, \"color\", \"white\")\n \n -- parses the identification key (contentToShow_currentListItem)\n if identificationKey then\n contentToShow = nil\n currentListItem = nil\n for str in string.gmatch(identificationKey, \"([^_]+)\") do\n if not contentToShow then\n -- grab the first part to know the content type\n contentToShow = str\n else\n -- get the index\n currentListItem = tonumber(str)\n break\n end\n end\n end\n\n UI.setAttribute(\"panel\" .. currentListItem, \"color\", \"grey\")\n UI.setAttribute(contentToShow .. \"_\" .. currentListItem, \"color\", \"black\")\n updatePreviewWindow()\nend\n\n-- click function for the download button in the preview window\nfunction onClick_download(player)\n local params = library[contentToShow][currentListItem]\n params.player = player\n placeholder_download(params)\nend\n\n-- the download button on the placeholder objects calls this to directly initiate a download\n---@param param Table contains url and guid of replacement object\nfunction placeholder_download(params)\n local url = SOURCE_REPO .. '/' .. params.url\n requestObj = WebRequest.get(url, function (request) contentDownloadCallback(request, params) end)\n startLuaCoroutine(Global, 'downloadCoroutine')\nend\n\nfunction downloadCoroutine()\n -- show progress bar\n UI.setAttribute('download_progress', 'active', true)\n\n -- update progress bar\n while requestObj do\n UI.setAttribute('download_progress', 'percentage', requestObj.download_progress * 100)\n coroutine.yield(0)\n end\n UI.setAttribute('download_progress', 'percentage', 100)\n\n -- wait 30 frames\n for i = 1, 30 do\n coroutine.yield(0)\n end\n\n -- hide progress bar\n UI.setAttribute('download_progress', 'active', false)\n\n -- hide download window\n if xmlVisibility.downloadWindow then\n xmlVisibility.downloadWindow = false\n UI.hide('downloadWindow')\n end\n return 1\nend\n\n-- spawns a bag that contains every object from the library\nfunction onClick_downloadAll()\n broadcastToAll(\"Download initiated - this will take a few minutes!\")\n\n -- hide download window\n if xmlVisibility.downloadWindow then\n xmlVisibility.downloadWindow = false\n UI.hide('downloadWindow')\n end\n\n startLuaCoroutine(Global, \"coroutineDownloadAll\")\nend\n\nfunction coroutineDownloadAll()\n local JSON = [[\n {\n \"Name\": \"Bag\",\n \"Transform\": {\n \"posX\": -39.5,\n \"posY\": 2,\n \"posZ\": -87,\n \"rotX\": 0,\n \"rotY\": 270,\n \"rotZ\": 0,\n \"scaleX\": 1.0,\n \"scaleY\": 1.0,\n \"scaleZ\": 1.0\n },\n \"Nickname\": \"All Downloadable Content\",\n \"Bag\": {\n \"Order\": 0\n },\n \"ContainedObjects\": [\n ]]\n \n local contained = \"\"\n local downloadedItems = 0\n local skippedItems = 0\n\n -- loop through the library to add content\n for contentType, objectList in pairs(library) do\n broadcastToAll(\"Downloading \" .. contentType .. \"...\")\n for _, params in ipairs(objectList) do\n local request = WebRequest.get(SOURCE_REPO .. '/' .. params.url)\n local start = os.time()\n while true do\n if request.is_done then\n contained = contained .. request.text .. \",\"\n downloadedItems = downloadedItems + 1\n break\n -- time-out if item can't be loaded in 5s\n elseif request.is_error or (os.time() - start) \u003e 5 then\n skippedItems = skippedItems + 1\n break\n end\n coroutine.yield(0)\n end\n end\n end\n\n JSON = JSON .. contained .. \"]}\"\n spawnObjectJSON({json = JSON})\n\n broadcastToAll(downloadedItems .. \" objects downloaded.\", \"Green\")\n broadcastToAll(skippedItems .. \" objects had a time-out / error.\", \"Orange\")\n return 1\nend\n\n-- spawns a placeholder box for the selected object\nfunction onClick_spawnPlaceholder()\n -- get object references\n local item = library[contentToShow][currentListItem]\n local dummy = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"PlaceholderBoxDummy\")\n \n -- error handling\n if not item.boxsize or item.boxsize == \"\" or not item.boxart or item.boxart == \"\" then\n print(\"Error loading object.\")\n return\n end\n\n -- get data for placeholder\n local spawnPos = {-39.5, 2, -87}\n\n local meshTable = {\n big = \"https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/core_h_MSH.obj\",\n small = \"https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj\",\n wide = \"http://pastebin.com/raw.php?i=uWAmuNZ2\"\n }\n\n local scaleTable = {\n big = {1.00, 0.14, 1.00},\n small = {2.21, 0.46, 2.42},\n wide = {2.00, 0.11, 1.69}\n }\n\n local placeholder = spawnObject({\n type = \"Custom_Model\",\n position = spawnPos,\n rotation = {0, 270, 0},\n scale = scaleTable[item.boxsize],\n })\n \n placeholder.setCustomObject({\n mesh = meshTable[item.boxsize],\n diffuse = item.boxart,\n material = 3\n })\n\n placeholder.setColorTint({1, 1, 1, 71/255})\n placeholder.setName(item.name)\n placeholder.setDescription(\"by \" .. (item.author or \"Unknown\"))\n placeholder.setGMNotes(item.url)\n placeholder.setLuaScript(dummy.getLuaScript())\n Player.getPlayers()[1].pingTable(spawnPos)\n\n -- hide download window\n if xmlVisibility.downloadWindow then\n xmlVisibility.downloadWindow = false\n UI.hide('downloadWindow')\n end\nend\n\n-- toggles the visibility of the respective UI\n---@param player LuaPlayer Player that triggered this\n---@param title String Name of the UI to toggle\nfunction onClick_toggleUi(player, title)\n if title == \"Navigation Overlay\" then\n navigationOverlayApi.cycleVisibility(player.color)\n return\n -- hide the playareaGallery if visible\n elseif title == \"downloadWindow\" and xmlVisibility.playareaGallery then\n onClick_toggleUi(_, \"playareaGallery\")\n -- hide the downloadWindow if visible\n elseif title == \"playareaGallery\" and xmlVisibility.downloadWindow then\n onClick_toggleUi(_, \"downloadWindow\")\n end\n\n if xmlVisibility[title] then\n -- small delay to allow button click sounds to play\n Wait.time(function() UI.hide(title) end, 0.1)\n else\n UI.show(title)\n end\n xmlVisibility[title] = not xmlVisibility[title]\nend\n\n-- forwards the call to the onClick function\nfunction togglePlayareaGallery()\n onClick_toggleUi(_, \"playareaGallery\")\nend\n\n-- updates the preview window\nfunction updatePreviewWindow()\n local item = library[contentToShow][currentListItem]\n local tempImage = \"http://cloud-3.steamusercontent.com/ugc/2115061845788345842/2CD6ABC551555CCF58F9D0DDB7620197BA398B06/\"\n\n -- set default image if not defined\n if item.boxsize == nil or item.boxsize == \"\" or item.boxart == nil or item.boxart == \"\" then\n item.boxsize = \"big\"\n item.boxart = \"http://cloud-3.steamusercontent.com/ugc/762723517667628371/18438B0A0045038A7099648AA3346DFCAA267C66/\"\n end\n\n UI.setValue(\"previewTitle\", item.name)\n UI.setValue(\"previewAuthor\", \"by \" .. (item.author or \"- Author not found -\"))\n UI.setValue(\"previewDescription\", item.description or \"- Description not found -\")\n\n -- update mask according to size (hardcoded values to align image in mask)\n local maskData = {}\n if item.boxsize == \"big\" then\n maskData = {\n image = \"box-cover-mask-big\",\n width = \"870\",\n height = \"435\",\n offsetXY = \"154 60\"\n }\n elseif item.boxsize == \"small\" then\n maskData = {\n image = \"box-cover-mask-small\",\n width = \"792\",\n height = \"594\",\n offsetXY = \"135 13\"\n }\n elseif item.boxsize == \"wide\" then\n maskData = {\n image = \"box-cover-mask-wide\",\n width = \"756\",\n height = \"630\",\n offsetXY = \"-190 -70\"\n }\n end\n\n -- loading empty image as placeholder until real image is loaded\n UI.setAttribute(\"previewArtImage\", \"image\", tempImage)\n \n -- insert the image itself\n UI.setAttribute(\"previewArtImage\", \"image\", item.boxart)\n UI.setAttributes(\"previewArtMask\", maskData)\nend\n\n-- formats the json response from the webrequest into a key-value lua table\n-- strips the prefix from the community content items\nfunction formatLibrary(json_response)\n library = {}\n library[\"campaigns\"] = json_response.campaigns\n library[\"scenarios\"] = json_response.scenarios\n library[\"extras\"] = json_response.extras\n library[\"fanmadeCampaigns\"] = {}\n library[\"fanmadeScenarios\"] = {}\n library[\"fanmadePlayerCards\"] = {}\n\n for _, item in ipairs(json_response.community) do\n local identifier = nil\n for str in string.gmatch(item.name, \"([^:]+)\") do\n if not identifier then\n -- grab the first part to know the content type\n identifier = str\n else\n -- update the name without the content type\n item.name = str\n break\n end\n end\n\n if identifier == \"Fan Investigators\" then\n table.insert(library[\"fanmadePlayerCards\"], item)\n elseif identifier == \"Fan Campaign\" then\n table.insert(library[\"fanmadeCampaigns\"], item)\n elseif identifier == \"Fan Scenario\" then\n table.insert(library[\"fanmadeScenarios\"], item)\n end\n end\nend\n\n-- updates the window content to the requested content\nfunction updateDownloadItemList()\n if not library then return end\n\n -- addition of list items according to library file\n local globalXml = UI.getXmlTable()\n local contentList = getXmlTableElementById(globalXml, 'contentList')\n\n contentList.children = {}\n for i, v in ipairs(library[contentToShow]) do\n table.insert(contentList.children,\n {\n tag = \"Panel\",\n attributes = { id = \"panel\" .. i },\n children = {\n tag = 'Text',\n value = v.name,\n attributes = {\n id = contentToShow .. \"_\" .. i,\n onClick = 'onClick_select',\n alignment = 'MiddleLeft'\n }\n }\n })\n end\n\n contentList.attributes.height = #contentList.children * 27\n UI.setXmlTable(globalXml)\n\n -- select the first item\n Wait.time(onClick_select, 0.2)\nend\n\n-- called after the webrequest of downloading an item\n-- deletes the placeholder and spawns the downloaded item\nfunction contentDownloadCallback(request, params)\n requestObj = nil\n\n -- error handling\n if request.is_error or request.response_code ~= 200 then\n print('Error: ' .. request.error)\n return\n end\n\n -- initiate content spawning\n local spawnTable = { json = request.text }\n if params.replace then\n local replacedObject = getObjectFromGUID(params.replace)\n if replacedObject then\n spawnTable.position = replacedObject.getPosition()\n spawnTable.rotation = replacedObject.getRotation()\n spawnTable.scale = replacedObject.getScale()\n destroyObject(replacedObject)\n end\n end\n\n -- if position is undefined, get empty position\n if not spawnTable.position then\n spawnTable.rotation = { 0, 270, 0}\n\n local pos = getValidSpawnPosition()\n if pos then\n spawnTable.position = pos\n else\n broadcastToAll(\"Please make space in the area below the tentacle stand in the upper middle of the table and try again.\", \"Red\")\n return\n end\n end\n\n -- if spawned from menu, move the camera and/or ping the table\n if params.name then\n spawnTable[\"callback_function\"] = function(obj)\n Wait.time(function()\n -- move camera\n if params.player then\n params.player.lookAt({\n position = obj.getPosition(),\n pitch = 65,\n yaw = 90,\n distance = 65\n })\n end\n \n -- ping object\n local pingPlayer = params.player or Player.getPlayers()[1]\n pingPlayer.pingTable(obj.getPosition())\n end, 0.1)\n end\n end\n\n if pcall(function() spawnObjectJSON(spawnTable) end) then\n print('Object loaded.')\n else\n print('Error loading object.')\n end\nend\n\n-- gets the first empty position to spawn a custom content object safely\nfunction getValidSpawnPosition()\n local potentialSpawnPositionX = { 65, 50, 35 }\n local potentialSpawnPositionY = 1.5\n local potentialSpawnPositionZ = { 35, 21, 7, -7, -21, -35 }\n\n for i, posX in ipairs(potentialSpawnPositionX) do\n for j, posZ in ipairs(potentialSpawnPositionZ) do\n local pos = {\n x = posX,\n y = potentialSpawnPositionY,\n z = posZ,\n }\n if checkPositionForContentSpawn(pos) then\n return pos\n end\n end\n end\n return nil\nend\n\n-- checks whether something is in the specified position\n-- returns true if empty\nfunction checkPositionForContentSpawn(checkPos)\n local search = Physics.cast({\n direction = { 0, 1, 0 },\n max_distance = 0.1,\n type = 3,\n size = { 0.1, 0.1, 0.1 },\n origin = checkPos\n })\n -- first hit is the table surface, additional hits means something is there\n return #search == 1\nend\n\n-- downloading of the library file\nfunction libraryDownloadCallback(request)\n if request.is_error or request.response_code ~= 200 then\n print('error: ' .. request.error)\n return\n end\n\n local json_response = nil\n if pcall(function () json_response = JSON.decode(request.text) end) then\n formatLibrary(json_response)\n updateDownloadItemList()\n else\n print('error parsing downloaded library')\n end\nend\n\n-- loops through an XML table and returns the specified object\n---@param ui Table XmlTable (get this via getXmlTable)\n---@param id String Id of the object to return\nfunction getXmlTableElementById(ui, id)\n for _, obj in ipairs(ui) do\n if obj.attributes and obj.attributes.id and obj.attributes.id == id then return obj end\n if obj.children then\n local result = getXmlTableElementById(obj.children, id)\n if result then return result end\n end\n end\n return nil\nend\n\n---------------------------------------------------------\n-- Option Panel related functionality\n---------------------------------------------------------\n\n-- called by toggling an option\nfunction onClick_toggleOption(_, id)\n local state = self.UI.getAttribute(id, \"isOn\")\n\n -- flip state (and handle stupid \"False\" value)\n if state == \"False\" then\n state = true\n else\n state = false\n end\n\n self.UI.setAttribute(id, \"isOn\", state)\n applyOptionPanelChange(id, state)\nend\n\n-- called by the language selection dropdown\nfunction languageSelected(_, selectedIndex, id)\n optionPanel[id] = LANGUAGES[tonumber(selectedIndex) + 1].code\nend\n\n-- returns the ID (position in the table) for a provided language code\nfunction returnLanguageId(code)\n for index, tbl in ipairs(LANGUAGES) do\n if tbl.code == code then\n return index\n end\n end\nend\n\n-- called by the resource counter selection dropdown\nfunction resourceCounterSelected(_, selectedIndex, id)\n optionPanel[id] = RESOURCE_OPTIONS[tonumber(selectedIndex) + 1]\nend\n\n-- returns the ID for the provided option name\nfunction returnResourceCounterId(name)\n for index, optionName in ipairs(RESOURCE_OPTIONS) do\n if optionName == name then\n return index\n end\n end\nend\n\n-- sets the option panel to the correct state (corresponding to 'optionPanel')\nfunction updateOptionPanelState()\n for id, optionValue in pairs(optionPanel) do\n if id == \"cardLanguage\" and type(optionValue) == \"string\" then\n local dropdownId = returnLanguageId(optionValue) - 1\n UI.setAttribute(id, \"value\", dropdownId)\n elseif id == \"useResourceCounters\" and type(optionValue) == \"string\" then\n local dropdownId = returnResourceCounterId(optionValue) - 1\n UI.setAttribute(id, \"value\", dropdownId)\n elseif (type(optionValue) == \"boolean\" and optionValue)\n or (type(optionValue) == \"string\" and optionValue)\n or (type(optionValue) == \"table\" and #optionValue ~= 0) then\n UI.setAttribute(id, \"isOn\", true)\n else\n UI.setAttribute(id, \"isOn\", \"False\")\n end\n end\nend\n\n-- handles the applying of option selections and calls the respective functions based\n---@param id String ID of the option that was selected or deselected\n---@param state Boolean State of the option (true = enabled)\nfunction applyOptionPanelChange(id, state)\n -- option: Snap tags\n if id == \"useSnapTags\" then\n playmatApi.setLimitSnapsByType(state, \"All\")\n optionPanel[id] = state\n\n -- option: Draw 1 button\n elseif id == \"showDrawButton\" then\n playmatApi.showDrawButton(state, \"All\")\n optionPanel[id] = state\n\n -- option: Clickable clue counters\n elseif id == \"useClueClickers\" then\n playmatApi.clickableClues(state, \"All\")\n optionPanel[id] = state\n\n -- update master clue counter\n local counter = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"MasterClueCounter\")\n counter.setVar(\"useClickableCounters\", state)\n\n -- option: Play area snap tags\n elseif id == \"playAreaSnapTags\" then\n playAreaApi.setLimitSnapsByType(state)\n optionPanel[id] = state\n\n -- option: Show Title on placing scenarios\n elseif id == \"showTitleSplash\" then\n optionPanel[id] = state\n\n -- option: Show clean up helper\n elseif id == \"showCleanUpHelper\" then\n optionPanel[id] = spawnOrRemoveHelper(state, \"Clean Up Helper\", {-66, 1.6, 46})\n\n -- option: Show hand helper for each player\n elseif id == \"showHandHelper\" then\n for i, color in ipairs(MAT_COLORS) do\n local pos = playmatApi.transformLocalPosition({0.05, 0, -1.182}, color)\n local rot = playmatApi.returnRotation(color)\n optionPanel[id][i] = spawnOrRemoveHelper(state, \"Hand Helper\", pos, rot)\n end\n\n -- option: Show search assistant for each player\n elseif id == \"showSearchAssistant\" then\n for i, color in ipairs(MAT_COLORS) do\n local pos = playmatApi.transformLocalPosition({-0.3, 0, -1.182}, color)\n local rot = playmatApi.returnRotation(color)\n optionPanel[id][i] = spawnOrRemoveHelper(state, \"Search Assistant\", pos, rot)\n end\n\n -- option: Show attachment helper\n elseif id == \"showAttachmentHelper\" then\n optionPanel[id] = spawnOrRemoveHelper(state, \"Attachment Helper\", {-62, 1.4, 0})\n\n -- option: Show CYOA campaign guides\n elseif id == \"showCYOA\" then\n optionPanel[id] = spawnOrRemoveHelper(state, \"CYOA Campaign Guides\", {39, 1.3, -20})\n\n -- option: Show displacement tool\n elseif id == \"showDisplacementTool\" then\n optionPanel[id] = spawnOrRemoveHelper(state, \"Displacement Tool\", {-57, 1.6, 46})\n end\nend\n\n-- handler for spawn / remove functions of helper objects\n---@param state Boolean Contains the state of the option: true = spawn it, false = remove it\n---@param name String Name of the helper object\n---@param position Vector Position of the object (where it will spawn)\n---@param rotation Vector Rotation of the object for spawning (default: {0, 270, 0})\n---@return. GUID of the spawnedObj (or nil if object was removed)\nfunction spawnOrRemoveHelper(state, name, position, rotation)\n if (type(state) == \"table\" and #state == 0) then\n return removeHelperObject(name)\n elseif state then\n Player.getPlayers()[1].pingTable(position)\n return spawnHelperObject(name, position, rotation).getGUID()\n else\n return removeHelperObject(name)\n end\nend\n\n-- copies the specified tool (by name) from the option panel source bag\n---@param name String Name of the object that should be copied\n---@param position Table Desired position of the object\n---@param rotation Table Desired rotation of the object (defaults to object's rotation)\nfunction spawnHelperObject(name, position, rotation)\n local sourceBag = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\",\"OptionPanelSource\")\n\n -- error handling for missing sourceBag\n if not sourceBag then\n broadcastToAll(\"Option panel source bag could not be found!\", \"Red\")\n return\n end\n\n local spawnTable = { position = position }\n\n -- only overrride rotation if there is one provided (object's rotation used instead)\n if rotation then\n spawnTable.rotation = rotation\n end\n\n for _, obj in ipairs(sourceBag.getData().ContainedObjects) do\n if obj[\"Nickname\"] == name then\n spawnTable.data = obj\n spawnTable.callback_function = function(spawnedObj)\n Wait.time(function() spawnedObj.setLock(true) end, 2)\n end\n return spawnObjectData(spawnTable)\n end\n end\nend\n\n-- removes the specified tool (by name)\n---@param name String Object that should be removed\nfunction removeHelperObject(name)\n -- links objects name to the respective option name (to grab the GUID for removal)\n local referenceTable = {\n [\"Clean Up Helper\"] = \"showCleanUpHelper\",\n [\"Hand Helper\"] = \"showHandHelper\",\n [\"Search Assistant\"] = \"showSearchAssistant\",\n [\"Displacement Tool\"] = \"showDisplacementTool\",\n [\"Attachment Helper\"] = \"showAttachmentHelper\",\n [\"CYOA Campaign Guides\"] = \"showCYOA\"\n }\n\n local data = optionPanel[referenceTable[name]]\n\n -- if there is a GUID stored, remove that object\n if type(data) == \"string\" then\n local obj = getObjectFromGUID(data)\n if obj then obj.destruct() end\n\n -- if it is a table (e.g. for the \"Hand Helper\", remove all of them)\n elseif type(data) == \"table\" then\n for _, guid in pairs(data) do\n local obj = getObjectFromGUID(guid)\n if obj then obj.destruct() end\n end\n end\nend\n\n-- loads saved options\nfunction loadSettings(newOptions)\n optionPanel = newOptions\n updateOptionPanelState()\n for id, state in pairs(optionPanel) do\n applyOptionPanelChange(id, state)\n end\nend\n\n-- loads the default options\nfunction onClick_defaultSettings()\n for id, _ in pairs(optionPanel) do\n local state = false\n -- override for settings that are enabled by default\n if id == \"useSnapTags\" or id == \"showTitleSplash\" then\n state = true\n end\n applyOptionPanelChange(id, state)\n end\n\n -- clean reset of variables\n optionPanel = {\n cardLanguage = \"en\",\n playAreaSnapTags = true,\n showAttachmentHelper = false,\n showCleanUpHelper = false,\n showCYOA = false,\n showDisplacementTool = false,\n showDrawButton = false,\n showHandHelper = {},\n showSearchAssistant = {},\n showTitleSplash = true,\n useClueClickers = false,\n useResourceCounters = \"disabled\",\n useSnapTags = true\n }\n\n -- update UI\n updateOptionPanelState()\nend\n\n-- splash scenario title on setup\nfunction titleSplash(scenarioName)\n if optionPanel['showTitleSplash'] then\n -- if there's any ongoing title being displayed, hide it and cancel the waiting function\n if hideTitleSplashWaitFunctionId then\n Wait.stop(hideTitleSplashWaitFunctionId)\n hideTitleSplashWaitFunctionId = nil\n UI.setAttribute('title_splash', 'active', false)\n end\n\n -- display scenario name and set a 4 seconds (2 seconds animation and 2 seconds on screen)\n -- wait timer to hide the scenario name\n UI.setValue('title_splash_text', scenarioName)\n UI.show('title_splash')\n hideTitleSplashWaitFunctionId = Wait.time(function()\n UI.hide('title_splash')\n hideTitleSplashWaitFunctionId = nil\n end, 4)\n\n soundCubeApi.playSoundByName(\"Deep Bell\")\n end\nend\n\n---------------------------------------------------------\n-- Update notification related functionality\n---------------------------------------------------------\n\n-- grabs the latest mod version and release notes from GitHub (called onLoad())\nfunction getModVersion()\n WebRequest.get(SOURCE_REPO .. '/modversion.json', compareVersion)\nend\n\n-- compares the modversion with GitHub and possibly shows the update notification\nfunction compareVersion(request)\n if request.is_error then\n log(request.error)\n return\n end\n\n -- global variable to make it accessible for other functions\n modMeta = JSON.decode(request.text)\n\n -- stop here if on latest or newer version\n if convertVersionToNumber(MOD_VERSION) \u003e= convertVersionToNumber(modMeta[\"latestVersion\"]) then return end\n\n -- stop here if \"don't show again\" was clicked for this version before\n if acknowledgedUpgradeVersions[modMeta[\"latestVersion\"]] then return end\n\n updateNotificationLoading()\n\n -- delay to avoid lagging during onLoad()\n Wait.time(function() UI.show(\"FinnIcon\") end, 1)\nend\n\n-- converts a version number to a string\n---@param version String Version number, separated by dots (e.g. 3.3.1)\nfunction convertVersionToNumber(version)\n local major, minor, patch = string.match(version, \"(%d+)%.(%d+)%.(%d+)\")\n return major * 100 + minor * 10 + patch\nend\n\n-- updates the XML update notification based on the mod metadata\nfunction updateNotificationLoading()\n -- grab data\n local highlights = modMeta[\"releaseHighlights\"]\n\n -- concatenate the release highlights\n local highlightText = \"• \" .. highlights[1]\n for i, entry in pairs(highlights) do\n if i ~= 1 then\n highlightText = highlightText .. \"\\n• \" .. entry\n end\n end\n\n -- update the XML UI\n UI.setValue(\"notificationHeader\", \"New version available: \" .. modMeta[\"latestVersion\"])\n UI.setValue(\"releaseHighlightText\", highlightText)\n UI.setAttribute(\"highlightRow\", \"preferredHeight\", 20*#highlights)\n UI.setAttribute(\"updateNotification\", \"height\", 20*#highlights + 125)\nend\n\n-- close / don't show again buttons on the update notification\nfunction onClick_notification(_, parameter)\n if parameter == \"dontShowAgain\" then\n -- this variable tracks if \"don't show again\" was pressed for a version\n acknowledgedUpgradeVersions[modMeta[\"latestVersion\"]] = true\n end\n UI.hide(\"FinnIcon\")\n UI.hide(\"updateNotification\")\n xmlVisibility[\"updateNotification\"] = false\nend\nend)\n__bundle_register(\"core/NavigationOverlayApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local NavigationOverlayApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getNOHandler()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"NavigationOverlayHandler\")\n end\n\n -- Copies the visibility for the Navigation overlay\n ---@param startColor String Color of the player to copy from\n ---@param targetColor String Color of the targeted player\n NavigationOverlayApi.copyVisibility = function(startColor, targetColor)\n getNOHandler().call(\"copyVisibility\", {\n startColor = startColor,\n targetColor = targetColor\n })\n end \n\n -- Changes the Navigation Overlay view (\"Full View\" --\u003e \"Play Areas\" --\u003e \"Closed\" etc.)\n ---@param playerColor String Color of the player to update the visibility for\n NavigationOverlayApi.cycleVisibility = function(playerColor)\n getNOHandler().call(\"cycleVisibility\", playerColor)\n end\n\n return NavigationOverlayApi\nend\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getPlayArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"PlayArea\")\n end\n\n local function getInvestigatorCounter()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"InvestigatorCounter\")\n end\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getInvestigatorCounter().getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n getInvestigatorCounter().call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with 'displacement_excluded'\n ---@param playerColor Color Color of the player requesting the shift for messages\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getPlayArea().call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getPlayArea().call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getPlayArea().call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getPlayArea().call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getPlayArea().call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getPlayArea().call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getPlayArea().call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getPlayArea().call(\"tryObjectEnterContainer\", { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getPlayArea().call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getPlayArea().call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getPlayArea().call(\"countVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getPlayArea().call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getPlayArea().getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getPlayArea().call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getPlayArea().call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getPlayArea().getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\n__bundle_register(\"core/OptionPanelApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local OptionPanelApi = {}\n\n -- loads saved options\n ---@param options Table New options table\n OptionPanelApi.loadSettings = function(options)\n return Global.call(\"loadSettings\", options)\n end\n\n -- returns option panel table\n OptionPanelApi.getOptions = function()\n return Global.getTable(\"optionPanel\")\n end\n\n return OptionPanelApi\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenArranger\")\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"core/MythosAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local MythosAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getMythosArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"MythosArea\")\n end\n\n -- returns the chaos token metadata (if provided through scenario reference card)\n MythosAreaApi.returnTokenData = function()\n return getMythosArea().call(\"returnTokenData\")\n end\n \n -- returns an object reference to the encounter deck\n MythosAreaApi.getEncounterDeck = function()\n return getMythosArea().call(\"getEncounterDeck\")\n end\n\n -- draw an encounter card to the requested position/rotation\n MythosAreaApi.drawEncounterCard = function(pos, rotY, alwaysFaceUp)\n getMythosArea().call(\"drawEncounterCard\", {\n pos = pos,\n rotY = rotY,\n alwaysFaceUp = alwaysFaceUp\n })\n end\n\n return MythosAreaApi\nend\nend)\n__bundle_register(\"core/SoundCubeApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local SoundCubeApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- this table links the name of a trigger effect to its index\n local soundIndices = {\n [\"Vacuum\"] = 0,\n [\"Deep Bell\"] = 1,\n [\"Dark Souls\"] = 2\n }\n\n local function playTriggerEffect(index)\n local SoundCube = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"SoundCube\")\n SoundCube.AssetBundle.playTriggerEffect(index)\n end\n\n -- plays the by name requested sound\n ---@param soundName String Name of the sound to play\n SoundCubeApi.playSoundByName = function(soundName)\n playTriggerEffect(soundIndices[soundName])\n end\n\n return SoundCubeApi\nend\nend)\n__bundle_register(\"core/token/TokenChecker\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local CHAOS_TOKEN_NAMES = {\n [\"Elder Sign\"] = true,\n [\"+1\"] = true,\n [\"0\"] = true,\n [\"-1\"] = true,\n [\"-2\"] = true,\n [\"-3\"] = true,\n [\"-4\"] = true,\n [\"-5\"] = true,\n [\"-6\"] = true,\n [\"-7\"] = true,\n [\"-8\"] = true,\n [\"Skull\"] = true,\n [\"Cultist\"] = true,\n [\"Tablet\"] = true,\n [\"Elder Thing\"] = true,\n [\"Auto-fail\"] = true,\n [\"Bless\"] = true,\n [\"Curse\"] = true,\n [\"Frost\"] = true\n }\n\n local TokenChecker = {}\n\n -- returns true if the passed object is a chaos token (by name)\n TokenChecker.isChaosToken = function(obj)\n if CHAOS_TOKEN_NAMES[obj.getName()] then\n return true\n else\n return false\n end\n end\n\n return TokenChecker\nend\nend)\n__bundle_register(\"core/token/TokenSpawnTrackerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenSpawnTracker = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getSpawnTracker()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenSpawnTracker\")\n end\n\n TokenSpawnTracker.hasSpawnedTokens = function(cardGuid)\n return getSpawnTracker().call(\"hasSpawnedTokens\", cardGuid)\n end\n\n TokenSpawnTracker.markTokensSpawned = function(cardGuid)\n return getSpawnTracker().call(\"markTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetTokensSpawned = function(cardGuid)\n return getSpawnTracker().call(\"resetTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetAllAssetAndEvents = function()\n return getSpawnTracker().call(\"resetAllAssetAndEvents\")\n end\n\n TokenSpawnTracker.resetAllLocations = function()\n return getSpawnTracker().call(\"resetAllLocations\")\n end\n\n TokenSpawnTracker.resetAll = function()\n return getSpawnTracker().call(\"resetAll\")\n end\n\n return TokenSpawnTracker\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/Global\")\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getManager()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"BlessCurseManager\")\n end\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getManager()\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getManager().call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getManager().call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getManager().call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getManager().call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getManager().call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"core/token/TokenManager\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n local optionPanelApi = require(\"core/OptionPanelApi\")\n local playAreaApi = require(\"core/PlayAreaApi\")\n local tokenSpawnTrackerApi = require(\"core/token/TokenSpawnTrackerApi\")\n\n local PLAYER_CARD_TOKEN_OFFSETS = {\n [1] = {\n Vector(0, 3, -0.2)\n },\n [2] = {\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [3] = {\n Vector(0, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [4] = {\n Vector(0.4, 3, -0.9),\n Vector(-0.4, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [5] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [6] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2)\n },\n [7] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0, 3, 0.5)\n },\n [8] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(-0.35, 3, 0.5),\n Vector(0.35, 3, 0.5)\n },\n [9] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5)\n },\n [10] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0, 3, 1.2)\n },\n [11] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(-0.35, 3, 1.2),\n Vector(0.35, 3, 1.2)\n },\n [12] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0.7, 3, 1.2),\n Vector(0, 3, 1.2),\n Vector(-0.7, 3, 1.2)\n }\n }\n\n -- stateIDs for the multi-stated resource tokens\n local stateTable = {\n [\"resource\"] = 1,\n [\"ammo\"] = 2,\n [\"bounty\"] = 3,\n [\"charge\"] = 4,\n [\"evidence\"] = 5,\n [\"secret\"] = 6,\n [\"supply\"] = 7\n }\n\n -- Table of data extracted from the token source bag, keyed by the Memo on each token which\n -- should match the token type keys (\"resource\", \"clue\", etc)\n local tokenTemplates\n\n local playerCardData\n local locationData\n\n local TokenManager = { }\n local internal = { }\n\n -- Spawns tokens for the card. This function is built to just throw a card at it and let it do\n -- the work once a card has hit an area where it might spawn tokens. It will check to see if\n -- the card has already spawned, find appropriate data from either the uses metadata or the Data\n -- Helper, and spawn the tokens.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n TokenManager.spawnForCard = function(card, extraUses)\n if tokenSpawnTrackerApi.hasSpawnedTokens(card.getGUID()) then\n return\n end\n local metadata = JSON.decode(card.getGMNotes())\n if metadata ~= nil then\n internal.spawnTokensFromUses(card, extraUses)\n else\n internal.spawnTokensFromDataHelper(card)\n end\n end\n\n -- Spawns a set of tokens on the given card.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String Type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param tokenCount Number How many tokens to spawn. For damage or horror this value will be set to the\n -- spawned state object rather than spawning multiple tokens\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnTokenGroup = function(card, tokenType, tokenCount, shiftDown, subType)\n local optionPanel = optionPanelApi.getOptions()\n\n if tokenType == \"damage\" or tokenType == \"horror\" then\n TokenManager.spawnCounterToken(card, tokenType, tokenCount, shiftDown)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"enabled\" then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"custom\" and tokenCount == 0 then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n else\n TokenManager.spawnMultipleTokens(card, tokenType, tokenCount, shiftDown, subType)\n end\n end\n\n -- Spawns a single counter token and sets the value to tokenValue. Used for damage and horror\n -- tokens.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String type of token to spawn, valid values are \"damage\" and \"horror\". Other\n -- types should use spawnMultipleTokens()\n ---@param tokenValue Number Value to set the damage/horror to\n TokenManager.spawnCounterToken = function(card, tokenType, tokenValue, shiftDown)\n if tokenValue \u003c 1 or tokenValue \u003e 50 then return end\n\n local pos = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[1][1] + Vector(0, 0, shiftDown))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, tokenType, rot, function(spawned) spawned.setState(tokenValue) end)\n end\n\n TokenManager.spawnResourceCounterToken = function(card, tokenCount)\n local pos = card.positionToWorld(card.positionToLocal(card.getPosition()) + Vector(0, 0.2, -0.5))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, \"resourceCounter\", rot, function(spawned)\n spawned.call(\"updateVal\", tokenCount)\n end)\n end\n\n -- Spawns a number of tokens.\n ---@param tokenType String type of token to spawn, valid values are resource\", \"doom\", or \"clue\".\n -- Other types should use spawnCounterToken()\n ---@param tokenCount Number How many tokens to spawn\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnMultipleTokens = function(card, tokenType, tokenCount, shiftDown, subType)\n -- not checking the max at this point since clue offsets are calculated dynamically\n if tokenCount \u003c 1 then return end\n\n local offsets = {}\n if tokenType == \"clue\" then\n offsets = internal.buildClueOffsets(card, tokenCount)\n else\n -- only up to 12 offset tables defined\n if tokenCount \u003e 12 then return end\n for i = 1, tokenCount do\n offsets[i] = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[tokenCount][i])\n -- Fix the y-position for the spawn, since positionToWorld considers rotation which can\n -- have bad results for face up/down differences\n offsets[i].y = card.getPosition().y + 0.15\n end\n end\n\n if shiftDown ~= nil then\n -- Copy the offsets to make sure we don't change the static values\n local baseOffsets = offsets\n offsets = { }\n\n -- get a vector for the shifting (downwards local to the card)\n local shiftDownVector = Vector(0, 0, shiftDown):rotateOver(\"y\", card.getRotation().y)\n for i, baseOffset in ipairs(baseOffsets) do\n offsets[i] = baseOffset + shiftDownVector\n end\n end\n\n if offsets == nil then\n error(\"couldn't find offsets for \" .. tokenCount .. ' tokens')\n return\n end\n\n -- handling for not provided subtype (for example when spawning from custom data helpers)\n if subType == nil then\n subType = \"\"\n end\n \n -- this is used to load the correct state for additional resource tokens (e.g. \"Ammo\")\n local callback = nil\n local stateID = stateTable[string.lower(subType)]\n if tokenType == \"resource\" and stateID ~= nil and stateID ~= 1 then\n callback = function(spawned) spawned.setState(stateID) end\n end\n\n for i = 1, tokenCount do\n TokenManager.spawnToken(offsets[i], tokenType, card.getRotation(), callback)\n end\n end\n\n -- Spawns a single token at the given global position by copying it from the template bag.\n ---@param position Global position to spawn the token\n ---@param tokenType String type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param rotation Vector Rotation to be used for the new token. Only the y-value will be used,\n -- x and z will use the default rotation from the source bag\n ---@param callback function A callback function triggered after the new token is spawned\n TokenManager.spawnToken = function(position, tokenType, rotation, callback)\n internal.initTokenTemplates()\n local loadTokenType = tokenType\n if tokenType == \"clue\" or tokenType == \"doom\" then\n loadTokenType = \"clueDoom\"\n end\n if tokenTemplates[loadTokenType] == nil then\n error(\"Unknown token type '\" .. tokenType .. \"'\")\n return\n end\n local tokenTemplate = tokenTemplates[loadTokenType]\n\n -- Take ONLY the Y-value for rotation, so we don't flip the token coming out of the bag\n local rot = Vector(tokenTemplate.Transform.rotX,\n 270,\n tokenTemplate.Transform.rotZ)\n if rotation ~= nil then\n rot.y = rotation.y\n end\n if tokenType == \"doom\" then\n rot.z = 180\n end\n\n tokenTemplate.Nickname = \"\"\n return spawnObjectData({\n data = tokenTemplate,\n position = position,\n rotation = rot,\n callback_function = callback\n })\n end\n\n -- Checks a card for metadata to maybe replenish it\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n TokenManager.maybeReplenishCard = function(card, uses, mat)\n -- TODO: support for cards with multiple uses AND replenish (as of yet, no official card needs that)\n if uses[1].count and uses[1].replenish then\n internal.replenishTokens(card, uses, mat)\n end\n end\n\n -- Delegate function to the token spawn tracker. Exists to avoid circular dependencies in some\n -- callers.\n ---@param card Object Card object to reset the tokens for\n TokenManager.resetTokensSpawned = function(card)\n tokenSpawnTrackerApi.resetTokensSpawned(card.getGUID())\n end\n\n -- Pushes new player card data into the local copy of the Data Helper player data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addPlayerCardData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n playerCardData[k] = v\n end\n end\n\n -- Pushes new location data into the local copy of the Data Helper location data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addLocationData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n locationData[k] = v\n end\n end\n\n -- Checks to see if the given card has location data in the DataHelper\n ---@param card Object Card to check for data\n ---@return Boolean True if this card has data in the helper, false otherwise\n TokenManager.hasLocationData = function(card)\n internal.initDataHelperData()\n return internal.getLocationData(card) ~= nil\n end\n\n internal.initTokenTemplates = function()\n if tokenTemplates ~= nil then\n return\n end\n tokenTemplates = {}\n local tokenSource = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenSource\")\n for _, tokenTemplate in ipairs(tokenSource.getData().ContainedObjects) do\n local tokenName = tokenTemplate.Memo\n tokenTemplates[tokenName] = tokenTemplate\n end\n end\n\n -- Copies the data from the DataHelper. Will only happen once.\n internal.initDataHelperData = function()\n if playerCardData ~= nil then\n return\n end\n local dataHelper = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"DataHelper\")\n playerCardData = dataHelper.getTable('PLAYER_CARD_DATA')\n locationData = dataHelper.getTable('LOCATIONS_DATA')\n end\n\n -- Spawn tokens for a card based on the uses metadata. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n internal.spawnTokensFromUses = function(card, extraUses)\n local uses = internal.getUses(card)\n if uses == nil then return end\n\n -- go through tokens to spawn\n local tokenCount\n for i, useInfo in ipairs(uses) do\n tokenCount = (useInfo.count or 0) + (useInfo.countPerInvestigator or 0) * playAreaApi.getInvestigatorCount()\n if extraUses ~= nil and extraUses[useInfo.type] ~= nil then\n tokenCount = tokenCount + extraUses[useInfo.type]\n end\n -- Shift each spawned group after the first down so they don't pile on each other\n TokenManager.spawnTokenGroup(card, useInfo.token, tokenCount, (i - 1) * 0.8, useInfo.type)\n end\n \n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a card based on the data helper data. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n internal.spawnTokensFromDataHelper = function(card)\n internal.initDataHelperData()\n local playerData = internal.getPlayerCardData(card)\n if playerData ~= nil then\n internal.spawnPlayerCardTokensFromDataHelper(card, playerData)\n end\n local locationData = internal.getLocationData(card)\n if locationData ~= nil then\n internal.spawnLocationTokensFromDataHelper(card, locationData)\n end\n end\n\n -- Spawn tokens for a player card using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Player card data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnPlayerCardTokensFromDataHelper = function(card, playerData)\n local token = playerData.tokenType\n local tokenCount = playerData.tokenCount\n TokenManager.spawnTokenGroup(card, token, tokenCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a location using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Location data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnLocationTokensFromDataHelper = function(card, locationData)\n local clueCount = internal.getClueCountFromData(card, locationData)\n if clueCount \u003e 0 then\n TokenManager.spawnTokenGroup(card, \"clue\", clueCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n end\n\n internal.getPlayerCardData = function(card)\n return playerCardData[card.getName() .. ':' .. card.getDescription()]\n or playerCardData[card.getName()]\n end\n\n internal.getLocationData = function(card)\n return locationData[card.getName() .. '_' .. card.getGUID()] or locationData[card.getName()]\n end\n\n internal.getClueCountFromData = function(card, locationData)\n -- Return the number of clues to spawn on this location\n if locationData == nil then\n error('attempted to get clue for unexpected object: ' .. card.getName())\n return 0\n end\n\n if ((card.is_face_down and locationData.clueSide == 'back')\n or (not card.is_face_down and locationData.clueSide == 'front')) then\n if locationData.type == 'fixed' then\n return locationData.value\n elseif locationData.type == 'perPlayer' then\n return locationData.value * playAreaApi.getInvestigatorCount()\n end\n error('unexpected location type: ' .. locationData.type)\n end\n return 0\n end\n\n -- Gets the right uses structure for this card, based on metadata and face up/down state\n ---@param card Object Card to pull the uses from\n internal.getUses = function(card)\n local metadata = JSON.decode(card.getGMNotes()) or { }\n if metadata.type == \"Location\" then\n if card.is_face_down and metadata.locationBack ~= nil then\n return metadata.locationBack.uses\n elseif not card.is_face_down and metadata.locationFront ~= nil then\n return metadata.locationFront.uses\n end\n elseif not card.is_face_down then\n return metadata.uses\n end\n\n return nil\n end\n\n -- Dynamically create positions for clues on a card.\n ---@param card Object Card the clues will be placed on\n ---@param count Integer How many clues?\n ---@return Table Array of global positions to spawn the clues at\n internal.buildClueOffsets = function(card, count)\n local pos = card.getPosition()\n local cluePositions = { }\n for i = 1, count do\n local row = math.floor(1 + (i - 1) / 4)\n local column = (i - 1) % 4\n table.insert(cluePositions, Vector(pos.x + 1.5 - 0.55 * row, pos.y + 0.15, pos.z - 0.825 + 0.55 * column))\n end\n return cluePositions\n end\n\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n internal.replenishTokens = function(card, uses, mat)\n local cardPos = card.getPosition()\n\n -- don't continue for cards on the deck (Norman) or in the discard pile\n if mat.positionToLocal(cardPos).x \u003c -1 then return end\n\n -- get current amount of resource tokens on the card\n local search = internal.searchOnCard(cardPos, card.getRotation())\n local clickableResourceCounter = nil\n local foundTokens = 0\n\n for _, obj in ipairs(search) do\n local obj = obj.hit_object\n local memo = obj.getMemo()\n\n if (stateTable[memo] or 0) \u003e 0 then\n foundTokens = foundTokens + math.abs(obj.getQuantity())\n obj.destruct()\n elseif memo == \"resourceCounter\" then\n foundTokens = obj.getVar(\"val\")\n clickableResourceCounter = obj\n break\n end\n end\n\n -- this is the theoretical new amount of uses (to be checked below)\n local newCount = foundTokens + uses[1].replenish\n\n -- if there are already more uses than the replenish amount, keep them\n if foundTokens \u003e uses[1].count then\n newCount = foundTokens\n -- only replenish up until the replenish amount\n elseif newCount \u003e uses[1].count then\n newCount = uses[1].count\n end\n\n -- update the clickable counter or spawn a group of tokens\n if clickableResourceCounter then\n clickableResourceCounter.call(\"updateVal\", newCount)\n else\n TokenManager.spawnTokenGroup(card, uses[1].token, newCount, _, uses[1].type)\n end\n end\n\n -- searches on a card (standard size) and returns the result\n ---@param position Table Position of the card\n ---@param rotation Table Rotation of the card\n internal.searchOnCard = function(position, rotation)\n return Physics.cast({\n origin = position,\n direction = {0, 1, 0},\n orientation = rotation,\n type = 3,\n size = { 2.5, 0.5, 3.5 },\n max_distance = 1,\n debug = false\n })\n end\n\n return TokenManager\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScriptState": "{\"acknowledgedUpgradeVersions\":[],\"optionPanel\":{\"cardLanguage\":\"en\",\"playAreaSnapTags\":true,\"showAttachmentHelper\":false,\"showCleanUpHelper\":false,\"showCYOA\":false,\"showDisplacementTool\":false,\"showDrawButton\":false,\"showHandHelper\":[],\"showSearchAssistant\":[],\"showTitleSplash\":true,\"useClueClickers\":false,\"useResourceCounters\":\"disabled\",\"useSnapTags\":true}}", "MusicPlayer": { "AudioLibrary": [ { @@ -534,6 +552,51 @@ }, "Note": "", "ObjectStates": [ + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 0.116, + "g": 0.116, + "r": 0.716 + }, + "Description": "This object handles GUID references to objects.", + "DragSelectable": true, + "GMNotes": "", + "GUID": "123456", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": true, + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/GUIDReferenceHandler\")\nend)\n__bundle_register(\"core/GUIDReferenceHandler\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal GuidReferences = {\n White = {\n ClueCounter = \"d86b7c\",\n ClickableClueCounter = \"db85d6\",\n DamageCounter = \"eb08d6\",\n HandZone = \"a70eee\",\n HorrorCounter = \"468e88\",\n InvestigatorSkillTracker = \"e598c2\",\n Playermat = \"8b081b\",\n ResourceCounter = \"4406f0\",\n TokenDiscardZone = \"457de3\",\n Trash = \"147e80\"\n },\n Orange = {\n ClueCounter = \"1769ed\",\n ClickableClueCounter = \"3f22e5\",\n DamageCounter = \"e64eec\",\n HandZone = \"5fe087\",\n HorrorCounter = \"0257d9\",\n InvestigatorSkillTracker = \"b4a5f7\",\n Playermat = \"bd0ff4\",\n ResourceCounter = \"816d84\",\n TokenDiscardZone = \"457de4\",\n Trash = \"f7b6c8\"\n },\n Green = {\n ClueCounter = \"032300\",\n ClickableClueCounter = \"891403\",\n DamageCounter = \"1f5a0a\",\n HandZone = \"0285cc\",\n HorrorCounter = \"7b5729\",\n InvestigatorSkillTracker = \"af7ed7\",\n Playermat = \"383d8b\",\n ResourceCounter = \"cd15ac\",\n TokenDiscardZone = \"457de5\",\n Trash = \"5f896a\"\n },\n Red = {\n ClueCounter = \"37be78\",\n ClickableClueCounter = \"4111de\",\n DamageCounter = \"591a45\",\n HandZone = \"be2f17\",\n HorrorCounter = \"beb964\",\n InvestigatorSkillTracker = \"e74881\",\n Playermat = \"0840d5\",\n ResourceCounter = \"a4b60d\",\n TokenDiscardZone = \"457de6\",\n Trash = \"4b8594\"\n },\n Mythos = {\n AllCardsBag = \"15bb07\",\n BlessCurseManager = \"5933fb\",\n CampaignThePathToCarcosa = \"aca04c\",\n DataHelper = \"708279\",\n DeckImporter = \"a28140\",\n DoomCounter = \"85c4c6\",\n DoomInPlayCounter = \"652ff3\",\n InvestigatorCounter = \"f182ee\",\n MasterClueCounter = \"4a3aa4\",\n MythosArea = \"9f334f\",\n NavigationOverlayHandler = \"797ede\",\n OptionPanelSource = \"830bd0\",\n PlaceholderBoxDummy = \"a93466\",\n PlayArea = \"721ba2\",\n PlayAreaZone = \"a2f932\",\n PlayerCardPanel = \"2d30ee\",\n ResourceTokenBag = \"9fadf9\",\n RulesReference = \"d99993\",\n SoundCube = \"3c988f\",\n TokenArranger = \"022907\",\n TokenSource = \"124381\",\n TokenSpawnTracker = \"e3ffc9\",\n TourStarter = \"0e5aa8\",\n Trash = \"70b9f6\",\n VictoryDisplay = \"6ccd6d\"\n }\n}\n\nfunction getObjectByOwnerAndType(params)\n local owner = params.owner or \"Mythos\"\n local type = params.type\n return getObjectFromGUID(GuidReferences[owner][type])\nend\n\nfunction getObjectsByType(type)\n local objList = {}\n for owner, objects in pairs(GuidReferences) do\n local obj = getObjectFromGUID(objects[type])\n if obj then\n objList[owner] = obj\n end\n end\n return objList\nend\n\nfunction getObjectsByOwner(owner)\n local objList = {}\n for type, guid in pairs(GuidReferences[owner]) do\n local obj = getObjectFromGUID(guid)\n if obj then\n objList[type] = obj\n end\n end\n return objList\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "go_game_piece_white", + "Nickname": "GUID Reference Handler", + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 78, + "posY": 1.328, + "posZ": -8, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, { "AltLookAngle": { "x": 0, @@ -568,13 +631,13 @@ "Sticky": true, "Tooltip": true, "Transform": { - "posX": -65.7, + "posX": -65, "posY": 6, - "posZ": -15.5, + "posZ": -16.1, "rotX": 0, "rotY": 90, "rotZ": 0, - "scaleX": 22.96, + "scaleX": 22, "scaleY": 7, "scaleZ": 5 }, @@ -615,13 +678,13 @@ "Sticky": true, "Tooltip": true, "Transform": { - "posX": -30.5, + "posX": -30.35, "posY": 6, - "posZ": -36.364, + "posZ": -36.6, "rotX": 0, "rotY": 0, "rotZ": 0, - "scaleX": 21.96, + "scaleX": 22, "scaleY": 7, "scaleZ": 5 }, @@ -662,13 +725,13 @@ "Sticky": true, "Tooltip": true, "Transform": { - "posX": -30.5, + "posX": -30.35, "posY": 6, - "posZ": 36.053, + "posZ": 36.6, "rotX": 0, "rotY": 180, "rotZ": 0, - "scaleX": 21.96, + "scaleX": 22, "scaleY": 7, "scaleZ": 5 }, @@ -709,13 +772,13 @@ "Sticky": true, "Tooltip": true, "Transform": { - "posX": -65.7, + "posX": -65, "posY": 6, - "posZ": 15.5, + "posZ": 16.1, "rotX": 0, "rotY": 90, "rotZ": 0, - "scaleX": 22.96, + "scaleX": 22, "scaleY": 7, "scaleZ": 5 }, @@ -1245,13 +1308,16 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = getObjectsWithTag(\"TokenArranger\")[1]\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = { }\n local PLAY_AREA_GUID = \"721ba2\"\n local INVESTIGATOR_COUNTER_GUID = \"f182ee\"\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with\n -- 'displacement_excluded'\n ---@param playerColor Color of the player requesting the shift. Used solely to send an error\n --- message in the unlikely case that the scripting zone has been deleted\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"tryObjectEnterContainer\",\n { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightCountedVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\n__bundle_register(\"core/token/TokenChecker\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local CHAOS_TOKEN_NAMES = {\n [\"Elder Sign\"] = true,\n [\"+1\"] = true,\n [\"0\"] = true,\n [\"-1\"] = true,\n [\"-2\"] = true,\n [\"-3\"] = true,\n [\"-4\"] = true,\n [\"-5\"] = true,\n [\"-6\"] = true,\n [\"-7\"] = true,\n [\"-8\"] = true,\n [\"Skull\"] = true,\n [\"Cultist\"] = true,\n [\"Tablet\"] = true,\n [\"Elder Thing\"] = true,\n [\"Auto-fail\"] = true,\n [\"Bless\"] = true,\n [\"Curse\"] = true,\n [\"Frost\"] = true\n }\n\n local TokenChecker = {}\n\n -- returns true if the passed object is a chaos token (by name)\n TokenChecker.isChaosToken = function(obj)\n if CHAOS_TOKEN_NAMES[obj.getName()] then\n return true\n else\n return false\n end\n end\n\n return TokenChecker\nend\nend)\n__bundle_register(\"core/token/TokenSpawnTrackerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenSpawnTracker = { }\n local SPAWN_TRACKER_GUID = \"e3ffc9\"\n\n TokenSpawnTracker.hasSpawnedTokens = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"hasSpawnedTokens\", cardGuid)\n end\n\n TokenSpawnTracker.markTokensSpawned = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"markTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetTokensSpawned = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetAllAssetAndEvents = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAllAssetAndEvents\")\n end\n\n TokenSpawnTracker.resetAllLocations = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAllLocations\")\n end\n\n TokenSpawnTracker.resetAll = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAll\")\n end\n\n return TokenSpawnTracker\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/MythosArea\")\nend)\n__bundle_register(\"core/MythosArea\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal playAreaApi = require(\"core/PlayAreaApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\nlocal tokenChecker = require(\"core/token/TokenChecker\")\nlocal tokenSpawnTrackerApi = require(\"core/token/TokenSpawnTrackerApi\")\n\nlocal ENCOUNTER_DECK_AREA = {\n upperLeft = { x = 0.9, z = 0.42 },\n lowerRight = { x = 0.86, z = 0.38 },\n}\nlocal ENCOUNTER_DISCARD_AREA = {\n upperLeft = { x = 1.62, z = 0.42 },\n lowerRight = { x = 1.58, z = 0.38 },\n}\n\n-- global position of encounter deck and discard pile\nlocal ENCOUNTER_DECK_POS = { x = -3.93, y = 1, z = 5.76 }\nlocal ENCOUNTER_DISCARD_POSITION = { x = -3.85, y = 1, z = 10.38 }\nlocal isReshuffling = false\n\n-- scenario metadata\nlocal currentScenario, useFrontData, tokenData\n\n-- GUID of data helper\nlocal DATA_HELPER_GUID = \"708279\"\n\nlocal TRASHCAN\nlocal TRASHCAN_GUID = \"70b9f6\"\n\n-- we use this to turn off collision handling until onLoad() is complete\nlocal collisionEnabled = false\n\nfunction onLoad(saveState)\n if saveState ~= nil then\n local loadedState = JSON.decode(saveState) or {}\n currentScenario = loadedState.currentScenario or \"\"\n useFrontData = loadedState.useFrontData or true\n tokenData = loadedState.tokenData or {}\n end\n TRASHCAN = getObjectFromGUID(TRASHCAN_GUID)\n collisionEnabled = true\nend\n\nfunction onSave()\n return JSON.encode({\n currentScenario = currentScenario,\n useFrontData = useFrontData,\n tokenData = tokenData\n })\nend\n\n-- TTS event handler. Handles scenario name event triggering and encounter card token resets.\nfunction onCollisionEnter(collisionInfo)\n if not collisionEnabled then return end\n local object = collisionInfo.collision_object\n\n if object.getName() == \"Scenario\" then\n local description = object.getDescription()\n\n -- detect if a new scenario card is placed down\n if currentScenario ~= description then\n currentScenario = description\n fireScenarioChangedEvent()\n end\n\n local metadata = JSON.decode(object.getGMNotes()) or {}\n if not metadata[\"tokens\"] then\n tokenData = {}\n return\n end\n\n -- detect orientation of scenario card (for difficulty)\n useFrontData = not object.is_face_down\n tokenData = metadata[\"tokens\"][(useFrontData and \"front\" or \"back\")]\n fireTokenDataChangedEvent()\n end\n\n local localPos = self.positionToLocal(object.getPosition())\n if inArea(localPos, ENCOUNTER_DECK_AREA) or inArea(localPos, ENCOUNTER_DISCARD_AREA) then\n tokenSpawnTrackerApi.resetTokensSpawned(object.getGUID())\n removeTokensFromObject(object)\n end\nend\n\n-- TTS event handler. Handles scenario name event triggering\nfunction onCollisionExit(collisionInfo)\n if not collisionEnabled then return end\n local object = collisionInfo.collision_object\n\n -- reset token metadata if scenario reference card is removed\n if object.getName() == \"Scenario\" then\n tokenData = {}\n useFrontData = nil\n fireTokenDataChangedEvent()\n end\nend\n\n-- Listens for cards entering the encounter deck or encounter discard, and resets the spawn state\n-- for the cards when they do.\nfunction onObjectEnterContainer(container, object)\n local localPos = self.positionToLocal(container.getPosition())\n if inArea(localPos, ENCOUNTER_DECK_AREA) or inArea(localPos, ENCOUNTER_DISCARD_AREA) then\n tokenSpawnTrackerApi.resetTokensSpawned(object.getGUID())\n end\nend\n\n-- fires if the scenario title changes\nfunction fireScenarioChangedEvent()\n Wait.frames(function() Global.call('titleSplash', currentScenario) end, 20)\n playAreaApi.onScenarioChanged(currentScenario)\nend\n\n-- fires if the scenario title or the difficulty changes\nfunction fireTokenDataChangedEvent()\n local fullData = returnTokenData()\n tokenArrangerApi.onTokenDataChanged(fullData)\nend\n\n-- returns the chaos token metadata (if provided)\nfunction returnTokenData()\n return {\n tokenData = tokenData,\n currentScenario = currentScenario,\n useFrontData = useFrontData\n }\nend\n\n---------------------------------------------------------\n-- encounter card drawing\n---------------------------------------------------------\n\n-- 'params' contains the position, rotation and a boolean to force a faceup draw\nfunction drawEncounterCard(params)\n local card\n local items = searchArea(ENCOUNTER_DECK_POS, { 3, 1, 4 }, isCardOrDeck)\n if #items \u003e 0 then\n for _, j in ipairs(items) do\n local v = j.hit_object\n if v.tag == 'Deck' then\n card = v.takeObject({ index = 0 })\n break\n end\n end\n -- we didn't find the deck so just pull the first thing we did find\n if card == nil then card = items[1].hit_object end\n actualEncounterCardDraw(card, params)\n else\n -- nothing here, time to reshuffle\n reshuffleEncounterDeck(params)\n end\nend\n\nfunction actualEncounterCardDraw(card, params)\n local faceUpRotation = 0\n if not params.alwaysFaceUp then\n local metadata = JSON.decode(card.getGMNotes()) or {}\n if metadata.hidden or getObjectFromGUID(DATA_HELPER_GUID).call('checkHiddenCard', card.getName()) then\n faceUpRotation = 180\n end\n end\n card.setPositionSmooth(params.pos, false, false)\n card.setRotationSmooth({ 0, params.rotY, faceUpRotation }, false, false)\nend\n\nfunction reshuffleEncounterDeck(params)\n -- flag to avoid multiple calls\n if isReshuffling then return end\n isReshuffling = true\n\n -- shuffle and flip deck, draw card after completion\n local discarded = searchArea(ENCOUNTER_DISCARD_POSITION, { 3, 1, 4 }, isDeck)\n if #discarded \u003e 0 then\n local deck = discarded[1].hit_object\n if not deck.is_face_down then deck.flip() end\n deck.shuffle()\n deck.setPositionSmooth(Vector(ENCOUNTER_DECK_POS) + Vector(0, 2, 0), false, true)\n Wait.time(function() actualEncounterCardDraw(deck.takeObject({ index = 0 }), params) end, 0.5)\n else\n printToAll(\"Couldn't find encounter discard pile to reshuffle.\", { 1, 0, 0 })\n end\n\n -- disable flag\n Wait.time(function() isReshuffling = false end, 1)\nend\n\n---------------------------------------------------------\n-- helper functions\n---------------------------------------------------------\n\n-- Simple method to check if the given point is in a specified area. Local use only,\n---@param point Vector. Point to check, only x and z values are relevant\n---@param bounds Table. Defined area to see if the point is within. See MAIN_PLAY_AREA for sample\n-- bounds definition.\n---@return Boolean. True if the point is in the area defined by bounds\nfunction inArea(point, bounds)\n return (point.x \u003c bounds.upperLeft.x\n and point.x \u003e bounds.lowerRight.x\n and point.z \u003c bounds.upperLeft.z\n and point.z \u003e bounds.lowerRight.z)\nend\n\n-- removes tokens from the provided card/deck\nfunction removeTokensFromObject(object)\n for _, v in ipairs(searchArea(object.getPosition(), { 3, 1, 4 })) do\n local obj = v.hit_object\n if obj.getGUID() ~= \"4ee1f2\" and -- table\n obj ~= self and\n obj.type ~= \"Deck\" and\n obj.type ~= \"Card\" and\n obj.memo ~= nil and\n obj.getLock() == false and\n not tokenChecker.isChaosToken(obj) then\n TRASHCAN.putObject(obj)\n end\n end\nend\n\n-- searches an area and optionally filters the result\nfunction searchArea(origin, size, filter)\n local objList = Physics.cast({\n origin = origin,\n direction = { 0, 1, 0 },\n orientation = self.getRotation(),\n type = 3,\n size = size,\n max_distance = 1\n })\n\n if filter then\n local filteredList = {}\n for _, obj in ipairs(objList) do\n if filter(obj.hit_object) then\n table.insert(filteredList, obj)\n end\n end\n return filteredList\n else\n return objList\n end\nend\n\n-- filter functions for searchArea\nfunction isDeck(x) return x.tag == 'Deck' end\n\nfunction isCardOrDeck(x) return x.tag == 'Card' or x.tag == 'Deck' end\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/MythosArea\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal guidReferenceApi = require(\"core/GUIDReferenceApi\")\nlocal playAreaApi = require(\"core/PlayAreaApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\nlocal tokenChecker = require(\"core/token/TokenChecker\")\nlocal tokenSpawnTrackerApi = require(\"core/token/TokenSpawnTrackerApi\")\n\nlocal ENCOUNTER_DECK_AREA = {\n upperLeft = { x = 0.9, z = 0.42 },\n lowerRight = { x = 0.86, z = 0.38 },\n}\nlocal ENCOUNTER_DISCARD_AREA = {\n upperLeft = { x = 1.62, z = 0.42 },\n lowerRight = { x = 1.58, z = 0.38 },\n}\n\n-- global position of encounter deck and discard pile\nlocal ENCOUNTER_DECK_POS = { x = -3.93, y = 1, z = 5.76 }\nlocal ENCOUNTER_DISCARD_POSITION = { x = -3.85, y = 1, z = 10.38 }\nlocal isReshuffling = false\n\n-- scenario metadata\nlocal currentScenario, useFrontData, tokenData\n\n-- object references\nlocal TRASH, DATA_HELPER\n\n-- we use this to turn off collision handling until onLoad() is complete\nlocal collisionEnabled = false\n\nfunction onLoad(saveState)\n if saveState ~= nil then\n local loadedState = JSON.decode(saveState) or {}\n currentScenario = loadedState.currentScenario or \"\"\n useFrontData = loadedState.useFrontData or true\n tokenData = loadedState.tokenData or {}\n end\n TRASH = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"Trash\")\n DATA_HELPER = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"DataHelper\")\n collisionEnabled = true\nend\n\nfunction onSave()\n return JSON.encode({\n currentScenario = currentScenario,\n useFrontData = useFrontData,\n tokenData = tokenData\n })\nend\n\n-- TTS event handler. Handles scenario name event triggering and encounter card token resets.\nfunction onCollisionEnter(collisionInfo)\n if not collisionEnabled then return end\n local object = collisionInfo.collision_object\n\n if object.getName() == \"Scenario\" then\n local description = object.getDescription()\n\n -- detect if a new scenario card is placed down\n if currentScenario ~= description then\n currentScenario = description\n fireScenarioChangedEvent()\n end\n\n local metadata = JSON.decode(object.getGMNotes()) or {}\n if not metadata[\"tokens\"] then\n tokenData = {}\n return\n end\n\n -- detect orientation of scenario card (for difficulty)\n useFrontData = not object.is_face_down\n tokenData = metadata[\"tokens\"][(useFrontData and \"front\" or \"back\")]\n fireTokenDataChangedEvent()\n end\n\n local localPos = self.positionToLocal(object.getPosition())\n if inArea(localPos, ENCOUNTER_DECK_AREA) or inArea(localPos, ENCOUNTER_DISCARD_AREA) then\n tokenSpawnTrackerApi.resetTokensSpawned(object.getGUID())\n removeTokensFromObject(object)\n end\nend\n\n-- TTS event handler. Handles scenario name event triggering\nfunction onCollisionExit(collisionInfo)\n if not collisionEnabled then return end\n local object = collisionInfo.collision_object\n\n -- reset token metadata if scenario reference card is removed\n if object.getName() == \"Scenario\" then\n tokenData = {}\n useFrontData = nil\n fireTokenDataChangedEvent()\n end\nend\n\n-- Listens for cards entering the encounter deck or encounter discard, and resets the spawn state\n-- for the cards when they do.\nfunction onObjectEnterContainer(container, object)\n local localPos = self.positionToLocal(container.getPosition())\n if inArea(localPos, ENCOUNTER_DECK_AREA) or inArea(localPos, ENCOUNTER_DISCARD_AREA) then\n tokenSpawnTrackerApi.resetTokensSpawned(object.getGUID())\n end\nend\n\n-- fires if the scenario title changes\nfunction fireScenarioChangedEvent()\n Wait.frames(function() Global.call('titleSplash', currentScenario) end, 20)\n playAreaApi.onScenarioChanged(currentScenario)\nend\n\n-- fires if the scenario title or the difficulty changes\nfunction fireTokenDataChangedEvent()\n local fullData = returnTokenData()\n tokenArrangerApi.onTokenDataChanged(fullData)\nend\n\n-- returns the chaos token metadata (if provided)\nfunction returnTokenData()\n return {\n tokenData = tokenData,\n currentScenario = currentScenario,\n useFrontData = useFrontData\n }\nend\n\n---------------------------------------------------------\n-- encounter card drawing\n---------------------------------------------------------\n\n-- gets the encounter deck (for internal functions and Api calls)\nfunction getEncounterDeck()\n local search = searchArea(ENCOUNTER_DECK_POS, { 3, 1, 4 }, isCardOrDeck)\n\n for _, v in ipairs(search) do\n local obj = v.hit_object\n if obj.type == 'Deck' then\n return obj\n end\n end\n \n -- if no deck was found, return the first hit (a card)\n if #search \u003e 0 then\n return search[1].hit_object\n end\nend\n\n-- 'params' contains the position, rotation and a boolean to force a faceup draw\nfunction drawEncounterCard(params)\n local card\n local deck = getEncounterDeck()\n\n if deck then\n if deck.type == \"Deck\" then\n card = deck.takeObject()\n else\n card = deck\n end\n actualEncounterCardDraw(card, params)\n else\n -- nothing here, time to reshuffle\n reshuffleEncounterDeck(params)\n end\nend\n\nfunction actualEncounterCardDraw(card, params)\n local faceUpRotation = 0\n if not params.alwaysFaceUp then\n local metadata = JSON.decode(card.getGMNotes()) or {}\n if metadata.hidden or DATA_HELPER.call('checkHiddenCard', card.getName()) then\n faceUpRotation = 180\n end\n end\n card.setPositionSmooth(params.pos, false, false)\n card.setRotationSmooth({ 0, params.rotY, faceUpRotation }, false, false)\nend\n\nfunction reshuffleEncounterDeck(params)\n -- flag to avoid multiple calls\n if isReshuffling then return end\n isReshuffling = true\n\n -- shuffle and flip deck, draw card after completion\n local discarded = searchArea(ENCOUNTER_DISCARD_POSITION, { 3, 1, 4 }, isDeck)\n if #discarded \u003e 0 then\n local deck = discarded[1].hit_object\n if not deck.is_face_down then deck.flip() end\n deck.shuffle()\n deck.setPositionSmooth(Vector(ENCOUNTER_DECK_POS) + Vector(0, 2, 0), false, true)\n Wait.time(function() actualEncounterCardDraw(deck.takeObject({ index = 0 }), params) end, 0.5)\n else\n printToAll(\"Couldn't find encounter discard pile to reshuffle.\", { 1, 0, 0 })\n end\n\n -- disable flag\n Wait.time(function() isReshuffling = false end, 1)\nend\n\n---------------------------------------------------------\n-- helper functions\n---------------------------------------------------------\n\n-- Simple method to check if the given point is in a specified area. Local use only,\n---@param point Vector. Point to check, only x and z values are relevant\n---@param bounds Table. Defined area to see if the point is within. See MAIN_PLAY_AREA for sample\n-- bounds definition.\n---@return Boolean. True if the point is in the area defined by bounds\nfunction inArea(point, bounds)\n return (point.x \u003c bounds.upperLeft.x\n and point.x \u003e bounds.lowerRight.x\n and point.z \u003c bounds.upperLeft.z\n and point.z \u003e bounds.lowerRight.z)\nend\n\n-- removes tokens from the provided card/deck\nfunction removeTokensFromObject(object)\n for _, v in ipairs(searchArea(object.getPosition(), { 3, 1, 4 })) do\n local obj = v.hit_object\n if obj.getGUID() ~= \"4ee1f2\" and -- table\n obj ~= self and\n obj.type ~= \"Deck\" and\n obj.type ~= \"Card\" and\n obj.memo ~= nil and\n obj.getLock() == false and\n not tokenChecker.isChaosToken(obj) then\n TRASH.putObject(obj)\n end\n end\nend\n\n-- searches an area and optionally filters the result\nfunction searchArea(origin, size, filter)\n local objList = Physics.cast({\n origin = origin,\n direction = { 0, 1, 0 },\n orientation = self.getRotation(),\n type = 3,\n size = size,\n max_distance = 1\n })\n\n if filter then\n local filteredList = {}\n for _, obj in ipairs(objList) do\n if filter(obj.hit_object) then\n table.insert(filteredList, obj)\n end\n end\n return filteredList\n else\n return objList\n end\nend\n\n-- filter functions for searchArea\nfunction isDeck(x) return x.tag == 'Deck' end\n\nfunction isCardOrDeck(x) return x.tag == 'Card' or x.tag == 'Deck' end\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenArranger\")\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getPlayArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"PlayArea\")\n end\n\n local function getInvestigatorCounter()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"InvestigatorCounter\")\n end\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getInvestigatorCounter().getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n getInvestigatorCounter().call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with 'displacement_excluded'\n ---@param playerColor Color Color of the player requesting the shift for messages\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getPlayArea().call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getPlayArea().call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getPlayArea().call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getPlayArea().call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getPlayArea().call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getPlayArea().call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getPlayArea().call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getPlayArea().call(\"tryObjectEnterContainer\", { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getPlayArea().call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getPlayArea().call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getPlayArea().call(\"countVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getPlayArea().call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getPlayArea().getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getPlayArea().call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getPlayArea().call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getPlayArea().getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\n__bundle_register(\"core/token/TokenChecker\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local CHAOS_TOKEN_NAMES = {\n [\"Elder Sign\"] = true,\n [\"+1\"] = true,\n [\"0\"] = true,\n [\"-1\"] = true,\n [\"-2\"] = true,\n [\"-3\"] = true,\n [\"-4\"] = true,\n [\"-5\"] = true,\n [\"-6\"] = true,\n [\"-7\"] = true,\n [\"-8\"] = true,\n [\"Skull\"] = true,\n [\"Cultist\"] = true,\n [\"Tablet\"] = true,\n [\"Elder Thing\"] = true,\n [\"Auto-fail\"] = true,\n [\"Bless\"] = true,\n [\"Curse\"] = true,\n [\"Frost\"] = true\n }\n\n local TokenChecker = {}\n\n -- returns true if the passed object is a chaos token (by name)\n TokenChecker.isChaosToken = function(obj)\n if CHAOS_TOKEN_NAMES[obj.getName()] then\n return true\n else\n return false\n end\n end\n\n return TokenChecker\nend\nend)\n__bundle_register(\"core/token/TokenSpawnTrackerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenSpawnTracker = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getSpawnTracker()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenSpawnTracker\")\n end\n\n TokenSpawnTracker.hasSpawnedTokens = function(cardGuid)\n return getSpawnTracker().call(\"hasSpawnedTokens\", cardGuid)\n end\n\n TokenSpawnTracker.markTokensSpawned = function(cardGuid)\n return getSpawnTracker().call(\"markTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetTokensSpawned = function(cardGuid)\n return getSpawnTracker().call(\"resetTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetAllAssetAndEvents = function()\n return getSpawnTracker().call(\"resetAllAssetAndEvents\")\n end\n\n TokenSpawnTracker.resetAllLocations = function()\n return getSpawnTracker().call(\"resetAllLocations\")\n end\n\n TokenSpawnTracker.resetAll = function()\n return getSpawnTracker().call(\"resetAll\")\n end\n\n return TokenSpawnTracker\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/MythosArea\")\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "{\"currentScenario\":\"\",\"tokenData\":[],\"useFrontData\":true}", "MeasureMovement": false, "Name": "Custom_Tile", "Nickname": "Mythos Area", "Snap": true, "Sticky": true, + "Tags": [ + "CleanUpHelper_ignore" + ], "Tooltip": false, "Transform": { "posX": -1.309, @@ -1789,6 +1855,9 @@ "Nickname": "Clue tokens", "Snap": true, "Sticky": true, + "Tags": [ + "CleanUpHelper_ignore" + ], "Tooltip": true, "Transform": { "posX": 2.857, @@ -1906,6 +1975,9 @@ "Nickname": "Doom tokens", "Snap": true, "Sticky": true, + "Tags": [ + "CleanUpHelper_ignore" + ], "Tooltip": true, "Transform": { "posX": 2.761, @@ -1956,13 +2028,16 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DoomCounter\")\nend)\n__bundle_register(\"core/DoomCounter\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal optionsVisible = false\nlocal options = {\n Agenda = true,\n Playarea = true,\n Playermats = true\n}\n\nval = 0\n\n-- save current value and options\nfunction onSave() return JSON.encode({ val, options }) end\n\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n val = loadedData[1]\n options = loadedData[2]\n\n -- restore state for option panel\n for key, bool in pairs(options) do\n self.UI.setAttribute(\"option\" .. key, \"isOn\", not bool)\n end\n end\n\n self.createButton({\n label = tostring(val),\n click_function = \"addOrSubtract\",\n function_owner = self,\n position = { 0, 0.06, 0 },\n height = 800,\n width = 800,\n font_size = 650,\n scale = { 1.5, 1.5, 1.5 },\n font_color = { 1, 1, 1, 95 },\n color = { 0, 0, 0, 0 }\n })\nend\n\n-- called by the invisible button to change displayed value\nfunction addOrSubtract(_, _, isRightClick)\n local newVal = math.min(math.max(val + (isRightClick and -1 or 1), 0), 99)\n if val ~= newVal then\n updateVal(newVal)\n end\nend\n\n-- adds the provided number to the current count\nfunction addVal(number)\n number = tonumber(number) or 0\n val = val + number\n self.editButton({ index = 0, label = tostring(val) })\n printToAll(\"Doom on agenda set to: \" .. val)\nend\n\n-- sets the current count to the provided number\nfunction updateVal(number)\n val = number or 0\n self.editButton({ index = 0, label = tostring(val) })\n printToAll(\"Doom on agenda set to: \" .. val)\nend\n\n-- called by \"Reset\" button to remove doom\nfunction startReset()\n if options.Agenda then\n updateVal(0)\n end\n -- call the \"Doom-in-Play\"-counter\n local DoomInPlayCounter = getObjectFromGUID(\"652ff3\")\n if DoomInPlayCounter then\n DoomInPlayCounter.call(\"removeDoom\", options)\n end\nend\n\n-- XML UI functions\nfunction optionClick(_, optionName)\n options[optionName] = not options[optionName]\n printToAll(\"Doom removal of \" .. optionName .. (options[optionName] and \" enabled\" or \" disabled\"))\nend\n\nfunction toggleOptions()\n optionsVisible = not optionsVisible\n\n if optionsVisible then\n self.UI.show(\"Options\")\n else\n self.UI.hide(\"Options\")\n end\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DoomCounter\")\nend)\n__bundle_register(\"core/DoomCounter\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\nlocal optionsVisible = false\nlocal options = {\n Agenda = true,\n Playarea = true,\n Playermats = true\n}\n\nval = 0\n\n-- save current value and options\nfunction onSave() return JSON.encode({ val, options }) end\n\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n val = loadedData[1]\n options = loadedData[2]\n\n -- restore state for option panel\n for key, bool in pairs(options) do\n self.UI.setAttribute(\"option\" .. key, \"isOn\", not bool)\n end\n end\n\n self.createButton({\n label = tostring(val),\n click_function = \"addOrSubtract\",\n function_owner = self,\n position = { 0, 0.06, 0 },\n height = 800,\n width = 800,\n font_size = 650,\n scale = { 1.5, 1.5, 1.5 },\n font_color = { 1, 1, 1, 95 },\n color = { 0, 0, 0, 0 }\n })\nend\n\n-- called by the invisible button to change displayed value\nfunction addOrSubtract(_, _, isRightClick)\n local newVal = math.min(math.max(val + (isRightClick and -1 or 1), 0), 99)\n if val ~= newVal then\n updateVal(newVal)\n end\nend\n\n-- adds the provided number to the current count\nfunction addVal(number)\n number = tonumber(number) or 0\n val = val + number\n self.editButton({ index = 0, label = tostring(val) })\n printToAll(\"Doom on agenda set to: \" .. val)\nend\n\n-- sets the current count to the provided number\nfunction updateVal(number)\n val = number or 0\n self.editButton({ index = 0, label = tostring(val) })\n printToAll(\"Doom on agenda set to: \" .. val)\nend\n\n-- called by \"Reset\" button to remove doom\nfunction startReset()\n if options.Agenda then\n updateVal(0)\n end\n local doomInPlayCounter = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"DoomInPlayCounter\")\n if doomInPlayCounter then\n doomInPlayCounter.call(\"removeDoom\", options)\n end\nend\n\n-- XML UI functions\nfunction optionClick(_, optionName)\n options[optionName] = not options[optionName]\n printToAll(\"Doom removal of \" .. optionName .. (options[optionName] and \" enabled\" or \" disabled\"))\nend\n\nfunction toggleOptions()\n optionsVisible = not optionsVisible\n\n if optionsVisible then\n self.UI.show(\"Options\")\n else\n self.UI.hide(\"Options\")\n end\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "[0,{\"Agenda\":true,\"Playarea\":true,\"Playermats\":true}]", "MeasureMovement": false, "Name": "Custom_Token", "Nickname": "Doom Counter", "Snap": true, "Sticky": true, + "Tags": [ + "CleanUpHelper_ignore" + ], "Tooltip": true, "Transform": { "posX": -5.3, @@ -1976,7 +2051,7 @@ "scaleZ": 0.42 }, "Value": 0, - "XmlUI": "\u003cDefaults\u003e\n \u003cPanel rotation=\"0 0 180\"\u003e\u003c/Panel\u003e\n \u003cToggleButton class=\"optionButton\" colors=\"#50e610|#f2d82e|#f2d82e\" fontSize=\"45\" isOn=\"0\" textAlignment=\"MiddleLeft\" padding=\"30 30 0 0\"\u003e\u003c/ToggleButton\u003e\n\u003c/Defaults\u003e\n\n\u003cPanel id=\"Buttons\" offsetXY=\"0 285\"\u003e\n \u003cTableLayout height=\"150\" width=\"500\" cellSpacing=\"10\"\u003e\n \u003cRow\u003e\n \u003cCell columnSpan=\"3\"\u003e\n \u003cButton onClick=\"startReset\" fontSize=\"80\"\u003eReset\u003c/Button\u003e\n \u003c/Cell\u003e\n \u003cCell\u003e\n \u003cToggleButton onClick=\"toggleOptions\" fontSize=\"55\"\u003e☰\u003c/ToggleButton\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n \u003c/TableLayout\u003e\n\u003c/Panel\u003e\n\n\u003cPanel id=\"Options\" offsetXY=\"0 535\" active=\"false\" showAnimation=\"Grow\" hideAnimation=\"Shrink\"\u003e\n \u003cVerticalLayout height=\"300\" width=\"500\" spacing=\"10\" childAlignment=\"MiddleCenter\"\u003e\n \u003cToggleButton class=\"optionButton\" id=\"optionAgenda\" onClick=\"optionClick(Agenda)\"\u003eDoom on Agenda\u003c/ToggleButton\u003e\n \u003cToggleButton class=\"optionButton\" id=\"optionPlayarea\" onClick=\"optionClick(Playarea)\"\u003eDoom in Playarea\u003c/ToggleButton\u003e\n \u003cToggleButton class=\"optionButton\" id=\"optionPlayermats\" onClick=\"optionClick(Playermats)\"\u003eDoom on Playermats\u003c/ToggleButton\u003e\n \u003c/VerticalLayout\u003e\n\u003c/Panel\u003e" + "XmlUI": "\u003c!-- include DoomCounter.xml --\u003e\n\u003cDefaults\u003e\n \u003cPanel rotation=\"0 0 180\"\u003e\u003c/Panel\u003e\n \u003cToggleButton class=\"optionButton\" colors=\"#50e610|#f2d82e|#f2d82e\" fontSize=\"45\" isOn=\"0\" textAlignment=\"MiddleLeft\" padding=\"30 30 0 0\"\u003e\u003c/ToggleButton\u003e\n\u003c/Defaults\u003e\n\n\u003cPanel id=\"Buttons\" offsetXY=\"0 285\"\u003e\n \u003cTableLayout height=\"150\" width=\"500\" cellSpacing=\"10\"\u003e\n \u003cRow\u003e\n \u003cCell columnSpan=\"3\"\u003e\n \u003cButton onClick=\"startReset\" fontSize=\"80\"\u003eReset\u003c/Button\u003e\n \u003c/Cell\u003e\n \u003cCell\u003e\n \u003cToggleButton onClick=\"toggleOptions\" fontSize=\"55\"\u003e☰\u003c/ToggleButton\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n \u003c/TableLayout\u003e\n\u003c/Panel\u003e\n\n\u003cPanel id=\"Options\" offsetXY=\"0 535\" active=\"false\" showAnimation=\"Grow\" hideAnimation=\"Shrink\"\u003e\n \u003cVerticalLayout height=\"300\" width=\"500\" spacing=\"10\" childAlignment=\"MiddleCenter\"\u003e\n \u003cToggleButton class=\"optionButton\" id=\"optionAgenda\" onClick=\"optionClick(Agenda)\"\u003eDoom on Agenda\u003c/ToggleButton\u003e\n \u003cToggleButton class=\"optionButton\" id=\"optionPlayarea\" onClick=\"optionClick(Playarea)\"\u003eDoom in Playarea\u003c/ToggleButton\u003e\n \u003cToggleButton class=\"optionButton\" id=\"optionPlayermats\" onClick=\"optionClick(Playermats)\"\u003eDoom on Playermats\u003c/ToggleButton\u003e\n \u003c/VerticalLayout\u003e\n\u003c/Panel\u003e\n\u003c!-- include DoomCounter.xml --\u003e" }, { "AltLookAngle": { @@ -2127,7 +2202,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/GenericCounter\", function(require, _LOADED, __bundle_register, __bundle_modules)\nMIN_VALUE = 0\nMAX_VALUE = 99\nval = 0\n\nfunction onSave() return JSON.encode(val) end\n\nfunction onLoad(savedData)\n if savedData ~= nil then\n val = JSON.decode(savedData)\n end\n\n local name = self.getName()\n local position = {}\n\n if name == \"Damage\" or name == \"Resources\" or name == \"Resource Counter\" then\n position = { 0, 0.06, 0.1 }\n elseif name == \"Horror\" then\n position = { -0.025, 0.06, -0.025 }\n elseif name == \"Elder Sign Counter\" or name == \"Auto-fail Counter\" then\n position = { 0, 0.1, 0 }\n else\n position = { 0, 0.06, 0 }\n end\n\n self.createButton({\n label = tostring(val),\n click_function = \"addOrSubtract\",\n function_owner = self,\n position = position,\n height = 600,\n width = 1000,\n scale = { 1.5, 1.5, 1.5 },\n font_size = 600,\n font_color = { 1, 1, 1, 100 },\n color = { 0, 0, 0, 0 }\n })\n\n self.addContextMenuItem(\"Add 5\", function() updateVal(val + 5) end)\n self.addContextMenuItem(\"Subtract 5\", function() updateVal(val - 5) end)\n self.addContextMenuItem(\"Add 10\", function() updateVal(val + 10) end)\n self.addContextMenuItem(\"Subtract 10\", function() updateVal(val - 10) end)\nend\n\nfunction updateVal(newVal)\n if tonumber(newVal) then\n val = math.min(math.max(newVal, MIN_VALUE), MAX_VALUE)\n self.editButton({ index = 0, label = tostring(val) })\n end\nend\n\nfunction addOrSubtract(_, _, isRightClick)\n val = math.min(math.max(val + (isRightClick and -1 or 1), MIN_VALUE), MAX_VALUE)\n self.editButton({ index = 0, label = tostring(val) })\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/ActiveInvestigatorCounter\")\nend)\n__bundle_register(\"core/ActiveInvestigatorCounter\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/GenericCounter\")\nMIN_VALUE = 1\nMAX_VALUE = 4\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/ActiveInvestigatorCounter\")\nend)\n__bundle_register(\"core/ActiveInvestigatorCounter\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/GenericCounter\")\nMIN_VALUE = 1\nMAX_VALUE = 4\nend)\n__bundle_register(\"core/GenericCounter\", function(require, _LOADED, __bundle_register, __bundle_modules)\nMIN_VALUE = 0\nMAX_VALUE = 99\nval = 0\n\nfunction onSave() return JSON.encode(val) end\n\nfunction onLoad(savedData)\n if savedData ~= nil then\n val = JSON.decode(savedData)\n end\n\n local name = self.getName()\n local position = {}\n\n if name == \"Damage\" or name == \"Resources\" or name == \"Resource Counter\" then\n position = { 0, 0.06, 0.1 }\n elseif name == \"Horror\" then\n position = { -0.025, 0.06, -0.025 }\n elseif name == \"Elder Sign Counter\" or name == \"Auto-fail Counter\" then\n position = { 0, 0.1, 0 }\n else\n position = { 0, 0.06, 0 }\n end\n\n self.createButton({\n label = tostring(val),\n click_function = \"addOrSubtract\",\n function_owner = self,\n position = position,\n height = 600,\n width = 1000,\n scale = { 1.5, 1.5, 1.5 },\n font_size = 600,\n font_color = { 1, 1, 1, 100 },\n color = { 0, 0, 0, 0 }\n })\n\n self.addContextMenuItem(\"Add 5\", function() updateVal(val + 5) end)\n self.addContextMenuItem(\"Subtract 5\", function() updateVal(val - 5) end)\n self.addContextMenuItem(\"Add 10\", function() updateVal(val + 10) end)\n self.addContextMenuItem(\"Subtract 10\", function() updateVal(val - 10) end)\nend\n\nfunction updateVal(newVal)\n if tonumber(newVal) then\n val = math.min(math.max(newVal, MIN_VALUE), MAX_VALUE)\n self.editButton({ index = 0, label = tostring(val) })\n end\nend\n\nfunction addOrSubtract(_, _, isRightClick)\n val = math.min(math.max(val + (isRightClick and -1 or 1), MIN_VALUE), MAX_VALUE)\n self.editButton({ index = 0, label = tostring(val) })\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "2", "MeasureMovement": false, "Name": "Custom_Token", @@ -2318,7 +2393,7 @@ "Tooltip": false, "Transform": { "posX": -59.426, - "posY": 1.3, + "posY": 1, "posZ": -22.721, "rotX": 0, "rotY": 280, @@ -2378,7 +2453,7 @@ "Tooltip": false, "Transform": { "posX": -59.426, - "posY": 1.3, + "posY": 1, "posZ": 9.395, "rotX": 0, "rotY": 280, @@ -2438,7 +2513,7 @@ "Tooltip": false, "Transform": { "posX": -36.87, - "posY": 1.3, + "posY": 1, "posZ": 30.977, "rotX": 0, "rotY": 10, @@ -2498,7 +2573,7 @@ "Tooltip": false, "Transform": { "posX": -23.89, - "posY": 1.3, + "posY": 1, "posZ": -30.977, "rotX": 0, "rotY": 190, @@ -2602,7 +2677,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/GenericCounter\")\nend)\n__bundle_register(\"core/GenericCounter\", function(require, _LOADED, __bundle_register, __bundle_modules)\nMIN_VALUE = 0\nMAX_VALUE = 99\nval = 0\n\nfunction onSave() return JSON.encode(val) end\n\nfunction onLoad(savedData)\n if savedData ~= nil then\n val = JSON.decode(savedData)\n end\n\n local name = self.getName()\n local position = {}\n\n if name == \"Damage\" or name == \"Resources\" or name == \"Resource Counter\" then\n position = { 0, 0.06, 0.1 }\n elseif name == \"Horror\" then\n position = { -0.025, 0.06, -0.025 }\n elseif name == \"Elder Sign Counter\" or name == \"Auto-fail Counter\" then\n position = { 0, 0.1, 0 }\n else\n position = { 0, 0.06, 0 }\n end\n\n self.createButton({\n label = tostring(val),\n click_function = \"addOrSubtract\",\n function_owner = self,\n position = position,\n height = 600,\n width = 1000,\n scale = { 1.5, 1.5, 1.5 },\n font_size = 600,\n font_color = { 1, 1, 1, 100 },\n color = { 0, 0, 0, 0 }\n })\n\n self.addContextMenuItem(\"Add 5\", function() updateVal(val + 5) end)\n self.addContextMenuItem(\"Subtract 5\", function() updateVal(val - 5) end)\n self.addContextMenuItem(\"Add 10\", function() updateVal(val + 10) end)\n self.addContextMenuItem(\"Subtract 10\", function() updateVal(val - 10) end)\nend\n\nfunction updateVal(newVal)\n if tonumber(newVal) then\n val = math.min(math.max(newVal, MIN_VALUE), MAX_VALUE)\n self.editButton({ index = 0, label = tostring(val) })\n end\nend\n\nfunction addOrSubtract(_, _, isRightClick)\n val = math.min(math.max(val + (isRightClick and -1 or 1), MIN_VALUE), MAX_VALUE)\n self.editButton({ index = 0, label = tostring(val) })\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/GenericCounter\", function(require, _LOADED, __bundle_register, __bundle_modules)\nMIN_VALUE = 0\nMAX_VALUE = 99\nval = 0\n\nfunction onSave() return JSON.encode(val) end\n\nfunction onLoad(savedData)\n if savedData ~= nil then\n val = JSON.decode(savedData)\n end\n\n local name = self.getName()\n local position = {}\n\n if name == \"Damage\" or name == \"Resources\" or name == \"Resource Counter\" then\n position = { 0, 0.06, 0.1 }\n elseif name == \"Horror\" then\n position = { -0.025, 0.06, -0.025 }\n elseif name == \"Elder Sign Counter\" or name == \"Auto-fail Counter\" then\n position = { 0, 0.1, 0 }\n else\n position = { 0, 0.06, 0 }\n end\n\n self.createButton({\n label = tostring(val),\n click_function = \"addOrSubtract\",\n function_owner = self,\n position = position,\n height = 600,\n width = 1000,\n scale = { 1.5, 1.5, 1.5 },\n font_size = 600,\n font_color = { 1, 1, 1, 100 },\n color = { 0, 0, 0, 0 }\n })\n\n self.addContextMenuItem(\"Add 5\", function() updateVal(val + 5) end)\n self.addContextMenuItem(\"Subtract 5\", function() updateVal(val - 5) end)\n self.addContextMenuItem(\"Add 10\", function() updateVal(val + 10) end)\n self.addContextMenuItem(\"Subtract 10\", function() updateVal(val - 10) end)\nend\n\nfunction updateVal(newVal)\n if tonumber(newVal) then\n val = math.min(math.max(newVal, MIN_VALUE), MAX_VALUE)\n self.editButton({ index = 0, label = tostring(val) })\n end\nend\n\nfunction addOrSubtract(_, _, isRightClick)\n val = math.min(math.max(val + (isRightClick and -1 or 1), MIN_VALUE), MAX_VALUE)\n self.editButton({ index = 0, label = tostring(val) })\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/GenericCounter\")\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "0", "MeasureMovement": false, "Name": "Custom_Token", @@ -3172,7 +3247,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/GenericCounter\", function(require, _LOADED, __bundle_register, __bundle_modules)\nMIN_VALUE = 0\nMAX_VALUE = 99\nval = 0\n\nfunction onSave() return JSON.encode(val) end\n\nfunction onLoad(savedData)\n if savedData ~= nil then\n val = JSON.decode(savedData)\n end\n\n local name = self.getName()\n local position = {}\n\n if name == \"Damage\" or name == \"Resources\" or name == \"Resource Counter\" then\n position = { 0, 0.06, 0.1 }\n elseif name == \"Horror\" then\n position = { -0.025, 0.06, -0.025 }\n elseif name == \"Elder Sign Counter\" or name == \"Auto-fail Counter\" then\n position = { 0, 0.1, 0 }\n else\n position = { 0, 0.06, 0 }\n end\n\n self.createButton({\n label = tostring(val),\n click_function = \"addOrSubtract\",\n function_owner = self,\n position = position,\n height = 600,\n width = 1000,\n scale = { 1.5, 1.5, 1.5 },\n font_size = 600,\n font_color = { 1, 1, 1, 100 },\n color = { 0, 0, 0, 0 }\n })\n\n self.addContextMenuItem(\"Add 5\", function() updateVal(val + 5) end)\n self.addContextMenuItem(\"Subtract 5\", function() updateVal(val - 5) end)\n self.addContextMenuItem(\"Add 10\", function() updateVal(val + 10) end)\n self.addContextMenuItem(\"Subtract 10\", function() updateVal(val - 10) end)\nend\n\nfunction updateVal(newVal)\n if tonumber(newVal) then\n val = math.min(math.max(newVal, MIN_VALUE), MAX_VALUE)\n self.editButton({ index = 0, label = tostring(val) })\n end\nend\n\nfunction addOrSubtract(_, _, isRightClick)\n val = math.min(math.max(val + (isRightClick and -1 or 1), MIN_VALUE), MAX_VALUE)\n self.editButton({ index = 0, label = tostring(val) })\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/GenericCounter\")\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/GenericCounter\")\nend)\n__bundle_register(\"core/GenericCounter\", function(require, _LOADED, __bundle_register, __bundle_modules)\nMIN_VALUE = 0\nMAX_VALUE = 99\nval = 0\n\nfunction onSave() return JSON.encode(val) end\n\nfunction onLoad(savedData)\n if savedData ~= nil then\n val = JSON.decode(savedData)\n end\n\n local name = self.getName()\n local position = {}\n\n if name == \"Damage\" or name == \"Resources\" or name == \"Resource Counter\" then\n position = { 0, 0.06, 0.1 }\n elseif name == \"Horror\" then\n position = { -0.025, 0.06, -0.025 }\n elseif name == \"Elder Sign Counter\" or name == \"Auto-fail Counter\" then\n position = { 0, 0.1, 0 }\n else\n position = { 0, 0.06, 0 }\n end\n\n self.createButton({\n label = tostring(val),\n click_function = \"addOrSubtract\",\n function_owner = self,\n position = position,\n height = 600,\n width = 1000,\n scale = { 1.5, 1.5, 1.5 },\n font_size = 600,\n font_color = { 1, 1, 1, 100 },\n color = { 0, 0, 0, 0 }\n })\n\n self.addContextMenuItem(\"Add 5\", function() updateVal(val + 5) end)\n self.addContextMenuItem(\"Subtract 5\", function() updateVal(val - 5) end)\n self.addContextMenuItem(\"Add 10\", function() updateVal(val + 10) end)\n self.addContextMenuItem(\"Subtract 10\", function() updateVal(val - 10) end)\nend\n\nfunction updateVal(newVal)\n if tonumber(newVal) then\n val = math.min(math.max(newVal, MIN_VALUE), MAX_VALUE)\n self.editButton({ index = 0, label = tostring(val) })\n end\nend\n\nfunction addOrSubtract(_, _, isRightClick)\n val = math.min(math.max(val + (isRightClick and -1 or 1), MIN_VALUE), MAX_VALUE)\n self.editButton({ index = 0, label = tostring(val) })\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "5", "MeasureMovement": false, "Name": "Custom_Token", @@ -3600,17 +3675,17 @@ "Order": 0 }, "ColorDiffuse": { - "b": 0.99796, - "g": 0.99623, + "b": 1, + "g": 1, "r": 1 }, "CustomMesh": { "CastShadows": true, "ColliderURL": "", "Convex": true, - "DiffuseURL": "", + "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/2172484009093064421/956617F74D651E2B2CD1F7E7EC6B34C3A30617B2/", "MaterialIndex": 0, - "MeshURL": "http://cloud-3.steamusercontent.com/ugc/1293045649230453355/2F68BC7FA71E051E2BBA46C0D1B06A5972D52E7C/", + "MeshURL": "http://cloud-3.steamusercontent.com/ugc/2172484009093064278/BFF258FC90A0E56581C5C302752CF67C4947A540/", "NormalURL": "", "TypeIndex": 6 }, @@ -3638,14 +3713,14 @@ "Tooltip": true, "Transform": { "posX": 0.493, - "posY": 1.656, + "posY": 1.55, "posZ": 0, "rotX": 0, - "rotY": 0, + "rotY": 270, "rotZ": 0, - "scaleX": 0.4, - "scaleY": 0.3, - "scaleZ": 0.4 + "scaleX": 0.75, + "scaleY": 1, + "scaleZ": 0.75 }, "Value": 0, "XmlUI": "" @@ -7682,17 +7757,17 @@ "Order": 0 }, "ColorDiffuse": { - "b": 0.99796, - "g": 0.99623, + "b": 1, + "g": 1, "r": 1 }, "CustomMesh": { "CastShadows": true, "ColliderURL": "", "Convex": true, - "DiffuseURL": "", + "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/2172484009093064421/956617F74D651E2B2CD1F7E7EC6B34C3A30617B2/", "MaterialIndex": 0, - "MeshURL": "http://cloud-3.steamusercontent.com/ugc/1293045649230453355/2F68BC7FA71E051E2BBA46C0D1B06A5972D52E7C/", + "MeshURL": "http://cloud-3.steamusercontent.com/ugc/2172484009093064278/BFF258FC90A0E56581C5C302752CF67C4947A540/", "NormalURL": "", "TypeIndex": 6 }, @@ -7720,14 +7795,14 @@ "Tooltip": true, "Transform": { "posX": -42.25, - "posY": 1.653, + "posY": 1.55, "posZ": -19.3, "rotX": 0, - "rotY": 0, + "rotY": 180, "rotZ": 0, - "scaleX": 0.3, - "scaleY": 0.3, - "scaleZ": 0.3 + "scaleX": 0.75, + "scaleY": 1, + "scaleZ": 0.75 }, "Value": 0, "XmlUI": "" @@ -7743,17 +7818,17 @@ "Order": 0 }, "ColorDiffuse": { - "b": 0.99796, - "g": 0.99623, + "b": 1, + "g": 1, "r": 1 }, "CustomMesh": { "CastShadows": true, "ColliderURL": "", "Convex": true, - "DiffuseURL": "", + "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/2172484009093064421/956617F74D651E2B2CD1F7E7EC6B34C3A30617B2/", "MaterialIndex": 0, - "MeshURL": "http://cloud-3.steamusercontent.com/ugc/1293045649230453355/2F68BC7FA71E051E2BBA46C0D1B06A5972D52E7C/", + "MeshURL": "http://cloud-3.steamusercontent.com/ugc/2172484009093064278/BFF258FC90A0E56581C5C302752CF67C4947A540/", "NormalURL": "", "TypeIndex": 6 }, @@ -7781,14 +7856,14 @@ "Tooltip": true, "Transform": { "posX": -42.25, - "posY": 1.664, + "posY": 1.55, "posZ": 19.3, "rotX": 0, "rotY": 0, "rotZ": 0, - "scaleX": 0.3, - "scaleY": 0.3, - "scaleZ": 0.3 + "scaleX": 0.75, + "scaleY": 1, + "scaleZ": 0.75 }, "Value": 0, "XmlUI": "" @@ -7804,17 +7879,17 @@ "Order": 0 }, "ColorDiffuse": { - "b": 0.99796, - "g": 0.99623, + "b": 1, + "g": 1, "r": 1 }, "CustomMesh": { "CastShadows": true, "ColliderURL": "", "Convex": true, - "DiffuseURL": "", + "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/2172484009093064421/956617F74D651E2B2CD1F7E7EC6B34C3A30617B2/", "MaterialIndex": 0, - "MeshURL": "http://cloud-3.steamusercontent.com/ugc/1293045649230453355/2F68BC7FA71E051E2BBA46C0D1B06A5972D52E7C/", + "MeshURL": "http://cloud-3.steamusercontent.com/ugc/2172484009093064278/BFF258FC90A0E56581C5C302752CF67C4947A540/", "NormalURL": "", "TypeIndex": 6 }, @@ -7842,14 +7917,14 @@ "Tooltip": true, "Transform": { "posX": -47.73, - "posY": 1.624, + "posY": 1.55, "posZ": 4, "rotX": 0, - "rotY": 0, + "rotY": 270, "rotZ": 0, - "scaleX": 0.3, - "scaleY": 0.3, - "scaleZ": 0.3 + "scaleX": 0.75, + "scaleY": 1, + "scaleZ": 0.75 }, "Value": 0, "XmlUI": "" @@ -7865,17 +7940,17 @@ "Order": 0 }, "ColorDiffuse": { - "b": 0.99796, - "g": 0.99623, + "b": 1, + "g": 1, "r": 1 }, "CustomMesh": { "CastShadows": true, "ColliderURL": "", "Convex": true, - "DiffuseURL": "", + "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/2172484009093064421/956617F74D651E2B2CD1F7E7EC6B34C3A30617B2/", "MaterialIndex": 0, - "MeshURL": "http://cloud-3.steamusercontent.com/ugc/1293045649230453355/2F68BC7FA71E051E2BBA46C0D1B06A5972D52E7C/", + "MeshURL": "http://cloud-3.steamusercontent.com/ugc/2172484009093064278/BFF258FC90A0E56581C5C302752CF67C4947A540/", "NormalURL": "", "TypeIndex": 6 }, @@ -7903,14 +7978,14 @@ "Tooltip": true, "Transform": { "posX": -47.73, - "posY": 1.622, + "posY": 1.55, "posZ": -4, "rotX": 0, - "rotY": 0, + "rotY": 270, "rotZ": 0, - "scaleX": 0.3, - "scaleY": 0.3, - "scaleZ": 0.3 + "scaleX": 0.75, + "scaleY": 1, + "scaleZ": 0.75 }, "Value": 0, "XmlUI": "" @@ -7931,7 +8006,7 @@ "PDFPage": 0, "PDFPageOffset": 0, "PDFPassword": "", - "PDFUrl": "https://images-cdn.fantasyflightgames.com/filer_public/c4/b0/c4b0d66c-d79e-411b-bdb5-b5d8c457d4bc/ahc01_rules_reference_web.pdf" + "PDFUrl": "http://cloud-3.steamusercontent.com/ugc/2115061845793806189/6FC67F9AF9224452E2D8F25E63B88D702B21B0DC/" }, "Description": "", "DragSelectable": true, @@ -13257,6 +13332,9 @@ "Nickname": "Doom tokens", "Snap": true, "Sticky": true, + "Tags": [ + "CleanUpHelper_ignore" + ], "Tooltip": true, "Transform": { "posX": -55.48, @@ -16937,6 +17015,9 @@ "Nickname": "Connection markers", "Snap": true, "Sticky": true, + "Tags": [ + "CleanUpHelper_ignore" + ], "Tooltip": true, "Transform": { "posX": -51, @@ -18521,7 +18602,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playermat/ClueCounter\")\nend)\n__bundle_register(\"playermat/ClueCounter\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Table of items which can be counted in this Bowl\n-- Each entry has 2 things to enter\n-- a name (what is in the name field of that object)\n-- a value (how much it is worth)\n-- a number in the items description will override the number entry in this table\nlocal validCountItemList = {\n [\"Clue\"] = 1,\n [\"\"] = 1\n}\nlocal trashGUID = \"70b9f6\"\nexposedValue = 0\n\nfunction onLoad()\n self.createButton({\n label = \"\",\n click_function = \"removeAllClues\",\n function_owner = self,\n position = { 0, 0.1, 0 },\n height = 0,\n width = 0,\n font_color = { 0, 0, 0 },\n font_size = 2000\n })\n loopID = Wait.time(countItems, 1, -1)\nend\n\n-- Activated once per second, counts items in bowls\nfunction countItems()\n local totalValue = 0\n local countableItems = findValidItemsInSphere()\n for _, entry in ipairs(countableItems) do\n local descValue = tonumber(entry.hit_object.getDescription())\n local stackMult = math.abs(entry.hit_object.getQuantity())\n -- Use value in description if available\n if descValue ~= nil then\n totalValue = totalValue + descValue * stackMult\n else\n -- Otherwise use the value in validCountItemList\n totalValue = totalValue + validCountItemList[entry.hit_object.getName()] * stackMult\n end\n end\n exposedValue = totalValue\n self.editButton({ index = 0, label = totalValue })\nend\n\nfunction findValidItemsInSphere()\n local items = Physics.cast({\n origin = self.getPosition(),\n direction = { 0, 1, 0 },\n type = 2,\n max_distance = 0,\n size = { 2, 2, 2 },\n --debug=true\n })\n\n retval = {}\n for _, entry in ipairs(items) do\n --Ignore the bowl\n if entry.hit_object ~= self then\n --Ignore if not in validCountItemList\n local tableEntry = validCountItemList[entry.hit_object.getName()]\n if tableEntry ~= nil then\n table.insert(retval, entry)\n end\n end\n end\n return retval\nend\n\nfunction removeAllClues()\n startLuaCoroutine(self, \"clueRemovalCoroutine\")\nend\n\nfunction clueRemovalCoroutine()\n for _, entry in ipairs(findValidItemsInSphere()) do\n -- Do not put the table in the garbage\n if entry.hit_object.getGUID() ~= \"4ee1f2\" then\n -- delay for animation purposes\n for k = 1, 10 do\n coroutine.yield(0)\n end\n getObjectFromGUID(trashGUID).putObject(entry.hit_object)\n end\n end\n return 1\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playermat/ClueCounter\")\nend)\n__bundle_register(\"playermat/ClueCounter\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Table of items which can be counted in this Bowl\n-- Each entry has 2 things to enter\n-- a name (what is in the name field of that object)\n-- a value (how much it is worth)\n-- a number in the items description will override the number entry in this table\nlocal validCountItemList = {\n [\"Clue\"] = 1,\n [\"\"] = 1\n}\nexposedValue = 0\n\nfunction onLoad()\n self.createButton({\n label = \"\",\n click_function = \"countItems\",\n function_owner = self,\n position = { 0, 0.1, 0 },\n height = 0,\n width = 0,\n font_color = { 0, 0, 0 },\n font_size = 2000\n })\n loopID = Wait.time(countItems, 1, -1)\nend\n\n-- Activated once per second, counts items in bowls\nfunction countItems()\n local totalValue = 0\n for _, item in ipairs(findValidItemsInSphere()) do\n local descValue = tonumber(item.getDescription())\n local stackMult = math.abs(item.getQuantity())\n -- Use value in description if available\n if descValue ~= nil then\n totalValue = totalValue + descValue * stackMult\n else\n -- Otherwise use the value in validCountItemList\n totalValue = totalValue + validCountItemList[item.getName()] * stackMult\n end\n end\n exposedValue = totalValue\n self.editButton({ index = 0, label = totalValue })\nend\n\nfunction findValidItemsInSphere()\n local items = Physics.cast({\n origin = self.getPosition(),\n direction = { 0, 1, 0 },\n type = 2,\n max_distance = 0,\n size = { 2, 2, 2 }\n })\n\n local validItemList = {}\n for _, entry in ipairs(items) do\n if entry.hit_object ~= self then\n if validCountItemList[entry.hit_object.getName()] ~= nil then\n table.insert(validItemList, entry.hit_object)\n end\n end\n end\n return validItemList\nend\n\nfunction removeAllClues(trash)\n for _, obj in ipairs(findValidItemsInSphere()) do\n trash.putObject(obj)\n end\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Custom_Model", @@ -18587,7 +18668,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playermat/ClueCounter\")\nend)\n__bundle_register(\"playermat/ClueCounter\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Table of items which can be counted in this Bowl\n-- Each entry has 2 things to enter\n-- a name (what is in the name field of that object)\n-- a value (how much it is worth)\n-- a number in the items description will override the number entry in this table\nlocal validCountItemList = {\n [\"Clue\"] = 1,\n [\"\"] = 1\n}\nlocal trashGUID = \"70b9f6\"\nexposedValue = 0\n\nfunction onLoad()\n self.createButton({\n label = \"\",\n click_function = \"removeAllClues\",\n function_owner = self,\n position = { 0, 0.1, 0 },\n height = 0,\n width = 0,\n font_color = { 0, 0, 0 },\n font_size = 2000\n })\n loopID = Wait.time(countItems, 1, -1)\nend\n\n-- Activated once per second, counts items in bowls\nfunction countItems()\n local totalValue = 0\n local countableItems = findValidItemsInSphere()\n for _, entry in ipairs(countableItems) do\n local descValue = tonumber(entry.hit_object.getDescription())\n local stackMult = math.abs(entry.hit_object.getQuantity())\n -- Use value in description if available\n if descValue ~= nil then\n totalValue = totalValue + descValue * stackMult\n else\n -- Otherwise use the value in validCountItemList\n totalValue = totalValue + validCountItemList[entry.hit_object.getName()] * stackMult\n end\n end\n exposedValue = totalValue\n self.editButton({ index = 0, label = totalValue })\nend\n\nfunction findValidItemsInSphere()\n local items = Physics.cast({\n origin = self.getPosition(),\n direction = { 0, 1, 0 },\n type = 2,\n max_distance = 0,\n size = { 2, 2, 2 },\n --debug=true\n })\n\n retval = {}\n for _, entry in ipairs(items) do\n --Ignore the bowl\n if entry.hit_object ~= self then\n --Ignore if not in validCountItemList\n local tableEntry = validCountItemList[entry.hit_object.getName()]\n if tableEntry ~= nil then\n table.insert(retval, entry)\n end\n end\n end\n return retval\nend\n\nfunction removeAllClues()\n startLuaCoroutine(self, \"clueRemovalCoroutine\")\nend\n\nfunction clueRemovalCoroutine()\n for _, entry in ipairs(findValidItemsInSphere()) do\n -- Do not put the table in the garbage\n if entry.hit_object.getGUID() ~= \"4ee1f2\" then\n -- delay for animation purposes\n for k = 1, 10 do\n coroutine.yield(0)\n end\n getObjectFromGUID(trashGUID).putObject(entry.hit_object)\n end\n end\n return 1\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playermat/ClueCounter\")\nend)\n__bundle_register(\"playermat/ClueCounter\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Table of items which can be counted in this Bowl\n-- Each entry has 2 things to enter\n-- a name (what is in the name field of that object)\n-- a value (how much it is worth)\n-- a number in the items description will override the number entry in this table\nlocal validCountItemList = {\n [\"Clue\"] = 1,\n [\"\"] = 1\n}\nexposedValue = 0\n\nfunction onLoad()\n self.createButton({\n label = \"\",\n click_function = \"countItems\",\n function_owner = self,\n position = { 0, 0.1, 0 },\n height = 0,\n width = 0,\n font_color = { 0, 0, 0 },\n font_size = 2000\n })\n loopID = Wait.time(countItems, 1, -1)\nend\n\n-- Activated once per second, counts items in bowls\nfunction countItems()\n local totalValue = 0\n for _, item in ipairs(findValidItemsInSphere()) do\n local descValue = tonumber(item.getDescription())\n local stackMult = math.abs(item.getQuantity())\n -- Use value in description if available\n if descValue ~= nil then\n totalValue = totalValue + descValue * stackMult\n else\n -- Otherwise use the value in validCountItemList\n totalValue = totalValue + validCountItemList[item.getName()] * stackMult\n end\n end\n exposedValue = totalValue\n self.editButton({ index = 0, label = totalValue })\nend\n\nfunction findValidItemsInSphere()\n local items = Physics.cast({\n origin = self.getPosition(),\n direction = { 0, 1, 0 },\n type = 2,\n max_distance = 0,\n size = { 2, 2, 2 }\n })\n\n local validItemList = {}\n for _, entry in ipairs(items) do\n if entry.hit_object ~= self then\n if validCountItemList[entry.hit_object.getName()] ~= nil then\n table.insert(validItemList, entry.hit_object)\n end\n end\n end\n return validItemList\nend\n\nfunction removeAllClues(trash)\n for _, obj in ipairs(findValidItemsInSphere()) do\n trash.putObject(obj)\n end\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Custom_Model", @@ -18653,7 +18734,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playermat/ClueCounter\")\nend)\n__bundle_register(\"playermat/ClueCounter\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Table of items which can be counted in this Bowl\n-- Each entry has 2 things to enter\n-- a name (what is in the name field of that object)\n-- a value (how much it is worth)\n-- a number in the items description will override the number entry in this table\nlocal validCountItemList = {\n [\"Clue\"] = 1,\n [\"\"] = 1\n}\nlocal trashGUID = \"70b9f6\"\nexposedValue = 0\n\nfunction onLoad()\n self.createButton({\n label = \"\",\n click_function = \"removeAllClues\",\n function_owner = self,\n position = { 0, 0.1, 0 },\n height = 0,\n width = 0,\n font_color = { 0, 0, 0 },\n font_size = 2000\n })\n loopID = Wait.time(countItems, 1, -1)\nend\n\n-- Activated once per second, counts items in bowls\nfunction countItems()\n local totalValue = 0\n local countableItems = findValidItemsInSphere()\n for _, entry in ipairs(countableItems) do\n local descValue = tonumber(entry.hit_object.getDescription())\n local stackMult = math.abs(entry.hit_object.getQuantity())\n -- Use value in description if available\n if descValue ~= nil then\n totalValue = totalValue + descValue * stackMult\n else\n -- Otherwise use the value in validCountItemList\n totalValue = totalValue + validCountItemList[entry.hit_object.getName()] * stackMult\n end\n end\n exposedValue = totalValue\n self.editButton({ index = 0, label = totalValue })\nend\n\nfunction findValidItemsInSphere()\n local items = Physics.cast({\n origin = self.getPosition(),\n direction = { 0, 1, 0 },\n type = 2,\n max_distance = 0,\n size = { 2, 2, 2 },\n --debug=true\n })\n\n retval = {}\n for _, entry in ipairs(items) do\n --Ignore the bowl\n if entry.hit_object ~= self then\n --Ignore if not in validCountItemList\n local tableEntry = validCountItemList[entry.hit_object.getName()]\n if tableEntry ~= nil then\n table.insert(retval, entry)\n end\n end\n end\n return retval\nend\n\nfunction removeAllClues()\n startLuaCoroutine(self, \"clueRemovalCoroutine\")\nend\n\nfunction clueRemovalCoroutine()\n for _, entry in ipairs(findValidItemsInSphere()) do\n -- Do not put the table in the garbage\n if entry.hit_object.getGUID() ~= \"4ee1f2\" then\n -- delay for animation purposes\n for k = 1, 10 do\n coroutine.yield(0)\n end\n getObjectFromGUID(trashGUID).putObject(entry.hit_object)\n end\n end\n return 1\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playermat/ClueCounter\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Table of items which can be counted in this Bowl\n-- Each entry has 2 things to enter\n-- a name (what is in the name field of that object)\n-- a value (how much it is worth)\n-- a number in the items description will override the number entry in this table\nlocal validCountItemList = {\n [\"Clue\"] = 1,\n [\"\"] = 1\n}\nexposedValue = 0\n\nfunction onLoad()\n self.createButton({\n label = \"\",\n click_function = \"countItems\",\n function_owner = self,\n position = { 0, 0.1, 0 },\n height = 0,\n width = 0,\n font_color = { 0, 0, 0 },\n font_size = 2000\n })\n loopID = Wait.time(countItems, 1, -1)\nend\n\n-- Activated once per second, counts items in bowls\nfunction countItems()\n local totalValue = 0\n for _, item in ipairs(findValidItemsInSphere()) do\n local descValue = tonumber(item.getDescription())\n local stackMult = math.abs(item.getQuantity())\n -- Use value in description if available\n if descValue ~= nil then\n totalValue = totalValue + descValue * stackMult\n else\n -- Otherwise use the value in validCountItemList\n totalValue = totalValue + validCountItemList[item.getName()] * stackMult\n end\n end\n exposedValue = totalValue\n self.editButton({ index = 0, label = totalValue })\nend\n\nfunction findValidItemsInSphere()\n local items = Physics.cast({\n origin = self.getPosition(),\n direction = { 0, 1, 0 },\n type = 2,\n max_distance = 0,\n size = { 2, 2, 2 }\n })\n\n local validItemList = {}\n for _, entry in ipairs(items) do\n if entry.hit_object ~= self then\n if validCountItemList[entry.hit_object.getName()] ~= nil then\n table.insert(validItemList, entry.hit_object)\n end\n end\n end\n return validItemList\nend\n\nfunction removeAllClues(trash)\n for _, obj in ipairs(findValidItemsInSphere()) do\n trash.putObject(obj)\n end\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playermat/ClueCounter\")\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Custom_Model", @@ -18719,7 +18800,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playermat/ClueCounter\")\nend)\n__bundle_register(\"playermat/ClueCounter\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Table of items which can be counted in this Bowl\n-- Each entry has 2 things to enter\n-- a name (what is in the name field of that object)\n-- a value (how much it is worth)\n-- a number in the items description will override the number entry in this table\nlocal validCountItemList = {\n [\"Clue\"] = 1,\n [\"\"] = 1\n}\nlocal trashGUID = \"70b9f6\"\nexposedValue = 0\n\nfunction onLoad()\n self.createButton({\n label = \"\",\n click_function = \"removeAllClues\",\n function_owner = self,\n position = { 0, 0.1, 0 },\n height = 0,\n width = 0,\n font_color = { 0, 0, 0 },\n font_size = 2000\n })\n loopID = Wait.time(countItems, 1, -1)\nend\n\n-- Activated once per second, counts items in bowls\nfunction countItems()\n local totalValue = 0\n local countableItems = findValidItemsInSphere()\n for _, entry in ipairs(countableItems) do\n local descValue = tonumber(entry.hit_object.getDescription())\n local stackMult = math.abs(entry.hit_object.getQuantity())\n -- Use value in description if available\n if descValue ~= nil then\n totalValue = totalValue + descValue * stackMult\n else\n -- Otherwise use the value in validCountItemList\n totalValue = totalValue + validCountItemList[entry.hit_object.getName()] * stackMult\n end\n end\n exposedValue = totalValue\n self.editButton({ index = 0, label = totalValue })\nend\n\nfunction findValidItemsInSphere()\n local items = Physics.cast({\n origin = self.getPosition(),\n direction = { 0, 1, 0 },\n type = 2,\n max_distance = 0,\n size = { 2, 2, 2 },\n --debug=true\n })\n\n retval = {}\n for _, entry in ipairs(items) do\n --Ignore the bowl\n if entry.hit_object ~= self then\n --Ignore if not in validCountItemList\n local tableEntry = validCountItemList[entry.hit_object.getName()]\n if tableEntry ~= nil then\n table.insert(retval, entry)\n end\n end\n end\n return retval\nend\n\nfunction removeAllClues()\n startLuaCoroutine(self, \"clueRemovalCoroutine\")\nend\n\nfunction clueRemovalCoroutine()\n for _, entry in ipairs(findValidItemsInSphere()) do\n -- Do not put the table in the garbage\n if entry.hit_object.getGUID() ~= \"4ee1f2\" then\n -- delay for animation purposes\n for k = 1, 10 do\n coroutine.yield(0)\n end\n getObjectFromGUID(trashGUID).putObject(entry.hit_object)\n end\n end\n return 1\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playermat/ClueCounter\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Table of items which can be counted in this Bowl\n-- Each entry has 2 things to enter\n-- a name (what is in the name field of that object)\n-- a value (how much it is worth)\n-- a number in the items description will override the number entry in this table\nlocal validCountItemList = {\n [\"Clue\"] = 1,\n [\"\"] = 1\n}\nexposedValue = 0\n\nfunction onLoad()\n self.createButton({\n label = \"\",\n click_function = \"countItems\",\n function_owner = self,\n position = { 0, 0.1, 0 },\n height = 0,\n width = 0,\n font_color = { 0, 0, 0 },\n font_size = 2000\n })\n loopID = Wait.time(countItems, 1, -1)\nend\n\n-- Activated once per second, counts items in bowls\nfunction countItems()\n local totalValue = 0\n for _, item in ipairs(findValidItemsInSphere()) do\n local descValue = tonumber(item.getDescription())\n local stackMult = math.abs(item.getQuantity())\n -- Use value in description if available\n if descValue ~= nil then\n totalValue = totalValue + descValue * stackMult\n else\n -- Otherwise use the value in validCountItemList\n totalValue = totalValue + validCountItemList[item.getName()] * stackMult\n end\n end\n exposedValue = totalValue\n self.editButton({ index = 0, label = totalValue })\nend\n\nfunction findValidItemsInSphere()\n local items = Physics.cast({\n origin = self.getPosition(),\n direction = { 0, 1, 0 },\n type = 2,\n max_distance = 0,\n size = { 2, 2, 2 }\n })\n\n local validItemList = {}\n for _, entry in ipairs(items) do\n if entry.hit_object ~= self then\n if validCountItemList[entry.hit_object.getName()] ~= nil then\n table.insert(validItemList, entry.hit_object)\n end\n end\n end\n return validItemList\nend\n\nfunction removeAllClues(trash)\n for _, obj in ipairs(findValidItemsInSphere()) do\n trash.putObject(obj)\n end\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playermat/ClueCounter\")\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Custom_Model", @@ -18762,7 +18843,7 @@ }, "ImageScalar": 1, "ImageSecondaryURL": "", - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/1758068501357164917/1D06F1DC4D6888B6F57124BD2AFE20D0B0DA15A8/", + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/784129913444610342/7903BA89870C1656A003FD69C79BFA99BD1AAC24/", "WidthScale": 0 }, "Description": "Click to remove all clues from all investigators", @@ -18776,13 +18857,16 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/MasterClueCounter\")\nend)\n__bundle_register(\"core/MasterClueCounter\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- variables are intentionally global to be accessible\ncount = 0\nuseClickableCounters = false\n\nfunction onSave() return JSON.encode(useClickableCounters) end\n\nfunction onLoad(savedData)\n if savedData ~= nil then\n useClickableCounters = JSON.decode(savedData)\n end\n self.createButton({\n label = \"0\",\n click_function = \"removeAllPlayerClues\",\n tooltip = \"Click here to remove all collected clues\",\n function_owner = self,\n position = { 0, 0.06, 0 },\n height = 900,\n width = 900,\n scale = { 1.5, 1.5, 1.5 },\n font_size = 650,\n font_color = { 0, 0, 0, 100 },\n color = { 0, 0, 0, 0 }\n })\n\n loopID = Wait.time(sumClues, 2, -1)\nend\n\n-- removes all player clues by calling the respective function from the counting bowls / clickers\nfunction removeAllPlayerClues()\n printToAll(count .. \" clue(s) from playermats removed.\", \"White\")\n playmatApi.removeClues(\"All\")\n self.editButton({ index = 0, label = \"0\" })\nend\n\n-- gets the counted values from the counting bowls / clickers and sums them up\nfunction sumClues()\n count = playmatApi.getClueCount(useClickableCounters, \"All\")\n self.editButton({ index = 0, label = tostring(count) })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/MasterClueCounter\")\nend)\n__bundle_register(\"core/MasterClueCounter\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- variables are intentionally global to be accessible\ncount = 0\nuseClickableCounters = false\n\nfunction onSave() return JSON.encode(useClickableCounters) end\n\nfunction onLoad(savedData)\n if savedData ~= nil then\n useClickableCounters = JSON.decode(savedData)\n end\n self.createButton({\n label = \"0\",\n click_function = \"removeAllPlayerClues\",\n tooltip = \"Click here to remove all collected clues\",\n function_owner = self,\n position = { 0, 0.06, 0 },\n height = 900,\n width = 900,\n scale = { 1.5, 1.5, 1.5 },\n font_size = 650,\n font_color = { 1, 1, 1, 100 },\n color = { 0, 0, 0, 0 }\n })\n Wait.time(sumClues, 2, -1)\nend\n\n-- removes all player clues by calling the respective function from the counting bowls / clickers\nfunction removeAllPlayerClues()\n printToAll(count .. \" clue(s) from playermats removed.\", \"White\")\n playmatApi.removeClues(\"All\")\n self.editButton({ index = 0, label = \"0\" })\nend\n\n-- gets the counted values from the counting bowls / clickers and sums them up\nfunction sumClues()\n count = playmatApi.getClueCount(useClickableCounters, \"All\")\n self.editButton({ index = 0, label = tostring(count) })\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "false", "MeasureMovement": false, "Name": "Custom_Token", - "Nickname": "Master Clue Counter\n", + "Nickname": "Master Clue Counter", "Snap": true, "Sticky": true, + "Tags": [ + "CleanUpHelper_ignore" + ], "Tooltip": true, "Transform": { "posX": -5.3, @@ -20064,11 +20148,11 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/token/TokenSpawnTrackerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenSpawnTracker = { }\n local SPAWN_TRACKER_GUID = \"e3ffc9\"\n\n TokenSpawnTracker.hasSpawnedTokens = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"hasSpawnedTokens\", cardGuid)\n end\n\n TokenSpawnTracker.markTokensSpawned = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"markTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetTokensSpawned = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetAllAssetAndEvents = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAllAssetAndEvents\")\n end\n\n TokenSpawnTracker.resetAllLocations = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAllLocations\")\n end\n\n TokenSpawnTracker.resetAll = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAll\")\n end\n\n return TokenSpawnTracker\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/PlayArea\")\nend)\n__bundle_register(\"core/PlayArea\", function(require, _LOADED, __bundle_register, __bundle_modules)\n---------------------------------------------------------\n-- general setup\n---------------------------------------------------------\n\n-- Location connection directional options\nlocal BIDIRECTIONAL = 0\nlocal ONE_WAY = 1\nlocal INCOMING_ONE_WAY = 2\n\n-- Connector draw parameters\nlocal CONNECTION_THICKNESS = 0.015\nlocal DRAGGING_CONNECTION_THICKNESS = 0.15\nlocal DRAGGING_CONNECTION_COLOR = { 0.8, 0.8, 0.8, 1 }\nlocal CONNECTION_COLOR = { 0.4, 0.4, 0.4, 1 }\nlocal DIRECTIONAL_ARROW_DISTANCE = 3.5\nlocal ARROW_ARM_LENGTH = 0.9\nlocal ARROW_ANGLE = 25\n\n-- Height to draw the connector lines, places them just above the table and always below cards\nlocal CONNECTION_LINE_Y = 1.529\n\n-- we use this to turn off collision handling until onLoad() is complete\nlocal collisionEnabled = false\n\n-- used for recreating the link to a custom data helper after image change\ncustomDataHelper = nil\n\nlocal DEFAULT_URL = \"http://cloud-3.steamusercontent.com/ugc/998015670465071049/FFAE162920D67CF38045EFBD3B85AD0F916147B2/\"\n\nlocal SHIFT_OFFSETS = {\n left = { x = 0.00, y = 0, z = 7.67 },\n right = { x = 0.00, y = 0, z = -7.67 },\n up = { x = 6.54, y = 0, z = 0.00 },\n down = { x = -6.54, y = 0, z = 0.00 }\n}\nlocal SHIFT_EXCLUSION = {\n [\"b7b45b\"] = true,\n [\"f182ee\"] = true,\n [\"721ba2\"] = true\n}\nlocal LOC_LINK_EXCLUDE_SCENARIOS = {\n [\"The Witching Hour\"] = true,\n [\"The Heart of Madness\"] = true\n}\n\nlocal tokenManager = require(\"core/token/TokenManager\")\nlocal INVESTIGATOR_COUNTER_GUID = \"f182ee\"\nlocal PLAY_AREA_ZONE_GUID = \"a2f932\"\n\nlocal clueData = {}\nlocal spawnedLocationGUIDs = {}\nlocal locations = {}\nlocal locationConnections = {}\nlocal draggingGuids = {}\nlocal locationData\nlocal currentScenario\n\nlocal missingData = {}\nlocal countedVP = {}\n\n---------------------------------------------------------\n-- general code\n---------------------------------------------------------\n\nfunction onSave()\n return JSON.encode({\n trackedLocations = locations,\n currentScenario = currentScenario,\n })\nend\n\nfunction onLoad(saveState)\n -- records locations we have spawned clues for\n local save = JSON.decode(saveState) or { }\n locations = save.trackedLocations or { }\n currentScenario = save.currentScenario\n\n self.interactable = false\n Wait.time(function() collisionEnabled = true end, 1)\nend\n\n-- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n-- data to the local token manager instance.\n---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\nfunction updateLocations(args)\n customDataHelper = getObjectFromGUID(args[1])\n if customDataHelper ~= nil then\n tokenManager.addLocationData(customDataHelper.getTable(\"LOCATIONS_DATA\"))\n end\nend\n\nfunction updateSurface(newURL)\n local customInfo = self.getCustomObject()\n\n if newURL ~= \"\" and newURL ~= nil and newURL ~= DEFAULT_URL then\n customInfo.image = newURL\n broadcastToAll(\"New Playmat Image Applied\", { 0.2, 0.9, 0.2 })\n else\n customInfo.image = DEFAULT_URL\n broadcastToAll(\"Default Playmat Image Applied\", { 0.2, 0.9, 0.2 })\n end\n \n self.setCustomObject(customInfo)\n\n local guid = nil\n\n if customDataHelper then guid = customDataHelper.getGUID() end\n self.reload()\n\n if guid ~= nil then\n Wait.time(function() updateLocations({ guid }) end, 1)\n end\nend\n\nfunction onCollisionEnter(collisionInfo)\n local obj = collisionInfo.collision_object\n local objType = obj.name\n\n -- only continue for cards\n if not collisionEnabled or (objType ~= \"Card\" and objType ~= \"CardCustom\") then\n if objType == \"Deck\" then\n table.insert(missingData, obj)\n end\n return\n end\n\n -- check if we should spawn clues here and do so according to playercount\n local card = collisionInfo.collision_object\n if shouldSpawnTokens(card) then\n tokenManager.spawnForCard(card)\n end\n -- If this card was being dragged, clear the dragging connections. A multi-drag/drop may send\n -- the dropped card immediately into a deck, so this has to be done here\n if draggingGuids[card.getGUID()] ~= nil then\n card.setVectorLines(nil)\n draggingGuids[card.getGUID()] = nil\n end\n maybeTrackLocation(card)\nend\n\nfunction shouldSpawnTokens(card)\n local metadata = JSON.decode(card.getGMNotes())\n if metadata == nil then\n return tokenManager.hasLocationData(card)\n end\n return metadata.type == \"Location\"\n or metadata.type == \"Enemy\"\n or metadata.type == \"Treachery\"\n or metadata.weakness\nend\n\nfunction onCollisionExit(collisionInfo)\n maybeUntrackLocation(collisionInfo.collision_object)\nend\n\n-- Destroyed objects don't trigger onCollisionExit(), so check on destruction to untrack as well\nfunction onObjectDestroy(object)\n maybeUntrackLocation(object)\nend\n\nfunction onObjectPickUp(player, object)\n -- only continue for cards\n local objType = object.name\n if objType ~= \"Card\" and objType ~= \"CardCustom\" then return end\n\n -- onCollisionExit USUALLY fires first, so we have to check the card to see if it's a location we\n -- should be tracking\n if showLocationLinks() and isInPlayArea(object) and object.getGMNotes() ~= nil and object.getGMNotes() ~= \"\" then\n local pickedUpGuid = object.getGUID()\n local metadata = JSON.decode(object.getGMNotes()) or { }\n if metadata.type == \"Location\" then\n -- onCollisionExit sometimes comes 1 frame after onObjectPickUp (rather than before it or in\n -- the same frame). This causes a mismatch in the data between dragging the on-table, and\n -- that one frame draws connectors on the card which then show up as shadows for snap points.\n -- Waiting ensures we always do thing in the expected Exit-\u003ePickUp order\n Wait.frames(function()\n if object.is_face_down then\n draggingGuids[pickedUpGuid] = metadata.locationBack\n else\n draggingGuids[pickedUpGuid] = metadata.locationFront\n end\n rebuildConnectionList()\n end, 2)\n end\n end\nend\n\nfunction onUpdate()\n -- Due to the frequence of onUpdate calls, ensure that we only process any changes to the\n -- connection list once, and only redraw once\n local needsConnectionRebuild = false\n local needsConnectionDraw = false\n for guid, _ in pairs(draggingGuids) do\n local obj = getObjectFromGUID(guid)\n if obj == nil or not isInPlayArea(obj) then\n draggingGuids[guid] = nil\n needsConnectionRebuild = true\n -- If object still exists then it's been dragged outside the area and needs to clear the\n -- lines attached to it\n if obj ~= nil then\n obj.setVectorLines(nil)\n end\n end\n -- Even if the last location left the play area, need one last draw to clear the lines\n needsConnectionDraw = true\n end\n if (needsConnectionRebuild) then\n rebuildConnectionList()\n end\n if needsConnectionDraw then\n drawDraggingConnections()\n end\nend\n\n-- Checks the given card and adds it to the list of locations tracked for connection purposes.\n-- A card will be added to the tracking if it is a location in the play area (based on centerpoint).\n---@param card Object A card object, possibly a location.\nfunction maybeTrackLocation(card)\n -- Collision checks for any part of the card overlap, but our other tracking is centerpoint\n -- Ignore any collision where the centerpoint isn't in the area\n if isInPlayArea(card) then\n local metadata = JSON.decode(card.getGMNotes())\n if metadata == nil then\n table.insert(missingData, card)\n else\n if metadata.type == \"Location\" then\n if card.is_face_down then\n locations[card.getGUID()] = metadata.locationBack\n else\n locations[card.getGUID()] = metadata.locationFront\n end\n\n -- only draw connection lines for not-excluded scenarios\n if showLocationLinks() then\n rebuildConnectionList()\n drawBaseConnections()\n end\n end\n end\n end\nend\n\n-- Stop tracking a location for connection drawing. This should be called for both collision exit\n-- and destruction, as a destroyed object does not trigger collision exit. An object can also be\n-- deleted mid-drag, but the ordering for drag events means we can't clear those here and those will\n-- be cleared in the next onUpdate() cycle.\n---@param card Object Card to (maybe) stop tracking\nfunction maybeUntrackLocation(card)\n -- Locked objects no longer collide (hence triggering an exit event) but are still in the play\n -- area. If the object is now locked, don't remove it.\n if locations[card.getGUID()] ~= nil and not card.locked then\n locations[card.getGUID()] = nil\n rebuildConnectionList()\n drawBaseConnections()\n end\nend\n\n-- Global event handler, delegated from Global. Clears any connection lines from dragged cards\n-- before they are destroyed by entering a deck. Removal of the card from the dragging list will\n-- be handled during the next onUpdate() call.\nfunction tryObjectEnterContainer(params)\n for draggedGuid, _ in pairs(draggingGuids) do\n local draggedObj = getObjectFromGUID(draggedGuid)\n if draggedObj ~= nil then\n draggedObj.setVectorLines(nil)\n end\n end\nend\n\n-- Builds a list of GUID to GUID connection information based on the currently tracked locations.\n-- This will update the connection information and store it in the locationConnections data member,\n-- but does not draw those connections. This should often be followed by a call to\n-- drawBaseConnections()\nfunction rebuildConnectionList()\n if not showLocationLinks() then\n locationConnections = { }\n return\n end\n\n local iconCardList = { }\n\n -- Build a list of cards with each icon as their location ID\n for cardId, metadata in pairs(draggingGuids) do\n buildLocListByIcon(cardId, iconCardList, metadata)\n end\n for cardId, metadata in pairs(locations) do\n buildLocListByIcon(cardId, iconCardList, metadata)\n end\n\n -- Pair up all the icons\n locationConnections = { }\n for cardId, metadata in pairs(draggingGuids) do\n buildConnection(cardId, iconCardList, metadata)\n end\n for cardId, metadata in pairs(locations) do\n if draggingGuids[cardId] == nil then\n buildConnection(cardId, iconCardList, metadata)\n end\n end\nend\n\n-- Extracts the card's icon string into a list of individual location icons\n---@param cardID String GUID of the card to pull the icon data from\n---@param iconCardList Table A table of icon-\u003eGUID list. Mutable, will be updated by this method\n---@param locData Table A table containing the metadata for the card (for the correct side)\nfunction buildLocListByIcon(cardId, iconCardList, locData)\n if locData ~= nil and locData.icons ~= nil then\n for icon in string.gmatch(locData.icons, \"%a+\") do\n if iconCardList[icon] == nil then\n iconCardList[icon] = { }\n end\n table.insert(iconCardList[icon], cardId)\n end\n end\nend\n\n-- Builds the connections for the given cardID by finding matching icons and adding them to the\n-- Playarea's locationConnections table.\n---@param cardId String GUID of the card to build the connections for\n---@param iconCardList Table A table of icon-\u003eGUID List. Used to find matching icons for connections.\n---@param locData Table A table containing the metadata for the card (for the correct side)\nfunction buildConnection(cardId, iconCardList, locData)\n if locData ~= nil and locData.connections ~= nil then\n locationConnections[cardId] = { }\n for icon in string.gmatch(locData.connections, \"%a+\") do\n if iconCardList[icon] ~= nil then\n for _, connectedGuid in ipairs(iconCardList[icon]) do\n -- If the reciprocal exists, convert it to BiDi, otherwise add as a one-way\n if locationConnections[connectedGuid] ~= nil\n and (locationConnections[connectedGuid][cardId] == ONE_WAY\n or locationConnections[connectedGuid][cardId] == BIDIRECTIONAL) then\n locationConnections[connectedGuid][cardId] = BIDIRECTIONAL\n locationConnections[cardId][connectedGuid] = nil\n else\n if locationConnections[connectedGuid] == nil then\n locationConnections[connectedGuid] = { }\n end\n locationConnections[cardId][connectedGuid] = ONE_WAY\n locationConnections[connectedGuid][cardId] = INCOMING_ONE_WAY\n end\n end\n end\n end\n end\nend\n\n-- Draws the lines for connections currently in locationConnections but not in draggingGuids.\n-- Constructed vectors will be set to the playmat\nfunction drawBaseConnections()\n if not showLocationLinks() then\n locationConnections = { }\n return\n end\n local cardConnectionLines = { }\n\n for originGuid, targetGuids in pairs(locationConnections) do\n -- Objects should reliably exist at this point, but since this can be called during onUpdate the\n -- object checks are conservative just to make sure.\n local origin = getObjectFromGUID(originGuid)\n if draggingGuids[originGuid] == nil and origin != nil then\n for targetGuid, direction in pairs(targetGuids) do\n local target = getObjectFromGUID(targetGuid)\n if draggingGuids[targetGuid] == nil and target != nil then\n -- Since we process the full list, we're guaranteed to hit any ONE_WAY connections later\n -- so we can ignore INCOMING_ONE_WAY\n if direction == BIDIRECTIONAL then\n addBidirectionalVector(origin, target, self, cardConnectionLines)\n elseif direction == ONE_WAY then\n addOneWayVector(origin, target, self, cardConnectionLines)\n end\n end\n end\n end\n end\n self.setVectorLines(cardConnectionLines)\nend\n\n-- Draws the lines for cards which are currently being dragged.\nfunction drawDraggingConnections()\n if not showLocationLinks() then\n return\n end\n local cardConnectionLines = { }\n local ownedVectors = { }\n\n for originGuid, _ in pairs(draggingGuids) do\n targetGuids = locationConnections[originGuid]\n -- Objects should reliably exist at this point, but since this can be called during onUpdate the\n -- object checks are conservative just to make sure.\n local origin = getObjectFromGUID(originGuid)\n if draggingGuids[originGuid] and origin ~= nil and targetGuids ~= nil then\n ownedVectors[originGuid] = { }\n for targetGuid, direction in pairs(targetGuids) do\n local target = getObjectFromGUID(targetGuid)\n if target != nil then\n if direction == BIDIRECTIONAL then\n addBidirectionalVector(origin, target, origin, ownedVectors[originGuid])\n elseif direction == ONE_WAY then\n addOneWayVector(origin, target, origin, ownedVectors[originGuid])\n elseif direction == INCOMING_ONE_WAY and not draggingGuids[targetGuid] then\n addOneWayVector(target, origin, origin, ownedVectors[originGuid])\n end\n end\n end\n end\n end\n for ownerGuid, vectors in pairs(ownedVectors) do\n local card = getObjectFromGUID(ownerGuid)\n card.setVectorLines(vectors)\n end\nend\n\n-- Draws a bidirectional location connection between the two cards, adding the lines to do so to the\n-- given lines list.\n---@param card1 Object One of the card objects to connect\n---@param card2 Object The other card object to connect\n---@param vectorOwner Object The object which these lines will be set to. Used for relative\n--- positioning and scaling, as well as highlighting connections during a drag operation\n---@param lines Table List of vector line elements. Mutable, will be updated to add this connector\nfunction addBidirectionalVector(card1, card2, vectorOwner, lines)\n local cardPos1 = card1.getPosition()\n local cardPos2 = card2.getPosition()\n cardPos1.y = CONNECTION_LINE_Y\n cardPos2.y = CONNECTION_LINE_Y\n\n local pos1 = vectorOwner.positionToLocal(cardPos1)\n local pos2 = vectorOwner.positionToLocal(cardPos2)\n\n table.insert(lines, {\n points = { pos1, pos2 },\n color = vectorOwner == self and CONNECTION_COLOR or DRAGGING_CONNECTION_COLOR,\n thickness = vectorOwner == self and CONNECTION_THICKNESS or DRAGGING_CONNECTION_THICKNESS,\n })\nend\n\n-- Draws a one-way location connection between the two cards, adding the lines to do so to the\n-- given lines list. Arrows will point towards the target card.\n---@param origin Object Origin card in the connection\n---@param target Object Target card object to connect\n---@param vectorOwner Object The object which these lines will be set to. Used for relative\n--- positioning and scaling, as well as highlighting connections during a drag operation\n---@param lines Table List of vector line elements. Mutable, will be updated to add this connector\nfunction addOneWayVector(origin, target, vectorOwner, lines)\n -- Start with the BiDi then add the arrow lines to it\n addBidirectionalVector(origin, target, vectorOwner, lines)\n local originPos = origin.getPosition()\n local targetPos = target.getPosition()\n originPos.y = CONNECTION_LINE_Y\n targetPos.y = CONNECTION_LINE_Y\n\n -- Calculate card distance to be closer for horizontal positions than vertical, since cards are\n -- taller than they are wide\n local heading = Vector(originPos):sub(targetPos):heading(\"y\")\n local distanceFromCard = DIRECTIONAL_ARROW_DISTANCE * 0.7 + DIRECTIONAL_ARROW_DISTANCE * 0.3 * math.abs(math.sin(math.rad(heading)))\n\n -- Calculate the three possible arrow positions. These are offset by half the arrow length to\n -- make them visually balanced by keeping the arrows centered, not tracking the point\n local midpoint = Vector(originPos):add(targetPos):scale(Vector(0.5, 0.5, 0.5)):moveTowards(targetPos, ARROW_ARM_LENGTH / 2)\n local closeToOrigin = Vector(originPos):moveTowards(targetPos, distanceFromCard + ARROW_ARM_LENGTH / 2)\n local closeToTarget = Vector(targetPos):moveTowards(originPos, distanceFromCard - ARROW_ARM_LENGTH / 2)\n\n if (originPos:distance(closeToOrigin) \u003e originPos:distance(closeToTarget)) then\n addArrowLines(midpoint, originPos, vectorOwner, lines)\n else\n addArrowLines(closeToOrigin, originPos, vectorOwner, lines)\n addArrowLines(closeToTarget, originPos, vectorOwner, lines)\n end\nend\n\n-- Draws an arrowhead at the given position.\n---@param arrowheadPosition Table Centerpoint of the arrowhead to draw (NOT the tip of the arrow)\n---@param originPos Table Origin point of the connection, used to position the arrow arms\n---@param vectorOwner Object The object which these lines will be set to. Used for relative\n--- positioning and scaling, as well as highlighting connections during a drag operation\n---@param lines Table List of vector line elements. Mutable, will be updated to add this arrow\nfunction addArrowLines(arrowheadPos, originPos, vectorOwner, lines)\n local arrowArm1 = Vector(arrowheadPos):moveTowards(originPos, ARROW_ARM_LENGTH):sub(arrowheadPos):rotateOver(\"y\", -1 * ARROW_ANGLE):add(arrowheadPos)\n local arrowArm2 = Vector(arrowheadPos):moveTowards(originPos, ARROW_ARM_LENGTH):sub(arrowheadPos):rotateOver(\"y\", ARROW_ANGLE):add(arrowheadPos)\n\n local head = vectorOwner.positionToLocal(arrowheadPos)\n local arm1 = vectorOwner.positionToLocal(arrowArm1)\n local arm2 = vectorOwner.positionToLocal(arrowArm2)\n table.insert(lines, {\n points = { arm1, head, arm2},\n color = vectorOwner == self and CONNECTION_COLOR or DRAGGING_CONNECTION_COLOR,\n thickness = vectorOwner == self and CONNECTION_THICKNESS or DRAGGING_CONNECTION_THICKNESS,\n })\nend\n\n-- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n-- fixed objects will be ignored, as will anything the player has tagged with 'displacement_excluded'\n---@param playerColor String Color of the player requesting the shift. Used solely to send an error\n--- message in the unlikely case that the scripting zone has been deleted\nfunction shiftContentsUp(playerColor)\n shiftContents(playerColor, \"up\")\nend\n\nfunction shiftContentsDown(playerColor)\n shiftContents(playerColor, \"down\")\nend\n\nfunction shiftContentsLeft(playerColor)\n shiftContents(playerColor, \"left\")\nend\n\nfunction shiftContentsRight(playerColor)\n shiftContents(playerColor, \"right\")\nend\n\nfunction shiftContents(playerColor, direction)\n local zone = getObjectFromGUID(PLAY_AREA_ZONE_GUID)\n if not zone then\n broadcastToColor(\"Scripting zone couldn't be found.\", playerColor, \"Red\")\n return\n end\n\n for _, object in ipairs(zone.getObjects()) do\n if not (SHIFT_EXCLUSION[object.getGUID()] or object.hasTag(\"displacement_excluded\")) then\n object.translate(SHIFT_OFFSETS[direction])\n end\n end\n Wait.time(drawBaseConnections, 0.1)\nend\n\n-- Check to see if the given object is within the bounds of the play area, based solely on the X and\n-- Z coordinates, ignoring height\n---@param object Object Object to check\n---@return. True if the object is inside the play area\nfunction isInPlayArea(object)\n local bounds = self.getBounds()\n local position = object.getPosition()\n -- Corners are arbitrary since it's all global - c1 goes down both axes, c2 goes up\n local c1 = { x = bounds.center.x - bounds.size.x / 2, z = bounds.center.z - bounds.size.z / 2}\n local c2 = { x = bounds.center.x + bounds.size.x / 2, z = bounds.center.z + bounds.size.z / 2}\n\n return position.x \u003e c1.x and position.x \u003c c2.x and position.z \u003e c1.z and position.z \u003c c2.z\nend\n\n-- Reset the play area's tracking of which cards have had tokens spawned.\nfunction resetSpawnedCards()\n spawnedLocationGUIDs = {}\nend\n\nfunction onScenarioChanged(scenarioName)\n currentScenario = scenarioName\n if not showLocationLinks() then\n broadcastToAll(\"Automatic location connections not available for this scenario\")\n end\nend\n\nfunction showLocationLinks()\n return not LOC_LINK_EXCLUDE_SCENARIOS[currentScenario]\nend\n\n-- Sets this playmat's snap points to limit snapping to locations or not.\n-- If matchTypes is false, snap points will be reset to snap all cards.\n---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\nfunction setLimitSnapsByType(matchTypes)\n local snaps = self.getSnapPoints()\n for i, snap in ipairs(snaps) do\n local snapTags = snaps[i].tags\n if matchTypes then\n if snapTags == nil then\n snaps[i].tags = { \"Location\" }\n else\n table.insert(snaps[i].tags, \"Location\")\n end\n else\n snaps[i].tags = nil\n end\n end\n self.setSnapPoints(snaps)\nend\n\n-- count victory points on locations in play area\n---@return. Returns the total amount of VP found in the play area\nfunction countVP()\n local totalVP = 0\n\n for cardId, metadata in pairs(locations) do\n if metadata ~= nil then\n local cardVP = tonumber(metadata.victory) or 0\n if cardVP ~= 0 and not cardHasClues(cardId) then\n totalVP = totalVP + cardVP\n if cardVP \u003e0 then\n table.insert(countedVP, getObjectFromGUID(cardId))\n end\n end\n end\n end\n\n return totalVP\nend\n\n-- checks if a card has clues on it, returns true if clues are on it\n---@param cardId String GUID of the card to check for clues\nfunction cardHasClues(cardId)\n local card = getObjectFromGUID(cardId)\n for _, v in ipairs(searchOnObj(card)) do\n local obj = v.hit_object\n if obj.memo == \"clueDoom\" and obj.is_face_down == false then\n return true\n end\n end\n return false\nend\n\n-- searches on an object (by using its bounds)\n---@param obj Object Object to search on\nfunction searchOnObj(obj)\n return Physics.cast({\n direction = { 0, 1, 0 },\n max_distance = 0.5,\n type = 3,\n size = obj.getBounds().size,\n origin = obj.getPosition()\n })\nend\n\n-- highlights all locations in the play area without metadata\n---@param state Boolean True if highlighting should be enabled\nfunction highlightMissingData(state)\n for i, obj in pairs(missingData) do\n if obj ~= nil then\n if state then\n obj.highlightOff(\"Red\")\n else\n obj.highlightOn(\"Red\")\n end\n else\n missingData[i] = nil\n end\n end\nend\n\n-- highlights all locations in the play area with VP\n---@param state Boolean True if highlighting should be enabled\nfunction highlightCountedVP(state)\n for i, obj in pairs(countedVP) do\n if obj ~= nil then\n if state then\n obj.highlightOff(\"Green\")\n else\n obj.highlightOn(\"Green\")\n end\n else\n countedVP[i] = nil\n end\n end\nend\n\n-- rebuilds local snap points (could be useful in the future again)\nfunction buildSnaps()\n local upperleft = { x = 1.53, z = -1.09}\n local lowerright = {x = -1.53, z = 1.55}\n local snaps = {}\n\n -- creates 81 snap points, for uneven rows + columns it makes a rotation snap point\n for i = 1, 9 do\n for j = 1, 9 do\n local snap = {}\n snap.position = {}\n snap.position.x = round(upperleft.x - (upperleft.x - lowerright.x) * (i - 1) / 8, 3)\n snap.position.y = 0.1\n snap.position.z = round(upperleft.z - (upperleft.z - lowerright.z) * (j - 1) / 8, 3)\n\n -- enable rotation snaps for uneven rows / columns\n if (i % 2 ~= 0) and (j % 2 ~= 0) then\n snap.rotation = {0, 0, 0}\n snap.rotation_snap = true\n end\n\n table.insert(snaps, snap)\n end\n end\n self.setSnapPoints(snaps)\nend\n\n-- utility function\nfunction round(num, numDecimalPlaces)\n local mult = 10^(numDecimalPlaces or 0)\n return math.floor(num * mult + 0.5) / mult\nend\nend)\n__bundle_register(\"core/token/TokenManager\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local optionPanelApi = require(\"core/OptionPanelApi\")\n local playAreaApi = require(\"core/PlayAreaApi\")\n local tokenSpawnTrackerApi = require(\"core/token/TokenSpawnTrackerApi\")\n\n local PLAYER_CARD_TOKEN_OFFSETS = {\n [1] = {\n Vector(0, 3, -0.2)\n },\n [2] = {\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [3] = {\n Vector(0, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [4] = {\n Vector(0.4, 3, -0.9),\n Vector(-0.4, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [5] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [6] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2)\n },\n [7] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0, 3, 0.5)\n },\n [8] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(-0.35, 3, 0.5),\n Vector(0.35, 3, 0.5)\n },\n [9] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5)\n },\n [10] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0, 3, 1.2)\n },\n [11] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(-0.35, 3, 1.2),\n Vector(0.35, 3, 1.2)\n },\n [12] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0.7, 3, 1.2),\n Vector(0, 3, 1.2),\n Vector(-0.7, 3, 1.2)\n }\n }\n\n -- stateIDs for the multi-stated resource tokens\n local stateTable = {\n [\"resource\"] = 1,\n [\"ammo\"] = 2,\n [\"bounty\"] = 3,\n [\"charge\"] = 4,\n [\"evidence\"] = 5,\n [\"secret\"] = 6,\n [\"supply\"] = 7\n }\n\n -- Source for tokens\n local TOKEN_SOURCE_GUID = \"124381\"\n\n -- Table of data extracted from the token source bag, keyed by the Memo on each token which\n -- should match the token type keys (\"resource\", \"clue\", etc)\n local tokenTemplates\n\n local DATA_HELPER_GUID = \"708279\"\n\n local playerCardData\n local locationData\n\n local TokenManager = { }\n local internal = { }\n\n -- Spawns tokens for the card. This function is built to just throw a card at it and let it do\n -- the work once a card has hit an area where it might spawn tokens. It will check to see if\n -- the card has already spawned, find appropriate data from either the uses metadata or the Data\n -- Helper, and spawn the tokens.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n TokenManager.spawnForCard = function(card, extraUses)\n if tokenSpawnTrackerApi.hasSpawnedTokens(card.getGUID()) then\n return\n end\n local metadata = JSON.decode(card.getGMNotes())\n if metadata ~= nil then\n internal.spawnTokensFromUses(card, extraUses)\n else\n internal.spawnTokensFromDataHelper(card)\n end\n end\n\n -- Spawns a set of tokens on the given card.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String Type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param tokenCount Number How many tokens to spawn. For damage or horror this value will be set to the\n -- spawned state object rather than spawning multiple tokens\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnTokenGroup = function(card, tokenType, tokenCount, shiftDown, subType)\n local optionPanel = optionPanelApi.getOptions()\n\n if tokenType == \"damage\" or tokenType == \"horror\" then\n TokenManager.spawnCounterToken(card, tokenType, tokenCount, shiftDown)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"enabled\" then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"custom\" and tokenCount == 0 then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n else\n TokenManager.spawnMultipleTokens(card, tokenType, tokenCount, shiftDown, subType)\n end\n end\n\n -- Spawns a single counter token and sets the value to tokenValue. Used for damage and horror\n -- tokens.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String type of token to spawn, valid values are \"damage\" and \"horror\". Other\n -- types should use spawnMultipleTokens()\n ---@param tokenValue Number Value to set the damage/horror to\n TokenManager.spawnCounterToken = function(card, tokenType, tokenValue, shiftDown)\n if tokenValue \u003c 1 or tokenValue \u003e 50 then return end\n\n local pos = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[1][1] + Vector(0, 0, shiftDown))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, tokenType, rot, function(spawned) spawned.setState(tokenValue) end)\n end\n\n TokenManager.spawnResourceCounterToken = function(card, tokenCount)\n local pos = card.positionToWorld(card.positionToLocal(card.getPosition()) + Vector(0, 0.2, -0.5))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, \"resourceCounter\", rot, function(spawned)\n spawned.call(\"updateVal\", tokenCount)\n end)\n end\n\n -- Spawns a number of tokens.\n ---@param tokenType String type of token to spawn, valid values are resource\", \"doom\", or \"clue\".\n -- Other types should use spawnCounterToken()\n ---@param tokenCount Number How many tokens to spawn\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnMultipleTokens = function(card, tokenType, tokenCount, shiftDown, subType)\n -- not checking the max at this point since clue offsets are calculated dynamically\n if tokenCount \u003c 1 then return end\n\n local offsets = {}\n if tokenType == \"clue\" then\n offsets = internal.buildClueOffsets(card, tokenCount)\n else\n -- only up to 12 offset tables defined\n if tokenCount \u003e 12 then return end\n for i = 1, tokenCount do\n offsets[i] = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[tokenCount][i])\n -- Fix the y-position for the spawn, since positionToWorld considers rotation which can\n -- have bad results for face up/down differences\n offsets[i].y = card.getPosition().y + 0.15\n end\n end\n\n if shiftDown ~= nil then\n -- Copy the offsets to make sure we don't change the static values\n local baseOffsets = offsets\n offsets = { }\n for i, baseOffset in ipairs(baseOffsets) do\n offsets[i] = baseOffset\n offsets[i][3] = offsets[i][3] + shiftDown\n end\n end\n\n if offsets == nil then\n error(\"couldn't find offsets for \" .. tokenCount .. ' tokens')\n return\n end\n\n -- handling for not provided subtype (for example when spawning from custom data helpers)\n if subType == nil then\n subType = \"\"\n end\n \n -- this is used to load the correct state for additional resource tokens (e.g. \"Ammo\")\n local callback = nil\n local stateID = stateTable[string.lower(subType)]\n if tokenType == \"resource\" and stateID ~= nil and stateID ~= 1 then\n callback = function(spawned) spawned.setState(stateID) end\n end\n\n for i = 1, tokenCount do\n TokenManager.spawnToken(offsets[i], tokenType, card.getRotation(), callback)\n end\n end\n\n -- Spawns a single token at the given global position by copying it from the template bag.\n ---@param position Global position to spawn the token\n ---@param tokenType String type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param rotation Vector Rotation to be used for the new token. Only the y-value will be used,\n -- x and z will use the default rotation from the source bag\n ---@param callback function A callback function triggered after the new token is spawned\n TokenManager.spawnToken = function(position, tokenType, rotation, callback)\n internal.initTokenTemplates()\n local loadTokenType = tokenType\n if tokenType == \"clue\" or tokenType == \"doom\" then\n loadTokenType = \"clueDoom\"\n end\n if tokenTemplates[loadTokenType] == nil then\n error(\"Unknown token type '\" .. tokenType .. \"'\")\n return\n end\n local tokenTemplate = tokenTemplates[loadTokenType]\n\n -- Take ONLY the Y-value for rotation, so we don't flip the token coming out of the bag\n local rot = Vector(tokenTemplate.Transform.rotX,\n 270,\n tokenTemplate.Transform.rotZ)\n if rotation ~= nil then\n rot.y = rotation.y\n end\n if tokenType == \"doom\" then\n rot.z = 180\n end\n\n tokenTemplate.Nickname = \"\"\n return spawnObjectData({\n data = tokenTemplate,\n position = position,\n rotation = rot,\n callback_function = callback\n })\n end\n\n -- Checks a card for metadata to maybe replenish it\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n TokenManager.maybeReplenishCard = function(card, uses, mat)\n -- TODO: support for cards with multiple uses AND replenish (as of yet, no official card needs that)\n if uses[1].count and uses[1].replenish then\n internal.replenishTokens(card, uses, mat)\n end\n end\n\n -- Delegate function to the token spawn tracker. Exists to avoid circular dependencies in some\n -- callers.\n ---@param card Object Card object to reset the tokens for\n TokenManager.resetTokensSpawned = function(card)\n tokenSpawnTrackerApi.resetTokensSpawned(card.getGUID())\n end\n\n -- Pushes new player card data into the local copy of the Data Helper player data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addPlayerCardData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n playerCardData[k] = v\n end\n end\n\n -- Pushes new location data into the local copy of the Data Helper location data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addLocationData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n locationData[k] = v\n end\n end\n\n -- Checks to see if the given card has location data in the DataHelper\n ---@param card Object Card to check for data\n ---@return Boolean True if this card has data in the helper, false otherwise\n TokenManager.hasLocationData = function(card)\n internal.initDataHelperData()\n return internal.getLocationData(card) ~= nil\n end\n\n internal.initTokenTemplates = function()\n if tokenTemplates ~= nil then\n return\n end\n tokenTemplates = { }\n local tokenSource = getObjectFromGUID(TOKEN_SOURCE_GUID)\n for _, tokenTemplate in ipairs(tokenSource.getData().ContainedObjects) do\n local tokenName = tokenTemplate.Memo\n tokenTemplates[tokenName] = tokenTemplate\n end\n end\n\n -- Copies the data from the DataHelper. Will only happen once.\n internal.initDataHelperData = function()\n if playerCardData ~= nil then\n return\n end\n local dataHelper = getObjectFromGUID(DATA_HELPER_GUID)\n playerCardData = dataHelper.getTable('PLAYER_CARD_DATA')\n locationData = dataHelper.getTable('LOCATIONS_DATA')\n end\n\n -- Spawn tokens for a card based on the uses metadata. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n internal.spawnTokensFromUses = function(card, extraUses)\n local uses = internal.getUses(card)\n if uses == nil then return end\n\n -- go through tokens to spawn\n local type, token, tokenCount\n for i, useInfo in ipairs(uses) do\n type = useInfo.type\n token = useInfo.token\n tokenCount = (useInfo.count or 0)\n + (useInfo.countPerInvestigator or 0) * playAreaApi.getInvestigatorCount()\n if extraUses ~= nil and extraUses[type] ~= nil then\n tokenCount = tokenCount + extraUses[type]\n end\n -- Shift each spawned group after the first down so they don't pile on each other\n TokenManager.spawnTokenGroup(card, token, tokenCount, (i - 1) * 0.8, type)\n end\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a card based on the data helper data. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n internal.spawnTokensFromDataHelper = function(card)\n internal.initDataHelperData()\n local playerData = internal.getPlayerCardData(card)\n if playerData ~= nil then\n internal.spawnPlayerCardTokensFromDataHelper(card, playerData)\n end\n local locationData = internal.getLocationData(card)\n if locationData ~= nil then\n internal.spawnLocationTokensFromDataHelper(card, locationData)\n end\n end\n\n -- Spawn tokens for a player card using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Player card data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnPlayerCardTokensFromDataHelper = function(card, playerData)\n token = playerData.tokenType\n tokenCount = playerData.tokenCount\n --log(\"Spawning data helper tokens for \"..card.getName()..'['..card.getDescription()..']: '..tokenCount..\"x \"..token)\n TokenManager.spawnTokenGroup(card, token, tokenCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a location using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Location data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnLocationTokensFromDataHelper = function(card, locationData)\n local clueCount = internal.getClueCountFromData(card, locationData)\n if clueCount \u003e 0 then\n TokenManager.spawnTokenGroup(card, \"clue\", clueCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n end\n\n internal.getPlayerCardData = function(card)\n return playerCardData[card.getName() .. ':' .. card.getDescription()]\n or playerCardData[card.getName()]\n end\n\n internal.getLocationData = function(card)\n return locationData[card.getName() .. '_' .. card.getGUID()] or locationData[card.getName()]\n end\n\n internal.getClueCountFromData = function(card, locationData)\n -- Return the number of clues to spawn on this location\n if locationData == nil then\n error('attempted to get clue for unexpected object: ' .. card.getName())\n return 0\n end\n\n --log(card.getName() .. ' : ' .. locationData.type .. ' : ' .. locationData.value .. ' : ' .. locationData.clueSide)\n if ((card.is_face_down and locationData.clueSide == 'back')\n or (not card.is_face_down and locationData.clueSide == 'front')) then\n if locationData.type == 'fixed' then\n return locationData.value\n elseif locationData.type == 'perPlayer' then\n return locationData.value * playAreaApi.getInvestigatorCount()\n end\n error('unexpected location type: ' .. locationData.type)\n end\n return 0\n end\n\n -- Gets the right uses structure for this card, based on metadata and face up/down state\n ---@param card Object Card to pull the uses from\n internal.getUses = function(card)\n local metadata = JSON.decode(card.getGMNotes()) or { }\n if metadata.type == \"Location\" then\n if card.is_face_down and metadata.locationBack ~= nil then\n return metadata.locationBack.uses\n elseif not card.is_face_down and metadata.locationFront ~= nil then\n return metadata.locationFront.uses\n end\n elseif not card.is_face_down then\n return metadata.uses\n end\n\n return nil\n end\n\n -- Dynamically create positions for clues on a card.\n ---@param card Object Card the clues will be placed on\n ---@param count Integer How many clues?\n ---@return Table Array of global positions to spawn the clues at\n internal.buildClueOffsets = function(card, count)\n local pos = card.getPosition()\n local cluePositions = { }\n for i = 1, count do\n local row = math.floor(1 + (i - 1) / 4)\n local column = (i - 1) % 4\n table.insert(cluePositions, Vector(pos.x + 1.5 - 0.55 * row, pos.y + 0.15, pos.z - 0.825 + 0.55 * column))\n end\n return cluePositions\n end\n\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n internal.replenishTokens = function(card, uses, mat)\n local cardPos = card.getPosition()\n\n -- don't continue for cards on the deck (Norman) or in the discard pile\n if mat.positionToLocal(cardPos).x \u003c -1 then return end\n\n -- get current amount of resource tokens on the card\n local search = internal.searchOnCard(cardPos, card.getRotation())\n local clickableResourceCounter = nil\n local foundTokens = 0\n\n for _, obj in ipairs(search) do\n local obj = obj.hit_object\n local memo = obj.getMemo()\n\n if (stateTable[memo] or 0) \u003e 0 then\n foundTokens = foundTokens + math.abs(obj.getQuantity())\n obj.destruct()\n elseif memo == \"resourceCounter\" then\n foundTokens = obj.getVar(\"val\")\n clickableResourceCounter = obj\n break\n end\n end\n\n -- this is the theoretical new amount of uses (to be checked below)\n local newCount = foundTokens + uses[1].replenish\n\n -- if there are already more uses than the replenish amount, keep them\n if foundTokens \u003e uses[1].count then\n newCount = foundTokens\n -- only replenish up until the replenish amount\n elseif newCount \u003e uses[1].count then\n newCount = uses[1].count\n end\n\n -- update the clickable counter or spawn a group of tokens\n if clickableResourceCounter then\n clickableResourceCounter.call(\"updateVal\", newCount)\n else\n TokenManager.spawnTokenGroup(card, uses[1].token, newCount, _, uses[1].type)\n end\n end\n\n -- searches on a card (standard size) and returns the result\n ---@param position Table Position of the card\n ---@param rotation Table Rotation of the card\n internal.searchOnCard = function(position, rotation)\n return Physics.cast({\n origin = position,\n direction = {0, 1, 0},\n orientation = rotation,\n type = 3,\n size = { 2.5, 0.5, 3.5 },\n max_distance = 1,\n debug = false\n })\n end\n\n return TokenManager\nend\nend)\n__bundle_register(\"core/OptionPanelApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local OptionPanelApi = {}\n\n -- loads saved options\n ---@param options Table New options table\n OptionPanelApi.loadSettings = function(options)\n return Global.call(\"loadSettings\", options)\n end\n\n -- returns option panel table\n OptionPanelApi.getOptions = function()\n return Global.getTable(\"optionPanel\")\n end\n\n return OptionPanelApi\nend\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = { }\n local PLAY_AREA_GUID = \"721ba2\"\n local INVESTIGATOR_COUNTER_GUID = \"f182ee\"\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with\n -- 'displacement_excluded'\n ---@param playerColor Color of the player requesting the shift. Used solely to send an error\n --- message in the unlikely case that the scripting zone has been deleted\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"tryObjectEnterContainer\",\n { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightCountedVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getPlayArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"PlayArea\")\n end\n\n local function getInvestigatorCounter()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"InvestigatorCounter\")\n end\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getInvestigatorCounter().getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n getInvestigatorCounter().call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with 'displacement_excluded'\n ---@param playerColor Color Color of the player requesting the shift for messages\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getPlayArea().call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getPlayArea().call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getPlayArea().call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getPlayArea().call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getPlayArea().call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getPlayArea().call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getPlayArea().call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getPlayArea().call(\"tryObjectEnterContainer\", { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getPlayArea().call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getPlayArea().call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getPlayArea().call(\"countVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getPlayArea().call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getPlayArea().getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getPlayArea().call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getPlayArea().call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getPlayArea().getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\n__bundle_register(\"core/token/TokenSpawnTrackerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenSpawnTracker = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getSpawnTracker()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenSpawnTracker\")\n end\n\n TokenSpawnTracker.hasSpawnedTokens = function(cardGuid)\n return getSpawnTracker().call(\"hasSpawnedTokens\", cardGuid)\n end\n\n TokenSpawnTracker.markTokensSpawned = function(cardGuid)\n return getSpawnTracker().call(\"markTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetTokensSpawned = function(cardGuid)\n return getSpawnTracker().call(\"resetTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetAllAssetAndEvents = function()\n return getSpawnTracker().call(\"resetAllAssetAndEvents\")\n end\n\n TokenSpawnTracker.resetAllLocations = function()\n return getSpawnTracker().call(\"resetAllLocations\")\n end\n\n TokenSpawnTracker.resetAll = function()\n return getSpawnTracker().call(\"resetAll\")\n end\n\n return TokenSpawnTracker\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/PlayArea\")\nend)\n__bundle_register(\"core/PlayArea\", function(require, _LOADED, __bundle_register, __bundle_modules)\n---------------------------------------------------------\n-- general setup\n---------------------------------------------------------\n\n-- Location connection directional options\nlocal BIDIRECTIONAL = 0\nlocal ONE_WAY = 1\nlocal INCOMING_ONE_WAY = 2\n\n-- Connector draw parameters\nlocal CONNECTION_THICKNESS = 0.015\nlocal DRAGGING_CONNECTION_THICKNESS = 0.15\nlocal DRAGGING_CONNECTION_COLOR = { 0.8, 0.8, 0.8, 1 }\nlocal CONNECTION_COLOR = { 0.4, 0.4, 0.4, 1 }\nlocal DIRECTIONAL_ARROW_DISTANCE = 3.5\nlocal ARROW_ARM_LENGTH = 0.9\nlocal ARROW_ANGLE = 25\n\n-- Height to draw the connector lines, places them just above the table and always below cards\nlocal CONNECTION_LINE_Y = 1.529\n\n-- we use this to turn off collision handling until onLoad() is complete\nlocal collisionEnabled = false\n\n-- used for recreating the link to a custom data helper after image change\ncustomDataHelper = nil\n\nlocal DEFAULT_URL =\n\"http://cloud-3.steamusercontent.com/ugc/998015670465071049/FFAE162920D67CF38045EFBD3B85AD0F916147B2/\"\n\nlocal SHIFT_OFFSETS = {\n left = { x = 0.00, y = 0, z = 7.67 },\n right = { x = 0.00, y = 0, z = -7.67 },\n up = { x = 6.54, y = 0, z = 0.00 },\n down = { x = -6.54, y = 0, z = 0.00 }\n}\nlocal SHIFT_EXCLUSION = {\n [\"b7b45b\"] = true,\n [\"f182ee\"] = true,\n [\"721ba2\"] = true\n}\nlocal LOC_LINK_EXCLUDE_SCENARIOS = {\n [\"The Witching Hour\"] = true,\n [\"The Heart of Madness\"] = true\n}\n\nlocal guidReferenceApi = require(\"core/GUIDReferenceApi\")\nlocal tokenManager = require(\"core/token/TokenManager\")\nlocal clueData = {}\nlocal spawnedLocationGUIDs = {}\nlocal locations = {}\nlocal locationConnections = {}\nlocal draggingGuids = {}\nlocal missingData = {}\nlocal locationData, currentScenario\n\n---------------------------------------------------------\n-- general code\n---------------------------------------------------------\n\nfunction onSave()\n return JSON.encode({\n trackedLocations = locations,\n currentScenario = currentScenario,\n })\nend\n\nfunction onLoad(saveState)\n -- records locations we have spawned clues for\n local save = JSON.decode(saveState) or {}\n locations = save.trackedLocations or {}\n currentScenario = save.currentScenario\n\n self.interactable = false\n Wait.time(function() collisionEnabled = true end, 1)\nend\n\n-- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n-- data to the local token manager instance.\n---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\nfunction updateLocations(args)\n customDataHelper = getObjectFromGUID(args[1])\n if customDataHelper ~= nil then\n tokenManager.addLocationData(customDataHelper.getTable(\"LOCATIONS_DATA\"))\n end\nend\n\nfunction updateSurface(newURL)\n local customInfo = self.getCustomObject()\n\n if newURL ~= \"\" and newURL ~= nil and newURL ~= DEFAULT_URL then\n customInfo.image = newURL\n broadcastToAll(\"New Playmat Image Applied\", { 0.2, 0.9, 0.2 })\n else\n customInfo.image = DEFAULT_URL\n broadcastToAll(\"Default Playmat Image Applied\", { 0.2, 0.9, 0.2 })\n end\n\n self.setCustomObject(customInfo)\n\n local guid = nil\n\n if customDataHelper then guid = customDataHelper.getGUID() end\n self.reload()\n\n if guid ~= nil then\n Wait.time(function() updateLocations({ guid }) end, 1)\n end\nend\n\nfunction onCollisionEnter(collisionInfo)\n local obj = collisionInfo.collision_object\n local objType = obj.name\n\n -- only continue for cards\n if not collisionEnabled or (objType ~= \"Card\" and objType ~= \"CardCustom\") then\n if objType == \"Deck\" then\n table.insert(missingData, obj)\n end\n return\n end\n\n -- check if we should spawn clues here and do so according to playercount\n local card = collisionInfo.collision_object\n if shouldSpawnTokens(card) then\n tokenManager.spawnForCard(card)\n end\n \n -- If this card was being dragged, clear the dragging connections. A multi-drag/drop may send\n -- the dropped card immediately into a deck, so this has to be done here\n if draggingGuids[card.getGUID()] ~= nil then\n card.setVectorLines(nil)\n draggingGuids[card.getGUID()] = nil\n end\n \n maybeTrackLocation(card)\nend\n\nfunction shouldSpawnTokens(card)\n local metadata = JSON.decode(card.getGMNotes())\n if metadata == nil then\n return tokenManager.hasLocationData(card)\n end\n return metadata.type == \"Location\"\n or metadata.type == \"Enemy\"\n or metadata.type == \"Treachery\"\n or metadata.weakness\n -- hardcoded IDs for \"Makeshift Trap\" and \"Shrine of the Moirai\"\n -- these cards are events with uses, that attach to encounter cards and thus will enter play in the playarea\n -- TODO: probably turn this into a metadata field if we get more cards like that\n or metadata.id == \"07310\"\n or metadata.id == \"09100\"\nend\n\nfunction onCollisionExit(collisionInfo)\n maybeUntrackLocation(collisionInfo.collision_object)\nend\n\n-- Destroyed objects don't trigger onCollisionExit(), so check on destruction to untrack as well\nfunction onObjectDestroy(object)\n maybeUntrackLocation(object)\nend\n\nfunction onObjectPickUp(player, object)\n -- only continue for cards\n local objType = object.name\n if objType ~= \"Card\" and objType ~= \"CardCustom\" then return end\n\n -- onCollisionExit USUALLY fires first, so we have to check the card to see if it's a location we\n -- should be tracking\n if showLocationLinks() and isInPlayArea(object) and object.getGMNotes() ~= nil and object.getGMNotes() ~= \"\" then\n local pickedUpGuid = object.getGUID()\n local metadata = JSON.decode(object.getGMNotes()) or {}\n if metadata.type == \"Location\" then\n -- onCollisionExit sometimes comes 1 frame after onObjectPickUp (rather than before it or in\n -- the same frame). This causes a mismatch in the data between dragging the on-table, and\n -- that one frame draws connectors on the card which then show up as shadows for snap points.\n -- Waiting ensures we always do thing in the expected Exit-\u003ePickUp order\n Wait.frames(function()\n if object.is_face_down then\n draggingGuids[pickedUpGuid] = metadata.locationBack\n else\n draggingGuids[pickedUpGuid] = metadata.locationFront\n end\n rebuildConnectionList()\n end, 2)\n end\n end\nend\n\nfunction onUpdate()\n -- Due to the frequence of onUpdate calls, ensure that we only process any changes to the\n -- connection list once, and only redraw once\n local needsConnectionRebuild = false\n local needsConnectionDraw = false\n for guid, _ in pairs(draggingGuids) do\n local obj = getObjectFromGUID(guid)\n if obj == nil or not isInPlayArea(obj) then\n draggingGuids[guid] = nil\n needsConnectionRebuild = true\n -- If object still exists then it's been dragged outside the area and needs to clear the\n -- lines attached to it\n if obj ~= nil then\n obj.setVectorLines(nil)\n end\n end\n -- Even if the last location left the play area, need one last draw to clear the lines\n needsConnectionDraw = true\n end\n if (needsConnectionRebuild) then\n rebuildConnectionList()\n end\n if needsConnectionDraw then\n drawDraggingConnections()\n end\nend\n\n-- Checks the given card and adds it to the list of locations tracked for connection purposes.\n-- A card will be added to the tracking if it is a location in the play area (based on centerpoint).\n---@param card Object A card object, possibly a location.\nfunction maybeTrackLocation(card)\n -- Collision checks for any part of the card overlap, but our other tracking is centerpoint\n -- Ignore any collision where the centerpoint isn't in the area\n if isInPlayArea(card) then\n local metadata = JSON.decode(card.getGMNotes())\n if metadata == nil then\n table.insert(missingData, card)\n else\n if metadata.type == \"Location\" then\n if card.is_face_down then\n locations[card.getGUID()] = metadata.locationBack\n else\n locations[card.getGUID()] = metadata.locationFront\n end\n\n -- only draw connection lines for not-excluded scenarios\n if showLocationLinks() then\n rebuildConnectionList()\n drawBaseConnections()\n end\n end\n end\n end\nend\n\n-- Stop tracking a location for connection drawing. This should be called for both collision exit\n-- and destruction, as a destroyed object does not trigger collision exit. An object can also be\n-- deleted mid-drag, but the ordering for drag events means we can't clear those here and those will\n-- be cleared in the next onUpdate() cycle.\n---@param card Object Card to (maybe) stop tracking\nfunction maybeUntrackLocation(card)\n -- Locked objects no longer collide (hence triggering an exit event) but are still in the play\n -- area. If the object is now locked, don't remove it.\n if locations[card.getGUID()] ~= nil and not card.locked then\n locations[card.getGUID()] = nil\n rebuildConnectionList()\n drawBaseConnections()\n end\nend\n\n-- Global event handler, delegated from Global. Clears any connection lines from dragged cards\n-- before they are destroyed by entering a deck. Removal of the card from the dragging list will\n-- be handled during the next onUpdate() call.\nfunction tryObjectEnterContainer(params)\n for draggedGuid, _ in pairs(draggingGuids) do\n local draggedObj = getObjectFromGUID(draggedGuid)\n if draggedObj ~= nil then\n draggedObj.setVectorLines(nil)\n end\n end\nend\n\n-- Builds a list of GUID to GUID connection information based on the currently tracked locations.\n-- This will update the connection information and store it in the locationConnections data member,\n-- but does not draw those connections. This should often be followed by a call to\n-- drawBaseConnections()\nfunction rebuildConnectionList()\n if not showLocationLinks() then\n locationConnections = {}\n return\n end\n\n local iconCardList = {}\n\n -- Build a list of cards with each icon as their location ID\n for cardId, metadata in pairs(draggingGuids) do\n buildLocListByIcon(cardId, iconCardList, metadata)\n end\n for cardId, metadata in pairs(locations) do\n buildLocListByIcon(cardId, iconCardList, metadata)\n end\n\n -- Pair up all the icons\n locationConnections = {}\n for cardId, metadata in pairs(draggingGuids) do\n buildConnection(cardId, iconCardList, metadata)\n end\n for cardId, metadata in pairs(locations) do\n if draggingGuids[cardId] == nil then\n buildConnection(cardId, iconCardList, metadata)\n end\n end\nend\n\n-- Extracts the card's icon string into a list of individual location icons\n---@param cardID String GUID of the card to pull the icon data from\n---@param iconCardList Table A table of icon-\u003eGUID list. Mutable, will be updated by this method\n---@param locData Table A table containing the metadata for the card (for the correct side)\nfunction buildLocListByIcon(cardId, iconCardList, locData)\n if locData ~= nil and locData.icons ~= nil then\n for icon in string.gmatch(locData.icons, \"%a+\") do\n if iconCardList[icon] == nil then\n iconCardList[icon] = {}\n end\n table.insert(iconCardList[icon], cardId)\n end\n end\nend\n\n-- Builds the connections for the given cardID by finding matching icons and adding them to the\n-- Playarea's locationConnections table.\n---@param cardId String GUID of the card to build the connections for\n---@param iconCardList Table A table of icon-\u003eGUID List. Used to find matching icons for connections.\n---@param locData Table A table containing the metadata for the card (for the correct side)\nfunction buildConnection(cardId, iconCardList, locData)\n if locData ~= nil and locData.connections ~= nil then\n locationConnections[cardId] = {}\n for icon in string.gmatch(locData.connections, \"%a+\") do\n if iconCardList[icon] ~= nil then\n for _, connectedGuid in ipairs(iconCardList[icon]) do\n -- If the reciprocal exists, convert it to BiDi, otherwise add as a one-way\n if locationConnections[connectedGuid] ~= nil\n and (locationConnections[connectedGuid][cardId] == ONE_WAY\n or locationConnections[connectedGuid][cardId] == BIDIRECTIONAL) then\n locationConnections[connectedGuid][cardId] = BIDIRECTIONAL\n locationConnections[cardId][connectedGuid] = nil\n else\n if locationConnections[connectedGuid] == nil then\n locationConnections[connectedGuid] = {}\n end\n locationConnections[cardId][connectedGuid] = ONE_WAY\n locationConnections[connectedGuid][cardId] = INCOMING_ONE_WAY\n end\n end\n end\n end\n end\nend\n\n-- Draws the lines for connections currently in locationConnections but not in draggingGuids.\n-- Constructed vectors will be set to the playmat\nfunction drawBaseConnections()\n if not showLocationLinks() then\n locationConnections = {}\n return\n end\n local cardConnectionLines = {}\n\n for originGuid, targetGuids in pairs(locationConnections) do\n -- Objects should reliably exist at this point, but since this can be called during onUpdate the\n -- object checks are conservative just to make sure.\n local origin = getObjectFromGUID(originGuid)\n if draggingGuids[originGuid] == nil and origin != nil then\n for targetGuid, direction in pairs(targetGuids) do\n local target = getObjectFromGUID(targetGuid)\n if draggingGuids[targetGuid] == nil and target != nil then\n -- Since we process the full list, we're guaranteed to hit any ONE_WAY connections later\n -- so we can ignore INCOMING_ONE_WAY\n if direction == BIDIRECTIONAL then\n addBidirectionalVector(origin, target, self, cardConnectionLines)\n elseif direction == ONE_WAY then\n addOneWayVector(origin, target, self, cardConnectionLines)\n end\n end\n end\n end\n end\n self.setVectorLines(cardConnectionLines)\nend\n\n-- Draws the lines for cards which are currently being dragged.\nfunction drawDraggingConnections()\n if not showLocationLinks() then\n return\n end\n local cardConnectionLines = {}\n local ownedVectors = {}\n\n for originGuid, _ in pairs(draggingGuids) do\n targetGuids = locationConnections[originGuid]\n -- Objects should reliably exist at this point, but since this can be called during onUpdate the\n -- object checks are conservative just to make sure.\n local origin = getObjectFromGUID(originGuid)\n if draggingGuids[originGuid] and origin ~= nil and targetGuids ~= nil then\n ownedVectors[originGuid] = {}\n for targetGuid, direction in pairs(targetGuids) do\n local target = getObjectFromGUID(targetGuid)\n if target != nil then\n if direction == BIDIRECTIONAL then\n addBidirectionalVector(origin, target, origin, ownedVectors[originGuid])\n elseif direction == ONE_WAY then\n addOneWayVector(origin, target, origin, ownedVectors[originGuid])\n elseif direction == INCOMING_ONE_WAY and not draggingGuids[targetGuid] then\n addOneWayVector(target, origin, origin, ownedVectors[originGuid])\n end\n end\n end\n end\n end\n for ownerGuid, vectors in pairs(ownedVectors) do\n local card = getObjectFromGUID(ownerGuid)\n card.setVectorLines(vectors)\n end\nend\n\n-- Draws a bidirectional location connection between the two cards, adding the lines to do so to the\n-- given lines list.\n---@param card1 Object One of the card objects to connect\n---@param card2 Object The other card object to connect\n---@param vectorOwner Object The object which these lines will be set to. Used for relative\n--- positioning and scaling, as well as highlighting connections during a drag operation\n---@param lines Table List of vector line elements. Mutable, will be updated to add this connector\nfunction addBidirectionalVector(card1, card2, vectorOwner, lines)\n local cardPos1 = card1.getPosition()\n local cardPos2 = card2.getPosition()\n cardPos1.y = CONNECTION_LINE_Y\n cardPos2.y = CONNECTION_LINE_Y\n\n local pos1 = vectorOwner.positionToLocal(cardPos1)\n local pos2 = vectorOwner.positionToLocal(cardPos2)\n\n table.insert(lines, {\n points = { pos1, pos2 },\n color = vectorOwner == self and CONNECTION_COLOR or DRAGGING_CONNECTION_COLOR,\n thickness = vectorOwner == self and CONNECTION_THICKNESS or DRAGGING_CONNECTION_THICKNESS,\n })\nend\n\n-- Draws a one-way location connection between the two cards, adding the lines to do so to the\n-- given lines list. Arrows will point towards the target card.\n---@param origin Object Origin card in the connection\n---@param target Object Target card object to connect\n---@param vectorOwner Object The object which these lines will be set to. Used for relative\n--- positioning and scaling, as well as highlighting connections during a drag operation\n---@param lines Table List of vector line elements. Mutable, will be updated to add this connector\nfunction addOneWayVector(origin, target, vectorOwner, lines)\n -- Start with the BiDi then add the arrow lines to it\n addBidirectionalVector(origin, target, vectorOwner, lines)\n local originPos = origin.getPosition()\n local targetPos = target.getPosition()\n originPos.y = CONNECTION_LINE_Y\n targetPos.y = CONNECTION_LINE_Y\n\n -- Calculate card distance to be closer for horizontal positions than vertical, since cards are\n -- taller than they are wide\n local heading = Vector(originPos):sub(targetPos):heading(\"y\")\n local distanceFromCard = DIRECTIONAL_ARROW_DISTANCE * 0.7 +\n DIRECTIONAL_ARROW_DISTANCE * 0.3 * math.abs(math.sin(math.rad(heading)))\n\n -- Calculate the three possible arrow positions. These are offset by half the arrow length to\n -- make them visually balanced by keeping the arrows centered, not tracking the point\n local midpoint = Vector(originPos):add(targetPos):scale(Vector(0.5, 0.5, 0.5)):moveTowards(targetPos,\n ARROW_ARM_LENGTH / 2)\n local closeToOrigin = Vector(originPos):moveTowards(targetPos, distanceFromCard + ARROW_ARM_LENGTH / 2)\n local closeToTarget = Vector(targetPos):moveTowards(originPos, distanceFromCard - ARROW_ARM_LENGTH / 2)\n\n if (originPos:distance(closeToOrigin) \u003e originPos:distance(closeToTarget)) then\n addArrowLines(midpoint, originPos, vectorOwner, lines)\n else\n addArrowLines(closeToOrigin, originPos, vectorOwner, lines)\n addArrowLines(closeToTarget, originPos, vectorOwner, lines)\n end\nend\n\n-- Draws an arrowhead at the given position.\n---@param arrowheadPosition Table Centerpoint of the arrowhead to draw (NOT the tip of the arrow)\n---@param originPos Table Origin point of the connection, used to position the arrow arms\n---@param vectorOwner Object The object which these lines will be set to. Used for relative\n--- positioning and scaling, as well as highlighting connections during a drag operation\n---@param lines Table List of vector line elements. Mutable, will be updated to add this arrow\nfunction addArrowLines(arrowheadPos, originPos, vectorOwner, lines)\n local arrowArm1 = Vector(arrowheadPos):moveTowards(originPos, ARROW_ARM_LENGTH):sub(arrowheadPos):rotateOver(\"y\",\n -1 * ARROW_ANGLE):add(arrowheadPos)\n local arrowArm2 = Vector(arrowheadPos):moveTowards(originPos, ARROW_ARM_LENGTH):sub(arrowheadPos):rotateOver(\"y\",\n ARROW_ANGLE):add(arrowheadPos)\n\n local head = vectorOwner.positionToLocal(arrowheadPos)\n local arm1 = vectorOwner.positionToLocal(arrowArm1)\n local arm2 = vectorOwner.positionToLocal(arrowArm2)\n table.insert(lines, {\n points = { arm1, head, arm2 },\n color = vectorOwner == self and CONNECTION_COLOR or DRAGGING_CONNECTION_COLOR,\n thickness = vectorOwner == self and CONNECTION_THICKNESS or DRAGGING_CONNECTION_THICKNESS,\n })\nend\n\n-- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n-- fixed objects will be ignored, as will anything the player has tagged with 'displacement_excluded'\n---@param playerColor String Color of the player requesting the shift. Used solely to send an error\n--- message in the unlikely case that the scripting zone has been deleted\nfunction shiftContentsUp(playerColor)\n shiftContents(playerColor, \"up\")\nend\n\nfunction shiftContentsDown(playerColor)\n shiftContents(playerColor, \"down\")\nend\n\nfunction shiftContentsLeft(playerColor)\n shiftContents(playerColor, \"left\")\nend\n\nfunction shiftContentsRight(playerColor)\n shiftContents(playerColor, \"right\")\nend\n\nfunction shiftContents(playerColor, direction)\n local zone = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"PlayAreaZone\")\n if not zone then\n broadcastToColor(\"Scripting zone couldn't be found.\", playerColor, \"Red\")\n return\n end\n\n for _, object in ipairs(zone.getObjects()) do\n if not (SHIFT_EXCLUSION[object.getGUID()] or object.hasTag(\"displacement_excluded\")) then\n object.translate(SHIFT_OFFSETS[direction])\n end\n end\n Wait.time(drawBaseConnections, 0.1)\nend\n\n-- Check to see if the given object is within the bounds of the play area, based solely on the X and\n-- Z coordinates, ignoring height\n---@param object Object Object to check\n---@return. True if the object is inside the play area\nfunction isInPlayArea(object)\n local bounds = self.getBounds()\n local position = object.getPosition()\n -- Corners are arbitrary since it's all global - c1 goes down both axes, c2 goes up\n local c1 = { x = bounds.center.x - bounds.size.x / 2, z = bounds.center.z - bounds.size.z / 2 }\n local c2 = { x = bounds.center.x + bounds.size.x / 2, z = bounds.center.z + bounds.size.z / 2 }\n\n return position.x \u003e c1.x and position.x \u003c c2.x and position.z \u003e c1.z and position.z \u003c c2.z\nend\n\n-- Reset the play area's tracking of which cards have had tokens spawned.\nfunction resetSpawnedCards()\n spawnedLocationGUIDs = {}\nend\n\nfunction onScenarioChanged(scenarioName)\n currentScenario = scenarioName\n if not showLocationLinks() then\n broadcastToAll(\"Automatic location connections not available for this scenario\")\n end\nend\n\nfunction showLocationLinks()\n return not LOC_LINK_EXCLUDE_SCENARIOS[currentScenario]\nend\n\n-- Sets this playmat's snap points to limit snapping to locations or not.\n-- If matchTypes is false, snap points will be reset to snap all cards.\n---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\nfunction setLimitSnapsByType(matchTypes)\n local snaps = self.getSnapPoints()\n for i, snap in ipairs(snaps) do\n local snapTags = snaps[i].tags\n if matchTypes then\n if snapTags == nil then\n snaps[i].tags = { \"Location\" }\n else\n table.insert(snaps[i].tags, \"Location\")\n end\n else\n snaps[i].tags = nil\n end\n end\n self.setSnapPoints(snaps)\nend\n\n-- count victory points on locations in play area\n---@param highlightOff Boolean True if highlighting should be enabled\n---@return. Returns the total amount of VP found in the play area\nfunction countVP(highlightOff)\n local totalVP = 0\n\n for cardId, metadata in pairs(locations) do\n local card = getObjectFromGUID(cardId)\n if metadata ~= nil and card ~= nil then\n if highlightOff == true then\n card.highlightOff(\"Green\")\n end\n\n local cardVP = tonumber(metadata.victory) or 0\n if cardVP ~= 0 and not cardHasClues(card) then\n totalVP = totalVP + cardVP\n if highlightOff == false then\n card.highlightOn(\"Green\")\n end\n end\n end\n end\n\n return totalVP\nend\n\n-- checks if a card has clues on it, returns true if clues are on it\n---@param card TTSObject Card to check for clues\nfunction cardHasClues(card)\n for _, v in ipairs(searchOnObj(card)) do\n local obj = v.hit_object\n if obj.memo == \"clueDoom\" and obj.is_face_down == false then\n return true\n end\n end\n return false\nend\n\n-- searches on an object (by using its bounds)\n---@param obj Object Object to search on\nfunction searchOnObj(obj)\n return Physics.cast({\n direction = { 0, 1, 0 },\n max_distance = 0.5,\n type = 3,\n size = obj.getBounds().size,\n origin = obj.getPosition()\n })\nend\n\n-- highlights all locations in the play area without metadata\n---@param state Boolean True if highlighting should be enabled\nfunction highlightMissingData(state)\n for i, obj in pairs(missingData) do\n if obj ~= nil then\n if state then\n obj.highlightOff(\"Red\")\n else\n obj.highlightOn(\"Red\")\n end\n else\n missingData[i] = nil\n end\n end\nend\n\n-- rebuilds local snap points (could be useful in the future again)\nfunction buildSnaps()\n local upperleft = { x = 1.53, z = -1.09 }\n local lowerright = { x = -1.53, z = 1.55 }\n local snaps = {}\n\n -- creates 81 snap points, for uneven rows + columns it makes a rotation snap point\n for i = 1, 9 do\n for j = 1, 9 do\n local snap = {}\n snap.position = {}\n snap.position.x = round(upperleft.x - (upperleft.x - lowerright.x) * (i - 1) / 8, 3)\n snap.position.y = 0.1\n snap.position.z = round(upperleft.z - (upperleft.z - lowerright.z) * (j - 1) / 8, 3)\n\n -- enable rotation snaps for uneven rows / columns\n if (i % 2 ~= 0) and (j % 2 ~= 0) then\n snap.rotation = { 0, 0, 0 }\n snap.rotation_snap = true\n end\n\n table.insert(snaps, snap)\n end\n end\n self.setSnapPoints(snaps)\nend\n\n-- utility function\nfunction round(num, numDecimalPlaces)\n local mult = 10 ^ (numDecimalPlaces or 0)\n return math.floor(num * mult + 0.5) / mult\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"core/token/TokenManager\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n local optionPanelApi = require(\"core/OptionPanelApi\")\n local playAreaApi = require(\"core/PlayAreaApi\")\n local tokenSpawnTrackerApi = require(\"core/token/TokenSpawnTrackerApi\")\n\n local PLAYER_CARD_TOKEN_OFFSETS = {\n [1] = {\n Vector(0, 3, -0.2)\n },\n [2] = {\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [3] = {\n Vector(0, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [4] = {\n Vector(0.4, 3, -0.9),\n Vector(-0.4, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [5] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [6] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2)\n },\n [7] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0, 3, 0.5)\n },\n [8] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(-0.35, 3, 0.5),\n Vector(0.35, 3, 0.5)\n },\n [9] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5)\n },\n [10] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0, 3, 1.2)\n },\n [11] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(-0.35, 3, 1.2),\n Vector(0.35, 3, 1.2)\n },\n [12] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0.7, 3, 1.2),\n Vector(0, 3, 1.2),\n Vector(-0.7, 3, 1.2)\n }\n }\n\n -- stateIDs for the multi-stated resource tokens\n local stateTable = {\n [\"resource\"] = 1,\n [\"ammo\"] = 2,\n [\"bounty\"] = 3,\n [\"charge\"] = 4,\n [\"evidence\"] = 5,\n [\"secret\"] = 6,\n [\"supply\"] = 7\n }\n\n -- Table of data extracted from the token source bag, keyed by the Memo on each token which\n -- should match the token type keys (\"resource\", \"clue\", etc)\n local tokenTemplates\n\n local playerCardData\n local locationData\n\n local TokenManager = { }\n local internal = { }\n\n -- Spawns tokens for the card. This function is built to just throw a card at it and let it do\n -- the work once a card has hit an area where it might spawn tokens. It will check to see if\n -- the card has already spawned, find appropriate data from either the uses metadata or the Data\n -- Helper, and spawn the tokens.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n TokenManager.spawnForCard = function(card, extraUses)\n if tokenSpawnTrackerApi.hasSpawnedTokens(card.getGUID()) then\n return\n end\n local metadata = JSON.decode(card.getGMNotes())\n if metadata ~= nil then\n internal.spawnTokensFromUses(card, extraUses)\n else\n internal.spawnTokensFromDataHelper(card)\n end\n end\n\n -- Spawns a set of tokens on the given card.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String Type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param tokenCount Number How many tokens to spawn. For damage or horror this value will be set to the\n -- spawned state object rather than spawning multiple tokens\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnTokenGroup = function(card, tokenType, tokenCount, shiftDown, subType)\n local optionPanel = optionPanelApi.getOptions()\n\n if tokenType == \"damage\" or tokenType == \"horror\" then\n TokenManager.spawnCounterToken(card, tokenType, tokenCount, shiftDown)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"enabled\" then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"custom\" and tokenCount == 0 then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n else\n TokenManager.spawnMultipleTokens(card, tokenType, tokenCount, shiftDown, subType)\n end\n end\n\n -- Spawns a single counter token and sets the value to tokenValue. Used for damage and horror\n -- tokens.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String type of token to spawn, valid values are \"damage\" and \"horror\". Other\n -- types should use spawnMultipleTokens()\n ---@param tokenValue Number Value to set the damage/horror to\n TokenManager.spawnCounterToken = function(card, tokenType, tokenValue, shiftDown)\n if tokenValue \u003c 1 or tokenValue \u003e 50 then return end\n\n local pos = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[1][1] + Vector(0, 0, shiftDown))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, tokenType, rot, function(spawned) spawned.setState(tokenValue) end)\n end\n\n TokenManager.spawnResourceCounterToken = function(card, tokenCount)\n local pos = card.positionToWorld(card.positionToLocal(card.getPosition()) + Vector(0, 0.2, -0.5))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, \"resourceCounter\", rot, function(spawned)\n spawned.call(\"updateVal\", tokenCount)\n end)\n end\n\n -- Spawns a number of tokens.\n ---@param tokenType String type of token to spawn, valid values are resource\", \"doom\", or \"clue\".\n -- Other types should use spawnCounterToken()\n ---@param tokenCount Number How many tokens to spawn\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnMultipleTokens = function(card, tokenType, tokenCount, shiftDown, subType)\n -- not checking the max at this point since clue offsets are calculated dynamically\n if tokenCount \u003c 1 then return end\n\n local offsets = {}\n if tokenType == \"clue\" then\n offsets = internal.buildClueOffsets(card, tokenCount)\n else\n -- only up to 12 offset tables defined\n if tokenCount \u003e 12 then return end\n for i = 1, tokenCount do\n offsets[i] = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[tokenCount][i])\n -- Fix the y-position for the spawn, since positionToWorld considers rotation which can\n -- have bad results for face up/down differences\n offsets[i].y = card.getPosition().y + 0.15\n end\n end\n\n if shiftDown ~= nil then\n -- Copy the offsets to make sure we don't change the static values\n local baseOffsets = offsets\n offsets = { }\n\n -- get a vector for the shifting (downwards local to the card)\n local shiftDownVector = Vector(0, 0, shiftDown):rotateOver(\"y\", card.getRotation().y)\n for i, baseOffset in ipairs(baseOffsets) do\n offsets[i] = baseOffset + shiftDownVector\n end\n end\n\n if offsets == nil then\n error(\"couldn't find offsets for \" .. tokenCount .. ' tokens')\n return\n end\n\n -- handling for not provided subtype (for example when spawning from custom data helpers)\n if subType == nil then\n subType = \"\"\n end\n \n -- this is used to load the correct state for additional resource tokens (e.g. \"Ammo\")\n local callback = nil\n local stateID = stateTable[string.lower(subType)]\n if tokenType == \"resource\" and stateID ~= nil and stateID ~= 1 then\n callback = function(spawned) spawned.setState(stateID) end\n end\n\n for i = 1, tokenCount do\n TokenManager.spawnToken(offsets[i], tokenType, card.getRotation(), callback)\n end\n end\n\n -- Spawns a single token at the given global position by copying it from the template bag.\n ---@param position Global position to spawn the token\n ---@param tokenType String type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param rotation Vector Rotation to be used for the new token. Only the y-value will be used,\n -- x and z will use the default rotation from the source bag\n ---@param callback function A callback function triggered after the new token is spawned\n TokenManager.spawnToken = function(position, tokenType, rotation, callback)\n internal.initTokenTemplates()\n local loadTokenType = tokenType\n if tokenType == \"clue\" or tokenType == \"doom\" then\n loadTokenType = \"clueDoom\"\n end\n if tokenTemplates[loadTokenType] == nil then\n error(\"Unknown token type '\" .. tokenType .. \"'\")\n return\n end\n local tokenTemplate = tokenTemplates[loadTokenType]\n\n -- Take ONLY the Y-value for rotation, so we don't flip the token coming out of the bag\n local rot = Vector(tokenTemplate.Transform.rotX,\n 270,\n tokenTemplate.Transform.rotZ)\n if rotation ~= nil then\n rot.y = rotation.y\n end\n if tokenType == \"doom\" then\n rot.z = 180\n end\n\n tokenTemplate.Nickname = \"\"\n return spawnObjectData({\n data = tokenTemplate,\n position = position,\n rotation = rot,\n callback_function = callback\n })\n end\n\n -- Checks a card for metadata to maybe replenish it\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n TokenManager.maybeReplenishCard = function(card, uses, mat)\n -- TODO: support for cards with multiple uses AND replenish (as of yet, no official card needs that)\n if uses[1].count and uses[1].replenish then\n internal.replenishTokens(card, uses, mat)\n end\n end\n\n -- Delegate function to the token spawn tracker. Exists to avoid circular dependencies in some\n -- callers.\n ---@param card Object Card object to reset the tokens for\n TokenManager.resetTokensSpawned = function(card)\n tokenSpawnTrackerApi.resetTokensSpawned(card.getGUID())\n end\n\n -- Pushes new player card data into the local copy of the Data Helper player data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addPlayerCardData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n playerCardData[k] = v\n end\n end\n\n -- Pushes new location data into the local copy of the Data Helper location data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addLocationData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n locationData[k] = v\n end\n end\n\n -- Checks to see if the given card has location data in the DataHelper\n ---@param card Object Card to check for data\n ---@return Boolean True if this card has data in the helper, false otherwise\n TokenManager.hasLocationData = function(card)\n internal.initDataHelperData()\n return internal.getLocationData(card) ~= nil\n end\n\n internal.initTokenTemplates = function()\n if tokenTemplates ~= nil then\n return\n end\n tokenTemplates = {}\n local tokenSource = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenSource\")\n for _, tokenTemplate in ipairs(tokenSource.getData().ContainedObjects) do\n local tokenName = tokenTemplate.Memo\n tokenTemplates[tokenName] = tokenTemplate\n end\n end\n\n -- Copies the data from the DataHelper. Will only happen once.\n internal.initDataHelperData = function()\n if playerCardData ~= nil then\n return\n end\n local dataHelper = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"DataHelper\")\n playerCardData = dataHelper.getTable('PLAYER_CARD_DATA')\n locationData = dataHelper.getTable('LOCATIONS_DATA')\n end\n\n -- Spawn tokens for a card based on the uses metadata. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n internal.spawnTokensFromUses = function(card, extraUses)\n local uses = internal.getUses(card)\n if uses == nil then return end\n\n -- go through tokens to spawn\n local tokenCount\n for i, useInfo in ipairs(uses) do\n tokenCount = (useInfo.count or 0) + (useInfo.countPerInvestigator or 0) * playAreaApi.getInvestigatorCount()\n if extraUses ~= nil and extraUses[useInfo.type] ~= nil then\n tokenCount = tokenCount + extraUses[useInfo.type]\n end\n -- Shift each spawned group after the first down so they don't pile on each other\n TokenManager.spawnTokenGroup(card, useInfo.token, tokenCount, (i - 1) * 0.8, useInfo.type)\n end\n \n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a card based on the data helper data. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n internal.spawnTokensFromDataHelper = function(card)\n internal.initDataHelperData()\n local playerData = internal.getPlayerCardData(card)\n if playerData ~= nil then\n internal.spawnPlayerCardTokensFromDataHelper(card, playerData)\n end\n local locationData = internal.getLocationData(card)\n if locationData ~= nil then\n internal.spawnLocationTokensFromDataHelper(card, locationData)\n end\n end\n\n -- Spawn tokens for a player card using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Player card data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnPlayerCardTokensFromDataHelper = function(card, playerData)\n local token = playerData.tokenType\n local tokenCount = playerData.tokenCount\n TokenManager.spawnTokenGroup(card, token, tokenCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a location using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Location data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnLocationTokensFromDataHelper = function(card, locationData)\n local clueCount = internal.getClueCountFromData(card, locationData)\n if clueCount \u003e 0 then\n TokenManager.spawnTokenGroup(card, \"clue\", clueCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n end\n\n internal.getPlayerCardData = function(card)\n return playerCardData[card.getName() .. ':' .. card.getDescription()]\n or playerCardData[card.getName()]\n end\n\n internal.getLocationData = function(card)\n return locationData[card.getName() .. '_' .. card.getGUID()] or locationData[card.getName()]\n end\n\n internal.getClueCountFromData = function(card, locationData)\n -- Return the number of clues to spawn on this location\n if locationData == nil then\n error('attempted to get clue for unexpected object: ' .. card.getName())\n return 0\n end\n\n if ((card.is_face_down and locationData.clueSide == 'back')\n or (not card.is_face_down and locationData.clueSide == 'front')) then\n if locationData.type == 'fixed' then\n return locationData.value\n elseif locationData.type == 'perPlayer' then\n return locationData.value * playAreaApi.getInvestigatorCount()\n end\n error('unexpected location type: ' .. locationData.type)\n end\n return 0\n end\n\n -- Gets the right uses structure for this card, based on metadata and face up/down state\n ---@param card Object Card to pull the uses from\n internal.getUses = function(card)\n local metadata = JSON.decode(card.getGMNotes()) or { }\n if metadata.type == \"Location\" then\n if card.is_face_down and metadata.locationBack ~= nil then\n return metadata.locationBack.uses\n elseif not card.is_face_down and metadata.locationFront ~= nil then\n return metadata.locationFront.uses\n end\n elseif not card.is_face_down then\n return metadata.uses\n end\n\n return nil\n end\n\n -- Dynamically create positions for clues on a card.\n ---@param card Object Card the clues will be placed on\n ---@param count Integer How many clues?\n ---@return Table Array of global positions to spawn the clues at\n internal.buildClueOffsets = function(card, count)\n local pos = card.getPosition()\n local cluePositions = { }\n for i = 1, count do\n local row = math.floor(1 + (i - 1) / 4)\n local column = (i - 1) % 4\n table.insert(cluePositions, Vector(pos.x + 1.5 - 0.55 * row, pos.y + 0.15, pos.z - 0.825 + 0.55 * column))\n end\n return cluePositions\n end\n\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n internal.replenishTokens = function(card, uses, mat)\n local cardPos = card.getPosition()\n\n -- don't continue for cards on the deck (Norman) or in the discard pile\n if mat.positionToLocal(cardPos).x \u003c -1 then return end\n\n -- get current amount of resource tokens on the card\n local search = internal.searchOnCard(cardPos, card.getRotation())\n local clickableResourceCounter = nil\n local foundTokens = 0\n\n for _, obj in ipairs(search) do\n local obj = obj.hit_object\n local memo = obj.getMemo()\n\n if (stateTable[memo] or 0) \u003e 0 then\n foundTokens = foundTokens + math.abs(obj.getQuantity())\n obj.destruct()\n elseif memo == \"resourceCounter\" then\n foundTokens = obj.getVar(\"val\")\n clickableResourceCounter = obj\n break\n end\n end\n\n -- this is the theoretical new amount of uses (to be checked below)\n local newCount = foundTokens + uses[1].replenish\n\n -- if there are already more uses than the replenish amount, keep them\n if foundTokens \u003e uses[1].count then\n newCount = foundTokens\n -- only replenish up until the replenish amount\n elseif newCount \u003e uses[1].count then\n newCount = uses[1].count\n end\n\n -- update the clickable counter or spawn a group of tokens\n if clickableResourceCounter then\n clickableResourceCounter.call(\"updateVal\", newCount)\n else\n TokenManager.spawnTokenGroup(card, uses[1].token, newCount, _, uses[1].type)\n end\n end\n\n -- searches on a card (standard size) and returns the result\n ---@param position Table Position of the card\n ---@param rotation Table Rotation of the card\n internal.searchOnCard = function(position, rotation)\n return Physics.cast({\n origin = position,\n direction = {0, 1, 0},\n orientation = rotation,\n type = 3,\n size = { 2.5, 0.5, 3.5 },\n max_distance = 1,\n debug = false\n })\n end\n\n return TokenManager\nend\nend)\n__bundle_register(\"core/OptionPanelApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local OptionPanelApi = {}\n\n -- loads saved options\n ---@param options Table New options table\n OptionPanelApi.loadSettings = function(options)\n return Global.call(\"loadSettings\", options)\n end\n\n -- returns option panel table\n OptionPanelApi.getOptions = function()\n return Global.getTable(\"optionPanel\")\n end\n\n return OptionPanelApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "{\"trackedLocations\":[]}", "MeasureMovement": false, "Name": "Custom_Token", - "Nickname": "Playarea", + "Nickname": "Play Area", "Snap": true, "Sticky": true, "Tags": [ @@ -20924,6 +21008,7 @@ "Snap": true, "Sticky": true, "Tags": [ + "CleanUpHelper_ignore", "displacement_excluded" ], "Tooltip": true, @@ -21569,6 +21654,7 @@ "Snap": true, "Sticky": true, "Tags": [ + "CleanUpHelper_ignore", "displacement_excluded" ], "Tooltip": true, @@ -21586,66 +21672,6 @@ "Value": 0, "XmlUI": "" }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "b": 1, - "g": 1, - "r": 1 - }, - "CustomImage": { - "CustomTile": { - "Stackable": false, - "Stretch": true, - "Thickness": 0.1, - "Type": 0 - }, - "ImageScalar": 1, - "ImageSecondaryURL": "http://cloud-3.steamusercontent.com/ugc/1767069252728653004/7BD6E4B8763FE70DB6ADB22B62504361D3778309/", - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/1767069252728651946/04A700179A71859B828E30D2877D802749B8223C/", - "WidthScale": 0 - }, - "Description": "See Notebook for details.", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0a5a29", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"util/TokenRemover\")\nend)\n__bundle_register(\"util/TokenRemover\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal zone = nil\nlocal tokenChecker = require(\"core/token/TokenChecker\")\n\n-- general code\nfunction onSave()\n return JSON.encode(zone and zone.getGUID() or nil)\nend\n\nfunction onLoad(savedData)\n if savedData ~= \"\" and savedData ~= nil then\n zone = getObjectFromGUID(JSON.decode(savedData))\n end\n setMenu(zone == nil)\nend\n\n-- context menu functions\nfunction enable()\n local scale = self.getScale()\n zone = spawnObject({\n type = \"ScriptingTrigger\",\n position = self.getPosition() + Vector(0, 2.5 + 0.11, 0),\n rotation = self.getRotation(),\n scale = { scale.x * 2, 5, scale.z * 2 }\n })\n setMenu(false)\nend\n\nfunction disable()\n if zone ~= nil then zone.destruct() end\n setMenu(true)\nend\n\n-- core functions\nfunction setMenu(isEnabled)\n self.clearContextMenu()\n if isEnabled then\n self.addContextMenuItem(\"Enable\", enable)\n else\n self.addContextMenuItem(\"Disable\", disable)\n end\nend\n\nfunction onObjectEnterScriptingZone(entering, object)\n if zone ~= entering then return end\n if object == self or object.type == \"Deck\" or object.type == \"Card\" then return end\n if tokenChecker.isChaosToken(object) then return end\n object.destruct()\nend\n\nfunction onPickUp()\n disable()\nend\nend)\n__bundle_register(\"core/token/TokenChecker\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local CHAOS_TOKEN_NAMES = {\n [\"Elder Sign\"] = true,\n [\"+1\"] = true,\n [\"0\"] = true,\n [\"-1\"] = true,\n [\"-2\"] = true,\n [\"-3\"] = true,\n [\"-4\"] = true,\n [\"-5\"] = true,\n [\"-6\"] = true,\n [\"-7\"] = true,\n [\"-8\"] = true,\n [\"Skull\"] = true,\n [\"Cultist\"] = true,\n [\"Tablet\"] = true,\n [\"Elder Thing\"] = true,\n [\"Auto-fail\"] = true,\n [\"Bless\"] = true,\n [\"Curse\"] = true,\n [\"Frost\"] = true\n }\n\n local TokenChecker = {}\n\n -- returns true if the passed object is a chaos token (by name)\n TokenChecker.isChaosToken = function(obj)\n if CHAOS_TOKEN_NAMES[obj.getName()] then\n return true\n else\n return false\n end\n end\n\n return TokenChecker\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "null", - "MeasureMovement": false, - "Name": "Custom_Tile", - "Nickname": "Token Remover", - "Snap": true, - "Sticky": true, - "Tags": [ - "CleanUpHelper_ignore" - ], - "Tooltip": true, - "Transform": { - "posX": -58.5, - "posY": 1.481, - "posZ": 0, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, { "AltLookAngle": { "x": 0, @@ -21669,7 +21695,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/token/TokenSpawnTrackerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenSpawnTracker = { }\n local SPAWN_TRACKER_GUID = \"e3ffc9\"\n\n TokenSpawnTracker.hasSpawnedTokens = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"hasSpawnedTokens\", cardGuid)\n end\n\n TokenSpawnTracker.markTokensSpawned = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"markTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetTokensSpawned = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetAllAssetAndEvents = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAllAssetAndEvents\")\n end\n\n TokenSpawnTracker.resetAllLocations = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAllLocations\")\n end\n\n TokenSpawnTracker.resetAll = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAll\")\n end\n\n return TokenSpawnTracker\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"util/TokenSpawnTool\")\nend)\n__bundle_register(\"util/TokenSpawnTool\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal tokenManager = require(\"core/token/TokenManager\")\nlocal TOKEN_INDEX = {}\nTOKEN_INDEX[3] = \"resourceCounter\"\nTOKEN_INDEX[4] = \"damage\"\nTOKEN_INDEX[5] = \"path\"\nTOKEN_INDEX[6] = \"horror\"\nTOKEN_INDEX[7] = \"doom\"\nTOKEN_INDEX[8] = \"clue\"\nTOKEN_INDEX[9] = \"resource\"\n\nlocal stateTable = {\n [\"resource\"] = 1,\n [\"ammo\"] = 2,\n [\"bounty\"] = 3,\n [\"charge\"] = 4,\n [\"evidence\"] = 5,\n [\"secret\"] = 6,\n [\"supply\"] = 7\n}\n\n---@param index number Index of the pressed key\n---@param playerColor string Color of the triggering player\nfunction onScriptingButtonDown(index, playerColor)\n local tokenType = TOKEN_INDEX[index]\n if not tokenType then return end\n\n local rotation = { x = 0, y = Player[playerColor].getPointerRotation(), z = 0 }\n local position = Player[playerColor].getPointerPosition() + Vector(0, 0.2, 0)\n local subType = \"\"\n local callback = nil\n\n -- check for subtype of resource based on card below\n if tokenType == \"resource\" then\n local search = Physics.cast({\n direction = { 0, -1, 0 },\n max_distance = 2,\n type = 3,\n size = { 0.1, 0.1, 0.1 },\n origin = position:setAt(\"y\", 2)\n })\n\n for _, v in ipairs(search) do\n if v.hit_object.tag == \"Card\" and not v.hit_object.is_face_down then\n local metadata = JSON.decode(v.hit_object.getGMNotes()) or {}\n local uses = metadata.uses or {}\n\n for _, useInfo in ipairs(uses) do\n if useInfo.token == \"resource\" then\n subType = useInfo.type\n break\n end\n end\n break\n end\n end\n \n -- this is used to load the correct state for additional resource tokens (e.g. \"Ammo\")\n local stateID = stateTable[string.lower(subType)]\n if stateID ~= nil and stateID ~= 1 then\n callback = function(spawned) spawned.setState(stateID) end\n end\n end\n\n tokenManager.spawnToken(position, tokenType, rotation, callback)\nend\nend)\n__bundle_register(\"core/token/TokenManager\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local optionPanelApi = require(\"core/OptionPanelApi\")\n local playAreaApi = require(\"core/PlayAreaApi\")\n local tokenSpawnTrackerApi = require(\"core/token/TokenSpawnTrackerApi\")\n\n local PLAYER_CARD_TOKEN_OFFSETS = {\n [1] = {\n Vector(0, 3, -0.2)\n },\n [2] = {\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [3] = {\n Vector(0, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [4] = {\n Vector(0.4, 3, -0.9),\n Vector(-0.4, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [5] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [6] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2)\n },\n [7] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0, 3, 0.5)\n },\n [8] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(-0.35, 3, 0.5),\n Vector(0.35, 3, 0.5)\n },\n [9] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5)\n },\n [10] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0, 3, 1.2)\n },\n [11] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(-0.35, 3, 1.2),\n Vector(0.35, 3, 1.2)\n },\n [12] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0.7, 3, 1.2),\n Vector(0, 3, 1.2),\n Vector(-0.7, 3, 1.2)\n }\n }\n\n -- stateIDs for the multi-stated resource tokens\n local stateTable = {\n [\"resource\"] = 1,\n [\"ammo\"] = 2,\n [\"bounty\"] = 3,\n [\"charge\"] = 4,\n [\"evidence\"] = 5,\n [\"secret\"] = 6,\n [\"supply\"] = 7\n }\n\n -- Source for tokens\n local TOKEN_SOURCE_GUID = \"124381\"\n\n -- Table of data extracted from the token source bag, keyed by the Memo on each token which\n -- should match the token type keys (\"resource\", \"clue\", etc)\n local tokenTemplates\n\n local DATA_HELPER_GUID = \"708279\"\n\n local playerCardData\n local locationData\n\n local TokenManager = { }\n local internal = { }\n\n -- Spawns tokens for the card. This function is built to just throw a card at it and let it do\n -- the work once a card has hit an area where it might spawn tokens. It will check to see if\n -- the card has already spawned, find appropriate data from either the uses metadata or the Data\n -- Helper, and spawn the tokens.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n TokenManager.spawnForCard = function(card, extraUses)\n if tokenSpawnTrackerApi.hasSpawnedTokens(card.getGUID()) then\n return\n end\n local metadata = JSON.decode(card.getGMNotes())\n if metadata ~= nil then\n internal.spawnTokensFromUses(card, extraUses)\n else\n internal.spawnTokensFromDataHelper(card)\n end\n end\n\n -- Spawns a set of tokens on the given card.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String Type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param tokenCount Number How many tokens to spawn. For damage or horror this value will be set to the\n -- spawned state object rather than spawning multiple tokens\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnTokenGroup = function(card, tokenType, tokenCount, shiftDown, subType)\n local optionPanel = optionPanelApi.getOptions()\n\n if tokenType == \"damage\" or tokenType == \"horror\" then\n TokenManager.spawnCounterToken(card, tokenType, tokenCount, shiftDown)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"enabled\" then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"custom\" and tokenCount == 0 then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n else\n TokenManager.spawnMultipleTokens(card, tokenType, tokenCount, shiftDown, subType)\n end\n end\n\n -- Spawns a single counter token and sets the value to tokenValue. Used for damage and horror\n -- tokens.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String type of token to spawn, valid values are \"damage\" and \"horror\". Other\n -- types should use spawnMultipleTokens()\n ---@param tokenValue Number Value to set the damage/horror to\n TokenManager.spawnCounterToken = function(card, tokenType, tokenValue, shiftDown)\n if tokenValue \u003c 1 or tokenValue \u003e 50 then return end\n\n local pos = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[1][1] + Vector(0, 0, shiftDown))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, tokenType, rot, function(spawned) spawned.setState(tokenValue) end)\n end\n\n TokenManager.spawnResourceCounterToken = function(card, tokenCount)\n local pos = card.positionToWorld(card.positionToLocal(card.getPosition()) + Vector(0, 0.2, -0.5))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, \"resourceCounter\", rot, function(spawned)\n spawned.call(\"updateVal\", tokenCount)\n end)\n end\n\n -- Spawns a number of tokens.\n ---@param tokenType String type of token to spawn, valid values are resource\", \"doom\", or \"clue\".\n -- Other types should use spawnCounterToken()\n ---@param tokenCount Number How many tokens to spawn\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnMultipleTokens = function(card, tokenType, tokenCount, shiftDown, subType)\n -- not checking the max at this point since clue offsets are calculated dynamically\n if tokenCount \u003c 1 then return end\n\n local offsets = {}\n if tokenType == \"clue\" then\n offsets = internal.buildClueOffsets(card, tokenCount)\n else\n -- only up to 12 offset tables defined\n if tokenCount \u003e 12 then return end\n for i = 1, tokenCount do\n offsets[i] = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[tokenCount][i])\n -- Fix the y-position for the spawn, since positionToWorld considers rotation which can\n -- have bad results for face up/down differences\n offsets[i].y = card.getPosition().y + 0.15\n end\n end\n\n if shiftDown ~= nil then\n -- Copy the offsets to make sure we don't change the static values\n local baseOffsets = offsets\n offsets = { }\n for i, baseOffset in ipairs(baseOffsets) do\n offsets[i] = baseOffset\n offsets[i][3] = offsets[i][3] + shiftDown\n end\n end\n\n if offsets == nil then\n error(\"couldn't find offsets for \" .. tokenCount .. ' tokens')\n return\n end\n\n -- handling for not provided subtype (for example when spawning from custom data helpers)\n if subType == nil then\n subType = \"\"\n end\n \n -- this is used to load the correct state for additional resource tokens (e.g. \"Ammo\")\n local callback = nil\n local stateID = stateTable[string.lower(subType)]\n if tokenType == \"resource\" and stateID ~= nil and stateID ~= 1 then\n callback = function(spawned) spawned.setState(stateID) end\n end\n\n for i = 1, tokenCount do\n TokenManager.spawnToken(offsets[i], tokenType, card.getRotation(), callback)\n end\n end\n\n -- Spawns a single token at the given global position by copying it from the template bag.\n ---@param position Global position to spawn the token\n ---@param tokenType String type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param rotation Vector Rotation to be used for the new token. Only the y-value will be used,\n -- x and z will use the default rotation from the source bag\n ---@param callback function A callback function triggered after the new token is spawned\n TokenManager.spawnToken = function(position, tokenType, rotation, callback)\n internal.initTokenTemplates()\n local loadTokenType = tokenType\n if tokenType == \"clue\" or tokenType == \"doom\" then\n loadTokenType = \"clueDoom\"\n end\n if tokenTemplates[loadTokenType] == nil then\n error(\"Unknown token type '\" .. tokenType .. \"'\")\n return\n end\n local tokenTemplate = tokenTemplates[loadTokenType]\n\n -- Take ONLY the Y-value for rotation, so we don't flip the token coming out of the bag\n local rot = Vector(tokenTemplate.Transform.rotX,\n 270,\n tokenTemplate.Transform.rotZ)\n if rotation ~= nil then\n rot.y = rotation.y\n end\n if tokenType == \"doom\" then\n rot.z = 180\n end\n\n tokenTemplate.Nickname = \"\"\n return spawnObjectData({\n data = tokenTemplate,\n position = position,\n rotation = rot,\n callback_function = callback\n })\n end\n\n -- Checks a card for metadata to maybe replenish it\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n TokenManager.maybeReplenishCard = function(card, uses, mat)\n -- TODO: support for cards with multiple uses AND replenish (as of yet, no official card needs that)\n if uses[1].count and uses[1].replenish then\n internal.replenishTokens(card, uses, mat)\n end\n end\n\n -- Delegate function to the token spawn tracker. Exists to avoid circular dependencies in some\n -- callers.\n ---@param card Object Card object to reset the tokens for\n TokenManager.resetTokensSpawned = function(card)\n tokenSpawnTrackerApi.resetTokensSpawned(card.getGUID())\n end\n\n -- Pushes new player card data into the local copy of the Data Helper player data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addPlayerCardData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n playerCardData[k] = v\n end\n end\n\n -- Pushes new location data into the local copy of the Data Helper location data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addLocationData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n locationData[k] = v\n end\n end\n\n -- Checks to see if the given card has location data in the DataHelper\n ---@param card Object Card to check for data\n ---@return Boolean True if this card has data in the helper, false otherwise\n TokenManager.hasLocationData = function(card)\n internal.initDataHelperData()\n return internal.getLocationData(card) ~= nil\n end\n\n internal.initTokenTemplates = function()\n if tokenTemplates ~= nil then\n return\n end\n tokenTemplates = { }\n local tokenSource = getObjectFromGUID(TOKEN_SOURCE_GUID)\n for _, tokenTemplate in ipairs(tokenSource.getData().ContainedObjects) do\n local tokenName = tokenTemplate.Memo\n tokenTemplates[tokenName] = tokenTemplate\n end\n end\n\n -- Copies the data from the DataHelper. Will only happen once.\n internal.initDataHelperData = function()\n if playerCardData ~= nil then\n return\n end\n local dataHelper = getObjectFromGUID(DATA_HELPER_GUID)\n playerCardData = dataHelper.getTable('PLAYER_CARD_DATA')\n locationData = dataHelper.getTable('LOCATIONS_DATA')\n end\n\n -- Spawn tokens for a card based on the uses metadata. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n internal.spawnTokensFromUses = function(card, extraUses)\n local uses = internal.getUses(card)\n if uses == nil then return end\n\n -- go through tokens to spawn\n local type, token, tokenCount\n for i, useInfo in ipairs(uses) do\n type = useInfo.type\n token = useInfo.token\n tokenCount = (useInfo.count or 0)\n + (useInfo.countPerInvestigator or 0) * playAreaApi.getInvestigatorCount()\n if extraUses ~= nil and extraUses[type] ~= nil then\n tokenCount = tokenCount + extraUses[type]\n end\n -- Shift each spawned group after the first down so they don't pile on each other\n TokenManager.spawnTokenGroup(card, token, tokenCount, (i - 1) * 0.8, type)\n end\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a card based on the data helper data. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n internal.spawnTokensFromDataHelper = function(card)\n internal.initDataHelperData()\n local playerData = internal.getPlayerCardData(card)\n if playerData ~= nil then\n internal.spawnPlayerCardTokensFromDataHelper(card, playerData)\n end\n local locationData = internal.getLocationData(card)\n if locationData ~= nil then\n internal.spawnLocationTokensFromDataHelper(card, locationData)\n end\n end\n\n -- Spawn tokens for a player card using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Player card data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnPlayerCardTokensFromDataHelper = function(card, playerData)\n token = playerData.tokenType\n tokenCount = playerData.tokenCount\n --log(\"Spawning data helper tokens for \"..card.getName()..'['..card.getDescription()..']: '..tokenCount..\"x \"..token)\n TokenManager.spawnTokenGroup(card, token, tokenCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a location using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Location data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnLocationTokensFromDataHelper = function(card, locationData)\n local clueCount = internal.getClueCountFromData(card, locationData)\n if clueCount \u003e 0 then\n TokenManager.spawnTokenGroup(card, \"clue\", clueCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n end\n\n internal.getPlayerCardData = function(card)\n return playerCardData[card.getName() .. ':' .. card.getDescription()]\n or playerCardData[card.getName()]\n end\n\n internal.getLocationData = function(card)\n return locationData[card.getName() .. '_' .. card.getGUID()] or locationData[card.getName()]\n end\n\n internal.getClueCountFromData = function(card, locationData)\n -- Return the number of clues to spawn on this location\n if locationData == nil then\n error('attempted to get clue for unexpected object: ' .. card.getName())\n return 0\n end\n\n --log(card.getName() .. ' : ' .. locationData.type .. ' : ' .. locationData.value .. ' : ' .. locationData.clueSide)\n if ((card.is_face_down and locationData.clueSide == 'back')\n or (not card.is_face_down and locationData.clueSide == 'front')) then\n if locationData.type == 'fixed' then\n return locationData.value\n elseif locationData.type == 'perPlayer' then\n return locationData.value * playAreaApi.getInvestigatorCount()\n end\n error('unexpected location type: ' .. locationData.type)\n end\n return 0\n end\n\n -- Gets the right uses structure for this card, based on metadata and face up/down state\n ---@param card Object Card to pull the uses from\n internal.getUses = function(card)\n local metadata = JSON.decode(card.getGMNotes()) or { }\n if metadata.type == \"Location\" then\n if card.is_face_down and metadata.locationBack ~= nil then\n return metadata.locationBack.uses\n elseif not card.is_face_down and metadata.locationFront ~= nil then\n return metadata.locationFront.uses\n end\n elseif not card.is_face_down then\n return metadata.uses\n end\n\n return nil\n end\n\n -- Dynamically create positions for clues on a card.\n ---@param card Object Card the clues will be placed on\n ---@param count Integer How many clues?\n ---@return Table Array of global positions to spawn the clues at\n internal.buildClueOffsets = function(card, count)\n local pos = card.getPosition()\n local cluePositions = { }\n for i = 1, count do\n local row = math.floor(1 + (i - 1) / 4)\n local column = (i - 1) % 4\n table.insert(cluePositions, Vector(pos.x + 1.5 - 0.55 * row, pos.y + 0.15, pos.z - 0.825 + 0.55 * column))\n end\n return cluePositions\n end\n\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n internal.replenishTokens = function(card, uses, mat)\n local cardPos = card.getPosition()\n\n -- don't continue for cards on the deck (Norman) or in the discard pile\n if mat.positionToLocal(cardPos).x \u003c -1 then return end\n\n -- get current amount of resource tokens on the card\n local search = internal.searchOnCard(cardPos, card.getRotation())\n local clickableResourceCounter = nil\n local foundTokens = 0\n\n for _, obj in ipairs(search) do\n local obj = obj.hit_object\n local memo = obj.getMemo()\n\n if (stateTable[memo] or 0) \u003e 0 then\n foundTokens = foundTokens + math.abs(obj.getQuantity())\n obj.destruct()\n elseif memo == \"resourceCounter\" then\n foundTokens = obj.getVar(\"val\")\n clickableResourceCounter = obj\n break\n end\n end\n\n -- this is the theoretical new amount of uses (to be checked below)\n local newCount = foundTokens + uses[1].replenish\n\n -- if there are already more uses than the replenish amount, keep them\n if foundTokens \u003e uses[1].count then\n newCount = foundTokens\n -- only replenish up until the replenish amount\n elseif newCount \u003e uses[1].count then\n newCount = uses[1].count\n end\n\n -- update the clickable counter or spawn a group of tokens\n if clickableResourceCounter then\n clickableResourceCounter.call(\"updateVal\", newCount)\n else\n TokenManager.spawnTokenGroup(card, uses[1].token, newCount, _, uses[1].type)\n end\n end\n\n -- searches on a card (standard size) and returns the result\n ---@param position Table Position of the card\n ---@param rotation Table Rotation of the card\n internal.searchOnCard = function(position, rotation)\n return Physics.cast({\n origin = position,\n direction = {0, 1, 0},\n orientation = rotation,\n type = 3,\n size = { 2.5, 0.5, 3.5 },\n max_distance = 1,\n debug = false\n })\n end\n\n return TokenManager\nend\nend)\n__bundle_register(\"core/OptionPanelApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local OptionPanelApi = {}\n\n -- loads saved options\n ---@param options Table New options table\n OptionPanelApi.loadSettings = function(options)\n return Global.call(\"loadSettings\", options)\n end\n\n -- returns option panel table\n OptionPanelApi.getOptions = function()\n return Global.getTable(\"optionPanel\")\n end\n\n return OptionPanelApi\nend\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = { }\n local PLAY_AREA_GUID = \"721ba2\"\n local INVESTIGATOR_COUNTER_GUID = \"f182ee\"\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with\n -- 'displacement_excluded'\n ---@param playerColor Color of the player requesting the shift. Used solely to send an error\n --- message in the unlikely case that the scripting zone has been deleted\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"tryObjectEnterContainer\",\n { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightCountedVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"core/OptionPanelApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local OptionPanelApi = {}\n\n -- loads saved options\n ---@param options Table New options table\n OptionPanelApi.loadSettings = function(options)\n return Global.call(\"loadSettings\", options)\n end\n\n -- returns option panel table\n OptionPanelApi.getOptions = function()\n return Global.getTable(\"optionPanel\")\n end\n\n return OptionPanelApi\nend\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getPlayArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"PlayArea\")\n end\n\n local function getInvestigatorCounter()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"InvestigatorCounter\")\n end\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getInvestigatorCounter().getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n getInvestigatorCounter().call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with 'displacement_excluded'\n ---@param playerColor Color Color of the player requesting the shift for messages\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getPlayArea().call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getPlayArea().call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getPlayArea().call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getPlayArea().call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getPlayArea().call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getPlayArea().call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getPlayArea().call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getPlayArea().call(\"tryObjectEnterContainer\", { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getPlayArea().call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getPlayArea().call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getPlayArea().call(\"countVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getPlayArea().call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getPlayArea().getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getPlayArea().call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getPlayArea().call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getPlayArea().getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\n__bundle_register(\"core/token/TokenSpawnTrackerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenSpawnTracker = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getSpawnTracker()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenSpawnTracker\")\n end\n\n TokenSpawnTracker.hasSpawnedTokens = function(cardGuid)\n return getSpawnTracker().call(\"hasSpawnedTokens\", cardGuid)\n end\n\n TokenSpawnTracker.markTokensSpawned = function(cardGuid)\n return getSpawnTracker().call(\"markTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetTokensSpawned = function(cardGuid)\n return getSpawnTracker().call(\"resetTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetAllAssetAndEvents = function()\n return getSpawnTracker().call(\"resetAllAssetAndEvents\")\n end\n\n TokenSpawnTracker.resetAllLocations = function()\n return getSpawnTracker().call(\"resetAllLocations\")\n end\n\n TokenSpawnTracker.resetAll = function()\n return getSpawnTracker().call(\"resetAll\")\n end\n\n return TokenSpawnTracker\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"util/TokenSpawnTool\")\nend)\n__bundle_register(\"util/TokenSpawnTool\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal tokenManager = require(\"core/token/TokenManager\")\nlocal TOKEN_INDEX = {}\nTOKEN_INDEX[3] = \"resourceCounter\"\nTOKEN_INDEX[4] = \"damage\"\nTOKEN_INDEX[5] = \"path\"\nTOKEN_INDEX[6] = \"horror\"\nTOKEN_INDEX[7] = \"doom\"\nTOKEN_INDEX[8] = \"clue\"\nTOKEN_INDEX[9] = \"resource\"\n\nlocal stateTable = {\n [\"resource\"] = 1,\n [\"ammo\"] = 2,\n [\"bounty\"] = 3,\n [\"charge\"] = 4,\n [\"evidence\"] = 5,\n [\"secret\"] = 6,\n [\"supply\"] = 7\n}\n\n---@param index number Index of the pressed key\n---@param playerColor string Color of the triggering player\nfunction onScriptingButtonDown(index, playerColor)\n local tokenType = TOKEN_INDEX[index]\n if not tokenType then return end\n\n local rotation = { x = 0, y = Player[playerColor].getPointerRotation(), z = 0 }\n local position = Player[playerColor].getPointerPosition() + Vector(0, 0.2, 0)\n local subType = \"\"\n local callback = nil\n\n -- check for subtype of resource based on card below\n if tokenType == \"resource\" then\n local search = Physics.cast({\n direction = { 0, -1, 0 },\n max_distance = 2,\n type = 3,\n size = { 0.1, 0.1, 0.1 },\n origin = position:setAt(\"y\", 2)\n })\n\n for _, v in ipairs(search) do\n if v.hit_object.tag == \"Card\" and not v.hit_object.is_face_down then\n local metadata = JSON.decode(v.hit_object.getGMNotes()) or {}\n local uses = metadata.uses or {}\n\n for _, useInfo in ipairs(uses) do\n if useInfo.token == \"resource\" then\n subType = useInfo.type\n break\n end\n end\n break\n end\n end\n \n -- this is used to load the correct state for additional resource tokens (e.g. \"Ammo\")\n local stateID = stateTable[string.lower(subType)]\n if stateID ~= nil and stateID ~= 1 then\n callback = function(spawned) spawned.setState(stateID) end\n end\n -- check hovered object for \"resourceCounter\" tokens and increase them instead\n elseif tokenType == \"resourceCounter\" then\n local hoverObj = Player[playerColor].getHoverObject()\n if hoverObj then\n if tokenType == hoverObj.getMemo() then\n hoverObj.call(\"addOrSubtract\")\n return\n end\n end\n -- check hovered object for \"damage\" and \"horror\" tokens and increase them instead\n elseif tokenType == \"damage\" or tokenType == \"horror\" then\n local hoverObj = Player[playerColor].getHoverObject()\n if hoverObj then\n if tokenType == hoverObj.getMemo() then\n local stateInfo = hoverObj.getStates()\n local stateId = hoverObj.getStateId()\n if stateId \u003c= #stateInfo then\n hoverObj.setState(stateId + 1)\n return\n end\n end\n end\n end\n\n tokenManager.spawnToken(position, tokenType, rotation, callback)\nend\nend)\n__bundle_register(\"core/token/TokenManager\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n local optionPanelApi = require(\"core/OptionPanelApi\")\n local playAreaApi = require(\"core/PlayAreaApi\")\n local tokenSpawnTrackerApi = require(\"core/token/TokenSpawnTrackerApi\")\n\n local PLAYER_CARD_TOKEN_OFFSETS = {\n [1] = {\n Vector(0, 3, -0.2)\n },\n [2] = {\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [3] = {\n Vector(0, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [4] = {\n Vector(0.4, 3, -0.9),\n Vector(-0.4, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [5] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [6] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2)\n },\n [7] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0, 3, 0.5)\n },\n [8] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(-0.35, 3, 0.5),\n Vector(0.35, 3, 0.5)\n },\n [9] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5)\n },\n [10] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0, 3, 1.2)\n },\n [11] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(-0.35, 3, 1.2),\n Vector(0.35, 3, 1.2)\n },\n [12] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0.7, 3, 1.2),\n Vector(0, 3, 1.2),\n Vector(-0.7, 3, 1.2)\n }\n }\n\n -- stateIDs for the multi-stated resource tokens\n local stateTable = {\n [\"resource\"] = 1,\n [\"ammo\"] = 2,\n [\"bounty\"] = 3,\n [\"charge\"] = 4,\n [\"evidence\"] = 5,\n [\"secret\"] = 6,\n [\"supply\"] = 7\n }\n\n -- Table of data extracted from the token source bag, keyed by the Memo on each token which\n -- should match the token type keys (\"resource\", \"clue\", etc)\n local tokenTemplates\n\n local playerCardData\n local locationData\n\n local TokenManager = { }\n local internal = { }\n\n -- Spawns tokens for the card. This function is built to just throw a card at it and let it do\n -- the work once a card has hit an area where it might spawn tokens. It will check to see if\n -- the card has already spawned, find appropriate data from either the uses metadata or the Data\n -- Helper, and spawn the tokens.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n TokenManager.spawnForCard = function(card, extraUses)\n if tokenSpawnTrackerApi.hasSpawnedTokens(card.getGUID()) then\n return\n end\n local metadata = JSON.decode(card.getGMNotes())\n if metadata ~= nil then\n internal.spawnTokensFromUses(card, extraUses)\n else\n internal.spawnTokensFromDataHelper(card)\n end\n end\n\n -- Spawns a set of tokens on the given card.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String Type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param tokenCount Number How many tokens to spawn. For damage or horror this value will be set to the\n -- spawned state object rather than spawning multiple tokens\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnTokenGroup = function(card, tokenType, tokenCount, shiftDown, subType)\n local optionPanel = optionPanelApi.getOptions()\n\n if tokenType == \"damage\" or tokenType == \"horror\" then\n TokenManager.spawnCounterToken(card, tokenType, tokenCount, shiftDown)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"enabled\" then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"custom\" and tokenCount == 0 then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n else\n TokenManager.spawnMultipleTokens(card, tokenType, tokenCount, shiftDown, subType)\n end\n end\n\n -- Spawns a single counter token and sets the value to tokenValue. Used for damage and horror\n -- tokens.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String type of token to spawn, valid values are \"damage\" and \"horror\". Other\n -- types should use spawnMultipleTokens()\n ---@param tokenValue Number Value to set the damage/horror to\n TokenManager.spawnCounterToken = function(card, tokenType, tokenValue, shiftDown)\n if tokenValue \u003c 1 or tokenValue \u003e 50 then return end\n\n local pos = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[1][1] + Vector(0, 0, shiftDown))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, tokenType, rot, function(spawned) spawned.setState(tokenValue) end)\n end\n\n TokenManager.spawnResourceCounterToken = function(card, tokenCount)\n local pos = card.positionToWorld(card.positionToLocal(card.getPosition()) + Vector(0, 0.2, -0.5))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, \"resourceCounter\", rot, function(spawned)\n spawned.call(\"updateVal\", tokenCount)\n end)\n end\n\n -- Spawns a number of tokens.\n ---@param tokenType String type of token to spawn, valid values are resource\", \"doom\", or \"clue\".\n -- Other types should use spawnCounterToken()\n ---@param tokenCount Number How many tokens to spawn\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnMultipleTokens = function(card, tokenType, tokenCount, shiftDown, subType)\n -- not checking the max at this point since clue offsets are calculated dynamically\n if tokenCount \u003c 1 then return end\n\n local offsets = {}\n if tokenType == \"clue\" then\n offsets = internal.buildClueOffsets(card, tokenCount)\n else\n -- only up to 12 offset tables defined\n if tokenCount \u003e 12 then return end\n for i = 1, tokenCount do\n offsets[i] = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[tokenCount][i])\n -- Fix the y-position for the spawn, since positionToWorld considers rotation which can\n -- have bad results for face up/down differences\n offsets[i].y = card.getPosition().y + 0.15\n end\n end\n\n if shiftDown ~= nil then\n -- Copy the offsets to make sure we don't change the static values\n local baseOffsets = offsets\n offsets = { }\n\n -- get a vector for the shifting (downwards local to the card)\n local shiftDownVector = Vector(0, 0, shiftDown):rotateOver(\"y\", card.getRotation().y)\n for i, baseOffset in ipairs(baseOffsets) do\n offsets[i] = baseOffset + shiftDownVector\n end\n end\n\n if offsets == nil then\n error(\"couldn't find offsets for \" .. tokenCount .. ' tokens')\n return\n end\n\n -- handling for not provided subtype (for example when spawning from custom data helpers)\n if subType == nil then\n subType = \"\"\n end\n \n -- this is used to load the correct state for additional resource tokens (e.g. \"Ammo\")\n local callback = nil\n local stateID = stateTable[string.lower(subType)]\n if tokenType == \"resource\" and stateID ~= nil and stateID ~= 1 then\n callback = function(spawned) spawned.setState(stateID) end\n end\n\n for i = 1, tokenCount do\n TokenManager.spawnToken(offsets[i], tokenType, card.getRotation(), callback)\n end\n end\n\n -- Spawns a single token at the given global position by copying it from the template bag.\n ---@param position Global position to spawn the token\n ---@param tokenType String type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param rotation Vector Rotation to be used for the new token. Only the y-value will be used,\n -- x and z will use the default rotation from the source bag\n ---@param callback function A callback function triggered after the new token is spawned\n TokenManager.spawnToken = function(position, tokenType, rotation, callback)\n internal.initTokenTemplates()\n local loadTokenType = tokenType\n if tokenType == \"clue\" or tokenType == \"doom\" then\n loadTokenType = \"clueDoom\"\n end\n if tokenTemplates[loadTokenType] == nil then\n error(\"Unknown token type '\" .. tokenType .. \"'\")\n return\n end\n local tokenTemplate = tokenTemplates[loadTokenType]\n\n -- Take ONLY the Y-value for rotation, so we don't flip the token coming out of the bag\n local rot = Vector(tokenTemplate.Transform.rotX,\n 270,\n tokenTemplate.Transform.rotZ)\n if rotation ~= nil then\n rot.y = rotation.y\n end\n if tokenType == \"doom\" then\n rot.z = 180\n end\n\n tokenTemplate.Nickname = \"\"\n return spawnObjectData({\n data = tokenTemplate,\n position = position,\n rotation = rot,\n callback_function = callback\n })\n end\n\n -- Checks a card for metadata to maybe replenish it\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n TokenManager.maybeReplenishCard = function(card, uses, mat)\n -- TODO: support for cards with multiple uses AND replenish (as of yet, no official card needs that)\n if uses[1].count and uses[1].replenish then\n internal.replenishTokens(card, uses, mat)\n end\n end\n\n -- Delegate function to the token spawn tracker. Exists to avoid circular dependencies in some\n -- callers.\n ---@param card Object Card object to reset the tokens for\n TokenManager.resetTokensSpawned = function(card)\n tokenSpawnTrackerApi.resetTokensSpawned(card.getGUID())\n end\n\n -- Pushes new player card data into the local copy of the Data Helper player data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addPlayerCardData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n playerCardData[k] = v\n end\n end\n\n -- Pushes new location data into the local copy of the Data Helper location data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addLocationData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n locationData[k] = v\n end\n end\n\n -- Checks to see if the given card has location data in the DataHelper\n ---@param card Object Card to check for data\n ---@return Boolean True if this card has data in the helper, false otherwise\n TokenManager.hasLocationData = function(card)\n internal.initDataHelperData()\n return internal.getLocationData(card) ~= nil\n end\n\n internal.initTokenTemplates = function()\n if tokenTemplates ~= nil then\n return\n end\n tokenTemplates = {}\n local tokenSource = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenSource\")\n for _, tokenTemplate in ipairs(tokenSource.getData().ContainedObjects) do\n local tokenName = tokenTemplate.Memo\n tokenTemplates[tokenName] = tokenTemplate\n end\n end\n\n -- Copies the data from the DataHelper. Will only happen once.\n internal.initDataHelperData = function()\n if playerCardData ~= nil then\n return\n end\n local dataHelper = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"DataHelper\")\n playerCardData = dataHelper.getTable('PLAYER_CARD_DATA')\n locationData = dataHelper.getTable('LOCATIONS_DATA')\n end\n\n -- Spawn tokens for a card based on the uses metadata. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n internal.spawnTokensFromUses = function(card, extraUses)\n local uses = internal.getUses(card)\n if uses == nil then return end\n\n -- go through tokens to spawn\n local tokenCount\n for i, useInfo in ipairs(uses) do\n tokenCount = (useInfo.count or 0) + (useInfo.countPerInvestigator or 0) * playAreaApi.getInvestigatorCount()\n if extraUses ~= nil and extraUses[useInfo.type] ~= nil then\n tokenCount = tokenCount + extraUses[useInfo.type]\n end\n -- Shift each spawned group after the first down so they don't pile on each other\n TokenManager.spawnTokenGroup(card, useInfo.token, tokenCount, (i - 1) * 0.8, useInfo.type)\n end\n \n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a card based on the data helper data. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n internal.spawnTokensFromDataHelper = function(card)\n internal.initDataHelperData()\n local playerData = internal.getPlayerCardData(card)\n if playerData ~= nil then\n internal.spawnPlayerCardTokensFromDataHelper(card, playerData)\n end\n local locationData = internal.getLocationData(card)\n if locationData ~= nil then\n internal.spawnLocationTokensFromDataHelper(card, locationData)\n end\n end\n\n -- Spawn tokens for a player card using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Player card data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnPlayerCardTokensFromDataHelper = function(card, playerData)\n local token = playerData.tokenType\n local tokenCount = playerData.tokenCount\n TokenManager.spawnTokenGroup(card, token, tokenCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a location using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Location data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnLocationTokensFromDataHelper = function(card, locationData)\n local clueCount = internal.getClueCountFromData(card, locationData)\n if clueCount \u003e 0 then\n TokenManager.spawnTokenGroup(card, \"clue\", clueCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n end\n\n internal.getPlayerCardData = function(card)\n return playerCardData[card.getName() .. ':' .. card.getDescription()]\n or playerCardData[card.getName()]\n end\n\n internal.getLocationData = function(card)\n return locationData[card.getName() .. '_' .. card.getGUID()] or locationData[card.getName()]\n end\n\n internal.getClueCountFromData = function(card, locationData)\n -- Return the number of clues to spawn on this location\n if locationData == nil then\n error('attempted to get clue for unexpected object: ' .. card.getName())\n return 0\n end\n\n if ((card.is_face_down and locationData.clueSide == 'back')\n or (not card.is_face_down and locationData.clueSide == 'front')) then\n if locationData.type == 'fixed' then\n return locationData.value\n elseif locationData.type == 'perPlayer' then\n return locationData.value * playAreaApi.getInvestigatorCount()\n end\n error('unexpected location type: ' .. locationData.type)\n end\n return 0\n end\n\n -- Gets the right uses structure for this card, based on metadata and face up/down state\n ---@param card Object Card to pull the uses from\n internal.getUses = function(card)\n local metadata = JSON.decode(card.getGMNotes()) or { }\n if metadata.type == \"Location\" then\n if card.is_face_down and metadata.locationBack ~= nil then\n return metadata.locationBack.uses\n elseif not card.is_face_down and metadata.locationFront ~= nil then\n return metadata.locationFront.uses\n end\n elseif not card.is_face_down then\n return metadata.uses\n end\n\n return nil\n end\n\n -- Dynamically create positions for clues on a card.\n ---@param card Object Card the clues will be placed on\n ---@param count Integer How many clues?\n ---@return Table Array of global positions to spawn the clues at\n internal.buildClueOffsets = function(card, count)\n local pos = card.getPosition()\n local cluePositions = { }\n for i = 1, count do\n local row = math.floor(1 + (i - 1) / 4)\n local column = (i - 1) % 4\n table.insert(cluePositions, Vector(pos.x + 1.5 - 0.55 * row, pos.y + 0.15, pos.z - 0.825 + 0.55 * column))\n end\n return cluePositions\n end\n\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n internal.replenishTokens = function(card, uses, mat)\n local cardPos = card.getPosition()\n\n -- don't continue for cards on the deck (Norman) or in the discard pile\n if mat.positionToLocal(cardPos).x \u003c -1 then return end\n\n -- get current amount of resource tokens on the card\n local search = internal.searchOnCard(cardPos, card.getRotation())\n local clickableResourceCounter = nil\n local foundTokens = 0\n\n for _, obj in ipairs(search) do\n local obj = obj.hit_object\n local memo = obj.getMemo()\n\n if (stateTable[memo] or 0) \u003e 0 then\n foundTokens = foundTokens + math.abs(obj.getQuantity())\n obj.destruct()\n elseif memo == \"resourceCounter\" then\n foundTokens = obj.getVar(\"val\")\n clickableResourceCounter = obj\n break\n end\n end\n\n -- this is the theoretical new amount of uses (to be checked below)\n local newCount = foundTokens + uses[1].replenish\n\n -- if there are already more uses than the replenish amount, keep them\n if foundTokens \u003e uses[1].count then\n newCount = foundTokens\n -- only replenish up until the replenish amount\n elseif newCount \u003e uses[1].count then\n newCount = uses[1].count\n end\n\n -- update the clickable counter or spawn a group of tokens\n if clickableResourceCounter then\n clickableResourceCounter.call(\"updateVal\", newCount)\n else\n TokenManager.spawnTokenGroup(card, uses[1].token, newCount, _, uses[1].type)\n end\n end\n\n -- searches on a card (standard size) and returns the result\n ---@param position Table Position of the card\n ---@param rotation Table Rotation of the card\n internal.searchOnCard = function(position, rotation)\n return Physics.cast({\n origin = position,\n direction = {0, 1, 0},\n orientation = rotation,\n type = 3,\n size = { 2.5, 0.5, 3.5 },\n max_distance = 1,\n debug = false\n })\n end\n\n return TokenManager\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Checker_white", @@ -22131,7 +22157,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Custom_Model", @@ -22475,7 +22501,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Custom_Model", @@ -22655,178 +22681,6 @@ "r": 1 }, "ContainedObjects": [ - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1655599785039299268/52DB5C3A0E600D6AECB0B851ECF90C5B3D016421/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "Challenge Scenario", - "DragSelectable": true, - "GMNotes": "scenarios/challenge_bad_blood.json", - "GUID": "451eaa", - "Grid": true, - "GridProjection": false, - "Hands": true, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Bad Blood", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 12.25, - "posY": 1.466, - "posZ": 3.986, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1849293764610824071/BD70BFDA6DED25221D6DC1BE60C8CE11B165F848/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "Challenge Scenario", - "DragSelectable": true, - "GMNotes": "scenarios/challenge_red_tide_rising.json", - "GUID": "5302f2", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Red Tide Rising", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 12.25, - "posY": 1.459, - "posZ": -20.014, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, { "AltLookAngle": { "x": 0, @@ -22900,9 +22754,9 @@ "Sticky": true, "Tooltip": true, "Transform": { - "posX": 12.252, - "posY": 1.468, - "posZ": 11.986, + "posX": 12.25, + "posY": 1.481, + "posZ": 19.986, "rotX": 0, "rotY": 270, "rotZ": 0, @@ -22960,7 +22814,7 @@ "SpecularIntensity": 0, "SpecularSharpness": 2 }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1655599785039304850/852232605656B7DD6577C475A1988491D3378506/", + "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1655599785039299268/52DB5C3A0E600D6AECB0B851ECF90C5B3D016421/", "MaterialIndex": 3, "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", "NormalURL": "", @@ -22968,8 +22822,8 @@ }, "Description": "Challenge Scenario", "DragSelectable": true, - "GMNotes": "scenarios/challenge_read_or_die.json", - "GUID": "9e73fa", + "GMNotes": "scenarios/challenge_bad_blood.json", + "GUID": "451eaa", "Grid": true, "GridProjection": false, "Hands": true, @@ -22977,18 +22831,18 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Custom_Model", - "Nickname": "Read or Die", + "Nickname": "Bad Blood", "Snap": true, "Sticky": true, "Tooltip": true, "Transform": { - "posX": 12.25, - "posY": 1.461, - "posZ": -12.014, + "posX": 12.252, + "posY": 1.481, + "posZ": 11.986, "rotX": 0, "rotY": 270, "rotZ": 0, @@ -23073,7 +22927,93 @@ "Tooltip": true, "Transform": { "posX": 12.25, - "posY": 1.463, + "posY": 1.481, + "posZ": 3.986, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 2.21, + "scaleY": 0.46, + "scaleZ": 2.42 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "AttachedDecals": [ + { + "CustomDecal": { + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", + "Name": "dunwich_back", + "Size": 7.4 + }, + "Transform": { + "posX": 0, + "posY": 0, + "posZ": 0, + "rotX": 270, + "rotY": 0, + "rotZ": 0, + "scaleX": 2, + "scaleY": 2, + "scaleZ": 2 + } + } + ], + "Autoraise": true, + "ColorDiffuse": { + "a": 0.27451, + "b": 1, + "g": 1, + "r": 1 + }, + "CustomMesh": { + "CastShadows": true, + "ColliderURL": "", + "Convex": true, + "CustomShader": { + "FresnelStrength": 0, + "SpecularColor": { + "b": 1, + "g": 1, + "r": 1 + }, + "SpecularIntensity": 0, + "SpecularSharpness": 2 + }, + "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/2115061845788468343/B7611EC7DCD2008B87D6518EBEFF0AD36EFE5B54/", + "MaterialIndex": 3, + "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", + "NormalURL": "", + "TypeIndex": 0 + }, + "Description": "Challenge Scenario", + "DragSelectable": true, + "GMNotes": "scenarios/challenge_laid_to_rest.json", + "GUID": "e2dd57", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Custom_Model", + "Nickname": "Laid to Rest", + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 12.25, + "posY": 1.481, "posZ": -4.014, "rotX": 0, "rotY": 270, @@ -23084,6 +23024,178 @@ }, "Value": 0, "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "AttachedDecals": [ + { + "CustomDecal": { + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", + "Name": "dunwich_back", + "Size": 7.4 + }, + "Transform": { + "posX": -0.0021877822, + "posY": -0.08963572, + "posZ": -0.00288731651, + "rotX": 270, + "rotY": 359.869568, + "rotZ": 0, + "scaleX": 2.00000215, + "scaleY": 2.00000238, + "scaleZ": 2.00000262 + } + } + ], + "Autoraise": true, + "ColorDiffuse": { + "a": 0.27451, + "b": 1, + "g": 1, + "r": 1 + }, + "CustomMesh": { + "CastShadows": true, + "ColliderURL": "", + "Convex": true, + "CustomShader": { + "FresnelStrength": 0, + "SpecularColor": { + "b": 1, + "g": 1, + "r": 1 + }, + "SpecularIntensity": 0, + "SpecularSharpness": 2 + }, + "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1655599785039304850/852232605656B7DD6577C475A1988491D3378506/", + "MaterialIndex": 3, + "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", + "NormalURL": "", + "TypeIndex": 0 + }, + "Description": "Challenge Scenario", + "DragSelectable": true, + "GMNotes": "scenarios/challenge_read_or_die.json", + "GUID": "9e73fa", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Custom_Model", + "Nickname": "Read or Die", + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 12.25, + "posY": 1.481, + "posZ": -12.014, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 2.21, + "scaleY": 0.46, + "scaleZ": 2.42 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "AttachedDecals": [ + { + "CustomDecal": { + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", + "Name": "dunwich_back", + "Size": 7.4 + }, + "Transform": { + "posX": -0.0021877822, + "posY": -0.08963572, + "posZ": -0.00288731651, + "rotX": 270, + "rotY": 359.869568, + "rotZ": 0, + "scaleX": 2.00000215, + "scaleY": 2.00000238, + "scaleZ": 2.00000262 + } + } + ], + "Autoraise": true, + "ColorDiffuse": { + "a": 0.27451, + "b": 1, + "g": 1, + "r": 1 + }, + "CustomMesh": { + "CastShadows": true, + "ColliderURL": "", + "Convex": true, + "CustomShader": { + "FresnelStrength": 0, + "SpecularColor": { + "b": 1, + "g": 1, + "r": 1 + }, + "SpecularIntensity": 0, + "SpecularSharpness": 2 + }, + "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1849293764610824071/BD70BFDA6DED25221D6DC1BE60C8CE11B165F848/", + "MaterialIndex": 3, + "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", + "NormalURL": "", + "TypeIndex": 0 + }, + "Description": "Challenge Scenario", + "DragSelectable": true, + "GMNotes": "scenarios/challenge_red_tide_rising.json", + "GUID": "5302f2", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Custom_Model", + "Nickname": "Red Tide Rising", + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 12.25, + "posY": 1.481, + "posZ": -20.014, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 2.21, + "scaleY": 0.46, + "scaleZ": 2.42 + }, + "Value": 0, + "XmlUI": "" } ], "CustomMesh": { @@ -23118,7 +23230,7 @@ "LayoutGroupSortIndex": 0, "Locked": false, "LuaScript": "-- Utility memory bag by Directsun\r\n-- Version 2.5.2\r\n-- Fork of Memory Bag 2.0 by MrStump\r\n\r\nfunction updateSave()\r\n local data_to_save = {[\"ml\"]=memoryList}\r\n saved_data = JSON.encode(data_to_save)\r\n self.script_state = saved_data\r\nend\r\n\r\nfunction combineMemoryFromBagsWithin()\r\n local bagObjList = self.getObjects()\r\n for _, bagObj in ipairs(bagObjList) do\r\n local data = bagObj.lua_script_state\r\n if data ~= nil then\r\n local j = JSON.decode(data)\r\n if j ~= nil and j.ml ~= nil then\r\n for guid, entry in pairs(j.ml) do\r\n memoryList[guid] = entry\r\n end\r\n end\r\n end\r\n end\r\nend\r\n\r\nfunction updateMemoryWithMoves()\r\n memoryList = memoryListBackup\r\n --get the first transposed object's coordinates\r\n local obj = getObjectFromGUID(moveGuid)\r\n\r\n -- p1 is where needs to go, p2 is where it was\r\n local refObjPos = memoryList[moveGuid].pos\r\n local deltaPos = findOffsetDistance(obj.getPosition(), refObjPos, nil)\r\n local movedRotation = obj.getRotation()\r\n for guid, entry in pairs(memoryList) do\r\n memoryList[guid].pos.x = entry.pos.x - deltaPos.x\r\n memoryList[guid].pos.y = entry.pos.y - deltaPos.y\r\n memoryList[guid].pos.z = entry.pos.z - deltaPos.z\r\n -- memoryList[guid].rot.x = movedRotation.x\r\n -- memoryList[guid].rot.y = movedRotation.y\r\n -- memoryList[guid].rot.z = movedRotation.z\r\n end\r\n\r\n --theList[obj.getGUID()] = {\r\n -- pos={x=round(pos.x,4), y=round(pos.y,4), z=round(pos.z,4)},\r\n -- rot={x=round(rot.x,4), y=round(rot.y,4), z=round(rot.z,4)},\r\n -- lock=obj.getLock()\r\n --}\r\n moveList = {}\r\nend\r\n\r\nfunction onload(saved_data)\r\n fresh = true\r\n if saved_data ~= \"\" then\r\n local loaded_data = JSON.decode(saved_data)\r\n --Set up information off of loaded_data\r\n memoryList = loaded_data.ml\r\n else\r\n --Set up information for if there is no saved saved data\r\n memoryList = {}\r\n end\r\n\r\n moveList = {}\r\n moveGuid = nil\r\n\r\n if next(memoryList) == nil then\r\n createSetupButton()\r\n else\r\n fresh = false\r\n createMemoryActionButtons()\r\n end\r\nend\r\n\r\n\r\n--Beginning Setup\r\n\r\n\r\n--Make setup button\r\nfunction createSetupButton()\r\n self.createButton({\r\n label=\"Setup\", click_function=\"buttonClick_setup\", function_owner=self,\r\n position={0,0.1,-6}, rotation={0,0,0}, height=500, width=1200,\r\n font_size=350, color={0,0,0}, font_color={1,1,1}\r\n })\r\nend\r\n\r\n--Triggered by Transpose button\r\nfunction buttonClick_transpose()\r\n moveGuid = nil\r\n broadcastToAll(\"Select one object and move it- all objects will move relative to the new location\", {0.75, 0.75, 1})\r\n memoryListBackup = duplicateTable(memoryList)\r\n memoryList = {}\r\n moveList = {}\r\n self.clearButtons()\r\n createButtonsOnAllObjects(true)\r\n createSetupActionButtons(true)\r\nend\r\n\r\n--Triggered by setup button,\r\nfunction buttonClick_setup()\r\n memoryListBackup = duplicateTable(memoryList)\r\n memoryList = {}\r\n self.clearButtons()\r\n createButtonsOnAllObjects(false)\r\n createSetupActionButtons(false)\r\nend\r\n\r\nfunction getAllObjectsInMemory()\r\n local objTable = {}\r\n local curObj = {}\r\n\r\n for guid in pairs(memoryListBackup) do\r\n curObj = getObjectFromGUID(guid)\r\n table.insert(objTable, curObj)\r\n end\r\n\r\n return objTable\r\n -- return getAllObjects()\r\nend\r\n\r\n--Creates selection buttons on objects\r\nfunction createButtonsOnAllObjects(move)\r\n local howManyButtons = 0\r\n\r\n local objsToHaveButtons = {}\r\n if move == true then\r\n objsToHaveButtons = getAllObjectsInMemory()\r\n else\r\n objsToHaveButtons = getAllObjects()\r\n end\r\n\r\n for _, obj in ipairs(objsToHaveButtons) do\r\n if obj ~= self then\r\n local dummyIndex = howManyButtons\r\n --On a normal bag, the button positions aren't the same size as the bag.\r\n globalScaleFactor = 1 * 1/self.getScale().x\r\n --Super sweet math to set button positions\r\n local selfPos = self.getPosition()\r\n local objPos = obj.getPosition()\r\n local deltaPos = findOffsetDistance(selfPos, objPos, obj)\r\n local objPos = rotateLocalCoordinates(deltaPos, self)\r\n objPos.x = -objPos.x * globalScaleFactor\r\n objPos.y = objPos.y * globalScaleFactor + 4\r\n objPos.z = objPos.z * globalScaleFactor\r\n --Offset rotation of bag\r\n local rot = self.getRotation()\r\n rot.y = -rot.y + 180\r\n --Create function\r\n local funcName = \"selectButton_\" .. howManyButtons\r\n local func = function() buttonClick_selection(dummyIndex, obj, move) end\r\n local color = {0.75,0.25,0.25,0.6}\r\n local colorMove = {0,0,1,0.6}\r\n if move == true then\r\n color = colorMove\r\n end\r\n self.setVar(funcName, func)\r\n self.createButton({\r\n click_function=funcName, function_owner=self,\r\n position=objPos, rotation=rot, height=1000, width=1000,\r\n color=color,\r\n })\r\n howManyButtons = howManyButtons + 1\r\n end\r\n end\r\nend\r\n\r\n--Creates submit and cancel buttons\r\nfunction createSetupActionButtons(move)\r\n self.createButton({\r\n label=\"Cancel\", click_function=\"buttonClick_cancel\", function_owner=self,\r\n position={-1.25,0.1,-6}, rotation={0,0,0}, height=500, width=1200,\r\n font_size=350, color={0,0,0}, font_color={1,1,1}\r\n })\r\n\r\n self.createButton({\r\n label=\"Submit\", click_function=\"buttonClick_submit\", function_owner=self,\r\n position={-1.25,0.3,-7}, rotation={0,0,0}, height=500, width=1200,\r\n font_size=350, color={0,0,0}, font_color={1,1,1}\r\n })\r\n\r\n if move == false then\r\n self.createButton({\r\n label=\"Add\", click_function=\"buttonClick_add\", function_owner=self,\r\n position={1.25,0.3,-6}, rotation={0,0,0}, height=500, width=1200,\r\n font_size=350, color={0,0,0}, font_color={0.25,1,0.25}\r\n })\r\n\r\n if fresh == false then\r\n self.createButton({\r\n label=\"Set New\", click_function=\"buttonClick_setNew\", function_owner=self,\r\n position={1.25,0.3,-8}, rotation={0,0,0}, height=500, width=1200,\r\n font_size=350, color={0,0,0}, font_color={0.75,0.75,1}\r\n })\r\n self.createButton({\r\n label=\"Remove\", click_function=\"buttonClick_remove\", function_owner=self,\r\n position={1.25,0.3,-7}, rotation={0,0,0}, height=500, width=1200,\r\n font_size=350, color={0,0,0}, font_color={1,0.25,0.25}\r\n })\r\n end\r\n end\r\n\r\n self.createButton({\r\n label=\"Reset\", click_function=\"buttonClick_reset\", function_owner=self,\r\n position={-1.25,0.3,-8}, rotation={0,0,0}, height=500, width=1200,\r\n font_size=350, color={0,0,0}, font_color={1,1,1}\r\n })\r\nend\r\n\r\n\r\n--During Setup\r\n\r\n\r\n--Checks or unchecks buttons\r\nfunction buttonClick_selection(index, obj, move)\r\n local colorMove = {0,0,1,0.6}\r\n local color = {0,1,0,0.6}\r\n\r\n previousGuid = selectedGuid\r\n selectedGuid = obj.getGUID()\r\n\r\n theList = memoryList\r\n if move == true then\r\n theList = moveList\r\n if previousGuid ~= nil and previousGuid ~= selectedGuid then\r\n local prevObj = getObjectFromGUID(previousGuid)\r\n prevObj.highlightOff()\r\n self.editButton({index=previousIndex, color=colorMove})\r\n theList[previousGuid] = nil\r\n end\r\n previousIndex = index\r\n end\r\n\r\n if theList[selectedGuid] == nil then\r\n self.editButton({index=index, color=color})\r\n --Adding pos/rot to memory table\r\n local pos, rot = obj.getPosition(), obj.getRotation()\r\n --I need to add it like this or it won't save due to indexing issue\r\n theList[obj.getGUID()] = {\r\n pos={x=round(pos.x,4), y=round(pos.y,4), z=round(pos.z,4)},\r\n rot={x=round(rot.x,4), y=round(rot.y,4), z=round(rot.z,4)},\r\n lock=obj.getLock()\r\n }\r\n obj.highlightOn({0,1,0})\r\n else\r\n color = {0.75,0.25,0.25,0.6}\r\n if move == true then\r\n color = colorMove\r\n end\r\n self.editButton({index=index, color=color})\r\n theList[obj.getGUID()] = nil\r\n obj.highlightOff()\r\n end\r\nend\r\n\r\n--Cancels selection process\r\nfunction buttonClick_cancel()\r\n memoryList = memoryListBackup\r\n moveList = {}\r\n self.clearButtons()\r\n if next(memoryList) == nil then\r\n createSetupButton()\r\n else\r\n createMemoryActionButtons()\r\n end\r\n removeAllHighlights()\r\n broadcastToAll(\"Selection Canceled\", {1,1,1})\r\n moveGuid = nil\r\nend\r\n\r\n--Saves selections\r\nfunction buttonClick_submit()\r\n fresh = false\r\n if next(moveList) ~= nil then\r\n for guid in pairs(moveList) do\r\n moveGuid = guid\r\n end\r\n if memoryListBackup[moveGuid] == nil then\r\n broadcastToAll(\"Item selected for moving is not already in memory\", {1, 0.25, 0.25})\r\n else\r\n broadcastToAll(\"Moving all items in memory relative to new objects position!\", {0.75, 0.75, 1})\r\n self.clearButtons()\r\n createMemoryActionButtons()\r\n local count = 0\r\n for guid in pairs(moveList) do\r\n moveGuid = guid\r\n count = count + 1\r\n local obj = getObjectFromGUID(guid)\r\n if obj ~= nil then obj.highlightOff() end\r\n end\r\n updateMemoryWithMoves()\r\n updateSave()\r\n buttonClick_place()\r\n end\r\n elseif next(memoryList) == nil and moveGuid == nil then\r\n memoryList = memoryListBackup\r\n broadcastToAll(\"No selections made.\", {0.75, 0.25, 0.25})\r\n end\r\n combineMemoryFromBagsWithin()\r\n self.clearButtons()\r\n createMemoryActionButtons()\r\n local count = 0\r\n for guid in pairs(memoryList) do\r\n count = count + 1\r\n local obj = getObjectFromGUID(guid)\r\n if obj ~= nil then obj.highlightOff() end\r\n end\r\n broadcastToAll(count..\" Objects Saved\", {1,1,1})\r\n updateSave()\r\n moveGuid = nil\r\nend\r\n\r\nfunction combineTables(first_table, second_table)\r\n for k,v in pairs(second_table) do first_table[k] = v end\r\nend\r\n\r\nfunction buttonClick_add()\r\n fresh = false\r\n combineTables(memoryList, memoryListBackup)\r\n broadcastToAll(\"Adding internal bags and selections to existing memory\", {0.25, 0.75, 0.25})\r\n combineMemoryFromBagsWithin()\r\n self.clearButtons()\r\n createMemoryActionButtons()\r\n local count = 0\r\n for guid in pairs(memoryList) do\r\n count = count + 1\r\n local obj = getObjectFromGUID(guid)\r\n if obj ~= nil then obj.highlightOff() end\r\n end\r\n broadcastToAll(count..\" Objects Saved\", {1,1,1})\r\n updateSave()\r\nend\r\n\r\nfunction buttonClick_remove()\r\n broadcastToAll(\"Removing Selected Entries From Memory\", {1.0, 0.25, 0.25})\r\n self.clearButtons()\r\n createMemoryActionButtons()\r\n local count = 0\r\n for guid in pairs(memoryList) do\r\n count = count + 1\r\n memoryListBackup[guid] = nil\r\n local obj = getObjectFromGUID(guid)\r\n if obj ~= nil then obj.highlightOff() end\r\n end\r\n broadcastToAll(count..\" Objects Removed\", {1,1,1})\r\n memoryList = memoryListBackup\r\n updateSave()\r\nend\r\n\r\nfunction buttonClick_setNew()\r\n broadcastToAll(\"Setting new position relative to items in memory\", {0.75, 0.75, 1})\r\n self.clearButtons()\r\n createMemoryActionButtons()\r\n local count = 0\r\n for _, obj in ipairs(getAllObjects()) do\r\n guid = obj.guid\r\n if memoryListBackup[guid] ~= nil then\r\n count = count + 1\r\n memoryListBackup[guid].pos = obj.getPosition()\r\n memoryListBackup[guid].rot = obj.getRotation()\r\n memoryListBackup[guid].lock = obj.getLock()\r\n end\r\n end\r\n broadcastToAll(count..\" Objects Saved\", {1,1,1})\r\n memoryList = memoryListBackup\r\n updateSave()\r\nend\r\n\r\n--Resets bag to starting status\r\nfunction buttonClick_reset()\r\n fresh = true\r\n memoryList = {}\r\n self.clearButtons()\r\n createSetupButton()\r\n removeAllHighlights()\r\n broadcastToAll(\"Tool Reset\", {1,1,1})\r\n updateSave()\r\nend\r\n\r\n\r\n--After Setup\r\n\r\n\r\n--Creates recall and place buttons\r\nfunction createMemoryActionButtons()\r\n self.createButton({\r\n label=\"Place\", click_function=\"buttonClick_place\", function_owner=self,\r\n position={1.35,1,6}, rotation={0,0,0}, height=500, width=1200,\r\n font_size=350, color={0,0,0}, font_color={1,1,1}\r\n })\r\n self.createButton({\r\n label=\"Recall\", click_function=\"buttonClick_recall\", function_owner=self,\r\n position={-1.25,1,6}, rotation={0,0,0}, height=500, width=1200,\r\n font_size=350, color={0,0,0}, font_color={1,1,1}\r\n })\r\n self.createButton({\r\n label=\"Setup\", click_function=\"buttonClick_setup\", function_owner=self,\r\n position={0,0.1,-6}, rotation={0,0,0}, height=500, width=1200,\r\n font_size=350, color={0,0,0}, font_color={1,1,1}\r\n })\r\n--- self.createButton({\r\n--- label=\"Move\", click_function=\"buttonClick_transpose\", function_owner=self,\r\n--- position={-2.8,0.3,0}, rotation={0,0,0}, height=350, width=800,\r\n--- font_size=250, color={0,0,0}, font_color={0.75,0.75,1}\r\n--- })\r\nend\r\n\r\n--Sends objects from bag/table to their saved position/rotation\r\nfunction buttonClick_place()\r\n local bagObjList = self.getObjects()\r\n for guid, entry in pairs(memoryList) do\r\n local obj = getObjectFromGUID(guid)\r\n --If obj is out on the table, move it to the saved pos/rot\r\n if obj ~= nil then\r\n obj.setPositionSmooth(entry.pos)\r\n obj.setRotationSmooth(entry.rot)\r\n obj.setLock(entry.lock)\r\n else\r\n --If obj is inside of the bag\r\n for _, bagObj in ipairs(bagObjList) do\r\n if bagObj.guid == guid then\r\n local item = self.takeObject({\r\n guid=guid, position=entry.pos, rotation=entry.rot, smooth=false\r\n })\r\n item.setLock(entry.lock)\r\n break\r\n end\r\n end\r\n end\r\n end\r\n broadcastToAll(\"Objects Placed\", {1,1,1})\r\nend\r\n\r\n--Recalls objects to bag from table\r\nfunction buttonClick_recall()\r\n for guid, entry in pairs(memoryList) do\r\n local obj = getObjectFromGUID(guid)\r\n if obj ~= nil then self.putObject(obj) end\r\n end\r\n broadcastToAll(\"Objects Recalled\", {1,1,1})\r\nend\r\n\r\n\r\n--Utility functions\r\n\r\n\r\n--Find delta (difference) between 2 x/y/z coordinates\r\nfunction findOffsetDistance(p1, p2, obj)\r\n local yOffset = 0\r\n if obj ~= nil then\r\n local bounds = obj.getBounds()\r\n yOffset = (bounds.size.y - bounds.offset.y)\r\n end\r\n local deltaPos = {}\r\n deltaPos.x = (p2.x-p1.x)\r\n deltaPos.y = (p2.y-p1.y) + yOffset\r\n deltaPos.z = (p2.z-p1.z)\r\n return deltaPos\r\nend\r\n\r\n--Used to rotate a set of coordinates by an angle\r\nfunction rotateLocalCoordinates(desiredPos, obj)\r\n\tlocal objPos, objRot = obj.getPosition(), obj.getRotation()\r\n local angle = math.rad(objRot.y)\r\n\tlocal x = desiredPos.x * math.cos(angle) - desiredPos.z * math.sin(angle)\r\n\tlocal z = desiredPos.x * math.sin(angle) + desiredPos.z * math.cos(angle)\r\n\t--return {x=objPos.x+x, y=objPos.y+desiredPos.y, z=objPos.z+z}\r\n return {x=x, y=desiredPos.y, z=z}\r\nend\r\n\r\nfunction rotateMyCoordinates(desiredPos, obj)\r\n\tlocal angle = math.rad(obj.getRotation().y)\r\n local x = desiredPos.x * math.sin(angle)\r\n\tlocal z = desiredPos.z * math.cos(angle)\r\n return {x=x, y=desiredPos.y, z=z}\r\nend\r\n\r\n--Coroutine delay, in seconds\r\nfunction wait(time)\r\n local start = os.time()\r\n repeat coroutine.yield(0) until os.time() \u003e start + time\r\nend\r\n\r\n--Duplicates a table (needed to prevent it making reference to the same objects)\r\nfunction duplicateTable(oldTable)\r\n local newTable = {}\r\n for k, v in pairs(oldTable) do\r\n newTable[k] = v\r\n end\r\n return newTable\r\nend\r\n\r\n--Moves scripted highlight from all objects\r\nfunction removeAllHighlights()\r\n for _, obj in ipairs(getAllObjects()) do\r\n obj.highlightOff()\r\n end\r\nend\r\n\r\n--Round number (num) to the Nth decimal (dec)\r\nfunction round(num, dec)\r\n local mult = 10^(dec or 0)\r\n return math.floor(num * mult + 0.5) / mult\r\nend\r", - "LuaScriptState": "{\"ml\":{\"451eaa\":{\"lock\":false,\"pos\":{\"x\":12.2499580383301,\"y\":1.46560525894165,\"z\":3.98636198043823},\"rot\":{\"x\":359.920135498047,\"y\":269.999908447266,\"z\":0.016873624175787}},\"5302f2\":{\"lock\":false,\"pos\":{\"x\":12.2504663467407,\"y\":1.45853757858276,\"z\":-20.013650894165},\"rot\":{\"x\":359.920135498047,\"y\":270.00146484375,\"z\":0.0168716721236706}},\"72ab92\":{\"lock\":false,\"pos\":{\"x\":12.2520532608032,\"y\":1.4679582118988,\"z\":11.9863719940186},\"rot\":{\"x\":359.920135498047,\"y\":270,\"z\":0.0168737415224314}},\"9e73fa\":{\"lock\":false,\"pos\":{\"x\":12.2500581741333,\"y\":1.46089386940002,\"z\":-12.0136384963989},\"rot\":{\"x\":359.920135498047,\"y\":269.999847412109,\"z\":0.0168744903057814}},\"cc7eb3\":{\"lock\":false,\"pos\":{\"x\":12.2495565414429,\"y\":1.46325027942657,\"z\":-4.01364088058472},\"rot\":{\"x\":359.920135498047,\"y\":269.999908447266,\"z\":0.0168744102120399}}}}\r", + "LuaScriptState": "{\"ml\":{\"451eaa\":{\"lock\":false,\"pos\":{\"x\":12.252,\"y\":1.4815,\"z\":11.986},\"rot\":{\"x\":0,\"y\":269.9999,\"z\":0}},\"5302f2\":{\"lock\":false,\"pos\":{\"x\":12.2505,\"y\":1.4815,\"z\":-20.0137},\"rot\":{\"x\":0,\"y\":270.0014,\"z\":0}},\"72ab92\":{\"lock\":false,\"pos\":{\"x\":12.25,\"y\":1.4815,\"z\":19.986},\"rot\":{\"x\":0,\"y\":269.9999,\"z\":0}},\"9e73fa\":{\"lock\":false,\"pos\":{\"x\":12.2501,\"y\":1.4815,\"z\":-12.0137},\"rot\":{\"x\":0,\"y\":269.9998,\"z\":0}},\"cc7eb3\":{\"lock\":false,\"pos\":{\"x\":12.25,\"y\":1.4815,\"z\":3.986},\"rot\":{\"x\":0,\"y\":269.9999,\"z\":0}},\"e2dd57\":{\"lock\":false,\"pos\":{\"x\":12.25,\"y\":1.4815,\"z\":-4.014},\"rot\":{\"x\":0,\"y\":270,\"z\":0}}}}", "MaterialIndex": -1, "MeasureMovement": false, "MeshIndex": -1, @@ -23129,7 +23241,7 @@ "Tooltip": true, "Transform": { "posX": -9, - "posY": 1.481, + "posY": 1.482, "posZ": -76, "rotX": 0, "rotY": 270, @@ -23709,7 +23821,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/Tarotcard\")\nend)\n__bundle_register(\"playercards/Tarotcard\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- context menu to manually fix rotation\nfunction onLoad()\n self.addContextMenuItem(\"Rotate Preview\", rotatePreview)\n self.addContextMenuItem(\"Rotate Card+Preview\", rotateSelfAndPreview)\nend\n\n-- rotates the alt_view_angle\nfunction rotatePreview()\n local angle = self.alt_view_angle\n if angle.y == 0 then\n angle.y = 180\n else\n angle.y = 0\n end\n self.alt_view_angle = angle\nend\n\n-- rotates this card and the preview\nfunction rotateSelfAndPreview()\n self.setRotationSmooth(self.getRotation() + Vector(0, 180, 0))\n rotatePreview()\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playercards/Tarotcard\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- context menu to manually fix rotation\nfunction onLoad()\n self.addContextMenuItem(\"Rotate Preview\", rotatePreview)\n self.addContextMenuItem(\"Rotate Card+Preview\", rotateSelfAndPreview)\nend\n\n-- rotates the alt_view_angle\nfunction rotatePreview()\n local angle = self.alt_view_angle\n if angle.y == 0 then\n angle.y = 180\n else\n angle.y = 0\n end\n self.alt_view_angle = angle\nend\n\n-- rotates this card and the preview\nfunction rotateSelfAndPreview()\n self.setRotationSmooth(self.getRotation() + Vector(0, 180, 0))\n rotatePreview()\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/Tarotcard\")\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -24405,7 +24517,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playercards/Tarotcard\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- context menu to manually fix rotation\nfunction onLoad()\n self.addContextMenuItem(\"Rotate Preview\", rotatePreview)\n self.addContextMenuItem(\"Rotate Card+Preview\", rotateSelfAndPreview)\nend\n\n-- rotates the alt_view_angle\nfunction rotatePreview()\n local angle = self.alt_view_angle\n if angle.y == 0 then\n angle.y = 180\n else\n angle.y = 0\n end\n self.alt_view_angle = angle\nend\n\n-- rotates this card and the preview\nfunction rotateSelfAndPreview()\n self.setRotationSmooth(self.getRotation() + Vector(0, 180, 0))\n rotatePreview()\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/Tarotcard\")\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/Tarotcard\")\nend)\n__bundle_register(\"playercards/Tarotcard\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- context menu to manually fix rotation\nfunction onLoad()\n self.addContextMenuItem(\"Rotate Preview\", rotatePreview)\n self.addContextMenuItem(\"Rotate Card+Preview\", rotateSelfAndPreview)\nend\n\n-- rotates the alt_view_angle\nfunction rotatePreview()\n local angle = self.alt_view_angle\n if angle.y == 0 then\n angle.y = 180\n else\n angle.y = 0\n end\n self.alt_view_angle = angle\nend\n\n-- rotates this card and the preview\nfunction rotateSelfAndPreview()\n self.setRotationSmooth(self.getRotation() + Vector(0, 180, 0))\n rotatePreview()\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -24781,7 +24893,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playercards/Tarotcard\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- context menu to manually fix rotation\nfunction onLoad()\n self.addContextMenuItem(\"Rotate Preview\", rotatePreview)\n self.addContextMenuItem(\"Rotate Card+Preview\", rotateSelfAndPreview)\nend\n\n-- rotates the alt_view_angle\nfunction rotatePreview()\n local angle = self.alt_view_angle\n if angle.y == 0 then\n angle.y = 180\n else\n angle.y = 0\n end\n self.alt_view_angle = angle\nend\n\n-- rotates this card and the preview\nfunction rotateSelfAndPreview()\n self.setRotationSmooth(self.getRotation() + Vector(0, 180, 0))\n rotatePreview()\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/Tarotcard\")\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/Tarotcard\")\nend)\n__bundle_register(\"playercards/Tarotcard\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- context menu to manually fix rotation\nfunction onLoad()\n self.addContextMenuItem(\"Rotate Preview\", rotatePreview)\n self.addContextMenuItem(\"Rotate Card+Preview\", rotateSelfAndPreview)\nend\n\n-- rotates the alt_view_angle\nfunction rotatePreview()\n local angle = self.alt_view_angle\n if angle.y == 0 then\n angle.y = 180\n else\n angle.y = 0\n end\n self.alt_view_angle = angle\nend\n\n-- rotates this card and the preview\nfunction rotateSelfAndPreview()\n self.setRotationSmooth(self.getRotation() + Vector(0, 180, 0))\n rotatePreview()\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -24839,7 +24951,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/Tarotcard\")\nend)\n__bundle_register(\"playercards/Tarotcard\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- context menu to manually fix rotation\nfunction onLoad()\n self.addContextMenuItem(\"Rotate Preview\", rotatePreview)\n self.addContextMenuItem(\"Rotate Card+Preview\", rotateSelfAndPreview)\nend\n\n-- rotates the alt_view_angle\nfunction rotatePreview()\n local angle = self.alt_view_angle\n if angle.y == 0 then\n angle.y = 180\n else\n angle.y = 0\n end\n self.alt_view_angle = angle\nend\n\n-- rotates this card and the preview\nfunction rotateSelfAndPreview()\n self.setRotationSmooth(self.getRotation() + Vector(0, 180, 0))\n rotatePreview()\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playercards/Tarotcard\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- context menu to manually fix rotation\nfunction onLoad()\n self.addContextMenuItem(\"Rotate Preview\", rotatePreview)\n self.addContextMenuItem(\"Rotate Card+Preview\", rotateSelfAndPreview)\nend\n\n-- rotates the alt_view_angle\nfunction rotatePreview()\n local angle = self.alt_view_angle\n if angle.y == 0 then\n angle.y = 180\n else\n angle.y = 0\n end\n self.alt_view_angle = angle\nend\n\n-- rotates this card and the preview\nfunction rotateSelfAndPreview()\n self.setRotationSmooth(self.getRotation() + Vector(0, 180, 0))\n rotatePreview()\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/Tarotcard\")\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -25419,7 +25531,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/Tarotcard\")\nend)\n__bundle_register(\"playercards/Tarotcard\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- context menu to manually fix rotation\nfunction onLoad()\n self.addContextMenuItem(\"Rotate Preview\", rotatePreview)\n self.addContextMenuItem(\"Rotate Card+Preview\", rotateSelfAndPreview)\nend\n\n-- rotates the alt_view_angle\nfunction rotatePreview()\n local angle = self.alt_view_angle\n if angle.y == 0 then\n angle.y = 180\n else\n angle.y = 0\n end\n self.alt_view_angle = angle\nend\n\n-- rotates this card and the preview\nfunction rotateSelfAndPreview()\n self.setRotationSmooth(self.getRotation() + Vector(0, 180, 0))\n rotatePreview()\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playercards/Tarotcard\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- context menu to manually fix rotation\nfunction onLoad()\n self.addContextMenuItem(\"Rotate Preview\", rotatePreview)\n self.addContextMenuItem(\"Rotate Card+Preview\", rotateSelfAndPreview)\nend\n\n-- rotates the alt_view_angle\nfunction rotatePreview()\n local angle = self.alt_view_angle\n if angle.y == 0 then\n angle.y = 180\n else\n angle.y = 0\n end\n self.alt_view_angle = angle\nend\n\n-- rotates this card and the preview\nfunction rotateSelfAndPreview()\n self.setRotationSmooth(self.getRotation() + Vector(0, 180, 0))\n rotatePreview()\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/Tarotcard\")\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -25535,7 +25647,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/Tarotcard\")\nend)\n__bundle_register(\"playercards/Tarotcard\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- context menu to manually fix rotation\nfunction onLoad()\n self.addContextMenuItem(\"Rotate Preview\", rotatePreview)\n self.addContextMenuItem(\"Rotate Card+Preview\", rotateSelfAndPreview)\nend\n\n-- rotates the alt_view_angle\nfunction rotatePreview()\n local angle = self.alt_view_angle\n if angle.y == 0 then\n angle.y = 180\n else\n angle.y = 0\n end\n self.alt_view_angle = angle\nend\n\n-- rotates this card and the preview\nfunction rotateSelfAndPreview()\n self.setRotationSmooth(self.getRotation() + Vector(0, 180, 0))\n rotatePreview()\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playercards/Tarotcard\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- context menu to manually fix rotation\nfunction onLoad()\n self.addContextMenuItem(\"Rotate Preview\", rotatePreview)\n self.addContextMenuItem(\"Rotate Card+Preview\", rotateSelfAndPreview)\nend\n\n-- rotates the alt_view_angle\nfunction rotatePreview()\n local angle = self.alt_view_angle\n if angle.y == 0 then\n angle.y = 180\n else\n angle.y = 0\n end\n self.alt_view_angle = angle\nend\n\n-- rotates this card and the preview\nfunction rotateSelfAndPreview()\n self.setRotationSmooth(self.getRotation() + Vector(0, 180, 0))\n rotatePreview()\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/Tarotcard\")\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -45259,6 +45371,2996 @@ "Value": 0, "XmlUI": "" }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "Bag": { + "Order": 0 + }, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "ContainedObjects": [ + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "ContainedObjects": [ + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33001, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "63bde8", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -5.625, + "posY": 1.171, + "posZ": 0.319, + "rotX": 0, + "rotY": 180, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33034, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0e05f2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.326, + "posY": 1.032, + "posZ": -3.647, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33033, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "9537b5", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -0.481, + "posY": 1.176, + "posZ": -3.573, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + } + ], + "CustomDeck": { + "330": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", + "NumHeight": 5, + "NumWidth": 8, + "Type": 0, + "UniqueBack": false + } + }, + "DeckIDs": [ + 33000, + 33001, + 33002, + 33003, + 33004, + 33005, + 33006, + 33007, + 33008, + 33009, + 33010, + 33011, + 33012, + 33013, + 33014, + 33015, + 33016, + 33017, + 33018, + 33019, + 33020, + 33021, + 33022, + 33023, + 33024, + 33025, + 33026, + 33027, + 33028, + 33029, + 33030, + 33031, + 33032, + 33034, + 33033 + ], + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "5f3cba", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Deck", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 16.499, + "posY": 3.612, + "posZ": -39.144, + "rotX": 357, + "rotY": 270, + "rotZ": 185, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "Description": "\n\nAt the start of each scenario, each investigator is dealt 2 secret objectives, they choose one. If they complete their secret objective at any time during the scenario, they add the card to their PERSONAL victory display.\n\n", + "DragSelectable": true, + "GMNotes": "", + "GUID": "f3dfc9", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Notecard", + "Nickname": "HOW TO USE SECRET OBJ.", + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 17.175, + "posY": 3.594, + "posZ": -38.818, + "rotX": 0, + "rotY": 90, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "ContainedObjects": [ + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33111, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "331": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724051130/604A4D98487815A81408F37D5FD4BD5201DDF087/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526724050690/73976114CA4EE3BB8BB03159476CAFAB63F551D3/", + "NumHeight": 4, + "NumWidth": 6, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "5249d8", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 7.158, + "posY": 1.231, + "posZ": 2.808, + "rotX": 0, + "rotY": 180, + "rotZ": 359, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33101, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "331": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724051130/604A4D98487815A81408F37D5FD4BD5201DDF087/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526724050690/73976114CA4EE3BB8BB03159476CAFAB63F551D3/", + "NumHeight": 4, + "NumWidth": 6, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "9e01c2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 7.354, + "posY": 1.152, + "posZ": 2.884, + "rotX": 0, + "rotY": 180, + "rotZ": 1, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33111, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "331": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724051130/604A4D98487815A81408F37D5FD4BD5201DDF087/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526724050690/73976114CA4EE3BB8BB03159476CAFAB63F551D3/", + "NumHeight": 4, + "NumWidth": 6, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "5249d8", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 7.158, + "posY": 1.231, + "posZ": 2.808, + "rotX": 0, + "rotY": 180, + "rotZ": 359, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33111, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "331": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724051130/604A4D98487815A81408F37D5FD4BD5201DDF087/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526724050690/73976114CA4EE3BB8BB03159476CAFAB63F551D3/", + "NumHeight": 4, + "NumWidth": 6, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "5249d8", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 7.158, + "posY": 1.231, + "posZ": 2.808, + "rotX": 0, + "rotY": 180, + "rotZ": 359, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33111, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "331": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724051130/604A4D98487815A81408F37D5FD4BD5201DDF087/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526724050690/73976114CA4EE3BB8BB03159476CAFAB63F551D3/", + "NumHeight": 4, + "NumWidth": 6, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "5249d8", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 7.158, + "posY": 1.231, + "posZ": 2.808, + "rotX": 0, + "rotY": 180, + "rotZ": 359, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33111, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "331": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724051130/604A4D98487815A81408F37D5FD4BD5201DDF087/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526724050690/73976114CA4EE3BB8BB03159476CAFAB63F551D3/", + "NumHeight": 4, + "NumWidth": 6, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "5249d8", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 7.158, + "posY": 1.231, + "posZ": 2.808, + "rotX": 0, + "rotY": 180, + "rotZ": 359, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33111, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "331": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724051130/604A4D98487815A81408F37D5FD4BD5201DDF087/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526724050690/73976114CA4EE3BB8BB03159476CAFAB63F551D3/", + "NumHeight": 4, + "NumWidth": 6, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "5249d8", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 7.158, + "posY": 1.231, + "posZ": 2.808, + "rotX": 0, + "rotY": 180, + "rotZ": 359, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33111, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "331": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724051130/604A4D98487815A81408F37D5FD4BD5201DDF087/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526724050690/73976114CA4EE3BB8BB03159476CAFAB63F551D3/", + "NumHeight": 4, + "NumWidth": 6, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "5249d8", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 7.158, + "posY": 1.231, + "posZ": 2.808, + "rotX": 0, + "rotY": 180, + "rotZ": 359, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33111, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "331": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724051130/604A4D98487815A81408F37D5FD4BD5201DDF087/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526724050690/73976114CA4EE3BB8BB03159476CAFAB63F551D3/", + "NumHeight": 4, + "NumWidth": 6, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "5249d8", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 7.158, + "posY": 1.231, + "posZ": 2.808, + "rotX": 0, + "rotY": 180, + "rotZ": 359, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33111, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "331": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724051130/604A4D98487815A81408F37D5FD4BD5201DDF087/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526724050690/73976114CA4EE3BB8BB03159476CAFAB63F551D3/", + "NumHeight": 4, + "NumWidth": 6, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "5249d8", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 7.158, + "posY": 1.231, + "posZ": 2.808, + "rotX": 0, + "rotY": 180, + "rotZ": 359, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33111, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "331": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724051130/604A4D98487815A81408F37D5FD4BD5201DDF087/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526724050690/73976114CA4EE3BB8BB03159476CAFAB63F551D3/", + "NumHeight": 4, + "NumWidth": 6, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "5249d8", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 7.158, + "posY": 1.231, + "posZ": 2.808, + "rotX": 0, + "rotY": 180, + "rotZ": 359, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 33111, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "331": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724051130/604A4D98487815A81408F37D5FD4BD5201DDF087/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526724050690/73976114CA4EE3BB8BB03159476CAFAB63F551D3/", + "NumHeight": 4, + "NumWidth": 6, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "5249d8", + "Grid": true, + "GridProjection": false, + "Hands": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 7.158, + "posY": 1.231, + "posZ": 2.808, + "rotX": 0, + "rotY": 180, + "rotZ": 359, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + } + ], + "CustomDeck": { + "331": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724051130/604A4D98487815A81408F37D5FD4BD5201DDF087/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526724050690/73976114CA4EE3BB8BB03159476CAFAB63F551D3/", + "NumHeight": 4, + "NumWidth": 6, + "Type": 0, + "UniqueBack": false + } + }, + "DeckIDs": [ + 33100, + 33101, + 33102, + 33103, + 33104, + 33105, + 33106, + 33107, + 33108, + 33109, + 33110, + 33111 + ], + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "1e8a13", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Deck", + "Nickname": "", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 14.368, + "posY": 3.614, + "posZ": -31.021, + "rotX": 0, + "rotY": 270, + "rotZ": 180, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "Description": "\nAt the start of each scenario, investigators may collectively choose to draw a random ultimatum. These ultimatums significantly ramp up the difficulty of the game, but reward them should they overcome the challenges.", + "DragSelectable": true, + "GMNotes": "", + "GUID": "ed4645", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Notecard", + "Nickname": "HOW TO USE ULTIMATUMS", + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 13.5, + "posY": 3.57, + "posZ": -31.298, + "rotX": 336, + "rotY": 87, + "rotZ": 7, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + } + ], + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "b2077d", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MaterialIndex": -1, + "MeasureMovement": false, + "MeshIndex": -1, + "Name": "Bag", + "Nickname": "Secret Objectives \u0026 Ultimatums", + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -37.163, + "posY": 2.829, + "posZ": -112.791, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, { "AltLookAngle": { "x": 0, @@ -45647,7 +48749,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "function onload(saved_data)\n revealCardPositions = {\n Vector(3.5, 0.25, 0),\n Vector(-3.5, 0.25, 0)\n }\n\n revealCardPositionsSwap = {\n Vector(-3.5, 0.25, 0),\n Vector(3.5, 0.25, 0)\n }\n\n self.createButton({\n label = 'Underworld Market\\nHelper',\n click_function = \"none\",\n function_owner = self,\n position = {0,-0.1,-1.6},\n height = 0,\n width = 0,\n font_size = 145,\n font_color = {1,1,1}\n })\n\n hiddenCards = 10\n hiddenCardLabel = '-----'\n\n isSetup = false\n movingCards = false\n\n self.addContextMenuItem('Reset helper', resetHelper)\n\n if saved_data != '' then\n local loaded_data = JSON.decode(saved_data)\n hiddenCards = loaded_data.saved_hiddenCards\n\n isSetup = true\n refreshButtons()\n end\nend\n\nfunction onSave()\n return JSON.encode({\n saved_hiddenCards = hiddenCards\n })\nend\n\nfunction onObjectEnterContainer(container, object)\n if container ~= self then return end\n\n if isSetup and object.tag == \"Card\" then\n refreshButtons()\n end\n\n if object.tag == \"Deck\" then\n if validateDeck(object) then\n takeDeckOut(object.getGUID(), self.getPosition() + Vector(0, 0.1, 0))\n refreshButtons()\n \n isSetup = true\n end\n elseif object.tag ~= \"Card\" then\n broadcastToAll(\"The 'Underworld Market Helper' is meant to be used for cards.\", \"White\")\n end\nend\n\nfunction onObjectLeaveContainer(container, object)\n if container ~= self then return end\n \n if isSetup then\n refreshButtons()\n end\nend\n\nfunction validateDeck(deck)\n if deck.getQuantity() ~= 10 then\n print('Underworld Market Helper: Deck must include exactly 10 cards.')\n return false\n end\n\n local illicitCount = 0\n\n for _, card in ipairs(deck.getObjects()) do\n decodedGMNotes = JSON.decode(card.gm_notes)\n\n if decodedGMNotes ~= nil and string.find(decodedGMNotes.traits, \"Illicit\", 1, true) then\n illicitCount = illicitCount + 1\n end\n end\n\n if illicitCount ~= 10 then\n print('Underworld Market Helper: Deck must include 10 Illicit cards.')\n return false\n end\n\n return true\nend\n\nfunction refreshButtons()\n local cardsList = ''\n\n for i, card in ipairs(self.getObjects()) do\n local localCardName = card.name\n\n if i \u003c= hiddenCards then\n localCardName = hiddenCardLabel\n end\n\n cardsList = cardsList .. localCardName .. '\\n'\n end\n\n self.clearButtons()\n\n self.createButton({\n label = 'Market Deck:',\n click_function = \"none\",\n function_owner = self,\n position = {0,-0.1,-1.6},\n height = 0,\n width = 0,\n font_size = 150,\n font_color = {1,1,1}\n })\n\n self.createButton({\n label = cardsList,\n click_function = \"none\",\n function_owner = self,\n position = {0,-0.1,0.15},\n height = 0,\n width = 0,\n font_size = 115,\n font_color = {1,1,1}\n })\n\n self.createButton({\n click_function = 'revealFirstTwoCards',\n function_owner = self,\n label = 'Reveal',\n position = {-0.85,0,1.6},\n width = 375,\n height = 175,\n font_size = 90\n })\n\n self.createButton({\n click_function = 'swap',\n function_owner = self,\n label = 'Swap',\n position = {0,0,1.6},\n width = 375,\n height = 175,\n font_size = 90\n })\n\n self.createButton({\n click_function = 'finish',\n function_owner = self,\n label = 'Finish',\n position = {0.85,0,1.6},\n width = 375,\n height = 175,\n font_size = 90\n })\nend\n\nfunction takeDeckOut(guid, pos)\n local deck = self.takeObject({ guid = guid, position = pos, smooth = false })\n\n for i = 1, #deck.getObjects() do\n self.putObject(deck.takeObject({ position = pos + Vector(0, 0.1 * i, 0), smooth = false }))\n end\n\n self.shuffle()\nend\n\nfunction getRevealedCards()\n local revealedCards = {}\n\n for _, pos in ipairs(revealCardPositions) do\n local hitList = Physics.cast({\n origin = self.positionToWorld(pos) + Vector(0, 0.25, 0),\n direction = {0,-1,0},\n type = 1,\n max_distance = 2\n })\n\n for _, hit in ipairs(hitList) do\n if hit.hit_object != self and hit.hit_object.tag == \"Card\" then\n table.insert(revealedCards, hit.hit_object.getGUID())\n end\n end\n end\n\n return revealedCards\nend\n\nfunction revealFirstTwoCards()\n if movingCards or #getRevealedCards() \u003e 0 then return end\n\n for i, card in ipairs(self.getObjects()) do\n movingCards = true\n\n self.takeObject({\n index = 0,\n rotation = self.getRotation(),\n position = self.positionToWorld(revealCardPositions[i]),\n callback_function = function(obj)\n obj.resting = true\n movingCards = false\n end\n })\n\n hiddenCards = hiddenCards - 1\n\n if i == 2 or #self.getObjects() == 0 then\n break\n end\n end\n\n refreshButtons()\nend\n\nfunction swap()\n if movingCards then return end\n\n local revealedCards = getRevealedCards()\n\n if #revealedCards == 2 then\n for i, revealedCardGUID in ipairs(revealedCards) do\n local revealedCard = getObjectFromGUID(revealedCardGUID)\n\n revealedCard.setPositionSmooth(self.positionToWorld(revealCardPositionsSwap[i]), false, false)\n end\n end\nend\n\nfunction finish()\n if movingCards then return end\n\n local revealedCards = getRevealedCards()\n\n movingCards = true\n\n for i, revealedCardGUID in ipairs(revealedCards) do\n self.putObject(getObjectFromGUID(revealedCardGUID))\n end\n\n Wait.time(\n function()\n movingCards = false\n end,\n 0.75)\nend\n\nfunction resetHelper()\n for i, card in ipairs(self.getObjects()) do\n self.takeObject({\n index = 0,\n smooth = false,\n rotation = self.getRotation(),\n position = self.positionToWorld(revealCardPositions[2])\n })\n end\n\n self.clearButtons()\n\n self.createButton({\n label = 'Underworld Market\\nHelper',\n click_function = \"none\",\n function_owner = self,\n position = {0,-0.1,-1.6},\n height = 0,\n width = 0,\n font_size = 145,\n font_color = {1,1,1}\n })\n\n hiddenCards = 10\n isSetup = false\n movingCards = false\n\n self.reset()\n\n print('Underworld Market Helper: Helper has been reset.')\nend", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"accessories/UnderworldMarketHelper\")\nend)\n__bundle_register(\"accessories/UnderworldMarketHelper\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onload(saved_data)\n revealCardPositions = {\n Vector(3.5, 0.25, 0),\n Vector(-3.5, 0.25, 0)\n }\n\n revealCardPositionsSwap = {\n Vector(-3.5, 0.25, 0),\n Vector(3.5, 0.25, 0)\n }\n\n self.createButton({\n label = 'Underworld Market\\nHelper',\n click_function = \"none\",\n function_owner = self,\n position = {0,-0.1,-1.6},\n height = 0,\n width = 0,\n font_size = 145,\n font_color = {1,1,1}\n })\n\n hiddenCards = 10\n hiddenCardLabel = '-----'\n\n isSetup = false\n movingCards = false\n\n self.addContextMenuItem('Reset helper', resetHelper)\n\n if saved_data != '' then\n local loaded_data = JSON.decode(saved_data)\n hiddenCards = loaded_data.saved_hiddenCards\n\n isSetup = true\n refreshButtons()\n end\nend\n\nfunction onSave()\n return JSON.encode({\n saved_hiddenCards = hiddenCards\n })\nend\n\nfunction onObjectEnterContainer(container, object)\n if container ~= self then return end\n\n if isSetup and object.tag == \"Card\" then\n refreshButtons()\n end\n\n if object.tag == \"Deck\" then\n if validateDeck(object) then\n takeDeckOut(object.getGUID(), self.getPosition() + Vector(0, 0.1, 0))\n refreshButtons()\n \n isSetup = true\n end\n elseif object.tag ~= \"Card\" then\n broadcastToAll(\"The 'Underworld Market Helper' is meant to be used for cards.\", \"White\")\n end\nend\n\nfunction onObjectLeaveContainer(container, object)\n if container ~= self then return end\n \n if isSetup then\n refreshButtons()\n end\nend\n\nfunction validateDeck(deck)\n if deck.getQuantity() ~= 10 then\n print('Underworld Market Helper: Deck must include exactly 10 cards.')\n return false\n end\n\n local illicitCount = 0\n\n for _, card in ipairs(deck.getObjects()) do\n decodedGMNotes = JSON.decode(card.gm_notes)\n\n if decodedGMNotes ~= nil and string.find(decodedGMNotes.traits, \"Illicit\", 1, true) then\n illicitCount = illicitCount + 1\n end\n end\n\n if illicitCount ~= 10 then\n print('Underworld Market Helper: Deck must include 10 Illicit cards.')\n return false\n end\n\n return true\nend\n\nfunction refreshButtons()\n local cardsList = ''\n\n for i, card in ipairs(self.getObjects()) do\n local localCardName = card.name\n\n if i \u003c= hiddenCards then\n localCardName = hiddenCardLabel\n end\n\n cardsList = cardsList .. localCardName .. '\\n'\n end\n\n self.clearButtons()\n\n self.createButton({\n label = 'Market Deck:',\n click_function = \"none\",\n function_owner = self,\n position = {0,-0.1,-1.6},\n height = 0,\n width = 0,\n font_size = 150,\n font_color = {1,1,1}\n })\n\n self.createButton({\n label = cardsList,\n click_function = \"none\",\n function_owner = self,\n position = {0,-0.1,0.15},\n height = 0,\n width = 0,\n font_size = 115,\n font_color = {1,1,1}\n })\n\n self.createButton({\n click_function = 'revealFirstTwoCards',\n function_owner = self,\n label = 'Reveal',\n position = {-0.85,0,1.6},\n width = 375,\n height = 175,\n font_size = 90\n })\n\n self.createButton({\n click_function = 'swap',\n function_owner = self,\n label = 'Swap',\n position = {0,0,1.6},\n width = 375,\n height = 175,\n font_size = 90\n })\n\n self.createButton({\n click_function = 'finish',\n function_owner = self,\n label = 'Finish',\n position = {0.85,0,1.6},\n width = 375,\n height = 175,\n font_size = 90\n })\nend\n\nfunction takeDeckOut(guid, pos)\n local deck = self.takeObject({ guid = guid, position = pos, smooth = false })\n\n for i = 1, #deck.getObjects() do\n self.putObject(deck.takeObject({ position = pos + Vector(0, 0.1 * i, 0), smooth = false }))\n end\n\n self.shuffle()\nend\n\nfunction getRevealedCards()\n local revealedCards = {}\n\n for _, pos in ipairs(revealCardPositions) do\n local hitList = Physics.cast({\n origin = self.positionToWorld(pos) + Vector(0, 0.25, 0),\n direction = {0,-1,0},\n type = 1,\n max_distance = 2\n })\n\n for _, hit in ipairs(hitList) do\n if hit.hit_object != self and hit.hit_object.tag == \"Card\" then\n table.insert(revealedCards, hit.hit_object.getGUID())\n end\n end\n end\n\n return revealedCards\nend\n\nfunction revealFirstTwoCards()\n if movingCards or #getRevealedCards() \u003e 0 then return end\n\n for i, card in ipairs(self.getObjects()) do\n movingCards = true\n\n self.takeObject({\n index = 0,\n rotation = self.getRotation(),\n position = self.positionToWorld(revealCardPositions[i]),\n callback_function = function(obj)\n obj.resting = true\n movingCards = false\n end\n })\n\n hiddenCards = hiddenCards - 1\n\n if i == 2 or #self.getObjects() == 0 then\n break\n end\n end\n\n refreshButtons()\nend\n\nfunction swap()\n if movingCards then return end\n\n local revealedCards = getRevealedCards()\n\n if #revealedCards == 2 then\n for i, revealedCardGUID in ipairs(revealedCards) do\n local revealedCard = getObjectFromGUID(revealedCardGUID)\n\n revealedCard.setPositionSmooth(self.positionToWorld(revealCardPositionsSwap[i]), false, false)\n end\n end\nend\n\nfunction finish()\n if movingCards then return end\n\n local revealedCards = getRevealedCards()\n\n movingCards = true\n\n for i, revealedCardGUID in ipairs(revealedCards) do\n self.putObject(getObjectFromGUID(revealedCardGUID))\n end\n\n Wait.time(\n function()\n movingCards = false\n end,\n 0.75)\nend\n\nfunction resetHelper()\n for i, card in ipairs(self.getObjects()) do\n self.takeObject({\n index = 0,\n smooth = false,\n rotation = self.getRotation(),\n position = self.positionToWorld(revealCardPositions[2])\n })\n end\n\n self.clearButtons()\n\n self.createButton({\n label = 'Underworld Market\\nHelper',\n click_function = \"none\",\n function_owner = self,\n position = {0,-0.1,-1.6},\n height = 0,\n width = 0,\n font_size = 145,\n font_color = {1,1,1}\n })\n\n hiddenCards = 10\n isSetup = false\n movingCards = false\n\n self.reset()\n\n print('Underworld Market Helper: Helper has been reset.')\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MaterialIndex": -1, "MeasureMovement": false, @@ -45723,7 +48825,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "local classOrder = {\n \"Guardian\",\n \"Seeker\",\n \"Survivor\",\n \"Mystic\",\n \"Rogue\"\n}\n\nlocal bParam = {}\nbParam.width = 0\nbParam.height = 0\nbParam.function_owner = self\nbParam.click_function = \"none\"\nbParam.label = \"0\"\nbParam.position = {x = 0, y = 0.1, z = -0.7}\nbParam.scale = {x = 0.1, y = 0.1, z = 0.1}\nbParam.font_color = \"White\"\nbParam.font_size = 700\n\nfunction onLoad()\n self.createButton({\n width = 2750,\n height = 800,\n function_owner = self,\n click_function = \"updateDisplayButtons\",\n label = \"Update!\",\n tooltip = \"Count classes from cards on this tile\",\n position = {x = 0, y = 0.1, z = 0.875},\n scale = {x = 0.1, y = 0.1, z = 0.1},\n font_size = 500\n })\n createDisplayButtons()\nend\n\nfunction createDisplayButtons()\n local x_offset = 0.361\n bParam.position.x = -3 * x_offset\n for i = 1, 5 do\n bParam.position.x = bParam.position.x + x_offset\n self.createButton(bParam)\n end\nend\n\nfunction updateDisplayButtons(_, playerColor)\n local classCount = {\n Guardian = 0,\n Seeker = 0,\n Survivor = 0,\n Mystic = 0,\n Rogue = 0,\n uncounted = 0\n }\n\n -- loop through cards on this helper and count classes from metadata\n for _, notes in ipairs(getNotesFromCardsAndContainers()) do\n if notes.class then\n for str in string.gmatch(notes.class, \"([^|]+)\") do\n if not tonumber(classCount[str]) then\n str = \"uncounted\"\n end\n classCount[str] = classCount[str] + 1\n end\n end\n end\n\n -- edit button labels with index 1-5\n for i = 1, 5 do\n self.editButton({index = i, label = classCount[classOrder[i]]})\n end\n \n -- show message about uncounted cards\n if classCount.uncounted \u003e 0 then\n printToColor(\"Search included \" .. classCount.uncounted .. \" neutral/ununcounted card(s).\", playerColor, \"Orange\")\n end\nend\n\nfunction getNotesFromCardsAndContainers()\n local search = Physics.cast({\n direction = { 0, 1, 0 },\n max_distance = 0,\n type = 3,\n size = self.getBounds().size:setAt(\"y\", 1),\n origin = self.getPosition() + Vector(0, 0.5, 0),\n })\n\n local notesList = {}\n for _, hit in ipairs(search) do\n local obj = hit.hit_object\n local notes = {}\n if obj.type == \"Card\" then\n notes = JSON.decode(obj.getGMNotes()) or {}\n table.insert(notesList, notes)\n elseif obj.type == \"Bag\" or obj.type == \"Deck\" then\n for _, deepObj in ipairs(obj.getData().ContainedObjects) do\n if deepObj.Name == \"Card\" or deepObj.Name == \"CardCustom\" then\n notes = JSON.decode(deepObj.GMNotes) or {}\n table.insert(notesList, notes)\n end\n end\n end\n end\n return notesList\nend", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"accessories/Subject5U-21Helper\")\nend)\n__bundle_register(\"accessories/Subject5U-21Helper\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal classOrder = {\n \"Guardian\",\n \"Seeker\",\n \"Survivor\",\n \"Mystic\",\n \"Rogue\"\n}\n\nlocal bParam = {}\nbParam.width = 0\nbParam.height = 0\nbParam.function_owner = self\nbParam.click_function = \"none\"\nbParam.label = \"0\"\nbParam.position = {x = 0, y = 0.1, z = -0.7}\nbParam.scale = {x = 0.1, y = 0.1, z = 0.1}\nbParam.font_color = \"White\"\nbParam.font_size = 700\n\nfunction onLoad()\n self.createButton({\n width = 2750,\n height = 800,\n function_owner = self,\n click_function = \"updateDisplayButtons\",\n label = \"Update!\",\n tooltip = \"Count classes from cards on this tile\",\n position = {x = 0, y = 0.1, z = 0.875},\n scale = {x = 0.1, y = 0.1, z = 0.1},\n font_size = 500\n })\n createDisplayButtons()\nend\n\nfunction createDisplayButtons()\n local x_offset = 0.361\n bParam.position.x = -3 * x_offset\n for i = 1, 5 do\n bParam.position.x = bParam.position.x + x_offset\n self.createButton(bParam)\n end\nend\n\nfunction updateDisplayButtons(_, playerColor)\n local classCount = {\n Guardian = 0,\n Seeker = 0,\n Survivor = 0,\n Mystic = 0,\n Rogue = 0,\n uncounted = 0\n }\n\n -- loop through cards on this helper and count classes from metadata\n for _, notes in ipairs(getNotesFromCardsAndContainers()) do\n if notes.class then\n for str in string.gmatch(notes.class, \"([^|]+)\") do\n if not tonumber(classCount[str]) then\n str = \"uncounted\"\n end\n classCount[str] = classCount[str] + 1\n end\n end\n end\n\n -- edit button labels with index 1-5\n for i = 1, 5 do\n self.editButton({index = i, label = classCount[classOrder[i]]})\n end\n \n -- show message about uncounted cards\n if classCount.uncounted \u003e 0 then\n printToColor(\"Search included \" .. classCount.uncounted .. \" neutral/ununcounted card(s).\", playerColor, \"Orange\")\n end\nend\n\nfunction getNotesFromCardsAndContainers()\n local search = Physics.cast({\n direction = { 0, 1, 0 },\n max_distance = 0,\n type = 3,\n size = self.getBounds().size:setAt(\"y\", 1),\n origin = self.getPosition() + Vector(0, 0.5, 0),\n })\n\n local notesList = {}\n for _, hit in ipairs(search) do\n local obj = hit.hit_object\n local notes = {}\n if obj.type == \"Card\" then\n notes = JSON.decode(obj.getGMNotes()) or {}\n table.insert(notesList, notes)\n elseif obj.type == \"Bag\" or obj.type == \"Deck\" then\n -- check if there are actually objects contained and loop through them\n local containedObjects = obj.getData().ContainedObjects\n if containedObjects then\n for _, deepObj in ipairs(containedObjects) do\n if deepObj.Name == \"Card\" or deepObj.Name == \"CardCustom\" then\n notes = JSON.decode(deepObj.GMNotes) or {}\n table.insert(notesList, notes)\n end\n end\n end\n end\n end\n return notesList\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Custom_Tile", @@ -45748,6 +48850,66 @@ "Value": 0, "XmlUI": "" }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomTile": { + "Stackable": false, + "Stretch": true, + "Thickness": 0.1, + "Type": 3 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/2115061845796985108/F0ADB7094641DA966FFA3AF0CC6987D33D2D9591/", + "WidthScale": 0 + }, + "Description": "Use the buttons to show / hide a playmat.", + "DragSelectable": true, + "GMNotes": "", + "GUID": "a758b2", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"accessories/PlayermatHider\")\nend)\n__bundle_register(\"accessories/PlayermatHider\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal guidReferenceApi = require(\"core/GUIDReferenceApi\")\nlocal objects\n\nfunction onClick_hideShow(player, matColor)\n objects = guidReferenceApi.getObjectsByOwner(matColor)\n local actionTokens = searchMat(objects.Playermat.positionToWorld({-1.1, 0.05, -0.27}), {4, 1, 1}, isActionToken)\n local pos = objects.Playermat.getPosition()\n local mod = (pos.y \u003e 0) and -2 or 2\n\n -- move all objects\n for _, obj in pairs(objects) do\n obj.setPosition(obj.getPosition() + Vector(0, mod, 0))\n end\n\n -- move action tokens\n for _, obj in ipairs(actionTokens) do\n obj.setLock(pos.y \u003e 0)\n obj.setPosition(obj.getPosition() + Vector(0, mod, 0))\n end\nend\n\nfunction isActionToken(x) return x.getDescription() == 'Action Token' end\n\nfunction searchMat(origin, size, filter)\n local searchResult = Physics.cast({\n origin = origin,\n direction = { 0, 1, 0 },\n orientation = objects.Playermat.getRotation(),\n type = 3,\n size = size,\n max_distance = 0\n })\n\n local objList = {}\n for _, v in ipairs(searchResult) do\n if not filter or (filter and filter(v.hit_object)) then\n table.insert(objList, v.hit_object)\n end\n end\n return objList\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Custom_Tile", + "Nickname": "PlayermatHider", + "Snap": true, + "Sticky": true, + "Tags": [ + "CleanUpHelper_ignore" + ], + "Tooltip": true, + "Transform": { + "posX": 0, + "posY": 2, + "posZ": 0, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 5, + "scaleY": 1, + "scaleZ": 5 + }, + "Value": 0, + "XmlUI": "\u003c!-- include accessories/PlayermatHider.xml --\u003e\n\u003cDefaults\u003e\n \u003cText color=\"White\"\n fontSize=\"110\"\n alignment=\"MiddleLeft\"\n font=\"font_teutonic-arkham\"/\u003e\n \u003cButton fontSize=\"110\"\n height=\"200\"\n width=\"600\"\n hoverClass=\"bGrey\"\n pressClass=\"bWhite\"\n selectClass=\"bWhite\"\n color=\"#aaaaaa\"\n font=\"font_teutonic-arkham\"/\u003e\n \u003cButton class=\"bGrey\"\n color=\"grey\"/\u003e\n \u003cButton class=\"bWhite\"\n color=\"white\"/\u003e\n \u003cButton class=\"activeTab\"\n color=\"#ffffff\"/\u003e\n \u003cRow preferredHeight=\"300\"/\u003e\n\u003c/Defaults\u003e\n\n\u003cTableLayout height=\"1600\"\n width=\"1800\"\n columnWidths=\"1000 800\"\n rotation=\"0 0 180\"\n position=\"0 0 -11\"\n scale=\"0.1 0.1 0.1\"\n cellBackgroundColor=\"none\"\u003e\n \u003cRow preferredHeight=\"400\"\u003e\n \u003cCell columnSpan=\"2\"\u003e\n \u003cText fontSize=\"200\"\n alignment=\"UpperCenter\"\u003ePlayermat Hider\u003c/Text\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n \u003cRow\u003e\n \u003cCell\u003e\n \u003cText color=\"White\"\u003ePlayermat 1 (White)\u003c/Text\u003e\n \u003c/Cell\u003e\n \u003cCell\u003e\n \u003cPanel\u003e\n \u003cButton onClick=\"onClick_hideShow(White)\"\u003eShow / Hide\u003c/Button\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n \u003cRow\u003e\n \u003cCell\u003e\n \u003cText color=\"Orange\"\u003ePlayermat 2 (Orange)\u003c/Text\u003e\n \u003c/Cell\u003e\n \u003cCell\u003e\n \u003cPanel\u003e\n \u003cButton onClick=\"onClick_hideShow(Orange)\"\u003eShow / Hide\u003c/Button\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n \u003cRow\u003e\n \u003cCell\u003e\n \u003cText color=\"Green\"\u003ePlayermat 3 (Green)\u003c/Text\u003e\n \u003c/Cell\u003e\n \u003cCell\u003e\n \u003cPanel\u003e\n \u003cButton onClick=\"onClick_hideShow(Green)\"\u003eShow / Hide\u003c/Button\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n \u003cRow\u003e\n \u003cCell\u003e\n \u003cText color=\"Red\"\u003ePlayermat 4 (Red)\u003c/Text\u003e\n \u003c/Cell\u003e\n \u003cCell\u003e\n \u003cPanel\u003e\n \u003cButton onClick=\"onClick_hideShow(Red)\"\u003eShow / Hide\u003c/Button\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\u003c/TableLayout\u003e\n\u003c!-- include accessories/PlayermatHider.xml --\u003e" + }, { "AltLookAngle": { "x": 0, @@ -47687,7 +50849,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"chaosbag/BlessCurseManager\")\nend)\n__bundle_register(\"chaosbag/BlessCurseManager\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\n-- common button parameters\nlocal buttonParamaters = {}\nbuttonParamaters.function_owner = self\nbuttonParamaters.color = { 0, 0, 0, 0 }\nbuttonParamaters.width = 700\nbuttonParamaters.height = 700\n\nlocal altState = false\nlocal MODE = {\n [false] = \"Add / Remove\",\n [true] = \"Take / Return\"\n}\nlocal BUTTON_COLOR = {\n [false] = { 0.4, 0.4, 0.4 },\n [true] = { 0.9, 0.9, 0.9 }\n}\nlocal FONT_COLOR = {\n [false] = { 1, 1, 1 },\n [true] = { 0, 0, 0 }\n}\nlocal whitespace = \" \"\nlocal updating\n\n---------------------------------------------------------\n-- creating buttons and menus + initializing tables\n---------------------------------------------------------\n\nfunction onSave() return JSON.encode(altState) end\n\nfunction onLoad(saved_state)\n if saved_state ~= nil then\n altState = JSON.decode(saved_state)\n end\n\n -- index: 0 - bless\n buttonParamaters.click_function = \"clickBless\"\n buttonParamaters.position = { -1.03, 0.05, 0.46 }\n self.createButton(buttonParamaters)\n\n -- index: 1 - curse\n buttonParamaters.click_function = \"clickCurse\"\n buttonParamaters.position[1] = -buttonParamaters.position[1]\n self.createButton(buttonParamaters)\n\n -- index: 2 - alternative mode (take / return)\n buttonParamaters.click_function = \"enableAlt\"\n buttonParamaters.width = 900\n buttonParamaters.height = 210\n buttonParamaters.position = { -1.03, 0.05, -0.85 }\n self.createButton(buttonParamaters)\n\n -- index: 3 - default mode (add / remove)\n buttonParamaters.click_function = \"enableDefault\"\n buttonParamaters.position[1] = -buttonParamaters.position[1]\n self.createButton(buttonParamaters)\n\n -- load labels, tooltips and colors\n updateButtons()\n\n -- context menu\n self.addContextMenuItem(\"Remove all\", doRemove)\n self.addContextMenuItem(\"Reset\", doReset)\n\n -- initializing tables \n initializeState()\n broadcastCount(\"Curse\")\n broadcastCount(\"Bless\")\nend\n\nfunction resetTables()\n numInPlay = { Bless = 0, Curse = 0 }\n tokensTaken = { Bless = {}, Curse = {} }\n sealedTokens = {}\nend\n\nfunction initializeState()\n resetTables()\n\n -- count tokens in the bag\n local chaosbag = chaosBagApi.findChaosBag()\n local tokens = {}\n for _, v in ipairs(chaosbag.getObjects()) do\n if v.name == \"Bless\" then\n numInPlay.Bless = numInPlay.Bless + 1\n elseif v.name == \"Curse\" then\n numInPlay.Curse = numInPlay.Curse + 1\n end\n end\n\n -- find tokens in the play area\n for _, obj in ipairs(getObjects()) do\n local pos = obj.getPosition()\n if pos.x \u003e -65 and pos.x \u003c 10 and pos.z \u003e -35 and pos.z \u003c 35 then\n if obj.getName() == \"Bless\" then\n table.insert(tokensTaken.Bless, obj.getGUID())\n numInPlay.Bless = numInPlay.Bless + 1\n elseif obj.getName() == \"Curse\" then\n table.insert(tokensTaken.Curse, obj.getGUID())\n numInPlay.Curse = numInPlay.Curse + 1\n end\n end\n end\nend\n\nfunction broadcastCount(token)\n local count = formatTokenCount(token)\n if count == \"(0/0)\" then return end\n broadcastToAll(token .. \" Tokens \" .. count, \"White\")\nend\n\nfunction broadcastStatus(color)\n broadcastToColor(\"Curse Tokens \" .. formatTokenCount(\"Curse\"), color, \"White\")\n broadcastToColor(\"Bless Tokens \" .. formatTokenCount(\"Bless\"), color, \"White\")\nend\n\n-- context menu function 1\nfunction doRemove(color)\n local chaosbag = chaosBagApi.findChaosBag()\n\n -- remove tokens from chaos bag\n local count = { Bless = 0, Curse = 0 }\n for _, v in ipairs(chaosbag.getObjects()) do\n if v.name == \"Bless\" or v.name == \"Curse\" then\n chaosbag.takeObject({\n guid = v.guid,\n position = { 0, 5, 0 },\n callback_function = function(obj) obj.destruct() end\n })\n count[v.name] = count[v.name] + 1\n end\n end\n\n broadcastToColor(\"Removed \" .. count.Bless .. \" Bless and \" ..\n count.Curse .. \" Curse tokens from the chaos bag.\", color, \"White\")\n broadcastToColor(\"Removed \" .. removeTakenTokens(\"Bless\") .. \" Bless and \" ..\n removeTakenTokens(\"Curse\") .. \" Curse tokens from play.\", color, \"White\")\n\n resetTables()\n tokenArrangerApi.layout()\nend\n\n-- context menu function 2\nfunction doReset(color)\n initializeState()\n broadcastCount(\"Curse\")\n broadcastCount(\"Bless\")\n tokenArrangerApi.layout()\nend\n\n-- removing tokens that were 'taken'\nfunction removeTakenTokens(type)\n local count = 0\n for _, guid in ipairs(tokensTaken[type]) do\n local token = getObjectFromGUID(guid)\n if token ~= nil then\n token.destruct()\n count = count + 1\n end\n end\n return count\nend\n\n---------------------------------------------------------\n-- click functions\n---------------------------------------------------------\n\n-- click function 1\nfunction clickBless(_, color, isRightClick)\n playerColor = color\n callFunctions(\"Bless\", isRightClick)\nend\n\n-- click function 2\nfunction clickCurse(_, color, isRightClick)\n playerColor = color\n callFunctions(\"Curse\", isRightClick)\nend\n\n-- click function 3\nfunction enableAlt()\n if altState then return end\n altState = not altState\n updateButtons()\nend\n\n-- click function 4\nfunction enableDefault()\n if not altState then return end\n altState = not altState\n updateButtons()\nend\n\n---------------------------------------------------------\n-- called functions\n---------------------------------------------------------\n\nfunction updateButtons()\n self.editButton({\n index = 0,\n tooltip = MODE[altState] .. \" Bless\"\n })\n\n self.editButton({\n index = 1,\n tooltip = MODE[altState] .. \" Curse\"\n })\n\n self.editButton({\n index = 2,\n label = whitespace .. MODE[true] .. (altState and \" ✓\" or whitespace) .. \" \",\n color = BUTTON_COLOR[not altState],\n font_color = FONT_COLOR[not altState]\n })\n\n self.editButton({\n index = 3,\n label = whitespace .. MODE[false] .. (altState and whitespace or \" ✓\") .. \" \",\n color = BUTTON_COLOR[altState],\n font_color = FONT_COLOR[altState]\n })\nend\n\n-- function that is called by click_functions 1+2 and calls the other functions\nfunction callFunctions(token, isRightClick)\n if not chaosBagApi.canTouchChaosTokens() then\n return\n end\n local success\n if not altState then\n if isRightClick then\n success = takeToken(token, true)\n else\n success = addToken(token)\n end\n else\n if isRightClick then\n success = returnToken(token)\n else\n success = takeToken(token, false)\n end\n end\n if success ~= 0 then tokenArrangerApi.layout() end\nend\n\n-- returns a formatted string with information about the provided token type (bless / curse)\nfunction formatTokenCount(type)\n if type == nil then type = mode end\n return \"(\" .. (numInPlay[type] - #tokensTaken[type]) .. \"/\" .. #tokensTaken[type] .. \")\"\nend\n\n-- called by cards that seal bless/curse tokens\n---@param param Table This contains the type and guid of the sealed token\nfunction sealedToken(param)\n table.insert(tokensTaken[param.type], param.guid)\n broadcastCount(param.type)\nend\n\n-- called by cards that seal bless/curse tokens\n---@param param Table This contains the type and guid of the released token\nfunction releasedToken(param)\n for i, v in ipairs(tokensTaken[param.type]) do\n if v == param.guid then\n table.remove(tokensTaken[param.type], i)\n break\n end\n end\n if not updating then\n updating = true\n Wait.frames(function()\n broadcastCount(param.type)\n updating = false\n end, 1)\n end\nend\n\n---------------------------------------------------------\n-- main functions: add, take and return\n---------------------------------------------------------\n\nfunction addToken(type)\n if numInPlay[type] == 10 then\n printToColor(\"10 tokens already in play, not adding any.\", playerColor)\n return 0\n end\n numInPlay[type] = numInPlay[type] + 1\n printToAll(\"Adding \" .. type .. \" token \" .. formatTokenCount(type))\n return chaosBagApi.spawnChaosToken(type)\nend\n\nfunction takeToken(type, remove)\n local chaosbag = chaosBagApi.findChaosBag()\n if not remove and not SEAL_CARD_MESSAGE then\n broadcastToColor(\"For sealing tokens on cards try right-clicking on the card for seal options.\", playerColor)\n SEAL_CARD_MESSAGE = true\n end\n local tokens = {}\n for _, v in ipairs(chaosbag.getObjects()) do\n if v.name == type then\n table.insert(tokens, v.guid)\n end\n end\n if #tokens == 0 then\n printToColor(\"No \" .. type .. \" tokens in the chaos bag.\", playerColor)\n return 0\n end\n local pos = self.getPosition() + Vector(2.25, 0, 0.85)\n if type == \"Curse\" then pos[3] = pos[3] - 1.7 end\n chaosbag.takeObject({\n guid = table.remove(tokens),\n position = pos,\n smooth = false,\n callback_function = function(obj)\n if remove then\n numInPlay[type] = numInPlay[type] - 1\n printToAll(\"Removing \" .. type .. \" token \" .. formatTokenCount(type))\n obj.destruct()\n else\n table.insert(tokensTaken[type], obj.getGUID())\n printToAll(\"Taking \" .. type .. \" token \" .. formatTokenCount(type))\n end\n end\n })\nend\n\nfunction returnToken(type)\n local guid = table.remove(tokensTaken[type])\n if guid == nil then\n printToColor(\"No \" .. type .. \" tokens to return\", playerColor)\n return 0\n end\n local token = getObjectFromGUID(guid)\n if token == nil then\n printToColor(\"Couldn't find token \" .. guid .. \", not returning to bag\", playerColor)\n return 0\n end\n local chaosbag = chaosBagApi.findChaosBag()\n if chaosbag == nil then\n return 0\n end\n chaosbag.putObject(token)\n printToAll(\"Returning \" .. type .. \" token \" .. formatTokenCount(type))\nend\n\n---------------------------------------------------------\n-- Wendy Menu (context menu for cards on hotkey press)\n---------------------------------------------------------\n\nfunction addMenuOptions(parameters)\n local playerColor = parameters.playerColor\n local hoveredObject = parameters.hoveredObject\n if hoveredObject == nil or hoveredObject.getVar(\"MENU_ADDED\") == true then return end\n if hoveredObject.tag ~= \"Card\" then\n broadcastToColor(\"Right-click seal options can only be added to cards\", playerColor)\n return\n end\n\n hoveredObject.addContextMenuItem(\"Seal Bless\", function(color)\n sealToken(\"Bless\", color, hoveredObject)\n tokenArrangerApi.layout()\n end, true)\n\n hoveredObject.addContextMenuItem(\"Release Bless\", function(color)\n releaseToken(\"Bless\", color, hoveredObject)\n tokenArrangerApi.layout()\n end, true)\n\n hoveredObject.addContextMenuItem(\"Seal Curse\", function(color)\n sealToken(\"Curse\", color, hoveredObject)\n tokenArrangerApi.layout()\n end, true)\n\n hoveredObject.addContextMenuItem(\"Release Curse\", function(color)\n releaseToken(\"Curse\", color, hoveredObject)\n tokenArrangerApi.layout()\n end, true)\n\n broadcastToColor(\"Right-click seal options added to \" .. hoveredObject.getName(), playerColor)\n hoveredObject.setVar(\"MENU_ADDED\", true)\n sealedTokens[hoveredObject.getGUID()] = {}\nend\n\nfunction sealToken(type, playerColor, enemy)\n local chaosbag = chaosBagApi.findChaosBag()\n if chaosbag == nil then return end\n local pos = enemy.getPosition()\n\n for i, token in ipairs(chaosbag.getObjects()) do\n if token.name == type then\n chaosbag.takeObject({\n position = { pos.x, pos.y + 1, pos.z },\n index = i - 1,\n smooth = false,\n callback_function = function(obj)\n Wait.frames(function()\n table.insert(sealedTokens[enemy.getGUID()], obj)\n table.insert(tokensTaken[type], obj.getGUID())\n printToColor(\"Sealing \" .. type .. \" token \" .. formatTokenCount(type), playerColor)\n end, 1)\n end\n })\n return\n end\n end\n printToColor(type .. \" token not found in bag\", playerColor)\nend\n\nfunction releaseToken(type, playerColor, enemy)\n local chaosbag = chaosBagApi.findChaosBag()\n if chaosbag == nil then return end\n local tokens = sealedTokens[enemy.getGUID()]\n if tokens == nil or #tokens == 0 then return end\n\n for i, token in ipairs(tokens) do\n if token ~= nil and token.getName() == type then\n local guid = token.getGUID()\n chaosbag.putObject(token)\n for j, v in ipairs(tokensTaken[type]) do\n if v == guid then\n table.remove(tokensTaken[type], j)\n table.remove(tokens, i)\n printToColor(\"Releasing \" .. type .. \" token\" .. formatTokenCount(type), playerColor)\n return\n end\n end\n end\n end\n printToColor(type .. \" token not sealed on \" .. enemy.getName(), playerColor)\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = getObjectsWithTag(\"TokenArranger\")[1]\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"chaosbag/BlessCurseManager\")\nend)\n__bundle_register(\"chaosbag/BlessCurseManager\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\n-- common button parameters\nlocal buttonParamaters = {}\nbuttonParamaters.function_owner = self\nbuttonParamaters.color = { 0, 0, 0, 0 }\nbuttonParamaters.width = 700\nbuttonParamaters.height = 700\n\nlocal altState = false\nlocal MODE = {\n [false] = \"Add / Remove\",\n [true] = \"Take / Return\"\n}\nlocal BUTTON_COLOR = {\n [false] = { 0.4, 0.4, 0.4 },\n [true] = { 0.9, 0.9, 0.9 }\n}\nlocal FONT_COLOR = {\n [false] = { 1, 1, 1 },\n [true] = { 0, 0, 0 }\n}\nlocal whitespace = \" \"\nlocal updating\n\n---------------------------------------------------------\n-- creating buttons and menus + initializing tables\n---------------------------------------------------------\n\nfunction onSave() return JSON.encode(altState) end\n\nfunction onLoad(saved_state)\n if saved_state ~= nil then\n altState = JSON.decode(saved_state)\n end\n\n -- index: 0 - bless\n buttonParamaters.click_function = \"clickBless\"\n buttonParamaters.position = { -1.03, 0.05, 0.46 }\n self.createButton(buttonParamaters)\n\n -- index: 1 - curse\n buttonParamaters.click_function = \"clickCurse\"\n buttonParamaters.position[1] = -buttonParamaters.position[1]\n self.createButton(buttonParamaters)\n\n -- index: 2 - alternative mode (take / return)\n buttonParamaters.click_function = \"enableAlt\"\n buttonParamaters.width = 900\n buttonParamaters.height = 210\n buttonParamaters.position = { -1.03, 0.05, -0.85 }\n self.createButton(buttonParamaters)\n\n -- index: 3 - default mode (add / remove)\n buttonParamaters.click_function = \"enableDefault\"\n buttonParamaters.position[1] = -buttonParamaters.position[1]\n self.createButton(buttonParamaters)\n\n -- load labels, tooltips and colors\n updateButtons()\n\n -- context menu\n self.addContextMenuItem(\"Remove all\", doRemove)\n self.addContextMenuItem(\"Reset\", doReset)\n\n -- initializing tables \n initializeState()\n broadcastCount(\"Curse\")\n broadcastCount(\"Bless\")\nend\n\nfunction resetTables()\n numInPlay = { Bless = 0, Curse = 0 }\n tokensTaken = { Bless = {}, Curse = {} }\n sealedTokens = {}\nend\n\nfunction initializeState()\n resetTables()\n\n -- count tokens in the bag\n local chaosbag = chaosBagApi.findChaosBag()\n local tokens = {}\n for _, v in ipairs(chaosbag.getObjects()) do\n if v.name == \"Bless\" then\n numInPlay.Bless = numInPlay.Bless + 1\n elseif v.name == \"Curse\" then\n numInPlay.Curse = numInPlay.Curse + 1\n end\n end\n\n -- find tokens in the play area\n for _, obj in ipairs(getObjects()) do\n local pos = obj.getPosition()\n if pos.x \u003e -65 and pos.x \u003c 10 and pos.z \u003e -35 and pos.z \u003c 35 then\n if obj.getName() == \"Bless\" then\n table.insert(tokensTaken.Bless, obj.getGUID())\n numInPlay.Bless = numInPlay.Bless + 1\n elseif obj.getName() == \"Curse\" then\n table.insert(tokensTaken.Curse, obj.getGUID())\n numInPlay.Curse = numInPlay.Curse + 1\n end\n end\n end\nend\n\nfunction broadcastCount(token)\n local count = formatTokenCount(token)\n if count == \"(0/0)\" then return end\n broadcastToAll(token .. \" Tokens \" .. count, \"White\")\nend\n\nfunction broadcastStatus(color)\n broadcastToColor(\"Curse Tokens \" .. formatTokenCount(\"Curse\"), color, \"White\")\n broadcastToColor(\"Bless Tokens \" .. formatTokenCount(\"Bless\"), color, \"White\")\nend\n\n-- context menu function 1\nfunction doRemove(color)\n local chaosbag = chaosBagApi.findChaosBag()\n\n -- remove tokens from chaos bag\n local count = { Bless = 0, Curse = 0 }\n for _, v in ipairs(chaosbag.getObjects()) do\n if v.name == \"Bless\" or v.name == \"Curse\" then\n chaosbag.takeObject({\n guid = v.guid,\n position = { 0, 5, 0 },\n callback_function = function(obj) obj.destruct() end\n })\n count[v.name] = count[v.name] + 1\n end\n end\n\n broadcastToColor(\"Removed \" .. count.Bless .. \" Bless and \" ..\n count.Curse .. \" Curse tokens from the chaos bag.\", color, \"White\")\n broadcastToColor(\"Removed \" .. removeTakenTokens(\"Bless\") .. \" Bless and \" ..\n removeTakenTokens(\"Curse\") .. \" Curse tokens from play.\", color, \"White\")\n\n resetTables()\n tokenArrangerApi.layout()\nend\n\n-- context menu function 2\nfunction doReset(color)\n initializeState()\n broadcastCount(\"Curse\")\n broadcastCount(\"Bless\")\n tokenArrangerApi.layout()\nend\n\n-- removing tokens that were 'taken'\nfunction removeTakenTokens(type)\n local count = 0\n for _, guid in ipairs(tokensTaken[type]) do\n local token = getObjectFromGUID(guid)\n if token ~= nil then\n token.destruct()\n count = count + 1\n end\n end\n return count\nend\n\n---------------------------------------------------------\n-- click functions\n---------------------------------------------------------\n\n-- click function 1\nfunction clickBless(_, color, isRightClick)\n playerColor = color\n callFunctions(\"Bless\", isRightClick)\nend\n\n-- click function 2\nfunction clickCurse(_, color, isRightClick)\n playerColor = color\n callFunctions(\"Curse\", isRightClick)\nend\n\n-- click function 3\nfunction enableAlt()\n if altState then return end\n altState = not altState\n updateButtons()\nend\n\n-- click function 4\nfunction enableDefault()\n if not altState then return end\n altState = not altState\n updateButtons()\nend\n\n---------------------------------------------------------\n-- called functions\n---------------------------------------------------------\n\nfunction updateButtons()\n self.editButton({\n index = 0,\n tooltip = MODE[altState] .. \" Bless\"\n })\n\n self.editButton({\n index = 1,\n tooltip = MODE[altState] .. \" Curse\"\n })\n\n self.editButton({\n index = 2,\n label = whitespace .. MODE[true] .. (altState and \" ✓\" or whitespace) .. \" \",\n color = BUTTON_COLOR[not altState],\n font_color = FONT_COLOR[not altState]\n })\n\n self.editButton({\n index = 3,\n label = whitespace .. MODE[false] .. (altState and whitespace or \" ✓\") .. \" \",\n color = BUTTON_COLOR[altState],\n font_color = FONT_COLOR[altState]\n })\nend\n\n-- function that is called by click_functions 1+2 and calls the other functions\nfunction callFunctions(token, isRightClick)\n if not chaosBagApi.canTouchChaosTokens() then\n return\n end\n local success\n if not altState then\n if isRightClick then\n success = takeToken(token, true)\n else\n success = addToken(token)\n end\n else\n if isRightClick then\n success = returnToken(token)\n else\n success = takeToken(token, false)\n end\n end\n if success ~= 0 then tokenArrangerApi.layout() end\nend\n\n-- returns a formatted string with information about the provided token type (bless / curse)\nfunction formatTokenCount(type)\n if type == nil then type = mode end\n return \"(\" .. (numInPlay[type] - #tokensTaken[type]) .. \"/\" .. #tokensTaken[type] .. \")\"\nend\n\n-- called by cards that seal bless/curse tokens\n---@param param Table This contains the type and guid of the sealed token\nfunction sealedToken(param)\n table.insert(tokensTaken[param.type], param.guid)\n broadcastCount(param.type)\nend\n\n-- called by cards that seal bless/curse tokens\n---@param param Table This contains the type and guid of the released token\nfunction releasedToken(param)\n for i, v in ipairs(tokensTaken[param.type]) do\n if v == param.guid then\n table.remove(tokensTaken[param.type], i)\n break\n end\n end\n if not updating then\n updating = true\n Wait.frames(function()\n broadcastCount(param.type)\n updating = false\n end, 1)\n end\nend\n\n---------------------------------------------------------\n-- main functions: add, take and return\n---------------------------------------------------------\n\nfunction addToken(type)\n if numInPlay[type] == 10 then\n printToColor(\"10 tokens already in play, not adding any.\", playerColor)\n return 0\n end\n numInPlay[type] = numInPlay[type] + 1\n printToAll(\"Adding \" .. type .. \" token \" .. formatTokenCount(type))\n return chaosBagApi.spawnChaosToken(type)\nend\n\nfunction takeToken(type, remove)\n local chaosbag = chaosBagApi.findChaosBag()\n if not remove and not SEAL_CARD_MESSAGE then\n broadcastToColor(\"For sealing tokens on cards try right-clicking on the card for seal options.\", playerColor)\n SEAL_CARD_MESSAGE = true\n end\n local tokens = {}\n for _, v in ipairs(chaosbag.getObjects()) do\n if v.name == type then\n table.insert(tokens, v.guid)\n end\n end\n if #tokens == 0 then\n printToColor(\"No \" .. type .. \" tokens in the chaos bag.\", playerColor)\n return 0\n end\n local pos = self.getPosition() + Vector(2.25, 0, 0.85)\n if type == \"Curse\" then pos[3] = pos[3] - 1.7 end\n chaosbag.takeObject({\n guid = table.remove(tokens),\n position = pos,\n smooth = false,\n callback_function = function(obj)\n if remove then\n numInPlay[type] = numInPlay[type] - 1\n printToAll(\"Removing \" .. type .. \" token \" .. formatTokenCount(type))\n obj.destruct()\n else\n table.insert(tokensTaken[type], obj.getGUID())\n printToAll(\"Taking \" .. type .. \" token \" .. formatTokenCount(type))\n end\n end\n })\nend\n\nfunction returnToken(type)\n local guid = table.remove(tokensTaken[type])\n if guid == nil then\n printToColor(\"No \" .. type .. \" tokens to return\", playerColor)\n return 0\n end\n local token = getObjectFromGUID(guid)\n if token == nil then\n printToColor(\"Couldn't find token \" .. guid .. \", not returning to bag\", playerColor)\n return 0\n end\n local chaosbag = chaosBagApi.findChaosBag()\n if chaosbag == nil then\n return 0\n end\n chaosbag.putObject(token)\n printToAll(\"Returning \" .. type .. \" token \" .. formatTokenCount(type))\nend\n\n---------------------------------------------------------\n-- Wendy Menu (context menu for cards on hotkey press)\n---------------------------------------------------------\n\nfunction addMenuOptions(parameters)\n local playerColor = parameters.playerColor\n local hoveredObject = parameters.hoveredObject\n if hoveredObject == nil or hoveredObject.getVar(\"MENU_ADDED\") == true then return end\n if hoveredObject.tag ~= \"Card\" then\n broadcastToColor(\"Right-click seal options can only be added to cards\", playerColor)\n return\n end\n\n hoveredObject.addContextMenuItem(\"Seal Bless\", function(color)\n sealToken(\"Bless\", color, hoveredObject)\n tokenArrangerApi.layout()\n end, true)\n\n hoveredObject.addContextMenuItem(\"Release Bless\", function(color)\n releaseToken(\"Bless\", color, hoveredObject)\n tokenArrangerApi.layout()\n end, true)\n\n hoveredObject.addContextMenuItem(\"Seal Curse\", function(color)\n sealToken(\"Curse\", color, hoveredObject)\n tokenArrangerApi.layout()\n end, true)\n\n hoveredObject.addContextMenuItem(\"Release Curse\", function(color)\n releaseToken(\"Curse\", color, hoveredObject)\n tokenArrangerApi.layout()\n end, true)\n\n broadcastToColor(\"Right-click seal options added to \" .. hoveredObject.getName(), playerColor)\n hoveredObject.setVar(\"MENU_ADDED\", true)\n sealedTokens[hoveredObject.getGUID()] = {}\nend\n\nfunction sealToken(type, playerColor, enemy)\n local chaosbag = chaosBagApi.findChaosBag()\n if chaosbag == nil then return end\n local pos = enemy.getPosition()\n\n for i, token in ipairs(chaosbag.getObjects()) do\n if token.name == type then\n chaosbag.takeObject({\n position = { pos.x, pos.y + 1, pos.z },\n index = i - 1,\n smooth = false,\n callback_function = function(obj)\n Wait.frames(function()\n table.insert(sealedTokens[enemy.getGUID()], obj)\n table.insert(tokensTaken[type], obj.getGUID())\n printToColor(\"Sealing \" .. type .. \" token \" .. formatTokenCount(type), playerColor)\n end, 1)\n end\n })\n return\n end\n end\n printToColor(type .. \" token not found in bag\", playerColor)\nend\n\nfunction releaseToken(type, playerColor, enemy)\n local chaosbag = chaosBagApi.findChaosBag()\n if chaosbag == nil then return end\n local tokens = sealedTokens[enemy.getGUID()]\n if tokens == nil or #tokens == 0 then return end\n\n for i, token in ipairs(tokens) do\n if token ~= nil and token.getName() == type then\n local guid = token.getGUID()\n chaosbag.putObject(token)\n for j, v in ipairs(tokensTaken[type]) do\n if v == guid then\n table.remove(tokensTaken[type], j)\n table.remove(tokens, i)\n printToColor(\"Releasing \" .. type .. \" token\" .. formatTokenCount(type), playerColor)\n return\n end\n end\n end\n end\n printToColor(type .. \" token not sealed on \" .. enemy.getName(), playerColor)\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenArranger\")\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "false", "MeasureMovement": false, "Name": "Custom_Token", @@ -47758,54 +50920,6 @@ "Value": 0, "XmlUI": "" }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "b": 0, - "g": 0, - "r": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "445115", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"util/DeckCutter\")\nend)\n__bundle_register(\"util/DeckCutter\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- cut 3 (6) cards from a deck if numpad 1 (2) is pressed\nfunction onScriptingButtonDown(index, player_color)\n if not (index \u003e= 1 and index \u003c= 2) then return end\n\n local count = index * 3\n local player = Player[player_color]\n local object = player.getHoverObject()\n\n if not object then\n broadcastToColor(\"Hover over a deck and try again.\", player_color, \"Orange\")\n return\n end\n if object.tag ~= \"Deck\" then\n broadcastToColor(\"Hover over a deck and try again.\", player_color, \"Orange\")\n return\n end\n if count \u003e= object.getQuantity() then\n broadcastToColor(\"Deck is too small to cut \" .. count .. \" cards.\", player_color, \"Orange\")\n return\n end\n\n local pos = object.positionToWorld(Vector(0, 0, -3.5))\n for _ = 1, count do\n object.takeObject {\n index = 0,\n position = pos,\n smooth = false\n }\n end\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Checker_black", - "Nickname": "Arkham Deck Cutter", - "Snap": true, - "Sticky": true, - "Tags": [ - "arkham_setup_memory_object" - ], - "Tooltip": true, - "Transform": { - "posX": 78, - "posY": 1.208, - "posZ": 6.315, - "rotX": 0, - "rotY": 270, - "rotZ": 180, - "scaleX": 0.25, - "scaleY": 0.25, - "scaleZ": 0.25 - }, - "Value": 0, - "XmlUI": "" - }, { "AltLookAngle": { "x": 0, @@ -48034,7 +51148,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Custom_Model", @@ -48059,740 +51173,6 @@ "Value": 0, "XmlUI": "" }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedSnapPoints": [ - { - "Position": { - "x": -1, - "y": 0.1, - "z": 0.118 - }, - "Tags": [ - "ActionToken" - ] - }, - { - "Position": { - "x": -0.865, - "y": 0.1, - "z": -0.28 - }, - "Tags": [ - "ActionToken" - ] - }, - { - "Position": { - "x": -1, - "y": 0.1, - "z": -0.28 - }, - "Tags": [ - "ActionToken" - ] - }, - { - "Position": { - "x": -1.18, - "y": 0.1, - "z": -0.28 - }, - "Tags": [ - "ActionToken" - ] - }, - { - "Position": { - "x": -1.36, - "y": 0.1, - "z": -0.28 - }, - "Tags": [ - "ActionToken" - ] - }, - { - "Position": { - "x": -0.631, - "y": 0.1, - "z": 0.551 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": -0.616, - "y": 0.102, - "z": 0.024 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": -0.177, - "y": 0.101, - "z": 0.032 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": -0.174, - "y": 0.099, - "z": 0.551 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": 0.212, - "y": 0.1, - "z": 0.559 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": 0.217, - "y": 0.1, - "z": 0.035 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": 0.602, - "y": 0.1, - "z": 0.033 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": 0.605, - "y": 0.1, - "z": 0.555 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": 0.977, - "y": 0.099, - "z": 0.556 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": 0.98, - "y": 0.099, - "z": 0.035 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": 1.371, - "y": 0.1, - "z": 0.038 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": 1.371, - "y": 0.099, - "z": 0.558 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": 1.754, - "y": 0.1, - "z": 0.563 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": 1.758, - "y": 0.101, - "z": 0.04 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": -1.82, - "y": 0.1, - "z": 0.61 - }, - "Rotation": { - "x": 0, - "y": 0, - "z": 0 - } - }, - { - "Position": { - "x": -1.82, - "y": 0.1, - "z": 0 - }, - "Rotation": { - "x": 0, - "y": 0, - "z": 0 - } - }, - { - "Position": { - "x": -1.177, - "y": 0.1, - "z": 0 - }, - "Tags": [ - "Investigator" - ] - }, - { - "Position": { - "x": 1.365, - "y": 0.1, - "z": -0.625 - }, - "Rotation": { - "x": 0, - "y": 0, - "z": 0 - } - }, - { - "Position": { - "x": 0.91, - "y": 0.1, - "z": -0.625 - }, - "Rotation": { - "x": 0, - "y": 0, - "z": 0 - } - }, - { - "Position": { - "x": 0.455, - "y": 0.1, - "z": -0.625 - }, - "Rotation": { - "x": 0, - "y": 0, - "z": 0 - } - }, - { - "Position": { - "x": 0, - "y": 0.1, - "z": -0.625 - }, - "Rotation": { - "x": 0, - "y": 0, - "z": 0 - } - }, - { - "Position": { - "x": -0.455, - "y": 0.1, - "z": -0.625 - }, - "Rotation": { - "x": 0, - "y": 0, - "z": 0 - } - }, - { - "Position": { - "x": -0.91, - "y": 0.1, - "z": -0.625 - }, - "Rotation": { - "x": 0, - "y": 0, - "z": 0 - } - }, - { - "Position": { - "x": -1.365, - "y": 0.1, - "z": -0.625 - }, - "Rotation": { - "x": 0, - "y": 0, - "z": 0 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "b": 0, - "g": 0, - "r": 0 - }, - "CustomImage": { - "CustomTile": { - "Stackable": false, - "Stretch": true, - "Thickness": 0.1, - "Type": 3 - }, - "ImageScalar": 1, - "ImageSecondaryURL": "", - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/2037357630681963618/E7271737B19CE0BFAAA382BEEEF497FE3E06ECC1/", - "WidthScale": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0840d5", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/NavigationOverlayApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local NavigationOverlayApi = {}\n local HANDLER_GUID = \"797ede\"\n\n -- Copies the visibility for the Navigation overlay\n ---@param startColor String Color of the player to copy from\n ---@param targetColor String Color of the targeted player\n NavigationOverlayApi.copyVisibility = function(startColor, targetColor)\n getObjectFromGUID(HANDLER_GUID).call(\"copyVisibility\", {\n startColor = startColor,\n targetColor = targetColor\n })\n end\n\n -- Changes the Navigation Overlay view (\"Full View\" --\u003e \"Play Areas\" --\u003e \"Closed\" etc.)\n ---@param playerColor String Color of the player to update the visibility for\n NavigationOverlayApi.cycleVisibility = function(playerColor)\n getObjectFromGUID(HANDLER_GUID).call(\"cycleVisibility\", playerColor)\n end\n\n return NavigationOverlayApi\nend\nend)\n__bundle_register(\"core/token/TokenChecker\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local CHAOS_TOKEN_NAMES = {\n [\"Elder Sign\"] = true,\n [\"+1\"] = true,\n [\"0\"] = true,\n [\"-1\"] = true,\n [\"-2\"] = true,\n [\"-3\"] = true,\n [\"-4\"] = true,\n [\"-5\"] = true,\n [\"-6\"] = true,\n [\"-7\"] = true,\n [\"-8\"] = true,\n [\"Skull\"] = true,\n [\"Cultist\"] = true,\n [\"Tablet\"] = true,\n [\"Elder Thing\"] = true,\n [\"Auto-fail\"] = true,\n [\"Bless\"] = true,\n [\"Curse\"] = true,\n [\"Frost\"] = true\n }\n\n local TokenChecker = {}\n\n -- returns true if the passed object is a chaos token (by name)\n TokenChecker.isChaosToken = function(obj)\n if CHAOS_TOKEN_NAMES[obj.getName()] then\n return true\n else\n return false\n end\n end\n\n return TokenChecker\nend\nend)\n__bundle_register(\"core/token/TokenManager\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local optionPanelApi = require(\"core/OptionPanelApi\")\n local playAreaApi = require(\"core/PlayAreaApi\")\n local tokenSpawnTrackerApi = require(\"core/token/TokenSpawnTrackerApi\")\n\n local PLAYER_CARD_TOKEN_OFFSETS = {\n [1] = {\n Vector(0, 3, -0.2)\n },\n [2] = {\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [3] = {\n Vector(0, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [4] = {\n Vector(0.4, 3, -0.9),\n Vector(-0.4, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [5] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [6] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2)\n },\n [7] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0, 3, 0.5)\n },\n [8] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(-0.35, 3, 0.5),\n Vector(0.35, 3, 0.5)\n },\n [9] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5)\n },\n [10] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0, 3, 1.2)\n },\n [11] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(-0.35, 3, 1.2),\n Vector(0.35, 3, 1.2)\n },\n [12] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0.7, 3, 1.2),\n Vector(0, 3, 1.2),\n Vector(-0.7, 3, 1.2)\n }\n }\n\n -- stateIDs for the multi-stated resource tokens\n local stateTable = {\n [\"resource\"] = 1,\n [\"ammo\"] = 2,\n [\"bounty\"] = 3,\n [\"charge\"] = 4,\n [\"evidence\"] = 5,\n [\"secret\"] = 6,\n [\"supply\"] = 7\n }\n\n -- Source for tokens\n local TOKEN_SOURCE_GUID = \"124381\"\n\n -- Table of data extracted from the token source bag, keyed by the Memo on each token which\n -- should match the token type keys (\"resource\", \"clue\", etc)\n local tokenTemplates\n\n local DATA_HELPER_GUID = \"708279\"\n\n local playerCardData\n local locationData\n\n local TokenManager = { }\n local internal = { }\n\n -- Spawns tokens for the card. This function is built to just throw a card at it and let it do\n -- the work once a card has hit an area where it might spawn tokens. It will check to see if\n -- the card has already spawned, find appropriate data from either the uses metadata or the Data\n -- Helper, and spawn the tokens.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n TokenManager.spawnForCard = function(card, extraUses)\n if tokenSpawnTrackerApi.hasSpawnedTokens(card.getGUID()) then\n return\n end\n local metadata = JSON.decode(card.getGMNotes())\n if metadata ~= nil then\n internal.spawnTokensFromUses(card, extraUses)\n else\n internal.spawnTokensFromDataHelper(card)\n end\n end\n\n -- Spawns a set of tokens on the given card.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String Type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param tokenCount Number How many tokens to spawn. For damage or horror this value will be set to the\n -- spawned state object rather than spawning multiple tokens\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnTokenGroup = function(card, tokenType, tokenCount, shiftDown, subType)\n local optionPanel = optionPanelApi.getOptions()\n\n if tokenType == \"damage\" or tokenType == \"horror\" then\n TokenManager.spawnCounterToken(card, tokenType, tokenCount, shiftDown)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"enabled\" then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"custom\" and tokenCount == 0 then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n else\n TokenManager.spawnMultipleTokens(card, tokenType, tokenCount, shiftDown, subType)\n end\n end\n\n -- Spawns a single counter token and sets the value to tokenValue. Used for damage and horror\n -- tokens.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String type of token to spawn, valid values are \"damage\" and \"horror\". Other\n -- types should use spawnMultipleTokens()\n ---@param tokenValue Number Value to set the damage/horror to\n TokenManager.spawnCounterToken = function(card, tokenType, tokenValue, shiftDown)\n if tokenValue \u003c 1 or tokenValue \u003e 50 then return end\n\n local pos = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[1][1] + Vector(0, 0, shiftDown))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, tokenType, rot, function(spawned) spawned.setState(tokenValue) end)\n end\n\n TokenManager.spawnResourceCounterToken = function(card, tokenCount)\n local pos = card.positionToWorld(card.positionToLocal(card.getPosition()) + Vector(0, 0.2, -0.5))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, \"resourceCounter\", rot, function(spawned)\n spawned.call(\"updateVal\", tokenCount)\n end)\n end\n\n -- Spawns a number of tokens.\n ---@param tokenType String type of token to spawn, valid values are resource\", \"doom\", or \"clue\".\n -- Other types should use spawnCounterToken()\n ---@param tokenCount Number How many tokens to spawn\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnMultipleTokens = function(card, tokenType, tokenCount, shiftDown, subType)\n -- not checking the max at this point since clue offsets are calculated dynamically\n if tokenCount \u003c 1 then return end\n\n local offsets = {}\n if tokenType == \"clue\" then\n offsets = internal.buildClueOffsets(card, tokenCount)\n else\n -- only up to 12 offset tables defined\n if tokenCount \u003e 12 then return end\n for i = 1, tokenCount do\n offsets[i] = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[tokenCount][i])\n -- Fix the y-position for the spawn, since positionToWorld considers rotation which can\n -- have bad results for face up/down differences\n offsets[i].y = card.getPosition().y + 0.15\n end\n end\n\n if shiftDown ~= nil then\n -- Copy the offsets to make sure we don't change the static values\n local baseOffsets = offsets\n offsets = { }\n for i, baseOffset in ipairs(baseOffsets) do\n offsets[i] = baseOffset\n offsets[i][3] = offsets[i][3] + shiftDown\n end\n end\n\n if offsets == nil then\n error(\"couldn't find offsets for \" .. tokenCount .. ' tokens')\n return\n end\n\n -- handling for not provided subtype (for example when spawning from custom data helpers)\n if subType == nil then\n subType = \"\"\n end\n \n -- this is used to load the correct state for additional resource tokens (e.g. \"Ammo\")\n local callback = nil\n local stateID = stateTable[string.lower(subType)]\n if tokenType == \"resource\" and stateID ~= nil and stateID ~= 1 then\n callback = function(spawned) spawned.setState(stateID) end\n end\n\n for i = 1, tokenCount do\n TokenManager.spawnToken(offsets[i], tokenType, card.getRotation(), callback)\n end\n end\n\n -- Spawns a single token at the given global position by copying it from the template bag.\n ---@param position Global position to spawn the token\n ---@param tokenType String type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param rotation Vector Rotation to be used for the new token. Only the y-value will be used,\n -- x and z will use the default rotation from the source bag\n ---@param callback function A callback function triggered after the new token is spawned\n TokenManager.spawnToken = function(position, tokenType, rotation, callback)\n internal.initTokenTemplates()\n local loadTokenType = tokenType\n if tokenType == \"clue\" or tokenType == \"doom\" then\n loadTokenType = \"clueDoom\"\n end\n if tokenTemplates[loadTokenType] == nil then\n error(\"Unknown token type '\" .. tokenType .. \"'\")\n return\n end\n local tokenTemplate = tokenTemplates[loadTokenType]\n\n -- Take ONLY the Y-value for rotation, so we don't flip the token coming out of the bag\n local rot = Vector(tokenTemplate.Transform.rotX,\n 270,\n tokenTemplate.Transform.rotZ)\n if rotation ~= nil then\n rot.y = rotation.y\n end\n if tokenType == \"doom\" then\n rot.z = 180\n end\n\n tokenTemplate.Nickname = \"\"\n return spawnObjectData({\n data = tokenTemplate,\n position = position,\n rotation = rot,\n callback_function = callback\n })\n end\n\n -- Checks a card for metadata to maybe replenish it\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n TokenManager.maybeReplenishCard = function(card, uses, mat)\n -- TODO: support for cards with multiple uses AND replenish (as of yet, no official card needs that)\n if uses[1].count and uses[1].replenish then\n internal.replenishTokens(card, uses, mat)\n end\n end\n\n -- Delegate function to the token spawn tracker. Exists to avoid circular dependencies in some\n -- callers.\n ---@param card Object Card object to reset the tokens for\n TokenManager.resetTokensSpawned = function(card)\n tokenSpawnTrackerApi.resetTokensSpawned(card.getGUID())\n end\n\n -- Pushes new player card data into the local copy of the Data Helper player data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addPlayerCardData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n playerCardData[k] = v\n end\n end\n\n -- Pushes new location data into the local copy of the Data Helper location data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addLocationData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n locationData[k] = v\n end\n end\n\n -- Checks to see if the given card has location data in the DataHelper\n ---@param card Object Card to check for data\n ---@return Boolean True if this card has data in the helper, false otherwise\n TokenManager.hasLocationData = function(card)\n internal.initDataHelperData()\n return internal.getLocationData(card) ~= nil\n end\n\n internal.initTokenTemplates = function()\n if tokenTemplates ~= nil then\n return\n end\n tokenTemplates = { }\n local tokenSource = getObjectFromGUID(TOKEN_SOURCE_GUID)\n for _, tokenTemplate in ipairs(tokenSource.getData().ContainedObjects) do\n local tokenName = tokenTemplate.Memo\n tokenTemplates[tokenName] = tokenTemplate\n end\n end\n\n -- Copies the data from the DataHelper. Will only happen once.\n internal.initDataHelperData = function()\n if playerCardData ~= nil then\n return\n end\n local dataHelper = getObjectFromGUID(DATA_HELPER_GUID)\n playerCardData = dataHelper.getTable('PLAYER_CARD_DATA')\n locationData = dataHelper.getTable('LOCATIONS_DATA')\n end\n\n -- Spawn tokens for a card based on the uses metadata. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n internal.spawnTokensFromUses = function(card, extraUses)\n local uses = internal.getUses(card)\n if uses == nil then return end\n\n -- go through tokens to spawn\n local type, token, tokenCount\n for i, useInfo in ipairs(uses) do\n type = useInfo.type\n token = useInfo.token\n tokenCount = (useInfo.count or 0)\n + (useInfo.countPerInvestigator or 0) * playAreaApi.getInvestigatorCount()\n if extraUses ~= nil and extraUses[type] ~= nil then\n tokenCount = tokenCount + extraUses[type]\n end\n -- Shift each spawned group after the first down so they don't pile on each other\n TokenManager.spawnTokenGroup(card, token, tokenCount, (i - 1) * 0.8, type)\n end\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a card based on the data helper data. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n internal.spawnTokensFromDataHelper = function(card)\n internal.initDataHelperData()\n local playerData = internal.getPlayerCardData(card)\n if playerData ~= nil then\n internal.spawnPlayerCardTokensFromDataHelper(card, playerData)\n end\n local locationData = internal.getLocationData(card)\n if locationData ~= nil then\n internal.spawnLocationTokensFromDataHelper(card, locationData)\n end\n end\n\n -- Spawn tokens for a player card using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Player card data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnPlayerCardTokensFromDataHelper = function(card, playerData)\n token = playerData.tokenType\n tokenCount = playerData.tokenCount\n --log(\"Spawning data helper tokens for \"..card.getName()..'['..card.getDescription()..']: '..tokenCount..\"x \"..token)\n TokenManager.spawnTokenGroup(card, token, tokenCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a location using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Location data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnLocationTokensFromDataHelper = function(card, locationData)\n local clueCount = internal.getClueCountFromData(card, locationData)\n if clueCount \u003e 0 then\n TokenManager.spawnTokenGroup(card, \"clue\", clueCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n end\n\n internal.getPlayerCardData = function(card)\n return playerCardData[card.getName() .. ':' .. card.getDescription()]\n or playerCardData[card.getName()]\n end\n\n internal.getLocationData = function(card)\n return locationData[card.getName() .. '_' .. card.getGUID()] or locationData[card.getName()]\n end\n\n internal.getClueCountFromData = function(card, locationData)\n -- Return the number of clues to spawn on this location\n if locationData == nil then\n error('attempted to get clue for unexpected object: ' .. card.getName())\n return 0\n end\n\n --log(card.getName() .. ' : ' .. locationData.type .. ' : ' .. locationData.value .. ' : ' .. locationData.clueSide)\n if ((card.is_face_down and locationData.clueSide == 'back')\n or (not card.is_face_down and locationData.clueSide == 'front')) then\n if locationData.type == 'fixed' then\n return locationData.value\n elseif locationData.type == 'perPlayer' then\n return locationData.value * playAreaApi.getInvestigatorCount()\n end\n error('unexpected location type: ' .. locationData.type)\n end\n return 0\n end\n\n -- Gets the right uses structure for this card, based on metadata and face up/down state\n ---@param card Object Card to pull the uses from\n internal.getUses = function(card)\n local metadata = JSON.decode(card.getGMNotes()) or { }\n if metadata.type == \"Location\" then\n if card.is_face_down and metadata.locationBack ~= nil then\n return metadata.locationBack.uses\n elseif not card.is_face_down and metadata.locationFront ~= nil then\n return metadata.locationFront.uses\n end\n elseif not card.is_face_down then\n return metadata.uses\n end\n\n return nil\n end\n\n -- Dynamically create positions for clues on a card.\n ---@param card Object Card the clues will be placed on\n ---@param count Integer How many clues?\n ---@return Table Array of global positions to spawn the clues at\n internal.buildClueOffsets = function(card, count)\n local pos = card.getPosition()\n local cluePositions = { }\n for i = 1, count do\n local row = math.floor(1 + (i - 1) / 4)\n local column = (i - 1) % 4\n table.insert(cluePositions, Vector(pos.x + 1.5 - 0.55 * row, pos.y + 0.15, pos.z - 0.825 + 0.55 * column))\n end\n return cluePositions\n end\n\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n internal.replenishTokens = function(card, uses, mat)\n local cardPos = card.getPosition()\n\n -- don't continue for cards on the deck (Norman) or in the discard pile\n if mat.positionToLocal(cardPos).x \u003c -1 then return end\n\n -- get current amount of resource tokens on the card\n local search = internal.searchOnCard(cardPos, card.getRotation())\n local clickableResourceCounter = nil\n local foundTokens = 0\n\n for _, obj in ipairs(search) do\n local obj = obj.hit_object\n local memo = obj.getMemo()\n\n if (stateTable[memo] or 0) \u003e 0 then\n foundTokens = foundTokens + math.abs(obj.getQuantity())\n obj.destruct()\n elseif memo == \"resourceCounter\" then\n foundTokens = obj.getVar(\"val\")\n clickableResourceCounter = obj\n break\n end\n end\n\n -- this is the theoretical new amount of uses (to be checked below)\n local newCount = foundTokens + uses[1].replenish\n\n -- if there are already more uses than the replenish amount, keep them\n if foundTokens \u003e uses[1].count then\n newCount = foundTokens\n -- only replenish up until the replenish amount\n elseif newCount \u003e uses[1].count then\n newCount = uses[1].count\n end\n\n -- update the clickable counter or spawn a group of tokens\n if clickableResourceCounter then\n clickableResourceCounter.call(\"updateVal\", newCount)\n else\n TokenManager.spawnTokenGroup(card, uses[1].token, newCount, _, uses[1].type)\n end\n end\n\n -- searches on a card (standard size) and returns the result\n ---@param position Table Position of the card\n ---@param rotation Table Rotation of the card\n internal.searchOnCard = function(position, rotation)\n return Physics.cast({\n origin = position,\n direction = {0, 1, 0},\n orientation = rotation,\n type = 3,\n size = { 2.5, 0.5, 3.5 },\n max_distance = 1,\n debug = false\n })\n end\n\n return TokenManager\nend\nend)\n__bundle_register(\"core/OptionPanelApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local OptionPanelApi = {}\n\n -- loads saved options\n ---@param options Table New options table\n OptionPanelApi.loadSettings = function(options)\n return Global.call(\"loadSettings\", options)\n end\n\n -- returns option panel table\n OptionPanelApi.getOptions = function()\n return Global.getTable(\"optionPanel\")\n end\n\n return OptionPanelApi\nend\nend)\n__bundle_register(\"core/token/TokenSpawnTrackerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenSpawnTracker = { }\n local SPAWN_TRACKER_GUID = \"e3ffc9\"\n\n TokenSpawnTracker.hasSpawnedTokens = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"hasSpawnedTokens\", cardGuid)\n end\n\n TokenSpawnTracker.markTokensSpawned = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"markTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetTokensSpawned = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetAllAssetAndEvents = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAllAssetAndEvents\")\n end\n\n TokenSpawnTracker.resetAllLocations = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAllLocations\")\n end\n\n TokenSpawnTracker.resetAll = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAll\")\n end\n\n return TokenSpawnTracker\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\n---------------------------------------------------------\n-- specific setup (different for each playmat)\n---------------------------------------------------------\n\nTRASHCAN_GUID = \"4b8594\"\nSTAT_TRACKER_GUID = \"e74881\"\nRESOURCE_COUNTER_GUID = \"a4b60d\"\nCLUE_COUNTER_GUID = \"37be78\"\nCLUE_CLICKER_GUID = \"4111de\"\n\nrequire(\"playermat/Playmat\")\nend)\n__bundle_register(\"playermat/Playmat\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal mythosAreaApi = require(\"core/MythosAreaApi\")\nlocal navigationOverlayApi = require(\"core/NavigationOverlayApi\")\nlocal tokenChecker = require(\"core/token/TokenChecker\")\nlocal tokenManager = require(\"core/token/TokenManager\")\n\n-- set true to enable debug logging and show Physics.cast()\nlocal DEBUG = false\n\n-- we use this to turn off collision handling until onLoad() is complete\nlocal collisionEnabled = false\n\n-- position offsets relative to mat [x, y, z]\nlocal DRAWN_ENCOUNTER_CARD_OFFSET = {1.365, 0.5, -0.625}\nlocal DRAWN_CHAOS_TOKEN_OFFSET = {-1.55, 0.25, -0.58}\n\n-- x-Values for discard buttons\nlocal DISCARD_BUTTON_OFFSETS = {-1.365, -0.91, -0.455, 0, 0.455, 0.91}\n\nlocal SEARCH_AROUND_SELF_X_BUFFER = 8\n\n-- defined areas for \"inArea()\" and \"Physics.cast()\"\nlocal MAIN_PLAY_AREA = {\n upperLeft = {\n x = 1.98,\n z = 0.736\n },\n lowerRight = {\n x = -0.79,\n z = -0.39\n }\n}\nlocal INVESTIGATOR_AREA = {\n upperLeft = {\n x = -1.084,\n z = 0.06517\n },\n lowerRight = {\n x = -1.258,\n z = -0.0805\n }\n}\nlocal THREAT_AREA = {\n upperLeft = {\n x = 1.53,\n z = -0.34\n },\n lowerRight = {\n x = -1.13,\n z = -0.92\n }\n}\nlocal DECK_DISCARD_AREA = {\n upperLeft = {\n x = -1.62,\n z = 0.855\n },\n lowerRight = {\n x = -2.02,\n z = -0.245\n },\n center = {\n x = -1.82,\n y = 0.1,\n z = 0.305\n },\n size = {\n x = 0.4,\n y = 0.1,\n z = 1.1\n }\n}\n\n-- local position of draw and discard pile\nlocal DRAW_DECK_POSITION = { x = -1.82, y = 0, z = 0 }\nlocal DISCARD_PILE_POSITION = { x = -1.82, y = 0, z = 0.61 }\n\n-- global position of encounter discard pile\nlocal ENCOUNTER_DISCARD_POSITION = { x = -3.85, y = 1.5, z = 10.38}\n\n-- global variable so it can be reset by the Clean Up Helper\nactiveInvestigatorId = \"00000\"\n\nlocal TRASHCAN, STAT_TRACKER, RESOURCE_COUNTER\nlocal isDrawButtonVisible = false\n\n-- global variable to report \"Dream-Enhancing Serum\" status\nisDES = false\n\nfunction onSave()\n return JSON.encode({\n playerColor = playerColor,\n activeInvestigatorId = activeInvestigatorId,\n isDrawButtonVisible = isDrawButtonVisible\n })\nend\n\nfunction onLoad(saveState)\n self.interactable = DEBUG\n\n TRASHCAN = getObjectFromGUID(TRASHCAN_GUID)\n STAT_TRACKER = getObjectFromGUID(STAT_TRACKER_GUID)\n RESOURCE_COUNTER = getObjectFromGUID(RESOURCE_COUNTER_GUID)\n\n -- button creation\n for i = 1, 6 do\n makeDiscardButton(DISCARD_BUTTON_OFFSETS[i], i)\n end\n\n self.createButton({\n click_function = \"drawEncounterCard\",\n function_owner = self,\n position = {-1.84, 0, -0.65},\n rotation = {0, 80, 0},\n width = 265,\n height = 190\n })\n\n self.createButton({\n click_function = \"drawChaosTokenButton\",\n function_owner = self,\n position = {1.85, 0, -0.74},\n rotation = {0, -45, 0},\n width = 135,\n height = 135\n })\n\n self.createButton({\n label = \"Upkeep\",\n click_function = \"doUpkeep\",\n function_owner = self,\n position = {1.84, 0.1, -0.44},\n scale = {0.12, 0.12, 0.12},\n width = 800,\n height = 280,\n font_size = 180\n })\n\n -- save state loading\n local state = JSON.decode(saveState)\n if state ~= nil then\n playerColor = state.playerColor\n activeInvestigatorId = state.activeInvestigatorId\n isDrawButtonVisible = state.isDrawButtonVisible\n end\n\n showDrawButton(isDrawButtonVisible)\n\n collisionEnabled = true\n\n math.randomseed(os.time())\nend\n\n---------------------------------------------------------\n-- utility functions\n---------------------------------------------------------\n\n-- searches an area and optionally filters the result\nfunction searchArea(origin, size, filter)\n local searchResult = Physics.cast({\n origin = origin,\n direction = { 0, 1, 0 },\n orientation = self.getRotation(),\n type = 3,\n size = size,\n max_distance = 1\n })\n\n local objList = {}\n for _, v in ipairs(searchResult) do\n if not filter or (filter and filter(v.hit_object)) then\n table.insert(objList, v.hit_object)\n end\n end\n return objList\nend\n\n-- filter functions for searchArea()\nfunction isCard(x) return x.type == 'Card' end\nfunction isDeck(x) return x.type == 'Deck' end\nfunction isCardOrDeck(x) return x.type == 'Card' or x.type == 'Deck' end\n\n-- Finds all objects on the playmat and associated set aside zone.\nfunction searchAroundSelf(filter)\n local bounds = self.getBoundsNormalized()\n -- Increase the width to cover the set aside zone\n bounds.size.x = bounds.size.x + SEARCH_AROUND_SELF_X_BUFFER\n -- Since the cast is centered on the position, shift left or right to keep the non-set aside edge\n -- of the cast at the edge of the playmat\n -- setAsideDirection accounts for the set aside zone being on the left or right, depending on the\n -- table position of the playmat\n local setAsideDirection = bounds.center.z \u003e 0 and 1 or -1\n local localCenter = self.positionToLocal(bounds.center)\n localCenter.x = localCenter.x + setAsideDirection * SEARCH_AROUND_SELF_X_BUFFER / 2 / self.getScale().x\n return searchArea(self.positionToWorld(localCenter), bounds.size, filter)\nend\n\n-- searches the area around the draw deck and discard pile\nfunction searchDeckAndDiscardArea(filter)\n local pos = self.positionToWorld(DECK_DISCARD_AREA.center)\n local scale = self.getScale()\n local size = {\n x = DECK_DISCARD_AREA.size.x * scale.x,\n y = DECK_DISCARD_AREA.size.y, \n z = DECK_DISCARD_AREA.size.z * scale.z\n }\n return searchArea(pos, size, filter)\nend\n\nfunction doNotReady(card)\n return card.getVar(\"do_not_ready\") or false\nend\n\n---------------------------------------------------------\n-- Discard buttons\n---------------------------------------------------------\n\n-- builds a function that discards things in searchPosition\n-- stuff on the card/deck will be put into the local trashcan\nfunction makeDiscardHandlerFor(searchPosition)\n return function ()\n local origin = self.positionToWorld(searchPosition)\n for _, obj in ipairs(searchArea(origin, {2, 1, 3.2})) do\n if isCardOrDeck(obj) then\n if obj.hasTag(\"PlayerCard\") then\n placeOrMergeIntoDeck(obj, returnGlobalDiscardPosition(), self.getRotation())\n else\n placeOrMergeIntoDeck(obj, ENCOUNTER_DISCARD_POSITION, {x = 0, y = -90, z = 0})\n end\n -- put chaos tokens back into bag (e.g. Unrelenting)\n elseif tokenChecker.isChaosToken(obj) then\n local chaosBag = chaosBagApi.findChaosBag()\n chaosBag.putObject(obj)\n -- don't touch the table or this playmat itself\n elseif obj.guid ~= \"4ee1f2\" and obj ~= self then\n TRASHCAN.putObject(obj)\n end\n end\n end\nend\n\n-- places a card/deck at a position or merges into an existing deck\n-- rotation is optional\nfunction placeOrMergeIntoDeck(obj, pos, rot)\n if not pos then return end\n\n local offset = 0.5\n local deck, card, newPos\n \n -- search the new position for existing card/deck\n local searchResult = searchArea(pos, { 1, 1, 1 }, isCardOrDeck)\n if #searchResult == 1 then\n local match = searchResult[1]\n if match.type == 'Card' then\n card = match\n elseif match.type == 'Deck' then\n deck = match\n end\n end\n\n -- update vertical component of new position\n if card or deck then\n local bounds = searchResult[1].getBounds()\n newPos = Vector(pos):setAt(\"y\", bounds.center.y + bounds.size.y / 2 + offset)\n else\n newPos = Vector(pos) + Vector(0, offset, 0)\n end\n\n -- actual movement of the object\n if rot then\n obj.setRotationSmooth(rot, false, true)\n end\n obj.setPositionSmooth(newPos, false, true)\n \n -- this avoids a TTS bug that merges unrelated cards that are not resting\n if deck then\n Wait.time(function() deck.putObject(obj) end, 0.3)\n elseif card then\n Wait.time(function() obj.setPosition(newPos) end, 0.3)\n end\nend\n\n-- build a discard button to discard from searchPosition (number must be unique)\nfunction makeDiscardButton(xValue, number)\n local position = { xValue, 0.1, -0.94}\n local searchPosition = {-position[1], position[2], position[3] + 0.32}\n local handler = makeDiscardHandlerFor(searchPosition)\n local handlerName = 'handler' .. number\n self.setVar(handlerName, handler)\n self.createButton({\n label = \"Discard\",\n click_function = handlerName,\n function_owner = self,\n position = position,\n scale = {0.12, 0.12, 0.12},\n width = 900,\n height = 350,\n font_size = 220\n })\nend\n\n---------------------------------------------------------\n-- Upkeep button\n---------------------------------------------------------\n\n-- calls the Upkeep function with correct parameter\nfunction doUpkeepFromHotkey(color)\n doUpkeep(_, color)\nend\n\nfunction doUpkeep(_, clickedByColor, isRightClick)\n -- right-click allow color changing\n if isRightClick then\n changeColor(clickedByColor)\n return\n end\n\n -- send messages to player who clicked button if no seated player found\n messageColor = Player[playerColor].seated and playerColor or clickedByColor\n\n -- unexhaust cards in play zone, flip action tokens and find forcedLearning\n local forcedLearning = false\n local rot = self.getRotation()\n for _, obj in ipairs(searchAroundSelf()) do\n if obj.getDescription() == \"Action Token\" and obj.is_face_down then\n obj.flip()\n elseif obj.type == \"Card\" and not inArea(self.positionToLocal(obj.getPosition()), INVESTIGATOR_AREA) then\n local cardMetadata = JSON.decode(obj.getGMNotes()) or {}\n if not doNotReady(obj) then\n local cardRotation = round(obj.getRotation().y, 0) - rot.y\n local yRotDiff = 0\n\n if cardRotation \u003c 0 then\n cardRotation = cardRotation + 360\n end\n\n -- rotate cards to the next multiple of 90° towards 0°\n if cardRotation \u003e 90 and cardRotation \u003c= 180 then\n yRotDiff = 90\n elseif cardRotation \u003c 270 and cardRotation \u003e 180 then\n yRotDiff = 270\n end\n\n -- set correct rotation for face-down cards\n rot.z = obj.is_face_down and 180 or 0\n obj.setRotation({rot.x, rot.y + yRotDiff, rot.z})\n end\n if cardMetadata.id == \"08031\" then\n forcedLearning = true\n end\n if cardMetadata.uses ~= nil then\n tokenManager.maybeReplenishCard(obj, cardMetadata.uses, self)\n end\n end\n end\n\n -- flip investigator mini-card and summoned servitor mini-card\n -- (all characters allowed to account for custom IDs - e.g. 'Z0000' for TTS Zoop generated IDs)\n if activeInvestigatorId ~= nil then\n local miniId = string.match(activeInvestigatorId, \".....\") .. \"-m\"\n for _, obj in ipairs(getObjects()) do\n if obj.type == \"Card\" and obj.is_face_down then\n local notes = JSON.decode(obj.getGMNotes())\n if notes ~= nil and notes.type == \"Minicard\" and (notes.id == miniId or notes.id == \"09080-m\") then\n obj.flip()\n end\n end\n end\n end\n\n -- gain a resource (or two if playing Jenny Barnes)\n if string.match(activeInvestigatorId, \"%d%d%d%d%d\") == \"02003\" then\n gainResources(2)\n printToColor(\"Gaining 2 resources (Jenny)\", messageColor)\n else\n gainResources(1)\n end\n\n -- draw a card (with handling for Patrice and Forced Learning)\n if activeInvestigatorId == \"06005\" then\n if forcedLearning then\n printToColor(\"Wow, did you really take 'Versatile' to play Patrice with 'Forced Learning'? Choose which draw replacement effect takes priority and draw cards accordingly.\", messageColor)\n else\n local handSize = #Player[playerColor].getHandObjects()\n if handSize \u003c 5 then\n local cardsToDraw = 5 - handSize\n printToColor(\"Drawing \" .. cardsToDraw .. \" cards (Patrice)\", messageColor)\n drawCardsWithReshuffle(cardsToDraw)\n end\n end\n elseif forcedLearning then\n printToColor(\"Drawing 2 cards, discard 1 (Forced Learning)\", messageColor)\n drawCardsWithReshuffle(2)\n elseif activeInvestigatorId == \"89001\" then\n printToColor(\"Drawing 2 cards (Subject 5U-21)\", messageColor)\n drawCardsWithReshuffle(2)\n else\n drawCardsWithReshuffle(1)\n end\nend\n\n-- adds the specified amount of resources to the resource counter\nfunction gainResources(amount)\n local count = RESOURCE_COUNTER.getVar(\"val\")\n local add = tonumber(amount) or 0\n RESOURCE_COUNTER.call(\"updateVal\", count + add)\nend\n\n-- returns the resource counter amount\nfunction getResourceCount()\n return RESOURCE_COUNTER.getVar(\"val\")\nend\n\n-- function for \"draw 1 button\" (that can be added via option panel)\nfunction doDrawOne(_, color)\n -- send messages to player who clicked button if no seated player found\n messageColor = Player[playerColor].seated and playerColor or color\n drawCardsWithReshuffle(1)\nend\n\n-- draw X cards (shuffle discards if necessary)\nfunction drawCardsWithReshuffle(numCards)\n getDrawDiscardDecks()\n\n -- Norman Withers handling\n if string.match(activeInvestigatorId, \"%d%d%d%d%d\") == \"08004\" then\n local harbinger = false\n if topCard ~= nil and topCard.getName() == \"The Harbinger\" then harbinger = true\n elseif drawDeck ~= nil and not drawDeck.is_face_down then\n local cards = drawDeck.getObjects()\n if cards[#cards].name == \"The Harbinger\" then harbinger = true end\n end\n\n if harbinger then\n printToColor(\"The Harbinger is on top of your deck, not drawing cards\", messageColor)\n return\n end\n\n if topCard ~= nil then\n topCard.deal(numCards, playerColor)\n numCards = numCards - 1\n if numCards == 0 then return end\n end\n end\n\n local deckSize = 1\n if drawDeck == nil then\n deckSize = 0\n elseif drawDeck.tag == \"Deck\" then\n deckSize = #drawDeck.getObjects()\n end\n\n if deckSize \u003e= numCards then\n drawCards(numCards)\n return\n end\n\n drawCards(deckSize)\n if discardPile ~= nil then\n shuffleDiscardIntoDeck()\n Wait.time(|| drawCards(numCards - deckSize), 1)\n end\n printToColor(\"Take 1 horror (drawing card from empty deck)\", messageColor)\nend\n\n-- get the draw deck and discard pile objects\nfunction getDrawDiscardDecks()\n drawDeck = nil\n discardPile = nil\n topCard = nil\n\n for _, object in ipairs(searchDeckAndDiscardArea(isCardOrDeck)) do\n if self.positionToLocal(object.getPosition()).z \u003e 0.5 then\n discardPile = object\n -- Norman Withers handling\n elseif string.match(activeInvestigatorId, \"%d%d%d%d%d\") == \"08004\" and not object.is_face_down then\n topCard = object\n else\n drawDeck = object\n end\n end\nend\n\nfunction drawCards(numCards)\n if drawDeck == nil then return end\n drawDeck.deal(numCards, playerColor)\nend\n\nfunction shuffleDiscardIntoDeck()\n if not discardPile.is_face_down then discardPile.flip() end\n discardPile.shuffle()\n discardPile.setPositionSmooth(self.positionToWorld(DRAW_DECK_POSITION), false, false)\n drawDeck = discardPile\n discardPile = nil\nend\n\n-- discard a random non-hidden card from hand\nfunction doDiscardOne()\n local hand = Player[playerColor].getHandObjects()\n if #hand == 0 then\n broadcastToAll(\"Cannot discard from empty hand!\", \"Red\")\n else\n local choices = {}\n for i = 1, #hand do\n local notes = JSON.decode(hand[i].getGMNotes())\n if notes ~= nil then\n if notes.hidden ~= true then\n table.insert(choices, i)\n end\n else\n table.insert(choices, i)\n end\n end\n\n if #choices == 0 then\n broadcastToAll(\"Hidden cards can't be randomly discarded.\", \"Orange\")\n return\n end\n\n -- get a random non-hidden card (from the \"choices\" table)\n local num = math.random(1, #choices)\n placeOrMergeIntoDeck(hand[choices[num]], returnGlobalDiscardPosition(), self.getRotation())\n broadcastToAll(playerColor .. \" randomly discarded card \" .. choices[num] .. \"/\" .. #hand .. \".\", \"White\")\n end\nend\n\n---------------------------------------------------------\n-- color related functions\n---------------------------------------------------------\n\n-- changes the player color\nfunction changeColor(clickedByColor)\n local colorList = {\n \"White\",\n \"Brown\",\n \"Red\",\n \"Orange\",\n \"Yellow\",\n \"Green\",\n \"Teal\",\n \"Blue\",\n \"Purple\",\n \"Pink\"\n }\n\n -- remove existing colors from the list of choices\n for _, existingColor in ipairs(Player.getAvailableColors()) do\n for i, newColor in ipairs(colorList) do\n if existingColor == newColor then\n table.remove(colorList, i)\n end\n end\n end\n\n -- show the option dialog for color selection to the player that triggered this\n Player[clickedByColor].showOptionsDialog(\"Select a new color:\", colorList, _, function(color)\n local HAND_ZONE_GUIDS = {\n \"a70eee\", -- White\n \"5fe087\", -- Orange\n \"0285cc\", -- Green\n \"be2f17\" -- Red\n }\n local index\n local startPos = self.getPosition()\n\n -- get respective hand zone by position\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n index = 1\n else\n index = 2\n end\n else\n if startPos.z \u003e 0 then\n index = 3\n else\n index = 4\n end\n end\n\n -- update the color of the hand zone\n local handZone = getObjectFromGUID(HAND_ZONE_GUIDS[index])\n handZone.setValue(color)\n\n -- if the seated player clicked this, reseat him to the new color\n if clickedByColor == playerColor then\n navigationOverlayApi.copyVisibility(playerColor, color)\n Player[playerColor].changeColor(color)\n end\n\n -- update the internal variable\n playerColor = color\n end)\nend\n\n---------------------------------------------------------\n-- playmat token spawning\n---------------------------------------------------------\n\n-- Finds all customizable cards in this play area and updates their metadata based on the selections\n-- on the matching upgrade sheet.\n-- This method is theoretically O(n^2), and should be used sparingly. In practice it will only be\n-- called when a checkbox is added or removed in-game (which should be rare), and is bounded by the\n-- number of customizable cards in play.\nfunction syncAllCustomizableCards()\n for _, card in ipairs(searchAroundSelf(isCard)) do\n syncCustomizableMetadata(card)\n end\nend\n\nfunction syncCustomizableMetadata(card)\n local cardMetadata = JSON.decode(card.getGMNotes()) or { }\n if cardMetadata == nil or cardMetadata.customizations == nil then\n return\n end\n for _, upgradeSheet in ipairs(searchAroundSelf(isCard)) do\n local upgradeSheetMetadata = JSON.decode(upgradeSheet.getGMNotes()) or { }\n if upgradeSheetMetadata.id == (cardMetadata.id .. \"-c\") then\n for i, customization in ipairs(cardMetadata.customizations) do\n if customization.replaces ~= nil and customization.replaces.uses ~= nil then\n -- Allowed use of call(), no APIs for individual cards\n if upgradeSheet.call(\"isUpgradeActive\", i) then\n cardMetadata.uses = customization.replaces.uses\n card.setGMNotes(JSON.encode(cardMetadata))\n else\n -- TODO: Get the original metadata to restore it... maybe. This should only be\n -- necessary in the very unlikely case that a user un-checks a previously-full upgrade\n -- row while the card is in play. It will be much easier once the AllPlayerCardsApi is\n -- in place, so defer until it is\n end\n end\n end\n end\n end\nend\n\nfunction spawnTokensFor(object)\n local extraUses = { }\n if activeInvestigatorId == \"03004\" then\n extraUses[\"Charge\"] = 1\n end\n\n tokenManager.spawnForCard(object, extraUses)\nend\n\nfunction onCollisionEnter(collision_info)\n local object = collision_info.collision_object\n\n -- detect if \"Dream-Enhancing Serum\" is placed\n if object.getName() == \"Dream-Enhancing Serum\" then isDES = true end\n\n -- only continue if loading is completed\n if not collisionEnabled then return end\n\n -- only continue for cards\n if object.type ~= \"Card\" then return end\n\n maybeUpdateActiveInvestigator(object)\n syncCustomizableMetadata(object)\n\n local localCardPos = self.positionToLocal(object.getPosition())\n if inArea(localCardPos, DECK_DISCARD_AREA) then\n tokenManager.resetTokensSpawned(object)\n removeTokensFromObject(object)\n elseif shouldSpawnTokens(object) then\n spawnTokensFor(object)\n end\nend\n\n-- detect if \"Dream-Enhancing Serum\" is removed\nfunction onCollisionExit(collision_info)\n if collision_info.collision_object.getName() == \"Dream-Enhancing Serum\" then isDES = false end\nend\n\n-- checks if tokens should be spawned for the provided card\nfunction shouldSpawnTokens(card)\n if card.is_face_down then\n return false\n end\n\n local localCardPos = self.positionToLocal(card.getPosition())\n local metadata = JSON.decode(card.getGMNotes())\n\n -- If no metadata we don't know the type, so only spawn in the main area\n if metadata == nil then\n return inArea(localCardPos, MAIN_PLAY_AREA)\n end\n\n -- Spawn tokens for assets and events on the main area\n if inArea(localCardPos, MAIN_PLAY_AREA)\n and (metadata.type == \"Asset\"\n or metadata.type == \"Event\") then\n return true\n end\n\n -- Spawn tokens for all encounter types in the threat area\n if inArea(localCardPos, THREAT_AREA)\n and (metadata.type == \"Treachery\"\n or metadata.type == \"Enemy\"\n or metadata.weakness) then\n return true\n end\n\n return false\nend\n\nfunction onObjectEnterContainer(container, object)\n Wait.frames(function() resetTokensIfInDeckZone(container, object) end, 1)\nend\n\nfunction resetTokensIfInDeckZone(container, object)\n local pos = self.positionToLocal(container.getPosition())\n if inArea(pos, DECK_DISCARD_AREA) then\n tokenManager.resetTokensSpawned(object)\n removeTokensFromObject(container)\n end\nend\n\n-- removes tokens from the provided card/deck\nfunction removeTokensFromObject(object)\n for _, obj in ipairs(searchArea(object.getPosition(), { 3, 1, 4 })) do\n if obj.getGUID() ~= \"4ee1f2\" and -- table\n obj ~= self and\n obj.type ~= \"Deck\" and\n obj.type ~= \"Card\" and\n obj.memo ~= nil and\n obj.getLock() == false and\n obj.getDescription() ~= \"Action Token\" and\n not tokenChecker.isChaosToken(obj) then\n TRASHCAN.putObject(obj)\n end\n end\nend\n\n---------------------------------------------------------\n-- investigator ID grabbing and skill tracker\n---------------------------------------------------------\n\nfunction maybeUpdateActiveInvestigator(card)\n if not inArea(self.positionToLocal(card.getPosition()), INVESTIGATOR_AREA) then return end\n\n local notes = JSON.decode(card.getGMNotes())\n local class\n\n if notes ~= nil and notes.type == \"Investigator\" and notes.id ~= nil then\n if notes.id == activeInvestigatorId then return end\n class = notes.class\n activeInvestigatorId = notes.id\n STAT_TRACKER.call(\"updateStats\", {notes.willpowerIcons, notes.intellectIcons, notes.combatIcons, notes.agilityIcons})\n elseif activeInvestigatorId ~= \"00000\" then\n class = \"Neutral\"\n activeInvestigatorId = \"00000\"\n STAT_TRACKER.call(\"updateStats\", {1, 1, 1, 1})\n else\n return\n end\n\n -- change state of action tokens\n local search = searchArea(self.positionToWorld({-1.1, 0.05, -0.27}), {4, 1, 1})\n local smallToken = nil\n local STATE_TABLE = {\n [\"Guardian\"] = 1,\n [\"Seeker\"] = 2,\n [\"Rogue\"] = 3,\n [\"Mystic\"] = 4,\n [\"Survivor\"] = 5,\n [\"Neutral\"] = 6\n }\n\n for _, obj in ipairs(search) do\n if obj.getDescription() == \"Action Token\" and obj.getStateId() \u003e 0 then\n if obj.getScale().x \u003c 0.4 then\n smallToken = obj\n else\n setObjectState(obj, STATE_TABLE[class])\n end\n end\n end\n\n -- update the small token with special action for certain investigators\n local SPECIAL_ACTIONS = {\n [\"04002\"] = 8, -- Ursula Downs\n [\"01002\"] = 9, -- Daisy Walker\n [\"01502\"] = 9, -- Daisy Walker\n [\"01002-pb\"] = 9, -- Daisy Walker\n [\"06003\"] = 10, -- Tony Morgan\n [\"04003\"] = 11, -- Finn Edwards\n [\"08016\"] = 14 -- Bob Jenkins\n }\n\n if smallToken ~= nil then\n setObjectState(smallToken, SPECIAL_ACTIONS[activeInvestigatorId] or STATE_TABLE[class])\n end\nend\n\nfunction setObjectState(obj, stateId)\n if obj.getStateId() ~= stateId then obj.setState(stateId) end\nend\n\n---------------------------------------------------------\n-- calls to 'Global' / functions for calls from outside\n---------------------------------------------------------\n\nfunction drawChaosTokenButton(_, _, isRightClick)\n chaosBagApi.drawChaosToken(self, DRAWN_CHAOS_TOKEN_OFFSET, isRightClick)\nend\n\nfunction drawEncounterCard(_, _, isRightClick)\n local pos = self.positionToWorld(DRAWN_ENCOUNTER_CARD_OFFSET)\n local rotY = self.getRotation().y\n mythosAreaApi.drawEncounterCard(pos, rotY, isRightClick)\nend\n\nfunction returnGlobalDiscardPosition()\n return self.positionToWorld(DISCARD_PILE_POSITION)\nend\n\n-- Sets this playermat's draw 1 button to visible\n---@param visible Boolean. Whether the draw 1 button should be visible\nfunction showDrawButton(visible)\n isDrawButtonVisible = visible\n\n -- create the \"Draw 1\" button\n if isDrawButtonVisible then\n self.createButton({\n label = \"Draw 1\",\n click_function = \"doDrawOne\",\n function_owner = self,\n position = { 1.84, 0.1, -0.36 },\n scale = { 0.12, 0.12, 0.12 },\n width = 800,\n height = 280,\n font_size = 180\n })\n\n -- remove the \"Draw 1\" button\n else\n local buttons = self.getButtons()\n for i = 1, #buttons do\n if buttons[i].label == \"Draw 1\" then\n self.removeButton(buttons[i].index)\n end\n end\n end\nend\n\n-- Spawns / destroys a clickable clue counter for this playmat with the correct amount of clues\n---@param showCounter Boolean Whether the clickable clue counter should be present\nfunction clickableClues(showCounter)\n local CLUE_COUNTER = getObjectFromGUID(CLUE_COUNTER_GUID)\n local CLUE_CLICKER = getObjectFromGUID(CLUE_CLICKER_GUID)\n local clickerPos = CLUE_CLICKER.getPosition()\n local clueCount = 0\n\n if showCounter then\n -- current clue count\n clueCount = CLUE_COUNTER.getVar(\"exposedValue\")\n\n -- remove clues\n CLUE_COUNTER.call(\"removeAllClues\")\n\n -- set value for clue clickers\n CLUE_CLICKER.call(\"updateVal\", clueCount)\n\n -- move clue counters up\n clickerPos.y = 1.52\n CLUE_CLICKER.setPosition(clickerPos)\n else\n -- current clue count\n clueCount = CLUE_CLICKER.getVar(\"val\")\n\n -- move clue counters down\n clickerPos.y = 1.3\n CLUE_CLICKER.setPosition(clickerPos)\n\n -- spawn clues\n local pos = self.positionToWorld({x = -1.12, y = 0.05, z = 0.7})\n for i = 1, clueCount do\n pos.y = pos.y + 0.045 * i\n tokenManager.spawnToken(pos, \"clue\", self.getRotation())\n end\n end\nend\n\n-- removes all clues (moving tokens to the trash and setting counters to 0)\nfunction removeClues()\n local CLUE_COUNTER = getObjectFromGUID(CLUE_COUNTER_GUID)\n local CLUE_CLICKER = getObjectFromGUID(CLUE_CLICKER_GUID)\n\n CLUE_COUNTER.call(\"removeAllClues\")\n CLUE_CLICKER.call(\"updateVal\", 0)\nend\n\n-- reports the clue count\n---@param useClickableCounters Boolean Controls which type of counter is getting checked\nfunction getClueCount(useClickableCounters)\n local count = 0\n\n if useClickableCounters then\n local CLUE_CLICKER = getObjectFromGUID(CLUE_CLICKER_GUID)\n count = tonumber(CLUE_CLICKER.getVar(\"val\"))\n else\n local CLUE_COUNTER = getObjectFromGUID(CLUE_COUNTER_GUID)\n count = tonumber(CLUE_COUNTER.getVar(\"exposedValue\"))\n end\n return count\nend\n\n-- Sets this playermat's snap points to limit snapping to matching card types or not. If matchTypes\n-- is true, the main card slot snap points will only snap assets, while the investigator area point\n-- will only snap Investigators. If matchTypes is false, snap points will be reset to snap all\n-- cards.\n---@param matchTypes Boolean. Whether snap points should only snap for the matching card types.\nfunction setLimitSnapsByType(matchTypes)\n local snaps = self.getSnapPoints()\n for i, snap in ipairs(snaps) do\n local snapPos = snap.position\n if inArea(snapPos, MAIN_PLAY_AREA) then\n local snapTags = snaps[i].tags\n if matchTypes then\n if snapTags == nil then\n snaps[i].tags = { \"Asset\" }\n else\n table.insert(snaps[i].tags, \"Asset\")\n end\n else\n snaps[i].tags = nil\n end\n end\n if inArea(snapPos, INVESTIGATOR_AREA) then\n local snapTags = snaps[i].tags\n if matchTypes then\n if snapTags == nil then\n snaps[i].tags = { \"Investigator\" }\n else\n table.insert(snaps[i].tags, \"Investigator\")\n end\n else\n snaps[i].tags = nil\n end\n end\n end\n self.setSnapPoints(snaps)\nend\n\n-- Simple method to check if the given point is in a specified area. Local use only,\n---@param point Vector Point to check, only x and z values are relevant\n---@param bounds Table Defined area to see if the point is within. See MAIN_PLAY_AREA for sample\n-- bounds definition.\n---@return Boolean True if the point is in the area defined by bounds\nfunction inArea(point, bounds)\n return (point.x \u003c bounds.upperLeft.x\n and point.x \u003e bounds.lowerRight.x\n and point.z \u003c bounds.upperLeft.z\n and point.z \u003e bounds.lowerRight.z)\nend\n\n-- called by custom data helpers to add player card data\n---@param args table Contains only one entry, the GUID of the custom data helper\nfunction updatePlayerCards(args)\n local customDataHelper = getObjectFromGUID(args[1])\n local playerCardData = customDataHelper.getTable(\"PLAYER_CARD_DATA\")\n tokenManager.addPlayerCardData(playerCardData)\nend\n\n-- utility function for rounding\n---@param num Number Initial value\n---@param numDecimalPlaces Number Amount of decimal places\nfunction round(num, numDecimalPlaces)\n local mult = 10^(numDecimalPlaces or 0)\n return math.floor(num * mult + 0.5) / mult\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/MythosAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local MythosAreaApi = {}\n local MYTHOS_AREA_GUID = \"9f334f\"\n\n -- returns the chaos token metadata (if provided through scenario reference card)\n MythosAreaApi.returnTokenData = function()\n return getObjectFromGUID(MYTHOS_AREA_GUID).call(\"returnTokenData\")\n end\n\n -- draw an encounter card to the requested position/rotation\n MythosAreaApi.drawEncounterCard = function(pos, rotY, alwaysFaceUp)\n getObjectFromGUID(MYTHOS_AREA_GUID).call(\"drawEncounterCard\", {\n pos = pos,\n rotY = rotY,\n alwaysFaceUp = alwaysFaceUp\n })\n end\n\n return MythosAreaApi\nend\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = { }\n local PLAY_AREA_GUID = \"721ba2\"\n local INVESTIGATOR_COUNTER_GUID = \"f182ee\"\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with\n -- 'displacement_excluded'\n ---@param playerColor Color of the player requesting the shift. Used solely to send an error\n --- message in the unlikely case that the scripting zone has been deleted\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"tryObjectEnterContainer\",\n { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightCountedVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "{\"activeInvestigatorId\":\"00000\",\"isDrawButtonVisible\":false,\"playerColor\":\"Red\"}", - "MeasureMovement": false, - "Name": "Custom_Tile", - "Nickname": "Playermat 4: Red", - "Snap": true, - "Sticky": true, - "Tooltip": false, - "Transform": { - "posX": -30.35, - "posY": 1.45, - "posZ": -26.6, - "rotX": 0, - "rotY": 180, - "rotZ": 0, - "scaleX": 6.43, - "scaleY": 1, - "scaleZ": 6.43 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedSnapPoints": [ - { - "Position": { - "x": -1, - "y": 0.1, - "z": 0.118 - }, - "Tags": [ - "ActionToken" - ] - }, - { - "Position": { - "x": -0.865, - "y": 0.1, - "z": -0.28 - }, - "Tags": [ - "ActionToken" - ] - }, - { - "Position": { - "x": -1, - "y": 0.1, - "z": -0.28 - }, - "Tags": [ - "ActionToken" - ] - }, - { - "Position": { - "x": -1.18, - "y": 0.1, - "z": -0.28 - }, - "Tags": [ - "ActionToken" - ] - }, - { - "Position": { - "x": -1.36, - "y": 0.1, - "z": -0.28 - }, - "Tags": [ - "ActionToken" - ] - }, - { - "Position": { - "x": -0.631, - "y": 0.1, - "z": 0.551 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": -0.616, - "y": 0.102, - "z": 0.024 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": -0.177, - "y": 0.101, - "z": 0.032 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": -0.174, - "y": 0.099, - "z": 0.551 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": 0.212, - "y": 0.1, - "z": 0.559 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": 0.217, - "y": 0.1, - "z": 0.035 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": 0.602, - "y": 0.1, - "z": 0.033 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": 0.605, - "y": 0.1, - "z": 0.555 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": 0.977, - "y": 0.099, - "z": 0.556 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": 0.98, - "y": 0.099, - "z": 0.035 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": 1.371, - "y": 0.1, - "z": 0.038 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": 1.371, - "y": 0.099, - "z": 0.558 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": 1.754, - "y": 0.1, - "z": 0.563 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": 1.758, - "y": 0.101, - "z": 0.04 - }, - "Tags": [ - "Asset" - ] - }, - { - "Position": { - "x": -1.82, - "y": 0.1, - "z": 0.61 - }, - "Rotation": { - "x": 0, - "y": 0, - "z": 0 - } - }, - { - "Position": { - "x": -1.82, - "y": 0.1, - "z": 0 - }, - "Rotation": { - "x": 0, - "y": 0, - "z": 0 - } - }, - { - "Position": { - "x": -1.177, - "y": 0.1, - "z": 0 - }, - "Tags": [ - "Investigator" - ] - }, - { - "Position": { - "x": 1.365, - "y": 0.1, - "z": -0.625 - }, - "Rotation": { - "x": 0, - "y": 0, - "z": 0 - } - }, - { - "Position": { - "x": 0.91, - "y": 0.1, - "z": -0.625 - }, - "Rotation": { - "x": 0, - "y": 0, - "z": 0 - } - }, - { - "Position": { - "x": 0.455, - "y": 0.1, - "z": -0.625 - }, - "Rotation": { - "x": 0, - "y": 0, - "z": 0 - } - }, - { - "Position": { - "x": 0, - "y": 0.1, - "z": -0.625 - }, - "Rotation": { - "x": 0, - "y": 0, - "z": 0 - } - }, - { - "Position": { - "x": -0.455, - "y": 0.1, - "z": -0.625 - }, - "Rotation": { - "x": 0, - "y": 0, - "z": 0 - } - }, - { - "Position": { - "x": -0.91, - "y": 0.1, - "z": -0.625 - }, - "Rotation": { - "x": 0, - "y": 0, - "z": 0 - } - }, - { - "Position": { - "x": -1.365, - "y": 0.1, - "z": -0.625 - }, - "Rotation": { - "x": 0, - "y": 0, - "z": 0 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "b": 0, - "g": 0, - "r": 0 - }, - "CustomImage": { - "CustomTile": { - "Stackable": false, - "Stretch": true, - "Thickness": 0.1, - "Type": 3 - }, - "ImageScalar": 1, - "ImageSecondaryURL": "", - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/2037357630681963618/E7271737B19CE0BFAAA382BEEEF497FE3E06ECC1/", - "WidthScale": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "383d8b", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\n---------------------------------------------------------\n-- specific setup (different for each playmat)\n---------------------------------------------------------\n\nTRASHCAN_GUID = \"5f896a\"\nSTAT_TRACKER_GUID = \"af7ed7\"\nRESOURCE_COUNTER_GUID = \"cd15ac\"\nCLUE_COUNTER_GUID = \"032300\"\nCLUE_CLICKER_GUID = \"891403\"\n\nrequire(\"playermat/Playmat\")\nend)\n__bundle_register(\"core/MythosAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local MythosAreaApi = {}\n local MYTHOS_AREA_GUID = \"9f334f\"\n\n -- returns the chaos token metadata (if provided through scenario reference card)\n MythosAreaApi.returnTokenData = function()\n return getObjectFromGUID(MYTHOS_AREA_GUID).call(\"returnTokenData\")\n end\n\n -- draw an encounter card to the requested position/rotation\n MythosAreaApi.drawEncounterCard = function(pos, rotY, alwaysFaceUp)\n getObjectFromGUID(MYTHOS_AREA_GUID).call(\"drawEncounterCard\", {\n pos = pos,\n rotY = rotY,\n alwaysFaceUp = alwaysFaceUp\n })\n end\n\n return MythosAreaApi\nend\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = { }\n local PLAY_AREA_GUID = \"721ba2\"\n local INVESTIGATOR_COUNTER_GUID = \"f182ee\"\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with\n -- 'displacement_excluded'\n ---@param playerColor Color of the player requesting the shift. Used solely to send an error\n --- message in the unlikely case that the scripting zone has been deleted\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"tryObjectEnterContainer\",\n { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightCountedVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\n__bundle_register(\"playermat/Playmat\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal mythosAreaApi = require(\"core/MythosAreaApi\")\nlocal navigationOverlayApi = require(\"core/NavigationOverlayApi\")\nlocal tokenChecker = require(\"core/token/TokenChecker\")\nlocal tokenManager = require(\"core/token/TokenManager\")\n\n-- set true to enable debug logging and show Physics.cast()\nlocal DEBUG = false\n\n-- we use this to turn off collision handling until onLoad() is complete\nlocal collisionEnabled = false\n\n-- position offsets relative to mat [x, y, z]\nlocal DRAWN_ENCOUNTER_CARD_OFFSET = {1.365, 0.5, -0.625}\nlocal DRAWN_CHAOS_TOKEN_OFFSET = {-1.55, 0.25, -0.58}\n\n-- x-Values for discard buttons\nlocal DISCARD_BUTTON_OFFSETS = {-1.365, -0.91, -0.455, 0, 0.455, 0.91}\n\nlocal SEARCH_AROUND_SELF_X_BUFFER = 8\n\n-- defined areas for \"inArea()\" and \"Physics.cast()\"\nlocal MAIN_PLAY_AREA = {\n upperLeft = {\n x = 1.98,\n z = 0.736\n },\n lowerRight = {\n x = -0.79,\n z = -0.39\n }\n}\nlocal INVESTIGATOR_AREA = {\n upperLeft = {\n x = -1.084,\n z = 0.06517\n },\n lowerRight = {\n x = -1.258,\n z = -0.0805\n }\n}\nlocal THREAT_AREA = {\n upperLeft = {\n x = 1.53,\n z = -0.34\n },\n lowerRight = {\n x = -1.13,\n z = -0.92\n }\n}\nlocal DECK_DISCARD_AREA = {\n upperLeft = {\n x = -1.62,\n z = 0.855\n },\n lowerRight = {\n x = -2.02,\n z = -0.245\n },\n center = {\n x = -1.82,\n y = 0.1,\n z = 0.305\n },\n size = {\n x = 0.4,\n y = 0.1,\n z = 1.1\n }\n}\n\n-- local position of draw and discard pile\nlocal DRAW_DECK_POSITION = { x = -1.82, y = 0, z = 0 }\nlocal DISCARD_PILE_POSITION = { x = -1.82, y = 0, z = 0.61 }\n\n-- global position of encounter discard pile\nlocal ENCOUNTER_DISCARD_POSITION = { x = -3.85, y = 1.5, z = 10.38}\n\n-- global variable so it can be reset by the Clean Up Helper\nactiveInvestigatorId = \"00000\"\n\nlocal TRASHCAN, STAT_TRACKER, RESOURCE_COUNTER\nlocal isDrawButtonVisible = false\n\n-- global variable to report \"Dream-Enhancing Serum\" status\nisDES = false\n\nfunction onSave()\n return JSON.encode({\n playerColor = playerColor,\n activeInvestigatorId = activeInvestigatorId,\n isDrawButtonVisible = isDrawButtonVisible\n })\nend\n\nfunction onLoad(saveState)\n self.interactable = DEBUG\n\n TRASHCAN = getObjectFromGUID(TRASHCAN_GUID)\n STAT_TRACKER = getObjectFromGUID(STAT_TRACKER_GUID)\n RESOURCE_COUNTER = getObjectFromGUID(RESOURCE_COUNTER_GUID)\n\n -- button creation\n for i = 1, 6 do\n makeDiscardButton(DISCARD_BUTTON_OFFSETS[i], i)\n end\n\n self.createButton({\n click_function = \"drawEncounterCard\",\n function_owner = self,\n position = {-1.84, 0, -0.65},\n rotation = {0, 80, 0},\n width = 265,\n height = 190\n })\n\n self.createButton({\n click_function = \"drawChaosTokenButton\",\n function_owner = self,\n position = {1.85, 0, -0.74},\n rotation = {0, -45, 0},\n width = 135,\n height = 135\n })\n\n self.createButton({\n label = \"Upkeep\",\n click_function = \"doUpkeep\",\n function_owner = self,\n position = {1.84, 0.1, -0.44},\n scale = {0.12, 0.12, 0.12},\n width = 800,\n height = 280,\n font_size = 180\n })\n\n -- save state loading\n local state = JSON.decode(saveState)\n if state ~= nil then\n playerColor = state.playerColor\n activeInvestigatorId = state.activeInvestigatorId\n isDrawButtonVisible = state.isDrawButtonVisible\n end\n\n showDrawButton(isDrawButtonVisible)\n\n collisionEnabled = true\n\n math.randomseed(os.time())\nend\n\n---------------------------------------------------------\n-- utility functions\n---------------------------------------------------------\n\n-- searches an area and optionally filters the result\nfunction searchArea(origin, size, filter)\n local searchResult = Physics.cast({\n origin = origin,\n direction = { 0, 1, 0 },\n orientation = self.getRotation(),\n type = 3,\n size = size,\n max_distance = 1\n })\n\n local objList = {}\n for _, v in ipairs(searchResult) do\n if not filter or (filter and filter(v.hit_object)) then\n table.insert(objList, v.hit_object)\n end\n end\n return objList\nend\n\n-- filter functions for searchArea()\nfunction isCard(x) return x.type == 'Card' end\nfunction isDeck(x) return x.type == 'Deck' end\nfunction isCardOrDeck(x) return x.type == 'Card' or x.type == 'Deck' end\n\n-- Finds all objects on the playmat and associated set aside zone.\nfunction searchAroundSelf(filter)\n local bounds = self.getBoundsNormalized()\n -- Increase the width to cover the set aside zone\n bounds.size.x = bounds.size.x + SEARCH_AROUND_SELF_X_BUFFER\n -- Since the cast is centered on the position, shift left or right to keep the non-set aside edge\n -- of the cast at the edge of the playmat\n -- setAsideDirection accounts for the set aside zone being on the left or right, depending on the\n -- table position of the playmat\n local setAsideDirection = bounds.center.z \u003e 0 and 1 or -1\n local localCenter = self.positionToLocal(bounds.center)\n localCenter.x = localCenter.x + setAsideDirection * SEARCH_AROUND_SELF_X_BUFFER / 2 / self.getScale().x\n return searchArea(self.positionToWorld(localCenter), bounds.size, filter)\nend\n\n-- searches the area around the draw deck and discard pile\nfunction searchDeckAndDiscardArea(filter)\n local pos = self.positionToWorld(DECK_DISCARD_AREA.center)\n local scale = self.getScale()\n local size = {\n x = DECK_DISCARD_AREA.size.x * scale.x,\n y = DECK_DISCARD_AREA.size.y, \n z = DECK_DISCARD_AREA.size.z * scale.z\n }\n return searchArea(pos, size, filter)\nend\n\nfunction doNotReady(card)\n return card.getVar(\"do_not_ready\") or false\nend\n\n---------------------------------------------------------\n-- Discard buttons\n---------------------------------------------------------\n\n-- builds a function that discards things in searchPosition\n-- stuff on the card/deck will be put into the local trashcan\nfunction makeDiscardHandlerFor(searchPosition)\n return function ()\n local origin = self.positionToWorld(searchPosition)\n for _, obj in ipairs(searchArea(origin, {2, 1, 3.2})) do\n if isCardOrDeck(obj) then\n if obj.hasTag(\"PlayerCard\") then\n placeOrMergeIntoDeck(obj, returnGlobalDiscardPosition(), self.getRotation())\n else\n placeOrMergeIntoDeck(obj, ENCOUNTER_DISCARD_POSITION, {x = 0, y = -90, z = 0})\n end\n -- put chaos tokens back into bag (e.g. Unrelenting)\n elseif tokenChecker.isChaosToken(obj) then\n local chaosBag = chaosBagApi.findChaosBag()\n chaosBag.putObject(obj)\n -- don't touch the table or this playmat itself\n elseif obj.guid ~= \"4ee1f2\" and obj ~= self then\n TRASHCAN.putObject(obj)\n end\n end\n end\nend\n\n-- places a card/deck at a position or merges into an existing deck\n-- rotation is optional\nfunction placeOrMergeIntoDeck(obj, pos, rot)\n if not pos then return end\n\n local offset = 0.5\n local deck, card, newPos\n \n -- search the new position for existing card/deck\n local searchResult = searchArea(pos, { 1, 1, 1 }, isCardOrDeck)\n if #searchResult == 1 then\n local match = searchResult[1]\n if match.type == 'Card' then\n card = match\n elseif match.type == 'Deck' then\n deck = match\n end\n end\n\n -- update vertical component of new position\n if card or deck then\n local bounds = searchResult[1].getBounds()\n newPos = Vector(pos):setAt(\"y\", bounds.center.y + bounds.size.y / 2 + offset)\n else\n newPos = Vector(pos) + Vector(0, offset, 0)\n end\n\n -- actual movement of the object\n if rot then\n obj.setRotationSmooth(rot, false, true)\n end\n obj.setPositionSmooth(newPos, false, true)\n \n -- this avoids a TTS bug that merges unrelated cards that are not resting\n if deck then\n Wait.time(function() deck.putObject(obj) end, 0.3)\n elseif card then\n Wait.time(function() obj.setPosition(newPos) end, 0.3)\n end\nend\n\n-- build a discard button to discard from searchPosition (number must be unique)\nfunction makeDiscardButton(xValue, number)\n local position = { xValue, 0.1, -0.94}\n local searchPosition = {-position[1], position[2], position[3] + 0.32}\n local handler = makeDiscardHandlerFor(searchPosition)\n local handlerName = 'handler' .. number\n self.setVar(handlerName, handler)\n self.createButton({\n label = \"Discard\",\n click_function = handlerName,\n function_owner = self,\n position = position,\n scale = {0.12, 0.12, 0.12},\n width = 900,\n height = 350,\n font_size = 220\n })\nend\n\n---------------------------------------------------------\n-- Upkeep button\n---------------------------------------------------------\n\n-- calls the Upkeep function with correct parameter\nfunction doUpkeepFromHotkey(color)\n doUpkeep(_, color)\nend\n\nfunction doUpkeep(_, clickedByColor, isRightClick)\n -- right-click allow color changing\n if isRightClick then\n changeColor(clickedByColor)\n return\n end\n\n -- send messages to player who clicked button if no seated player found\n messageColor = Player[playerColor].seated and playerColor or clickedByColor\n\n -- unexhaust cards in play zone, flip action tokens and find forcedLearning\n local forcedLearning = false\n local rot = self.getRotation()\n for _, obj in ipairs(searchAroundSelf()) do\n if obj.getDescription() == \"Action Token\" and obj.is_face_down then\n obj.flip()\n elseif obj.type == \"Card\" and not inArea(self.positionToLocal(obj.getPosition()), INVESTIGATOR_AREA) then\n local cardMetadata = JSON.decode(obj.getGMNotes()) or {}\n if not doNotReady(obj) then\n local cardRotation = round(obj.getRotation().y, 0) - rot.y\n local yRotDiff = 0\n\n if cardRotation \u003c 0 then\n cardRotation = cardRotation + 360\n end\n\n -- rotate cards to the next multiple of 90° towards 0°\n if cardRotation \u003e 90 and cardRotation \u003c= 180 then\n yRotDiff = 90\n elseif cardRotation \u003c 270 and cardRotation \u003e 180 then\n yRotDiff = 270\n end\n\n -- set correct rotation for face-down cards\n rot.z = obj.is_face_down and 180 or 0\n obj.setRotation({rot.x, rot.y + yRotDiff, rot.z})\n end\n if cardMetadata.id == \"08031\" then\n forcedLearning = true\n end\n if cardMetadata.uses ~= nil then\n tokenManager.maybeReplenishCard(obj, cardMetadata.uses, self)\n end\n end\n end\n\n -- flip investigator mini-card and summoned servitor mini-card\n -- (all characters allowed to account for custom IDs - e.g. 'Z0000' for TTS Zoop generated IDs)\n if activeInvestigatorId ~= nil then\n local miniId = string.match(activeInvestigatorId, \".....\") .. \"-m\"\n for _, obj in ipairs(getObjects()) do\n if obj.type == \"Card\" and obj.is_face_down then\n local notes = JSON.decode(obj.getGMNotes())\n if notes ~= nil and notes.type == \"Minicard\" and (notes.id == miniId or notes.id == \"09080-m\") then\n obj.flip()\n end\n end\n end\n end\n\n -- gain a resource (or two if playing Jenny Barnes)\n if string.match(activeInvestigatorId, \"%d%d%d%d%d\") == \"02003\" then\n gainResources(2)\n printToColor(\"Gaining 2 resources (Jenny)\", messageColor)\n else\n gainResources(1)\n end\n\n -- draw a card (with handling for Patrice and Forced Learning)\n if activeInvestigatorId == \"06005\" then\n if forcedLearning then\n printToColor(\"Wow, did you really take 'Versatile' to play Patrice with 'Forced Learning'? Choose which draw replacement effect takes priority and draw cards accordingly.\", messageColor)\n else\n local handSize = #Player[playerColor].getHandObjects()\n if handSize \u003c 5 then\n local cardsToDraw = 5 - handSize\n printToColor(\"Drawing \" .. cardsToDraw .. \" cards (Patrice)\", messageColor)\n drawCardsWithReshuffle(cardsToDraw)\n end\n end\n elseif forcedLearning then\n printToColor(\"Drawing 2 cards, discard 1 (Forced Learning)\", messageColor)\n drawCardsWithReshuffle(2)\n elseif activeInvestigatorId == \"89001\" then\n printToColor(\"Drawing 2 cards (Subject 5U-21)\", messageColor)\n drawCardsWithReshuffle(2)\n else\n drawCardsWithReshuffle(1)\n end\nend\n\n-- adds the specified amount of resources to the resource counter\nfunction gainResources(amount)\n local count = RESOURCE_COUNTER.getVar(\"val\")\n local add = tonumber(amount) or 0\n RESOURCE_COUNTER.call(\"updateVal\", count + add)\nend\n\n-- returns the resource counter amount\nfunction getResourceCount()\n return RESOURCE_COUNTER.getVar(\"val\")\nend\n\n-- function for \"draw 1 button\" (that can be added via option panel)\nfunction doDrawOne(_, color)\n -- send messages to player who clicked button if no seated player found\n messageColor = Player[playerColor].seated and playerColor or color\n drawCardsWithReshuffle(1)\nend\n\n-- draw X cards (shuffle discards if necessary)\nfunction drawCardsWithReshuffle(numCards)\n getDrawDiscardDecks()\n\n -- Norman Withers handling\n if string.match(activeInvestigatorId, \"%d%d%d%d%d\") == \"08004\" then\n local harbinger = false\n if topCard ~= nil and topCard.getName() == \"The Harbinger\" then harbinger = true\n elseif drawDeck ~= nil and not drawDeck.is_face_down then\n local cards = drawDeck.getObjects()\n if cards[#cards].name == \"The Harbinger\" then harbinger = true end\n end\n\n if harbinger then\n printToColor(\"The Harbinger is on top of your deck, not drawing cards\", messageColor)\n return\n end\n\n if topCard ~= nil then\n topCard.deal(numCards, playerColor)\n numCards = numCards - 1\n if numCards == 0 then return end\n end\n end\n\n local deckSize = 1\n if drawDeck == nil then\n deckSize = 0\n elseif drawDeck.tag == \"Deck\" then\n deckSize = #drawDeck.getObjects()\n end\n\n if deckSize \u003e= numCards then\n drawCards(numCards)\n return\n end\n\n drawCards(deckSize)\n if discardPile ~= nil then\n shuffleDiscardIntoDeck()\n Wait.time(|| drawCards(numCards - deckSize), 1)\n end\n printToColor(\"Take 1 horror (drawing card from empty deck)\", messageColor)\nend\n\n-- get the draw deck and discard pile objects\nfunction getDrawDiscardDecks()\n drawDeck = nil\n discardPile = nil\n topCard = nil\n\n for _, object in ipairs(searchDeckAndDiscardArea(isCardOrDeck)) do\n if self.positionToLocal(object.getPosition()).z \u003e 0.5 then\n discardPile = object\n -- Norman Withers handling\n elseif string.match(activeInvestigatorId, \"%d%d%d%d%d\") == \"08004\" and not object.is_face_down then\n topCard = object\n else\n drawDeck = object\n end\n end\nend\n\nfunction drawCards(numCards)\n if drawDeck == nil then return end\n drawDeck.deal(numCards, playerColor)\nend\n\nfunction shuffleDiscardIntoDeck()\n if not discardPile.is_face_down then discardPile.flip() end\n discardPile.shuffle()\n discardPile.setPositionSmooth(self.positionToWorld(DRAW_DECK_POSITION), false, false)\n drawDeck = discardPile\n discardPile = nil\nend\n\n-- discard a random non-hidden card from hand\nfunction doDiscardOne()\n local hand = Player[playerColor].getHandObjects()\n if #hand == 0 then\n broadcastToAll(\"Cannot discard from empty hand!\", \"Red\")\n else\n local choices = {}\n for i = 1, #hand do\n local notes = JSON.decode(hand[i].getGMNotes())\n if notes ~= nil then\n if notes.hidden ~= true then\n table.insert(choices, i)\n end\n else\n table.insert(choices, i)\n end\n end\n\n if #choices == 0 then\n broadcastToAll(\"Hidden cards can't be randomly discarded.\", \"Orange\")\n return\n end\n\n -- get a random non-hidden card (from the \"choices\" table)\n local num = math.random(1, #choices)\n placeOrMergeIntoDeck(hand[choices[num]], returnGlobalDiscardPosition(), self.getRotation())\n broadcastToAll(playerColor .. \" randomly discarded card \" .. choices[num] .. \"/\" .. #hand .. \".\", \"White\")\n end\nend\n\n---------------------------------------------------------\n-- color related functions\n---------------------------------------------------------\n\n-- changes the player color\nfunction changeColor(clickedByColor)\n local colorList = {\n \"White\",\n \"Brown\",\n \"Red\",\n \"Orange\",\n \"Yellow\",\n \"Green\",\n \"Teal\",\n \"Blue\",\n \"Purple\",\n \"Pink\"\n }\n\n -- remove existing colors from the list of choices\n for _, existingColor in ipairs(Player.getAvailableColors()) do\n for i, newColor in ipairs(colorList) do\n if existingColor == newColor then\n table.remove(colorList, i)\n end\n end\n end\n\n -- show the option dialog for color selection to the player that triggered this\n Player[clickedByColor].showOptionsDialog(\"Select a new color:\", colorList, _, function(color)\n local HAND_ZONE_GUIDS = {\n \"a70eee\", -- White\n \"5fe087\", -- Orange\n \"0285cc\", -- Green\n \"be2f17\" -- Red\n }\n local index\n local startPos = self.getPosition()\n\n -- get respective hand zone by position\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n index = 1\n else\n index = 2\n end\n else\n if startPos.z \u003e 0 then\n index = 3\n else\n index = 4\n end\n end\n\n -- update the color of the hand zone\n local handZone = getObjectFromGUID(HAND_ZONE_GUIDS[index])\n handZone.setValue(color)\n\n -- if the seated player clicked this, reseat him to the new color\n if clickedByColor == playerColor then\n navigationOverlayApi.copyVisibility(playerColor, color)\n Player[playerColor].changeColor(color)\n end\n\n -- update the internal variable\n playerColor = color\n end)\nend\n\n---------------------------------------------------------\n-- playmat token spawning\n---------------------------------------------------------\n\n-- Finds all customizable cards in this play area and updates their metadata based on the selections\n-- on the matching upgrade sheet.\n-- This method is theoretically O(n^2), and should be used sparingly. In practice it will only be\n-- called when a checkbox is added or removed in-game (which should be rare), and is bounded by the\n-- number of customizable cards in play.\nfunction syncAllCustomizableCards()\n for _, card in ipairs(searchAroundSelf(isCard)) do\n syncCustomizableMetadata(card)\n end\nend\n\nfunction syncCustomizableMetadata(card)\n local cardMetadata = JSON.decode(card.getGMNotes()) or { }\n if cardMetadata == nil or cardMetadata.customizations == nil then\n return\n end\n for _, upgradeSheet in ipairs(searchAroundSelf(isCard)) do\n local upgradeSheetMetadata = JSON.decode(upgradeSheet.getGMNotes()) or { }\n if upgradeSheetMetadata.id == (cardMetadata.id .. \"-c\") then\n for i, customization in ipairs(cardMetadata.customizations) do\n if customization.replaces ~= nil and customization.replaces.uses ~= nil then\n -- Allowed use of call(), no APIs for individual cards\n if upgradeSheet.call(\"isUpgradeActive\", i) then\n cardMetadata.uses = customization.replaces.uses\n card.setGMNotes(JSON.encode(cardMetadata))\n else\n -- TODO: Get the original metadata to restore it... maybe. This should only be\n -- necessary in the very unlikely case that a user un-checks a previously-full upgrade\n -- row while the card is in play. It will be much easier once the AllPlayerCardsApi is\n -- in place, so defer until it is\n end\n end\n end\n end\n end\nend\n\nfunction spawnTokensFor(object)\n local extraUses = { }\n if activeInvestigatorId == \"03004\" then\n extraUses[\"Charge\"] = 1\n end\n\n tokenManager.spawnForCard(object, extraUses)\nend\n\nfunction onCollisionEnter(collision_info)\n local object = collision_info.collision_object\n\n -- detect if \"Dream-Enhancing Serum\" is placed\n if object.getName() == \"Dream-Enhancing Serum\" then isDES = true end\n\n -- only continue if loading is completed\n if not collisionEnabled then return end\n\n -- only continue for cards\n if object.type ~= \"Card\" then return end\n\n maybeUpdateActiveInvestigator(object)\n syncCustomizableMetadata(object)\n\n local localCardPos = self.positionToLocal(object.getPosition())\n if inArea(localCardPos, DECK_DISCARD_AREA) then\n tokenManager.resetTokensSpawned(object)\n removeTokensFromObject(object)\n elseif shouldSpawnTokens(object) then\n spawnTokensFor(object)\n end\nend\n\n-- detect if \"Dream-Enhancing Serum\" is removed\nfunction onCollisionExit(collision_info)\n if collision_info.collision_object.getName() == \"Dream-Enhancing Serum\" then isDES = false end\nend\n\n-- checks if tokens should be spawned for the provided card\nfunction shouldSpawnTokens(card)\n if card.is_face_down then\n return false\n end\n\n local localCardPos = self.positionToLocal(card.getPosition())\n local metadata = JSON.decode(card.getGMNotes())\n\n -- If no metadata we don't know the type, so only spawn in the main area\n if metadata == nil then\n return inArea(localCardPos, MAIN_PLAY_AREA)\n end\n\n -- Spawn tokens for assets and events on the main area\n if inArea(localCardPos, MAIN_PLAY_AREA)\n and (metadata.type == \"Asset\"\n or metadata.type == \"Event\") then\n return true\n end\n\n -- Spawn tokens for all encounter types in the threat area\n if inArea(localCardPos, THREAT_AREA)\n and (metadata.type == \"Treachery\"\n or metadata.type == \"Enemy\"\n or metadata.weakness) then\n return true\n end\n\n return false\nend\n\nfunction onObjectEnterContainer(container, object)\n Wait.frames(function() resetTokensIfInDeckZone(container, object) end, 1)\nend\n\nfunction resetTokensIfInDeckZone(container, object)\n local pos = self.positionToLocal(container.getPosition())\n if inArea(pos, DECK_DISCARD_AREA) then\n tokenManager.resetTokensSpawned(object)\n removeTokensFromObject(container)\n end\nend\n\n-- removes tokens from the provided card/deck\nfunction removeTokensFromObject(object)\n for _, obj in ipairs(searchArea(object.getPosition(), { 3, 1, 4 })) do\n if obj.getGUID() ~= \"4ee1f2\" and -- table\n obj ~= self and\n obj.type ~= \"Deck\" and\n obj.type ~= \"Card\" and\n obj.memo ~= nil and\n obj.getLock() == false and\n obj.getDescription() ~= \"Action Token\" and\n not tokenChecker.isChaosToken(obj) then\n TRASHCAN.putObject(obj)\n end\n end\nend\n\n---------------------------------------------------------\n-- investigator ID grabbing and skill tracker\n---------------------------------------------------------\n\nfunction maybeUpdateActiveInvestigator(card)\n if not inArea(self.positionToLocal(card.getPosition()), INVESTIGATOR_AREA) then return end\n\n local notes = JSON.decode(card.getGMNotes())\n local class\n\n if notes ~= nil and notes.type == \"Investigator\" and notes.id ~= nil then\n if notes.id == activeInvestigatorId then return end\n class = notes.class\n activeInvestigatorId = notes.id\n STAT_TRACKER.call(\"updateStats\", {notes.willpowerIcons, notes.intellectIcons, notes.combatIcons, notes.agilityIcons})\n elseif activeInvestigatorId ~= \"00000\" then\n class = \"Neutral\"\n activeInvestigatorId = \"00000\"\n STAT_TRACKER.call(\"updateStats\", {1, 1, 1, 1})\n else\n return\n end\n\n -- change state of action tokens\n local search = searchArea(self.positionToWorld({-1.1, 0.05, -0.27}), {4, 1, 1})\n local smallToken = nil\n local STATE_TABLE = {\n [\"Guardian\"] = 1,\n [\"Seeker\"] = 2,\n [\"Rogue\"] = 3,\n [\"Mystic\"] = 4,\n [\"Survivor\"] = 5,\n [\"Neutral\"] = 6\n }\n\n for _, obj in ipairs(search) do\n if obj.getDescription() == \"Action Token\" and obj.getStateId() \u003e 0 then\n if obj.getScale().x \u003c 0.4 then\n smallToken = obj\n else\n setObjectState(obj, STATE_TABLE[class])\n end\n end\n end\n\n -- update the small token with special action for certain investigators\n local SPECIAL_ACTIONS = {\n [\"04002\"] = 8, -- Ursula Downs\n [\"01002\"] = 9, -- Daisy Walker\n [\"01502\"] = 9, -- Daisy Walker\n [\"01002-pb\"] = 9, -- Daisy Walker\n [\"06003\"] = 10, -- Tony Morgan\n [\"04003\"] = 11, -- Finn Edwards\n [\"08016\"] = 14 -- Bob Jenkins\n }\n\n if smallToken ~= nil then\n setObjectState(smallToken, SPECIAL_ACTIONS[activeInvestigatorId] or STATE_TABLE[class])\n end\nend\n\nfunction setObjectState(obj, stateId)\n if obj.getStateId() ~= stateId then obj.setState(stateId) end\nend\n\n---------------------------------------------------------\n-- calls to 'Global' / functions for calls from outside\n---------------------------------------------------------\n\nfunction drawChaosTokenButton(_, _, isRightClick)\n chaosBagApi.drawChaosToken(self, DRAWN_CHAOS_TOKEN_OFFSET, isRightClick)\nend\n\nfunction drawEncounterCard(_, _, isRightClick)\n local pos = self.positionToWorld(DRAWN_ENCOUNTER_CARD_OFFSET)\n local rotY = self.getRotation().y\n mythosAreaApi.drawEncounterCard(pos, rotY, isRightClick)\nend\n\nfunction returnGlobalDiscardPosition()\n return self.positionToWorld(DISCARD_PILE_POSITION)\nend\n\n-- Sets this playermat's draw 1 button to visible\n---@param visible Boolean. Whether the draw 1 button should be visible\nfunction showDrawButton(visible)\n isDrawButtonVisible = visible\n\n -- create the \"Draw 1\" button\n if isDrawButtonVisible then\n self.createButton({\n label = \"Draw 1\",\n click_function = \"doDrawOne\",\n function_owner = self,\n position = { 1.84, 0.1, -0.36 },\n scale = { 0.12, 0.12, 0.12 },\n width = 800,\n height = 280,\n font_size = 180\n })\n\n -- remove the \"Draw 1\" button\n else\n local buttons = self.getButtons()\n for i = 1, #buttons do\n if buttons[i].label == \"Draw 1\" then\n self.removeButton(buttons[i].index)\n end\n end\n end\nend\n\n-- Spawns / destroys a clickable clue counter for this playmat with the correct amount of clues\n---@param showCounter Boolean Whether the clickable clue counter should be present\nfunction clickableClues(showCounter)\n local CLUE_COUNTER = getObjectFromGUID(CLUE_COUNTER_GUID)\n local CLUE_CLICKER = getObjectFromGUID(CLUE_CLICKER_GUID)\n local clickerPos = CLUE_CLICKER.getPosition()\n local clueCount = 0\n\n if showCounter then\n -- current clue count\n clueCount = CLUE_COUNTER.getVar(\"exposedValue\")\n\n -- remove clues\n CLUE_COUNTER.call(\"removeAllClues\")\n\n -- set value for clue clickers\n CLUE_CLICKER.call(\"updateVal\", clueCount)\n\n -- move clue counters up\n clickerPos.y = 1.52\n CLUE_CLICKER.setPosition(clickerPos)\n else\n -- current clue count\n clueCount = CLUE_CLICKER.getVar(\"val\")\n\n -- move clue counters down\n clickerPos.y = 1.3\n CLUE_CLICKER.setPosition(clickerPos)\n\n -- spawn clues\n local pos = self.positionToWorld({x = -1.12, y = 0.05, z = 0.7})\n for i = 1, clueCount do\n pos.y = pos.y + 0.045 * i\n tokenManager.spawnToken(pos, \"clue\", self.getRotation())\n end\n end\nend\n\n-- removes all clues (moving tokens to the trash and setting counters to 0)\nfunction removeClues()\n local CLUE_COUNTER = getObjectFromGUID(CLUE_COUNTER_GUID)\n local CLUE_CLICKER = getObjectFromGUID(CLUE_CLICKER_GUID)\n\n CLUE_COUNTER.call(\"removeAllClues\")\n CLUE_CLICKER.call(\"updateVal\", 0)\nend\n\n-- reports the clue count\n---@param useClickableCounters Boolean Controls which type of counter is getting checked\nfunction getClueCount(useClickableCounters)\n local count = 0\n\n if useClickableCounters then\n local CLUE_CLICKER = getObjectFromGUID(CLUE_CLICKER_GUID)\n count = tonumber(CLUE_CLICKER.getVar(\"val\"))\n else\n local CLUE_COUNTER = getObjectFromGUID(CLUE_COUNTER_GUID)\n count = tonumber(CLUE_COUNTER.getVar(\"exposedValue\"))\n end\n return count\nend\n\n-- Sets this playermat's snap points to limit snapping to matching card types or not. If matchTypes\n-- is true, the main card slot snap points will only snap assets, while the investigator area point\n-- will only snap Investigators. If matchTypes is false, snap points will be reset to snap all\n-- cards.\n---@param matchTypes Boolean. Whether snap points should only snap for the matching card types.\nfunction setLimitSnapsByType(matchTypes)\n local snaps = self.getSnapPoints()\n for i, snap in ipairs(snaps) do\n local snapPos = snap.position\n if inArea(snapPos, MAIN_PLAY_AREA) then\n local snapTags = snaps[i].tags\n if matchTypes then\n if snapTags == nil then\n snaps[i].tags = { \"Asset\" }\n else\n table.insert(snaps[i].tags, \"Asset\")\n end\n else\n snaps[i].tags = nil\n end\n end\n if inArea(snapPos, INVESTIGATOR_AREA) then\n local snapTags = snaps[i].tags\n if matchTypes then\n if snapTags == nil then\n snaps[i].tags = { \"Investigator\" }\n else\n table.insert(snaps[i].tags, \"Investigator\")\n end\n else\n snaps[i].tags = nil\n end\n end\n end\n self.setSnapPoints(snaps)\nend\n\n-- Simple method to check if the given point is in a specified area. Local use only,\n---@param point Vector Point to check, only x and z values are relevant\n---@param bounds Table Defined area to see if the point is within. See MAIN_PLAY_AREA for sample\n-- bounds definition.\n---@return Boolean True if the point is in the area defined by bounds\nfunction inArea(point, bounds)\n return (point.x \u003c bounds.upperLeft.x\n and point.x \u003e bounds.lowerRight.x\n and point.z \u003c bounds.upperLeft.z\n and point.z \u003e bounds.lowerRight.z)\nend\n\n-- called by custom data helpers to add player card data\n---@param args table Contains only one entry, the GUID of the custom data helper\nfunction updatePlayerCards(args)\n local customDataHelper = getObjectFromGUID(args[1])\n local playerCardData = customDataHelper.getTable(\"PLAYER_CARD_DATA\")\n tokenManager.addPlayerCardData(playerCardData)\nend\n\n-- utility function for rounding\n---@param num Number Initial value\n---@param numDecimalPlaces Number Amount of decimal places\nfunction round(num, numDecimalPlaces)\n local mult = 10^(numDecimalPlaces or 0)\n return math.floor(num * mult + 0.5) / mult\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/NavigationOverlayApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local NavigationOverlayApi = {}\n local HANDLER_GUID = \"797ede\"\n\n -- Copies the visibility for the Navigation overlay\n ---@param startColor String Color of the player to copy from\n ---@param targetColor String Color of the targeted player\n NavigationOverlayApi.copyVisibility = function(startColor, targetColor)\n getObjectFromGUID(HANDLER_GUID).call(\"copyVisibility\", {\n startColor = startColor,\n targetColor = targetColor\n })\n end\n\n -- Changes the Navigation Overlay view (\"Full View\" --\u003e \"Play Areas\" --\u003e \"Closed\" etc.)\n ---@param playerColor String Color of the player to update the visibility for\n NavigationOverlayApi.cycleVisibility = function(playerColor)\n getObjectFromGUID(HANDLER_GUID).call(\"cycleVisibility\", playerColor)\n end\n\n return NavigationOverlayApi\nend\nend)\n__bundle_register(\"core/token/TokenChecker\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local CHAOS_TOKEN_NAMES = {\n [\"Elder Sign\"] = true,\n [\"+1\"] = true,\n [\"0\"] = true,\n [\"-1\"] = true,\n [\"-2\"] = true,\n [\"-3\"] = true,\n [\"-4\"] = true,\n [\"-5\"] = true,\n [\"-6\"] = true,\n [\"-7\"] = true,\n [\"-8\"] = true,\n [\"Skull\"] = true,\n [\"Cultist\"] = true,\n [\"Tablet\"] = true,\n [\"Elder Thing\"] = true,\n [\"Auto-fail\"] = true,\n [\"Bless\"] = true,\n [\"Curse\"] = true,\n [\"Frost\"] = true\n }\n\n local TokenChecker = {}\n\n -- returns true if the passed object is a chaos token (by name)\n TokenChecker.isChaosToken = function(obj)\n if CHAOS_TOKEN_NAMES[obj.getName()] then\n return true\n else\n return false\n end\n end\n\n return TokenChecker\nend\nend)\n__bundle_register(\"core/token/TokenManager\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local optionPanelApi = require(\"core/OptionPanelApi\")\n local playAreaApi = require(\"core/PlayAreaApi\")\n local tokenSpawnTrackerApi = require(\"core/token/TokenSpawnTrackerApi\")\n\n local PLAYER_CARD_TOKEN_OFFSETS = {\n [1] = {\n Vector(0, 3, -0.2)\n },\n [2] = {\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [3] = {\n Vector(0, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [4] = {\n Vector(0.4, 3, -0.9),\n Vector(-0.4, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [5] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [6] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2)\n },\n [7] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0, 3, 0.5)\n },\n [8] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(-0.35, 3, 0.5),\n Vector(0.35, 3, 0.5)\n },\n [9] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5)\n },\n [10] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0, 3, 1.2)\n },\n [11] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(-0.35, 3, 1.2),\n Vector(0.35, 3, 1.2)\n },\n [12] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0.7, 3, 1.2),\n Vector(0, 3, 1.2),\n Vector(-0.7, 3, 1.2)\n }\n }\n\n -- stateIDs for the multi-stated resource tokens\n local stateTable = {\n [\"resource\"] = 1,\n [\"ammo\"] = 2,\n [\"bounty\"] = 3,\n [\"charge\"] = 4,\n [\"evidence\"] = 5,\n [\"secret\"] = 6,\n [\"supply\"] = 7\n }\n\n -- Source for tokens\n local TOKEN_SOURCE_GUID = \"124381\"\n\n -- Table of data extracted from the token source bag, keyed by the Memo on each token which\n -- should match the token type keys (\"resource\", \"clue\", etc)\n local tokenTemplates\n\n local DATA_HELPER_GUID = \"708279\"\n\n local playerCardData\n local locationData\n\n local TokenManager = { }\n local internal = { }\n\n -- Spawns tokens for the card. This function is built to just throw a card at it and let it do\n -- the work once a card has hit an area where it might spawn tokens. It will check to see if\n -- the card has already spawned, find appropriate data from either the uses metadata or the Data\n -- Helper, and spawn the tokens.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n TokenManager.spawnForCard = function(card, extraUses)\n if tokenSpawnTrackerApi.hasSpawnedTokens(card.getGUID()) then\n return\n end\n local metadata = JSON.decode(card.getGMNotes())\n if metadata ~= nil then\n internal.spawnTokensFromUses(card, extraUses)\n else\n internal.spawnTokensFromDataHelper(card)\n end\n end\n\n -- Spawns a set of tokens on the given card.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String Type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param tokenCount Number How many tokens to spawn. For damage or horror this value will be set to the\n -- spawned state object rather than spawning multiple tokens\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnTokenGroup = function(card, tokenType, tokenCount, shiftDown, subType)\n local optionPanel = optionPanelApi.getOptions()\n\n if tokenType == \"damage\" or tokenType == \"horror\" then\n TokenManager.spawnCounterToken(card, tokenType, tokenCount, shiftDown)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"enabled\" then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"custom\" and tokenCount == 0 then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n else\n TokenManager.spawnMultipleTokens(card, tokenType, tokenCount, shiftDown, subType)\n end\n end\n\n -- Spawns a single counter token and sets the value to tokenValue. Used for damage and horror\n -- tokens.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String type of token to spawn, valid values are \"damage\" and \"horror\". Other\n -- types should use spawnMultipleTokens()\n ---@param tokenValue Number Value to set the damage/horror to\n TokenManager.spawnCounterToken = function(card, tokenType, tokenValue, shiftDown)\n if tokenValue \u003c 1 or tokenValue \u003e 50 then return end\n\n local pos = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[1][1] + Vector(0, 0, shiftDown))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, tokenType, rot, function(spawned) spawned.setState(tokenValue) end)\n end\n\n TokenManager.spawnResourceCounterToken = function(card, tokenCount)\n local pos = card.positionToWorld(card.positionToLocal(card.getPosition()) + Vector(0, 0.2, -0.5))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, \"resourceCounter\", rot, function(spawned)\n spawned.call(\"updateVal\", tokenCount)\n end)\n end\n\n -- Spawns a number of tokens.\n ---@param tokenType String type of token to spawn, valid values are resource\", \"doom\", or \"clue\".\n -- Other types should use spawnCounterToken()\n ---@param tokenCount Number How many tokens to spawn\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnMultipleTokens = function(card, tokenType, tokenCount, shiftDown, subType)\n -- not checking the max at this point since clue offsets are calculated dynamically\n if tokenCount \u003c 1 then return end\n\n local offsets = {}\n if tokenType == \"clue\" then\n offsets = internal.buildClueOffsets(card, tokenCount)\n else\n -- only up to 12 offset tables defined\n if tokenCount \u003e 12 then return end\n for i = 1, tokenCount do\n offsets[i] = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[tokenCount][i])\n -- Fix the y-position for the spawn, since positionToWorld considers rotation which can\n -- have bad results for face up/down differences\n offsets[i].y = card.getPosition().y + 0.15\n end\n end\n\n if shiftDown ~= nil then\n -- Copy the offsets to make sure we don't change the static values\n local baseOffsets = offsets\n offsets = { }\n for i, baseOffset in ipairs(baseOffsets) do\n offsets[i] = baseOffset\n offsets[i][3] = offsets[i][3] + shiftDown\n end\n end\n\n if offsets == nil then\n error(\"couldn't find offsets for \" .. tokenCount .. ' tokens')\n return\n end\n\n -- handling for not provided subtype (for example when spawning from custom data helpers)\n if subType == nil then\n subType = \"\"\n end\n \n -- this is used to load the correct state for additional resource tokens (e.g. \"Ammo\")\n local callback = nil\n local stateID = stateTable[string.lower(subType)]\n if tokenType == \"resource\" and stateID ~= nil and stateID ~= 1 then\n callback = function(spawned) spawned.setState(stateID) end\n end\n\n for i = 1, tokenCount do\n TokenManager.spawnToken(offsets[i], tokenType, card.getRotation(), callback)\n end\n end\n\n -- Spawns a single token at the given global position by copying it from the template bag.\n ---@param position Global position to spawn the token\n ---@param tokenType String type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param rotation Vector Rotation to be used for the new token. Only the y-value will be used,\n -- x and z will use the default rotation from the source bag\n ---@param callback function A callback function triggered after the new token is spawned\n TokenManager.spawnToken = function(position, tokenType, rotation, callback)\n internal.initTokenTemplates()\n local loadTokenType = tokenType\n if tokenType == \"clue\" or tokenType == \"doom\" then\n loadTokenType = \"clueDoom\"\n end\n if tokenTemplates[loadTokenType] == nil then\n error(\"Unknown token type '\" .. tokenType .. \"'\")\n return\n end\n local tokenTemplate = tokenTemplates[loadTokenType]\n\n -- Take ONLY the Y-value for rotation, so we don't flip the token coming out of the bag\n local rot = Vector(tokenTemplate.Transform.rotX,\n 270,\n tokenTemplate.Transform.rotZ)\n if rotation ~= nil then\n rot.y = rotation.y\n end\n if tokenType == \"doom\" then\n rot.z = 180\n end\n\n tokenTemplate.Nickname = \"\"\n return spawnObjectData({\n data = tokenTemplate,\n position = position,\n rotation = rot,\n callback_function = callback\n })\n end\n\n -- Checks a card for metadata to maybe replenish it\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n TokenManager.maybeReplenishCard = function(card, uses, mat)\n -- TODO: support for cards with multiple uses AND replenish (as of yet, no official card needs that)\n if uses[1].count and uses[1].replenish then\n internal.replenishTokens(card, uses, mat)\n end\n end\n\n -- Delegate function to the token spawn tracker. Exists to avoid circular dependencies in some\n -- callers.\n ---@param card Object Card object to reset the tokens for\n TokenManager.resetTokensSpawned = function(card)\n tokenSpawnTrackerApi.resetTokensSpawned(card.getGUID())\n end\n\n -- Pushes new player card data into the local copy of the Data Helper player data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addPlayerCardData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n playerCardData[k] = v\n end\n end\n\n -- Pushes new location data into the local copy of the Data Helper location data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addLocationData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n locationData[k] = v\n end\n end\n\n -- Checks to see if the given card has location data in the DataHelper\n ---@param card Object Card to check for data\n ---@return Boolean True if this card has data in the helper, false otherwise\n TokenManager.hasLocationData = function(card)\n internal.initDataHelperData()\n return internal.getLocationData(card) ~= nil\n end\n\n internal.initTokenTemplates = function()\n if tokenTemplates ~= nil then\n return\n end\n tokenTemplates = { }\n local tokenSource = getObjectFromGUID(TOKEN_SOURCE_GUID)\n for _, tokenTemplate in ipairs(tokenSource.getData().ContainedObjects) do\n local tokenName = tokenTemplate.Memo\n tokenTemplates[tokenName] = tokenTemplate\n end\n end\n\n -- Copies the data from the DataHelper. Will only happen once.\n internal.initDataHelperData = function()\n if playerCardData ~= nil then\n return\n end\n local dataHelper = getObjectFromGUID(DATA_HELPER_GUID)\n playerCardData = dataHelper.getTable('PLAYER_CARD_DATA')\n locationData = dataHelper.getTable('LOCATIONS_DATA')\n end\n\n -- Spawn tokens for a card based on the uses metadata. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n internal.spawnTokensFromUses = function(card, extraUses)\n local uses = internal.getUses(card)\n if uses == nil then return end\n\n -- go through tokens to spawn\n local type, token, tokenCount\n for i, useInfo in ipairs(uses) do\n type = useInfo.type\n token = useInfo.token\n tokenCount = (useInfo.count or 0)\n + (useInfo.countPerInvestigator or 0) * playAreaApi.getInvestigatorCount()\n if extraUses ~= nil and extraUses[type] ~= nil then\n tokenCount = tokenCount + extraUses[type]\n end\n -- Shift each spawned group after the first down so they don't pile on each other\n TokenManager.spawnTokenGroup(card, token, tokenCount, (i - 1) * 0.8, type)\n end\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a card based on the data helper data. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n internal.spawnTokensFromDataHelper = function(card)\n internal.initDataHelperData()\n local playerData = internal.getPlayerCardData(card)\n if playerData ~= nil then\n internal.spawnPlayerCardTokensFromDataHelper(card, playerData)\n end\n local locationData = internal.getLocationData(card)\n if locationData ~= nil then\n internal.spawnLocationTokensFromDataHelper(card, locationData)\n end\n end\n\n -- Spawn tokens for a player card using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Player card data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnPlayerCardTokensFromDataHelper = function(card, playerData)\n token = playerData.tokenType\n tokenCount = playerData.tokenCount\n --log(\"Spawning data helper tokens for \"..card.getName()..'['..card.getDescription()..']: '..tokenCount..\"x \"..token)\n TokenManager.spawnTokenGroup(card, token, tokenCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a location using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Location data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnLocationTokensFromDataHelper = function(card, locationData)\n local clueCount = internal.getClueCountFromData(card, locationData)\n if clueCount \u003e 0 then\n TokenManager.spawnTokenGroup(card, \"clue\", clueCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n end\n\n internal.getPlayerCardData = function(card)\n return playerCardData[card.getName() .. ':' .. card.getDescription()]\n or playerCardData[card.getName()]\n end\n\n internal.getLocationData = function(card)\n return locationData[card.getName() .. '_' .. card.getGUID()] or locationData[card.getName()]\n end\n\n internal.getClueCountFromData = function(card, locationData)\n -- Return the number of clues to spawn on this location\n if locationData == nil then\n error('attempted to get clue for unexpected object: ' .. card.getName())\n return 0\n end\n\n --log(card.getName() .. ' : ' .. locationData.type .. ' : ' .. locationData.value .. ' : ' .. locationData.clueSide)\n if ((card.is_face_down and locationData.clueSide == 'back')\n or (not card.is_face_down and locationData.clueSide == 'front')) then\n if locationData.type == 'fixed' then\n return locationData.value\n elseif locationData.type == 'perPlayer' then\n return locationData.value * playAreaApi.getInvestigatorCount()\n end\n error('unexpected location type: ' .. locationData.type)\n end\n return 0\n end\n\n -- Gets the right uses structure for this card, based on metadata and face up/down state\n ---@param card Object Card to pull the uses from\n internal.getUses = function(card)\n local metadata = JSON.decode(card.getGMNotes()) or { }\n if metadata.type == \"Location\" then\n if card.is_face_down and metadata.locationBack ~= nil then\n return metadata.locationBack.uses\n elseif not card.is_face_down and metadata.locationFront ~= nil then\n return metadata.locationFront.uses\n end\n elseif not card.is_face_down then\n return metadata.uses\n end\n\n return nil\n end\n\n -- Dynamically create positions for clues on a card.\n ---@param card Object Card the clues will be placed on\n ---@param count Integer How many clues?\n ---@return Table Array of global positions to spawn the clues at\n internal.buildClueOffsets = function(card, count)\n local pos = card.getPosition()\n local cluePositions = { }\n for i = 1, count do\n local row = math.floor(1 + (i - 1) / 4)\n local column = (i - 1) % 4\n table.insert(cluePositions, Vector(pos.x + 1.5 - 0.55 * row, pos.y + 0.15, pos.z - 0.825 + 0.55 * column))\n end\n return cluePositions\n end\n\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n internal.replenishTokens = function(card, uses, mat)\n local cardPos = card.getPosition()\n\n -- don't continue for cards on the deck (Norman) or in the discard pile\n if mat.positionToLocal(cardPos).x \u003c -1 then return end\n\n -- get current amount of resource tokens on the card\n local search = internal.searchOnCard(cardPos, card.getRotation())\n local clickableResourceCounter = nil\n local foundTokens = 0\n\n for _, obj in ipairs(search) do\n local obj = obj.hit_object\n local memo = obj.getMemo()\n\n if (stateTable[memo] or 0) \u003e 0 then\n foundTokens = foundTokens + math.abs(obj.getQuantity())\n obj.destruct()\n elseif memo == \"resourceCounter\" then\n foundTokens = obj.getVar(\"val\")\n clickableResourceCounter = obj\n break\n end\n end\n\n -- this is the theoretical new amount of uses (to be checked below)\n local newCount = foundTokens + uses[1].replenish\n\n -- if there are already more uses than the replenish amount, keep them\n if foundTokens \u003e uses[1].count then\n newCount = foundTokens\n -- only replenish up until the replenish amount\n elseif newCount \u003e uses[1].count then\n newCount = uses[1].count\n end\n\n -- update the clickable counter or spawn a group of tokens\n if clickableResourceCounter then\n clickableResourceCounter.call(\"updateVal\", newCount)\n else\n TokenManager.spawnTokenGroup(card, uses[1].token, newCount, _, uses[1].type)\n end\n end\n\n -- searches on a card (standard size) and returns the result\n ---@param position Table Position of the card\n ---@param rotation Table Rotation of the card\n internal.searchOnCard = function(position, rotation)\n return Physics.cast({\n origin = position,\n direction = {0, 1, 0},\n orientation = rotation,\n type = 3,\n size = { 2.5, 0.5, 3.5 },\n max_distance = 1,\n debug = false\n })\n end\n\n return TokenManager\nend\nend)\n__bundle_register(\"core/OptionPanelApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local OptionPanelApi = {}\n\n -- loads saved options\n ---@param options Table New options table\n OptionPanelApi.loadSettings = function(options)\n return Global.call(\"loadSettings\", options)\n end\n\n -- returns option panel table\n OptionPanelApi.getOptions = function()\n return Global.getTable(\"optionPanel\")\n end\n\n return OptionPanelApi\nend\nend)\n__bundle_register(\"core/token/TokenSpawnTrackerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenSpawnTracker = { }\n local SPAWN_TRACKER_GUID = \"e3ffc9\"\n\n TokenSpawnTracker.hasSpawnedTokens = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"hasSpawnedTokens\", cardGuid)\n end\n\n TokenSpawnTracker.markTokensSpawned = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"markTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetTokensSpawned = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetAllAssetAndEvents = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAllAssetAndEvents\")\n end\n\n TokenSpawnTracker.resetAllLocations = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAllLocations\")\n end\n\n TokenSpawnTracker.resetAll = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAll\")\n end\n\n return TokenSpawnTracker\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "{\"activeInvestigatorId\":\"00000\",\"isDrawButtonVisible\":false,\"playerColor\":\"Green\"}", - "MeasureMovement": false, - "Name": "Custom_Tile", - "Nickname": "Playermat 3: Green", - "Snap": true, - "Sticky": true, - "Tooltip": false, - "Transform": { - "posX": -30.35, - "posY": 1.45, - "posZ": 26.6, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 6.43, - "scaleY": 1, - "scaleZ": 6.43 - }, - "Value": 0, - "XmlUI": "" - }, { "AltLookAngle": { "x": 0, @@ -48828,7 +51208,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DoomInPlayCounter\")\nend)\n__bundle_register(\"core/DoomInPlayCounter\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- common parameters\nlocal castParameters = {}\ncastParameters.direction = { 0, 1, 0 }\ncastParameters.type = 3\ncastParameters.max_distance = 0\n\nlocal zone\nlocal doomURL = \"https://i.imgur.com/EoL7yaZ.png\"\nlocal IGNORE_TAG = \"DoomCounter_ignore\"\n\n-- playermats 1 to 4\nlocal originAndSize = {\n { origin = { -55, 1.6, 16.5 }, size = { 12, 1, 25 } },\n { origin = { -55, 1.6, -16.5 }, size = { 12, 1, 25 } },\n { origin = { -25, 1.6, 27 }, size = { 25, 1, 12 } },\n { origin = { -25, 1.6, -27 }, size = { 25, 1, 12 } }\n}\n\n-- create button, context menu and start loop\nfunction onLoad()\n self.createButton({\n label = tostring(0),\n click_function = \"none\",\n function_owner = self,\n position = { 0, 0.06, 0 },\n height = 0,\n width = 0,\n scale = { 1.5, 1.5, 1.5 },\n font_size = 600,\n font_color = { 1, 1, 1, 100 },\n color = { 0, 0, 0, 0 }\n })\n\n zone = getObjectFromGUID(\"a2f932\")\n loopID = Wait.time(countDoom, 2, -1)\nend\n\n-- main function\nfunction countDoom()\n local doom = 0\n for i = 1, 5 do doom = doom + search(i) end\n self.editButton({ index = 0, label = tostring(doom) })\nend\n\n-- searches playermats (num = 1-4) or the scripting zone (num = 5)\nfunction search(num)\n local val = 0\n if num == 5 then\n for _, obj in ipairs(zone.getObjects()) do\n val = val + isDoom(obj)\n end\n else\n castParameters.origin = originAndSize[num].origin\n castParameters.size = originAndSize[num].size\n\n for _, obj in ipairs(Physics.cast(castParameters)) do\n val = val + isDoom(obj.hit_object)\n end\n end\n return val\nend\n\n-- checks an object for the doom image and gets quantity (for stacks)\nfunction isDoom(obj)\n if (obj.is_face_down and obj.getCustomObject().image_bottom == doomURL) or\n (obj.name == \"Custom_Token\" and obj.getCustomObject().image == doomURL) then\n if not obj.hasTag(IGNORE_TAG) then\n return math.abs(obj.getQuantity())\n end\n end\n return 0\nend\n\n-- removes doom from playermats / playarea\nfunction removeDoom(options)\n local trashCan = getObjectFromGUID(\"70b9f6\")\n local count = 0\n if options.Playermats then\n for i = 1, 4 do\n castParameters.origin = originAndSize[i].origin\n castParameters.size = originAndSize[i].size\n\n for _, obj in ipairs(Physics.cast(castParameters)) do\n local obj = obj.hit_object\n local amount = isDoom(obj)\n if amount \u003e 0 then\n trashCan.putObject(obj)\n count = count + amount\n end\n end\n end\n broadcastToAll(count .. \" doom removed from Playermats.\", \"White\")\n end\n\n local count = 0\n if options.Playarea then\n for _, obj in ipairs(zone.getObjects()) do\n local amount = isDoom(obj)\n if amount \u003e 0 then\n trashCan.putObject(obj)\n count = count + amount\n end\n end\n broadcastToAll(count .. \" doom removed from Playarea.\", \"White\")\n end\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DoomInPlayCounter\")\nend)\n__bundle_register(\"core/DoomInPlayCounter\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal guidReferenceApi = require(\"core/GUIDReferenceApi\")\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\nlocal ZONE, TRASH, loopID\nlocal doomURL = \"https://i.imgur.com/EoL7yaZ.png\"\nlocal IGNORE_TAG = \"DoomCounter_ignore\"\nlocal TOTAL_PLAY_AREA = {\n upperLeft = {\n x = -10,\n z = -35\n },\n lowerRight = {\n x = -60,\n z = 35\n }\n}\n\n-- create button, context menu and start loop\nfunction onLoad()\n self.createButton({\n label = \"0\",\n click_function = \"none\",\n function_owner = self,\n position = { 0, 0.06, 0 },\n height = 0,\n width = 0,\n scale = { 1.5, 1.5, 1.5 },\n font_size = 600,\n font_color = { 1, 1, 1, 100 },\n color = { 0, 0, 0, 0 }\n })\n\n TRASH = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"Trash\")\n ZONE = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"PlayAreaZone\")\n loopID = Wait.time(countDoom, 2, -1)\nend\n\n-- main function\nfunction countDoom()\n local count = 0\n\n -- get doom in play\n for _, obj in ipairs(getObjects()) do\n count = count + getDoomAmount(obj)\n end\n\n self.editButton({ index = 0, label = tostring(count) })\nend\n\n-- gets quantity (for stacks) of doom\nfunction getDoomAmount(obj)\n if (obj.is_face_down and obj.getCustomObject().image_bottom == doomURL)\n and not obj.hasTag(IGNORE_TAG)\n and inArea(obj.getPosition(), TOTAL_PLAY_AREA) then\n return math.abs(obj.getQuantity())\n else\n return 0\n end\nend\n\n-- removes doom from playermats / playarea\nfunction removeDoom(options)\n local count = 0\n\n if options.Playermats then\n count = removeDoomFromList(playmatApi.searchAroundPlaymat(\"All\"))\n broadcastToAll(count .. \" doom removed from Playermats.\", \"White\")\n end\n\n if options.Playarea then\n count = removeDoomFromList(ZONE.getObjects())\n broadcastToAll(count .. \" doom removed from Playerarea.\", \"White\")\n end\nend\n\n-- removes doom from provided object list and returns the removed amount\nfunction removeDoomFromList(objList)\n local count = 0\n for _, obj in ipairs(objList) do\n local amount = getDoomAmount(obj)\n if amount \u003e 0 then\n TRASH.putObject(obj)\n count = count + amount\n end\n end\n return count\nend\n\nfunction inArea(point, bounds)\n return (point.x \u003c bounds.upperLeft.x\n and point.x \u003e bounds.lowerRight.x\n and point.z \u003e bounds.upperLeft.z\n and point.z \u003c bounds.lowerRight.z)\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Custom_Token", @@ -49198,9 +51578,10 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/OptionPanelApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local OptionPanelApi = {}\n\n -- loads saved options\n ---@param options Table New options table\n OptionPanelApi.loadSettings = function(options)\n return Global.call(\"loadSettings\", options)\n end\n\n -- returns option panel table\n OptionPanelApi.getOptions = function()\n return Global.getTable(\"optionPanel\")\n end\n\n return OptionPanelApi\nend\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = { }\n local PLAY_AREA_GUID = \"721ba2\"\n local INVESTIGATOR_COUNTER_GUID = \"f182ee\"\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with\n -- 'displacement_excluded'\n ---@param playerColor Color of the player requesting the shift. Used solely to send an error\n --- message in the unlikely case that the scripting zone has been deleted\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"tryObjectEnterContainer\",\n { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightCountedVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\n__bundle_register(\"core/token/TokenSpawnTrackerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenSpawnTracker = { }\n local SPAWN_TRACKER_GUID = \"e3ffc9\"\n\n TokenSpawnTracker.hasSpawnedTokens = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"hasSpawnedTokens\", cardGuid)\n end\n\n TokenSpawnTracker.markTokensSpawned = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"markTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetTokensSpawned = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetAllAssetAndEvents = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAllAssetAndEvents\")\n end\n\n TokenSpawnTracker.resetAllLocations = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAllLocations\")\n end\n\n TokenSpawnTracker.resetAll = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAll\")\n end\n\n return TokenSpawnTracker\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\n---------------------------------------------------------\n-- specific setup (different for each playmat)\n---------------------------------------------------------\n\nTRASHCAN_GUID = \"147e80\"\nSTAT_TRACKER_GUID = \"e598c2\"\nRESOURCE_COUNTER_GUID = \"4406f0\"\nCLUE_COUNTER_GUID = \"d86b7c\"\nCLUE_CLICKER_GUID = \"db85d6\"\n\nrequire(\"playermat/Playmat\")\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/NavigationOverlayApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local NavigationOverlayApi = {}\n local HANDLER_GUID = \"797ede\"\n\n -- Copies the visibility for the Navigation overlay\n ---@param startColor String Color of the player to copy from\n ---@param targetColor String Color of the targeted player\n NavigationOverlayApi.copyVisibility = function(startColor, targetColor)\n getObjectFromGUID(HANDLER_GUID).call(\"copyVisibility\", {\n startColor = startColor,\n targetColor = targetColor\n })\n end\n\n -- Changes the Navigation Overlay view (\"Full View\" --\u003e \"Play Areas\" --\u003e \"Closed\" etc.)\n ---@param playerColor String Color of the player to update the visibility for\n NavigationOverlayApi.cycleVisibility = function(playerColor)\n getObjectFromGUID(HANDLER_GUID).call(\"cycleVisibility\", playerColor)\n end\n\n return NavigationOverlayApi\nend\nend)\n__bundle_register(\"core/token/TokenManager\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local optionPanelApi = require(\"core/OptionPanelApi\")\n local playAreaApi = require(\"core/PlayAreaApi\")\n local tokenSpawnTrackerApi = require(\"core/token/TokenSpawnTrackerApi\")\n\n local PLAYER_CARD_TOKEN_OFFSETS = {\n [1] = {\n Vector(0, 3, -0.2)\n },\n [2] = {\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [3] = {\n Vector(0, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [4] = {\n Vector(0.4, 3, -0.9),\n Vector(-0.4, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [5] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [6] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2)\n },\n [7] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0, 3, 0.5)\n },\n [8] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(-0.35, 3, 0.5),\n Vector(0.35, 3, 0.5)\n },\n [9] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5)\n },\n [10] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0, 3, 1.2)\n },\n [11] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(-0.35, 3, 1.2),\n Vector(0.35, 3, 1.2)\n },\n [12] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0.7, 3, 1.2),\n Vector(0, 3, 1.2),\n Vector(-0.7, 3, 1.2)\n }\n }\n\n -- stateIDs for the multi-stated resource tokens\n local stateTable = {\n [\"resource\"] = 1,\n [\"ammo\"] = 2,\n [\"bounty\"] = 3,\n [\"charge\"] = 4,\n [\"evidence\"] = 5,\n [\"secret\"] = 6,\n [\"supply\"] = 7\n }\n\n -- Source for tokens\n local TOKEN_SOURCE_GUID = \"124381\"\n\n -- Table of data extracted from the token source bag, keyed by the Memo on each token which\n -- should match the token type keys (\"resource\", \"clue\", etc)\n local tokenTemplates\n\n local DATA_HELPER_GUID = \"708279\"\n\n local playerCardData\n local locationData\n\n local TokenManager = { }\n local internal = { }\n\n -- Spawns tokens for the card. This function is built to just throw a card at it and let it do\n -- the work once a card has hit an area where it might spawn tokens. It will check to see if\n -- the card has already spawned, find appropriate data from either the uses metadata or the Data\n -- Helper, and spawn the tokens.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n TokenManager.spawnForCard = function(card, extraUses)\n if tokenSpawnTrackerApi.hasSpawnedTokens(card.getGUID()) then\n return\n end\n local metadata = JSON.decode(card.getGMNotes())\n if metadata ~= nil then\n internal.spawnTokensFromUses(card, extraUses)\n else\n internal.spawnTokensFromDataHelper(card)\n end\n end\n\n -- Spawns a set of tokens on the given card.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String Type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param tokenCount Number How many tokens to spawn. For damage or horror this value will be set to the\n -- spawned state object rather than spawning multiple tokens\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnTokenGroup = function(card, tokenType, tokenCount, shiftDown, subType)\n local optionPanel = optionPanelApi.getOptions()\n\n if tokenType == \"damage\" or tokenType == \"horror\" then\n TokenManager.spawnCounterToken(card, tokenType, tokenCount, shiftDown)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"enabled\" then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"custom\" and tokenCount == 0 then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n else\n TokenManager.spawnMultipleTokens(card, tokenType, tokenCount, shiftDown, subType)\n end\n end\n\n -- Spawns a single counter token and sets the value to tokenValue. Used for damage and horror\n -- tokens.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String type of token to spawn, valid values are \"damage\" and \"horror\". Other\n -- types should use spawnMultipleTokens()\n ---@param tokenValue Number Value to set the damage/horror to\n TokenManager.spawnCounterToken = function(card, tokenType, tokenValue, shiftDown)\n if tokenValue \u003c 1 or tokenValue \u003e 50 then return end\n\n local pos = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[1][1] + Vector(0, 0, shiftDown))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, tokenType, rot, function(spawned) spawned.setState(tokenValue) end)\n end\n\n TokenManager.spawnResourceCounterToken = function(card, tokenCount)\n local pos = card.positionToWorld(card.positionToLocal(card.getPosition()) + Vector(0, 0.2, -0.5))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, \"resourceCounter\", rot, function(spawned)\n spawned.call(\"updateVal\", tokenCount)\n end)\n end\n\n -- Spawns a number of tokens.\n ---@param tokenType String type of token to spawn, valid values are resource\", \"doom\", or \"clue\".\n -- Other types should use spawnCounterToken()\n ---@param tokenCount Number How many tokens to spawn\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnMultipleTokens = function(card, tokenType, tokenCount, shiftDown, subType)\n -- not checking the max at this point since clue offsets are calculated dynamically\n if tokenCount \u003c 1 then return end\n\n local offsets = {}\n if tokenType == \"clue\" then\n offsets = internal.buildClueOffsets(card, tokenCount)\n else\n -- only up to 12 offset tables defined\n if tokenCount \u003e 12 then return end\n for i = 1, tokenCount do\n offsets[i] = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[tokenCount][i])\n -- Fix the y-position for the spawn, since positionToWorld considers rotation which can\n -- have bad results for face up/down differences\n offsets[i].y = card.getPosition().y + 0.15\n end\n end\n\n if shiftDown ~= nil then\n -- Copy the offsets to make sure we don't change the static values\n local baseOffsets = offsets\n offsets = { }\n for i, baseOffset in ipairs(baseOffsets) do\n offsets[i] = baseOffset\n offsets[i][3] = offsets[i][3] + shiftDown\n end\n end\n\n if offsets == nil then\n error(\"couldn't find offsets for \" .. tokenCount .. ' tokens')\n return\n end\n\n -- handling for not provided subtype (for example when spawning from custom data helpers)\n if subType == nil then\n subType = \"\"\n end\n \n -- this is used to load the correct state for additional resource tokens (e.g. \"Ammo\")\n local callback = nil\n local stateID = stateTable[string.lower(subType)]\n if tokenType == \"resource\" and stateID ~= nil and stateID ~= 1 then\n callback = function(spawned) spawned.setState(stateID) end\n end\n\n for i = 1, tokenCount do\n TokenManager.spawnToken(offsets[i], tokenType, card.getRotation(), callback)\n end\n end\n\n -- Spawns a single token at the given global position by copying it from the template bag.\n ---@param position Global position to spawn the token\n ---@param tokenType String type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param rotation Vector Rotation to be used for the new token. Only the y-value will be used,\n -- x and z will use the default rotation from the source bag\n ---@param callback function A callback function triggered after the new token is spawned\n TokenManager.spawnToken = function(position, tokenType, rotation, callback)\n internal.initTokenTemplates()\n local loadTokenType = tokenType\n if tokenType == \"clue\" or tokenType == \"doom\" then\n loadTokenType = \"clueDoom\"\n end\n if tokenTemplates[loadTokenType] == nil then\n error(\"Unknown token type '\" .. tokenType .. \"'\")\n return\n end\n local tokenTemplate = tokenTemplates[loadTokenType]\n\n -- Take ONLY the Y-value for rotation, so we don't flip the token coming out of the bag\n local rot = Vector(tokenTemplate.Transform.rotX,\n 270,\n tokenTemplate.Transform.rotZ)\n if rotation ~= nil then\n rot.y = rotation.y\n end\n if tokenType == \"doom\" then\n rot.z = 180\n end\n\n tokenTemplate.Nickname = \"\"\n return spawnObjectData({\n data = tokenTemplate,\n position = position,\n rotation = rot,\n callback_function = callback\n })\n end\n\n -- Checks a card for metadata to maybe replenish it\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n TokenManager.maybeReplenishCard = function(card, uses, mat)\n -- TODO: support for cards with multiple uses AND replenish (as of yet, no official card needs that)\n if uses[1].count and uses[1].replenish then\n internal.replenishTokens(card, uses, mat)\n end\n end\n\n -- Delegate function to the token spawn tracker. Exists to avoid circular dependencies in some\n -- callers.\n ---@param card Object Card object to reset the tokens for\n TokenManager.resetTokensSpawned = function(card)\n tokenSpawnTrackerApi.resetTokensSpawned(card.getGUID())\n end\n\n -- Pushes new player card data into the local copy of the Data Helper player data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addPlayerCardData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n playerCardData[k] = v\n end\n end\n\n -- Pushes new location data into the local copy of the Data Helper location data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addLocationData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n locationData[k] = v\n end\n end\n\n -- Checks to see if the given card has location data in the DataHelper\n ---@param card Object Card to check for data\n ---@return Boolean True if this card has data in the helper, false otherwise\n TokenManager.hasLocationData = function(card)\n internal.initDataHelperData()\n return internal.getLocationData(card) ~= nil\n end\n\n internal.initTokenTemplates = function()\n if tokenTemplates ~= nil then\n return\n end\n tokenTemplates = { }\n local tokenSource = getObjectFromGUID(TOKEN_SOURCE_GUID)\n for _, tokenTemplate in ipairs(tokenSource.getData().ContainedObjects) do\n local tokenName = tokenTemplate.Memo\n tokenTemplates[tokenName] = tokenTemplate\n end\n end\n\n -- Copies the data from the DataHelper. Will only happen once.\n internal.initDataHelperData = function()\n if playerCardData ~= nil then\n return\n end\n local dataHelper = getObjectFromGUID(DATA_HELPER_GUID)\n playerCardData = dataHelper.getTable('PLAYER_CARD_DATA')\n locationData = dataHelper.getTable('LOCATIONS_DATA')\n end\n\n -- Spawn tokens for a card based on the uses metadata. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n internal.spawnTokensFromUses = function(card, extraUses)\n local uses = internal.getUses(card)\n if uses == nil then return end\n\n -- go through tokens to spawn\n local type, token, tokenCount\n for i, useInfo in ipairs(uses) do\n type = useInfo.type\n token = useInfo.token\n tokenCount = (useInfo.count or 0)\n + (useInfo.countPerInvestigator or 0) * playAreaApi.getInvestigatorCount()\n if extraUses ~= nil and extraUses[type] ~= nil then\n tokenCount = tokenCount + extraUses[type]\n end\n -- Shift each spawned group after the first down so they don't pile on each other\n TokenManager.spawnTokenGroup(card, token, tokenCount, (i - 1) * 0.8, type)\n end\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a card based on the data helper data. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n internal.spawnTokensFromDataHelper = function(card)\n internal.initDataHelperData()\n local playerData = internal.getPlayerCardData(card)\n if playerData ~= nil then\n internal.spawnPlayerCardTokensFromDataHelper(card, playerData)\n end\n local locationData = internal.getLocationData(card)\n if locationData ~= nil then\n internal.spawnLocationTokensFromDataHelper(card, locationData)\n end\n end\n\n -- Spawn tokens for a player card using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Player card data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnPlayerCardTokensFromDataHelper = function(card, playerData)\n token = playerData.tokenType\n tokenCount = playerData.tokenCount\n --log(\"Spawning data helper tokens for \"..card.getName()..'['..card.getDescription()..']: '..tokenCount..\"x \"..token)\n TokenManager.spawnTokenGroup(card, token, tokenCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a location using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Location data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnLocationTokensFromDataHelper = function(card, locationData)\n local clueCount = internal.getClueCountFromData(card, locationData)\n if clueCount \u003e 0 then\n TokenManager.spawnTokenGroup(card, \"clue\", clueCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n end\n\n internal.getPlayerCardData = function(card)\n return playerCardData[card.getName() .. ':' .. card.getDescription()]\n or playerCardData[card.getName()]\n end\n\n internal.getLocationData = function(card)\n return locationData[card.getName() .. '_' .. card.getGUID()] or locationData[card.getName()]\n end\n\n internal.getClueCountFromData = function(card, locationData)\n -- Return the number of clues to spawn on this location\n if locationData == nil then\n error('attempted to get clue for unexpected object: ' .. card.getName())\n return 0\n end\n\n --log(card.getName() .. ' : ' .. locationData.type .. ' : ' .. locationData.value .. ' : ' .. locationData.clueSide)\n if ((card.is_face_down and locationData.clueSide == 'back')\n or (not card.is_face_down and locationData.clueSide == 'front')) then\n if locationData.type == 'fixed' then\n return locationData.value\n elseif locationData.type == 'perPlayer' then\n return locationData.value * playAreaApi.getInvestigatorCount()\n end\n error('unexpected location type: ' .. locationData.type)\n end\n return 0\n end\n\n -- Gets the right uses structure for this card, based on metadata and face up/down state\n ---@param card Object Card to pull the uses from\n internal.getUses = function(card)\n local metadata = JSON.decode(card.getGMNotes()) or { }\n if metadata.type == \"Location\" then\n if card.is_face_down and metadata.locationBack ~= nil then\n return metadata.locationBack.uses\n elseif not card.is_face_down and metadata.locationFront ~= nil then\n return metadata.locationFront.uses\n end\n elseif not card.is_face_down then\n return metadata.uses\n end\n\n return nil\n end\n\n -- Dynamically create positions for clues on a card.\n ---@param card Object Card the clues will be placed on\n ---@param count Integer How many clues?\n ---@return Table Array of global positions to spawn the clues at\n internal.buildClueOffsets = function(card, count)\n local pos = card.getPosition()\n local cluePositions = { }\n for i = 1, count do\n local row = math.floor(1 + (i - 1) / 4)\n local column = (i - 1) % 4\n table.insert(cluePositions, Vector(pos.x + 1.5 - 0.55 * row, pos.y + 0.15, pos.z - 0.825 + 0.55 * column))\n end\n return cluePositions\n end\n\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n internal.replenishTokens = function(card, uses, mat)\n local cardPos = card.getPosition()\n\n -- don't continue for cards on the deck (Norman) or in the discard pile\n if mat.positionToLocal(cardPos).x \u003c -1 then return end\n\n -- get current amount of resource tokens on the card\n local search = internal.searchOnCard(cardPos, card.getRotation())\n local clickableResourceCounter = nil\n local foundTokens = 0\n\n for _, obj in ipairs(search) do\n local obj = obj.hit_object\n local memo = obj.getMemo()\n\n if (stateTable[memo] or 0) \u003e 0 then\n foundTokens = foundTokens + math.abs(obj.getQuantity())\n obj.destruct()\n elseif memo == \"resourceCounter\" then\n foundTokens = obj.getVar(\"val\")\n clickableResourceCounter = obj\n break\n end\n end\n\n -- this is the theoretical new amount of uses (to be checked below)\n local newCount = foundTokens + uses[1].replenish\n\n -- if there are already more uses than the replenish amount, keep them\n if foundTokens \u003e uses[1].count then\n newCount = foundTokens\n -- only replenish up until the replenish amount\n elseif newCount \u003e uses[1].count then\n newCount = uses[1].count\n end\n\n -- update the clickable counter or spawn a group of tokens\n if clickableResourceCounter then\n clickableResourceCounter.call(\"updateVal\", newCount)\n else\n TokenManager.spawnTokenGroup(card, uses[1].token, newCount, _, uses[1].type)\n end\n end\n\n -- searches on a card (standard size) and returns the result\n ---@param position Table Position of the card\n ---@param rotation Table Rotation of the card\n internal.searchOnCard = function(position, rotation)\n return Physics.cast({\n origin = position,\n direction = {0, 1, 0},\n orientation = rotation,\n type = 3,\n size = { 2.5, 0.5, 3.5 },\n max_distance = 1,\n debug = false\n })\n end\n\n return TokenManager\nend\nend)\n__bundle_register(\"playermat/Playmat\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal mythosAreaApi = require(\"core/MythosAreaApi\")\nlocal navigationOverlayApi = require(\"core/NavigationOverlayApi\")\nlocal tokenChecker = require(\"core/token/TokenChecker\")\nlocal tokenManager = require(\"core/token/TokenManager\")\n\n-- set true to enable debug logging and show Physics.cast()\nlocal DEBUG = false\n\n-- we use this to turn off collision handling until onLoad() is complete\nlocal collisionEnabled = false\n\n-- position offsets relative to mat [x, y, z]\nlocal DRAWN_ENCOUNTER_CARD_OFFSET = {1.365, 0.5, -0.625}\nlocal DRAWN_CHAOS_TOKEN_OFFSET = {-1.55, 0.25, -0.58}\n\n-- x-Values for discard buttons\nlocal DISCARD_BUTTON_OFFSETS = {-1.365, -0.91, -0.455, 0, 0.455, 0.91}\n\nlocal SEARCH_AROUND_SELF_X_BUFFER = 8\n\n-- defined areas for \"inArea()\" and \"Physics.cast()\"\nlocal MAIN_PLAY_AREA = {\n upperLeft = {\n x = 1.98,\n z = 0.736\n },\n lowerRight = {\n x = -0.79,\n z = -0.39\n }\n}\nlocal INVESTIGATOR_AREA = {\n upperLeft = {\n x = -1.084,\n z = 0.06517\n },\n lowerRight = {\n x = -1.258,\n z = -0.0805\n }\n}\nlocal THREAT_AREA = {\n upperLeft = {\n x = 1.53,\n z = -0.34\n },\n lowerRight = {\n x = -1.13,\n z = -0.92\n }\n}\nlocal DECK_DISCARD_AREA = {\n upperLeft = {\n x = -1.62,\n z = 0.855\n },\n lowerRight = {\n x = -2.02,\n z = -0.245\n },\n center = {\n x = -1.82,\n y = 0.1,\n z = 0.305\n },\n size = {\n x = 0.4,\n y = 0.1,\n z = 1.1\n }\n}\n\n-- local position of draw and discard pile\nlocal DRAW_DECK_POSITION = { x = -1.82, y = 0, z = 0 }\nlocal DISCARD_PILE_POSITION = { x = -1.82, y = 0, z = 0.61 }\n\n-- global position of encounter discard pile\nlocal ENCOUNTER_DISCARD_POSITION = { x = -3.85, y = 1.5, z = 10.38}\n\n-- global variable so it can be reset by the Clean Up Helper\nactiveInvestigatorId = \"00000\"\n\nlocal TRASHCAN, STAT_TRACKER, RESOURCE_COUNTER\nlocal isDrawButtonVisible = false\n\n-- global variable to report \"Dream-Enhancing Serum\" status\nisDES = false\n\nfunction onSave()\n return JSON.encode({\n playerColor = playerColor,\n activeInvestigatorId = activeInvestigatorId,\n isDrawButtonVisible = isDrawButtonVisible\n })\nend\n\nfunction onLoad(saveState)\n self.interactable = DEBUG\n\n TRASHCAN = getObjectFromGUID(TRASHCAN_GUID)\n STAT_TRACKER = getObjectFromGUID(STAT_TRACKER_GUID)\n RESOURCE_COUNTER = getObjectFromGUID(RESOURCE_COUNTER_GUID)\n\n -- button creation\n for i = 1, 6 do\n makeDiscardButton(DISCARD_BUTTON_OFFSETS[i], i)\n end\n\n self.createButton({\n click_function = \"drawEncounterCard\",\n function_owner = self,\n position = {-1.84, 0, -0.65},\n rotation = {0, 80, 0},\n width = 265,\n height = 190\n })\n\n self.createButton({\n click_function = \"drawChaosTokenButton\",\n function_owner = self,\n position = {1.85, 0, -0.74},\n rotation = {0, -45, 0},\n width = 135,\n height = 135\n })\n\n self.createButton({\n label = \"Upkeep\",\n click_function = \"doUpkeep\",\n function_owner = self,\n position = {1.84, 0.1, -0.44},\n scale = {0.12, 0.12, 0.12},\n width = 800,\n height = 280,\n font_size = 180\n })\n\n -- save state loading\n local state = JSON.decode(saveState)\n if state ~= nil then\n playerColor = state.playerColor\n activeInvestigatorId = state.activeInvestigatorId\n isDrawButtonVisible = state.isDrawButtonVisible\n end\n\n showDrawButton(isDrawButtonVisible)\n\n collisionEnabled = true\n\n math.randomseed(os.time())\nend\n\n---------------------------------------------------------\n-- utility functions\n---------------------------------------------------------\n\n-- searches an area and optionally filters the result\nfunction searchArea(origin, size, filter)\n local searchResult = Physics.cast({\n origin = origin,\n direction = { 0, 1, 0 },\n orientation = self.getRotation(),\n type = 3,\n size = size,\n max_distance = 1\n })\n\n local objList = {}\n for _, v in ipairs(searchResult) do\n if not filter or (filter and filter(v.hit_object)) then\n table.insert(objList, v.hit_object)\n end\n end\n return objList\nend\n\n-- filter functions for searchArea()\nfunction isCard(x) return x.type == 'Card' end\nfunction isDeck(x) return x.type == 'Deck' end\nfunction isCardOrDeck(x) return x.type == 'Card' or x.type == 'Deck' end\n\n-- Finds all objects on the playmat and associated set aside zone.\nfunction searchAroundSelf(filter)\n local bounds = self.getBoundsNormalized()\n -- Increase the width to cover the set aside zone\n bounds.size.x = bounds.size.x + SEARCH_AROUND_SELF_X_BUFFER\n -- Since the cast is centered on the position, shift left or right to keep the non-set aside edge\n -- of the cast at the edge of the playmat\n -- setAsideDirection accounts for the set aside zone being on the left or right, depending on the\n -- table position of the playmat\n local setAsideDirection = bounds.center.z \u003e 0 and 1 or -1\n local localCenter = self.positionToLocal(bounds.center)\n localCenter.x = localCenter.x + setAsideDirection * SEARCH_AROUND_SELF_X_BUFFER / 2 / self.getScale().x\n return searchArea(self.positionToWorld(localCenter), bounds.size, filter)\nend\n\n-- searches the area around the draw deck and discard pile\nfunction searchDeckAndDiscardArea(filter)\n local pos = self.positionToWorld(DECK_DISCARD_AREA.center)\n local scale = self.getScale()\n local size = {\n x = DECK_DISCARD_AREA.size.x * scale.x,\n y = DECK_DISCARD_AREA.size.y, \n z = DECK_DISCARD_AREA.size.z * scale.z\n }\n return searchArea(pos, size, filter)\nend\n\nfunction doNotReady(card)\n return card.getVar(\"do_not_ready\") or false\nend\n\n---------------------------------------------------------\n-- Discard buttons\n---------------------------------------------------------\n\n-- builds a function that discards things in searchPosition\n-- stuff on the card/deck will be put into the local trashcan\nfunction makeDiscardHandlerFor(searchPosition)\n return function ()\n local origin = self.positionToWorld(searchPosition)\n for _, obj in ipairs(searchArea(origin, {2, 1, 3.2})) do\n if isCardOrDeck(obj) then\n if obj.hasTag(\"PlayerCard\") then\n placeOrMergeIntoDeck(obj, returnGlobalDiscardPosition(), self.getRotation())\n else\n placeOrMergeIntoDeck(obj, ENCOUNTER_DISCARD_POSITION, {x = 0, y = -90, z = 0})\n end\n -- put chaos tokens back into bag (e.g. Unrelenting)\n elseif tokenChecker.isChaosToken(obj) then\n local chaosBag = chaosBagApi.findChaosBag()\n chaosBag.putObject(obj)\n -- don't touch the table or this playmat itself\n elseif obj.guid ~= \"4ee1f2\" and obj ~= self then\n TRASHCAN.putObject(obj)\n end\n end\n end\nend\n\n-- places a card/deck at a position or merges into an existing deck\n-- rotation is optional\nfunction placeOrMergeIntoDeck(obj, pos, rot)\n if not pos then return end\n\n local offset = 0.5\n local deck, card, newPos\n \n -- search the new position for existing card/deck\n local searchResult = searchArea(pos, { 1, 1, 1 }, isCardOrDeck)\n if #searchResult == 1 then\n local match = searchResult[1]\n if match.type == 'Card' then\n card = match\n elseif match.type == 'Deck' then\n deck = match\n end\n end\n\n -- update vertical component of new position\n if card or deck then\n local bounds = searchResult[1].getBounds()\n newPos = Vector(pos):setAt(\"y\", bounds.center.y + bounds.size.y / 2 + offset)\n else\n newPos = Vector(pos) + Vector(0, offset, 0)\n end\n\n -- actual movement of the object\n if rot then\n obj.setRotationSmooth(rot, false, true)\n end\n obj.setPositionSmooth(newPos, false, true)\n \n -- this avoids a TTS bug that merges unrelated cards that are not resting\n if deck then\n Wait.time(function() deck.putObject(obj) end, 0.3)\n elseif card then\n Wait.time(function() obj.setPosition(newPos) end, 0.3)\n end\nend\n\n-- build a discard button to discard from searchPosition (number must be unique)\nfunction makeDiscardButton(xValue, number)\n local position = { xValue, 0.1, -0.94}\n local searchPosition = {-position[1], position[2], position[3] + 0.32}\n local handler = makeDiscardHandlerFor(searchPosition)\n local handlerName = 'handler' .. number\n self.setVar(handlerName, handler)\n self.createButton({\n label = \"Discard\",\n click_function = handlerName,\n function_owner = self,\n position = position,\n scale = {0.12, 0.12, 0.12},\n width = 900,\n height = 350,\n font_size = 220\n })\nend\n\n---------------------------------------------------------\n-- Upkeep button\n---------------------------------------------------------\n\n-- calls the Upkeep function with correct parameter\nfunction doUpkeepFromHotkey(color)\n doUpkeep(_, color)\nend\n\nfunction doUpkeep(_, clickedByColor, isRightClick)\n -- right-click allow color changing\n if isRightClick then\n changeColor(clickedByColor)\n return\n end\n\n -- send messages to player who clicked button if no seated player found\n messageColor = Player[playerColor].seated and playerColor or clickedByColor\n\n -- unexhaust cards in play zone, flip action tokens and find forcedLearning\n local forcedLearning = false\n local rot = self.getRotation()\n for _, obj in ipairs(searchAroundSelf()) do\n if obj.getDescription() == \"Action Token\" and obj.is_face_down then\n obj.flip()\n elseif obj.type == \"Card\" and not inArea(self.positionToLocal(obj.getPosition()), INVESTIGATOR_AREA) then\n local cardMetadata = JSON.decode(obj.getGMNotes()) or {}\n if not doNotReady(obj) then\n local cardRotation = round(obj.getRotation().y, 0) - rot.y\n local yRotDiff = 0\n\n if cardRotation \u003c 0 then\n cardRotation = cardRotation + 360\n end\n\n -- rotate cards to the next multiple of 90° towards 0°\n if cardRotation \u003e 90 and cardRotation \u003c= 180 then\n yRotDiff = 90\n elseif cardRotation \u003c 270 and cardRotation \u003e 180 then\n yRotDiff = 270\n end\n\n -- set correct rotation for face-down cards\n rot.z = obj.is_face_down and 180 or 0\n obj.setRotation({rot.x, rot.y + yRotDiff, rot.z})\n end\n if cardMetadata.id == \"08031\" then\n forcedLearning = true\n end\n if cardMetadata.uses ~= nil then\n tokenManager.maybeReplenishCard(obj, cardMetadata.uses, self)\n end\n end\n end\n\n -- flip investigator mini-card and summoned servitor mini-card\n -- (all characters allowed to account for custom IDs - e.g. 'Z0000' for TTS Zoop generated IDs)\n if activeInvestigatorId ~= nil then\n local miniId = string.match(activeInvestigatorId, \".....\") .. \"-m\"\n for _, obj in ipairs(getObjects()) do\n if obj.type == \"Card\" and obj.is_face_down then\n local notes = JSON.decode(obj.getGMNotes())\n if notes ~= nil and notes.type == \"Minicard\" and (notes.id == miniId or notes.id == \"09080-m\") then\n obj.flip()\n end\n end\n end\n end\n\n -- gain a resource (or two if playing Jenny Barnes)\n if string.match(activeInvestigatorId, \"%d%d%d%d%d\") == \"02003\" then\n gainResources(2)\n printToColor(\"Gaining 2 resources (Jenny)\", messageColor)\n else\n gainResources(1)\n end\n\n -- draw a card (with handling for Patrice and Forced Learning)\n if activeInvestigatorId == \"06005\" then\n if forcedLearning then\n printToColor(\"Wow, did you really take 'Versatile' to play Patrice with 'Forced Learning'? Choose which draw replacement effect takes priority and draw cards accordingly.\", messageColor)\n else\n local handSize = #Player[playerColor].getHandObjects()\n if handSize \u003c 5 then\n local cardsToDraw = 5 - handSize\n printToColor(\"Drawing \" .. cardsToDraw .. \" cards (Patrice)\", messageColor)\n drawCardsWithReshuffle(cardsToDraw)\n end\n end\n elseif forcedLearning then\n printToColor(\"Drawing 2 cards, discard 1 (Forced Learning)\", messageColor)\n drawCardsWithReshuffle(2)\n elseif activeInvestigatorId == \"89001\" then\n printToColor(\"Drawing 2 cards (Subject 5U-21)\", messageColor)\n drawCardsWithReshuffle(2)\n else\n drawCardsWithReshuffle(1)\n end\nend\n\n-- adds the specified amount of resources to the resource counter\nfunction gainResources(amount)\n local count = RESOURCE_COUNTER.getVar(\"val\")\n local add = tonumber(amount) or 0\n RESOURCE_COUNTER.call(\"updateVal\", count + add)\nend\n\n-- returns the resource counter amount\nfunction getResourceCount()\n return RESOURCE_COUNTER.getVar(\"val\")\nend\n\n-- function for \"draw 1 button\" (that can be added via option panel)\nfunction doDrawOne(_, color)\n -- send messages to player who clicked button if no seated player found\n messageColor = Player[playerColor].seated and playerColor or color\n drawCardsWithReshuffle(1)\nend\n\n-- draw X cards (shuffle discards if necessary)\nfunction drawCardsWithReshuffle(numCards)\n getDrawDiscardDecks()\n\n -- Norman Withers handling\n if string.match(activeInvestigatorId, \"%d%d%d%d%d\") == \"08004\" then\n local harbinger = false\n if topCard ~= nil and topCard.getName() == \"The Harbinger\" then harbinger = true\n elseif drawDeck ~= nil and not drawDeck.is_face_down then\n local cards = drawDeck.getObjects()\n if cards[#cards].name == \"The Harbinger\" then harbinger = true end\n end\n\n if harbinger then\n printToColor(\"The Harbinger is on top of your deck, not drawing cards\", messageColor)\n return\n end\n\n if topCard ~= nil then\n topCard.deal(numCards, playerColor)\n numCards = numCards - 1\n if numCards == 0 then return end\n end\n end\n\n local deckSize = 1\n if drawDeck == nil then\n deckSize = 0\n elseif drawDeck.tag == \"Deck\" then\n deckSize = #drawDeck.getObjects()\n end\n\n if deckSize \u003e= numCards then\n drawCards(numCards)\n return\n end\n\n drawCards(deckSize)\n if discardPile ~= nil then\n shuffleDiscardIntoDeck()\n Wait.time(|| drawCards(numCards - deckSize), 1)\n end\n printToColor(\"Take 1 horror (drawing card from empty deck)\", messageColor)\nend\n\n-- get the draw deck and discard pile objects\nfunction getDrawDiscardDecks()\n drawDeck = nil\n discardPile = nil\n topCard = nil\n\n for _, object in ipairs(searchDeckAndDiscardArea(isCardOrDeck)) do\n if self.positionToLocal(object.getPosition()).z \u003e 0.5 then\n discardPile = object\n -- Norman Withers handling\n elseif string.match(activeInvestigatorId, \"%d%d%d%d%d\") == \"08004\" and not object.is_face_down then\n topCard = object\n else\n drawDeck = object\n end\n end\nend\n\nfunction drawCards(numCards)\n if drawDeck == nil then return end\n drawDeck.deal(numCards, playerColor)\nend\n\nfunction shuffleDiscardIntoDeck()\n if not discardPile.is_face_down then discardPile.flip() end\n discardPile.shuffle()\n discardPile.setPositionSmooth(self.positionToWorld(DRAW_DECK_POSITION), false, false)\n drawDeck = discardPile\n discardPile = nil\nend\n\n-- discard a random non-hidden card from hand\nfunction doDiscardOne()\n local hand = Player[playerColor].getHandObjects()\n if #hand == 0 then\n broadcastToAll(\"Cannot discard from empty hand!\", \"Red\")\n else\n local choices = {}\n for i = 1, #hand do\n local notes = JSON.decode(hand[i].getGMNotes())\n if notes ~= nil then\n if notes.hidden ~= true then\n table.insert(choices, i)\n end\n else\n table.insert(choices, i)\n end\n end\n\n if #choices == 0 then\n broadcastToAll(\"Hidden cards can't be randomly discarded.\", \"Orange\")\n return\n end\n\n -- get a random non-hidden card (from the \"choices\" table)\n local num = math.random(1, #choices)\n placeOrMergeIntoDeck(hand[choices[num]], returnGlobalDiscardPosition(), self.getRotation())\n broadcastToAll(playerColor .. \" randomly discarded card \" .. choices[num] .. \"/\" .. #hand .. \".\", \"White\")\n end\nend\n\n---------------------------------------------------------\n-- color related functions\n---------------------------------------------------------\n\n-- changes the player color\nfunction changeColor(clickedByColor)\n local colorList = {\n \"White\",\n \"Brown\",\n \"Red\",\n \"Orange\",\n \"Yellow\",\n \"Green\",\n \"Teal\",\n \"Blue\",\n \"Purple\",\n \"Pink\"\n }\n\n -- remove existing colors from the list of choices\n for _, existingColor in ipairs(Player.getAvailableColors()) do\n for i, newColor in ipairs(colorList) do\n if existingColor == newColor then\n table.remove(colorList, i)\n end\n end\n end\n\n -- show the option dialog for color selection to the player that triggered this\n Player[clickedByColor].showOptionsDialog(\"Select a new color:\", colorList, _, function(color)\n local HAND_ZONE_GUIDS = {\n \"a70eee\", -- White\n \"5fe087\", -- Orange\n \"0285cc\", -- Green\n \"be2f17\" -- Red\n }\n local index\n local startPos = self.getPosition()\n\n -- get respective hand zone by position\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n index = 1\n else\n index = 2\n end\n else\n if startPos.z \u003e 0 then\n index = 3\n else\n index = 4\n end\n end\n\n -- update the color of the hand zone\n local handZone = getObjectFromGUID(HAND_ZONE_GUIDS[index])\n handZone.setValue(color)\n\n -- if the seated player clicked this, reseat him to the new color\n if clickedByColor == playerColor then\n navigationOverlayApi.copyVisibility(playerColor, color)\n Player[playerColor].changeColor(color)\n end\n\n -- update the internal variable\n playerColor = color\n end)\nend\n\n---------------------------------------------------------\n-- playmat token spawning\n---------------------------------------------------------\n\n-- Finds all customizable cards in this play area and updates their metadata based on the selections\n-- on the matching upgrade sheet.\n-- This method is theoretically O(n^2), and should be used sparingly. In practice it will only be\n-- called when a checkbox is added or removed in-game (which should be rare), and is bounded by the\n-- number of customizable cards in play.\nfunction syncAllCustomizableCards()\n for _, card in ipairs(searchAroundSelf(isCard)) do\n syncCustomizableMetadata(card)\n end\nend\n\nfunction syncCustomizableMetadata(card)\n local cardMetadata = JSON.decode(card.getGMNotes()) or { }\n if cardMetadata == nil or cardMetadata.customizations == nil then\n return\n end\n for _, upgradeSheet in ipairs(searchAroundSelf(isCard)) do\n local upgradeSheetMetadata = JSON.decode(upgradeSheet.getGMNotes()) or { }\n if upgradeSheetMetadata.id == (cardMetadata.id .. \"-c\") then\n for i, customization in ipairs(cardMetadata.customizations) do\n if customization.replaces ~= nil and customization.replaces.uses ~= nil then\n -- Allowed use of call(), no APIs for individual cards\n if upgradeSheet.call(\"isUpgradeActive\", i) then\n cardMetadata.uses = customization.replaces.uses\n card.setGMNotes(JSON.encode(cardMetadata))\n else\n -- TODO: Get the original metadata to restore it... maybe. This should only be\n -- necessary in the very unlikely case that a user un-checks a previously-full upgrade\n -- row while the card is in play. It will be much easier once the AllPlayerCardsApi is\n -- in place, so defer until it is\n end\n end\n end\n end\n end\nend\n\nfunction spawnTokensFor(object)\n local extraUses = { }\n if activeInvestigatorId == \"03004\" then\n extraUses[\"Charge\"] = 1\n end\n\n tokenManager.spawnForCard(object, extraUses)\nend\n\nfunction onCollisionEnter(collision_info)\n local object = collision_info.collision_object\n\n -- detect if \"Dream-Enhancing Serum\" is placed\n if object.getName() == \"Dream-Enhancing Serum\" then isDES = true end\n\n -- only continue if loading is completed\n if not collisionEnabled then return end\n\n -- only continue for cards\n if object.type ~= \"Card\" then return end\n\n maybeUpdateActiveInvestigator(object)\n syncCustomizableMetadata(object)\n\n local localCardPos = self.positionToLocal(object.getPosition())\n if inArea(localCardPos, DECK_DISCARD_AREA) then\n tokenManager.resetTokensSpawned(object)\n removeTokensFromObject(object)\n elseif shouldSpawnTokens(object) then\n spawnTokensFor(object)\n end\nend\n\n-- detect if \"Dream-Enhancing Serum\" is removed\nfunction onCollisionExit(collision_info)\n if collision_info.collision_object.getName() == \"Dream-Enhancing Serum\" then isDES = false end\nend\n\n-- checks if tokens should be spawned for the provided card\nfunction shouldSpawnTokens(card)\n if card.is_face_down then\n return false\n end\n\n local localCardPos = self.positionToLocal(card.getPosition())\n local metadata = JSON.decode(card.getGMNotes())\n\n -- If no metadata we don't know the type, so only spawn in the main area\n if metadata == nil then\n return inArea(localCardPos, MAIN_PLAY_AREA)\n end\n\n -- Spawn tokens for assets and events on the main area\n if inArea(localCardPos, MAIN_PLAY_AREA)\n and (metadata.type == \"Asset\"\n or metadata.type == \"Event\") then\n return true\n end\n\n -- Spawn tokens for all encounter types in the threat area\n if inArea(localCardPos, THREAT_AREA)\n and (metadata.type == \"Treachery\"\n or metadata.type == \"Enemy\"\n or metadata.weakness) then\n return true\n end\n\n return false\nend\n\nfunction onObjectEnterContainer(container, object)\n Wait.frames(function() resetTokensIfInDeckZone(container, object) end, 1)\nend\n\nfunction resetTokensIfInDeckZone(container, object)\n local pos = self.positionToLocal(container.getPosition())\n if inArea(pos, DECK_DISCARD_AREA) then\n tokenManager.resetTokensSpawned(object)\n removeTokensFromObject(container)\n end\nend\n\n-- removes tokens from the provided card/deck\nfunction removeTokensFromObject(object)\n for _, obj in ipairs(searchArea(object.getPosition(), { 3, 1, 4 })) do\n if obj.getGUID() ~= \"4ee1f2\" and -- table\n obj ~= self and\n obj.type ~= \"Deck\" and\n obj.type ~= \"Card\" and\n obj.memo ~= nil and\n obj.getLock() == false and\n obj.getDescription() ~= \"Action Token\" and\n not tokenChecker.isChaosToken(obj) then\n TRASHCAN.putObject(obj)\n end\n end\nend\n\n---------------------------------------------------------\n-- investigator ID grabbing and skill tracker\n---------------------------------------------------------\n\nfunction maybeUpdateActiveInvestigator(card)\n if not inArea(self.positionToLocal(card.getPosition()), INVESTIGATOR_AREA) then return end\n\n local notes = JSON.decode(card.getGMNotes())\n local class\n\n if notes ~= nil and notes.type == \"Investigator\" and notes.id ~= nil then\n if notes.id == activeInvestigatorId then return end\n class = notes.class\n activeInvestigatorId = notes.id\n STAT_TRACKER.call(\"updateStats\", {notes.willpowerIcons, notes.intellectIcons, notes.combatIcons, notes.agilityIcons})\n elseif activeInvestigatorId ~= \"00000\" then\n class = \"Neutral\"\n activeInvestigatorId = \"00000\"\n STAT_TRACKER.call(\"updateStats\", {1, 1, 1, 1})\n else\n return\n end\n\n -- change state of action tokens\n local search = searchArea(self.positionToWorld({-1.1, 0.05, -0.27}), {4, 1, 1})\n local smallToken = nil\n local STATE_TABLE = {\n [\"Guardian\"] = 1,\n [\"Seeker\"] = 2,\n [\"Rogue\"] = 3,\n [\"Mystic\"] = 4,\n [\"Survivor\"] = 5,\n [\"Neutral\"] = 6\n }\n\n for _, obj in ipairs(search) do\n if obj.getDescription() == \"Action Token\" and obj.getStateId() \u003e 0 then\n if obj.getScale().x \u003c 0.4 then\n smallToken = obj\n else\n setObjectState(obj, STATE_TABLE[class])\n end\n end\n end\n\n -- update the small token with special action for certain investigators\n local SPECIAL_ACTIONS = {\n [\"04002\"] = 8, -- Ursula Downs\n [\"01002\"] = 9, -- Daisy Walker\n [\"01502\"] = 9, -- Daisy Walker\n [\"01002-pb\"] = 9, -- Daisy Walker\n [\"06003\"] = 10, -- Tony Morgan\n [\"04003\"] = 11, -- Finn Edwards\n [\"08016\"] = 14 -- Bob Jenkins\n }\n\n if smallToken ~= nil then\n setObjectState(smallToken, SPECIAL_ACTIONS[activeInvestigatorId] or STATE_TABLE[class])\n end\nend\n\nfunction setObjectState(obj, stateId)\n if obj.getStateId() ~= stateId then obj.setState(stateId) end\nend\n\n---------------------------------------------------------\n-- calls to 'Global' / functions for calls from outside\n---------------------------------------------------------\n\nfunction drawChaosTokenButton(_, _, isRightClick)\n chaosBagApi.drawChaosToken(self, DRAWN_CHAOS_TOKEN_OFFSET, isRightClick)\nend\n\nfunction drawEncounterCard(_, _, isRightClick)\n local pos = self.positionToWorld(DRAWN_ENCOUNTER_CARD_OFFSET)\n local rotY = self.getRotation().y\n mythosAreaApi.drawEncounterCard(pos, rotY, isRightClick)\nend\n\nfunction returnGlobalDiscardPosition()\n return self.positionToWorld(DISCARD_PILE_POSITION)\nend\n\n-- Sets this playermat's draw 1 button to visible\n---@param visible Boolean. Whether the draw 1 button should be visible\nfunction showDrawButton(visible)\n isDrawButtonVisible = visible\n\n -- create the \"Draw 1\" button\n if isDrawButtonVisible then\n self.createButton({\n label = \"Draw 1\",\n click_function = \"doDrawOne\",\n function_owner = self,\n position = { 1.84, 0.1, -0.36 },\n scale = { 0.12, 0.12, 0.12 },\n width = 800,\n height = 280,\n font_size = 180\n })\n\n -- remove the \"Draw 1\" button\n else\n local buttons = self.getButtons()\n for i = 1, #buttons do\n if buttons[i].label == \"Draw 1\" then\n self.removeButton(buttons[i].index)\n end\n end\n end\nend\n\n-- Spawns / destroys a clickable clue counter for this playmat with the correct amount of clues\n---@param showCounter Boolean Whether the clickable clue counter should be present\nfunction clickableClues(showCounter)\n local CLUE_COUNTER = getObjectFromGUID(CLUE_COUNTER_GUID)\n local CLUE_CLICKER = getObjectFromGUID(CLUE_CLICKER_GUID)\n local clickerPos = CLUE_CLICKER.getPosition()\n local clueCount = 0\n\n if showCounter then\n -- current clue count\n clueCount = CLUE_COUNTER.getVar(\"exposedValue\")\n\n -- remove clues\n CLUE_COUNTER.call(\"removeAllClues\")\n\n -- set value for clue clickers\n CLUE_CLICKER.call(\"updateVal\", clueCount)\n\n -- move clue counters up\n clickerPos.y = 1.52\n CLUE_CLICKER.setPosition(clickerPos)\n else\n -- current clue count\n clueCount = CLUE_CLICKER.getVar(\"val\")\n\n -- move clue counters down\n clickerPos.y = 1.3\n CLUE_CLICKER.setPosition(clickerPos)\n\n -- spawn clues\n local pos = self.positionToWorld({x = -1.12, y = 0.05, z = 0.7})\n for i = 1, clueCount do\n pos.y = pos.y + 0.045 * i\n tokenManager.spawnToken(pos, \"clue\", self.getRotation())\n end\n end\nend\n\n-- removes all clues (moving tokens to the trash and setting counters to 0)\nfunction removeClues()\n local CLUE_COUNTER = getObjectFromGUID(CLUE_COUNTER_GUID)\n local CLUE_CLICKER = getObjectFromGUID(CLUE_CLICKER_GUID)\n\n CLUE_COUNTER.call(\"removeAllClues\")\n CLUE_CLICKER.call(\"updateVal\", 0)\nend\n\n-- reports the clue count\n---@param useClickableCounters Boolean Controls which type of counter is getting checked\nfunction getClueCount(useClickableCounters)\n local count = 0\n\n if useClickableCounters then\n local CLUE_CLICKER = getObjectFromGUID(CLUE_CLICKER_GUID)\n count = tonumber(CLUE_CLICKER.getVar(\"val\"))\n else\n local CLUE_COUNTER = getObjectFromGUID(CLUE_COUNTER_GUID)\n count = tonumber(CLUE_COUNTER.getVar(\"exposedValue\"))\n end\n return count\nend\n\n-- Sets this playermat's snap points to limit snapping to matching card types or not. If matchTypes\n-- is true, the main card slot snap points will only snap assets, while the investigator area point\n-- will only snap Investigators. If matchTypes is false, snap points will be reset to snap all\n-- cards.\n---@param matchTypes Boolean. Whether snap points should only snap for the matching card types.\nfunction setLimitSnapsByType(matchTypes)\n local snaps = self.getSnapPoints()\n for i, snap in ipairs(snaps) do\n local snapPos = snap.position\n if inArea(snapPos, MAIN_PLAY_AREA) then\n local snapTags = snaps[i].tags\n if matchTypes then\n if snapTags == nil then\n snaps[i].tags = { \"Asset\" }\n else\n table.insert(snaps[i].tags, \"Asset\")\n end\n else\n snaps[i].tags = nil\n end\n end\n if inArea(snapPos, INVESTIGATOR_AREA) then\n local snapTags = snaps[i].tags\n if matchTypes then\n if snapTags == nil then\n snaps[i].tags = { \"Investigator\" }\n else\n table.insert(snaps[i].tags, \"Investigator\")\n end\n else\n snaps[i].tags = nil\n end\n end\n end\n self.setSnapPoints(snaps)\nend\n\n-- Simple method to check if the given point is in a specified area. Local use only,\n---@param point Vector Point to check, only x and z values are relevant\n---@param bounds Table Defined area to see if the point is within. See MAIN_PLAY_AREA for sample\n-- bounds definition.\n---@return Boolean True if the point is in the area defined by bounds\nfunction inArea(point, bounds)\n return (point.x \u003c bounds.upperLeft.x\n and point.x \u003e bounds.lowerRight.x\n and point.z \u003c bounds.upperLeft.z\n and point.z \u003e bounds.lowerRight.z)\nend\n\n-- called by custom data helpers to add player card data\n---@param args table Contains only one entry, the GUID of the custom data helper\nfunction updatePlayerCards(args)\n local customDataHelper = getObjectFromGUID(args[1])\n local playerCardData = customDataHelper.getTable(\"PLAYER_CARD_DATA\")\n tokenManager.addPlayerCardData(playerCardData)\nend\n\n-- utility function for rounding\n---@param num Number Initial value\n---@param numDecimalPlaces Number Amount of decimal places\nfunction round(num, numDecimalPlaces)\n local mult = 10^(numDecimalPlaces or 0)\n return math.floor(num * mult + 0.5) / mult\nend\nend)\n__bundle_register(\"core/MythosAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local MythosAreaApi = {}\n local MYTHOS_AREA_GUID = \"9f334f\"\n\n -- returns the chaos token metadata (if provided through scenario reference card)\n MythosAreaApi.returnTokenData = function()\n return getObjectFromGUID(MYTHOS_AREA_GUID).call(\"returnTokenData\")\n end\n\n -- draw an encounter card to the requested position/rotation\n MythosAreaApi.drawEncounterCard = function(pos, rotY, alwaysFaceUp)\n getObjectFromGUID(MYTHOS_AREA_GUID).call(\"drawEncounterCard\", {\n pos = pos,\n rotY = rotY,\n alwaysFaceUp = alwaysFaceUp\n })\n end\n\n return MythosAreaApi\nend\nend)\n__bundle_register(\"core/token/TokenChecker\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local CHAOS_TOKEN_NAMES = {\n [\"Elder Sign\"] = true,\n [\"+1\"] = true,\n [\"0\"] = true,\n [\"-1\"] = true,\n [\"-2\"] = true,\n [\"-3\"] = true,\n [\"-4\"] = true,\n [\"-5\"] = true,\n [\"-6\"] = true,\n [\"-7\"] = true,\n [\"-8\"] = true,\n [\"Skull\"] = true,\n [\"Cultist\"] = true,\n [\"Tablet\"] = true,\n [\"Elder Thing\"] = true,\n [\"Auto-fail\"] = true,\n [\"Bless\"] = true,\n [\"Curse\"] = true,\n [\"Frost\"] = true\n }\n\n local TokenChecker = {}\n\n -- returns true if the passed object is a chaos token (by name)\n TokenChecker.isChaosToken = function(obj)\n if CHAOS_TOKEN_NAMES[obj.getName()] then\n return true\n else\n return false\n end\n end\n\n return TokenChecker\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playermat/Playmat\")\nend)\n__bundle_register(\"playermat/Playmat\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal guidReferenceApi = require(\"core/GUIDReferenceApi\")\nlocal mythosAreaApi = require(\"core/MythosAreaApi\")\nlocal navigationOverlayApi = require(\"core/NavigationOverlayApi\")\nlocal tokenChecker = require(\"core/token/TokenChecker\")\nlocal tokenManager = require(\"core/token/TokenManager\")\n\n-- set true to enable debug logging and show Physics.cast()\nlocal DEBUG = false\n\n-- we use this to turn off collision handling until onLoad() is complete\nlocal collisionEnabled = false\n\n-- position offsets relative to mat [x, y, z]\nlocal DRAWN_ENCOUNTER_CARD_OFFSET = {1.365, 0.5, -0.625}\nlocal DRAWN_CHAOS_TOKEN_OFFSET = {-1.55, 0.25, -0.58}\n\n-- x-Values for discard buttons\nlocal DISCARD_BUTTON_OFFSETS = {-1.365, -0.91, -0.455, 0, 0.455, 0.91}\n\nlocal SEARCH_AROUND_SELF_X_BUFFER = 8\n\n-- defined areas for \"inArea()\" and \"Physics.cast()\"\nlocal MAIN_PLAY_AREA = {\n upperLeft = {\n x = 1.98,\n z = 0.736\n },\n lowerRight = {\n x = -0.79,\n z = -0.39\n }\n}\nlocal INVESTIGATOR_AREA = {\n upperLeft = {\n x = -1.084,\n z = 0.06517\n },\n lowerRight = {\n x = -1.258,\n z = -0.0805\n }\n}\nlocal THREAT_AREA = {\n upperLeft = {\n x = 1.53,\n z = -0.34\n },\n lowerRight = {\n x = -1.13,\n z = -0.92\n }\n}\nlocal DECK_DISCARD_AREA = {\n upperLeft = {\n x = -1.62,\n z = 0.855\n },\n lowerRight = {\n x = -2.02,\n z = -0.245\n },\n center = {\n x = -1.82,\n y = 0.5,\n z = 0.305\n },\n size = {\n x = 0.4,\n y = 3,\n z = 1.1\n }\n}\n\n-- local position of draw and discard pile\nlocal DRAW_DECK_POSITION = { x = -1.82, y = 0.1, z = 0 }\nlocal DISCARD_PILE_POSITION = { x = -1.82, y = 0.1, z = 0.61 }\n\n-- global position of encounter discard pile\nlocal ENCOUNTER_DISCARD_POSITION = { x = -3.85, y = 1.5, z = 10.38}\n\n-- global variable so it can be reset by the Clean Up Helper\nactiveInvestigatorId = \"00000\"\n\n-- table of type-object reference pairs of all owned objects\nlocal ownedObjects = {}\nlocal matColor = self.getMemo()\n\n-- variable to track the status of the \"Show Draw Button\" option\nlocal isDrawButtonVisible = false\n\n-- global variable to report \"Dream-Enhancing Serum\" status\nisDES = false\n\nfunction onSave()\n return JSON.encode({\n playerColor = playerColor,\n activeInvestigatorId = activeInvestigatorId,\n isDrawButtonVisible = isDrawButtonVisible\n })\nend\n\nfunction onLoad(saveState)\n self.interactable = DEBUG\n\n -- get object references to owned objects\n ownedObjects = guidReferenceApi.getObjectsByOwner(matColor)\n\n -- button creation\n for i = 1, 6 do\n makeDiscardButton(DISCARD_BUTTON_OFFSETS[i], i)\n end\n\n self.createButton({\n click_function = \"drawEncounterCard\",\n function_owner = self,\n position = {-1.84, 0, -0.65},\n rotation = {0, 80, 0},\n width = 265,\n height = 190\n })\n\n self.createButton({\n click_function = \"drawChaosTokenButton\",\n function_owner = self,\n position = {1.85, 0, -0.74},\n rotation = {0, -45, 0},\n width = 135,\n height = 135\n })\n\n self.createButton({\n label = \"Upkeep\",\n click_function = \"doUpkeep\",\n function_owner = self,\n position = {1.84, 0.1, -0.44},\n scale = {0.12, 0.12, 0.12},\n width = 800,\n height = 280,\n font_size = 180\n })\n\n -- save state loading\n local state = JSON.decode(saveState)\n if state ~= nil then\n playerColor = state.playerColor\n activeInvestigatorId = state.activeInvestigatorId\n isDrawButtonVisible = state.isDrawButtonVisible\n end\n\n showDrawButton(isDrawButtonVisible)\n collisionEnabled = true\n math.randomseed(os.time())\nend\n\n---------------------------------------------------------\n-- utility functions\n---------------------------------------------------------\n\n-- searches an area and optionally filters the result\nfunction searchArea(origin, size, filter)\n local searchResult = Physics.cast({\n origin = origin,\n direction = { 0, 1, 0 },\n orientation = self.getRotation(),\n type = 3,\n size = size,\n max_distance = 0\n })\n\n local objList = {}\n for _, v in ipairs(searchResult) do\n if not filter or (filter and filter(v.hit_object)) then\n table.insert(objList, v.hit_object)\n end\n end\n return objList\nend\n\n-- filter functions for searchArea()\nfunction isCard(x) return x.type == 'Card' end\nfunction isDeck(x) return x.type == 'Deck' end\nfunction isCardOrDeck(x) return x.type == 'Card' or x.type == 'Deck' end\n\n-- finds all objects on the playmat and associated set aside zone.\nfunction searchAroundSelf(filter)\n local bounds = self.getBoundsNormalized()\n -- Increase the width to cover the set aside zone\n bounds.size.x = bounds.size.x + SEARCH_AROUND_SELF_X_BUFFER\n bounds.size.y = 1\n -- Since the cast is centered on the position, shift left or right to keep the non-set aside edge\n -- of the cast at the edge of the playmat\n -- setAsideDirection accounts for the set aside zone being on the left or right, depending on the\n -- table position of the playmat\n local setAsideDirection = bounds.center.z \u003e 0 and 1 or -1\n local localCenter = self.positionToLocal(bounds.center)\n localCenter.x = localCenter.x + setAsideDirection * SEARCH_AROUND_SELF_X_BUFFER / 2 / self.getScale().x\n return searchArea(self.positionToWorld(localCenter), bounds.size, filter)\nend\n\n-- searches the area around the draw deck and discard pile\nfunction searchDeckAndDiscardArea(filter)\n local pos = self.positionToWorld(DECK_DISCARD_AREA.center)\n local scale = self.getScale()\n local size = {\n x = DECK_DISCARD_AREA.size.x * scale.x,\n y = DECK_DISCARD_AREA.size.y, \n z = DECK_DISCARD_AREA.size.z * scale.z\n }\n return searchArea(pos, size, filter)\nend\n\nfunction doNotReady(card)\n return card.getVar(\"do_not_ready\") or false\nend\n\n-- rounds a number to the specified amount of decimal places\n---@param num Number Initial value\n---@param numDecimalPlaces Number Amount of decimal places\nfunction round(num, numDecimalPlaces)\n local mult = 10^(numDecimalPlaces or 0)\n return math.floor(num * mult + 0.5) / mult\nend\n\n---------------------------------------------------------\n-- Discard buttons\n---------------------------------------------------------\n\n-- handles discarding for a list of objects\n---@param objList Table List of objects to discard\nfunction discardListOfObjects(objList)\n for _, obj in ipairs(objList) do\n if isCardOrDeck(obj) then\n if obj.hasTag(\"PlayerCard\") then\n placeOrMergeIntoDeck(obj, returnGlobalDiscardPosition(), self.getRotation())\n else\n placeOrMergeIntoDeck(obj, ENCOUNTER_DISCARD_POSITION, {x = 0, y = -90, z = 0})\n end\n -- put chaos tokens back into bag (e.g. Unrelenting)\n elseif tokenChecker.isChaosToken(obj) then\n local chaosBag = chaosBagApi.findChaosBag()\n chaosBag.putObject(obj)\n -- don't touch locked objects (like the table etc.)\n elseif not obj.getLock() then\n ownedObjects.Trash.putObject(obj)\n end\n end\nend\n\n-- places a card/deck at a position or merges into an existing deck\n-- rotation is optional\nfunction placeOrMergeIntoDeck(obj, pos, rot)\n if not pos then return end\n\n local offset = 0.5\n \n -- search the new position for existing card/deck\n local searchResult = searchArea(pos, { 1, 1, 1 }, isCardOrDeck)\n\n -- get new position\n local newPos\n if #searchResult == 1 then\n local bounds = searchResult[1].getBounds()\n newPos = Vector(pos):setAt(\"y\", bounds.center.y + bounds.size.y / 2 + offset)\n else\n newPos = Vector(pos) + Vector(0, offset, 0)\n end\n\n -- allow moving the objects smoothly out of the hand\n obj.use_hands = false\n\n if rot then\n obj.setRotationSmooth(rot, false, true)\n end\n obj.setPositionSmooth(newPos, false, true)\n\n -- continue if the card stops smooth moving\n Wait.condition(\n function()\n obj.use_hands = true\n -- this avoids a TTS bug that merges unrelated cards that are not resting\n if #searchResult == 1 and searchResult[1] ~= obj then\n -- call this with avoiding errors (physics is sometimes too fast so the object doesn't exist for the put)\n pcall(function() searchResult[1].putObject(obj) end)\n end\n end,\n function() return not obj.isSmoothMoving() end, 3)\nend\n\n-- build a discard button to discard from searchPosition (number must be unique)\nfunction makeDiscardButton(xValue, number)\n local position = { xValue, 0.1, -0.94}\n local searchPosition = {-position[1], position[2], position[3] + 0.32}\n local handlerName = 'handler' .. number\n self.setVar(handlerName, function()\n local cardSizeSearch = {2, 1, 3.2}\n local globalSearchPosition = self.positionToWorld(searchPosition)\n local searchResult = searchArea(globalSearchPosition, cardSizeSearch)\n return discardListOfObjects(searchResult)\n end)\n self.createButton({\n label = \"Discard\",\n click_function = handlerName,\n function_owner = self,\n position = position,\n scale = {0.12, 0.12, 0.12},\n width = 900,\n height = 350,\n font_size = 220\n })\nend\n\n---------------------------------------------------------\n-- Upkeep button\n---------------------------------------------------------\n\n-- calls the Upkeep function with correct parameter\nfunction doUpkeepFromHotkey(color)\n doUpkeep(_, color)\nend\n\nfunction doUpkeep(_, clickedByColor, isRightClick)\n -- right-click allow color changing\n if isRightClick then\n changeColor(clickedByColor)\n return\n end\n\n -- send messages to player who clicked button if no seated player found\n messageColor = Player[playerColor].seated and playerColor or clickedByColor\n\n -- unexhaust cards in play zone, flip action tokens and find forcedLearning\n local forcedLearning = false\n local rot = self.getRotation()\n for _, obj in ipairs(searchAroundSelf()) do\n if obj.getDescription() == \"Action Token\" and obj.is_face_down then\n obj.flip()\n elseif obj.type == \"Card\" and not inArea(self.positionToLocal(obj.getPosition()), INVESTIGATOR_AREA) then\n local cardMetadata = JSON.decode(obj.getGMNotes()) or {}\n if not doNotReady(obj) then\n local cardRotation = round(obj.getRotation().y, 0) - rot.y\n local yRotDiff = 0\n\n if cardRotation \u003c 0 then\n cardRotation = cardRotation + 360\n end\n\n -- rotate cards to the next multiple of 90° towards 0°\n if cardRotation \u003e 90 and cardRotation \u003c= 180 then\n yRotDiff = 90\n elseif cardRotation \u003c 270 and cardRotation \u003e 180 then\n yRotDiff = 270\n end\n\n -- set correct rotation for face-down cards\n rot.z = obj.is_face_down and 180 or 0\n obj.setRotation({rot.x, rot.y + yRotDiff, rot.z})\n end\n if cardMetadata.id == \"08031\" then\n forcedLearning = true\n end\n if cardMetadata.uses ~= nil then\n tokenManager.maybeReplenishCard(obj, cardMetadata.uses, self)\n end\n end\n end\n\n -- flip investigator mini-card and summoned servitor mini-card\n -- (all characters allowed to account for custom IDs - e.g. 'Z0000' for TTS Zoop generated IDs)\n if activeInvestigatorId ~= nil then\n local miniId = string.match(activeInvestigatorId, \".....\") .. \"-m\"\n for _, obj in ipairs(getObjects()) do\n if obj.type == \"Card\" and obj.is_face_down then\n local notes = JSON.decode(obj.getGMNotes())\n if notes ~= nil and notes.type == \"Minicard\" and (notes.id == miniId or notes.id == \"09080-m\") then\n obj.flip()\n end\n end\n end\n end\n\n -- gain a resource (or two if playing Jenny Barnes)\n if string.match(activeInvestigatorId, \"%d%d%d%d%d\") == \"02003\" then\n updateCounter({type = \"ResourceCounter\", modifier = 2})\n printToColor(\"Gaining 2 resources (Jenny)\", messageColor)\n else\n updateCounter({type = \"ResourceCounter\", modifier = 1})\n end\n\n -- draw a card (with handling for Patrice and Forced Learning)\n if activeInvestigatorId == \"06005\" then\n if forcedLearning then\n printToColor(\"Wow, did you really take 'Versatile' to play Patrice with 'Forced Learning'? Choose which draw replacement effect takes priority and draw cards accordingly.\", messageColor)\n else\n local handSize = #Player[playerColor].getHandObjects()\n if handSize \u003c 5 then\n local cardsToDraw = 5 - handSize\n printToColor(\"Drawing \" .. cardsToDraw .. \" cards (Patrice)\", messageColor)\n drawCardsWithReshuffle(cardsToDraw)\n end\n end\n elseif forcedLearning then\n printToColor(\"Drawing 2 cards, discard 1 (Forced Learning)\", messageColor)\n drawCardsWithReshuffle(2)\n elseif activeInvestigatorId == \"89001\" then\n printToColor(\"Drawing 2 cards (Subject 5U-21)\", messageColor)\n drawCardsWithReshuffle(2)\n else\n drawCardsWithReshuffle(1)\n end\nend\n\n-- function for \"draw 1 button\" (that can be added via option panel)\nfunction doDrawOne(_, color)\n -- send messages to player who clicked button if no seated player found\n messageColor = Player[playerColor].seated and playerColor or color\n drawCardsWithReshuffle(1)\nend\n\n-- draw X cards (shuffle discards if necessary)\nfunction drawCardsWithReshuffle(numCards)\n local deckAreaObjects = getDeckAreaObjects()\n\n -- Norman Withers handling\n local harbinger = false\n if deckAreaObjects.topCard and deckAreaObjects.topCard.getName() == \"The Harbinger\" then\n harbinger = true\n elseif deckAreaObjects.draw and not deckAreaObjects.draw.is_face_down then\n local cards = deckAreaObjects.draw.getObjects()\n if cards[#cards].name == \"The Harbinger\" then\n harbinger = true\n end\n end\n\n if harbinger then\n printToColor(\"The Harbinger is on top of your deck, not drawing cards\", messageColor)\n return\n end\n\n local topCardDetected = false\n if deckAreaObjects.topCard ~= nil then\n deckAreaObjects.topCard.deal(1, playerColor)\n topCardDetected = true\n numCards = numCards - 1\n if numCards == 0 then\n flipTopCardFromDeck()\n return\n end\n end\n\n local deckSize = 1\n if deckAreaObjects.draw == nil then\n deckSize = 0\n elseif deckAreaObjects.draw.type == \"Deck\" then\n deckSize = #deckAreaObjects.draw.getObjects()\n end\n\n if deckSize \u003e= numCards then\n drawCards(numCards)\n -- flip top card again for Norman\n if topCardDetected and string.match(activeInvestigatorId, \"%d%d%d%d%d\") == \"08004\" then\n flipTopCardFromDeck()\n end\n else\n drawCards(deckSize)\n if deckAreaObjects.discard ~= nil then\n shuffleDiscardIntoDeck()\n Wait.time(function()\n drawCards(numCards - deckSize)\n -- flip top card again for Norman\n if topCardDetected and string.match(activeInvestigatorId, \"%d%d%d%d%d\") == \"08004\" then\n flipTopCardFromDeck()\n end\n end, 1)\n end\n printToColor(\"Take 1 horror (drawing card from empty deck)\", messageColor)\n end\nend\n\n-- get the draw deck and discard pile objects and returns the references\nfunction getDeckAreaObjects()\n local deckAreaObjects = {}\n for _, object in ipairs(searchDeckAndDiscardArea(isCardOrDeck)) do\n if self.positionToLocal(object.getPosition()).z \u003e 0.5 then\n deckAreaObjects.discard = object\n -- Norman Withers handling\n elseif object.type == \"Card\" and not object.is_face_down then\n deckAreaObjects.topCard = object\n else\n deckAreaObjects.draw = object\n end\n end\n return deckAreaObjects\nend\n\nfunction drawCards(numCards)\n local deckAreaObjects = getDeckAreaObjects()\n if deckAreaObjects.draw then\n deckAreaObjects.draw.deal(numCards, playerColor)\n end\nend\n\nfunction shuffleDiscardIntoDeck()\n local deckAreaObjects = getDeckAreaObjects()\n if not deckAreaObjects.discard.is_face_down then\n deckAreaObjects.discard.flip()\n end\n deckAreaObjects.discard.shuffle()\n deckAreaObjects.discard.setPositionSmooth(self.positionToWorld(DRAW_DECK_POSITION), false, false)\nend\n\n-- utility function for Norman Withers to flip the top card to the revealed side\nfunction flipTopCardFromDeck()\n Wait.time(function()\n local deckAreaObjects = getDeckAreaObjects()\n if deckAreaObjects.topCard then\n return\n elseif deckAreaObjects.draw then\n if deckAreaObjects.draw.type == \"Card\" then\n deckAreaObjects.draw.flip()\n else\n -- get bounds to know the height of the deck\n local bounds = deckAreaObjects.draw.getBounds()\n local pos = bounds.center + Vector(0, bounds.size.y / 2 + 0.2, 0)\n deckAreaObjects.draw.takeObject({ position = pos, flip = true })\n end\n end\n end, 0.1)\nend\n\n-- discard a random non-hidden card from hand\nfunction doDiscardOne()\n local hand = Player[playerColor].getHandObjects()\n if #hand == 0 then\n broadcastToAll(\"Cannot discard from empty hand!\", \"Red\")\n else\n local choices = {}\n for i = 1, #hand do\n local notes = JSON.decode(hand[i].getGMNotes())\n if notes ~= nil then\n if notes.hidden ~= true then\n table.insert(choices, i)\n end\n else\n table.insert(choices, i)\n end\n end\n\n if #choices == 0 then\n broadcastToAll(\"Hidden cards can't be randomly discarded.\", \"Orange\")\n return\n end\n\n -- get a random non-hidden card (from the \"choices\" table)\n local num = math.random(1, #choices)\n placeOrMergeIntoDeck(hand[choices[num]], returnGlobalDiscardPosition(), self.getRotation())\n broadcastToAll(playerColor .. \" randomly discarded card \" .. choices[num] .. \"/\" .. #hand .. \".\", \"White\")\n end\nend\n\n---------------------------------------------------------\n-- color related functions\n---------------------------------------------------------\n\n-- changes the player color\nfunction changeColor(clickedByColor)\n local colorList = {\n \"White\",\n \"Brown\",\n \"Red\",\n \"Orange\",\n \"Yellow\",\n \"Green\",\n \"Teal\",\n \"Blue\",\n \"Purple\",\n \"Pink\"\n }\n\n -- remove existing colors from the list of choices\n for _, existingColor in ipairs(Player.getAvailableColors()) do\n for i, newColor in ipairs(colorList) do\n if existingColor == newColor then\n table.remove(colorList, i)\n end\n end\n end\n\n -- show the option dialog for color selection to the player that triggered this\n Player[clickedByColor].showOptionsDialog(\"Select a new color:\", colorList, _, function(color)\n -- update the color of the hand zone\n local handZone = ownedObjects.HandZone\n handZone.setValue(color)\n\n -- if the seated player clicked this, reseat him to the new color\n if clickedByColor == playerColor then\n navigationOverlayApi.copyVisibility(playerColor, color)\n Player[playerColor].changeColor(color)\n end\n\n -- update the internal variable\n playerColor = color\n end)\nend\n\n---------------------------------------------------------\n-- playmat token spawning\n---------------------------------------------------------\n\n-- Finds all customizable cards in this play area and updates their metadata based on the selections\n-- on the matching upgrade sheet.\n-- This method is theoretically O(n^2), and should be used sparingly. In practice it will only be\n-- called when a checkbox is added or removed in-game (which should be rare), and is bounded by the\n-- number of customizable cards in play.\nfunction syncAllCustomizableCards()\n for _, card in ipairs(searchAroundSelf(isCard)) do\n syncCustomizableMetadata(card)\n end\nend\n\nfunction syncCustomizableMetadata(card)\n local cardMetadata = JSON.decode(card.getGMNotes()) or { }\n if cardMetadata == nil or cardMetadata.customizations == nil then\n return\n end\n for _, upgradeSheet in ipairs(searchAroundSelf(isCard)) do\n local upgradeSheetMetadata = JSON.decode(upgradeSheet.getGMNotes()) or { }\n if upgradeSheetMetadata.id == (cardMetadata.id .. \"-c\") then\n for i, customization in ipairs(cardMetadata.customizations) do\n if customization.replaces ~= nil and customization.replaces.uses ~= nil then\n -- Allowed use of call(), no APIs for individual cards\n if upgradeSheet.call(\"isUpgradeActive\", i) then\n cardMetadata.uses = customization.replaces.uses\n card.setGMNotes(JSON.encode(cardMetadata))\n else\n -- TODO: Get the original metadata to restore it... maybe. This should only be\n -- necessary in the very unlikely case that a user un-checks a previously-full upgrade\n -- row while the card is in play. It will be much easier once the AllPlayerCardsApi is\n -- in place, so defer until it is\n end\n end\n end\n end\n end\nend\n\nfunction spawnTokensFor(object)\n local extraUses = { }\n if activeInvestigatorId == \"03004\" then\n extraUses[\"Charge\"] = 1\n end\n\n tokenManager.spawnForCard(object, extraUses)\nend\n\nfunction onCollisionEnter(collisionInfo)\n local object = collisionInfo.collision_object\n\n -- only continue if loading is completed\n if not collisionEnabled then return end\n\n -- only continue for cards\n if not isCard(object) then return end\n\n -- detect if \"Dream-Enhancing Serum\" is placed\n if object.getName() == \"Dream-Enhancing Serum\" then isDES = true end\n\n maybeUpdateActiveInvestigator(object)\n syncCustomizableMetadata(object)\n\n local localCardPos = self.positionToLocal(object.getPosition())\n if inArea(localCardPos, DECK_DISCARD_AREA) then\n tokenManager.resetTokensSpawned(object)\n removeTokensFromObject(object)\n elseif shouldSpawnTokens(object) then\n spawnTokensFor(object)\n end\nend\n\n-- detect if \"Dream-Enhancing Serum\" is removed\nfunction onCollisionExit(collisionInfo)\n if collisionInfo.collision_object.getName() == \"Dream-Enhancing Serum\" then isDES = false end\nend\n\n-- checks if tokens should be spawned for the provided card\nfunction shouldSpawnTokens(card)\n if card.is_face_down then\n return false\n end\n\n local localCardPos = self.positionToLocal(card.getPosition())\n local metadata = JSON.decode(card.getGMNotes())\n\n -- If no metadata we don't know the type, so only spawn in the main area\n if metadata == nil then\n return inArea(localCardPos, MAIN_PLAY_AREA)\n end\n\n -- Spawn tokens for assets and events on the main area\n if inArea(localCardPos, MAIN_PLAY_AREA)\n and (metadata.type == \"Asset\"\n or metadata.type == \"Event\") then\n return true\n end\n\n -- Spawn tokens for all encounter types in the threat area\n if inArea(localCardPos, THREAT_AREA)\n and (metadata.type == \"Treachery\"\n or metadata.type == \"Enemy\"\n or metadata.weakness) then\n return true\n end\n\n return false\nend\n\nfunction onObjectEnterContainer(container, object)\n if not isCard(object) then return end\n\n local localCardPos = self.positionToLocal(object.getPosition())\n if inArea(localCardPos, DECK_DISCARD_AREA) then\n tokenManager.resetTokensSpawned(object)\n removeTokensFromObject(object)\n end\nend\n\n-- removes tokens from the provided card/deck\nfunction removeTokensFromObject(object)\n for _, obj in ipairs(searchArea(object.getPosition(), { 3, 1, 4 })) do\n if obj.getGUID() ~= \"4ee1f2\" and -- table\n obj ~= self and\n obj.type ~= \"Deck\" and\n obj.type ~= \"Card\" and\n obj.memo ~= nil and\n obj.getLock() == false and\n obj.getDescription() ~= \"Action Token\" and\n not tokenChecker.isChaosToken(obj) then\n ownedObjects.Trash.putObject(obj)\n end\n end\nend\n\n---------------------------------------------------------\n-- investigator ID grabbing and skill tracker\n---------------------------------------------------------\n\nfunction maybeUpdateActiveInvestigator(card)\n if not inArea(self.positionToLocal(card.getPosition()), INVESTIGATOR_AREA) then return end\n\n local notes = JSON.decode(card.getGMNotes())\n local class\n\n if notes ~= nil and notes.type == \"Investigator\" and notes.id ~= nil then\n if notes.id == activeInvestigatorId then return end\n class = notes.class\n activeInvestigatorId = notes.id\n ownedObjects.InvestigatorSkillTracker.call(\"updateStats\", {\n notes.willpowerIcons,\n notes.intellectIcons,\n notes.combatIcons,\n notes.agilityIcons\n })\n elseif activeInvestigatorId ~= \"00000\" then\n class = \"Neutral\"\n activeInvestigatorId = \"00000\"\n ownedObjects.InvestigatorSkillTracker.call(\"updateStats\", {1, 1, 1, 1})\n else\n return\n end\n\n -- change state of action tokens\n local search = searchArea(self.positionToWorld({-1.1, 0.05, -0.27}), {4, 1, 1})\n local smallToken = nil\n local STATE_TABLE = {\n [\"Guardian\"] = 1,\n [\"Seeker\"] = 2,\n [\"Rogue\"] = 3,\n [\"Mystic\"] = 4,\n [\"Survivor\"] = 5,\n [\"Neutral\"] = 6\n }\n\n for _, obj in ipairs(search) do\n if obj.getDescription() == \"Action Token\" and obj.getStateId() \u003e 0 then\n if obj.getScale().x \u003c 0.4 then\n smallToken = obj\n else\n setObjectState(obj, STATE_TABLE[class])\n end\n end\n end\n\n -- update the small token with special action for certain investigators\n local SPECIAL_ACTIONS = {\n [\"04002\"] = 8, -- Ursula Downs\n [\"01002\"] = 9, -- Daisy Walker\n [\"01502\"] = 9, -- Daisy Walker\n [\"01002-pb\"] = 9, -- Daisy Walker\n [\"06003\"] = 10, -- Tony Morgan\n [\"04003\"] = 11, -- Finn Edwards\n [\"08016\"] = 14 -- Bob Jenkins\n }\n\n if smallToken ~= nil then\n setObjectState(smallToken, SPECIAL_ACTIONS[activeInvestigatorId] or STATE_TABLE[class])\n end\nend\n\nfunction setObjectState(obj, stateId)\n if obj.getStateId() ~= stateId then obj.setState(stateId) end\nend\n\n---------------------------------------------------------\n-- manipulation of owned objects\n---------------------------------------------------------\n\n-- updates the specific owned counter\n---@param param Table Contains the information to update:\n--- type: String Counter to target\n--- newValue: Number Value to set the counter to\n--- modifier: Number If newValue is not provided, the existing value will be adjusted by this modifier\nfunction updateCounter(param)\n local counter = ownedObjects[param.type]\n if counter ~= nil then\n counter.call(\"updateVal\", param.newValue or (counter.getVar(\"val\") + param.modifier))\n else\n printToAll(param.type .. \" for \" .. matColor .. \" could not be found.\", \"Yellow\")\n end\nend\n\n-- returns the resource counter amount\n---@param type String Counter to target\nfunction getCounterValue(type)\n return ownedObjects[type].getVar(\"val\")\nend\n\n-- set investigator skill tracker to \"1, 1, 1, 1\"\nfunction resetSkillTracker()\n local obj = ownedObjects.InvestigatorSkillTracker\n if obj ~= nil then\n obj.call(\"updateStats\", { 1, 1, 1, 1 })\n else\n printToAll(\"Skill tracker for \" .. matColor .. \" playmat could not be found.\", \"Yellow\")\n end\nend\n\n---------------------------------------------------------\n-- calls to 'Global' / functions for calls from outside\n---------------------------------------------------------\n\nfunction drawChaosTokenButton(_, _, isRightClick)\n chaosBagApi.drawChaosToken(self, DRAWN_CHAOS_TOKEN_OFFSET, isRightClick)\nend\n\nfunction drawEncounterCard(_, _, isRightClick)\n local pos = self.positionToWorld(DRAWN_ENCOUNTER_CARD_OFFSET)\n local rotY = self.getRotation().y\n mythosAreaApi.drawEncounterCard(pos, rotY, isRightClick)\nend\n\nfunction returnGlobalDiscardPosition()\n return self.positionToWorld(DISCARD_PILE_POSITION)\nend\n\n-- Sets this playermat's draw 1 button to visible\n---@param visible Boolean. Whether the draw 1 button should be visible\nfunction showDrawButton(visible)\n isDrawButtonVisible = visible\n\n -- create the \"Draw 1\" button\n if isDrawButtonVisible then\n self.createButton({\n label = \"Draw 1\",\n click_function = \"doDrawOne\",\n function_owner = self,\n position = { 1.84, 0.1, -0.36 },\n scale = { 0.12, 0.12, 0.12 },\n width = 800,\n height = 280,\n font_size = 180\n })\n\n -- remove the \"Draw 1\" button\n else\n local buttons = self.getButtons()\n for i = 1, #buttons do\n if buttons[i].label == \"Draw 1\" then\n self.removeButton(buttons[i].index)\n end\n end\n end\nend\n\n-- shows / hides a clickable clue counter for this playmat and sets the correct amount of clues\n---@param showCounter Boolean Whether the clickable clue counter should be visible\nfunction clickableClues(showCounter)\n local clickerPos = ownedObjects.ClickableClueCounter.getPosition()\n local clueCount = 0\n \n -- move clue counters\n local modY = showCounter and 0.525 or -0.525\n ownedObjects.ClickableClueCounter.setPosition(clickerPos + Vector(0, modY, 0))\n\n if showCounter then\n -- current clue count\n clueCount = ownedObjects.ClueCounter.getVar(\"exposedValue\")\n\n -- remove clues\n ownedObjects.ClueCounter.call(\"removeAllClues\", ownedObjects.Trash)\n\n -- set value for clue clickers\n ownedObjects.ClickableClueCounter.call(\"updateVal\", clueCount)\n else\n -- current clue count\n clueCount = ownedObjects.ClickableClueCounter.getVar(\"val\")\n\n -- spawn clues\n local pos = self.positionToWorld({x = -1.12, y = 0.05, z = 0.7})\n for i = 1, clueCount do\n pos.y = pos.y + 0.045 * i\n tokenManager.spawnToken(pos, \"clue\", self.getRotation())\n end\n end\nend\n\n-- removes all clues (moving tokens to the trash and setting counters to 0)\nfunction removeClues()\n ownedObjects.ClueCounter.call(\"removeAllClues\", ownedObjects.Trash)\n ownedObjects.ClickableClueCounter.call(\"updateVal\", 0)\nend\n\n-- reports the clue count\n---@param useClickableCounters Boolean Controls which type of counter is getting checked\nfunction getClueCount(useClickableCounters)\n if useClickableCounters then\n return ownedObjects.ClickableClueCounter.getVar(\"val\")\n else\n return ownedObjects.ClueCounter.getVar(\"exposedValue\")\n end\nend\n\n-- Sets this playermat's snap points to limit snapping to matching card types or not. If matchTypes\n-- is true, the main card slot snap points will only snap assets, while the investigator area point\n-- will only snap Investigators. If matchTypes is false, snap points will be reset to snap all\n-- cards.\n---@param matchTypes Boolean. Whether snap points should only snap for the matching card types.\nfunction setLimitSnapsByType(matchTypes)\n local snaps = self.getSnapPoints()\n for i, snap in ipairs(snaps) do\n local snapPos = snap.position\n if inArea(snapPos, MAIN_PLAY_AREA) then\n local snapTags = snaps[i].tags\n if matchTypes then\n if snapTags == nil then\n snaps[i].tags = { \"Asset\" }\n else\n table.insert(snaps[i].tags, \"Asset\")\n end\n else\n snaps[i].tags = nil\n end\n end\n if inArea(snapPos, INVESTIGATOR_AREA) then\n local snapTags = snaps[i].tags\n if matchTypes then\n if snapTags == nil then\n snaps[i].tags = { \"Investigator\" }\n else\n table.insert(snaps[i].tags, \"Investigator\")\n end\n else\n snaps[i].tags = nil\n end\n end\n end\n self.setSnapPoints(snaps)\nend\n\n-- Simple method to check if the given point is in a specified area. Local use only,\n---@param point Vector Point to check, only x and z values are relevant\n---@param bounds Table Defined area to see if the point is within. See MAIN_PLAY_AREA for sample\n-- bounds definition.\n---@return Boolean True if the point is in the area defined by bounds\nfunction inArea(point, bounds)\n return (point.x \u003c bounds.upperLeft.x\n and point.x \u003e bounds.lowerRight.x\n and point.z \u003c bounds.upperLeft.z\n and point.z \u003e bounds.lowerRight.z)\nend\n\n-- called by custom data helpers to add player card data\n---@param args table Contains only one entry, the GUID of the custom data helper\nfunction updatePlayerCards(args)\n local customDataHelper = getObjectFromGUID(args[1])\n local playerCardData = customDataHelper.getTable(\"PLAYER_CARD_DATA\")\n tokenManager.addPlayerCardData(playerCardData)\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/MythosAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local MythosAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getMythosArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"MythosArea\")\n end\n\n -- returns the chaos token metadata (if provided through scenario reference card)\n MythosAreaApi.returnTokenData = function()\n return getMythosArea().call(\"returnTokenData\")\n end\n \n -- returns an object reference to the encounter deck\n MythosAreaApi.getEncounterDeck = function()\n return getMythosArea().call(\"getEncounterDeck\")\n end\n\n -- draw an encounter card to the requested position/rotation\n MythosAreaApi.drawEncounterCard = function(pos, rotY, alwaysFaceUp)\n getMythosArea().call(\"drawEncounterCard\", {\n pos = pos,\n rotY = rotY,\n alwaysFaceUp = alwaysFaceUp\n })\n end\n\n return MythosAreaApi\nend\nend)\n__bundle_register(\"core/token/TokenChecker\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local CHAOS_TOKEN_NAMES = {\n [\"Elder Sign\"] = true,\n [\"+1\"] = true,\n [\"0\"] = true,\n [\"-1\"] = true,\n [\"-2\"] = true,\n [\"-3\"] = true,\n [\"-4\"] = true,\n [\"-5\"] = true,\n [\"-6\"] = true,\n [\"-7\"] = true,\n [\"-8\"] = true,\n [\"Skull\"] = true,\n [\"Cultist\"] = true,\n [\"Tablet\"] = true,\n [\"Elder Thing\"] = true,\n [\"Auto-fail\"] = true,\n [\"Bless\"] = true,\n [\"Curse\"] = true,\n [\"Frost\"] = true\n }\n\n local TokenChecker = {}\n\n -- returns true if the passed object is a chaos token (by name)\n TokenChecker.isChaosToken = function(obj)\n if CHAOS_TOKEN_NAMES[obj.getName()] then\n return true\n else\n return false\n end\n end\n\n return TokenChecker\nend\nend)\n__bundle_register(\"core/OptionPanelApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local OptionPanelApi = {}\n\n -- loads saved options\n ---@param options Table New options table\n OptionPanelApi.loadSettings = function(options)\n return Global.call(\"loadSettings\", options)\n end\n\n -- returns option panel table\n OptionPanelApi.getOptions = function()\n return Global.getTable(\"optionPanel\")\n end\n\n return OptionPanelApi\nend\nend)\n__bundle_register(\"core/token/TokenSpawnTrackerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenSpawnTracker = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getSpawnTracker()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenSpawnTracker\")\n end\n\n TokenSpawnTracker.hasSpawnedTokens = function(cardGuid)\n return getSpawnTracker().call(\"hasSpawnedTokens\", cardGuid)\n end\n\n TokenSpawnTracker.markTokensSpawned = function(cardGuid)\n return getSpawnTracker().call(\"markTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetTokensSpawned = function(cardGuid)\n return getSpawnTracker().call(\"resetTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetAllAssetAndEvents = function()\n return getSpawnTracker().call(\"resetAllAssetAndEvents\")\n end\n\n TokenSpawnTracker.resetAllLocations = function()\n return getSpawnTracker().call(\"resetAllLocations\")\n end\n\n TokenSpawnTracker.resetAll = function()\n return getSpawnTracker().call(\"resetAll\")\n end\n\n return TokenSpawnTracker\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"core/NavigationOverlayApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local NavigationOverlayApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getNOHandler()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"NavigationOverlayHandler\")\n end\n\n -- Copies the visibility for the Navigation overlay\n ---@param startColor String Color of the player to copy from\n ---@param targetColor String Color of the targeted player\n NavigationOverlayApi.copyVisibility = function(startColor, targetColor)\n getNOHandler().call(\"copyVisibility\", {\n startColor = startColor,\n targetColor = targetColor\n })\n end \n\n -- Changes the Navigation Overlay view (\"Full View\" --\u003e \"Play Areas\" --\u003e \"Closed\" etc.)\n ---@param playerColor String Color of the player to update the visibility for\n NavigationOverlayApi.cycleVisibility = function(playerColor)\n getNOHandler().call(\"cycleVisibility\", playerColor)\n end\n\n return NavigationOverlayApi\nend\nend)\n__bundle_register(\"core/token/TokenManager\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n local optionPanelApi = require(\"core/OptionPanelApi\")\n local playAreaApi = require(\"core/PlayAreaApi\")\n local tokenSpawnTrackerApi = require(\"core/token/TokenSpawnTrackerApi\")\n\n local PLAYER_CARD_TOKEN_OFFSETS = {\n [1] = {\n Vector(0, 3, -0.2)\n },\n [2] = {\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [3] = {\n Vector(0, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [4] = {\n Vector(0.4, 3, -0.9),\n Vector(-0.4, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [5] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [6] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2)\n },\n [7] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0, 3, 0.5)\n },\n [8] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(-0.35, 3, 0.5),\n Vector(0.35, 3, 0.5)\n },\n [9] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5)\n },\n [10] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0, 3, 1.2)\n },\n [11] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(-0.35, 3, 1.2),\n Vector(0.35, 3, 1.2)\n },\n [12] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0.7, 3, 1.2),\n Vector(0, 3, 1.2),\n Vector(-0.7, 3, 1.2)\n }\n }\n\n -- stateIDs for the multi-stated resource tokens\n local stateTable = {\n [\"resource\"] = 1,\n [\"ammo\"] = 2,\n [\"bounty\"] = 3,\n [\"charge\"] = 4,\n [\"evidence\"] = 5,\n [\"secret\"] = 6,\n [\"supply\"] = 7\n }\n\n -- Table of data extracted from the token source bag, keyed by the Memo on each token which\n -- should match the token type keys (\"resource\", \"clue\", etc)\n local tokenTemplates\n\n local playerCardData\n local locationData\n\n local TokenManager = { }\n local internal = { }\n\n -- Spawns tokens for the card. This function is built to just throw a card at it and let it do\n -- the work once a card has hit an area where it might spawn tokens. It will check to see if\n -- the card has already spawned, find appropriate data from either the uses metadata or the Data\n -- Helper, and spawn the tokens.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n TokenManager.spawnForCard = function(card, extraUses)\n if tokenSpawnTrackerApi.hasSpawnedTokens(card.getGUID()) then\n return\n end\n local metadata = JSON.decode(card.getGMNotes())\n if metadata ~= nil then\n internal.spawnTokensFromUses(card, extraUses)\n else\n internal.spawnTokensFromDataHelper(card)\n end\n end\n\n -- Spawns a set of tokens on the given card.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String Type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param tokenCount Number How many tokens to spawn. For damage or horror this value will be set to the\n -- spawned state object rather than spawning multiple tokens\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnTokenGroup = function(card, tokenType, tokenCount, shiftDown, subType)\n local optionPanel = optionPanelApi.getOptions()\n\n if tokenType == \"damage\" or tokenType == \"horror\" then\n TokenManager.spawnCounterToken(card, tokenType, tokenCount, shiftDown)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"enabled\" then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"custom\" and tokenCount == 0 then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n else\n TokenManager.spawnMultipleTokens(card, tokenType, tokenCount, shiftDown, subType)\n end\n end\n\n -- Spawns a single counter token and sets the value to tokenValue. Used for damage and horror\n -- tokens.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String type of token to spawn, valid values are \"damage\" and \"horror\". Other\n -- types should use spawnMultipleTokens()\n ---@param tokenValue Number Value to set the damage/horror to\n TokenManager.spawnCounterToken = function(card, tokenType, tokenValue, shiftDown)\n if tokenValue \u003c 1 or tokenValue \u003e 50 then return end\n\n local pos = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[1][1] + Vector(0, 0, shiftDown))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, tokenType, rot, function(spawned) spawned.setState(tokenValue) end)\n end\n\n TokenManager.spawnResourceCounterToken = function(card, tokenCount)\n local pos = card.positionToWorld(card.positionToLocal(card.getPosition()) + Vector(0, 0.2, -0.5))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, \"resourceCounter\", rot, function(spawned)\n spawned.call(\"updateVal\", tokenCount)\n end)\n end\n\n -- Spawns a number of tokens.\n ---@param tokenType String type of token to spawn, valid values are resource\", \"doom\", or \"clue\".\n -- Other types should use spawnCounterToken()\n ---@param tokenCount Number How many tokens to spawn\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnMultipleTokens = function(card, tokenType, tokenCount, shiftDown, subType)\n -- not checking the max at this point since clue offsets are calculated dynamically\n if tokenCount \u003c 1 then return end\n\n local offsets = {}\n if tokenType == \"clue\" then\n offsets = internal.buildClueOffsets(card, tokenCount)\n else\n -- only up to 12 offset tables defined\n if tokenCount \u003e 12 then return end\n for i = 1, tokenCount do\n offsets[i] = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[tokenCount][i])\n -- Fix the y-position for the spawn, since positionToWorld considers rotation which can\n -- have bad results for face up/down differences\n offsets[i].y = card.getPosition().y + 0.15\n end\n end\n\n if shiftDown ~= nil then\n -- Copy the offsets to make sure we don't change the static values\n local baseOffsets = offsets\n offsets = { }\n\n -- get a vector for the shifting (downwards local to the card)\n local shiftDownVector = Vector(0, 0, shiftDown):rotateOver(\"y\", card.getRotation().y)\n for i, baseOffset in ipairs(baseOffsets) do\n offsets[i] = baseOffset + shiftDownVector\n end\n end\n\n if offsets == nil then\n error(\"couldn't find offsets for \" .. tokenCount .. ' tokens')\n return\n end\n\n -- handling for not provided subtype (for example when spawning from custom data helpers)\n if subType == nil then\n subType = \"\"\n end\n \n -- this is used to load the correct state for additional resource tokens (e.g. \"Ammo\")\n local callback = nil\n local stateID = stateTable[string.lower(subType)]\n if tokenType == \"resource\" and stateID ~= nil and stateID ~= 1 then\n callback = function(spawned) spawned.setState(stateID) end\n end\n\n for i = 1, tokenCount do\n TokenManager.spawnToken(offsets[i], tokenType, card.getRotation(), callback)\n end\n end\n\n -- Spawns a single token at the given global position by copying it from the template bag.\n ---@param position Global position to spawn the token\n ---@param tokenType String type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param rotation Vector Rotation to be used for the new token. Only the y-value will be used,\n -- x and z will use the default rotation from the source bag\n ---@param callback function A callback function triggered after the new token is spawned\n TokenManager.spawnToken = function(position, tokenType, rotation, callback)\n internal.initTokenTemplates()\n local loadTokenType = tokenType\n if tokenType == \"clue\" or tokenType == \"doom\" then\n loadTokenType = \"clueDoom\"\n end\n if tokenTemplates[loadTokenType] == nil then\n error(\"Unknown token type '\" .. tokenType .. \"'\")\n return\n end\n local tokenTemplate = tokenTemplates[loadTokenType]\n\n -- Take ONLY the Y-value for rotation, so we don't flip the token coming out of the bag\n local rot = Vector(tokenTemplate.Transform.rotX,\n 270,\n tokenTemplate.Transform.rotZ)\n if rotation ~= nil then\n rot.y = rotation.y\n end\n if tokenType == \"doom\" then\n rot.z = 180\n end\n\n tokenTemplate.Nickname = \"\"\n return spawnObjectData({\n data = tokenTemplate,\n position = position,\n rotation = rot,\n callback_function = callback\n })\n end\n\n -- Checks a card for metadata to maybe replenish it\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n TokenManager.maybeReplenishCard = function(card, uses, mat)\n -- TODO: support for cards with multiple uses AND replenish (as of yet, no official card needs that)\n if uses[1].count and uses[1].replenish then\n internal.replenishTokens(card, uses, mat)\n end\n end\n\n -- Delegate function to the token spawn tracker. Exists to avoid circular dependencies in some\n -- callers.\n ---@param card Object Card object to reset the tokens for\n TokenManager.resetTokensSpawned = function(card)\n tokenSpawnTrackerApi.resetTokensSpawned(card.getGUID())\n end\n\n -- Pushes new player card data into the local copy of the Data Helper player data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addPlayerCardData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n playerCardData[k] = v\n end\n end\n\n -- Pushes new location data into the local copy of the Data Helper location data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addLocationData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n locationData[k] = v\n end\n end\n\n -- Checks to see if the given card has location data in the DataHelper\n ---@param card Object Card to check for data\n ---@return Boolean True if this card has data in the helper, false otherwise\n TokenManager.hasLocationData = function(card)\n internal.initDataHelperData()\n return internal.getLocationData(card) ~= nil\n end\n\n internal.initTokenTemplates = function()\n if tokenTemplates ~= nil then\n return\n end\n tokenTemplates = {}\n local tokenSource = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenSource\")\n for _, tokenTemplate in ipairs(tokenSource.getData().ContainedObjects) do\n local tokenName = tokenTemplate.Memo\n tokenTemplates[tokenName] = tokenTemplate\n end\n end\n\n -- Copies the data from the DataHelper. Will only happen once.\n internal.initDataHelperData = function()\n if playerCardData ~= nil then\n return\n end\n local dataHelper = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"DataHelper\")\n playerCardData = dataHelper.getTable('PLAYER_CARD_DATA')\n locationData = dataHelper.getTable('LOCATIONS_DATA')\n end\n\n -- Spawn tokens for a card based on the uses metadata. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n internal.spawnTokensFromUses = function(card, extraUses)\n local uses = internal.getUses(card)\n if uses == nil then return end\n\n -- go through tokens to spawn\n local tokenCount\n for i, useInfo in ipairs(uses) do\n tokenCount = (useInfo.count or 0) + (useInfo.countPerInvestigator or 0) * playAreaApi.getInvestigatorCount()\n if extraUses ~= nil and extraUses[useInfo.type] ~= nil then\n tokenCount = tokenCount + extraUses[useInfo.type]\n end\n -- Shift each spawned group after the first down so they don't pile on each other\n TokenManager.spawnTokenGroup(card, useInfo.token, tokenCount, (i - 1) * 0.8, useInfo.type)\n end\n \n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a card based on the data helper data. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n internal.spawnTokensFromDataHelper = function(card)\n internal.initDataHelperData()\n local playerData = internal.getPlayerCardData(card)\n if playerData ~= nil then\n internal.spawnPlayerCardTokensFromDataHelper(card, playerData)\n end\n local locationData = internal.getLocationData(card)\n if locationData ~= nil then\n internal.spawnLocationTokensFromDataHelper(card, locationData)\n end\n end\n\n -- Spawn tokens for a player card using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Player card data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnPlayerCardTokensFromDataHelper = function(card, playerData)\n local token = playerData.tokenType\n local tokenCount = playerData.tokenCount\n TokenManager.spawnTokenGroup(card, token, tokenCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a location using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Location data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnLocationTokensFromDataHelper = function(card, locationData)\n local clueCount = internal.getClueCountFromData(card, locationData)\n if clueCount \u003e 0 then\n TokenManager.spawnTokenGroup(card, \"clue\", clueCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n end\n\n internal.getPlayerCardData = function(card)\n return playerCardData[card.getName() .. ':' .. card.getDescription()]\n or playerCardData[card.getName()]\n end\n\n internal.getLocationData = function(card)\n return locationData[card.getName() .. '_' .. card.getGUID()] or locationData[card.getName()]\n end\n\n internal.getClueCountFromData = function(card, locationData)\n -- Return the number of clues to spawn on this location\n if locationData == nil then\n error('attempted to get clue for unexpected object: ' .. card.getName())\n return 0\n end\n\n if ((card.is_face_down and locationData.clueSide == 'back')\n or (not card.is_face_down and locationData.clueSide == 'front')) then\n if locationData.type == 'fixed' then\n return locationData.value\n elseif locationData.type == 'perPlayer' then\n return locationData.value * playAreaApi.getInvestigatorCount()\n end\n error('unexpected location type: ' .. locationData.type)\n end\n return 0\n end\n\n -- Gets the right uses structure for this card, based on metadata and face up/down state\n ---@param card Object Card to pull the uses from\n internal.getUses = function(card)\n local metadata = JSON.decode(card.getGMNotes()) or { }\n if metadata.type == \"Location\" then\n if card.is_face_down and metadata.locationBack ~= nil then\n return metadata.locationBack.uses\n elseif not card.is_face_down and metadata.locationFront ~= nil then\n return metadata.locationFront.uses\n end\n elseif not card.is_face_down then\n return metadata.uses\n end\n\n return nil\n end\n\n -- Dynamically create positions for clues on a card.\n ---@param card Object Card the clues will be placed on\n ---@param count Integer How many clues?\n ---@return Table Array of global positions to spawn the clues at\n internal.buildClueOffsets = function(card, count)\n local pos = card.getPosition()\n local cluePositions = { }\n for i = 1, count do\n local row = math.floor(1 + (i - 1) / 4)\n local column = (i - 1) % 4\n table.insert(cluePositions, Vector(pos.x + 1.5 - 0.55 * row, pos.y + 0.15, pos.z - 0.825 + 0.55 * column))\n end\n return cluePositions\n end\n\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n internal.replenishTokens = function(card, uses, mat)\n local cardPos = card.getPosition()\n\n -- don't continue for cards on the deck (Norman) or in the discard pile\n if mat.positionToLocal(cardPos).x \u003c -1 then return end\n\n -- get current amount of resource tokens on the card\n local search = internal.searchOnCard(cardPos, card.getRotation())\n local clickableResourceCounter = nil\n local foundTokens = 0\n\n for _, obj in ipairs(search) do\n local obj = obj.hit_object\n local memo = obj.getMemo()\n\n if (stateTable[memo] or 0) \u003e 0 then\n foundTokens = foundTokens + math.abs(obj.getQuantity())\n obj.destruct()\n elseif memo == \"resourceCounter\" then\n foundTokens = obj.getVar(\"val\")\n clickableResourceCounter = obj\n break\n end\n end\n\n -- this is the theoretical new amount of uses (to be checked below)\n local newCount = foundTokens + uses[1].replenish\n\n -- if there are already more uses than the replenish amount, keep them\n if foundTokens \u003e uses[1].count then\n newCount = foundTokens\n -- only replenish up until the replenish amount\n elseif newCount \u003e uses[1].count then\n newCount = uses[1].count\n end\n\n -- update the clickable counter or spawn a group of tokens\n if clickableResourceCounter then\n clickableResourceCounter.call(\"updateVal\", newCount)\n else\n TokenManager.spawnTokenGroup(card, uses[1].token, newCount, _, uses[1].type)\n end\n end\n\n -- searches on a card (standard size) and returns the result\n ---@param position Table Position of the card\n ---@param rotation Table Rotation of the card\n internal.searchOnCard = function(position, rotation)\n return Physics.cast({\n origin = position,\n direction = {0, 1, 0},\n orientation = rotation,\n type = 3,\n size = { 2.5, 0.5, 3.5 },\n max_distance = 1,\n debug = false\n })\n end\n\n return TokenManager\nend\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getPlayArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"PlayArea\")\n end\n\n local function getInvestigatorCounter()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"InvestigatorCounter\")\n end\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getInvestigatorCounter().getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n getInvestigatorCounter().call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with 'displacement_excluded'\n ---@param playerColor Color Color of the player requesting the shift for messages\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getPlayArea().call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getPlayArea().call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getPlayArea().call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getPlayArea().call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getPlayArea().call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getPlayArea().call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getPlayArea().call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getPlayArea().call(\"tryObjectEnterContainer\", { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getPlayArea().call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getPlayArea().call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getPlayArea().call(\"countVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getPlayArea().call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getPlayArea().getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getPlayArea().call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getPlayArea().call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getPlayArea().getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "{\"activeInvestigatorId\":\"00000\",\"isDrawButtonVisible\":false,\"playerColor\":\"White\"}", "MeasureMovement": false, + "Memo": "White", "Name": "Custom_Tile", "Nickname": "Playermat 1: White", "Snap": true, @@ -49565,18 +51946,19 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/token/TokenManager\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local optionPanelApi = require(\"core/OptionPanelApi\")\n local playAreaApi = require(\"core/PlayAreaApi\")\n local tokenSpawnTrackerApi = require(\"core/token/TokenSpawnTrackerApi\")\n\n local PLAYER_CARD_TOKEN_OFFSETS = {\n [1] = {\n Vector(0, 3, -0.2)\n },\n [2] = {\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [3] = {\n Vector(0, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [4] = {\n Vector(0.4, 3, -0.9),\n Vector(-0.4, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [5] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [6] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2)\n },\n [7] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0, 3, 0.5)\n },\n [8] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(-0.35, 3, 0.5),\n Vector(0.35, 3, 0.5)\n },\n [9] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5)\n },\n [10] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0, 3, 1.2)\n },\n [11] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(-0.35, 3, 1.2),\n Vector(0.35, 3, 1.2)\n },\n [12] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0.7, 3, 1.2),\n Vector(0, 3, 1.2),\n Vector(-0.7, 3, 1.2)\n }\n }\n\n -- stateIDs for the multi-stated resource tokens\n local stateTable = {\n [\"resource\"] = 1,\n [\"ammo\"] = 2,\n [\"bounty\"] = 3,\n [\"charge\"] = 4,\n [\"evidence\"] = 5,\n [\"secret\"] = 6,\n [\"supply\"] = 7\n }\n\n -- Source for tokens\n local TOKEN_SOURCE_GUID = \"124381\"\n\n -- Table of data extracted from the token source bag, keyed by the Memo on each token which\n -- should match the token type keys (\"resource\", \"clue\", etc)\n local tokenTemplates\n\n local DATA_HELPER_GUID = \"708279\"\n\n local playerCardData\n local locationData\n\n local TokenManager = { }\n local internal = { }\n\n -- Spawns tokens for the card. This function is built to just throw a card at it and let it do\n -- the work once a card has hit an area where it might spawn tokens. It will check to see if\n -- the card has already spawned, find appropriate data from either the uses metadata or the Data\n -- Helper, and spawn the tokens.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n TokenManager.spawnForCard = function(card, extraUses)\n if tokenSpawnTrackerApi.hasSpawnedTokens(card.getGUID()) then\n return\n end\n local metadata = JSON.decode(card.getGMNotes())\n if metadata ~= nil then\n internal.spawnTokensFromUses(card, extraUses)\n else\n internal.spawnTokensFromDataHelper(card)\n end\n end\n\n -- Spawns a set of tokens on the given card.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String Type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param tokenCount Number How many tokens to spawn. For damage or horror this value will be set to the\n -- spawned state object rather than spawning multiple tokens\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnTokenGroup = function(card, tokenType, tokenCount, shiftDown, subType)\n local optionPanel = optionPanelApi.getOptions()\n\n if tokenType == \"damage\" or tokenType == \"horror\" then\n TokenManager.spawnCounterToken(card, tokenType, tokenCount, shiftDown)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"enabled\" then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"custom\" and tokenCount == 0 then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n else\n TokenManager.spawnMultipleTokens(card, tokenType, tokenCount, shiftDown, subType)\n end\n end\n\n -- Spawns a single counter token and sets the value to tokenValue. Used for damage and horror\n -- tokens.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String type of token to spawn, valid values are \"damage\" and \"horror\". Other\n -- types should use spawnMultipleTokens()\n ---@param tokenValue Number Value to set the damage/horror to\n TokenManager.spawnCounterToken = function(card, tokenType, tokenValue, shiftDown)\n if tokenValue \u003c 1 or tokenValue \u003e 50 then return end\n\n local pos = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[1][1] + Vector(0, 0, shiftDown))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, tokenType, rot, function(spawned) spawned.setState(tokenValue) end)\n end\n\n TokenManager.spawnResourceCounterToken = function(card, tokenCount)\n local pos = card.positionToWorld(card.positionToLocal(card.getPosition()) + Vector(0, 0.2, -0.5))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, \"resourceCounter\", rot, function(spawned)\n spawned.call(\"updateVal\", tokenCount)\n end)\n end\n\n -- Spawns a number of tokens.\n ---@param tokenType String type of token to spawn, valid values are resource\", \"doom\", or \"clue\".\n -- Other types should use spawnCounterToken()\n ---@param tokenCount Number How many tokens to spawn\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnMultipleTokens = function(card, tokenType, tokenCount, shiftDown, subType)\n -- not checking the max at this point since clue offsets are calculated dynamically\n if tokenCount \u003c 1 then return end\n\n local offsets = {}\n if tokenType == \"clue\" then\n offsets = internal.buildClueOffsets(card, tokenCount)\n else\n -- only up to 12 offset tables defined\n if tokenCount \u003e 12 then return end\n for i = 1, tokenCount do\n offsets[i] = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[tokenCount][i])\n -- Fix the y-position for the spawn, since positionToWorld considers rotation which can\n -- have bad results for face up/down differences\n offsets[i].y = card.getPosition().y + 0.15\n end\n end\n\n if shiftDown ~= nil then\n -- Copy the offsets to make sure we don't change the static values\n local baseOffsets = offsets\n offsets = { }\n for i, baseOffset in ipairs(baseOffsets) do\n offsets[i] = baseOffset\n offsets[i][3] = offsets[i][3] + shiftDown\n end\n end\n\n if offsets == nil then\n error(\"couldn't find offsets for \" .. tokenCount .. ' tokens')\n return\n end\n\n -- handling for not provided subtype (for example when spawning from custom data helpers)\n if subType == nil then\n subType = \"\"\n end\n \n -- this is used to load the correct state for additional resource tokens (e.g. \"Ammo\")\n local callback = nil\n local stateID = stateTable[string.lower(subType)]\n if tokenType == \"resource\" and stateID ~= nil and stateID ~= 1 then\n callback = function(spawned) spawned.setState(stateID) end\n end\n\n for i = 1, tokenCount do\n TokenManager.spawnToken(offsets[i], tokenType, card.getRotation(), callback)\n end\n end\n\n -- Spawns a single token at the given global position by copying it from the template bag.\n ---@param position Global position to spawn the token\n ---@param tokenType String type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param rotation Vector Rotation to be used for the new token. Only the y-value will be used,\n -- x and z will use the default rotation from the source bag\n ---@param callback function A callback function triggered after the new token is spawned\n TokenManager.spawnToken = function(position, tokenType, rotation, callback)\n internal.initTokenTemplates()\n local loadTokenType = tokenType\n if tokenType == \"clue\" or tokenType == \"doom\" then\n loadTokenType = \"clueDoom\"\n end\n if tokenTemplates[loadTokenType] == nil then\n error(\"Unknown token type '\" .. tokenType .. \"'\")\n return\n end\n local tokenTemplate = tokenTemplates[loadTokenType]\n\n -- Take ONLY the Y-value for rotation, so we don't flip the token coming out of the bag\n local rot = Vector(tokenTemplate.Transform.rotX,\n 270,\n tokenTemplate.Transform.rotZ)\n if rotation ~= nil then\n rot.y = rotation.y\n end\n if tokenType == \"doom\" then\n rot.z = 180\n end\n\n tokenTemplate.Nickname = \"\"\n return spawnObjectData({\n data = tokenTemplate,\n position = position,\n rotation = rot,\n callback_function = callback\n })\n end\n\n -- Checks a card for metadata to maybe replenish it\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n TokenManager.maybeReplenishCard = function(card, uses, mat)\n -- TODO: support for cards with multiple uses AND replenish (as of yet, no official card needs that)\n if uses[1].count and uses[1].replenish then\n internal.replenishTokens(card, uses, mat)\n end\n end\n\n -- Delegate function to the token spawn tracker. Exists to avoid circular dependencies in some\n -- callers.\n ---@param card Object Card object to reset the tokens for\n TokenManager.resetTokensSpawned = function(card)\n tokenSpawnTrackerApi.resetTokensSpawned(card.getGUID())\n end\n\n -- Pushes new player card data into the local copy of the Data Helper player data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addPlayerCardData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n playerCardData[k] = v\n end\n end\n\n -- Pushes new location data into the local copy of the Data Helper location data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addLocationData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n locationData[k] = v\n end\n end\n\n -- Checks to see if the given card has location data in the DataHelper\n ---@param card Object Card to check for data\n ---@return Boolean True if this card has data in the helper, false otherwise\n TokenManager.hasLocationData = function(card)\n internal.initDataHelperData()\n return internal.getLocationData(card) ~= nil\n end\n\n internal.initTokenTemplates = function()\n if tokenTemplates ~= nil then\n return\n end\n tokenTemplates = { }\n local tokenSource = getObjectFromGUID(TOKEN_SOURCE_GUID)\n for _, tokenTemplate in ipairs(tokenSource.getData().ContainedObjects) do\n local tokenName = tokenTemplate.Memo\n tokenTemplates[tokenName] = tokenTemplate\n end\n end\n\n -- Copies the data from the DataHelper. Will only happen once.\n internal.initDataHelperData = function()\n if playerCardData ~= nil then\n return\n end\n local dataHelper = getObjectFromGUID(DATA_HELPER_GUID)\n playerCardData = dataHelper.getTable('PLAYER_CARD_DATA')\n locationData = dataHelper.getTable('LOCATIONS_DATA')\n end\n\n -- Spawn tokens for a card based on the uses metadata. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n internal.spawnTokensFromUses = function(card, extraUses)\n local uses = internal.getUses(card)\n if uses == nil then return end\n\n -- go through tokens to spawn\n local type, token, tokenCount\n for i, useInfo in ipairs(uses) do\n type = useInfo.type\n token = useInfo.token\n tokenCount = (useInfo.count or 0)\n + (useInfo.countPerInvestigator or 0) * playAreaApi.getInvestigatorCount()\n if extraUses ~= nil and extraUses[type] ~= nil then\n tokenCount = tokenCount + extraUses[type]\n end\n -- Shift each spawned group after the first down so they don't pile on each other\n TokenManager.spawnTokenGroup(card, token, tokenCount, (i - 1) * 0.8, type)\n end\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a card based on the data helper data. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n internal.spawnTokensFromDataHelper = function(card)\n internal.initDataHelperData()\n local playerData = internal.getPlayerCardData(card)\n if playerData ~= nil then\n internal.spawnPlayerCardTokensFromDataHelper(card, playerData)\n end\n local locationData = internal.getLocationData(card)\n if locationData ~= nil then\n internal.spawnLocationTokensFromDataHelper(card, locationData)\n end\n end\n\n -- Spawn tokens for a player card using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Player card data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnPlayerCardTokensFromDataHelper = function(card, playerData)\n token = playerData.tokenType\n tokenCount = playerData.tokenCount\n --log(\"Spawning data helper tokens for \"..card.getName()..'['..card.getDescription()..']: '..tokenCount..\"x \"..token)\n TokenManager.spawnTokenGroup(card, token, tokenCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a location using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Location data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnLocationTokensFromDataHelper = function(card, locationData)\n local clueCount = internal.getClueCountFromData(card, locationData)\n if clueCount \u003e 0 then\n TokenManager.spawnTokenGroup(card, \"clue\", clueCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n end\n\n internal.getPlayerCardData = function(card)\n return playerCardData[card.getName() .. ':' .. card.getDescription()]\n or playerCardData[card.getName()]\n end\n\n internal.getLocationData = function(card)\n return locationData[card.getName() .. '_' .. card.getGUID()] or locationData[card.getName()]\n end\n\n internal.getClueCountFromData = function(card, locationData)\n -- Return the number of clues to spawn on this location\n if locationData == nil then\n error('attempted to get clue for unexpected object: ' .. card.getName())\n return 0\n end\n\n --log(card.getName() .. ' : ' .. locationData.type .. ' : ' .. locationData.value .. ' : ' .. locationData.clueSide)\n if ((card.is_face_down and locationData.clueSide == 'back')\n or (not card.is_face_down and locationData.clueSide == 'front')) then\n if locationData.type == 'fixed' then\n return locationData.value\n elseif locationData.type == 'perPlayer' then\n return locationData.value * playAreaApi.getInvestigatorCount()\n end\n error('unexpected location type: ' .. locationData.type)\n end\n return 0\n end\n\n -- Gets the right uses structure for this card, based on metadata and face up/down state\n ---@param card Object Card to pull the uses from\n internal.getUses = function(card)\n local metadata = JSON.decode(card.getGMNotes()) or { }\n if metadata.type == \"Location\" then\n if card.is_face_down and metadata.locationBack ~= nil then\n return metadata.locationBack.uses\n elseif not card.is_face_down and metadata.locationFront ~= nil then\n return metadata.locationFront.uses\n end\n elseif not card.is_face_down then\n return metadata.uses\n end\n\n return nil\n end\n\n -- Dynamically create positions for clues on a card.\n ---@param card Object Card the clues will be placed on\n ---@param count Integer How many clues?\n ---@return Table Array of global positions to spawn the clues at\n internal.buildClueOffsets = function(card, count)\n local pos = card.getPosition()\n local cluePositions = { }\n for i = 1, count do\n local row = math.floor(1 + (i - 1) / 4)\n local column = (i - 1) % 4\n table.insert(cluePositions, Vector(pos.x + 1.5 - 0.55 * row, pos.y + 0.15, pos.z - 0.825 + 0.55 * column))\n end\n return cluePositions\n end\n\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n internal.replenishTokens = function(card, uses, mat)\n local cardPos = card.getPosition()\n\n -- don't continue for cards on the deck (Norman) or in the discard pile\n if mat.positionToLocal(cardPos).x \u003c -1 then return end\n\n -- get current amount of resource tokens on the card\n local search = internal.searchOnCard(cardPos, card.getRotation())\n local clickableResourceCounter = nil\n local foundTokens = 0\n\n for _, obj in ipairs(search) do\n local obj = obj.hit_object\n local memo = obj.getMemo()\n\n if (stateTable[memo] or 0) \u003e 0 then\n foundTokens = foundTokens + math.abs(obj.getQuantity())\n obj.destruct()\n elseif memo == \"resourceCounter\" then\n foundTokens = obj.getVar(\"val\")\n clickableResourceCounter = obj\n break\n end\n end\n\n -- this is the theoretical new amount of uses (to be checked below)\n local newCount = foundTokens + uses[1].replenish\n\n -- if there are already more uses than the replenish amount, keep them\n if foundTokens \u003e uses[1].count then\n newCount = foundTokens\n -- only replenish up until the replenish amount\n elseif newCount \u003e uses[1].count then\n newCount = uses[1].count\n end\n\n -- update the clickable counter or spawn a group of tokens\n if clickableResourceCounter then\n clickableResourceCounter.call(\"updateVal\", newCount)\n else\n TokenManager.spawnTokenGroup(card, uses[1].token, newCount, _, uses[1].type)\n end\n end\n\n -- searches on a card (standard size) and returns the result\n ---@param position Table Position of the card\n ---@param rotation Table Rotation of the card\n internal.searchOnCard = function(position, rotation)\n return Physics.cast({\n origin = position,\n direction = {0, 1, 0},\n orientation = rotation,\n type = 3,\n size = { 2.5, 0.5, 3.5 },\n max_distance = 1,\n debug = false\n })\n end\n\n return TokenManager\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\n---------------------------------------------------------\n-- specific setup (different for each playmat)\n---------------------------------------------------------\n\nTRASHCAN_GUID = \"f7b6c8\"\nSTAT_TRACKER_GUID = \"b4a5f7\"\nRESOURCE_COUNTER_GUID = \"816d84\"\nCLUE_COUNTER_GUID = \"1769ed\"\nCLUE_CLICKER_GUID = \"3f22e5\"\n\nrequire(\"playermat/Playmat\")\nend)\n__bundle_register(\"playermat/Playmat\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal mythosAreaApi = require(\"core/MythosAreaApi\")\nlocal navigationOverlayApi = require(\"core/NavigationOverlayApi\")\nlocal tokenChecker = require(\"core/token/TokenChecker\")\nlocal tokenManager = require(\"core/token/TokenManager\")\n\n-- set true to enable debug logging and show Physics.cast()\nlocal DEBUG = false\n\n-- we use this to turn off collision handling until onLoad() is complete\nlocal collisionEnabled = false\n\n-- position offsets relative to mat [x, y, z]\nlocal DRAWN_ENCOUNTER_CARD_OFFSET = {1.365, 0.5, -0.625}\nlocal DRAWN_CHAOS_TOKEN_OFFSET = {-1.55, 0.25, -0.58}\n\n-- x-Values for discard buttons\nlocal DISCARD_BUTTON_OFFSETS = {-1.365, -0.91, -0.455, 0, 0.455, 0.91}\n\nlocal SEARCH_AROUND_SELF_X_BUFFER = 8\n\n-- defined areas for \"inArea()\" and \"Physics.cast()\"\nlocal MAIN_PLAY_AREA = {\n upperLeft = {\n x = 1.98,\n z = 0.736\n },\n lowerRight = {\n x = -0.79,\n z = -0.39\n }\n}\nlocal INVESTIGATOR_AREA = {\n upperLeft = {\n x = -1.084,\n z = 0.06517\n },\n lowerRight = {\n x = -1.258,\n z = -0.0805\n }\n}\nlocal THREAT_AREA = {\n upperLeft = {\n x = 1.53,\n z = -0.34\n },\n lowerRight = {\n x = -1.13,\n z = -0.92\n }\n}\nlocal DECK_DISCARD_AREA = {\n upperLeft = {\n x = -1.62,\n z = 0.855\n },\n lowerRight = {\n x = -2.02,\n z = -0.245\n },\n center = {\n x = -1.82,\n y = 0.1,\n z = 0.305\n },\n size = {\n x = 0.4,\n y = 0.1,\n z = 1.1\n }\n}\n\n-- local position of draw and discard pile\nlocal DRAW_DECK_POSITION = { x = -1.82, y = 0, z = 0 }\nlocal DISCARD_PILE_POSITION = { x = -1.82, y = 0, z = 0.61 }\n\n-- global position of encounter discard pile\nlocal ENCOUNTER_DISCARD_POSITION = { x = -3.85, y = 1.5, z = 10.38}\n\n-- global variable so it can be reset by the Clean Up Helper\nactiveInvestigatorId = \"00000\"\n\nlocal TRASHCAN, STAT_TRACKER, RESOURCE_COUNTER\nlocal isDrawButtonVisible = false\n\n-- global variable to report \"Dream-Enhancing Serum\" status\nisDES = false\n\nfunction onSave()\n return JSON.encode({\n playerColor = playerColor,\n activeInvestigatorId = activeInvestigatorId,\n isDrawButtonVisible = isDrawButtonVisible\n })\nend\n\nfunction onLoad(saveState)\n self.interactable = DEBUG\n\n TRASHCAN = getObjectFromGUID(TRASHCAN_GUID)\n STAT_TRACKER = getObjectFromGUID(STAT_TRACKER_GUID)\n RESOURCE_COUNTER = getObjectFromGUID(RESOURCE_COUNTER_GUID)\n\n -- button creation\n for i = 1, 6 do\n makeDiscardButton(DISCARD_BUTTON_OFFSETS[i], i)\n end\n\n self.createButton({\n click_function = \"drawEncounterCard\",\n function_owner = self,\n position = {-1.84, 0, -0.65},\n rotation = {0, 80, 0},\n width = 265,\n height = 190\n })\n\n self.createButton({\n click_function = \"drawChaosTokenButton\",\n function_owner = self,\n position = {1.85, 0, -0.74},\n rotation = {0, -45, 0},\n width = 135,\n height = 135\n })\n\n self.createButton({\n label = \"Upkeep\",\n click_function = \"doUpkeep\",\n function_owner = self,\n position = {1.84, 0.1, -0.44},\n scale = {0.12, 0.12, 0.12},\n width = 800,\n height = 280,\n font_size = 180\n })\n\n -- save state loading\n local state = JSON.decode(saveState)\n if state ~= nil then\n playerColor = state.playerColor\n activeInvestigatorId = state.activeInvestigatorId\n isDrawButtonVisible = state.isDrawButtonVisible\n end\n\n showDrawButton(isDrawButtonVisible)\n\n collisionEnabled = true\n\n math.randomseed(os.time())\nend\n\n---------------------------------------------------------\n-- utility functions\n---------------------------------------------------------\n\n-- searches an area and optionally filters the result\nfunction searchArea(origin, size, filter)\n local searchResult = Physics.cast({\n origin = origin,\n direction = { 0, 1, 0 },\n orientation = self.getRotation(),\n type = 3,\n size = size,\n max_distance = 1\n })\n\n local objList = {}\n for _, v in ipairs(searchResult) do\n if not filter or (filter and filter(v.hit_object)) then\n table.insert(objList, v.hit_object)\n end\n end\n return objList\nend\n\n-- filter functions for searchArea()\nfunction isCard(x) return x.type == 'Card' end\nfunction isDeck(x) return x.type == 'Deck' end\nfunction isCardOrDeck(x) return x.type == 'Card' or x.type == 'Deck' end\n\n-- Finds all objects on the playmat and associated set aside zone.\nfunction searchAroundSelf(filter)\n local bounds = self.getBoundsNormalized()\n -- Increase the width to cover the set aside zone\n bounds.size.x = bounds.size.x + SEARCH_AROUND_SELF_X_BUFFER\n -- Since the cast is centered on the position, shift left or right to keep the non-set aside edge\n -- of the cast at the edge of the playmat\n -- setAsideDirection accounts for the set aside zone being on the left or right, depending on the\n -- table position of the playmat\n local setAsideDirection = bounds.center.z \u003e 0 and 1 or -1\n local localCenter = self.positionToLocal(bounds.center)\n localCenter.x = localCenter.x + setAsideDirection * SEARCH_AROUND_SELF_X_BUFFER / 2 / self.getScale().x\n return searchArea(self.positionToWorld(localCenter), bounds.size, filter)\nend\n\n-- searches the area around the draw deck and discard pile\nfunction searchDeckAndDiscardArea(filter)\n local pos = self.positionToWorld(DECK_DISCARD_AREA.center)\n local scale = self.getScale()\n local size = {\n x = DECK_DISCARD_AREA.size.x * scale.x,\n y = DECK_DISCARD_AREA.size.y, \n z = DECK_DISCARD_AREA.size.z * scale.z\n }\n return searchArea(pos, size, filter)\nend\n\nfunction doNotReady(card)\n return card.getVar(\"do_not_ready\") or false\nend\n\n---------------------------------------------------------\n-- Discard buttons\n---------------------------------------------------------\n\n-- builds a function that discards things in searchPosition\n-- stuff on the card/deck will be put into the local trashcan\nfunction makeDiscardHandlerFor(searchPosition)\n return function ()\n local origin = self.positionToWorld(searchPosition)\n for _, obj in ipairs(searchArea(origin, {2, 1, 3.2})) do\n if isCardOrDeck(obj) then\n if obj.hasTag(\"PlayerCard\") then\n placeOrMergeIntoDeck(obj, returnGlobalDiscardPosition(), self.getRotation())\n else\n placeOrMergeIntoDeck(obj, ENCOUNTER_DISCARD_POSITION, {x = 0, y = -90, z = 0})\n end\n -- put chaos tokens back into bag (e.g. Unrelenting)\n elseif tokenChecker.isChaosToken(obj) then\n local chaosBag = chaosBagApi.findChaosBag()\n chaosBag.putObject(obj)\n -- don't touch the table or this playmat itself\n elseif obj.guid ~= \"4ee1f2\" and obj ~= self then\n TRASHCAN.putObject(obj)\n end\n end\n end\nend\n\n-- places a card/deck at a position or merges into an existing deck\n-- rotation is optional\nfunction placeOrMergeIntoDeck(obj, pos, rot)\n if not pos then return end\n\n local offset = 0.5\n local deck, card, newPos\n \n -- search the new position for existing card/deck\n local searchResult = searchArea(pos, { 1, 1, 1 }, isCardOrDeck)\n if #searchResult == 1 then\n local match = searchResult[1]\n if match.type == 'Card' then\n card = match\n elseif match.type == 'Deck' then\n deck = match\n end\n end\n\n -- update vertical component of new position\n if card or deck then\n local bounds = searchResult[1].getBounds()\n newPos = Vector(pos):setAt(\"y\", bounds.center.y + bounds.size.y / 2 + offset)\n else\n newPos = Vector(pos) + Vector(0, offset, 0)\n end\n\n -- actual movement of the object\n if rot then\n obj.setRotationSmooth(rot, false, true)\n end\n obj.setPositionSmooth(newPos, false, true)\n \n -- this avoids a TTS bug that merges unrelated cards that are not resting\n if deck then\n Wait.time(function() deck.putObject(obj) end, 0.3)\n elseif card then\n Wait.time(function() obj.setPosition(newPos) end, 0.3)\n end\nend\n\n-- build a discard button to discard from searchPosition (number must be unique)\nfunction makeDiscardButton(xValue, number)\n local position = { xValue, 0.1, -0.94}\n local searchPosition = {-position[1], position[2], position[3] + 0.32}\n local handler = makeDiscardHandlerFor(searchPosition)\n local handlerName = 'handler' .. number\n self.setVar(handlerName, handler)\n self.createButton({\n label = \"Discard\",\n click_function = handlerName,\n function_owner = self,\n position = position,\n scale = {0.12, 0.12, 0.12},\n width = 900,\n height = 350,\n font_size = 220\n })\nend\n\n---------------------------------------------------------\n-- Upkeep button\n---------------------------------------------------------\n\n-- calls the Upkeep function with correct parameter\nfunction doUpkeepFromHotkey(color)\n doUpkeep(_, color)\nend\n\nfunction doUpkeep(_, clickedByColor, isRightClick)\n -- right-click allow color changing\n if isRightClick then\n changeColor(clickedByColor)\n return\n end\n\n -- send messages to player who clicked button if no seated player found\n messageColor = Player[playerColor].seated and playerColor or clickedByColor\n\n -- unexhaust cards in play zone, flip action tokens and find forcedLearning\n local forcedLearning = false\n local rot = self.getRotation()\n for _, obj in ipairs(searchAroundSelf()) do\n if obj.getDescription() == \"Action Token\" and obj.is_face_down then\n obj.flip()\n elseif obj.type == \"Card\" and not inArea(self.positionToLocal(obj.getPosition()), INVESTIGATOR_AREA) then\n local cardMetadata = JSON.decode(obj.getGMNotes()) or {}\n if not doNotReady(obj) then\n local cardRotation = round(obj.getRotation().y, 0) - rot.y\n local yRotDiff = 0\n\n if cardRotation \u003c 0 then\n cardRotation = cardRotation + 360\n end\n\n -- rotate cards to the next multiple of 90° towards 0°\n if cardRotation \u003e 90 and cardRotation \u003c= 180 then\n yRotDiff = 90\n elseif cardRotation \u003c 270 and cardRotation \u003e 180 then\n yRotDiff = 270\n end\n\n -- set correct rotation for face-down cards\n rot.z = obj.is_face_down and 180 or 0\n obj.setRotation({rot.x, rot.y + yRotDiff, rot.z})\n end\n if cardMetadata.id == \"08031\" then\n forcedLearning = true\n end\n if cardMetadata.uses ~= nil then\n tokenManager.maybeReplenishCard(obj, cardMetadata.uses, self)\n end\n end\n end\n\n -- flip investigator mini-card and summoned servitor mini-card\n -- (all characters allowed to account for custom IDs - e.g. 'Z0000' for TTS Zoop generated IDs)\n if activeInvestigatorId ~= nil then\n local miniId = string.match(activeInvestigatorId, \".....\") .. \"-m\"\n for _, obj in ipairs(getObjects()) do\n if obj.type == \"Card\" and obj.is_face_down then\n local notes = JSON.decode(obj.getGMNotes())\n if notes ~= nil and notes.type == \"Minicard\" and (notes.id == miniId or notes.id == \"09080-m\") then\n obj.flip()\n end\n end\n end\n end\n\n -- gain a resource (or two if playing Jenny Barnes)\n if string.match(activeInvestigatorId, \"%d%d%d%d%d\") == \"02003\" then\n gainResources(2)\n printToColor(\"Gaining 2 resources (Jenny)\", messageColor)\n else\n gainResources(1)\n end\n\n -- draw a card (with handling for Patrice and Forced Learning)\n if activeInvestigatorId == \"06005\" then\n if forcedLearning then\n printToColor(\"Wow, did you really take 'Versatile' to play Patrice with 'Forced Learning'? Choose which draw replacement effect takes priority and draw cards accordingly.\", messageColor)\n else\n local handSize = #Player[playerColor].getHandObjects()\n if handSize \u003c 5 then\n local cardsToDraw = 5 - handSize\n printToColor(\"Drawing \" .. cardsToDraw .. \" cards (Patrice)\", messageColor)\n drawCardsWithReshuffle(cardsToDraw)\n end\n end\n elseif forcedLearning then\n printToColor(\"Drawing 2 cards, discard 1 (Forced Learning)\", messageColor)\n drawCardsWithReshuffle(2)\n elseif activeInvestigatorId == \"89001\" then\n printToColor(\"Drawing 2 cards (Subject 5U-21)\", messageColor)\n drawCardsWithReshuffle(2)\n else\n drawCardsWithReshuffle(1)\n end\nend\n\n-- adds the specified amount of resources to the resource counter\nfunction gainResources(amount)\n local count = RESOURCE_COUNTER.getVar(\"val\")\n local add = tonumber(amount) or 0\n RESOURCE_COUNTER.call(\"updateVal\", count + add)\nend\n\n-- returns the resource counter amount\nfunction getResourceCount()\n return RESOURCE_COUNTER.getVar(\"val\")\nend\n\n-- function for \"draw 1 button\" (that can be added via option panel)\nfunction doDrawOne(_, color)\n -- send messages to player who clicked button if no seated player found\n messageColor = Player[playerColor].seated and playerColor or color\n drawCardsWithReshuffle(1)\nend\n\n-- draw X cards (shuffle discards if necessary)\nfunction drawCardsWithReshuffle(numCards)\n getDrawDiscardDecks()\n\n -- Norman Withers handling\n if string.match(activeInvestigatorId, \"%d%d%d%d%d\") == \"08004\" then\n local harbinger = false\n if topCard ~= nil and topCard.getName() == \"The Harbinger\" then harbinger = true\n elseif drawDeck ~= nil and not drawDeck.is_face_down then\n local cards = drawDeck.getObjects()\n if cards[#cards].name == \"The Harbinger\" then harbinger = true end\n end\n\n if harbinger then\n printToColor(\"The Harbinger is on top of your deck, not drawing cards\", messageColor)\n return\n end\n\n if topCard ~= nil then\n topCard.deal(numCards, playerColor)\n numCards = numCards - 1\n if numCards == 0 then return end\n end\n end\n\n local deckSize = 1\n if drawDeck == nil then\n deckSize = 0\n elseif drawDeck.tag == \"Deck\" then\n deckSize = #drawDeck.getObjects()\n end\n\n if deckSize \u003e= numCards then\n drawCards(numCards)\n return\n end\n\n drawCards(deckSize)\n if discardPile ~= nil then\n shuffleDiscardIntoDeck()\n Wait.time(|| drawCards(numCards - deckSize), 1)\n end\n printToColor(\"Take 1 horror (drawing card from empty deck)\", messageColor)\nend\n\n-- get the draw deck and discard pile objects\nfunction getDrawDiscardDecks()\n drawDeck = nil\n discardPile = nil\n topCard = nil\n\n for _, object in ipairs(searchDeckAndDiscardArea(isCardOrDeck)) do\n if self.positionToLocal(object.getPosition()).z \u003e 0.5 then\n discardPile = object\n -- Norman Withers handling\n elseif string.match(activeInvestigatorId, \"%d%d%d%d%d\") == \"08004\" and not object.is_face_down then\n topCard = object\n else\n drawDeck = object\n end\n end\nend\n\nfunction drawCards(numCards)\n if drawDeck == nil then return end\n drawDeck.deal(numCards, playerColor)\nend\n\nfunction shuffleDiscardIntoDeck()\n if not discardPile.is_face_down then discardPile.flip() end\n discardPile.shuffle()\n discardPile.setPositionSmooth(self.positionToWorld(DRAW_DECK_POSITION), false, false)\n drawDeck = discardPile\n discardPile = nil\nend\n\n-- discard a random non-hidden card from hand\nfunction doDiscardOne()\n local hand = Player[playerColor].getHandObjects()\n if #hand == 0 then\n broadcastToAll(\"Cannot discard from empty hand!\", \"Red\")\n else\n local choices = {}\n for i = 1, #hand do\n local notes = JSON.decode(hand[i].getGMNotes())\n if notes ~= nil then\n if notes.hidden ~= true then\n table.insert(choices, i)\n end\n else\n table.insert(choices, i)\n end\n end\n\n if #choices == 0 then\n broadcastToAll(\"Hidden cards can't be randomly discarded.\", \"Orange\")\n return\n end\n\n -- get a random non-hidden card (from the \"choices\" table)\n local num = math.random(1, #choices)\n placeOrMergeIntoDeck(hand[choices[num]], returnGlobalDiscardPosition(), self.getRotation())\n broadcastToAll(playerColor .. \" randomly discarded card \" .. choices[num] .. \"/\" .. #hand .. \".\", \"White\")\n end\nend\n\n---------------------------------------------------------\n-- color related functions\n---------------------------------------------------------\n\n-- changes the player color\nfunction changeColor(clickedByColor)\n local colorList = {\n \"White\",\n \"Brown\",\n \"Red\",\n \"Orange\",\n \"Yellow\",\n \"Green\",\n \"Teal\",\n \"Blue\",\n \"Purple\",\n \"Pink\"\n }\n\n -- remove existing colors from the list of choices\n for _, existingColor in ipairs(Player.getAvailableColors()) do\n for i, newColor in ipairs(colorList) do\n if existingColor == newColor then\n table.remove(colorList, i)\n end\n end\n end\n\n -- show the option dialog for color selection to the player that triggered this\n Player[clickedByColor].showOptionsDialog(\"Select a new color:\", colorList, _, function(color)\n local HAND_ZONE_GUIDS = {\n \"a70eee\", -- White\n \"5fe087\", -- Orange\n \"0285cc\", -- Green\n \"be2f17\" -- Red\n }\n local index\n local startPos = self.getPosition()\n\n -- get respective hand zone by position\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n index = 1\n else\n index = 2\n end\n else\n if startPos.z \u003e 0 then\n index = 3\n else\n index = 4\n end\n end\n\n -- update the color of the hand zone\n local handZone = getObjectFromGUID(HAND_ZONE_GUIDS[index])\n handZone.setValue(color)\n\n -- if the seated player clicked this, reseat him to the new color\n if clickedByColor == playerColor then\n navigationOverlayApi.copyVisibility(playerColor, color)\n Player[playerColor].changeColor(color)\n end\n\n -- update the internal variable\n playerColor = color\n end)\nend\n\n---------------------------------------------------------\n-- playmat token spawning\n---------------------------------------------------------\n\n-- Finds all customizable cards in this play area and updates their metadata based on the selections\n-- on the matching upgrade sheet.\n-- This method is theoretically O(n^2), and should be used sparingly. In practice it will only be\n-- called when a checkbox is added or removed in-game (which should be rare), and is bounded by the\n-- number of customizable cards in play.\nfunction syncAllCustomizableCards()\n for _, card in ipairs(searchAroundSelf(isCard)) do\n syncCustomizableMetadata(card)\n end\nend\n\nfunction syncCustomizableMetadata(card)\n local cardMetadata = JSON.decode(card.getGMNotes()) or { }\n if cardMetadata == nil or cardMetadata.customizations == nil then\n return\n end\n for _, upgradeSheet in ipairs(searchAroundSelf(isCard)) do\n local upgradeSheetMetadata = JSON.decode(upgradeSheet.getGMNotes()) or { }\n if upgradeSheetMetadata.id == (cardMetadata.id .. \"-c\") then\n for i, customization in ipairs(cardMetadata.customizations) do\n if customization.replaces ~= nil and customization.replaces.uses ~= nil then\n -- Allowed use of call(), no APIs for individual cards\n if upgradeSheet.call(\"isUpgradeActive\", i) then\n cardMetadata.uses = customization.replaces.uses\n card.setGMNotes(JSON.encode(cardMetadata))\n else\n -- TODO: Get the original metadata to restore it... maybe. This should only be\n -- necessary in the very unlikely case that a user un-checks a previously-full upgrade\n -- row while the card is in play. It will be much easier once the AllPlayerCardsApi is\n -- in place, so defer until it is\n end\n end\n end\n end\n end\nend\n\nfunction spawnTokensFor(object)\n local extraUses = { }\n if activeInvestigatorId == \"03004\" then\n extraUses[\"Charge\"] = 1\n end\n\n tokenManager.spawnForCard(object, extraUses)\nend\n\nfunction onCollisionEnter(collision_info)\n local object = collision_info.collision_object\n\n -- detect if \"Dream-Enhancing Serum\" is placed\n if object.getName() == \"Dream-Enhancing Serum\" then isDES = true end\n\n -- only continue if loading is completed\n if not collisionEnabled then return end\n\n -- only continue for cards\n if object.type ~= \"Card\" then return end\n\n maybeUpdateActiveInvestigator(object)\n syncCustomizableMetadata(object)\n\n local localCardPos = self.positionToLocal(object.getPosition())\n if inArea(localCardPos, DECK_DISCARD_AREA) then\n tokenManager.resetTokensSpawned(object)\n removeTokensFromObject(object)\n elseif shouldSpawnTokens(object) then\n spawnTokensFor(object)\n end\nend\n\n-- detect if \"Dream-Enhancing Serum\" is removed\nfunction onCollisionExit(collision_info)\n if collision_info.collision_object.getName() == \"Dream-Enhancing Serum\" then isDES = false end\nend\n\n-- checks if tokens should be spawned for the provided card\nfunction shouldSpawnTokens(card)\n if card.is_face_down then\n return false\n end\n\n local localCardPos = self.positionToLocal(card.getPosition())\n local metadata = JSON.decode(card.getGMNotes())\n\n -- If no metadata we don't know the type, so only spawn in the main area\n if metadata == nil then\n return inArea(localCardPos, MAIN_PLAY_AREA)\n end\n\n -- Spawn tokens for assets and events on the main area\n if inArea(localCardPos, MAIN_PLAY_AREA)\n and (metadata.type == \"Asset\"\n or metadata.type == \"Event\") then\n return true\n end\n\n -- Spawn tokens for all encounter types in the threat area\n if inArea(localCardPos, THREAT_AREA)\n and (metadata.type == \"Treachery\"\n or metadata.type == \"Enemy\"\n or metadata.weakness) then\n return true\n end\n\n return false\nend\n\nfunction onObjectEnterContainer(container, object)\n Wait.frames(function() resetTokensIfInDeckZone(container, object) end, 1)\nend\n\nfunction resetTokensIfInDeckZone(container, object)\n local pos = self.positionToLocal(container.getPosition())\n if inArea(pos, DECK_DISCARD_AREA) then\n tokenManager.resetTokensSpawned(object)\n removeTokensFromObject(container)\n end\nend\n\n-- removes tokens from the provided card/deck\nfunction removeTokensFromObject(object)\n for _, obj in ipairs(searchArea(object.getPosition(), { 3, 1, 4 })) do\n if obj.getGUID() ~= \"4ee1f2\" and -- table\n obj ~= self and\n obj.type ~= \"Deck\" and\n obj.type ~= \"Card\" and\n obj.memo ~= nil and\n obj.getLock() == false and\n obj.getDescription() ~= \"Action Token\" and\n not tokenChecker.isChaosToken(obj) then\n TRASHCAN.putObject(obj)\n end\n end\nend\n\n---------------------------------------------------------\n-- investigator ID grabbing and skill tracker\n---------------------------------------------------------\n\nfunction maybeUpdateActiveInvestigator(card)\n if not inArea(self.positionToLocal(card.getPosition()), INVESTIGATOR_AREA) then return end\n\n local notes = JSON.decode(card.getGMNotes())\n local class\n\n if notes ~= nil and notes.type == \"Investigator\" and notes.id ~= nil then\n if notes.id == activeInvestigatorId then return end\n class = notes.class\n activeInvestigatorId = notes.id\n STAT_TRACKER.call(\"updateStats\", {notes.willpowerIcons, notes.intellectIcons, notes.combatIcons, notes.agilityIcons})\n elseif activeInvestigatorId ~= \"00000\" then\n class = \"Neutral\"\n activeInvestigatorId = \"00000\"\n STAT_TRACKER.call(\"updateStats\", {1, 1, 1, 1})\n else\n return\n end\n\n -- change state of action tokens\n local search = searchArea(self.positionToWorld({-1.1, 0.05, -0.27}), {4, 1, 1})\n local smallToken = nil\n local STATE_TABLE = {\n [\"Guardian\"] = 1,\n [\"Seeker\"] = 2,\n [\"Rogue\"] = 3,\n [\"Mystic\"] = 4,\n [\"Survivor\"] = 5,\n [\"Neutral\"] = 6\n }\n\n for _, obj in ipairs(search) do\n if obj.getDescription() == \"Action Token\" and obj.getStateId() \u003e 0 then\n if obj.getScale().x \u003c 0.4 then\n smallToken = obj\n else\n setObjectState(obj, STATE_TABLE[class])\n end\n end\n end\n\n -- update the small token with special action for certain investigators\n local SPECIAL_ACTIONS = {\n [\"04002\"] = 8, -- Ursula Downs\n [\"01002\"] = 9, -- Daisy Walker\n [\"01502\"] = 9, -- Daisy Walker\n [\"01002-pb\"] = 9, -- Daisy Walker\n [\"06003\"] = 10, -- Tony Morgan\n [\"04003\"] = 11, -- Finn Edwards\n [\"08016\"] = 14 -- Bob Jenkins\n }\n\n if smallToken ~= nil then\n setObjectState(smallToken, SPECIAL_ACTIONS[activeInvestigatorId] or STATE_TABLE[class])\n end\nend\n\nfunction setObjectState(obj, stateId)\n if obj.getStateId() ~= stateId then obj.setState(stateId) end\nend\n\n---------------------------------------------------------\n-- calls to 'Global' / functions for calls from outside\n---------------------------------------------------------\n\nfunction drawChaosTokenButton(_, _, isRightClick)\n chaosBagApi.drawChaosToken(self, DRAWN_CHAOS_TOKEN_OFFSET, isRightClick)\nend\n\nfunction drawEncounterCard(_, _, isRightClick)\n local pos = self.positionToWorld(DRAWN_ENCOUNTER_CARD_OFFSET)\n local rotY = self.getRotation().y\n mythosAreaApi.drawEncounterCard(pos, rotY, isRightClick)\nend\n\nfunction returnGlobalDiscardPosition()\n return self.positionToWorld(DISCARD_PILE_POSITION)\nend\n\n-- Sets this playermat's draw 1 button to visible\n---@param visible Boolean. Whether the draw 1 button should be visible\nfunction showDrawButton(visible)\n isDrawButtonVisible = visible\n\n -- create the \"Draw 1\" button\n if isDrawButtonVisible then\n self.createButton({\n label = \"Draw 1\",\n click_function = \"doDrawOne\",\n function_owner = self,\n position = { 1.84, 0.1, -0.36 },\n scale = { 0.12, 0.12, 0.12 },\n width = 800,\n height = 280,\n font_size = 180\n })\n\n -- remove the \"Draw 1\" button\n else\n local buttons = self.getButtons()\n for i = 1, #buttons do\n if buttons[i].label == \"Draw 1\" then\n self.removeButton(buttons[i].index)\n end\n end\n end\nend\n\n-- Spawns / destroys a clickable clue counter for this playmat with the correct amount of clues\n---@param showCounter Boolean Whether the clickable clue counter should be present\nfunction clickableClues(showCounter)\n local CLUE_COUNTER = getObjectFromGUID(CLUE_COUNTER_GUID)\n local CLUE_CLICKER = getObjectFromGUID(CLUE_CLICKER_GUID)\n local clickerPos = CLUE_CLICKER.getPosition()\n local clueCount = 0\n\n if showCounter then\n -- current clue count\n clueCount = CLUE_COUNTER.getVar(\"exposedValue\")\n\n -- remove clues\n CLUE_COUNTER.call(\"removeAllClues\")\n\n -- set value for clue clickers\n CLUE_CLICKER.call(\"updateVal\", clueCount)\n\n -- move clue counters up\n clickerPos.y = 1.52\n CLUE_CLICKER.setPosition(clickerPos)\n else\n -- current clue count\n clueCount = CLUE_CLICKER.getVar(\"val\")\n\n -- move clue counters down\n clickerPos.y = 1.3\n CLUE_CLICKER.setPosition(clickerPos)\n\n -- spawn clues\n local pos = self.positionToWorld({x = -1.12, y = 0.05, z = 0.7})\n for i = 1, clueCount do\n pos.y = pos.y + 0.045 * i\n tokenManager.spawnToken(pos, \"clue\", self.getRotation())\n end\n end\nend\n\n-- removes all clues (moving tokens to the trash and setting counters to 0)\nfunction removeClues()\n local CLUE_COUNTER = getObjectFromGUID(CLUE_COUNTER_GUID)\n local CLUE_CLICKER = getObjectFromGUID(CLUE_CLICKER_GUID)\n\n CLUE_COUNTER.call(\"removeAllClues\")\n CLUE_CLICKER.call(\"updateVal\", 0)\nend\n\n-- reports the clue count\n---@param useClickableCounters Boolean Controls which type of counter is getting checked\nfunction getClueCount(useClickableCounters)\n local count = 0\n\n if useClickableCounters then\n local CLUE_CLICKER = getObjectFromGUID(CLUE_CLICKER_GUID)\n count = tonumber(CLUE_CLICKER.getVar(\"val\"))\n else\n local CLUE_COUNTER = getObjectFromGUID(CLUE_COUNTER_GUID)\n count = tonumber(CLUE_COUNTER.getVar(\"exposedValue\"))\n end\n return count\nend\n\n-- Sets this playermat's snap points to limit snapping to matching card types or not. If matchTypes\n-- is true, the main card slot snap points will only snap assets, while the investigator area point\n-- will only snap Investigators. If matchTypes is false, snap points will be reset to snap all\n-- cards.\n---@param matchTypes Boolean. Whether snap points should only snap for the matching card types.\nfunction setLimitSnapsByType(matchTypes)\n local snaps = self.getSnapPoints()\n for i, snap in ipairs(snaps) do\n local snapPos = snap.position\n if inArea(snapPos, MAIN_PLAY_AREA) then\n local snapTags = snaps[i].tags\n if matchTypes then\n if snapTags == nil then\n snaps[i].tags = { \"Asset\" }\n else\n table.insert(snaps[i].tags, \"Asset\")\n end\n else\n snaps[i].tags = nil\n end\n end\n if inArea(snapPos, INVESTIGATOR_AREA) then\n local snapTags = snaps[i].tags\n if matchTypes then\n if snapTags == nil then\n snaps[i].tags = { \"Investigator\" }\n else\n table.insert(snaps[i].tags, \"Investigator\")\n end\n else\n snaps[i].tags = nil\n end\n end\n end\n self.setSnapPoints(snaps)\nend\n\n-- Simple method to check if the given point is in a specified area. Local use only,\n---@param point Vector Point to check, only x and z values are relevant\n---@param bounds Table Defined area to see if the point is within. See MAIN_PLAY_AREA for sample\n-- bounds definition.\n---@return Boolean True if the point is in the area defined by bounds\nfunction inArea(point, bounds)\n return (point.x \u003c bounds.upperLeft.x\n and point.x \u003e bounds.lowerRight.x\n and point.z \u003c bounds.upperLeft.z\n and point.z \u003e bounds.lowerRight.z)\nend\n\n-- called by custom data helpers to add player card data\n---@param args table Contains only one entry, the GUID of the custom data helper\nfunction updatePlayerCards(args)\n local customDataHelper = getObjectFromGUID(args[1])\n local playerCardData = customDataHelper.getTable(\"PLAYER_CARD_DATA\")\n tokenManager.addPlayerCardData(playerCardData)\nend\n\n-- utility function for rounding\n---@param num Number Initial value\n---@param numDecimalPlaces Number Amount of decimal places\nfunction round(num, numDecimalPlaces)\n local mult = 10^(numDecimalPlaces or 0)\n return math.floor(num * mult + 0.5) / mult\nend\nend)\n__bundle_register(\"core/MythosAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local MythosAreaApi = {}\n local MYTHOS_AREA_GUID = \"9f334f\"\n\n -- returns the chaos token metadata (if provided through scenario reference card)\n MythosAreaApi.returnTokenData = function()\n return getObjectFromGUID(MYTHOS_AREA_GUID).call(\"returnTokenData\")\n end\n\n -- draw an encounter card to the requested position/rotation\n MythosAreaApi.drawEncounterCard = function(pos, rotY, alwaysFaceUp)\n getObjectFromGUID(MYTHOS_AREA_GUID).call(\"drawEncounterCard\", {\n pos = pos,\n rotY = rotY,\n alwaysFaceUp = alwaysFaceUp\n })\n end\n\n return MythosAreaApi\nend\nend)\n__bundle_register(\"core/NavigationOverlayApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local NavigationOverlayApi = {}\n local HANDLER_GUID = \"797ede\"\n\n -- Copies the visibility for the Navigation overlay\n ---@param startColor String Color of the player to copy from\n ---@param targetColor String Color of the targeted player\n NavigationOverlayApi.copyVisibility = function(startColor, targetColor)\n getObjectFromGUID(HANDLER_GUID).call(\"copyVisibility\", {\n startColor = startColor,\n targetColor = targetColor\n })\n end\n\n -- Changes the Navigation Overlay view (\"Full View\" --\u003e \"Play Areas\" --\u003e \"Closed\" etc.)\n ---@param playerColor String Color of the player to update the visibility for\n NavigationOverlayApi.cycleVisibility = function(playerColor)\n getObjectFromGUID(HANDLER_GUID).call(\"cycleVisibility\", playerColor)\n end\n\n return NavigationOverlayApi\nend\nend)\n__bundle_register(\"core/token/TokenChecker\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local CHAOS_TOKEN_NAMES = {\n [\"Elder Sign\"] = true,\n [\"+1\"] = true,\n [\"0\"] = true,\n [\"-1\"] = true,\n [\"-2\"] = true,\n [\"-3\"] = true,\n [\"-4\"] = true,\n [\"-5\"] = true,\n [\"-6\"] = true,\n [\"-7\"] = true,\n [\"-8\"] = true,\n [\"Skull\"] = true,\n [\"Cultist\"] = true,\n [\"Tablet\"] = true,\n [\"Elder Thing\"] = true,\n [\"Auto-fail\"] = true,\n [\"Bless\"] = true,\n [\"Curse\"] = true,\n [\"Frost\"] = true\n }\n\n local TokenChecker = {}\n\n -- returns true if the passed object is a chaos token (by name)\n TokenChecker.isChaosToken = function(obj)\n if CHAOS_TOKEN_NAMES[obj.getName()] then\n return true\n else\n return false\n end\n end\n\n return TokenChecker\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/OptionPanelApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local OptionPanelApi = {}\n\n -- loads saved options\n ---@param options Table New options table\n OptionPanelApi.loadSettings = function(options)\n return Global.call(\"loadSettings\", options)\n end\n\n -- returns option panel table\n OptionPanelApi.getOptions = function()\n return Global.getTable(\"optionPanel\")\n end\n\n return OptionPanelApi\nend\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = { }\n local PLAY_AREA_GUID = \"721ba2\"\n local INVESTIGATOR_COUNTER_GUID = \"f182ee\"\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with\n -- 'displacement_excluded'\n ---@param playerColor Color of the player requesting the shift. Used solely to send an error\n --- message in the unlikely case that the scripting zone has been deleted\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"tryObjectEnterContainer\",\n { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightCountedVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\n__bundle_register(\"core/token/TokenSpawnTrackerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenSpawnTracker = { }\n local SPAWN_TRACKER_GUID = \"e3ffc9\"\n\n TokenSpawnTracker.hasSpawnedTokens = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"hasSpawnedTokens\", cardGuid)\n end\n\n TokenSpawnTracker.markTokensSpawned = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"markTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetTokensSpawned = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetAllAssetAndEvents = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAllAssetAndEvents\")\n end\n\n TokenSpawnTracker.resetAllLocations = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAllLocations\")\n end\n\n TokenSpawnTracker.resetAll = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAll\")\n end\n\n return TokenSpawnTracker\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/token/TokenChecker\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local CHAOS_TOKEN_NAMES = {\n [\"Elder Sign\"] = true,\n [\"+1\"] = true,\n [\"0\"] = true,\n [\"-1\"] = true,\n [\"-2\"] = true,\n [\"-3\"] = true,\n [\"-4\"] = true,\n [\"-5\"] = true,\n [\"-6\"] = true,\n [\"-7\"] = true,\n [\"-8\"] = true,\n [\"Skull\"] = true,\n [\"Cultist\"] = true,\n [\"Tablet\"] = true,\n [\"Elder Thing\"] = true,\n [\"Auto-fail\"] = true,\n [\"Bless\"] = true,\n [\"Curse\"] = true,\n [\"Frost\"] = true\n }\n\n local TokenChecker = {}\n\n -- returns true if the passed object is a chaos token (by name)\n TokenChecker.isChaosToken = function(obj)\n if CHAOS_TOKEN_NAMES[obj.getName()] then\n return true\n else\n return false\n end\n end\n\n return TokenChecker\nend\nend)\n__bundle_register(\"core/token/TokenManager\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n local optionPanelApi = require(\"core/OptionPanelApi\")\n local playAreaApi = require(\"core/PlayAreaApi\")\n local tokenSpawnTrackerApi = require(\"core/token/TokenSpawnTrackerApi\")\n\n local PLAYER_CARD_TOKEN_OFFSETS = {\n [1] = {\n Vector(0, 3, -0.2)\n },\n [2] = {\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [3] = {\n Vector(0, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [4] = {\n Vector(0.4, 3, -0.9),\n Vector(-0.4, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [5] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [6] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2)\n },\n [7] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0, 3, 0.5)\n },\n [8] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(-0.35, 3, 0.5),\n Vector(0.35, 3, 0.5)\n },\n [9] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5)\n },\n [10] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0, 3, 1.2)\n },\n [11] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(-0.35, 3, 1.2),\n Vector(0.35, 3, 1.2)\n },\n [12] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0.7, 3, 1.2),\n Vector(0, 3, 1.2),\n Vector(-0.7, 3, 1.2)\n }\n }\n\n -- stateIDs for the multi-stated resource tokens\n local stateTable = {\n [\"resource\"] = 1,\n [\"ammo\"] = 2,\n [\"bounty\"] = 3,\n [\"charge\"] = 4,\n [\"evidence\"] = 5,\n [\"secret\"] = 6,\n [\"supply\"] = 7\n }\n\n -- Table of data extracted from the token source bag, keyed by the Memo on each token which\n -- should match the token type keys (\"resource\", \"clue\", etc)\n local tokenTemplates\n\n local playerCardData\n local locationData\n\n local TokenManager = { }\n local internal = { }\n\n -- Spawns tokens for the card. This function is built to just throw a card at it and let it do\n -- the work once a card has hit an area where it might spawn tokens. It will check to see if\n -- the card has already spawned, find appropriate data from either the uses metadata or the Data\n -- Helper, and spawn the tokens.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n TokenManager.spawnForCard = function(card, extraUses)\n if tokenSpawnTrackerApi.hasSpawnedTokens(card.getGUID()) then\n return\n end\n local metadata = JSON.decode(card.getGMNotes())\n if metadata ~= nil then\n internal.spawnTokensFromUses(card, extraUses)\n else\n internal.spawnTokensFromDataHelper(card)\n end\n end\n\n -- Spawns a set of tokens on the given card.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String Type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param tokenCount Number How many tokens to spawn. For damage or horror this value will be set to the\n -- spawned state object rather than spawning multiple tokens\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnTokenGroup = function(card, tokenType, tokenCount, shiftDown, subType)\n local optionPanel = optionPanelApi.getOptions()\n\n if tokenType == \"damage\" or tokenType == \"horror\" then\n TokenManager.spawnCounterToken(card, tokenType, tokenCount, shiftDown)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"enabled\" then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"custom\" and tokenCount == 0 then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n else\n TokenManager.spawnMultipleTokens(card, tokenType, tokenCount, shiftDown, subType)\n end\n end\n\n -- Spawns a single counter token and sets the value to tokenValue. Used for damage and horror\n -- tokens.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String type of token to spawn, valid values are \"damage\" and \"horror\". Other\n -- types should use spawnMultipleTokens()\n ---@param tokenValue Number Value to set the damage/horror to\n TokenManager.spawnCounterToken = function(card, tokenType, tokenValue, shiftDown)\n if tokenValue \u003c 1 or tokenValue \u003e 50 then return end\n\n local pos = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[1][1] + Vector(0, 0, shiftDown))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, tokenType, rot, function(spawned) spawned.setState(tokenValue) end)\n end\n\n TokenManager.spawnResourceCounterToken = function(card, tokenCount)\n local pos = card.positionToWorld(card.positionToLocal(card.getPosition()) + Vector(0, 0.2, -0.5))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, \"resourceCounter\", rot, function(spawned)\n spawned.call(\"updateVal\", tokenCount)\n end)\n end\n\n -- Spawns a number of tokens.\n ---@param tokenType String type of token to spawn, valid values are resource\", \"doom\", or \"clue\".\n -- Other types should use spawnCounterToken()\n ---@param tokenCount Number How many tokens to spawn\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnMultipleTokens = function(card, tokenType, tokenCount, shiftDown, subType)\n -- not checking the max at this point since clue offsets are calculated dynamically\n if tokenCount \u003c 1 then return end\n\n local offsets = {}\n if tokenType == \"clue\" then\n offsets = internal.buildClueOffsets(card, tokenCount)\n else\n -- only up to 12 offset tables defined\n if tokenCount \u003e 12 then return end\n for i = 1, tokenCount do\n offsets[i] = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[tokenCount][i])\n -- Fix the y-position for the spawn, since positionToWorld considers rotation which can\n -- have bad results for face up/down differences\n offsets[i].y = card.getPosition().y + 0.15\n end\n end\n\n if shiftDown ~= nil then\n -- Copy the offsets to make sure we don't change the static values\n local baseOffsets = offsets\n offsets = { }\n\n -- get a vector for the shifting (downwards local to the card)\n local shiftDownVector = Vector(0, 0, shiftDown):rotateOver(\"y\", card.getRotation().y)\n for i, baseOffset in ipairs(baseOffsets) do\n offsets[i] = baseOffset + shiftDownVector\n end\n end\n\n if offsets == nil then\n error(\"couldn't find offsets for \" .. tokenCount .. ' tokens')\n return\n end\n\n -- handling for not provided subtype (for example when spawning from custom data helpers)\n if subType == nil then\n subType = \"\"\n end\n \n -- this is used to load the correct state for additional resource tokens (e.g. \"Ammo\")\n local callback = nil\n local stateID = stateTable[string.lower(subType)]\n if tokenType == \"resource\" and stateID ~= nil and stateID ~= 1 then\n callback = function(spawned) spawned.setState(stateID) end\n end\n\n for i = 1, tokenCount do\n TokenManager.spawnToken(offsets[i], tokenType, card.getRotation(), callback)\n end\n end\n\n -- Spawns a single token at the given global position by copying it from the template bag.\n ---@param position Global position to spawn the token\n ---@param tokenType String type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param rotation Vector Rotation to be used for the new token. Only the y-value will be used,\n -- x and z will use the default rotation from the source bag\n ---@param callback function A callback function triggered after the new token is spawned\n TokenManager.spawnToken = function(position, tokenType, rotation, callback)\n internal.initTokenTemplates()\n local loadTokenType = tokenType\n if tokenType == \"clue\" or tokenType == \"doom\" then\n loadTokenType = \"clueDoom\"\n end\n if tokenTemplates[loadTokenType] == nil then\n error(\"Unknown token type '\" .. tokenType .. \"'\")\n return\n end\n local tokenTemplate = tokenTemplates[loadTokenType]\n\n -- Take ONLY the Y-value for rotation, so we don't flip the token coming out of the bag\n local rot = Vector(tokenTemplate.Transform.rotX,\n 270,\n tokenTemplate.Transform.rotZ)\n if rotation ~= nil then\n rot.y = rotation.y\n end\n if tokenType == \"doom\" then\n rot.z = 180\n end\n\n tokenTemplate.Nickname = \"\"\n return spawnObjectData({\n data = tokenTemplate,\n position = position,\n rotation = rot,\n callback_function = callback\n })\n end\n\n -- Checks a card for metadata to maybe replenish it\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n TokenManager.maybeReplenishCard = function(card, uses, mat)\n -- TODO: support for cards with multiple uses AND replenish (as of yet, no official card needs that)\n if uses[1].count and uses[1].replenish then\n internal.replenishTokens(card, uses, mat)\n end\n end\n\n -- Delegate function to the token spawn tracker. Exists to avoid circular dependencies in some\n -- callers.\n ---@param card Object Card object to reset the tokens for\n TokenManager.resetTokensSpawned = function(card)\n tokenSpawnTrackerApi.resetTokensSpawned(card.getGUID())\n end\n\n -- Pushes new player card data into the local copy of the Data Helper player data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addPlayerCardData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n playerCardData[k] = v\n end\n end\n\n -- Pushes new location data into the local copy of the Data Helper location data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addLocationData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n locationData[k] = v\n end\n end\n\n -- Checks to see if the given card has location data in the DataHelper\n ---@param card Object Card to check for data\n ---@return Boolean True if this card has data in the helper, false otherwise\n TokenManager.hasLocationData = function(card)\n internal.initDataHelperData()\n return internal.getLocationData(card) ~= nil\n end\n\n internal.initTokenTemplates = function()\n if tokenTemplates ~= nil then\n return\n end\n tokenTemplates = {}\n local tokenSource = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenSource\")\n for _, tokenTemplate in ipairs(tokenSource.getData().ContainedObjects) do\n local tokenName = tokenTemplate.Memo\n tokenTemplates[tokenName] = tokenTemplate\n end\n end\n\n -- Copies the data from the DataHelper. Will only happen once.\n internal.initDataHelperData = function()\n if playerCardData ~= nil then\n return\n end\n local dataHelper = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"DataHelper\")\n playerCardData = dataHelper.getTable('PLAYER_CARD_DATA')\n locationData = dataHelper.getTable('LOCATIONS_DATA')\n end\n\n -- Spawn tokens for a card based on the uses metadata. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n internal.spawnTokensFromUses = function(card, extraUses)\n local uses = internal.getUses(card)\n if uses == nil then return end\n\n -- go through tokens to spawn\n local tokenCount\n for i, useInfo in ipairs(uses) do\n tokenCount = (useInfo.count or 0) + (useInfo.countPerInvestigator or 0) * playAreaApi.getInvestigatorCount()\n if extraUses ~= nil and extraUses[useInfo.type] ~= nil then\n tokenCount = tokenCount + extraUses[useInfo.type]\n end\n -- Shift each spawned group after the first down so they don't pile on each other\n TokenManager.spawnTokenGroup(card, useInfo.token, tokenCount, (i - 1) * 0.8, useInfo.type)\n end\n \n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a card based on the data helper data. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n internal.spawnTokensFromDataHelper = function(card)\n internal.initDataHelperData()\n local playerData = internal.getPlayerCardData(card)\n if playerData ~= nil then\n internal.spawnPlayerCardTokensFromDataHelper(card, playerData)\n end\n local locationData = internal.getLocationData(card)\n if locationData ~= nil then\n internal.spawnLocationTokensFromDataHelper(card, locationData)\n end\n end\n\n -- Spawn tokens for a player card using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Player card data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnPlayerCardTokensFromDataHelper = function(card, playerData)\n local token = playerData.tokenType\n local tokenCount = playerData.tokenCount\n TokenManager.spawnTokenGroup(card, token, tokenCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a location using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Location data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnLocationTokensFromDataHelper = function(card, locationData)\n local clueCount = internal.getClueCountFromData(card, locationData)\n if clueCount \u003e 0 then\n TokenManager.spawnTokenGroup(card, \"clue\", clueCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n end\n\n internal.getPlayerCardData = function(card)\n return playerCardData[card.getName() .. ':' .. card.getDescription()]\n or playerCardData[card.getName()]\n end\n\n internal.getLocationData = function(card)\n return locationData[card.getName() .. '_' .. card.getGUID()] or locationData[card.getName()]\n end\n\n internal.getClueCountFromData = function(card, locationData)\n -- Return the number of clues to spawn on this location\n if locationData == nil then\n error('attempted to get clue for unexpected object: ' .. card.getName())\n return 0\n end\n\n if ((card.is_face_down and locationData.clueSide == 'back')\n or (not card.is_face_down and locationData.clueSide == 'front')) then\n if locationData.type == 'fixed' then\n return locationData.value\n elseif locationData.type == 'perPlayer' then\n return locationData.value * playAreaApi.getInvestigatorCount()\n end\n error('unexpected location type: ' .. locationData.type)\n end\n return 0\n end\n\n -- Gets the right uses structure for this card, based on metadata and face up/down state\n ---@param card Object Card to pull the uses from\n internal.getUses = function(card)\n local metadata = JSON.decode(card.getGMNotes()) or { }\n if metadata.type == \"Location\" then\n if card.is_face_down and metadata.locationBack ~= nil then\n return metadata.locationBack.uses\n elseif not card.is_face_down and metadata.locationFront ~= nil then\n return metadata.locationFront.uses\n end\n elseif not card.is_face_down then\n return metadata.uses\n end\n\n return nil\n end\n\n -- Dynamically create positions for clues on a card.\n ---@param card Object Card the clues will be placed on\n ---@param count Integer How many clues?\n ---@return Table Array of global positions to spawn the clues at\n internal.buildClueOffsets = function(card, count)\n local pos = card.getPosition()\n local cluePositions = { }\n for i = 1, count do\n local row = math.floor(1 + (i - 1) / 4)\n local column = (i - 1) % 4\n table.insert(cluePositions, Vector(pos.x + 1.5 - 0.55 * row, pos.y + 0.15, pos.z - 0.825 + 0.55 * column))\n end\n return cluePositions\n end\n\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n internal.replenishTokens = function(card, uses, mat)\n local cardPos = card.getPosition()\n\n -- don't continue for cards on the deck (Norman) or in the discard pile\n if mat.positionToLocal(cardPos).x \u003c -1 then return end\n\n -- get current amount of resource tokens on the card\n local search = internal.searchOnCard(cardPos, card.getRotation())\n local clickableResourceCounter = nil\n local foundTokens = 0\n\n for _, obj in ipairs(search) do\n local obj = obj.hit_object\n local memo = obj.getMemo()\n\n if (stateTable[memo] or 0) \u003e 0 then\n foundTokens = foundTokens + math.abs(obj.getQuantity())\n obj.destruct()\n elseif memo == \"resourceCounter\" then\n foundTokens = obj.getVar(\"val\")\n clickableResourceCounter = obj\n break\n end\n end\n\n -- this is the theoretical new amount of uses (to be checked below)\n local newCount = foundTokens + uses[1].replenish\n\n -- if there are already more uses than the replenish amount, keep them\n if foundTokens \u003e uses[1].count then\n newCount = foundTokens\n -- only replenish up until the replenish amount\n elseif newCount \u003e uses[1].count then\n newCount = uses[1].count\n end\n\n -- update the clickable counter or spawn a group of tokens\n if clickableResourceCounter then\n clickableResourceCounter.call(\"updateVal\", newCount)\n else\n TokenManager.spawnTokenGroup(card, uses[1].token, newCount, _, uses[1].type)\n end\n end\n\n -- searches on a card (standard size) and returns the result\n ---@param position Table Position of the card\n ---@param rotation Table Rotation of the card\n internal.searchOnCard = function(position, rotation)\n return Physics.cast({\n origin = position,\n direction = {0, 1, 0},\n orientation = rotation,\n type = 3,\n size = { 2.5, 0.5, 3.5 },\n max_distance = 1,\n debug = false\n })\n end\n\n return TokenManager\nend\nend)\n__bundle_register(\"core/token/TokenSpawnTrackerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenSpawnTracker = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getSpawnTracker()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenSpawnTracker\")\n end\n\n TokenSpawnTracker.hasSpawnedTokens = function(cardGuid)\n return getSpawnTracker().call(\"hasSpawnedTokens\", cardGuid)\n end\n\n TokenSpawnTracker.markTokensSpawned = function(cardGuid)\n return getSpawnTracker().call(\"markTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetTokensSpawned = function(cardGuid)\n return getSpawnTracker().call(\"resetTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetAllAssetAndEvents = function()\n return getSpawnTracker().call(\"resetAllAssetAndEvents\")\n end\n\n TokenSpawnTracker.resetAllLocations = function()\n return getSpawnTracker().call(\"resetAllLocations\")\n end\n\n TokenSpawnTracker.resetAll = function()\n return getSpawnTracker().call(\"resetAll\")\n end\n\n return TokenSpawnTracker\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"core/MythosAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local MythosAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getMythosArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"MythosArea\")\n end\n\n -- returns the chaos token metadata (if provided through scenario reference card)\n MythosAreaApi.returnTokenData = function()\n return getMythosArea().call(\"returnTokenData\")\n end\n \n -- returns an object reference to the encounter deck\n MythosAreaApi.getEncounterDeck = function()\n return getMythosArea().call(\"getEncounterDeck\")\n end\n\n -- draw an encounter card to the requested position/rotation\n MythosAreaApi.drawEncounterCard = function(pos, rotY, alwaysFaceUp)\n getMythosArea().call(\"drawEncounterCard\", {\n pos = pos,\n rotY = rotY,\n alwaysFaceUp = alwaysFaceUp\n })\n end\n\n return MythosAreaApi\nend\nend)\n__bundle_register(\"core/OptionPanelApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local OptionPanelApi = {}\n\n -- loads saved options\n ---@param options Table New options table\n OptionPanelApi.loadSettings = function(options)\n return Global.call(\"loadSettings\", options)\n end\n\n -- returns option panel table\n OptionPanelApi.getOptions = function()\n return Global.getTable(\"optionPanel\")\n end\n\n return OptionPanelApi\nend\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getPlayArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"PlayArea\")\n end\n\n local function getInvestigatorCounter()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"InvestigatorCounter\")\n end\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getInvestigatorCounter().getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n getInvestigatorCounter().call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with 'displacement_excluded'\n ---@param playerColor Color Color of the player requesting the shift for messages\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getPlayArea().call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getPlayArea().call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getPlayArea().call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getPlayArea().call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getPlayArea().call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getPlayArea().call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getPlayArea().call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getPlayArea().call(\"tryObjectEnterContainer\", { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getPlayArea().call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getPlayArea().call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getPlayArea().call(\"countVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getPlayArea().call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getPlayArea().getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getPlayArea().call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getPlayArea().call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getPlayArea().getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playermat/Playmat\")\nend)\n__bundle_register(\"playermat/Playmat\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal guidReferenceApi = require(\"core/GUIDReferenceApi\")\nlocal mythosAreaApi = require(\"core/MythosAreaApi\")\nlocal navigationOverlayApi = require(\"core/NavigationOverlayApi\")\nlocal tokenChecker = require(\"core/token/TokenChecker\")\nlocal tokenManager = require(\"core/token/TokenManager\")\n\n-- set true to enable debug logging and show Physics.cast()\nlocal DEBUG = false\n\n-- we use this to turn off collision handling until onLoad() is complete\nlocal collisionEnabled = false\n\n-- position offsets relative to mat [x, y, z]\nlocal DRAWN_ENCOUNTER_CARD_OFFSET = {1.365, 0.5, -0.625}\nlocal DRAWN_CHAOS_TOKEN_OFFSET = {-1.55, 0.25, -0.58}\n\n-- x-Values for discard buttons\nlocal DISCARD_BUTTON_OFFSETS = {-1.365, -0.91, -0.455, 0, 0.455, 0.91}\n\nlocal SEARCH_AROUND_SELF_X_BUFFER = 8\n\n-- defined areas for \"inArea()\" and \"Physics.cast()\"\nlocal MAIN_PLAY_AREA = {\n upperLeft = {\n x = 1.98,\n z = 0.736\n },\n lowerRight = {\n x = -0.79,\n z = -0.39\n }\n}\nlocal INVESTIGATOR_AREA = {\n upperLeft = {\n x = -1.084,\n z = 0.06517\n },\n lowerRight = {\n x = -1.258,\n z = -0.0805\n }\n}\nlocal THREAT_AREA = {\n upperLeft = {\n x = 1.53,\n z = -0.34\n },\n lowerRight = {\n x = -1.13,\n z = -0.92\n }\n}\nlocal DECK_DISCARD_AREA = {\n upperLeft = {\n x = -1.62,\n z = 0.855\n },\n lowerRight = {\n x = -2.02,\n z = -0.245\n },\n center = {\n x = -1.82,\n y = 0.5,\n z = 0.305\n },\n size = {\n x = 0.4,\n y = 3,\n z = 1.1\n }\n}\n\n-- local position of draw and discard pile\nlocal DRAW_DECK_POSITION = { x = -1.82, y = 0.1, z = 0 }\nlocal DISCARD_PILE_POSITION = { x = -1.82, y = 0.1, z = 0.61 }\n\n-- global position of encounter discard pile\nlocal ENCOUNTER_DISCARD_POSITION = { x = -3.85, y = 1.5, z = 10.38}\n\n-- global variable so it can be reset by the Clean Up Helper\nactiveInvestigatorId = \"00000\"\n\n-- table of type-object reference pairs of all owned objects\nlocal ownedObjects = {}\nlocal matColor = self.getMemo()\n\n-- variable to track the status of the \"Show Draw Button\" option\nlocal isDrawButtonVisible = false\n\n-- global variable to report \"Dream-Enhancing Serum\" status\nisDES = false\n\nfunction onSave()\n return JSON.encode({\n playerColor = playerColor,\n activeInvestigatorId = activeInvestigatorId,\n isDrawButtonVisible = isDrawButtonVisible\n })\nend\n\nfunction onLoad(saveState)\n self.interactable = DEBUG\n\n -- get object references to owned objects\n ownedObjects = guidReferenceApi.getObjectsByOwner(matColor)\n\n -- button creation\n for i = 1, 6 do\n makeDiscardButton(DISCARD_BUTTON_OFFSETS[i], i)\n end\n\n self.createButton({\n click_function = \"drawEncounterCard\",\n function_owner = self,\n position = {-1.84, 0, -0.65},\n rotation = {0, 80, 0},\n width = 265,\n height = 190\n })\n\n self.createButton({\n click_function = \"drawChaosTokenButton\",\n function_owner = self,\n position = {1.85, 0, -0.74},\n rotation = {0, -45, 0},\n width = 135,\n height = 135\n })\n\n self.createButton({\n label = \"Upkeep\",\n click_function = \"doUpkeep\",\n function_owner = self,\n position = {1.84, 0.1, -0.44},\n scale = {0.12, 0.12, 0.12},\n width = 800,\n height = 280,\n font_size = 180\n })\n\n -- save state loading\n local state = JSON.decode(saveState)\n if state ~= nil then\n playerColor = state.playerColor\n activeInvestigatorId = state.activeInvestigatorId\n isDrawButtonVisible = state.isDrawButtonVisible\n end\n\n showDrawButton(isDrawButtonVisible)\n collisionEnabled = true\n math.randomseed(os.time())\nend\n\n---------------------------------------------------------\n-- utility functions\n---------------------------------------------------------\n\n-- searches an area and optionally filters the result\nfunction searchArea(origin, size, filter)\n local searchResult = Physics.cast({\n origin = origin,\n direction = { 0, 1, 0 },\n orientation = self.getRotation(),\n type = 3,\n size = size,\n max_distance = 0\n })\n\n local objList = {}\n for _, v in ipairs(searchResult) do\n if not filter or (filter and filter(v.hit_object)) then\n table.insert(objList, v.hit_object)\n end\n end\n return objList\nend\n\n-- filter functions for searchArea()\nfunction isCard(x) return x.type == 'Card' end\nfunction isDeck(x) return x.type == 'Deck' end\nfunction isCardOrDeck(x) return x.type == 'Card' or x.type == 'Deck' end\n\n-- finds all objects on the playmat and associated set aside zone.\nfunction searchAroundSelf(filter)\n local bounds = self.getBoundsNormalized()\n -- Increase the width to cover the set aside zone\n bounds.size.x = bounds.size.x + SEARCH_AROUND_SELF_X_BUFFER\n bounds.size.y = 1\n -- Since the cast is centered on the position, shift left or right to keep the non-set aside edge\n -- of the cast at the edge of the playmat\n -- setAsideDirection accounts for the set aside zone being on the left or right, depending on the\n -- table position of the playmat\n local setAsideDirection = bounds.center.z \u003e 0 and 1 or -1\n local localCenter = self.positionToLocal(bounds.center)\n localCenter.x = localCenter.x + setAsideDirection * SEARCH_AROUND_SELF_X_BUFFER / 2 / self.getScale().x\n return searchArea(self.positionToWorld(localCenter), bounds.size, filter)\nend\n\n-- searches the area around the draw deck and discard pile\nfunction searchDeckAndDiscardArea(filter)\n local pos = self.positionToWorld(DECK_DISCARD_AREA.center)\n local scale = self.getScale()\n local size = {\n x = DECK_DISCARD_AREA.size.x * scale.x,\n y = DECK_DISCARD_AREA.size.y, \n z = DECK_DISCARD_AREA.size.z * scale.z\n }\n return searchArea(pos, size, filter)\nend\n\nfunction doNotReady(card)\n return card.getVar(\"do_not_ready\") or false\nend\n\n-- rounds a number to the specified amount of decimal places\n---@param num Number Initial value\n---@param numDecimalPlaces Number Amount of decimal places\nfunction round(num, numDecimalPlaces)\n local mult = 10^(numDecimalPlaces or 0)\n return math.floor(num * mult + 0.5) / mult\nend\n\n---------------------------------------------------------\n-- Discard buttons\n---------------------------------------------------------\n\n-- handles discarding for a list of objects\n---@param objList Table List of objects to discard\nfunction discardListOfObjects(objList)\n for _, obj in ipairs(objList) do\n if isCardOrDeck(obj) then\n if obj.hasTag(\"PlayerCard\") then\n placeOrMergeIntoDeck(obj, returnGlobalDiscardPosition(), self.getRotation())\n else\n placeOrMergeIntoDeck(obj, ENCOUNTER_DISCARD_POSITION, {x = 0, y = -90, z = 0})\n end\n -- put chaos tokens back into bag (e.g. Unrelenting)\n elseif tokenChecker.isChaosToken(obj) then\n local chaosBag = chaosBagApi.findChaosBag()\n chaosBag.putObject(obj)\n -- don't touch locked objects (like the table etc.)\n elseif not obj.getLock() then\n ownedObjects.Trash.putObject(obj)\n end\n end\nend\n\n-- places a card/deck at a position or merges into an existing deck\n-- rotation is optional\nfunction placeOrMergeIntoDeck(obj, pos, rot)\n if not pos then return end\n\n local offset = 0.5\n \n -- search the new position for existing card/deck\n local searchResult = searchArea(pos, { 1, 1, 1 }, isCardOrDeck)\n\n -- get new position\n local newPos\n if #searchResult == 1 then\n local bounds = searchResult[1].getBounds()\n newPos = Vector(pos):setAt(\"y\", bounds.center.y + bounds.size.y / 2 + offset)\n else\n newPos = Vector(pos) + Vector(0, offset, 0)\n end\n\n -- allow moving the objects smoothly out of the hand\n obj.use_hands = false\n\n if rot then\n obj.setRotationSmooth(rot, false, true)\n end\n obj.setPositionSmooth(newPos, false, true)\n\n -- continue if the card stops smooth moving\n Wait.condition(\n function()\n obj.use_hands = true\n -- this avoids a TTS bug that merges unrelated cards that are not resting\n if #searchResult == 1 and searchResult[1] ~= obj then\n -- call this with avoiding errors (physics is sometimes too fast so the object doesn't exist for the put)\n pcall(function() searchResult[1].putObject(obj) end)\n end\n end,\n function() return not obj.isSmoothMoving() end, 3)\nend\n\n-- build a discard button to discard from searchPosition (number must be unique)\nfunction makeDiscardButton(xValue, number)\n local position = { xValue, 0.1, -0.94}\n local searchPosition = {-position[1], position[2], position[3] + 0.32}\n local handlerName = 'handler' .. number\n self.setVar(handlerName, function()\n local cardSizeSearch = {2, 1, 3.2}\n local globalSearchPosition = self.positionToWorld(searchPosition)\n local searchResult = searchArea(globalSearchPosition, cardSizeSearch)\n return discardListOfObjects(searchResult)\n end)\n self.createButton({\n label = \"Discard\",\n click_function = handlerName,\n function_owner = self,\n position = position,\n scale = {0.12, 0.12, 0.12},\n width = 900,\n height = 350,\n font_size = 220\n })\nend\n\n---------------------------------------------------------\n-- Upkeep button\n---------------------------------------------------------\n\n-- calls the Upkeep function with correct parameter\nfunction doUpkeepFromHotkey(color)\n doUpkeep(_, color)\nend\n\nfunction doUpkeep(_, clickedByColor, isRightClick)\n -- right-click allow color changing\n if isRightClick then\n changeColor(clickedByColor)\n return\n end\n\n -- send messages to player who clicked button if no seated player found\n messageColor = Player[playerColor].seated and playerColor or clickedByColor\n\n -- unexhaust cards in play zone, flip action tokens and find forcedLearning\n local forcedLearning = false\n local rot = self.getRotation()\n for _, obj in ipairs(searchAroundSelf()) do\n if obj.getDescription() == \"Action Token\" and obj.is_face_down then\n obj.flip()\n elseif obj.type == \"Card\" and not inArea(self.positionToLocal(obj.getPosition()), INVESTIGATOR_AREA) then\n local cardMetadata = JSON.decode(obj.getGMNotes()) or {}\n if not doNotReady(obj) then\n local cardRotation = round(obj.getRotation().y, 0) - rot.y\n local yRotDiff = 0\n\n if cardRotation \u003c 0 then\n cardRotation = cardRotation + 360\n end\n\n -- rotate cards to the next multiple of 90° towards 0°\n if cardRotation \u003e 90 and cardRotation \u003c= 180 then\n yRotDiff = 90\n elseif cardRotation \u003c 270 and cardRotation \u003e 180 then\n yRotDiff = 270\n end\n\n -- set correct rotation for face-down cards\n rot.z = obj.is_face_down and 180 or 0\n obj.setRotation({rot.x, rot.y + yRotDiff, rot.z})\n end\n if cardMetadata.id == \"08031\" then\n forcedLearning = true\n end\n if cardMetadata.uses ~= nil then\n tokenManager.maybeReplenishCard(obj, cardMetadata.uses, self)\n end\n end\n end\n\n -- flip investigator mini-card and summoned servitor mini-card\n -- (all characters allowed to account for custom IDs - e.g. 'Z0000' for TTS Zoop generated IDs)\n if activeInvestigatorId ~= nil then\n local miniId = string.match(activeInvestigatorId, \".....\") .. \"-m\"\n for _, obj in ipairs(getObjects()) do\n if obj.type == \"Card\" and obj.is_face_down then\n local notes = JSON.decode(obj.getGMNotes())\n if notes ~= nil and notes.type == \"Minicard\" and (notes.id == miniId or notes.id == \"09080-m\") then\n obj.flip()\n end\n end\n end\n end\n\n -- gain a resource (or two if playing Jenny Barnes)\n if string.match(activeInvestigatorId, \"%d%d%d%d%d\") == \"02003\" then\n updateCounter({type = \"ResourceCounter\", modifier = 2})\n printToColor(\"Gaining 2 resources (Jenny)\", messageColor)\n else\n updateCounter({type = \"ResourceCounter\", modifier = 1})\n end\n\n -- draw a card (with handling for Patrice and Forced Learning)\n if activeInvestigatorId == \"06005\" then\n if forcedLearning then\n printToColor(\"Wow, did you really take 'Versatile' to play Patrice with 'Forced Learning'? Choose which draw replacement effect takes priority and draw cards accordingly.\", messageColor)\n else\n local handSize = #Player[playerColor].getHandObjects()\n if handSize \u003c 5 then\n local cardsToDraw = 5 - handSize\n printToColor(\"Drawing \" .. cardsToDraw .. \" cards (Patrice)\", messageColor)\n drawCardsWithReshuffle(cardsToDraw)\n end\n end\n elseif forcedLearning then\n printToColor(\"Drawing 2 cards, discard 1 (Forced Learning)\", messageColor)\n drawCardsWithReshuffle(2)\n elseif activeInvestigatorId == \"89001\" then\n printToColor(\"Drawing 2 cards (Subject 5U-21)\", messageColor)\n drawCardsWithReshuffle(2)\n else\n drawCardsWithReshuffle(1)\n end\nend\n\n-- function for \"draw 1 button\" (that can be added via option panel)\nfunction doDrawOne(_, color)\n -- send messages to player who clicked button if no seated player found\n messageColor = Player[playerColor].seated and playerColor or color\n drawCardsWithReshuffle(1)\nend\n\n-- draw X cards (shuffle discards if necessary)\nfunction drawCardsWithReshuffle(numCards)\n local deckAreaObjects = getDeckAreaObjects()\n\n -- Norman Withers handling\n local harbinger = false\n if deckAreaObjects.topCard and deckAreaObjects.topCard.getName() == \"The Harbinger\" then\n harbinger = true\n elseif deckAreaObjects.draw and not deckAreaObjects.draw.is_face_down then\n local cards = deckAreaObjects.draw.getObjects()\n if cards[#cards].name == \"The Harbinger\" then\n harbinger = true\n end\n end\n\n if harbinger then\n printToColor(\"The Harbinger is on top of your deck, not drawing cards\", messageColor)\n return\n end\n\n local topCardDetected = false\n if deckAreaObjects.topCard ~= nil then\n deckAreaObjects.topCard.deal(1, playerColor)\n topCardDetected = true\n numCards = numCards - 1\n if numCards == 0 then\n flipTopCardFromDeck()\n return\n end\n end\n\n local deckSize = 1\n if deckAreaObjects.draw == nil then\n deckSize = 0\n elseif deckAreaObjects.draw.type == \"Deck\" then\n deckSize = #deckAreaObjects.draw.getObjects()\n end\n\n if deckSize \u003e= numCards then\n drawCards(numCards)\n -- flip top card again for Norman\n if topCardDetected and string.match(activeInvestigatorId, \"%d%d%d%d%d\") == \"08004\" then\n flipTopCardFromDeck()\n end\n else\n drawCards(deckSize)\n if deckAreaObjects.discard ~= nil then\n shuffleDiscardIntoDeck()\n Wait.time(function()\n drawCards(numCards - deckSize)\n -- flip top card again for Norman\n if topCardDetected and string.match(activeInvestigatorId, \"%d%d%d%d%d\") == \"08004\" then\n flipTopCardFromDeck()\n end\n end, 1)\n end\n printToColor(\"Take 1 horror (drawing card from empty deck)\", messageColor)\n end\nend\n\n-- get the draw deck and discard pile objects and returns the references\nfunction getDeckAreaObjects()\n local deckAreaObjects = {}\n for _, object in ipairs(searchDeckAndDiscardArea(isCardOrDeck)) do\n if self.positionToLocal(object.getPosition()).z \u003e 0.5 then\n deckAreaObjects.discard = object\n -- Norman Withers handling\n elseif object.type == \"Card\" and not object.is_face_down then\n deckAreaObjects.topCard = object\n else\n deckAreaObjects.draw = object\n end\n end\n return deckAreaObjects\nend\n\nfunction drawCards(numCards)\n local deckAreaObjects = getDeckAreaObjects()\n if deckAreaObjects.draw then\n deckAreaObjects.draw.deal(numCards, playerColor)\n end\nend\n\nfunction shuffleDiscardIntoDeck()\n local deckAreaObjects = getDeckAreaObjects()\n if not deckAreaObjects.discard.is_face_down then\n deckAreaObjects.discard.flip()\n end\n deckAreaObjects.discard.shuffle()\n deckAreaObjects.discard.setPositionSmooth(self.positionToWorld(DRAW_DECK_POSITION), false, false)\nend\n\n-- utility function for Norman Withers to flip the top card to the revealed side\nfunction flipTopCardFromDeck()\n Wait.time(function()\n local deckAreaObjects = getDeckAreaObjects()\n if deckAreaObjects.topCard then\n return\n elseif deckAreaObjects.draw then\n if deckAreaObjects.draw.type == \"Card\" then\n deckAreaObjects.draw.flip()\n else\n -- get bounds to know the height of the deck\n local bounds = deckAreaObjects.draw.getBounds()\n local pos = bounds.center + Vector(0, bounds.size.y / 2 + 0.2, 0)\n deckAreaObjects.draw.takeObject({ position = pos, flip = true })\n end\n end\n end, 0.1)\nend\n\n-- discard a random non-hidden card from hand\nfunction doDiscardOne()\n local hand = Player[playerColor].getHandObjects()\n if #hand == 0 then\n broadcastToAll(\"Cannot discard from empty hand!\", \"Red\")\n else\n local choices = {}\n for i = 1, #hand do\n local notes = JSON.decode(hand[i].getGMNotes())\n if notes ~= nil then\n if notes.hidden ~= true then\n table.insert(choices, i)\n end\n else\n table.insert(choices, i)\n end\n end\n\n if #choices == 0 then\n broadcastToAll(\"Hidden cards can't be randomly discarded.\", \"Orange\")\n return\n end\n\n -- get a random non-hidden card (from the \"choices\" table)\n local num = math.random(1, #choices)\n placeOrMergeIntoDeck(hand[choices[num]], returnGlobalDiscardPosition(), self.getRotation())\n broadcastToAll(playerColor .. \" randomly discarded card \" .. choices[num] .. \"/\" .. #hand .. \".\", \"White\")\n end\nend\n\n---------------------------------------------------------\n-- color related functions\n---------------------------------------------------------\n\n-- changes the player color\nfunction changeColor(clickedByColor)\n local colorList = {\n \"White\",\n \"Brown\",\n \"Red\",\n \"Orange\",\n \"Yellow\",\n \"Green\",\n \"Teal\",\n \"Blue\",\n \"Purple\",\n \"Pink\"\n }\n\n -- remove existing colors from the list of choices\n for _, existingColor in ipairs(Player.getAvailableColors()) do\n for i, newColor in ipairs(colorList) do\n if existingColor == newColor then\n table.remove(colorList, i)\n end\n end\n end\n\n -- show the option dialog for color selection to the player that triggered this\n Player[clickedByColor].showOptionsDialog(\"Select a new color:\", colorList, _, function(color)\n -- update the color of the hand zone\n local handZone = ownedObjects.HandZone\n handZone.setValue(color)\n\n -- if the seated player clicked this, reseat him to the new color\n if clickedByColor == playerColor then\n navigationOverlayApi.copyVisibility(playerColor, color)\n Player[playerColor].changeColor(color)\n end\n\n -- update the internal variable\n playerColor = color\n end)\nend\n\n---------------------------------------------------------\n-- playmat token spawning\n---------------------------------------------------------\n\n-- Finds all customizable cards in this play area and updates their metadata based on the selections\n-- on the matching upgrade sheet.\n-- This method is theoretically O(n^2), and should be used sparingly. In practice it will only be\n-- called when a checkbox is added or removed in-game (which should be rare), and is bounded by the\n-- number of customizable cards in play.\nfunction syncAllCustomizableCards()\n for _, card in ipairs(searchAroundSelf(isCard)) do\n syncCustomizableMetadata(card)\n end\nend\n\nfunction syncCustomizableMetadata(card)\n local cardMetadata = JSON.decode(card.getGMNotes()) or { }\n if cardMetadata == nil or cardMetadata.customizations == nil then\n return\n end\n for _, upgradeSheet in ipairs(searchAroundSelf(isCard)) do\n local upgradeSheetMetadata = JSON.decode(upgradeSheet.getGMNotes()) or { }\n if upgradeSheetMetadata.id == (cardMetadata.id .. \"-c\") then\n for i, customization in ipairs(cardMetadata.customizations) do\n if customization.replaces ~= nil and customization.replaces.uses ~= nil then\n -- Allowed use of call(), no APIs for individual cards\n if upgradeSheet.call(\"isUpgradeActive\", i) then\n cardMetadata.uses = customization.replaces.uses\n card.setGMNotes(JSON.encode(cardMetadata))\n else\n -- TODO: Get the original metadata to restore it... maybe. This should only be\n -- necessary in the very unlikely case that a user un-checks a previously-full upgrade\n -- row while the card is in play. It will be much easier once the AllPlayerCardsApi is\n -- in place, so defer until it is\n end\n end\n end\n end\n end\nend\n\nfunction spawnTokensFor(object)\n local extraUses = { }\n if activeInvestigatorId == \"03004\" then\n extraUses[\"Charge\"] = 1\n end\n\n tokenManager.spawnForCard(object, extraUses)\nend\n\nfunction onCollisionEnter(collisionInfo)\n local object = collisionInfo.collision_object\n\n -- only continue if loading is completed\n if not collisionEnabled then return end\n\n -- only continue for cards\n if not isCard(object) then return end\n\n -- detect if \"Dream-Enhancing Serum\" is placed\n if object.getName() == \"Dream-Enhancing Serum\" then isDES = true end\n\n maybeUpdateActiveInvestigator(object)\n syncCustomizableMetadata(object)\n\n local localCardPos = self.positionToLocal(object.getPosition())\n if inArea(localCardPos, DECK_DISCARD_AREA) then\n tokenManager.resetTokensSpawned(object)\n removeTokensFromObject(object)\n elseif shouldSpawnTokens(object) then\n spawnTokensFor(object)\n end\nend\n\n-- detect if \"Dream-Enhancing Serum\" is removed\nfunction onCollisionExit(collisionInfo)\n if collisionInfo.collision_object.getName() == \"Dream-Enhancing Serum\" then isDES = false end\nend\n\n-- checks if tokens should be spawned for the provided card\nfunction shouldSpawnTokens(card)\n if card.is_face_down then\n return false\n end\n\n local localCardPos = self.positionToLocal(card.getPosition())\n local metadata = JSON.decode(card.getGMNotes())\n\n -- If no metadata we don't know the type, so only spawn in the main area\n if metadata == nil then\n return inArea(localCardPos, MAIN_PLAY_AREA)\n end\n\n -- Spawn tokens for assets and events on the main area\n if inArea(localCardPos, MAIN_PLAY_AREA)\n and (metadata.type == \"Asset\"\n or metadata.type == \"Event\") then\n return true\n end\n\n -- Spawn tokens for all encounter types in the threat area\n if inArea(localCardPos, THREAT_AREA)\n and (metadata.type == \"Treachery\"\n or metadata.type == \"Enemy\"\n or metadata.weakness) then\n return true\n end\n\n return false\nend\n\nfunction onObjectEnterContainer(container, object)\n if not isCard(object) then return end\n\n local localCardPos = self.positionToLocal(object.getPosition())\n if inArea(localCardPos, DECK_DISCARD_AREA) then\n tokenManager.resetTokensSpawned(object)\n removeTokensFromObject(object)\n end\nend\n\n-- removes tokens from the provided card/deck\nfunction removeTokensFromObject(object)\n for _, obj in ipairs(searchArea(object.getPosition(), { 3, 1, 4 })) do\n if obj.getGUID() ~= \"4ee1f2\" and -- table\n obj ~= self and\n obj.type ~= \"Deck\" and\n obj.type ~= \"Card\" and\n obj.memo ~= nil and\n obj.getLock() == false and\n obj.getDescription() ~= \"Action Token\" and\n not tokenChecker.isChaosToken(obj) then\n ownedObjects.Trash.putObject(obj)\n end\n end\nend\n\n---------------------------------------------------------\n-- investigator ID grabbing and skill tracker\n---------------------------------------------------------\n\nfunction maybeUpdateActiveInvestigator(card)\n if not inArea(self.positionToLocal(card.getPosition()), INVESTIGATOR_AREA) then return end\n\n local notes = JSON.decode(card.getGMNotes())\n local class\n\n if notes ~= nil and notes.type == \"Investigator\" and notes.id ~= nil then\n if notes.id == activeInvestigatorId then return end\n class = notes.class\n activeInvestigatorId = notes.id\n ownedObjects.InvestigatorSkillTracker.call(\"updateStats\", {\n notes.willpowerIcons,\n notes.intellectIcons,\n notes.combatIcons,\n notes.agilityIcons\n })\n elseif activeInvestigatorId ~= \"00000\" then\n class = \"Neutral\"\n activeInvestigatorId = \"00000\"\n ownedObjects.InvestigatorSkillTracker.call(\"updateStats\", {1, 1, 1, 1})\n else\n return\n end\n\n -- change state of action tokens\n local search = searchArea(self.positionToWorld({-1.1, 0.05, -0.27}), {4, 1, 1})\n local smallToken = nil\n local STATE_TABLE = {\n [\"Guardian\"] = 1,\n [\"Seeker\"] = 2,\n [\"Rogue\"] = 3,\n [\"Mystic\"] = 4,\n [\"Survivor\"] = 5,\n [\"Neutral\"] = 6\n }\n\n for _, obj in ipairs(search) do\n if obj.getDescription() == \"Action Token\" and obj.getStateId() \u003e 0 then\n if obj.getScale().x \u003c 0.4 then\n smallToken = obj\n else\n setObjectState(obj, STATE_TABLE[class])\n end\n end\n end\n\n -- update the small token with special action for certain investigators\n local SPECIAL_ACTIONS = {\n [\"04002\"] = 8, -- Ursula Downs\n [\"01002\"] = 9, -- Daisy Walker\n [\"01502\"] = 9, -- Daisy Walker\n [\"01002-pb\"] = 9, -- Daisy Walker\n [\"06003\"] = 10, -- Tony Morgan\n [\"04003\"] = 11, -- Finn Edwards\n [\"08016\"] = 14 -- Bob Jenkins\n }\n\n if smallToken ~= nil then\n setObjectState(smallToken, SPECIAL_ACTIONS[activeInvestigatorId] or STATE_TABLE[class])\n end\nend\n\nfunction setObjectState(obj, stateId)\n if obj.getStateId() ~= stateId then obj.setState(stateId) end\nend\n\n---------------------------------------------------------\n-- manipulation of owned objects\n---------------------------------------------------------\n\n-- updates the specific owned counter\n---@param param Table Contains the information to update:\n--- type: String Counter to target\n--- newValue: Number Value to set the counter to\n--- modifier: Number If newValue is not provided, the existing value will be adjusted by this modifier\nfunction updateCounter(param)\n local counter = ownedObjects[param.type]\n if counter ~= nil then\n counter.call(\"updateVal\", param.newValue or (counter.getVar(\"val\") + param.modifier))\n else\n printToAll(param.type .. \" for \" .. matColor .. \" could not be found.\", \"Yellow\")\n end\nend\n\n-- returns the resource counter amount\n---@param type String Counter to target\nfunction getCounterValue(type)\n return ownedObjects[type].getVar(\"val\")\nend\n\n-- set investigator skill tracker to \"1, 1, 1, 1\"\nfunction resetSkillTracker()\n local obj = ownedObjects.InvestigatorSkillTracker\n if obj ~= nil then\n obj.call(\"updateStats\", { 1, 1, 1, 1 })\n else\n printToAll(\"Skill tracker for \" .. matColor .. \" playmat could not be found.\", \"Yellow\")\n end\nend\n\n---------------------------------------------------------\n-- calls to 'Global' / functions for calls from outside\n---------------------------------------------------------\n\nfunction drawChaosTokenButton(_, _, isRightClick)\n chaosBagApi.drawChaosToken(self, DRAWN_CHAOS_TOKEN_OFFSET, isRightClick)\nend\n\nfunction drawEncounterCard(_, _, isRightClick)\n local pos = self.positionToWorld(DRAWN_ENCOUNTER_CARD_OFFSET)\n local rotY = self.getRotation().y\n mythosAreaApi.drawEncounterCard(pos, rotY, isRightClick)\nend\n\nfunction returnGlobalDiscardPosition()\n return self.positionToWorld(DISCARD_PILE_POSITION)\nend\n\n-- Sets this playermat's draw 1 button to visible\n---@param visible Boolean. Whether the draw 1 button should be visible\nfunction showDrawButton(visible)\n isDrawButtonVisible = visible\n\n -- create the \"Draw 1\" button\n if isDrawButtonVisible then\n self.createButton({\n label = \"Draw 1\",\n click_function = \"doDrawOne\",\n function_owner = self,\n position = { 1.84, 0.1, -0.36 },\n scale = { 0.12, 0.12, 0.12 },\n width = 800,\n height = 280,\n font_size = 180\n })\n\n -- remove the \"Draw 1\" button\n else\n local buttons = self.getButtons()\n for i = 1, #buttons do\n if buttons[i].label == \"Draw 1\" then\n self.removeButton(buttons[i].index)\n end\n end\n end\nend\n\n-- shows / hides a clickable clue counter for this playmat and sets the correct amount of clues\n---@param showCounter Boolean Whether the clickable clue counter should be visible\nfunction clickableClues(showCounter)\n local clickerPos = ownedObjects.ClickableClueCounter.getPosition()\n local clueCount = 0\n \n -- move clue counters\n local modY = showCounter and 0.525 or -0.525\n ownedObjects.ClickableClueCounter.setPosition(clickerPos + Vector(0, modY, 0))\n\n if showCounter then\n -- current clue count\n clueCount = ownedObjects.ClueCounter.getVar(\"exposedValue\")\n\n -- remove clues\n ownedObjects.ClueCounter.call(\"removeAllClues\", ownedObjects.Trash)\n\n -- set value for clue clickers\n ownedObjects.ClickableClueCounter.call(\"updateVal\", clueCount)\n else\n -- current clue count\n clueCount = ownedObjects.ClickableClueCounter.getVar(\"val\")\n\n -- spawn clues\n local pos = self.positionToWorld({x = -1.12, y = 0.05, z = 0.7})\n for i = 1, clueCount do\n pos.y = pos.y + 0.045 * i\n tokenManager.spawnToken(pos, \"clue\", self.getRotation())\n end\n end\nend\n\n-- removes all clues (moving tokens to the trash and setting counters to 0)\nfunction removeClues()\n ownedObjects.ClueCounter.call(\"removeAllClues\", ownedObjects.Trash)\n ownedObjects.ClickableClueCounter.call(\"updateVal\", 0)\nend\n\n-- reports the clue count\n---@param useClickableCounters Boolean Controls which type of counter is getting checked\nfunction getClueCount(useClickableCounters)\n if useClickableCounters then\n return ownedObjects.ClickableClueCounter.getVar(\"val\")\n else\n return ownedObjects.ClueCounter.getVar(\"exposedValue\")\n end\nend\n\n-- Sets this playermat's snap points to limit snapping to matching card types or not. If matchTypes\n-- is true, the main card slot snap points will only snap assets, while the investigator area point\n-- will only snap Investigators. If matchTypes is false, snap points will be reset to snap all\n-- cards.\n---@param matchTypes Boolean. Whether snap points should only snap for the matching card types.\nfunction setLimitSnapsByType(matchTypes)\n local snaps = self.getSnapPoints()\n for i, snap in ipairs(snaps) do\n local snapPos = snap.position\n if inArea(snapPos, MAIN_PLAY_AREA) then\n local snapTags = snaps[i].tags\n if matchTypes then\n if snapTags == nil then\n snaps[i].tags = { \"Asset\" }\n else\n table.insert(snaps[i].tags, \"Asset\")\n end\n else\n snaps[i].tags = nil\n end\n end\n if inArea(snapPos, INVESTIGATOR_AREA) then\n local snapTags = snaps[i].tags\n if matchTypes then\n if snapTags == nil then\n snaps[i].tags = { \"Investigator\" }\n else\n table.insert(snaps[i].tags, \"Investigator\")\n end\n else\n snaps[i].tags = nil\n end\n end\n end\n self.setSnapPoints(snaps)\nend\n\n-- Simple method to check if the given point is in a specified area. Local use only,\n---@param point Vector Point to check, only x and z values are relevant\n---@param bounds Table Defined area to see if the point is within. See MAIN_PLAY_AREA for sample\n-- bounds definition.\n---@return Boolean True if the point is in the area defined by bounds\nfunction inArea(point, bounds)\n return (point.x \u003c bounds.upperLeft.x\n and point.x \u003e bounds.lowerRight.x\n and point.z \u003c bounds.upperLeft.z\n and point.z \u003e bounds.lowerRight.z)\nend\n\n-- called by custom data helpers to add player card data\n---@param args table Contains only one entry, the GUID of the custom data helper\nfunction updatePlayerCards(args)\n local customDataHelper = getObjectFromGUID(args[1])\n local playerCardData = customDataHelper.getTable(\"PLAYER_CARD_DATA\")\n tokenManager.addPlayerCardData(playerCardData)\nend\nend)\n__bundle_register(\"core/NavigationOverlayApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local NavigationOverlayApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getNOHandler()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"NavigationOverlayHandler\")\n end\n\n -- Copies the visibility for the Navigation overlay\n ---@param startColor String Color of the player to copy from\n ---@param targetColor String Color of the targeted player\n NavigationOverlayApi.copyVisibility = function(startColor, targetColor)\n getNOHandler().call(\"copyVisibility\", {\n startColor = startColor,\n targetColor = targetColor\n })\n end \n\n -- Changes the Navigation Overlay view (\"Full View\" --\u003e \"Play Areas\" --\u003e \"Closed\" etc.)\n ---@param playerColor String Color of the player to update the visibility for\n NavigationOverlayApi.cycleVisibility = function(playerColor)\n getNOHandler().call(\"cycleVisibility\", playerColor)\n end\n\n return NavigationOverlayApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "{\"activeInvestigatorId\":\"00000\",\"isDrawButtonVisible\":false,\"playerColor\":\"Orange\"}", "MeasureMovement": false, + "Memo": "Orange", "Name": "Custom_Tile", "Nickname": "Playermat 2: Orange", "Snap": true, "Sticky": true, "Tooltip": false, "Transform": { - "posX": -54.999, + "posX": -55, "posY": 1.45, - "posZ": -16.098, + "posZ": -16.1, "rotX": 0, "rotY": 270, "rotZ": 0, @@ -49587,6 +51969,742 @@ "Value": 0, "XmlUI": "" }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "AttachedSnapPoints": [ + { + "Position": { + "x": -1, + "y": 0.1, + "z": 0.118 + }, + "Tags": [ + "ActionToken" + ] + }, + { + "Position": { + "x": -0.865, + "y": 0.1, + "z": -0.28 + }, + "Tags": [ + "ActionToken" + ] + }, + { + "Position": { + "x": -1, + "y": 0.1, + "z": -0.28 + }, + "Tags": [ + "ActionToken" + ] + }, + { + "Position": { + "x": -1.18, + "y": 0.1, + "z": -0.28 + }, + "Tags": [ + "ActionToken" + ] + }, + { + "Position": { + "x": -1.36, + "y": 0.1, + "z": -0.28 + }, + "Tags": [ + "ActionToken" + ] + }, + { + "Position": { + "x": -0.631, + "y": 0.1, + "z": 0.551 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": -0.616, + "y": 0.102, + "z": 0.024 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": -0.177, + "y": 0.101, + "z": 0.032 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": -0.174, + "y": 0.099, + "z": 0.551 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": 0.212, + "y": 0.1, + "z": 0.559 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": 0.217, + "y": 0.1, + "z": 0.035 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": 0.602, + "y": 0.1, + "z": 0.033 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": 0.605, + "y": 0.1, + "z": 0.555 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": 0.977, + "y": 0.099, + "z": 0.556 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": 0.98, + "y": 0.099, + "z": 0.035 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": 1.371, + "y": 0.1, + "z": 0.038 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": 1.371, + "y": 0.099, + "z": 0.558 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": 1.754, + "y": 0.1, + "z": 0.563 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": 1.758, + "y": 0.101, + "z": 0.04 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": -1.82, + "y": 0.1, + "z": 0.61 + }, + "Rotation": { + "x": 0, + "y": 0, + "z": 0 + } + }, + { + "Position": { + "x": -1.82, + "y": 0.1, + "z": 0 + }, + "Rotation": { + "x": 0, + "y": 0, + "z": 0 + } + }, + { + "Position": { + "x": -1.177, + "y": 0.1, + "z": 0 + }, + "Tags": [ + "Investigator" + ] + }, + { + "Position": { + "x": 1.365, + "y": 0.1, + "z": -0.625 + }, + "Rotation": { + "x": 0, + "y": 0, + "z": 0 + } + }, + { + "Position": { + "x": 0.91, + "y": 0.1, + "z": -0.625 + }, + "Rotation": { + "x": 0, + "y": 0, + "z": 0 + } + }, + { + "Position": { + "x": 0.455, + "y": 0.1, + "z": -0.625 + }, + "Rotation": { + "x": 0, + "y": 0, + "z": 0 + } + }, + { + "Position": { + "x": 0, + "y": 0.1, + "z": -0.625 + }, + "Rotation": { + "x": 0, + "y": 0, + "z": 0 + } + }, + { + "Position": { + "x": -0.455, + "y": 0.1, + "z": -0.625 + }, + "Rotation": { + "x": 0, + "y": 0, + "z": 0 + } + }, + { + "Position": { + "x": -0.91, + "y": 0.1, + "z": -0.625 + }, + "Rotation": { + "x": 0, + "y": 0, + "z": 0 + } + }, + { + "Position": { + "x": -1.365, + "y": 0.1, + "z": -0.625 + }, + "Rotation": { + "x": 0, + "y": 0, + "z": 0 + } + } + ], + "Autoraise": true, + "ColorDiffuse": { + "b": 0, + "g": 0, + "r": 0 + }, + "CustomImage": { + "CustomTile": { + "Stackable": false, + "Stretch": true, + "Thickness": 0.1, + "Type": 3 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/2037357630681963618/E7271737B19CE0BFAAA382BEEEF497FE3E06ECC1/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "383d8b", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": true, + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playermat/Playmat\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal guidReferenceApi = require(\"core/GUIDReferenceApi\")\nlocal mythosAreaApi = require(\"core/MythosAreaApi\")\nlocal navigationOverlayApi = require(\"core/NavigationOverlayApi\")\nlocal tokenChecker = require(\"core/token/TokenChecker\")\nlocal tokenManager = require(\"core/token/TokenManager\")\n\n-- set true to enable debug logging and show Physics.cast()\nlocal DEBUG = false\n\n-- we use this to turn off collision handling until onLoad() is complete\nlocal collisionEnabled = false\n\n-- position offsets relative to mat [x, y, z]\nlocal DRAWN_ENCOUNTER_CARD_OFFSET = {1.365, 0.5, -0.625}\nlocal DRAWN_CHAOS_TOKEN_OFFSET = {-1.55, 0.25, -0.58}\n\n-- x-Values for discard buttons\nlocal DISCARD_BUTTON_OFFSETS = {-1.365, -0.91, -0.455, 0, 0.455, 0.91}\n\nlocal SEARCH_AROUND_SELF_X_BUFFER = 8\n\n-- defined areas for \"inArea()\" and \"Physics.cast()\"\nlocal MAIN_PLAY_AREA = {\n upperLeft = {\n x = 1.98,\n z = 0.736\n },\n lowerRight = {\n x = -0.79,\n z = -0.39\n }\n}\nlocal INVESTIGATOR_AREA = {\n upperLeft = {\n x = -1.084,\n z = 0.06517\n },\n lowerRight = {\n x = -1.258,\n z = -0.0805\n }\n}\nlocal THREAT_AREA = {\n upperLeft = {\n x = 1.53,\n z = -0.34\n },\n lowerRight = {\n x = -1.13,\n z = -0.92\n }\n}\nlocal DECK_DISCARD_AREA = {\n upperLeft = {\n x = -1.62,\n z = 0.855\n },\n lowerRight = {\n x = -2.02,\n z = -0.245\n },\n center = {\n x = -1.82,\n y = 0.5,\n z = 0.305\n },\n size = {\n x = 0.4,\n y = 3,\n z = 1.1\n }\n}\n\n-- local position of draw and discard pile\nlocal DRAW_DECK_POSITION = { x = -1.82, y = 0.1, z = 0 }\nlocal DISCARD_PILE_POSITION = { x = -1.82, y = 0.1, z = 0.61 }\n\n-- global position of encounter discard pile\nlocal ENCOUNTER_DISCARD_POSITION = { x = -3.85, y = 1.5, z = 10.38}\n\n-- global variable so it can be reset by the Clean Up Helper\nactiveInvestigatorId = \"00000\"\n\n-- table of type-object reference pairs of all owned objects\nlocal ownedObjects = {}\nlocal matColor = self.getMemo()\n\n-- variable to track the status of the \"Show Draw Button\" option\nlocal isDrawButtonVisible = false\n\n-- global variable to report \"Dream-Enhancing Serum\" status\nisDES = false\n\nfunction onSave()\n return JSON.encode({\n playerColor = playerColor,\n activeInvestigatorId = activeInvestigatorId,\n isDrawButtonVisible = isDrawButtonVisible\n })\nend\n\nfunction onLoad(saveState)\n self.interactable = DEBUG\n\n -- get object references to owned objects\n ownedObjects = guidReferenceApi.getObjectsByOwner(matColor)\n\n -- button creation\n for i = 1, 6 do\n makeDiscardButton(DISCARD_BUTTON_OFFSETS[i], i)\n end\n\n self.createButton({\n click_function = \"drawEncounterCard\",\n function_owner = self,\n position = {-1.84, 0, -0.65},\n rotation = {0, 80, 0},\n width = 265,\n height = 190\n })\n\n self.createButton({\n click_function = \"drawChaosTokenButton\",\n function_owner = self,\n position = {1.85, 0, -0.74},\n rotation = {0, -45, 0},\n width = 135,\n height = 135\n })\n\n self.createButton({\n label = \"Upkeep\",\n click_function = \"doUpkeep\",\n function_owner = self,\n position = {1.84, 0.1, -0.44},\n scale = {0.12, 0.12, 0.12},\n width = 800,\n height = 280,\n font_size = 180\n })\n\n -- save state loading\n local state = JSON.decode(saveState)\n if state ~= nil then\n playerColor = state.playerColor\n activeInvestigatorId = state.activeInvestigatorId\n isDrawButtonVisible = state.isDrawButtonVisible\n end\n\n showDrawButton(isDrawButtonVisible)\n collisionEnabled = true\n math.randomseed(os.time())\nend\n\n---------------------------------------------------------\n-- utility functions\n---------------------------------------------------------\n\n-- searches an area and optionally filters the result\nfunction searchArea(origin, size, filter)\n local searchResult = Physics.cast({\n origin = origin,\n direction = { 0, 1, 0 },\n orientation = self.getRotation(),\n type = 3,\n size = size,\n max_distance = 0\n })\n\n local objList = {}\n for _, v in ipairs(searchResult) do\n if not filter or (filter and filter(v.hit_object)) then\n table.insert(objList, v.hit_object)\n end\n end\n return objList\nend\n\n-- filter functions for searchArea()\nfunction isCard(x) return x.type == 'Card' end\nfunction isDeck(x) return x.type == 'Deck' end\nfunction isCardOrDeck(x) return x.type == 'Card' or x.type == 'Deck' end\n\n-- finds all objects on the playmat and associated set aside zone.\nfunction searchAroundSelf(filter)\n local bounds = self.getBoundsNormalized()\n -- Increase the width to cover the set aside zone\n bounds.size.x = bounds.size.x + SEARCH_AROUND_SELF_X_BUFFER\n bounds.size.y = 1\n -- Since the cast is centered on the position, shift left or right to keep the non-set aside edge\n -- of the cast at the edge of the playmat\n -- setAsideDirection accounts for the set aside zone being on the left or right, depending on the\n -- table position of the playmat\n local setAsideDirection = bounds.center.z \u003e 0 and 1 or -1\n local localCenter = self.positionToLocal(bounds.center)\n localCenter.x = localCenter.x + setAsideDirection * SEARCH_AROUND_SELF_X_BUFFER / 2 / self.getScale().x\n return searchArea(self.positionToWorld(localCenter), bounds.size, filter)\nend\n\n-- searches the area around the draw deck and discard pile\nfunction searchDeckAndDiscardArea(filter)\n local pos = self.positionToWorld(DECK_DISCARD_AREA.center)\n local scale = self.getScale()\n local size = {\n x = DECK_DISCARD_AREA.size.x * scale.x,\n y = DECK_DISCARD_AREA.size.y, \n z = DECK_DISCARD_AREA.size.z * scale.z\n }\n return searchArea(pos, size, filter)\nend\n\nfunction doNotReady(card)\n return card.getVar(\"do_not_ready\") or false\nend\n\n-- rounds a number to the specified amount of decimal places\n---@param num Number Initial value\n---@param numDecimalPlaces Number Amount of decimal places\nfunction round(num, numDecimalPlaces)\n local mult = 10^(numDecimalPlaces or 0)\n return math.floor(num * mult + 0.5) / mult\nend\n\n---------------------------------------------------------\n-- Discard buttons\n---------------------------------------------------------\n\n-- handles discarding for a list of objects\n---@param objList Table List of objects to discard\nfunction discardListOfObjects(objList)\n for _, obj in ipairs(objList) do\n if isCardOrDeck(obj) then\n if obj.hasTag(\"PlayerCard\") then\n placeOrMergeIntoDeck(obj, returnGlobalDiscardPosition(), self.getRotation())\n else\n placeOrMergeIntoDeck(obj, ENCOUNTER_DISCARD_POSITION, {x = 0, y = -90, z = 0})\n end\n -- put chaos tokens back into bag (e.g. Unrelenting)\n elseif tokenChecker.isChaosToken(obj) then\n local chaosBag = chaosBagApi.findChaosBag()\n chaosBag.putObject(obj)\n -- don't touch locked objects (like the table etc.)\n elseif not obj.getLock() then\n ownedObjects.Trash.putObject(obj)\n end\n end\nend\n\n-- places a card/deck at a position or merges into an existing deck\n-- rotation is optional\nfunction placeOrMergeIntoDeck(obj, pos, rot)\n if not pos then return end\n\n local offset = 0.5\n \n -- search the new position for existing card/deck\n local searchResult = searchArea(pos, { 1, 1, 1 }, isCardOrDeck)\n\n -- get new position\n local newPos\n if #searchResult == 1 then\n local bounds = searchResult[1].getBounds()\n newPos = Vector(pos):setAt(\"y\", bounds.center.y + bounds.size.y / 2 + offset)\n else\n newPos = Vector(pos) + Vector(0, offset, 0)\n end\n\n -- allow moving the objects smoothly out of the hand\n obj.use_hands = false\n\n if rot then\n obj.setRotationSmooth(rot, false, true)\n end\n obj.setPositionSmooth(newPos, false, true)\n\n -- continue if the card stops smooth moving\n Wait.condition(\n function()\n obj.use_hands = true\n -- this avoids a TTS bug that merges unrelated cards that are not resting\n if #searchResult == 1 and searchResult[1] ~= obj then\n -- call this with avoiding errors (physics is sometimes too fast so the object doesn't exist for the put)\n pcall(function() searchResult[1].putObject(obj) end)\n end\n end,\n function() return not obj.isSmoothMoving() end, 3)\nend\n\n-- build a discard button to discard from searchPosition (number must be unique)\nfunction makeDiscardButton(xValue, number)\n local position = { xValue, 0.1, -0.94}\n local searchPosition = {-position[1], position[2], position[3] + 0.32}\n local handlerName = 'handler' .. number\n self.setVar(handlerName, function()\n local cardSizeSearch = {2, 1, 3.2}\n local globalSearchPosition = self.positionToWorld(searchPosition)\n local searchResult = searchArea(globalSearchPosition, cardSizeSearch)\n return discardListOfObjects(searchResult)\n end)\n self.createButton({\n label = \"Discard\",\n click_function = handlerName,\n function_owner = self,\n position = position,\n scale = {0.12, 0.12, 0.12},\n width = 900,\n height = 350,\n font_size = 220\n })\nend\n\n---------------------------------------------------------\n-- Upkeep button\n---------------------------------------------------------\n\n-- calls the Upkeep function with correct parameter\nfunction doUpkeepFromHotkey(color)\n doUpkeep(_, color)\nend\n\nfunction doUpkeep(_, clickedByColor, isRightClick)\n -- right-click allow color changing\n if isRightClick then\n changeColor(clickedByColor)\n return\n end\n\n -- send messages to player who clicked button if no seated player found\n messageColor = Player[playerColor].seated and playerColor or clickedByColor\n\n -- unexhaust cards in play zone, flip action tokens and find forcedLearning\n local forcedLearning = false\n local rot = self.getRotation()\n for _, obj in ipairs(searchAroundSelf()) do\n if obj.getDescription() == \"Action Token\" and obj.is_face_down then\n obj.flip()\n elseif obj.type == \"Card\" and not inArea(self.positionToLocal(obj.getPosition()), INVESTIGATOR_AREA) then\n local cardMetadata = JSON.decode(obj.getGMNotes()) or {}\n if not doNotReady(obj) then\n local cardRotation = round(obj.getRotation().y, 0) - rot.y\n local yRotDiff = 0\n\n if cardRotation \u003c 0 then\n cardRotation = cardRotation + 360\n end\n\n -- rotate cards to the next multiple of 90° towards 0°\n if cardRotation \u003e 90 and cardRotation \u003c= 180 then\n yRotDiff = 90\n elseif cardRotation \u003c 270 and cardRotation \u003e 180 then\n yRotDiff = 270\n end\n\n -- set correct rotation for face-down cards\n rot.z = obj.is_face_down and 180 or 0\n obj.setRotation({rot.x, rot.y + yRotDiff, rot.z})\n end\n if cardMetadata.id == \"08031\" then\n forcedLearning = true\n end\n if cardMetadata.uses ~= nil then\n tokenManager.maybeReplenishCard(obj, cardMetadata.uses, self)\n end\n end\n end\n\n -- flip investigator mini-card and summoned servitor mini-card\n -- (all characters allowed to account for custom IDs - e.g. 'Z0000' for TTS Zoop generated IDs)\n if activeInvestigatorId ~= nil then\n local miniId = string.match(activeInvestigatorId, \".....\") .. \"-m\"\n for _, obj in ipairs(getObjects()) do\n if obj.type == \"Card\" and obj.is_face_down then\n local notes = JSON.decode(obj.getGMNotes())\n if notes ~= nil and notes.type == \"Minicard\" and (notes.id == miniId or notes.id == \"09080-m\") then\n obj.flip()\n end\n end\n end\n end\n\n -- gain a resource (or two if playing Jenny Barnes)\n if string.match(activeInvestigatorId, \"%d%d%d%d%d\") == \"02003\" then\n updateCounter({type = \"ResourceCounter\", modifier = 2})\n printToColor(\"Gaining 2 resources (Jenny)\", messageColor)\n else\n updateCounter({type = \"ResourceCounter\", modifier = 1})\n end\n\n -- draw a card (with handling for Patrice and Forced Learning)\n if activeInvestigatorId == \"06005\" then\n if forcedLearning then\n printToColor(\"Wow, did you really take 'Versatile' to play Patrice with 'Forced Learning'? Choose which draw replacement effect takes priority and draw cards accordingly.\", messageColor)\n else\n local handSize = #Player[playerColor].getHandObjects()\n if handSize \u003c 5 then\n local cardsToDraw = 5 - handSize\n printToColor(\"Drawing \" .. cardsToDraw .. \" cards (Patrice)\", messageColor)\n drawCardsWithReshuffle(cardsToDraw)\n end\n end\n elseif forcedLearning then\n printToColor(\"Drawing 2 cards, discard 1 (Forced Learning)\", messageColor)\n drawCardsWithReshuffle(2)\n elseif activeInvestigatorId == \"89001\" then\n printToColor(\"Drawing 2 cards (Subject 5U-21)\", messageColor)\n drawCardsWithReshuffle(2)\n else\n drawCardsWithReshuffle(1)\n end\nend\n\n-- function for \"draw 1 button\" (that can be added via option panel)\nfunction doDrawOne(_, color)\n -- send messages to player who clicked button if no seated player found\n messageColor = Player[playerColor].seated and playerColor or color\n drawCardsWithReshuffle(1)\nend\n\n-- draw X cards (shuffle discards if necessary)\nfunction drawCardsWithReshuffle(numCards)\n local deckAreaObjects = getDeckAreaObjects()\n\n -- Norman Withers handling\n local harbinger = false\n if deckAreaObjects.topCard and deckAreaObjects.topCard.getName() == \"The Harbinger\" then\n harbinger = true\n elseif deckAreaObjects.draw and not deckAreaObjects.draw.is_face_down then\n local cards = deckAreaObjects.draw.getObjects()\n if cards[#cards].name == \"The Harbinger\" then\n harbinger = true\n end\n end\n\n if harbinger then\n printToColor(\"The Harbinger is on top of your deck, not drawing cards\", messageColor)\n return\n end\n\n local topCardDetected = false\n if deckAreaObjects.topCard ~= nil then\n deckAreaObjects.topCard.deal(1, playerColor)\n topCardDetected = true\n numCards = numCards - 1\n if numCards == 0 then\n flipTopCardFromDeck()\n return\n end\n end\n\n local deckSize = 1\n if deckAreaObjects.draw == nil then\n deckSize = 0\n elseif deckAreaObjects.draw.type == \"Deck\" then\n deckSize = #deckAreaObjects.draw.getObjects()\n end\n\n if deckSize \u003e= numCards then\n drawCards(numCards)\n -- flip top card again for Norman\n if topCardDetected and string.match(activeInvestigatorId, \"%d%d%d%d%d\") == \"08004\" then\n flipTopCardFromDeck()\n end\n else\n drawCards(deckSize)\n if deckAreaObjects.discard ~= nil then\n shuffleDiscardIntoDeck()\n Wait.time(function()\n drawCards(numCards - deckSize)\n -- flip top card again for Norman\n if topCardDetected and string.match(activeInvestigatorId, \"%d%d%d%d%d\") == \"08004\" then\n flipTopCardFromDeck()\n end\n end, 1)\n end\n printToColor(\"Take 1 horror (drawing card from empty deck)\", messageColor)\n end\nend\n\n-- get the draw deck and discard pile objects and returns the references\nfunction getDeckAreaObjects()\n local deckAreaObjects = {}\n for _, object in ipairs(searchDeckAndDiscardArea(isCardOrDeck)) do\n if self.positionToLocal(object.getPosition()).z \u003e 0.5 then\n deckAreaObjects.discard = object\n -- Norman Withers handling\n elseif object.type == \"Card\" and not object.is_face_down then\n deckAreaObjects.topCard = object\n else\n deckAreaObjects.draw = object\n end\n end\n return deckAreaObjects\nend\n\nfunction drawCards(numCards)\n local deckAreaObjects = getDeckAreaObjects()\n if deckAreaObjects.draw then\n deckAreaObjects.draw.deal(numCards, playerColor)\n end\nend\n\nfunction shuffleDiscardIntoDeck()\n local deckAreaObjects = getDeckAreaObjects()\n if not deckAreaObjects.discard.is_face_down then\n deckAreaObjects.discard.flip()\n end\n deckAreaObjects.discard.shuffle()\n deckAreaObjects.discard.setPositionSmooth(self.positionToWorld(DRAW_DECK_POSITION), false, false)\nend\n\n-- utility function for Norman Withers to flip the top card to the revealed side\nfunction flipTopCardFromDeck()\n Wait.time(function()\n local deckAreaObjects = getDeckAreaObjects()\n if deckAreaObjects.topCard then\n return\n elseif deckAreaObjects.draw then\n if deckAreaObjects.draw.type == \"Card\" then\n deckAreaObjects.draw.flip()\n else\n -- get bounds to know the height of the deck\n local bounds = deckAreaObjects.draw.getBounds()\n local pos = bounds.center + Vector(0, bounds.size.y / 2 + 0.2, 0)\n deckAreaObjects.draw.takeObject({ position = pos, flip = true })\n end\n end\n end, 0.1)\nend\n\n-- discard a random non-hidden card from hand\nfunction doDiscardOne()\n local hand = Player[playerColor].getHandObjects()\n if #hand == 0 then\n broadcastToAll(\"Cannot discard from empty hand!\", \"Red\")\n else\n local choices = {}\n for i = 1, #hand do\n local notes = JSON.decode(hand[i].getGMNotes())\n if notes ~= nil then\n if notes.hidden ~= true then\n table.insert(choices, i)\n end\n else\n table.insert(choices, i)\n end\n end\n\n if #choices == 0 then\n broadcastToAll(\"Hidden cards can't be randomly discarded.\", \"Orange\")\n return\n end\n\n -- get a random non-hidden card (from the \"choices\" table)\n local num = math.random(1, #choices)\n placeOrMergeIntoDeck(hand[choices[num]], returnGlobalDiscardPosition(), self.getRotation())\n broadcastToAll(playerColor .. \" randomly discarded card \" .. choices[num] .. \"/\" .. #hand .. \".\", \"White\")\n end\nend\n\n---------------------------------------------------------\n-- color related functions\n---------------------------------------------------------\n\n-- changes the player color\nfunction changeColor(clickedByColor)\n local colorList = {\n \"White\",\n \"Brown\",\n \"Red\",\n \"Orange\",\n \"Yellow\",\n \"Green\",\n \"Teal\",\n \"Blue\",\n \"Purple\",\n \"Pink\"\n }\n\n -- remove existing colors from the list of choices\n for _, existingColor in ipairs(Player.getAvailableColors()) do\n for i, newColor in ipairs(colorList) do\n if existingColor == newColor then\n table.remove(colorList, i)\n end\n end\n end\n\n -- show the option dialog for color selection to the player that triggered this\n Player[clickedByColor].showOptionsDialog(\"Select a new color:\", colorList, _, function(color)\n -- update the color of the hand zone\n local handZone = ownedObjects.HandZone\n handZone.setValue(color)\n\n -- if the seated player clicked this, reseat him to the new color\n if clickedByColor == playerColor then\n navigationOverlayApi.copyVisibility(playerColor, color)\n Player[playerColor].changeColor(color)\n end\n\n -- update the internal variable\n playerColor = color\n end)\nend\n\n---------------------------------------------------------\n-- playmat token spawning\n---------------------------------------------------------\n\n-- Finds all customizable cards in this play area and updates their metadata based on the selections\n-- on the matching upgrade sheet.\n-- This method is theoretically O(n^2), and should be used sparingly. In practice it will only be\n-- called when a checkbox is added or removed in-game (which should be rare), and is bounded by the\n-- number of customizable cards in play.\nfunction syncAllCustomizableCards()\n for _, card in ipairs(searchAroundSelf(isCard)) do\n syncCustomizableMetadata(card)\n end\nend\n\nfunction syncCustomizableMetadata(card)\n local cardMetadata = JSON.decode(card.getGMNotes()) or { }\n if cardMetadata == nil or cardMetadata.customizations == nil then\n return\n end\n for _, upgradeSheet in ipairs(searchAroundSelf(isCard)) do\n local upgradeSheetMetadata = JSON.decode(upgradeSheet.getGMNotes()) or { }\n if upgradeSheetMetadata.id == (cardMetadata.id .. \"-c\") then\n for i, customization in ipairs(cardMetadata.customizations) do\n if customization.replaces ~= nil and customization.replaces.uses ~= nil then\n -- Allowed use of call(), no APIs for individual cards\n if upgradeSheet.call(\"isUpgradeActive\", i) then\n cardMetadata.uses = customization.replaces.uses\n card.setGMNotes(JSON.encode(cardMetadata))\n else\n -- TODO: Get the original metadata to restore it... maybe. This should only be\n -- necessary in the very unlikely case that a user un-checks a previously-full upgrade\n -- row while the card is in play. It will be much easier once the AllPlayerCardsApi is\n -- in place, so defer until it is\n end\n end\n end\n end\n end\nend\n\nfunction spawnTokensFor(object)\n local extraUses = { }\n if activeInvestigatorId == \"03004\" then\n extraUses[\"Charge\"] = 1\n end\n\n tokenManager.spawnForCard(object, extraUses)\nend\n\nfunction onCollisionEnter(collisionInfo)\n local object = collisionInfo.collision_object\n\n -- only continue if loading is completed\n if not collisionEnabled then return end\n\n -- only continue for cards\n if not isCard(object) then return end\n\n -- detect if \"Dream-Enhancing Serum\" is placed\n if object.getName() == \"Dream-Enhancing Serum\" then isDES = true end\n\n maybeUpdateActiveInvestigator(object)\n syncCustomizableMetadata(object)\n\n local localCardPos = self.positionToLocal(object.getPosition())\n if inArea(localCardPos, DECK_DISCARD_AREA) then\n tokenManager.resetTokensSpawned(object)\n removeTokensFromObject(object)\n elseif shouldSpawnTokens(object) then\n spawnTokensFor(object)\n end\nend\n\n-- detect if \"Dream-Enhancing Serum\" is removed\nfunction onCollisionExit(collisionInfo)\n if collisionInfo.collision_object.getName() == \"Dream-Enhancing Serum\" then isDES = false end\nend\n\n-- checks if tokens should be spawned for the provided card\nfunction shouldSpawnTokens(card)\n if card.is_face_down then\n return false\n end\n\n local localCardPos = self.positionToLocal(card.getPosition())\n local metadata = JSON.decode(card.getGMNotes())\n\n -- If no metadata we don't know the type, so only spawn in the main area\n if metadata == nil then\n return inArea(localCardPos, MAIN_PLAY_AREA)\n end\n\n -- Spawn tokens for assets and events on the main area\n if inArea(localCardPos, MAIN_PLAY_AREA)\n and (metadata.type == \"Asset\"\n or metadata.type == \"Event\") then\n return true\n end\n\n -- Spawn tokens for all encounter types in the threat area\n if inArea(localCardPos, THREAT_AREA)\n and (metadata.type == \"Treachery\"\n or metadata.type == \"Enemy\"\n or metadata.weakness) then\n return true\n end\n\n return false\nend\n\nfunction onObjectEnterContainer(container, object)\n if not isCard(object) then return end\n\n local localCardPos = self.positionToLocal(object.getPosition())\n if inArea(localCardPos, DECK_DISCARD_AREA) then\n tokenManager.resetTokensSpawned(object)\n removeTokensFromObject(object)\n end\nend\n\n-- removes tokens from the provided card/deck\nfunction removeTokensFromObject(object)\n for _, obj in ipairs(searchArea(object.getPosition(), { 3, 1, 4 })) do\n if obj.getGUID() ~= \"4ee1f2\" and -- table\n obj ~= self and\n obj.type ~= \"Deck\" and\n obj.type ~= \"Card\" and\n obj.memo ~= nil and\n obj.getLock() == false and\n obj.getDescription() ~= \"Action Token\" and\n not tokenChecker.isChaosToken(obj) then\n ownedObjects.Trash.putObject(obj)\n end\n end\nend\n\n---------------------------------------------------------\n-- investigator ID grabbing and skill tracker\n---------------------------------------------------------\n\nfunction maybeUpdateActiveInvestigator(card)\n if not inArea(self.positionToLocal(card.getPosition()), INVESTIGATOR_AREA) then return end\n\n local notes = JSON.decode(card.getGMNotes())\n local class\n\n if notes ~= nil and notes.type == \"Investigator\" and notes.id ~= nil then\n if notes.id == activeInvestigatorId then return end\n class = notes.class\n activeInvestigatorId = notes.id\n ownedObjects.InvestigatorSkillTracker.call(\"updateStats\", {\n notes.willpowerIcons,\n notes.intellectIcons,\n notes.combatIcons,\n notes.agilityIcons\n })\n elseif activeInvestigatorId ~= \"00000\" then\n class = \"Neutral\"\n activeInvestigatorId = \"00000\"\n ownedObjects.InvestigatorSkillTracker.call(\"updateStats\", {1, 1, 1, 1})\n else\n return\n end\n\n -- change state of action tokens\n local search = searchArea(self.positionToWorld({-1.1, 0.05, -0.27}), {4, 1, 1})\n local smallToken = nil\n local STATE_TABLE = {\n [\"Guardian\"] = 1,\n [\"Seeker\"] = 2,\n [\"Rogue\"] = 3,\n [\"Mystic\"] = 4,\n [\"Survivor\"] = 5,\n [\"Neutral\"] = 6\n }\n\n for _, obj in ipairs(search) do\n if obj.getDescription() == \"Action Token\" and obj.getStateId() \u003e 0 then\n if obj.getScale().x \u003c 0.4 then\n smallToken = obj\n else\n setObjectState(obj, STATE_TABLE[class])\n end\n end\n end\n\n -- update the small token with special action for certain investigators\n local SPECIAL_ACTIONS = {\n [\"04002\"] = 8, -- Ursula Downs\n [\"01002\"] = 9, -- Daisy Walker\n [\"01502\"] = 9, -- Daisy Walker\n [\"01002-pb\"] = 9, -- Daisy Walker\n [\"06003\"] = 10, -- Tony Morgan\n [\"04003\"] = 11, -- Finn Edwards\n [\"08016\"] = 14 -- Bob Jenkins\n }\n\n if smallToken ~= nil then\n setObjectState(smallToken, SPECIAL_ACTIONS[activeInvestigatorId] or STATE_TABLE[class])\n end\nend\n\nfunction setObjectState(obj, stateId)\n if obj.getStateId() ~= stateId then obj.setState(stateId) end\nend\n\n---------------------------------------------------------\n-- manipulation of owned objects\n---------------------------------------------------------\n\n-- updates the specific owned counter\n---@param param Table Contains the information to update:\n--- type: String Counter to target\n--- newValue: Number Value to set the counter to\n--- modifier: Number If newValue is not provided, the existing value will be adjusted by this modifier\nfunction updateCounter(param)\n local counter = ownedObjects[param.type]\n if counter ~= nil then\n counter.call(\"updateVal\", param.newValue or (counter.getVar(\"val\") + param.modifier))\n else\n printToAll(param.type .. \" for \" .. matColor .. \" could not be found.\", \"Yellow\")\n end\nend\n\n-- returns the resource counter amount\n---@param type String Counter to target\nfunction getCounterValue(type)\n return ownedObjects[type].getVar(\"val\")\nend\n\n-- set investigator skill tracker to \"1, 1, 1, 1\"\nfunction resetSkillTracker()\n local obj = ownedObjects.InvestigatorSkillTracker\n if obj ~= nil then\n obj.call(\"updateStats\", { 1, 1, 1, 1 })\n else\n printToAll(\"Skill tracker for \" .. matColor .. \" playmat could not be found.\", \"Yellow\")\n end\nend\n\n---------------------------------------------------------\n-- calls to 'Global' / functions for calls from outside\n---------------------------------------------------------\n\nfunction drawChaosTokenButton(_, _, isRightClick)\n chaosBagApi.drawChaosToken(self, DRAWN_CHAOS_TOKEN_OFFSET, isRightClick)\nend\n\nfunction drawEncounterCard(_, _, isRightClick)\n local pos = self.positionToWorld(DRAWN_ENCOUNTER_CARD_OFFSET)\n local rotY = self.getRotation().y\n mythosAreaApi.drawEncounterCard(pos, rotY, isRightClick)\nend\n\nfunction returnGlobalDiscardPosition()\n return self.positionToWorld(DISCARD_PILE_POSITION)\nend\n\n-- Sets this playermat's draw 1 button to visible\n---@param visible Boolean. Whether the draw 1 button should be visible\nfunction showDrawButton(visible)\n isDrawButtonVisible = visible\n\n -- create the \"Draw 1\" button\n if isDrawButtonVisible then\n self.createButton({\n label = \"Draw 1\",\n click_function = \"doDrawOne\",\n function_owner = self,\n position = { 1.84, 0.1, -0.36 },\n scale = { 0.12, 0.12, 0.12 },\n width = 800,\n height = 280,\n font_size = 180\n })\n\n -- remove the \"Draw 1\" button\n else\n local buttons = self.getButtons()\n for i = 1, #buttons do\n if buttons[i].label == \"Draw 1\" then\n self.removeButton(buttons[i].index)\n end\n end\n end\nend\n\n-- shows / hides a clickable clue counter for this playmat and sets the correct amount of clues\n---@param showCounter Boolean Whether the clickable clue counter should be visible\nfunction clickableClues(showCounter)\n local clickerPos = ownedObjects.ClickableClueCounter.getPosition()\n local clueCount = 0\n \n -- move clue counters\n local modY = showCounter and 0.525 or -0.525\n ownedObjects.ClickableClueCounter.setPosition(clickerPos + Vector(0, modY, 0))\n\n if showCounter then\n -- current clue count\n clueCount = ownedObjects.ClueCounter.getVar(\"exposedValue\")\n\n -- remove clues\n ownedObjects.ClueCounter.call(\"removeAllClues\", ownedObjects.Trash)\n\n -- set value for clue clickers\n ownedObjects.ClickableClueCounter.call(\"updateVal\", clueCount)\n else\n -- current clue count\n clueCount = ownedObjects.ClickableClueCounter.getVar(\"val\")\n\n -- spawn clues\n local pos = self.positionToWorld({x = -1.12, y = 0.05, z = 0.7})\n for i = 1, clueCount do\n pos.y = pos.y + 0.045 * i\n tokenManager.spawnToken(pos, \"clue\", self.getRotation())\n end\n end\nend\n\n-- removes all clues (moving tokens to the trash and setting counters to 0)\nfunction removeClues()\n ownedObjects.ClueCounter.call(\"removeAllClues\", ownedObjects.Trash)\n ownedObjects.ClickableClueCounter.call(\"updateVal\", 0)\nend\n\n-- reports the clue count\n---@param useClickableCounters Boolean Controls which type of counter is getting checked\nfunction getClueCount(useClickableCounters)\n if useClickableCounters then\n return ownedObjects.ClickableClueCounter.getVar(\"val\")\n else\n return ownedObjects.ClueCounter.getVar(\"exposedValue\")\n end\nend\n\n-- Sets this playermat's snap points to limit snapping to matching card types or not. If matchTypes\n-- is true, the main card slot snap points will only snap assets, while the investigator area point\n-- will only snap Investigators. If matchTypes is false, snap points will be reset to snap all\n-- cards.\n---@param matchTypes Boolean. Whether snap points should only snap for the matching card types.\nfunction setLimitSnapsByType(matchTypes)\n local snaps = self.getSnapPoints()\n for i, snap in ipairs(snaps) do\n local snapPos = snap.position\n if inArea(snapPos, MAIN_PLAY_AREA) then\n local snapTags = snaps[i].tags\n if matchTypes then\n if snapTags == nil then\n snaps[i].tags = { \"Asset\" }\n else\n table.insert(snaps[i].tags, \"Asset\")\n end\n else\n snaps[i].tags = nil\n end\n end\n if inArea(snapPos, INVESTIGATOR_AREA) then\n local snapTags = snaps[i].tags\n if matchTypes then\n if snapTags == nil then\n snaps[i].tags = { \"Investigator\" }\n else\n table.insert(snaps[i].tags, \"Investigator\")\n end\n else\n snaps[i].tags = nil\n end\n end\n end\n self.setSnapPoints(snaps)\nend\n\n-- Simple method to check if the given point is in a specified area. Local use only,\n---@param point Vector Point to check, only x and z values are relevant\n---@param bounds Table Defined area to see if the point is within. See MAIN_PLAY_AREA for sample\n-- bounds definition.\n---@return Boolean True if the point is in the area defined by bounds\nfunction inArea(point, bounds)\n return (point.x \u003c bounds.upperLeft.x\n and point.x \u003e bounds.lowerRight.x\n and point.z \u003c bounds.upperLeft.z\n and point.z \u003e bounds.lowerRight.z)\nend\n\n-- called by custom data helpers to add player card data\n---@param args table Contains only one entry, the GUID of the custom data helper\nfunction updatePlayerCards(args)\n local customDataHelper = getObjectFromGUID(args[1])\n local playerCardData = customDataHelper.getTable(\"PLAYER_CARD_DATA\")\n tokenManager.addPlayerCardData(playerCardData)\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"core/token/TokenChecker\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local CHAOS_TOKEN_NAMES = {\n [\"Elder Sign\"] = true,\n [\"+1\"] = true,\n [\"0\"] = true,\n [\"-1\"] = true,\n [\"-2\"] = true,\n [\"-3\"] = true,\n [\"-4\"] = true,\n [\"-5\"] = true,\n [\"-6\"] = true,\n [\"-7\"] = true,\n [\"-8\"] = true,\n [\"Skull\"] = true,\n [\"Cultist\"] = true,\n [\"Tablet\"] = true,\n [\"Elder Thing\"] = true,\n [\"Auto-fail\"] = true,\n [\"Bless\"] = true,\n [\"Curse\"] = true,\n [\"Frost\"] = true\n }\n\n local TokenChecker = {}\n\n -- returns true if the passed object is a chaos token (by name)\n TokenChecker.isChaosToken = function(obj)\n if CHAOS_TOKEN_NAMES[obj.getName()] then\n return true\n else\n return false\n end\n end\n\n return TokenChecker\nend\nend)\n__bundle_register(\"core/token/TokenManager\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n local optionPanelApi = require(\"core/OptionPanelApi\")\n local playAreaApi = require(\"core/PlayAreaApi\")\n local tokenSpawnTrackerApi = require(\"core/token/TokenSpawnTrackerApi\")\n\n local PLAYER_CARD_TOKEN_OFFSETS = {\n [1] = {\n Vector(0, 3, -0.2)\n },\n [2] = {\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [3] = {\n Vector(0, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [4] = {\n Vector(0.4, 3, -0.9),\n Vector(-0.4, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [5] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [6] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2)\n },\n [7] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0, 3, 0.5)\n },\n [8] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(-0.35, 3, 0.5),\n Vector(0.35, 3, 0.5)\n },\n [9] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5)\n },\n [10] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0, 3, 1.2)\n },\n [11] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(-0.35, 3, 1.2),\n Vector(0.35, 3, 1.2)\n },\n [12] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0.7, 3, 1.2),\n Vector(0, 3, 1.2),\n Vector(-0.7, 3, 1.2)\n }\n }\n\n -- stateIDs for the multi-stated resource tokens\n local stateTable = {\n [\"resource\"] = 1,\n [\"ammo\"] = 2,\n [\"bounty\"] = 3,\n [\"charge\"] = 4,\n [\"evidence\"] = 5,\n [\"secret\"] = 6,\n [\"supply\"] = 7\n }\n\n -- Table of data extracted from the token source bag, keyed by the Memo on each token which\n -- should match the token type keys (\"resource\", \"clue\", etc)\n local tokenTemplates\n\n local playerCardData\n local locationData\n\n local TokenManager = { }\n local internal = { }\n\n -- Spawns tokens for the card. This function is built to just throw a card at it and let it do\n -- the work once a card has hit an area where it might spawn tokens. It will check to see if\n -- the card has already spawned, find appropriate data from either the uses metadata or the Data\n -- Helper, and spawn the tokens.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n TokenManager.spawnForCard = function(card, extraUses)\n if tokenSpawnTrackerApi.hasSpawnedTokens(card.getGUID()) then\n return\n end\n local metadata = JSON.decode(card.getGMNotes())\n if metadata ~= nil then\n internal.spawnTokensFromUses(card, extraUses)\n else\n internal.spawnTokensFromDataHelper(card)\n end\n end\n\n -- Spawns a set of tokens on the given card.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String Type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param tokenCount Number How many tokens to spawn. For damage or horror this value will be set to the\n -- spawned state object rather than spawning multiple tokens\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnTokenGroup = function(card, tokenType, tokenCount, shiftDown, subType)\n local optionPanel = optionPanelApi.getOptions()\n\n if tokenType == \"damage\" or tokenType == \"horror\" then\n TokenManager.spawnCounterToken(card, tokenType, tokenCount, shiftDown)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"enabled\" then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"custom\" and tokenCount == 0 then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n else\n TokenManager.spawnMultipleTokens(card, tokenType, tokenCount, shiftDown, subType)\n end\n end\n\n -- Spawns a single counter token and sets the value to tokenValue. Used for damage and horror\n -- tokens.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String type of token to spawn, valid values are \"damage\" and \"horror\". Other\n -- types should use spawnMultipleTokens()\n ---@param tokenValue Number Value to set the damage/horror to\n TokenManager.spawnCounterToken = function(card, tokenType, tokenValue, shiftDown)\n if tokenValue \u003c 1 or tokenValue \u003e 50 then return end\n\n local pos = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[1][1] + Vector(0, 0, shiftDown))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, tokenType, rot, function(spawned) spawned.setState(tokenValue) end)\n end\n\n TokenManager.spawnResourceCounterToken = function(card, tokenCount)\n local pos = card.positionToWorld(card.positionToLocal(card.getPosition()) + Vector(0, 0.2, -0.5))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, \"resourceCounter\", rot, function(spawned)\n spawned.call(\"updateVal\", tokenCount)\n end)\n end\n\n -- Spawns a number of tokens.\n ---@param tokenType String type of token to spawn, valid values are resource\", \"doom\", or \"clue\".\n -- Other types should use spawnCounterToken()\n ---@param tokenCount Number How many tokens to spawn\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnMultipleTokens = function(card, tokenType, tokenCount, shiftDown, subType)\n -- not checking the max at this point since clue offsets are calculated dynamically\n if tokenCount \u003c 1 then return end\n\n local offsets = {}\n if tokenType == \"clue\" then\n offsets = internal.buildClueOffsets(card, tokenCount)\n else\n -- only up to 12 offset tables defined\n if tokenCount \u003e 12 then return end\n for i = 1, tokenCount do\n offsets[i] = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[tokenCount][i])\n -- Fix the y-position for the spawn, since positionToWorld considers rotation which can\n -- have bad results for face up/down differences\n offsets[i].y = card.getPosition().y + 0.15\n end\n end\n\n if shiftDown ~= nil then\n -- Copy the offsets to make sure we don't change the static values\n local baseOffsets = offsets\n offsets = { }\n\n -- get a vector for the shifting (downwards local to the card)\n local shiftDownVector = Vector(0, 0, shiftDown):rotateOver(\"y\", card.getRotation().y)\n for i, baseOffset in ipairs(baseOffsets) do\n offsets[i] = baseOffset + shiftDownVector\n end\n end\n\n if offsets == nil then\n error(\"couldn't find offsets for \" .. tokenCount .. ' tokens')\n return\n end\n\n -- handling for not provided subtype (for example when spawning from custom data helpers)\n if subType == nil then\n subType = \"\"\n end\n \n -- this is used to load the correct state for additional resource tokens (e.g. \"Ammo\")\n local callback = nil\n local stateID = stateTable[string.lower(subType)]\n if tokenType == \"resource\" and stateID ~= nil and stateID ~= 1 then\n callback = function(spawned) spawned.setState(stateID) end\n end\n\n for i = 1, tokenCount do\n TokenManager.spawnToken(offsets[i], tokenType, card.getRotation(), callback)\n end\n end\n\n -- Spawns a single token at the given global position by copying it from the template bag.\n ---@param position Global position to spawn the token\n ---@param tokenType String type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param rotation Vector Rotation to be used for the new token. Only the y-value will be used,\n -- x and z will use the default rotation from the source bag\n ---@param callback function A callback function triggered after the new token is spawned\n TokenManager.spawnToken = function(position, tokenType, rotation, callback)\n internal.initTokenTemplates()\n local loadTokenType = tokenType\n if tokenType == \"clue\" or tokenType == \"doom\" then\n loadTokenType = \"clueDoom\"\n end\n if tokenTemplates[loadTokenType] == nil then\n error(\"Unknown token type '\" .. tokenType .. \"'\")\n return\n end\n local tokenTemplate = tokenTemplates[loadTokenType]\n\n -- Take ONLY the Y-value for rotation, so we don't flip the token coming out of the bag\n local rot = Vector(tokenTemplate.Transform.rotX,\n 270,\n tokenTemplate.Transform.rotZ)\n if rotation ~= nil then\n rot.y = rotation.y\n end\n if tokenType == \"doom\" then\n rot.z = 180\n end\n\n tokenTemplate.Nickname = \"\"\n return spawnObjectData({\n data = tokenTemplate,\n position = position,\n rotation = rot,\n callback_function = callback\n })\n end\n\n -- Checks a card for metadata to maybe replenish it\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n TokenManager.maybeReplenishCard = function(card, uses, mat)\n -- TODO: support for cards with multiple uses AND replenish (as of yet, no official card needs that)\n if uses[1].count and uses[1].replenish then\n internal.replenishTokens(card, uses, mat)\n end\n end\n\n -- Delegate function to the token spawn tracker. Exists to avoid circular dependencies in some\n -- callers.\n ---@param card Object Card object to reset the tokens for\n TokenManager.resetTokensSpawned = function(card)\n tokenSpawnTrackerApi.resetTokensSpawned(card.getGUID())\n end\n\n -- Pushes new player card data into the local copy of the Data Helper player data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addPlayerCardData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n playerCardData[k] = v\n end\n end\n\n -- Pushes new location data into the local copy of the Data Helper location data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addLocationData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n locationData[k] = v\n end\n end\n\n -- Checks to see if the given card has location data in the DataHelper\n ---@param card Object Card to check for data\n ---@return Boolean True if this card has data in the helper, false otherwise\n TokenManager.hasLocationData = function(card)\n internal.initDataHelperData()\n return internal.getLocationData(card) ~= nil\n end\n\n internal.initTokenTemplates = function()\n if tokenTemplates ~= nil then\n return\n end\n tokenTemplates = {}\n local tokenSource = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenSource\")\n for _, tokenTemplate in ipairs(tokenSource.getData().ContainedObjects) do\n local tokenName = tokenTemplate.Memo\n tokenTemplates[tokenName] = tokenTemplate\n end\n end\n\n -- Copies the data from the DataHelper. Will only happen once.\n internal.initDataHelperData = function()\n if playerCardData ~= nil then\n return\n end\n local dataHelper = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"DataHelper\")\n playerCardData = dataHelper.getTable('PLAYER_CARD_DATA')\n locationData = dataHelper.getTable('LOCATIONS_DATA')\n end\n\n -- Spawn tokens for a card based on the uses metadata. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n internal.spawnTokensFromUses = function(card, extraUses)\n local uses = internal.getUses(card)\n if uses == nil then return end\n\n -- go through tokens to spawn\n local tokenCount\n for i, useInfo in ipairs(uses) do\n tokenCount = (useInfo.count or 0) + (useInfo.countPerInvestigator or 0) * playAreaApi.getInvestigatorCount()\n if extraUses ~= nil and extraUses[useInfo.type] ~= nil then\n tokenCount = tokenCount + extraUses[useInfo.type]\n end\n -- Shift each spawned group after the first down so they don't pile on each other\n TokenManager.spawnTokenGroup(card, useInfo.token, tokenCount, (i - 1) * 0.8, useInfo.type)\n end\n \n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a card based on the data helper data. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n internal.spawnTokensFromDataHelper = function(card)\n internal.initDataHelperData()\n local playerData = internal.getPlayerCardData(card)\n if playerData ~= nil then\n internal.spawnPlayerCardTokensFromDataHelper(card, playerData)\n end\n local locationData = internal.getLocationData(card)\n if locationData ~= nil then\n internal.spawnLocationTokensFromDataHelper(card, locationData)\n end\n end\n\n -- Spawn tokens for a player card using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Player card data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnPlayerCardTokensFromDataHelper = function(card, playerData)\n local token = playerData.tokenType\n local tokenCount = playerData.tokenCount\n TokenManager.spawnTokenGroup(card, token, tokenCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a location using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Location data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnLocationTokensFromDataHelper = function(card, locationData)\n local clueCount = internal.getClueCountFromData(card, locationData)\n if clueCount \u003e 0 then\n TokenManager.spawnTokenGroup(card, \"clue\", clueCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n end\n\n internal.getPlayerCardData = function(card)\n return playerCardData[card.getName() .. ':' .. card.getDescription()]\n or playerCardData[card.getName()]\n end\n\n internal.getLocationData = function(card)\n return locationData[card.getName() .. '_' .. card.getGUID()] or locationData[card.getName()]\n end\n\n internal.getClueCountFromData = function(card, locationData)\n -- Return the number of clues to spawn on this location\n if locationData == nil then\n error('attempted to get clue for unexpected object: ' .. card.getName())\n return 0\n end\n\n if ((card.is_face_down and locationData.clueSide == 'back')\n or (not card.is_face_down and locationData.clueSide == 'front')) then\n if locationData.type == 'fixed' then\n return locationData.value\n elseif locationData.type == 'perPlayer' then\n return locationData.value * playAreaApi.getInvestigatorCount()\n end\n error('unexpected location type: ' .. locationData.type)\n end\n return 0\n end\n\n -- Gets the right uses structure for this card, based on metadata and face up/down state\n ---@param card Object Card to pull the uses from\n internal.getUses = function(card)\n local metadata = JSON.decode(card.getGMNotes()) or { }\n if metadata.type == \"Location\" then\n if card.is_face_down and metadata.locationBack ~= nil then\n return metadata.locationBack.uses\n elseif not card.is_face_down and metadata.locationFront ~= nil then\n return metadata.locationFront.uses\n end\n elseif not card.is_face_down then\n return metadata.uses\n end\n\n return nil\n end\n\n -- Dynamically create positions for clues on a card.\n ---@param card Object Card the clues will be placed on\n ---@param count Integer How many clues?\n ---@return Table Array of global positions to spawn the clues at\n internal.buildClueOffsets = function(card, count)\n local pos = card.getPosition()\n local cluePositions = { }\n for i = 1, count do\n local row = math.floor(1 + (i - 1) / 4)\n local column = (i - 1) % 4\n table.insert(cluePositions, Vector(pos.x + 1.5 - 0.55 * row, pos.y + 0.15, pos.z - 0.825 + 0.55 * column))\n end\n return cluePositions\n end\n\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n internal.replenishTokens = function(card, uses, mat)\n local cardPos = card.getPosition()\n\n -- don't continue for cards on the deck (Norman) or in the discard pile\n if mat.positionToLocal(cardPos).x \u003c -1 then return end\n\n -- get current amount of resource tokens on the card\n local search = internal.searchOnCard(cardPos, card.getRotation())\n local clickableResourceCounter = nil\n local foundTokens = 0\n\n for _, obj in ipairs(search) do\n local obj = obj.hit_object\n local memo = obj.getMemo()\n\n if (stateTable[memo] or 0) \u003e 0 then\n foundTokens = foundTokens + math.abs(obj.getQuantity())\n obj.destruct()\n elseif memo == \"resourceCounter\" then\n foundTokens = obj.getVar(\"val\")\n clickableResourceCounter = obj\n break\n end\n end\n\n -- this is the theoretical new amount of uses (to be checked below)\n local newCount = foundTokens + uses[1].replenish\n\n -- if there are already more uses than the replenish amount, keep them\n if foundTokens \u003e uses[1].count then\n newCount = foundTokens\n -- only replenish up until the replenish amount\n elseif newCount \u003e uses[1].count then\n newCount = uses[1].count\n end\n\n -- update the clickable counter or spawn a group of tokens\n if clickableResourceCounter then\n clickableResourceCounter.call(\"updateVal\", newCount)\n else\n TokenManager.spawnTokenGroup(card, uses[1].token, newCount, _, uses[1].type)\n end\n end\n\n -- searches on a card (standard size) and returns the result\n ---@param position Table Position of the card\n ---@param rotation Table Rotation of the card\n internal.searchOnCard = function(position, rotation)\n return Physics.cast({\n origin = position,\n direction = {0, 1, 0},\n orientation = rotation,\n type = 3,\n size = { 2.5, 0.5, 3.5 },\n max_distance = 1,\n debug = false\n })\n end\n\n return TokenManager\nend\nend)\n__bundle_register(\"core/token/TokenSpawnTrackerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenSpawnTracker = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getSpawnTracker()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenSpawnTracker\")\n end\n\n TokenSpawnTracker.hasSpawnedTokens = function(cardGuid)\n return getSpawnTracker().call(\"hasSpawnedTokens\", cardGuid)\n end\n\n TokenSpawnTracker.markTokensSpawned = function(cardGuid)\n return getSpawnTracker().call(\"markTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetTokensSpawned = function(cardGuid)\n return getSpawnTracker().call(\"resetTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetAllAssetAndEvents = function()\n return getSpawnTracker().call(\"resetAllAssetAndEvents\")\n end\n\n TokenSpawnTracker.resetAllLocations = function()\n return getSpawnTracker().call(\"resetAllLocations\")\n end\n\n TokenSpawnTracker.resetAll = function()\n return getSpawnTracker().call(\"resetAll\")\n end\n\n return TokenSpawnTracker\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playermat/Playmat\")\nend)\n__bundle_register(\"core/MythosAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local MythosAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getMythosArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"MythosArea\")\n end\n\n -- returns the chaos token metadata (if provided through scenario reference card)\n MythosAreaApi.returnTokenData = function()\n return getMythosArea().call(\"returnTokenData\")\n end\n \n -- returns an object reference to the encounter deck\n MythosAreaApi.getEncounterDeck = function()\n return getMythosArea().call(\"getEncounterDeck\")\n end\n\n -- draw an encounter card to the requested position/rotation\n MythosAreaApi.drawEncounterCard = function(pos, rotY, alwaysFaceUp)\n getMythosArea().call(\"drawEncounterCard\", {\n pos = pos,\n rotY = rotY,\n alwaysFaceUp = alwaysFaceUp\n })\n end\n\n return MythosAreaApi\nend\nend)\n__bundle_register(\"core/NavigationOverlayApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local NavigationOverlayApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getNOHandler()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"NavigationOverlayHandler\")\n end\n\n -- Copies the visibility for the Navigation overlay\n ---@param startColor String Color of the player to copy from\n ---@param targetColor String Color of the targeted player\n NavigationOverlayApi.copyVisibility = function(startColor, targetColor)\n getNOHandler().call(\"copyVisibility\", {\n startColor = startColor,\n targetColor = targetColor\n })\n end \n\n -- Changes the Navigation Overlay view (\"Full View\" --\u003e \"Play Areas\" --\u003e \"Closed\" etc.)\n ---@param playerColor String Color of the player to update the visibility for\n NavigationOverlayApi.cycleVisibility = function(playerColor)\n getNOHandler().call(\"cycleVisibility\", playerColor)\n end\n\n return NavigationOverlayApi\nend\nend)\n__bundle_register(\"core/OptionPanelApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local OptionPanelApi = {}\n\n -- loads saved options\n ---@param options Table New options table\n OptionPanelApi.loadSettings = function(options)\n return Global.call(\"loadSettings\", options)\n end\n\n -- returns option panel table\n OptionPanelApi.getOptions = function()\n return Global.getTable(\"optionPanel\")\n end\n\n return OptionPanelApi\nend\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getPlayArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"PlayArea\")\n end\n\n local function getInvestigatorCounter()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"InvestigatorCounter\")\n end\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getInvestigatorCounter().getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n getInvestigatorCounter().call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with 'displacement_excluded'\n ---@param playerColor Color Color of the player requesting the shift for messages\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getPlayArea().call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getPlayArea().call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getPlayArea().call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getPlayArea().call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getPlayArea().call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getPlayArea().call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getPlayArea().call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getPlayArea().call(\"tryObjectEnterContainer\", { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getPlayArea().call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getPlayArea().call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getPlayArea().call(\"countVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getPlayArea().call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getPlayArea().getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getPlayArea().call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getPlayArea().call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getPlayArea().getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScriptState": "{\"activeInvestigatorId\":\"00000\",\"isDrawButtonVisible\":false,\"playerColor\":\"Green\"}", + "MeasureMovement": false, + "Memo": "Green", + "Name": "Custom_Tile", + "Nickname": "Playermat 3: Green", + "Snap": true, + "Sticky": true, + "Tooltip": false, + "Transform": { + "posX": -30.35, + "posY": 1.45, + "posZ": 26.6, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 6.43, + "scaleY": 1, + "scaleZ": 6.43 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "AttachedSnapPoints": [ + { + "Position": { + "x": -1, + "y": 0.1, + "z": 0.118 + }, + "Tags": [ + "ActionToken" + ] + }, + { + "Position": { + "x": -0.865, + "y": 0.1, + "z": -0.28 + }, + "Tags": [ + "ActionToken" + ] + }, + { + "Position": { + "x": -1, + "y": 0.1, + "z": -0.28 + }, + "Tags": [ + "ActionToken" + ] + }, + { + "Position": { + "x": -1.18, + "y": 0.1, + "z": -0.28 + }, + "Tags": [ + "ActionToken" + ] + }, + { + "Position": { + "x": -1.36, + "y": 0.1, + "z": -0.28 + }, + "Tags": [ + "ActionToken" + ] + }, + { + "Position": { + "x": -0.631, + "y": 0.1, + "z": 0.551 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": -0.616, + "y": 0.102, + "z": 0.024 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": -0.177, + "y": 0.101, + "z": 0.032 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": -0.174, + "y": 0.099, + "z": 0.551 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": 0.212, + "y": 0.1, + "z": 0.559 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": 0.217, + "y": 0.1, + "z": 0.035 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": 0.602, + "y": 0.1, + "z": 0.033 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": 0.605, + "y": 0.1, + "z": 0.555 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": 0.977, + "y": 0.099, + "z": 0.556 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": 0.98, + "y": 0.099, + "z": 0.035 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": 1.371, + "y": 0.1, + "z": 0.038 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": 1.371, + "y": 0.099, + "z": 0.558 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": 1.754, + "y": 0.1, + "z": 0.563 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": 1.758, + "y": 0.101, + "z": 0.04 + }, + "Tags": [ + "Asset" + ] + }, + { + "Position": { + "x": -1.82, + "y": 0.1, + "z": 0.61 + }, + "Rotation": { + "x": 0, + "y": 0, + "z": 0 + } + }, + { + "Position": { + "x": -1.82, + "y": 0.1, + "z": 0 + }, + "Rotation": { + "x": 0, + "y": 0, + "z": 0 + } + }, + { + "Position": { + "x": -1.177, + "y": 0.1, + "z": 0 + }, + "Tags": [ + "Investigator" + ] + }, + { + "Position": { + "x": 1.365, + "y": 0.1, + "z": -0.625 + }, + "Rotation": { + "x": 0, + "y": 0, + "z": 0 + } + }, + { + "Position": { + "x": 0.91, + "y": 0.1, + "z": -0.625 + }, + "Rotation": { + "x": 0, + "y": 0, + "z": 0 + } + }, + { + "Position": { + "x": 0.455, + "y": 0.1, + "z": -0.625 + }, + "Rotation": { + "x": 0, + "y": 0, + "z": 0 + } + }, + { + "Position": { + "x": 0, + "y": 0.1, + "z": -0.625 + }, + "Rotation": { + "x": 0, + "y": 0, + "z": 0 + } + }, + { + "Position": { + "x": -0.455, + "y": 0.1, + "z": -0.625 + }, + "Rotation": { + "x": 0, + "y": 0, + "z": 0 + } + }, + { + "Position": { + "x": -0.91, + "y": 0.1, + "z": -0.625 + }, + "Rotation": { + "x": 0, + "y": 0, + "z": 0 + } + }, + { + "Position": { + "x": -1.365, + "y": 0.1, + "z": -0.625 + }, + "Rotation": { + "x": 0, + "y": 0, + "z": 0 + } + } + ], + "Autoraise": true, + "ColorDiffuse": { + "b": 0, + "g": 0, + "r": 0 + }, + "CustomImage": { + "CustomTile": { + "Stackable": false, + "Stretch": true, + "Thickness": 0.1, + "Type": 3 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/2037357630681963618/E7271737B19CE0BFAAA382BEEEF497FE3E06ECC1/", + "WidthScale": 0 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0840d5", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": true, + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/token/TokenSpawnTrackerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenSpawnTracker = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getSpawnTracker()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenSpawnTracker\")\n end\n\n TokenSpawnTracker.hasSpawnedTokens = function(cardGuid)\n return getSpawnTracker().call(\"hasSpawnedTokens\", cardGuid)\n end\n\n TokenSpawnTracker.markTokensSpawned = function(cardGuid)\n return getSpawnTracker().call(\"markTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetTokensSpawned = function(cardGuid)\n return getSpawnTracker().call(\"resetTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetAllAssetAndEvents = function()\n return getSpawnTracker().call(\"resetAllAssetAndEvents\")\n end\n\n TokenSpawnTracker.resetAllLocations = function()\n return getSpawnTracker().call(\"resetAllLocations\")\n end\n\n TokenSpawnTracker.resetAll = function()\n return getSpawnTracker().call(\"resetAll\")\n end\n\n return TokenSpawnTracker\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playermat/Playmat\")\nend)\n__bundle_register(\"core/MythosAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local MythosAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getMythosArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"MythosArea\")\n end\n\n -- returns the chaos token metadata (if provided through scenario reference card)\n MythosAreaApi.returnTokenData = function()\n return getMythosArea().call(\"returnTokenData\")\n end\n \n -- returns an object reference to the encounter deck\n MythosAreaApi.getEncounterDeck = function()\n return getMythosArea().call(\"getEncounterDeck\")\n end\n\n -- draw an encounter card to the requested position/rotation\n MythosAreaApi.drawEncounterCard = function(pos, rotY, alwaysFaceUp)\n getMythosArea().call(\"drawEncounterCard\", {\n pos = pos,\n rotY = rotY,\n alwaysFaceUp = alwaysFaceUp\n })\n end\n\n return MythosAreaApi\nend\nend)\n__bundle_register(\"core/token/TokenChecker\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local CHAOS_TOKEN_NAMES = {\n [\"Elder Sign\"] = true,\n [\"+1\"] = true,\n [\"0\"] = true,\n [\"-1\"] = true,\n [\"-2\"] = true,\n [\"-3\"] = true,\n [\"-4\"] = true,\n [\"-5\"] = true,\n [\"-6\"] = true,\n [\"-7\"] = true,\n [\"-8\"] = true,\n [\"Skull\"] = true,\n [\"Cultist\"] = true,\n [\"Tablet\"] = true,\n [\"Elder Thing\"] = true,\n [\"Auto-fail\"] = true,\n [\"Bless\"] = true,\n [\"Curse\"] = true,\n [\"Frost\"] = true\n }\n\n local TokenChecker = {}\n\n -- returns true if the passed object is a chaos token (by name)\n TokenChecker.isChaosToken = function(obj)\n if CHAOS_TOKEN_NAMES[obj.getName()] then\n return true\n else\n return false\n end\n end\n\n return TokenChecker\nend\nend)\n__bundle_register(\"core/NavigationOverlayApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local NavigationOverlayApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getNOHandler()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"NavigationOverlayHandler\")\n end\n\n -- Copies the visibility for the Navigation overlay\n ---@param startColor String Color of the player to copy from\n ---@param targetColor String Color of the targeted player\n NavigationOverlayApi.copyVisibility = function(startColor, targetColor)\n getNOHandler().call(\"copyVisibility\", {\n startColor = startColor,\n targetColor = targetColor\n })\n end \n\n -- Changes the Navigation Overlay view (\"Full View\" --\u003e \"Play Areas\" --\u003e \"Closed\" etc.)\n ---@param playerColor String Color of the player to update the visibility for\n NavigationOverlayApi.cycleVisibility = function(playerColor)\n getNOHandler().call(\"cycleVisibility\", playerColor)\n end\n\n return NavigationOverlayApi\nend\nend)\n__bundle_register(\"core/token/TokenManager\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n local optionPanelApi = require(\"core/OptionPanelApi\")\n local playAreaApi = require(\"core/PlayAreaApi\")\n local tokenSpawnTrackerApi = require(\"core/token/TokenSpawnTrackerApi\")\n\n local PLAYER_CARD_TOKEN_OFFSETS = {\n [1] = {\n Vector(0, 3, -0.2)\n },\n [2] = {\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [3] = {\n Vector(0, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [4] = {\n Vector(0.4, 3, -0.9),\n Vector(-0.4, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [5] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [6] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2)\n },\n [7] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0, 3, 0.5)\n },\n [8] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(-0.35, 3, 0.5),\n Vector(0.35, 3, 0.5)\n },\n [9] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5)\n },\n [10] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0, 3, 1.2)\n },\n [11] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(-0.35, 3, 1.2),\n Vector(0.35, 3, 1.2)\n },\n [12] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0.7, 3, 1.2),\n Vector(0, 3, 1.2),\n Vector(-0.7, 3, 1.2)\n }\n }\n\n -- stateIDs for the multi-stated resource tokens\n local stateTable = {\n [\"resource\"] = 1,\n [\"ammo\"] = 2,\n [\"bounty\"] = 3,\n [\"charge\"] = 4,\n [\"evidence\"] = 5,\n [\"secret\"] = 6,\n [\"supply\"] = 7\n }\n\n -- Table of data extracted from the token source bag, keyed by the Memo on each token which\n -- should match the token type keys (\"resource\", \"clue\", etc)\n local tokenTemplates\n\n local playerCardData\n local locationData\n\n local TokenManager = { }\n local internal = { }\n\n -- Spawns tokens for the card. This function is built to just throw a card at it and let it do\n -- the work once a card has hit an area where it might spawn tokens. It will check to see if\n -- the card has already spawned, find appropriate data from either the uses metadata or the Data\n -- Helper, and spawn the tokens.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n TokenManager.spawnForCard = function(card, extraUses)\n if tokenSpawnTrackerApi.hasSpawnedTokens(card.getGUID()) then\n return\n end\n local metadata = JSON.decode(card.getGMNotes())\n if metadata ~= nil then\n internal.spawnTokensFromUses(card, extraUses)\n else\n internal.spawnTokensFromDataHelper(card)\n end\n end\n\n -- Spawns a set of tokens on the given card.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String Type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param tokenCount Number How many tokens to spawn. For damage or horror this value will be set to the\n -- spawned state object rather than spawning multiple tokens\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnTokenGroup = function(card, tokenType, tokenCount, shiftDown, subType)\n local optionPanel = optionPanelApi.getOptions()\n\n if tokenType == \"damage\" or tokenType == \"horror\" then\n TokenManager.spawnCounterToken(card, tokenType, tokenCount, shiftDown)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"enabled\" then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"custom\" and tokenCount == 0 then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n else\n TokenManager.spawnMultipleTokens(card, tokenType, tokenCount, shiftDown, subType)\n end\n end\n\n -- Spawns a single counter token and sets the value to tokenValue. Used for damage and horror\n -- tokens.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String type of token to spawn, valid values are \"damage\" and \"horror\". Other\n -- types should use spawnMultipleTokens()\n ---@param tokenValue Number Value to set the damage/horror to\n TokenManager.spawnCounterToken = function(card, tokenType, tokenValue, shiftDown)\n if tokenValue \u003c 1 or tokenValue \u003e 50 then return end\n\n local pos = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[1][1] + Vector(0, 0, shiftDown))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, tokenType, rot, function(spawned) spawned.setState(tokenValue) end)\n end\n\n TokenManager.spawnResourceCounterToken = function(card, tokenCount)\n local pos = card.positionToWorld(card.positionToLocal(card.getPosition()) + Vector(0, 0.2, -0.5))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, \"resourceCounter\", rot, function(spawned)\n spawned.call(\"updateVal\", tokenCount)\n end)\n end\n\n -- Spawns a number of tokens.\n ---@param tokenType String type of token to spawn, valid values are resource\", \"doom\", or \"clue\".\n -- Other types should use spawnCounterToken()\n ---@param tokenCount Number How many tokens to spawn\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnMultipleTokens = function(card, tokenType, tokenCount, shiftDown, subType)\n -- not checking the max at this point since clue offsets are calculated dynamically\n if tokenCount \u003c 1 then return end\n\n local offsets = {}\n if tokenType == \"clue\" then\n offsets = internal.buildClueOffsets(card, tokenCount)\n else\n -- only up to 12 offset tables defined\n if tokenCount \u003e 12 then return end\n for i = 1, tokenCount do\n offsets[i] = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[tokenCount][i])\n -- Fix the y-position for the spawn, since positionToWorld considers rotation which can\n -- have bad results for face up/down differences\n offsets[i].y = card.getPosition().y + 0.15\n end\n end\n\n if shiftDown ~= nil then\n -- Copy the offsets to make sure we don't change the static values\n local baseOffsets = offsets\n offsets = { }\n\n -- get a vector for the shifting (downwards local to the card)\n local shiftDownVector = Vector(0, 0, shiftDown):rotateOver(\"y\", card.getRotation().y)\n for i, baseOffset in ipairs(baseOffsets) do\n offsets[i] = baseOffset + shiftDownVector\n end\n end\n\n if offsets == nil then\n error(\"couldn't find offsets for \" .. tokenCount .. ' tokens')\n return\n end\n\n -- handling for not provided subtype (for example when spawning from custom data helpers)\n if subType == nil then\n subType = \"\"\n end\n \n -- this is used to load the correct state for additional resource tokens (e.g. \"Ammo\")\n local callback = nil\n local stateID = stateTable[string.lower(subType)]\n if tokenType == \"resource\" and stateID ~= nil and stateID ~= 1 then\n callback = function(spawned) spawned.setState(stateID) end\n end\n\n for i = 1, tokenCount do\n TokenManager.spawnToken(offsets[i], tokenType, card.getRotation(), callback)\n end\n end\n\n -- Spawns a single token at the given global position by copying it from the template bag.\n ---@param position Global position to spawn the token\n ---@param tokenType String type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param rotation Vector Rotation to be used for the new token. Only the y-value will be used,\n -- x and z will use the default rotation from the source bag\n ---@param callback function A callback function triggered after the new token is spawned\n TokenManager.spawnToken = function(position, tokenType, rotation, callback)\n internal.initTokenTemplates()\n local loadTokenType = tokenType\n if tokenType == \"clue\" or tokenType == \"doom\" then\n loadTokenType = \"clueDoom\"\n end\n if tokenTemplates[loadTokenType] == nil then\n error(\"Unknown token type '\" .. tokenType .. \"'\")\n return\n end\n local tokenTemplate = tokenTemplates[loadTokenType]\n\n -- Take ONLY the Y-value for rotation, so we don't flip the token coming out of the bag\n local rot = Vector(tokenTemplate.Transform.rotX,\n 270,\n tokenTemplate.Transform.rotZ)\n if rotation ~= nil then\n rot.y = rotation.y\n end\n if tokenType == \"doom\" then\n rot.z = 180\n end\n\n tokenTemplate.Nickname = \"\"\n return spawnObjectData({\n data = tokenTemplate,\n position = position,\n rotation = rot,\n callback_function = callback\n })\n end\n\n -- Checks a card for metadata to maybe replenish it\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n TokenManager.maybeReplenishCard = function(card, uses, mat)\n -- TODO: support for cards with multiple uses AND replenish (as of yet, no official card needs that)\n if uses[1].count and uses[1].replenish then\n internal.replenishTokens(card, uses, mat)\n end\n end\n\n -- Delegate function to the token spawn tracker. Exists to avoid circular dependencies in some\n -- callers.\n ---@param card Object Card object to reset the tokens for\n TokenManager.resetTokensSpawned = function(card)\n tokenSpawnTrackerApi.resetTokensSpawned(card.getGUID())\n end\n\n -- Pushes new player card data into the local copy of the Data Helper player data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addPlayerCardData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n playerCardData[k] = v\n end\n end\n\n -- Pushes new location data into the local copy of the Data Helper location data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addLocationData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n locationData[k] = v\n end\n end\n\n -- Checks to see if the given card has location data in the DataHelper\n ---@param card Object Card to check for data\n ---@return Boolean True if this card has data in the helper, false otherwise\n TokenManager.hasLocationData = function(card)\n internal.initDataHelperData()\n return internal.getLocationData(card) ~= nil\n end\n\n internal.initTokenTemplates = function()\n if tokenTemplates ~= nil then\n return\n end\n tokenTemplates = {}\n local tokenSource = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenSource\")\n for _, tokenTemplate in ipairs(tokenSource.getData().ContainedObjects) do\n local tokenName = tokenTemplate.Memo\n tokenTemplates[tokenName] = tokenTemplate\n end\n end\n\n -- Copies the data from the DataHelper. Will only happen once.\n internal.initDataHelperData = function()\n if playerCardData ~= nil then\n return\n end\n local dataHelper = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"DataHelper\")\n playerCardData = dataHelper.getTable('PLAYER_CARD_DATA')\n locationData = dataHelper.getTable('LOCATIONS_DATA')\n end\n\n -- Spawn tokens for a card based on the uses metadata. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n internal.spawnTokensFromUses = function(card, extraUses)\n local uses = internal.getUses(card)\n if uses == nil then return end\n\n -- go through tokens to spawn\n local tokenCount\n for i, useInfo in ipairs(uses) do\n tokenCount = (useInfo.count or 0) + (useInfo.countPerInvestigator or 0) * playAreaApi.getInvestigatorCount()\n if extraUses ~= nil and extraUses[useInfo.type] ~= nil then\n tokenCount = tokenCount + extraUses[useInfo.type]\n end\n -- Shift each spawned group after the first down so they don't pile on each other\n TokenManager.spawnTokenGroup(card, useInfo.token, tokenCount, (i - 1) * 0.8, useInfo.type)\n end\n \n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a card based on the data helper data. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n internal.spawnTokensFromDataHelper = function(card)\n internal.initDataHelperData()\n local playerData = internal.getPlayerCardData(card)\n if playerData ~= nil then\n internal.spawnPlayerCardTokensFromDataHelper(card, playerData)\n end\n local locationData = internal.getLocationData(card)\n if locationData ~= nil then\n internal.spawnLocationTokensFromDataHelper(card, locationData)\n end\n end\n\n -- Spawn tokens for a player card using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Player card data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnPlayerCardTokensFromDataHelper = function(card, playerData)\n local token = playerData.tokenType\n local tokenCount = playerData.tokenCount\n TokenManager.spawnTokenGroup(card, token, tokenCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a location using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Location data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnLocationTokensFromDataHelper = function(card, locationData)\n local clueCount = internal.getClueCountFromData(card, locationData)\n if clueCount \u003e 0 then\n TokenManager.spawnTokenGroup(card, \"clue\", clueCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n end\n\n internal.getPlayerCardData = function(card)\n return playerCardData[card.getName() .. ':' .. card.getDescription()]\n or playerCardData[card.getName()]\n end\n\n internal.getLocationData = function(card)\n return locationData[card.getName() .. '_' .. card.getGUID()] or locationData[card.getName()]\n end\n\n internal.getClueCountFromData = function(card, locationData)\n -- Return the number of clues to spawn on this location\n if locationData == nil then\n error('attempted to get clue for unexpected object: ' .. card.getName())\n return 0\n end\n\n if ((card.is_face_down and locationData.clueSide == 'back')\n or (not card.is_face_down and locationData.clueSide == 'front')) then\n if locationData.type == 'fixed' then\n return locationData.value\n elseif locationData.type == 'perPlayer' then\n return locationData.value * playAreaApi.getInvestigatorCount()\n end\n error('unexpected location type: ' .. locationData.type)\n end\n return 0\n end\n\n -- Gets the right uses structure for this card, based on metadata and face up/down state\n ---@param card Object Card to pull the uses from\n internal.getUses = function(card)\n local metadata = JSON.decode(card.getGMNotes()) or { }\n if metadata.type == \"Location\" then\n if card.is_face_down and metadata.locationBack ~= nil then\n return metadata.locationBack.uses\n elseif not card.is_face_down and metadata.locationFront ~= nil then\n return metadata.locationFront.uses\n end\n elseif not card.is_face_down then\n return metadata.uses\n end\n\n return nil\n end\n\n -- Dynamically create positions for clues on a card.\n ---@param card Object Card the clues will be placed on\n ---@param count Integer How many clues?\n ---@return Table Array of global positions to spawn the clues at\n internal.buildClueOffsets = function(card, count)\n local pos = card.getPosition()\n local cluePositions = { }\n for i = 1, count do\n local row = math.floor(1 + (i - 1) / 4)\n local column = (i - 1) % 4\n table.insert(cluePositions, Vector(pos.x + 1.5 - 0.55 * row, pos.y + 0.15, pos.z - 0.825 + 0.55 * column))\n end\n return cluePositions\n end\n\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n internal.replenishTokens = function(card, uses, mat)\n local cardPos = card.getPosition()\n\n -- don't continue for cards on the deck (Norman) or in the discard pile\n if mat.positionToLocal(cardPos).x \u003c -1 then return end\n\n -- get current amount of resource tokens on the card\n local search = internal.searchOnCard(cardPos, card.getRotation())\n local clickableResourceCounter = nil\n local foundTokens = 0\n\n for _, obj in ipairs(search) do\n local obj = obj.hit_object\n local memo = obj.getMemo()\n\n if (stateTable[memo] or 0) \u003e 0 then\n foundTokens = foundTokens + math.abs(obj.getQuantity())\n obj.destruct()\n elseif memo == \"resourceCounter\" then\n foundTokens = obj.getVar(\"val\")\n clickableResourceCounter = obj\n break\n end\n end\n\n -- this is the theoretical new amount of uses (to be checked below)\n local newCount = foundTokens + uses[1].replenish\n\n -- if there are already more uses than the replenish amount, keep them\n if foundTokens \u003e uses[1].count then\n newCount = foundTokens\n -- only replenish up until the replenish amount\n elseif newCount \u003e uses[1].count then\n newCount = uses[1].count\n end\n\n -- update the clickable counter or spawn a group of tokens\n if clickableResourceCounter then\n clickableResourceCounter.call(\"updateVal\", newCount)\n else\n TokenManager.spawnTokenGroup(card, uses[1].token, newCount, _, uses[1].type)\n end\n end\n\n -- searches on a card (standard size) and returns the result\n ---@param position Table Position of the card\n ---@param rotation Table Rotation of the card\n internal.searchOnCard = function(position, rotation)\n return Physics.cast({\n origin = position,\n direction = {0, 1, 0},\n orientation = rotation,\n type = 3,\n size = { 2.5, 0.5, 3.5 },\n max_distance = 1,\n debug = false\n })\n end\n\n return TokenManager\nend\nend)\n__bundle_register(\"core/OptionPanelApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local OptionPanelApi = {}\n\n -- loads saved options\n ---@param options Table New options table\n OptionPanelApi.loadSettings = function(options)\n return Global.call(\"loadSettings\", options)\n end\n\n -- returns option panel table\n OptionPanelApi.getOptions = function()\n return Global.getTable(\"optionPanel\")\n end\n\n return OptionPanelApi\nend\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getPlayArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"PlayArea\")\n end\n\n local function getInvestigatorCounter()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"InvestigatorCounter\")\n end\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getInvestigatorCounter().getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n getInvestigatorCounter().call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with 'displacement_excluded'\n ---@param playerColor Color Color of the player requesting the shift for messages\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getPlayArea().call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getPlayArea().call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getPlayArea().call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getPlayArea().call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getPlayArea().call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getPlayArea().call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getPlayArea().call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getPlayArea().call(\"tryObjectEnterContainer\", { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getPlayArea().call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getPlayArea().call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getPlayArea().call(\"countVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getPlayArea().call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getPlayArea().getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getPlayArea().call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getPlayArea().call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getPlayArea().getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\n__bundle_register(\"playermat/Playmat\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal guidReferenceApi = require(\"core/GUIDReferenceApi\")\nlocal mythosAreaApi = require(\"core/MythosAreaApi\")\nlocal navigationOverlayApi = require(\"core/NavigationOverlayApi\")\nlocal tokenChecker = require(\"core/token/TokenChecker\")\nlocal tokenManager = require(\"core/token/TokenManager\")\n\n-- set true to enable debug logging and show Physics.cast()\nlocal DEBUG = false\n\n-- we use this to turn off collision handling until onLoad() is complete\nlocal collisionEnabled = false\n\n-- position offsets relative to mat [x, y, z]\nlocal DRAWN_ENCOUNTER_CARD_OFFSET = {1.365, 0.5, -0.625}\nlocal DRAWN_CHAOS_TOKEN_OFFSET = {-1.55, 0.25, -0.58}\n\n-- x-Values for discard buttons\nlocal DISCARD_BUTTON_OFFSETS = {-1.365, -0.91, -0.455, 0, 0.455, 0.91}\n\nlocal SEARCH_AROUND_SELF_X_BUFFER = 8\n\n-- defined areas for \"inArea()\" and \"Physics.cast()\"\nlocal MAIN_PLAY_AREA = {\n upperLeft = {\n x = 1.98,\n z = 0.736\n },\n lowerRight = {\n x = -0.79,\n z = -0.39\n }\n}\nlocal INVESTIGATOR_AREA = {\n upperLeft = {\n x = -1.084,\n z = 0.06517\n },\n lowerRight = {\n x = -1.258,\n z = -0.0805\n }\n}\nlocal THREAT_AREA = {\n upperLeft = {\n x = 1.53,\n z = -0.34\n },\n lowerRight = {\n x = -1.13,\n z = -0.92\n }\n}\nlocal DECK_DISCARD_AREA = {\n upperLeft = {\n x = -1.62,\n z = 0.855\n },\n lowerRight = {\n x = -2.02,\n z = -0.245\n },\n center = {\n x = -1.82,\n y = 0.5,\n z = 0.305\n },\n size = {\n x = 0.4,\n y = 3,\n z = 1.1\n }\n}\n\n-- local position of draw and discard pile\nlocal DRAW_DECK_POSITION = { x = -1.82, y = 0.1, z = 0 }\nlocal DISCARD_PILE_POSITION = { x = -1.82, y = 0.1, z = 0.61 }\n\n-- global position of encounter discard pile\nlocal ENCOUNTER_DISCARD_POSITION = { x = -3.85, y = 1.5, z = 10.38}\n\n-- global variable so it can be reset by the Clean Up Helper\nactiveInvestigatorId = \"00000\"\n\n-- table of type-object reference pairs of all owned objects\nlocal ownedObjects = {}\nlocal matColor = self.getMemo()\n\n-- variable to track the status of the \"Show Draw Button\" option\nlocal isDrawButtonVisible = false\n\n-- global variable to report \"Dream-Enhancing Serum\" status\nisDES = false\n\nfunction onSave()\n return JSON.encode({\n playerColor = playerColor,\n activeInvestigatorId = activeInvestigatorId,\n isDrawButtonVisible = isDrawButtonVisible\n })\nend\n\nfunction onLoad(saveState)\n self.interactable = DEBUG\n\n -- get object references to owned objects\n ownedObjects = guidReferenceApi.getObjectsByOwner(matColor)\n\n -- button creation\n for i = 1, 6 do\n makeDiscardButton(DISCARD_BUTTON_OFFSETS[i], i)\n end\n\n self.createButton({\n click_function = \"drawEncounterCard\",\n function_owner = self,\n position = {-1.84, 0, -0.65},\n rotation = {0, 80, 0},\n width = 265,\n height = 190\n })\n\n self.createButton({\n click_function = \"drawChaosTokenButton\",\n function_owner = self,\n position = {1.85, 0, -0.74},\n rotation = {0, -45, 0},\n width = 135,\n height = 135\n })\n\n self.createButton({\n label = \"Upkeep\",\n click_function = \"doUpkeep\",\n function_owner = self,\n position = {1.84, 0.1, -0.44},\n scale = {0.12, 0.12, 0.12},\n width = 800,\n height = 280,\n font_size = 180\n })\n\n -- save state loading\n local state = JSON.decode(saveState)\n if state ~= nil then\n playerColor = state.playerColor\n activeInvestigatorId = state.activeInvestigatorId\n isDrawButtonVisible = state.isDrawButtonVisible\n end\n\n showDrawButton(isDrawButtonVisible)\n collisionEnabled = true\n math.randomseed(os.time())\nend\n\n---------------------------------------------------------\n-- utility functions\n---------------------------------------------------------\n\n-- searches an area and optionally filters the result\nfunction searchArea(origin, size, filter)\n local searchResult = Physics.cast({\n origin = origin,\n direction = { 0, 1, 0 },\n orientation = self.getRotation(),\n type = 3,\n size = size,\n max_distance = 0\n })\n\n local objList = {}\n for _, v in ipairs(searchResult) do\n if not filter or (filter and filter(v.hit_object)) then\n table.insert(objList, v.hit_object)\n end\n end\n return objList\nend\n\n-- filter functions for searchArea()\nfunction isCard(x) return x.type == 'Card' end\nfunction isDeck(x) return x.type == 'Deck' end\nfunction isCardOrDeck(x) return x.type == 'Card' or x.type == 'Deck' end\n\n-- finds all objects on the playmat and associated set aside zone.\nfunction searchAroundSelf(filter)\n local bounds = self.getBoundsNormalized()\n -- Increase the width to cover the set aside zone\n bounds.size.x = bounds.size.x + SEARCH_AROUND_SELF_X_BUFFER\n bounds.size.y = 1\n -- Since the cast is centered on the position, shift left or right to keep the non-set aside edge\n -- of the cast at the edge of the playmat\n -- setAsideDirection accounts for the set aside zone being on the left or right, depending on the\n -- table position of the playmat\n local setAsideDirection = bounds.center.z \u003e 0 and 1 or -1\n local localCenter = self.positionToLocal(bounds.center)\n localCenter.x = localCenter.x + setAsideDirection * SEARCH_AROUND_SELF_X_BUFFER / 2 / self.getScale().x\n return searchArea(self.positionToWorld(localCenter), bounds.size, filter)\nend\n\n-- searches the area around the draw deck and discard pile\nfunction searchDeckAndDiscardArea(filter)\n local pos = self.positionToWorld(DECK_DISCARD_AREA.center)\n local scale = self.getScale()\n local size = {\n x = DECK_DISCARD_AREA.size.x * scale.x,\n y = DECK_DISCARD_AREA.size.y, \n z = DECK_DISCARD_AREA.size.z * scale.z\n }\n return searchArea(pos, size, filter)\nend\n\nfunction doNotReady(card)\n return card.getVar(\"do_not_ready\") or false\nend\n\n-- rounds a number to the specified amount of decimal places\n---@param num Number Initial value\n---@param numDecimalPlaces Number Amount of decimal places\nfunction round(num, numDecimalPlaces)\n local mult = 10^(numDecimalPlaces or 0)\n return math.floor(num * mult + 0.5) / mult\nend\n\n---------------------------------------------------------\n-- Discard buttons\n---------------------------------------------------------\n\n-- handles discarding for a list of objects\n---@param objList Table List of objects to discard\nfunction discardListOfObjects(objList)\n for _, obj in ipairs(objList) do\n if isCardOrDeck(obj) then\n if obj.hasTag(\"PlayerCard\") then\n placeOrMergeIntoDeck(obj, returnGlobalDiscardPosition(), self.getRotation())\n else\n placeOrMergeIntoDeck(obj, ENCOUNTER_DISCARD_POSITION, {x = 0, y = -90, z = 0})\n end\n -- put chaos tokens back into bag (e.g. Unrelenting)\n elseif tokenChecker.isChaosToken(obj) then\n local chaosBag = chaosBagApi.findChaosBag()\n chaosBag.putObject(obj)\n -- don't touch locked objects (like the table etc.)\n elseif not obj.getLock() then\n ownedObjects.Trash.putObject(obj)\n end\n end\nend\n\n-- places a card/deck at a position or merges into an existing deck\n-- rotation is optional\nfunction placeOrMergeIntoDeck(obj, pos, rot)\n if not pos then return end\n\n local offset = 0.5\n \n -- search the new position for existing card/deck\n local searchResult = searchArea(pos, { 1, 1, 1 }, isCardOrDeck)\n\n -- get new position\n local newPos\n if #searchResult == 1 then\n local bounds = searchResult[1].getBounds()\n newPos = Vector(pos):setAt(\"y\", bounds.center.y + bounds.size.y / 2 + offset)\n else\n newPos = Vector(pos) + Vector(0, offset, 0)\n end\n\n -- allow moving the objects smoothly out of the hand\n obj.use_hands = false\n\n if rot then\n obj.setRotationSmooth(rot, false, true)\n end\n obj.setPositionSmooth(newPos, false, true)\n\n -- continue if the card stops smooth moving\n Wait.condition(\n function()\n obj.use_hands = true\n -- this avoids a TTS bug that merges unrelated cards that are not resting\n if #searchResult == 1 and searchResult[1] ~= obj then\n -- call this with avoiding errors (physics is sometimes too fast so the object doesn't exist for the put)\n pcall(function() searchResult[1].putObject(obj) end)\n end\n end,\n function() return not obj.isSmoothMoving() end, 3)\nend\n\n-- build a discard button to discard from searchPosition (number must be unique)\nfunction makeDiscardButton(xValue, number)\n local position = { xValue, 0.1, -0.94}\n local searchPosition = {-position[1], position[2], position[3] + 0.32}\n local handlerName = 'handler' .. number\n self.setVar(handlerName, function()\n local cardSizeSearch = {2, 1, 3.2}\n local globalSearchPosition = self.positionToWorld(searchPosition)\n local searchResult = searchArea(globalSearchPosition, cardSizeSearch)\n return discardListOfObjects(searchResult)\n end)\n self.createButton({\n label = \"Discard\",\n click_function = handlerName,\n function_owner = self,\n position = position,\n scale = {0.12, 0.12, 0.12},\n width = 900,\n height = 350,\n font_size = 220\n })\nend\n\n---------------------------------------------------------\n-- Upkeep button\n---------------------------------------------------------\n\n-- calls the Upkeep function with correct parameter\nfunction doUpkeepFromHotkey(color)\n doUpkeep(_, color)\nend\n\nfunction doUpkeep(_, clickedByColor, isRightClick)\n -- right-click allow color changing\n if isRightClick then\n changeColor(clickedByColor)\n return\n end\n\n -- send messages to player who clicked button if no seated player found\n messageColor = Player[playerColor].seated and playerColor or clickedByColor\n\n -- unexhaust cards in play zone, flip action tokens and find forcedLearning\n local forcedLearning = false\n local rot = self.getRotation()\n for _, obj in ipairs(searchAroundSelf()) do\n if obj.getDescription() == \"Action Token\" and obj.is_face_down then\n obj.flip()\n elseif obj.type == \"Card\" and not inArea(self.positionToLocal(obj.getPosition()), INVESTIGATOR_AREA) then\n local cardMetadata = JSON.decode(obj.getGMNotes()) or {}\n if not doNotReady(obj) then\n local cardRotation = round(obj.getRotation().y, 0) - rot.y\n local yRotDiff = 0\n\n if cardRotation \u003c 0 then\n cardRotation = cardRotation + 360\n end\n\n -- rotate cards to the next multiple of 90° towards 0°\n if cardRotation \u003e 90 and cardRotation \u003c= 180 then\n yRotDiff = 90\n elseif cardRotation \u003c 270 and cardRotation \u003e 180 then\n yRotDiff = 270\n end\n\n -- set correct rotation for face-down cards\n rot.z = obj.is_face_down and 180 or 0\n obj.setRotation({rot.x, rot.y + yRotDiff, rot.z})\n end\n if cardMetadata.id == \"08031\" then\n forcedLearning = true\n end\n if cardMetadata.uses ~= nil then\n tokenManager.maybeReplenishCard(obj, cardMetadata.uses, self)\n end\n end\n end\n\n -- flip investigator mini-card and summoned servitor mini-card\n -- (all characters allowed to account for custom IDs - e.g. 'Z0000' for TTS Zoop generated IDs)\n if activeInvestigatorId ~= nil then\n local miniId = string.match(activeInvestigatorId, \".....\") .. \"-m\"\n for _, obj in ipairs(getObjects()) do\n if obj.type == \"Card\" and obj.is_face_down then\n local notes = JSON.decode(obj.getGMNotes())\n if notes ~= nil and notes.type == \"Minicard\" and (notes.id == miniId or notes.id == \"09080-m\") then\n obj.flip()\n end\n end\n end\n end\n\n -- gain a resource (or two if playing Jenny Barnes)\n if string.match(activeInvestigatorId, \"%d%d%d%d%d\") == \"02003\" then\n updateCounter({type = \"ResourceCounter\", modifier = 2})\n printToColor(\"Gaining 2 resources (Jenny)\", messageColor)\n else\n updateCounter({type = \"ResourceCounter\", modifier = 1})\n end\n\n -- draw a card (with handling for Patrice and Forced Learning)\n if activeInvestigatorId == \"06005\" then\n if forcedLearning then\n printToColor(\"Wow, did you really take 'Versatile' to play Patrice with 'Forced Learning'? Choose which draw replacement effect takes priority and draw cards accordingly.\", messageColor)\n else\n local handSize = #Player[playerColor].getHandObjects()\n if handSize \u003c 5 then\n local cardsToDraw = 5 - handSize\n printToColor(\"Drawing \" .. cardsToDraw .. \" cards (Patrice)\", messageColor)\n drawCardsWithReshuffle(cardsToDraw)\n end\n end\n elseif forcedLearning then\n printToColor(\"Drawing 2 cards, discard 1 (Forced Learning)\", messageColor)\n drawCardsWithReshuffle(2)\n elseif activeInvestigatorId == \"89001\" then\n printToColor(\"Drawing 2 cards (Subject 5U-21)\", messageColor)\n drawCardsWithReshuffle(2)\n else\n drawCardsWithReshuffle(1)\n end\nend\n\n-- function for \"draw 1 button\" (that can be added via option panel)\nfunction doDrawOne(_, color)\n -- send messages to player who clicked button if no seated player found\n messageColor = Player[playerColor].seated and playerColor or color\n drawCardsWithReshuffle(1)\nend\n\n-- draw X cards (shuffle discards if necessary)\nfunction drawCardsWithReshuffle(numCards)\n local deckAreaObjects = getDeckAreaObjects()\n\n -- Norman Withers handling\n local harbinger = false\n if deckAreaObjects.topCard and deckAreaObjects.topCard.getName() == \"The Harbinger\" then\n harbinger = true\n elseif deckAreaObjects.draw and not deckAreaObjects.draw.is_face_down then\n local cards = deckAreaObjects.draw.getObjects()\n if cards[#cards].name == \"The Harbinger\" then\n harbinger = true\n end\n end\n\n if harbinger then\n printToColor(\"The Harbinger is on top of your deck, not drawing cards\", messageColor)\n return\n end\n\n local topCardDetected = false\n if deckAreaObjects.topCard ~= nil then\n deckAreaObjects.topCard.deal(1, playerColor)\n topCardDetected = true\n numCards = numCards - 1\n if numCards == 0 then\n flipTopCardFromDeck()\n return\n end\n end\n\n local deckSize = 1\n if deckAreaObjects.draw == nil then\n deckSize = 0\n elseif deckAreaObjects.draw.type == \"Deck\" then\n deckSize = #deckAreaObjects.draw.getObjects()\n end\n\n if deckSize \u003e= numCards then\n drawCards(numCards)\n -- flip top card again for Norman\n if topCardDetected and string.match(activeInvestigatorId, \"%d%d%d%d%d\") == \"08004\" then\n flipTopCardFromDeck()\n end\n else\n drawCards(deckSize)\n if deckAreaObjects.discard ~= nil then\n shuffleDiscardIntoDeck()\n Wait.time(function()\n drawCards(numCards - deckSize)\n -- flip top card again for Norman\n if topCardDetected and string.match(activeInvestigatorId, \"%d%d%d%d%d\") == \"08004\" then\n flipTopCardFromDeck()\n end\n end, 1)\n end\n printToColor(\"Take 1 horror (drawing card from empty deck)\", messageColor)\n end\nend\n\n-- get the draw deck and discard pile objects and returns the references\nfunction getDeckAreaObjects()\n local deckAreaObjects = {}\n for _, object in ipairs(searchDeckAndDiscardArea(isCardOrDeck)) do\n if self.positionToLocal(object.getPosition()).z \u003e 0.5 then\n deckAreaObjects.discard = object\n -- Norman Withers handling\n elseif object.type == \"Card\" and not object.is_face_down then\n deckAreaObjects.topCard = object\n else\n deckAreaObjects.draw = object\n end\n end\n return deckAreaObjects\nend\n\nfunction drawCards(numCards)\n local deckAreaObjects = getDeckAreaObjects()\n if deckAreaObjects.draw then\n deckAreaObjects.draw.deal(numCards, playerColor)\n end\nend\n\nfunction shuffleDiscardIntoDeck()\n local deckAreaObjects = getDeckAreaObjects()\n if not deckAreaObjects.discard.is_face_down then\n deckAreaObjects.discard.flip()\n end\n deckAreaObjects.discard.shuffle()\n deckAreaObjects.discard.setPositionSmooth(self.positionToWorld(DRAW_DECK_POSITION), false, false)\nend\n\n-- utility function for Norman Withers to flip the top card to the revealed side\nfunction flipTopCardFromDeck()\n Wait.time(function()\n local deckAreaObjects = getDeckAreaObjects()\n if deckAreaObjects.topCard then\n return\n elseif deckAreaObjects.draw then\n if deckAreaObjects.draw.type == \"Card\" then\n deckAreaObjects.draw.flip()\n else\n -- get bounds to know the height of the deck\n local bounds = deckAreaObjects.draw.getBounds()\n local pos = bounds.center + Vector(0, bounds.size.y / 2 + 0.2, 0)\n deckAreaObjects.draw.takeObject({ position = pos, flip = true })\n end\n end\n end, 0.1)\nend\n\n-- discard a random non-hidden card from hand\nfunction doDiscardOne()\n local hand = Player[playerColor].getHandObjects()\n if #hand == 0 then\n broadcastToAll(\"Cannot discard from empty hand!\", \"Red\")\n else\n local choices = {}\n for i = 1, #hand do\n local notes = JSON.decode(hand[i].getGMNotes())\n if notes ~= nil then\n if notes.hidden ~= true then\n table.insert(choices, i)\n end\n else\n table.insert(choices, i)\n end\n end\n\n if #choices == 0 then\n broadcastToAll(\"Hidden cards can't be randomly discarded.\", \"Orange\")\n return\n end\n\n -- get a random non-hidden card (from the \"choices\" table)\n local num = math.random(1, #choices)\n placeOrMergeIntoDeck(hand[choices[num]], returnGlobalDiscardPosition(), self.getRotation())\n broadcastToAll(playerColor .. \" randomly discarded card \" .. choices[num] .. \"/\" .. #hand .. \".\", \"White\")\n end\nend\n\n---------------------------------------------------------\n-- color related functions\n---------------------------------------------------------\n\n-- changes the player color\nfunction changeColor(clickedByColor)\n local colorList = {\n \"White\",\n \"Brown\",\n \"Red\",\n \"Orange\",\n \"Yellow\",\n \"Green\",\n \"Teal\",\n \"Blue\",\n \"Purple\",\n \"Pink\"\n }\n\n -- remove existing colors from the list of choices\n for _, existingColor in ipairs(Player.getAvailableColors()) do\n for i, newColor in ipairs(colorList) do\n if existingColor == newColor then\n table.remove(colorList, i)\n end\n end\n end\n\n -- show the option dialog for color selection to the player that triggered this\n Player[clickedByColor].showOptionsDialog(\"Select a new color:\", colorList, _, function(color)\n -- update the color of the hand zone\n local handZone = ownedObjects.HandZone\n handZone.setValue(color)\n\n -- if the seated player clicked this, reseat him to the new color\n if clickedByColor == playerColor then\n navigationOverlayApi.copyVisibility(playerColor, color)\n Player[playerColor].changeColor(color)\n end\n\n -- update the internal variable\n playerColor = color\n end)\nend\n\n---------------------------------------------------------\n-- playmat token spawning\n---------------------------------------------------------\n\n-- Finds all customizable cards in this play area and updates their metadata based on the selections\n-- on the matching upgrade sheet.\n-- This method is theoretically O(n^2), and should be used sparingly. In practice it will only be\n-- called when a checkbox is added or removed in-game (which should be rare), and is bounded by the\n-- number of customizable cards in play.\nfunction syncAllCustomizableCards()\n for _, card in ipairs(searchAroundSelf(isCard)) do\n syncCustomizableMetadata(card)\n end\nend\n\nfunction syncCustomizableMetadata(card)\n local cardMetadata = JSON.decode(card.getGMNotes()) or { }\n if cardMetadata == nil or cardMetadata.customizations == nil then\n return\n end\n for _, upgradeSheet in ipairs(searchAroundSelf(isCard)) do\n local upgradeSheetMetadata = JSON.decode(upgradeSheet.getGMNotes()) or { }\n if upgradeSheetMetadata.id == (cardMetadata.id .. \"-c\") then\n for i, customization in ipairs(cardMetadata.customizations) do\n if customization.replaces ~= nil and customization.replaces.uses ~= nil then\n -- Allowed use of call(), no APIs for individual cards\n if upgradeSheet.call(\"isUpgradeActive\", i) then\n cardMetadata.uses = customization.replaces.uses\n card.setGMNotes(JSON.encode(cardMetadata))\n else\n -- TODO: Get the original metadata to restore it... maybe. This should only be\n -- necessary in the very unlikely case that a user un-checks a previously-full upgrade\n -- row while the card is in play. It will be much easier once the AllPlayerCardsApi is\n -- in place, so defer until it is\n end\n end\n end\n end\n end\nend\n\nfunction spawnTokensFor(object)\n local extraUses = { }\n if activeInvestigatorId == \"03004\" then\n extraUses[\"Charge\"] = 1\n end\n\n tokenManager.spawnForCard(object, extraUses)\nend\n\nfunction onCollisionEnter(collisionInfo)\n local object = collisionInfo.collision_object\n\n -- only continue if loading is completed\n if not collisionEnabled then return end\n\n -- only continue for cards\n if not isCard(object) then return end\n\n -- detect if \"Dream-Enhancing Serum\" is placed\n if object.getName() == \"Dream-Enhancing Serum\" then isDES = true end\n\n maybeUpdateActiveInvestigator(object)\n syncCustomizableMetadata(object)\n\n local localCardPos = self.positionToLocal(object.getPosition())\n if inArea(localCardPos, DECK_DISCARD_AREA) then\n tokenManager.resetTokensSpawned(object)\n removeTokensFromObject(object)\n elseif shouldSpawnTokens(object) then\n spawnTokensFor(object)\n end\nend\n\n-- detect if \"Dream-Enhancing Serum\" is removed\nfunction onCollisionExit(collisionInfo)\n if collisionInfo.collision_object.getName() == \"Dream-Enhancing Serum\" then isDES = false end\nend\n\n-- checks if tokens should be spawned for the provided card\nfunction shouldSpawnTokens(card)\n if card.is_face_down then\n return false\n end\n\n local localCardPos = self.positionToLocal(card.getPosition())\n local metadata = JSON.decode(card.getGMNotes())\n\n -- If no metadata we don't know the type, so only spawn in the main area\n if metadata == nil then\n return inArea(localCardPos, MAIN_PLAY_AREA)\n end\n\n -- Spawn tokens for assets and events on the main area\n if inArea(localCardPos, MAIN_PLAY_AREA)\n and (metadata.type == \"Asset\"\n or metadata.type == \"Event\") then\n return true\n end\n\n -- Spawn tokens for all encounter types in the threat area\n if inArea(localCardPos, THREAT_AREA)\n and (metadata.type == \"Treachery\"\n or metadata.type == \"Enemy\"\n or metadata.weakness) then\n return true\n end\n\n return false\nend\n\nfunction onObjectEnterContainer(container, object)\n if not isCard(object) then return end\n\n local localCardPos = self.positionToLocal(object.getPosition())\n if inArea(localCardPos, DECK_DISCARD_AREA) then\n tokenManager.resetTokensSpawned(object)\n removeTokensFromObject(object)\n end\nend\n\n-- removes tokens from the provided card/deck\nfunction removeTokensFromObject(object)\n for _, obj in ipairs(searchArea(object.getPosition(), { 3, 1, 4 })) do\n if obj.getGUID() ~= \"4ee1f2\" and -- table\n obj ~= self and\n obj.type ~= \"Deck\" and\n obj.type ~= \"Card\" and\n obj.memo ~= nil and\n obj.getLock() == false and\n obj.getDescription() ~= \"Action Token\" and\n not tokenChecker.isChaosToken(obj) then\n ownedObjects.Trash.putObject(obj)\n end\n end\nend\n\n---------------------------------------------------------\n-- investigator ID grabbing and skill tracker\n---------------------------------------------------------\n\nfunction maybeUpdateActiveInvestigator(card)\n if not inArea(self.positionToLocal(card.getPosition()), INVESTIGATOR_AREA) then return end\n\n local notes = JSON.decode(card.getGMNotes())\n local class\n\n if notes ~= nil and notes.type == \"Investigator\" and notes.id ~= nil then\n if notes.id == activeInvestigatorId then return end\n class = notes.class\n activeInvestigatorId = notes.id\n ownedObjects.InvestigatorSkillTracker.call(\"updateStats\", {\n notes.willpowerIcons,\n notes.intellectIcons,\n notes.combatIcons,\n notes.agilityIcons\n })\n elseif activeInvestigatorId ~= \"00000\" then\n class = \"Neutral\"\n activeInvestigatorId = \"00000\"\n ownedObjects.InvestigatorSkillTracker.call(\"updateStats\", {1, 1, 1, 1})\n else\n return\n end\n\n -- change state of action tokens\n local search = searchArea(self.positionToWorld({-1.1, 0.05, -0.27}), {4, 1, 1})\n local smallToken = nil\n local STATE_TABLE = {\n [\"Guardian\"] = 1,\n [\"Seeker\"] = 2,\n [\"Rogue\"] = 3,\n [\"Mystic\"] = 4,\n [\"Survivor\"] = 5,\n [\"Neutral\"] = 6\n }\n\n for _, obj in ipairs(search) do\n if obj.getDescription() == \"Action Token\" and obj.getStateId() \u003e 0 then\n if obj.getScale().x \u003c 0.4 then\n smallToken = obj\n else\n setObjectState(obj, STATE_TABLE[class])\n end\n end\n end\n\n -- update the small token with special action for certain investigators\n local SPECIAL_ACTIONS = {\n [\"04002\"] = 8, -- Ursula Downs\n [\"01002\"] = 9, -- Daisy Walker\n [\"01502\"] = 9, -- Daisy Walker\n [\"01002-pb\"] = 9, -- Daisy Walker\n [\"06003\"] = 10, -- Tony Morgan\n [\"04003\"] = 11, -- Finn Edwards\n [\"08016\"] = 14 -- Bob Jenkins\n }\n\n if smallToken ~= nil then\n setObjectState(smallToken, SPECIAL_ACTIONS[activeInvestigatorId] or STATE_TABLE[class])\n end\nend\n\nfunction setObjectState(obj, stateId)\n if obj.getStateId() ~= stateId then obj.setState(stateId) end\nend\n\n---------------------------------------------------------\n-- manipulation of owned objects\n---------------------------------------------------------\n\n-- updates the specific owned counter\n---@param param Table Contains the information to update:\n--- type: String Counter to target\n--- newValue: Number Value to set the counter to\n--- modifier: Number If newValue is not provided, the existing value will be adjusted by this modifier\nfunction updateCounter(param)\n local counter = ownedObjects[param.type]\n if counter ~= nil then\n counter.call(\"updateVal\", param.newValue or (counter.getVar(\"val\") + param.modifier))\n else\n printToAll(param.type .. \" for \" .. matColor .. \" could not be found.\", \"Yellow\")\n end\nend\n\n-- returns the resource counter amount\n---@param type String Counter to target\nfunction getCounterValue(type)\n return ownedObjects[type].getVar(\"val\")\nend\n\n-- set investigator skill tracker to \"1, 1, 1, 1\"\nfunction resetSkillTracker()\n local obj = ownedObjects.InvestigatorSkillTracker\n if obj ~= nil then\n obj.call(\"updateStats\", { 1, 1, 1, 1 })\n else\n printToAll(\"Skill tracker for \" .. matColor .. \" playmat could not be found.\", \"Yellow\")\n end\nend\n\n---------------------------------------------------------\n-- calls to 'Global' / functions for calls from outside\n---------------------------------------------------------\n\nfunction drawChaosTokenButton(_, _, isRightClick)\n chaosBagApi.drawChaosToken(self, DRAWN_CHAOS_TOKEN_OFFSET, isRightClick)\nend\n\nfunction drawEncounterCard(_, _, isRightClick)\n local pos = self.positionToWorld(DRAWN_ENCOUNTER_CARD_OFFSET)\n local rotY = self.getRotation().y\n mythosAreaApi.drawEncounterCard(pos, rotY, isRightClick)\nend\n\nfunction returnGlobalDiscardPosition()\n return self.positionToWorld(DISCARD_PILE_POSITION)\nend\n\n-- Sets this playermat's draw 1 button to visible\n---@param visible Boolean. Whether the draw 1 button should be visible\nfunction showDrawButton(visible)\n isDrawButtonVisible = visible\n\n -- create the \"Draw 1\" button\n if isDrawButtonVisible then\n self.createButton({\n label = \"Draw 1\",\n click_function = \"doDrawOne\",\n function_owner = self,\n position = { 1.84, 0.1, -0.36 },\n scale = { 0.12, 0.12, 0.12 },\n width = 800,\n height = 280,\n font_size = 180\n })\n\n -- remove the \"Draw 1\" button\n else\n local buttons = self.getButtons()\n for i = 1, #buttons do\n if buttons[i].label == \"Draw 1\" then\n self.removeButton(buttons[i].index)\n end\n end\n end\nend\n\n-- shows / hides a clickable clue counter for this playmat and sets the correct amount of clues\n---@param showCounter Boolean Whether the clickable clue counter should be visible\nfunction clickableClues(showCounter)\n local clickerPos = ownedObjects.ClickableClueCounter.getPosition()\n local clueCount = 0\n \n -- move clue counters\n local modY = showCounter and 0.525 or -0.525\n ownedObjects.ClickableClueCounter.setPosition(clickerPos + Vector(0, modY, 0))\n\n if showCounter then\n -- current clue count\n clueCount = ownedObjects.ClueCounter.getVar(\"exposedValue\")\n\n -- remove clues\n ownedObjects.ClueCounter.call(\"removeAllClues\", ownedObjects.Trash)\n\n -- set value for clue clickers\n ownedObjects.ClickableClueCounter.call(\"updateVal\", clueCount)\n else\n -- current clue count\n clueCount = ownedObjects.ClickableClueCounter.getVar(\"val\")\n\n -- spawn clues\n local pos = self.positionToWorld({x = -1.12, y = 0.05, z = 0.7})\n for i = 1, clueCount do\n pos.y = pos.y + 0.045 * i\n tokenManager.spawnToken(pos, \"clue\", self.getRotation())\n end\n end\nend\n\n-- removes all clues (moving tokens to the trash and setting counters to 0)\nfunction removeClues()\n ownedObjects.ClueCounter.call(\"removeAllClues\", ownedObjects.Trash)\n ownedObjects.ClickableClueCounter.call(\"updateVal\", 0)\nend\n\n-- reports the clue count\n---@param useClickableCounters Boolean Controls which type of counter is getting checked\nfunction getClueCount(useClickableCounters)\n if useClickableCounters then\n return ownedObjects.ClickableClueCounter.getVar(\"val\")\n else\n return ownedObjects.ClueCounter.getVar(\"exposedValue\")\n end\nend\n\n-- Sets this playermat's snap points to limit snapping to matching card types or not. If matchTypes\n-- is true, the main card slot snap points will only snap assets, while the investigator area point\n-- will only snap Investigators. If matchTypes is false, snap points will be reset to snap all\n-- cards.\n---@param matchTypes Boolean. Whether snap points should only snap for the matching card types.\nfunction setLimitSnapsByType(matchTypes)\n local snaps = self.getSnapPoints()\n for i, snap in ipairs(snaps) do\n local snapPos = snap.position\n if inArea(snapPos, MAIN_PLAY_AREA) then\n local snapTags = snaps[i].tags\n if matchTypes then\n if snapTags == nil then\n snaps[i].tags = { \"Asset\" }\n else\n table.insert(snaps[i].tags, \"Asset\")\n end\n else\n snaps[i].tags = nil\n end\n end\n if inArea(snapPos, INVESTIGATOR_AREA) then\n local snapTags = snaps[i].tags\n if matchTypes then\n if snapTags == nil then\n snaps[i].tags = { \"Investigator\" }\n else\n table.insert(snaps[i].tags, \"Investigator\")\n end\n else\n snaps[i].tags = nil\n end\n end\n end\n self.setSnapPoints(snaps)\nend\n\n-- Simple method to check if the given point is in a specified area. Local use only,\n---@param point Vector Point to check, only x and z values are relevant\n---@param bounds Table Defined area to see if the point is within. See MAIN_PLAY_AREA for sample\n-- bounds definition.\n---@return Boolean True if the point is in the area defined by bounds\nfunction inArea(point, bounds)\n return (point.x \u003c bounds.upperLeft.x\n and point.x \u003e bounds.lowerRight.x\n and point.z \u003c bounds.upperLeft.z\n and point.z \u003e bounds.lowerRight.z)\nend\n\n-- called by custom data helpers to add player card data\n---@param args table Contains only one entry, the GUID of the custom data helper\nfunction updatePlayerCards(args)\n local customDataHelper = getObjectFromGUID(args[1])\n local playerCardData = customDataHelper.getTable(\"PLAYER_CARD_DATA\")\n tokenManager.addPlayerCardData(playerCardData)\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScriptState": "{\"activeInvestigatorId\":\"00000\",\"isDrawButtonVisible\":false,\"playerColor\":\"Red\"}", + "MeasureMovement": false, + "Memo": "Red", + "Name": "Custom_Tile", + "Nickname": "Playermat 4: Red", + "Snap": true, + "Sticky": true, + "Tooltip": false, + "Transform": { + "posX": -30.35, + "posY": 1.45, + "posZ": -26.6, + "rotX": 0, + "rotY": 180, + "rotZ": 0, + "scaleX": 6.43, + "scaleY": 1, + "scaleZ": 6.43 + }, + "Value": 0, + "XmlUI": "" + }, { "AltLookAngle": { "x": 0, @@ -86228,7 +89346,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"arkhamdb/DeckImporterMain\")\nend)\n__bundle_register(\"playercards/PlayerCardSpawner\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Amount to shift for the next card (zShift) or next row of cards (xShift)\n-- Note that the table rotation is weird, and the X axis is vertical while the\n-- Z axis is horizontal\nlocal SPREAD_Z_SHIFT = -2.3\nlocal SPREAD_X_SHIFT = -3.66\n\nSpawner = { }\n\n-- Spawns a list of cards at the given position/rotation. This will separate cards by size -\n-- investigator, standard, and mini, spawning them in that order with larger cards on bottom. If\n-- there are different types, the provided callback will be called once for each type as it spawns\n-- either a card or deck.\n-- @param cardList: A list of Player Card data structures (data/metadata)\n-- @param pos Position table where the cards should be spawned (global)\n-- @param rot Rotation table for the orientation of the spawned cards (global)\n-- @param sort Boolean, true if this list of cards should be sorted before spawning\n-- @param callback Function, callback to be called after the card/deck spawns.\nSpawner.spawnCards = function(cardList, pos, rot, sort, callback)\n if (sort) then\n table.sort(cardList, Spawner.cardComparator)\n end\n\n local miniCards = { }\n local standardCards = { }\n local investigatorCards = { }\n\n for _, card in ipairs(cardList) do\n if (card.metadata.type == \"Investigator\") then\n table.insert(investigatorCards, card)\n elseif (card.metadata.type == \"Minicard\") then\n table.insert(miniCards, card)\n else\n table.insert(standardCards, card)\n end\n end\n -- Spawn each of the three types individually. Each Y position shift accounts for the thickness\n -- of the spawned deck\n local position = { x = pos.x, y = pos.y, z = pos.z }\n Spawner.spawn(investigatorCards, position, { rot.x, rot.y - 90, rot.z }, callback)\n\n position.y = position.y + (#investigatorCards + #standardCards) * 0.07\n Spawner.spawn(standardCards, position, rot, callback)\n\n position.y = position.y + (#standardCards + #miniCards) * 0.07\n Spawner.spawn(miniCards, position, rot, callback)\nend\n\nSpawner.spawnCardSpread = function(cardList, startPos, maxCols, rot, sort, callback)\n if (sort) then\n table.sort(cardList, Spawner.cardComparator)\n end\n\n local position = { x = startPos.x, y = startPos.y, z = startPos.z }\n -- Special handle the first row if we have less than a full single row, but only if there's a\n -- reasonable max column count. Single-row spreads will send a large value for maxCols\n if maxCols \u003c 100 and #cardList \u003c maxCols then\n position.z = startPos.z + ((maxCols - #cardList) / 2 * SPREAD_Z_SHIFT)\n end\n local cardsInRow = 0\n local rows = 0\n for _, card in ipairs(cardList) do\n Spawner.spawn({ card }, position, rot, callback)\n position.z = position.z + SPREAD_Z_SHIFT\n cardsInRow = cardsInRow + 1\n if cardsInRow \u003e= maxCols then\n rows = rows + 1\n local cardsForRow = #cardList - rows * maxCols\n if cardsForRow \u003e maxCols then\n cardsForRow = maxCols\n end\n position.z = startPos.z + ((maxCols - cardsForRow) / 2 * SPREAD_Z_SHIFT)\n position.x = position.x + SPREAD_X_SHIFT\n cardsInRow = 0\n end\n end\nend\n\n-- Spawn a specific list of cards. This method is for internal use and should not be called\n-- directly, use spawnCards instead.\n---@param cardList: A list of Player Card data structures (data/metadata)\n---@param pos table Position where the cards should be spawned (global)\n---@param rot table Rotation for the orientation of the spawned cards (global)\n---@param callback function callback to be called after the card/deck spawns.\nSpawner.spawn = function(cardList, pos, rot, callback)\n if (#cardList == 0) then\n return\n end\n -- Spawn a single card directly\n if (#cardList == 1) then\n spawnObjectData({\n data = cardList[1].data,\n position = pos,\n rotation = rot,\n callback_function = callback,\n })\n return\n end\n -- For multiple cards, construct a deck and spawn that\n local deck = Spawner.buildDeckDataTemplate()\n -- Decks won't inherently scale to the cards in them. The card list being spawned should be all\n -- the same type/size by this point, so use the first card to set the size\n deck.Transform = {\n scaleX = cardList[1].data.Transform.scaleX,\n scaleY = 1,\n scaleZ = cardList[1].data.Transform.scaleZ,\n }\n local sidewaysDeck = true\n for _, spawnCard in ipairs(cardList) do\n Spawner.addCardToDeck(deck, spawnCard.data)\n -- set sidewaysDeck to false if any card is not a sideways card\n sidewaysDeck = (sidewaysDeck and spawnCard.data.SidewaysCard)\n end\n -- set the alt view angle for sideway decks\n if sidewaysDeck then\n deck.AltLookAngle = { x = 0, y = 180, z = 90 }\n end\n spawnObjectData({\n data = deck,\n position = pos,\n rotation = rot,\n callback_function = callback,\n })\nend\n\n-- Inserts a card into the given deck. This does three things:\n-- 1. Add the card's data to ContainedObjects\n-- 2. Add the card's ID (the TTS CardID, not the Arkham ID) to the deck's\n-- ID list. Note that the deck's ID list is \"DeckIDs\" even though it\n-- contains a list of card Ids\n-- 3. Extract the card's CustomDeck table and add it to the deck. The deck's\n-- \"CustomDeck\" field is a list of all CustomDecks used by cards within the\n-- deck, keyed by the DeckID and referencing the custom deck table\n---@param deck: TTS deck data structure to add to\n---@param card: Data for the card to be inserted\nSpawner.addCardToDeck = function(deck, cardData)\n for customDeckId, customDeckData in pairs(cardData.CustomDeck) do\n if (deck.CustomDeck[customDeckId] == nil) then\n -- CustomDeck not added to deck yet, add it\n deck.CustomDeck[customDeckId] = customDeckData\n elseif (deck.CustomDeck[customDeckId].FaceURL == customDeckData.FaceURL) then\n -- CustomDeck for this card matches the current one for the deck, do nothing\n else\n -- CustomDeck data conflict\n local newDeckId = nil\n for deckId, customDeck in pairs(deck.CustomDeck) do\n if (customDeckData.FaceURL == customDeck.FaceURL) then\n newDeckId = deckId\n end\n end\n if (newDeckId == nil) then\n -- No non-conflicting custom deck for this card, add a new one\n newDeckId = Spawner.findNextAvailableId(deck.CustomDeck, \"1000\")\n deck.CustomDeck[newDeckId] = customDeckData\n end\n -- Update the card with the new CustomDeck info\n cardData.CardID = newDeckId..string.sub(cardData.CardID, 5)\n cardData.CustomDeck[customDeckId] = nil\n cardData.CustomDeck[newDeckId] = customDeckData\n break\n end\n end\n table.insert(deck.ContainedObjects, cardData)\n table.insert(deck.DeckIDs, cardData.CardID)\nend\n\n-- Create an empty deck data table which can have cards added to it. This\n-- creates a new table on each call without using metatables or previous\n-- definitions because we can't be sure that TTS doesn't modify the structure\n---@return: Table containing the minimal TTS deck data structure\nSpawner.buildDeckDataTemplate = function()\n local deck = {}\n deck.Name = \"Deck\"\n\n -- Card data. DeckIDs and CustomDeck entries will be built from the cards\n deck.ContainedObjects = {}\n deck.DeckIDs = {}\n deck.CustomDeck = {}\n\n -- Transform is required, Position and Rotation will be overridden by the spawn call so can be omitted here\n deck.Transform = {\n scaleX = 1,\n scaleY = 1,\n scaleZ = 1,\n }\n\n return deck\nend\n\n-- Returns the first ID which does not exist in the given table, starting at startId and increasing\n-- @param objectTable Table keyed by strings which are numbers\n-- @param startId First possible ID.\n-- @return String ID \u003e= startId\nSpawner.findNextAvailableId = function(objectTable, startId)\n local id = startId\n while (objectTable[id] ~= nil) do\n id = tostring(tonumber(id) + 1)\n end\n\n return id\nend\n\n-- Get the PBCN (Permanent/Bonded/Customizable/Normal) value from the given metadata.\n---@return: 1 for Permanent, 2 for Bonded or 4 for Normal. The actual values are\n-- irrelevant as they provide only grouping and the order between them doesn't matter.\nSpawner.getpbcn = function(metadata)\n if metadata.permanent then\n return 1\n elseif metadata.bonded_to ~= nil then\n return 2\n else -- Normal card\n return 3\n end\nend\n\n-- Comparison function used to sort the cards in a deck. Groups bonded or\n-- permanent cards first, then sorts within theose types by name/subname.\n-- Normal cards will sort in standard alphabetical order, while\n-- permanent/bonded/customizable will be in reverse alphabetical order.\n--\n-- Since cards spawn in the order provided by this comparator, with the first\n-- cards ending up at the bottom of a pile, this ordering will spawn in reverse\n-- alphabetical order. This presents the cards in order for non-face-down\n-- areas, and presents them in order when Searching the face-down deck.\nSpawner.cardComparator = function(card1, card2)\n local pbcn1 = Spawner.getpbcn(card1.metadata)\n local pbcn2 = Spawner.getpbcn(card2.metadata)\n if pbcn1 ~= pbcn2 then\n return pbcn1 \u003e pbcn2\n end\n if pbcn1 == 3 then\n if card1.data.Nickname ~= card2.data.Nickname then\n return card1.data.Nickname \u003c card2.data.Nickname\n end\n return card1.data.Description \u003c card2.data.Description\n else\n if card1.data.Nickname ~= card2.data.Nickname then\n return card1.data.Nickname \u003e card2.data.Nickname\n end\n return card1.data.Description \u003e card2.data.Description\n end\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"playermat/Zones\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Sets up and returns coordinates for all possible spawn zones. Because Lua assigns tables by reference\n-- and there is no built-in function to copy a table this is relatively brute force.\n--\n-- Positions are all relative to the player mat, and most are consistent. The\n-- exception are the SetAside# zones, which are placed to the left of the mat\n-- for White/Green, and the right of the mat for Orange/Red.\n--\n-- Investigator: Investigator card area.\n-- Minicard: Placement for the investigator's minicard, just above the player mat\n-- Deck, Discard: Standard locations for the deck and discard piles.\n-- BlankTop: used for assets that start in play (e.g. Duke)\n-- Tarot, Hand1, Hand2, Ally, BlankBottom, Accessory, Arcane1, Arcane2, Body: Asset slot positions\n-- Threat[1-4]: Threat area slots. Threat[1-3] correspond to the named threat area slots, and Threat4 is the blank threat area slot.\n-- SetAside[1-3]: Column closest to the player mat, with 1 at the top and 3 at the bottom.\n-- SetAside[4-6]: Column farther away from the mat, with 4 at the top and 6 at the bottom.\n-- SetAside1: Permanent cards\n-- SetAside2: Bonded cards\n-- SetAside3: Ancestral Knowledge / Underworld Market\n-- SetAside4: Upgrade sheets for customizable cards\n-- SetAside5: Hunch Deck for Joe Diamond\n-- SetAside6: currently unused\ndo\n local Zones = { }\n\n local playerMatGuids = {}\n playerMatGuids[\"Red\"] = \"0840d5\"\n playerMatGuids[\"Orange\"] = \"bd0ff4\"\n playerMatGuids[\"White\"] = \"8b081b\"\n playerMatGuids[\"Green\"] = \"383d8b\"\n\n local commonZones = {}\n commonZones[\"Investigator\"] = { -1.17702, 0, 0.00209 }\n commonZones[\"Deck\"] = { -1.822724, 0, -0.02940192 }\n commonZones[\"Discard\"] = { -1.822451, 0, 0.6092291 }\n commonZones[\"Ally\"] = { -0.6157398, 0, 0.02435675 }\n commonZones[\"Body\"] = { -0.6306521, 0, 0.553170 }\n commonZones[\"Hand1\"] = { 0.2155387, 0, 0.04257287 }\n commonZones[\"Hand2\"] = { -0.1803701, 0, 0.03745948 }\n commonZones[\"Arcane1\"] = { 0.2124223, 0, 0.5596902 }\n commonZones[\"Arcane2\"] = { -0.1711275, 0, 0.5567944 }\n commonZones[\"Tarot\"] = { 0.6016169, 0, 0.03273106 }\n commonZones[\"Accessory\"] = { 0.6049907, 0, 0.5546234 }\n commonZones[\"BlankTop\"] = { 1.758446, 0, 0.03965336 }\n commonZones[\"BlankBottom\"] = { 1.754469, 0, 0.5634764 }\n commonZones[\"Threat1\"] = { -0.9116555, 0, -0.6446251 }\n commonZones[\"Threat2\"] = { -0.4544126, 0, -0.6428719 }\n commonZones[\"Threat3\"] = { 0.002246313, 0, -0.6430681 }\n commonZones[\"Threat4\"] = { 0.4590618, 0, -0.6432732 }\n\n local zoneData = {}\n zoneData[\"White\"] = {}\n zoneData[\"White\"][\"Investigator\"] = commonZones[\"Investigator\"]\n zoneData[\"White\"][\"Deck\"] = commonZones[\"Deck\"]\n zoneData[\"White\"][\"Discard\"] = commonZones[\"Discard\"]\n zoneData[\"White\"][\"Ally\"] = commonZones[\"Ally\"]\n zoneData[\"White\"][\"Body\"] = commonZones[\"Body\"]\n zoneData[\"White\"][\"Hand1\"] = commonZones[\"Hand1\"]\n zoneData[\"White\"][\"Hand2\"] = commonZones[\"Hand2\"]\n zoneData[\"White\"][\"Arcane1\"] = commonZones[\"Arcane1\"]\n zoneData[\"White\"][\"Arcane2\"] = commonZones[\"Arcane2\"]\n zoneData[\"White\"][\"Tarot\"] = commonZones[\"Tarot\"]\n zoneData[\"White\"][\"Accessory\"] = commonZones[\"Accessory\"]\n zoneData[\"White\"][\"BlankTop\"] = commonZones[\"BlankTop\"]\n zoneData[\"White\"][\"BlankBottom\"] = commonZones[\"BlankBottom\"]\n zoneData[\"White\"][\"Threat1\"] = commonZones[\"Threat1\"]\n zoneData[\"White\"][\"Threat2\"] = commonZones[\"Threat2\"]\n zoneData[\"White\"][\"Threat3\"] = commonZones[\"Threat3\"]\n zoneData[\"White\"][\"Threat4\"] = commonZones[\"Threat4\"]\n zoneData[\"White\"][\"Minicard\"] = { -1, 0, -1.45 }\n zoneData[\"White\"][\"SetAside1\"] = { 2.345893, 0, -0.520315 }\n zoneData[\"White\"][\"SetAside2\"] = { 2.345893, 0, 0.042552 }\n zoneData[\"White\"][\"SetAside3\"] = { 2.345893, 0, 0.605419 }\n zoneData[\"White\"][\"UnderSetAside3\"] = { 2.495893, 0, 0.805419 }\n zoneData[\"White\"][\"SetAside4\"] = { 2.775893, 0, -0.520315 }\n zoneData[\"White\"][\"SetAside5\"] = { 2.775893, 0, 0.042552 }\n zoneData[\"White\"][\"SetAside6\"] = { 2.775893, 0, 0.605419 }\n zoneData[\"White\"][\"UnderSetAside6\"] = { 2.925893, 0, 0.805419 }\n\n zoneData[\"Orange\"] = {}\n zoneData[\"Orange\"][\"Investigator\"] = commonZones[\"Investigator\"]\n zoneData[\"Orange\"][\"Deck\"] = commonZones[\"Deck\"]\n zoneData[\"Orange\"][\"Discard\"] = commonZones[\"Discard\"]\n zoneData[\"Orange\"][\"Ally\"] = commonZones[\"Ally\"]\n zoneData[\"Orange\"][\"Body\"] = commonZones[\"Body\"]\n zoneData[\"Orange\"][\"Hand1\"] = commonZones[\"Hand1\"]\n zoneData[\"Orange\"][\"Hand2\"] = commonZones[\"Hand2\"]\n zoneData[\"Orange\"][\"Arcane1\"] = commonZones[\"Arcane1\"]\n zoneData[\"Orange\"][\"Arcane2\"] = commonZones[\"Arcane2\"]\n zoneData[\"Orange\"][\"Tarot\"] = commonZones[\"Tarot\"]\n zoneData[\"Orange\"][\"Accessory\"] = commonZones[\"Accessory\"]\n zoneData[\"Orange\"][\"BlankTop\"] = commonZones[\"BlankTop\"]\n zoneData[\"Orange\"][\"BlankBottom\"] = commonZones[\"BlankBottom\"]\n zoneData[\"Orange\"][\"Threat1\"] = commonZones[\"Threat1\"]\n zoneData[\"Orange\"][\"Threat2\"] = commonZones[\"Threat2\"]\n zoneData[\"Orange\"][\"Threat3\"] = commonZones[\"Threat3\"]\n zoneData[\"Orange\"][\"Threat4\"] = commonZones[\"Threat4\"]\n zoneData[\"Orange\"][\"Minicard\"] = { 1, 0, -1.45 }\n zoneData[\"Orange\"][\"SetAside1\"] = { -2.350362, 0, -0.520315 }\n zoneData[\"Orange\"][\"SetAside2\"] = { -2.350362, 0, 0.042552 }\n zoneData[\"Orange\"][\"SetAside3\"] = { -2.350362, 0, 0.605419 }\n zoneData[\"Orange\"][\"UnderSetAside3\"] = { -2.500362, 0, 0.80419 }\n zoneData[\"Orange\"][\"SetAside4\"] = { -2.7803627, 0, -0.520315 }\n zoneData[\"Orange\"][\"SetAside5\"] = { -2.7803627, 0, 0.042552 }\n zoneData[\"Orange\"][\"SetAside6\"] = { -2.7803627, 0, 0.605419 }\n zoneData[\"Orange\"][\"UnderSetAside6\"] = { -2.9303627, 0, 0.80419 }\n\n -- Green positions are the same as White and Red the same as Orange\n zoneData[\"Red\"] = zoneData[\"Orange\"]\n zoneData[\"Green\"] = zoneData[\"White\"]\n\n -- Gets the global position for the given zone on the specified player mat.\n ---@param playerColor: Color name of the player mat to get the zone position for (e.g. \"Red\")\n ---@param zoneName: Name of the zone to get the position for. See Zones object documentation for a list of valid zones.\n ---@return: Global position table, or nil if an invalid player color or zone is specified\n Zones.getZonePosition = function(playerColor, zoneName)\n if (playerColor ~= \"Red\"\n and playerColor ~= \"Orange\"\n and playerColor ~= \"White\"\n and playerColor ~= \"Green\") then\n return nil\n end\n return getObjectFromGUID(playerMatGuids[playerColor]).positionToWorld(zoneData[playerColor][zoneName])\n end\n\n -- Return the global rotation for a card on the given player mat, based on its metadata.\n ---@param playerColor: Color name of the player mat to get the rotation for (e.g. \"Red\")\n ---@param cardMetadata: Table of card metadata. Metadata fields type and permanent are required; all others are optional.\n ---@return: Global rotation vector for the given card. This will include the\n -- Y rotation to orient the card on the given player mat as well as a\n -- Z rotation to place the card face up or face down.\n Zones.getDefaultCardRotation = function(playerColor, zone)\n local deckRotation = getObjectFromGUID(playerMatGuids[playerColor]).getRotation()\n\n if zone == \"Deck\" then\n deckRotation = deckRotation + Vector(0, 0, 180)\n end\n\n return deckRotation\n end\n\n return Zones\nend\nend)\n__bundle_register(\"arkhamdb/DeckImporterMain\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"arkhamdb/DeckImporterUi\")\nrequire(\"playercards/PlayerCardSpawner\")\n\nlocal allCardsBagApi = require(\"playercards/AllCardsBagApi\")\nlocal arkhamDb = require(\"arkhamdb/ArkhamDb\")\nlocal playAreaApi = require(\"core/PlayAreaApi\")\nlocal playmatApi = require(\"playermat/PlaymatApi\")\nlocal zones = require(\"playermat/Zones\")\n\nfunction onLoad(script_state)\n initializeUi(JSON.decode(script_state))\n math.randomseed(os.time())\n arkhamDb.initialize()\nend\n\nfunction onSave() return JSON.encode(getUiState()) end\n\n-- Returns the zone name where the specified card should be placed, based on its metadata.\n---@param cardMetadata Table of card metadata.\n---@return Zone String Name of the zone such as \"Deck\", \"SetAside1\", etc.\n-- See Zones object documentation for a list of valid zones.\nfunction getDefaultCardZone(cardMetadata, bondedList)\n if (cardMetadata.id == \"09080-m\") then -- Have to check the Servitor before other minicards\n return \"SetAside6\"\n elseif (cardMetadata.id == \"09006\") then -- On The Mend is set aside\n return \"SetAside2\"\n elseif cardMetadata.type == \"Investigator\" then\n return \"Investigator\"\n elseif cardMetadata.type == \"Minicard\" then\n return \"Minicard\"\n elseif cardMetadata.type == \"UpgradeSheet\" then\n return \"SetAside4\"\n elseif cardMetadata.startsInPlay then\n return \"BlankTop\"\n elseif cardMetadata.permanent then\n return \"SetAside1\"\n elseif bondedList[cardMetadata.id] then\n return \"SetAside2\"\n -- SetAside3 is used for Ancestral Knowledge / Underworld Market\n else\n return \"Deck\"\n end\nend\n\nfunction buildDeck(playerColor, deckId)\n local uiState = getUiState()\n arkhamDb.getDecklist(\n playerColor,\n deckId,\n uiState.private,\n uiState.loadNewest,\n uiState.investigators,\n loadCards)\nend\n\n-- Process the slot list, which defines the card Ids and counts of cards to load. Spawn those cards\n-- at the appropriate zones and report an error to the user if any could not be loaded.\n-- This is a callback function which handles the results of ArkhamDb.getDecklist()\n-- This method uses an encapsulated coroutine with yields to make the card spawning cleaner.\n--\n---@param slots Table Key-Value table of cardId:count. cardId is the ArkhamDB ID of the card to spawn,\n-- and count is the number which should be spawned\n---@param investigatorId String ArkhamDB ID (code) for this deck's investigator.\n-- Investigator cards should already be added to the slots list if they\n-- should be spawned, but this value is separate to check for special\n-- handling for certain investigators\n---@param bondedList Table A table of cardID keys to meaningless values. Card IDs in this list were added\n-- from a parent bonded card.\n---@param customizations String ArkhamDB data for customizations on customizable cards\n---@param playerColor String Color name of the player mat to place this deck on (e.g. \"Red\")\n---@param loadAltInvestigator String Contains the name of alternative art for the investigator (\"normal\", \"revised\" or \"promo\")\nfunction loadCards(slots, investigatorId, bondedList, customizations, playerColor, loadAltInvestigator)\n function coinside()\n local yPos = {}\n local cardsToSpawn = {}\n for cardId, cardCount in pairs(slots) do\n local card = allCardsBagApi.getCardById(cardId)\n if card ~= nil then\n local cardZone = getDefaultCardZone(card.metadata, bondedList)\n for i = 1, cardCount do\n table.insert(cardsToSpawn, { data = card.data, metadata = card.metadata, zone = cardZone })\n end\n\n slots[cardId] = 0\n end\n end\n\n handleAncestralKnowledge(cardsToSpawn)\n handleUnderworldMarket(cardsToSpawn, playerColor)\n handleHunchDeck(investigatorId, cardsToSpawn, playerColor)\n handleCustomizableUpgrades(cardsToSpawn, customizations)\n handlePeteSignatureAssets(investigatorId, cardsToSpawn)\n\n -- Split the card list into separate lists for each zone\n local zoneDecks = buildZoneLists(cardsToSpawn)\n -- Spawn the list for each zone\n for zone, zoneCards in pairs(zoneDecks) do\n local deckPos = zones.getZonePosition(playerColor, zone)\n deckPos.y = 3\n\n local callback = nil\n -- If cards are spread too close together TTS groups them weirdly, selecting multiples\n -- when hovering over a single card. This distance is the minimum to avoid that\n local spreadDistance = 1.15\n if (zone == \"SetAside4\") then\n -- SetAside4 is reserved for customization cards, and we want them spread on the table\n -- so their checkboxes are visible\n -- TO-DO: take into account that spreading will make multiple rows\n -- (this is affected by the user's local settings!)\n if (playerColor == \"White\") then\n deckPos.z = deckPos.z + (#zoneCards - 1) * spreadDistance\n elseif (playerColor == \"Green\") then\n deckPos.x = deckPos.x + (#zoneCards - 1) * spreadDistance\n end\n callback = function(deck) deck.spread(spreadDistance) end\n elseif zone == \"Deck\" then\n callback = function(deck) deckSpawned(deck, playerColor) end\n elseif zone == \"Investigator\" or zone == \"Minicard\" then\n callback = function(card) loadAltArt(card, loadAltInvestigator) end\n end\n Spawner.spawnCards(\n zoneCards,\n deckPos,\n zones.getDefaultCardRotation(playerColor, zone),\n true, -- Sort deck\n callback)\n\n coroutine.yield(0)\n end\n\n -- Look for any cards which haven't been loaded\n local hadError = false\n for cardId, remainingCount in pairs(slots) do\n if remainingCount \u003e 0 then\n hadError = true\n arkhamDb.logCardNotFound(cardId, playerColor)\n end\n end\n if (not hadError) then\n printToAll(\"Deck loaded successfully!\", playerColor)\n end\n return 1\n end\n\n startLuaCoroutine(self, \"coinside\")\nend\n\n-- Callback handler for the main deck spawning. Looks for cards which should start in hand, and\n-- draws them for the appropriate player.\n---@param deck Object Callback-provided spawned deck object\n---@param playerColor String Color of the player to draw the cards to\nfunction deckSpawned(deck, playerColor)\n local player = Player[playmatApi.getPlayerColor(playerColor)]\n local handPos = player.getHandTransform(1).position -- Only one hand zone per player\n local deckCards = deck.getData().ContainedObjects\n -- Process in reverse order so taking cards out doesn't upset the indexing\n for i = #deckCards, 1, -1 do\n local cardMetadata = JSON.decode(deckCards[i].GMNotes) or { }\n if cardMetadata.startsInHand then\n deck.takeObject({ index = i - 1, position = handPos, flip = true, smooth = true})\n end\n end\nend\n\n-- Converts the Raven Quill's selections from card IDs to card names. This could be more elegant\n-- but the inputs are very static so we're using some brute force.\n---@param selectionString String provided by ArkhamDB, indicates the customization selections\n-- Should be either a single card ID or two separated by a ^ (e.g. XXXXX^YYYYY)\nfunction convertRavenQuillSelections(selectionString)\n if (string.len(selectionString) == 5) then\n return getCardName(selectionString)\n elseif (string.len(selectionString) == 11) then\n return getCardName(string.sub(selectionString, 1, 5)) .. \", \" .. getCardName(string.sub(selectionString, 7))\n end\nend\n\n-- Converts Grizzled's selections from a single string with \"^\".\n---@param selectionString String provided by ArkhamDB, indicates the customization selections\n-- Should be two Traits separated by a ^ (e.g. XXXXX^YYYYY)\nfunction convertGrizzledSelections(selectionString)\n return selectionString:gsub(\"%^\", \", \")\nend\n\n-- Returns the simple name of a card given its ID. This will find the card and strip any trailing\n-- SCED-specific suffixes such as (Taboo) or (Level)\nfunction getCardName(cardId)\n local card = allCardsBagApi.getCardById(cardId)\n if (card ~= nil) then\n local name = card.data.Nickname\n if (string.find(name, \" %(\")) then\n return string.sub(name, 1, string.find(name, \" %(\") - 1)\n else\n return name\n end\n end\nend\n\n-- Split a single list of cards into a separate table of lists, keyed by the zone\n---@param cards: Table of {cardData, cardMetadata, zone}\n---@return: Table of {zoneName=card list}\nfunction buildZoneLists(cards)\n local zoneList = {}\n for _, card in ipairs(cards) do\n if zoneList[card.zone] == nil then\n zoneList[card.zone] = {}\n end\n table.insert(zoneList[card.zone], card)\n end\n\n return zoneList\nend\n\n-- Check to see if the deck list has Ancestral Knowledge. If it does, move 5 random skills to SetAside3\n---@param cardList Table Deck list being created\nfunction handleAncestralKnowledge(cardList)\n local hasAncestralKnowledge = false\n local skillList = {}\n -- Have to process the entire list to check for Ancestral Knowledge and get all possible skills, so do both in one pass\n for i, card in ipairs(cardList) do\n if card.metadata.id == \"07303\" then\n hasAncestralKnowledge = true\n card.zone = \"SetAside3\"\n elseif (card.metadata.type == \"Skill\"\n and card.zone == \"Deck\"\n and not card.metadata.weakness) then\n table.insert(skillList, i)\n end\n end\n if hasAncestralKnowledge then\n for i = 1, 5 do\n -- Move 5 random skills to SetAside3\n local skillListIndex = math.random(#skillList)\n cardList[skillList[skillListIndex]].zone = \"UnderSetAside3\"\n table.remove(skillList, skillListIndex)\n end\n end\nend\n\n-- Check for and handle Underworld Market by moving all Illicit cards to UnderSetAside3\n---@param cardList Table Deck list being created\n---@param playerColor String Color this deck is being loaded for\nfunction handleUnderworldMarket(cardList, playerColor)\n local hasMarket = false\n local illicitList = {}\n -- Process the entire list to check for Underworld Market and get all possible skills, doing both in one pass\n for i, card in ipairs(cardList) do\n if card.metadata.id == \"09077\" then\n -- Underworld Market found\n hasMarket = true\n card.zone = \"SetAside3\"\n elseif card.metadata.traits ~= nil and string.find(card.metadata.traits, \"Illicit\", 1, true) and card.zone == \"Deck\" then\n table.insert(illicitList, i)\n end\n end\n\n if hasMarket then\n if #illicitList \u003c 10 then\n printToAll(\"Only \" .. #illicitList ..\n \" Illicit cards in your deck, you can't trigger Underworld Market's ability.\",\n playerColor)\n else\n -- Process cards to move them to the market deck. This is done in reverse\n -- order because the sorting needs to be reversed (deck sorts for face down)\n -- Performance here may be an issue, as table.remove() is an O(n) operation\n -- which makes the full shift O(n^2). But keep it simple unless it becomes\n -- a problem\n for i = #illicitList, 1, -1 do\n local moving = cardList[illicitList[i]]\n moving.zone = \"UnderSetAside3\"\n table.remove(cardList, illicitList[i])\n table.insert(cardList, moving)\n end\n\n if #illicitList \u003e 10 then\n printToAll(\"Moved all \" .. #illicitList ..\n \" Illicit cards to the Market deck, reduce it to 10\",\n playerColor)\n else\n printToAll(\"Built the Market deck\", playerColor)\n end\n end\n end\nend\n\n-- If the investigator is Joe Diamond, extract all Insight events to SetAside5 to build the Hunch\n-- Deck.\n---@param investigatorId String ID for the deck's investigator card. Passed separately because the\n--- investigator may not be included in the cardList\n---@param cardList Table Deck list being created\n---@param playerColor String Color this deck is being loaded for\nfunction handleHunchDeck(investigatorId, cardList, playerColor)\n if investigatorId == \"05002\" then -- Joe Diamond\n local insightList = {}\n for i, card in ipairs(cardList) do\n if (card.metadata.type == \"Event\"\n and card.metadata.traits ~= nil\n and string.match(card.metadata.traits, \"Insight\")\n and card.metadata.bonded_to == nil) then\n table.insert(insightList, i)\n end\n end\n -- Process insights to move them to the hunch deck. This is done in reverse\n -- order because the sorting needs to be reversed (deck sorts for face down)\n -- Performance here may be an issue, as table.remove() is an O(n) operation\n -- which makes the full shift O(n^2). But keep it simple unless it becomes\n -- a problem\n for i = #insightList, 1, -1 do\n local moving = cardList[insightList[i]]\n moving.zone = \"SetAside5\"\n table.remove(cardList, insightList[i])\n table.insert(cardList, moving)\n end\n if #insightList \u003c 11 then\n printToAll(\"Joe's hunch deck must have 11 cards but the deck only has \" .. #insightList ..\n \" Insight events.\", playerColor)\n elseif #insightList \u003e 11 then\n printToAll(\"Moved all \" .. #insightList ..\n \" Insight events to the hunch deck, reduce it to 11.\", playerColor)\n else\n printToAll(\"Built Joe's hunch deck\", playerColor)\n end\n end\nend\n\n-- For any customization upgrade cards in the card list, process the metadata from the deck to\n-- set the save state to show the correct checkboxes/text field values\n---@param cardList Table Deck list being created\n---@param customizations Table Deck's meta table, extracted from ArkhamDB's deck structure\nfunction handleCustomizableUpgrades(cardList, customizations)\n for _, card in ipairs(cardList) do\n if card.metadata.type == \"UpgradeSheet\" then\n local baseId = string.sub(card.metadata.id, 1, 5)\n local upgrades = customizations[\"cus_\" .. baseId]\n\n if upgrades ~= nil then\n -- initialize tables\n -- markedBoxes: contains the amount of markedBoxes (left to right) per row (starting at row 1)\n -- inputValues: contains the amount of inputValues per row (starting at row 0)\n local selectedUpgrades = { }\n local index_xp = {}\n\n -- get the index and xp values (looks like this: X|X,X|X, ..)\n -- input string from ArkhamDB is split by \",\"\n for str in string.gmatch(customizations[\"cus_\" .. baseId], \"([^,]+)\") do\n table.insert(index_xp, str)\n end\n\n -- split each pair and assign it to the proper position in markedBoxes\n for _, entry in ipairs(index_xp) do\n -- counter increments from 1 to 3 and indicates the part of the string we are on\n -- usually: 1 = row, 2 = amount of check boxes, 3 = entry in inputfield\n local counter = 0\n local row = 0\n\n -- parsing the string for each row\n for str in entry:gmatch(\"([^|]+)\") do\n counter = counter + 1\n\n if counter == 1 then\n row = tonumber(str) + 1\n elseif counter == 2 then\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n end\n selectedUpgrades[row].xp = tonumber(str)\n elseif counter == 3 and str ~= \"\" then\n if baseId == \"09042\" then\n selectedUpgrades[row].text = convertRavenQuillSelections(str)\n elseif baseId == \"09101\" then\n selectedUpgrades[row].text = convertGrizzledSelections(str)\n elseif baseId == \"09079\" then -- Living Ink skill selection\n -- All skills, regardless of row, are placed in upgrade slot 1 as a comma-delimited\n -- list\n if selectedUpgrades[1].text == nil then\n selectedUpgrades[1].text = str\n else\n selectedUpgrades[1].text = selectedUpgrades[1].text .. \",\" .. str\n end\n else\n selectedUpgrades[row].text = str\n end\n end\n end\n end\n\n -- write the loaded values to the save_data of the sheets\n card.data[\"LuaScriptState\"] = JSON.encode({ selections = selectedUpgrades })\n end\n end\n end\nend\n\n-- Handles cards that start in play under specific conditions for Ashcan Pete (Regular Pete - Duke, Parallel Pete - Guitar)\n---@param investigatorId String ID for the deck's investigator card. Passed separately because the\n--- investigator may not be included in the cardList\n---@param cardList Table Deck list being created\nfunction handlePeteSignatureAssets(investigatorId, cardList)\n if investigatorId == \"02005\" or investigatorId == \"02005-pb\" then -- regular Pete's front\n for i, card in ipairs(cardList) do\n if card.metadata.id == \"02014\" then -- Duke\n card.zone = \"BlankTop\"\n end\n end\n elseif investigatorId == \"02005-p\" or investigatorId == \"02005-pf\" then -- parallel Pete's front\n for i, card in ipairs(cardList) do\n if card.metadata.id == \"90047\" then -- Pete's Guitar\n card.zone = \"BlankTop\"\n end\n end\n end\nend\n\n-- Callback function for investigator cards and minicards to set the correct state for alt art\n---@param card Object Card which needs to be set the state for\n---@param loadAltInvestigator String Contains the name of alternative art for the investigator (\"normal\", \"revised\" or \"promo\")\nfunction loadAltArt(card, loadAltInvestigator)\n -- states are set up this way:\n -- 1 - normal, 2 - revised/promo, 3 - promo (if 2 is revised)\n -- This means we can always load the 2nd state for revised and just get the last state for promo\n if loadAltInvestigator == \"normal\" then\n return\n elseif loadAltInvestigator == \"revised\" then\n card.setState(2)\n elseif loadAltInvestigator == \"promo\" then\n local states = card.getStates()\n card.setState(#states)\n end\nend\nend)\n__bundle_register(\"arkhamdb/ArkhamDb\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local allCardsBagApi = require(\"playercards/AllCardsBagApi\")\n local playAreaApi = require(\"core/PlayAreaApi\")\n \n local ArkhamDb = { }\n local internal = { }\n\n local RANDOM_WEAKNESS_ID = \"01000\"\n\n local tabooList = { }\n --Forward declaration\n ---@type Request\n local Request = {}\n local configuration\n\n -- Sets up the ArkhamDb interface. Should be called from the parent object on load.\n ArkhamDb.initialize = function()\n configuration = internal.getConfiguration()\n Request.start({ configuration.api_uri, configuration.taboo }, function(status)\n local json = JSON.decode(internal.fixUtf16String(status.text))\n for _, taboo in pairs(json) do\n ---@type \u003cstring, boolean\u003e\n local cards = {}\n\n for _, card in pairs(JSON.decode(taboo.cards)) do\n cards[card.code] = true\n end\n\n tabooList[taboo.id] = {\n date = taboo.date_start,\n cards = cards\n }\n end\n return true, nil\n end)\n end\n\n -- Start the deck build process for the given player color and deck ID. This\n -- will retrieve the deck from ArkhamDB, and pass to a callback for processing.\n ---@param playerColor String. Color name of the player mat to place this deck on (e.g. \"Red\").\n ---@param deckId String. ArkhamDB deck id to be loaded\n ---@param isPrivate Boolean. Whether this deck is published or private on ArkhamDB\n ---@param loadNewest Boolean. Whether the newest version of this deck should be loaded\n ---@param loadInvestigators Boolean. Whether investigator cards should be loaded as part of this\n --- deck\n ---@param callback Function. Callback which will be sent the results of this load. Parameters\n --- to the callback will be:\n --- slots Table. A map of card ID to count in the deck\n --- investigatorCode String. ID of the investigator in this deck\n --- customizations Table. The decoded table of customization upgrades in this deck\n --- playerColor String. Color this deck is being loaded for\n ArkhamDb.getDecklist = function(\n playerColor,\n deckId,\n isPrivate,\n loadNewest,\n loadInvestigators,\n callback)\n -- Get a simple card to see if the bag indexes are complete. If not, abort\n -- the deck load. The called method will handle player notification.\n local checkCard = allCardsBagApi.getCardById(\"01001\")\n if (checkCard ~= nil and checkCard.data == nil) then\n return\n end\n\n local deckUri = { configuration.api_uri,\n isPrivate and configuration.private_deck or configuration.public_deck, deckId }\n\n local deck = Request.start(deckUri, function(status)\n if string.find(status.text, \"\u003c!DOCTYPE html\u003e\") then\n internal.maybePrint(\"Private deck ID \" .. deckId .. \" is not shared\", playerColor)\n return false, table.concat({ \"Private deck \", deckId, \" is not shared\" })\n end\n local json = JSON.decode(status.text)\n\n if not json then\n internal.maybePrint(\"Deck ID \" .. deckId .. \" not found\", playerColor)\n return false, \"Deck not found!\"\n end\n\n return true, json\n end)\n\n deck:with(internal.onDeckResult, playerColor, loadNewest, loadInvestigators, callback)\n end\n\n -- Logs that a card could not be loaded in the mod by printing it to the console in the given\n -- color of the player owning the deck. Attempts to look up the name on ArkhamDB for clarity,\n -- but prints the card ID if the name cannot be retrieved.\n ---@param cardId String. ArkhamDB ID of the card that could not be found\n ---@param playerColor String. Color of the player's deck that had the problem\n ArkhamDb.logCardNotFound = function(cardId, playerColor)\n local request = Request.start({\n configuration.api_uri,\n configuration.cards,\n cardId\n },\n function(result)\n local adbCardInfo = JSON.decode(internal.fixUtf16String(result.text))\n local cardName = adbCardInfo.real_name\n if (cardName ~= nil) then\n if (adbCardInfo.xp ~= nil and adbCardInfo.xp \u003e 0) then\n cardName = cardName .. \" (\" .. adbCardInfo.xp .. \")\"\n end\n internal.maybePrint(\"Card not found: \" .. cardName .. \", ArkhamDB ID \" .. cardId, playerColor)\n else\n internal.maybePrint(\"Card not found in ArkhamDB, ID \" .. cardId, playerColor)\n end\n end)\n end\n\n -- Callback when the deck information is received from ArkhamDB. Parses the\n -- response then applies standard transformations to the deck such as adding\n -- random weaknesses and checking for taboos. Once the deck is processed,\n -- passes to loadCards to actually spawn the defined deck.\n ---@param deck ArkhamImportDeck\n ---@param playerColor String Color name of the player mat to place this deck on (e.g. \"Red\")\n ---@param loadNewest Boolean Whether the newest version of this deck should be loaded\n ---@param loadInvestigators Boolean Whether investigator cards should be loaded as part of this\n --- deck\n ---@param callback Function Callback which will be sent the results of this load. Parameters\n --- to the callback will be:\n --- slots Table. A map of card ID to count in the deck\n --- investigatorCode String. ID of the investigator in this deck\n --- bondedList A table of cardID keys to meaningless values. Card IDs in this list were\n --- added from a parent bonded card.\n --- customizations Table. The decoded table of customization upgrades in this deck\n --- playerColor String. Color this deck is being loaded for\n internal.onDeckResult = function(deck, playerColor, loadNewest, loadInvestigators, callback)\n -- Load the next deck in the upgrade path if the option is enabled\n if (loadNewest and deck.next_deck ~= nil and deck.next_deck ~= \"\") then\n buildDeck(playerColor, deck.next_deck)\n return\n end\n\n internal.maybePrint(table.concat({ \"Found decklist: \", deck.name }), playerColor)\n\n -- Initialize deck slot table and perform common transformations. The order of these should not\n -- be changed, as later steps may act on cards added in each. For example, a random weakness or\n -- investigator may have bonded cards or taboo entries, and should be present\n local slots = deck.slots\n internal.maybeDrawRandomWeakness(slots, playerColor)\n local loadAltInvestigator = \"normal\"\n if loadInvestigators then\n loadAltInvestigator = internal.addInvestigatorCards(deck, slots)\n end\n \n internal.maybeAddSummonedServitor(slots)\n internal.maybeAddOnTheMend(slots, playerColor)\n internal.maybeAddRealityAcidReference(slots)\n local bondList = internal.extractBondedCards(slots)\n internal.checkTaboos(deck.taboo_id, slots, playerColor)\n internal.maybeAddUpgradeSheets(slots)\n\n -- get upgrades for customizable cards\n local customizations = {}\n if deck.meta then\n customizations = JSON.decode(deck.meta)\n end\n\n callback(slots, deck.investigator_code, bondList, customizations, playerColor, loadAltInvestigator)\n end\n\n -- Checks to see if the slot list includes the random weakness ID. If it does,\n -- removes it from the deck and replaces it with the ID of a random basic weakness provided by the\n -- all cards bag\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number\n --- of those cards which will be spawned\n ---@param playerColor String Color of the player this deck is being loaded for. Used for broadcast\n --- if a weakness is added.\n internal.maybeDrawRandomWeakness = function(slots, playerColor)\n local randomWeaknessAmount = slots[RANDOM_WEAKNESS_ID] or 0\n slots[RANDOM_WEAKNESS_ID] = nil\n\n if randomWeaknessAmount ~= 0 then\n for i=1, randomWeaknessAmount do\n local weaknessId = allCardsBagApi.getRandomWeaknessId()\n slots[weaknessId] = (slots[weaknessId] or 0) + 1\n end\n internal.maybePrint(\"Added \" .. randomWeaknessAmount .. \" random basic weakness(es) to deck\", playerColor)\n end\n end\n\n -- Adds both the investigator (XXXXX) and minicard (XXXXX-m) slots with one copy each\n ---@param deck Table The processed ArkhamDB deck response\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the\n --- number of those cards which will be spawned\n ---@return string: Contains the name of the art that should be loaded (\"normal\", \"promo\" or \"revised\")\n internal.addInvestigatorCards = function(deck, slots)\n local investigatorId = deck.investigator_code\n slots[investigatorId .. \"-m\"] = 1\n local deckMeta = JSON.decode(deck.meta)\n -- handling alternative investigator art and parallel investigators\n local loadAltInvestigator = \"normal\"\n if deckMeta ~= nil then\n local altFrontId = tonumber(deckMeta.alternate_front) or 0\n local altBackId = tonumber(deckMeta.alternate_back) or 0\n local altArt = { front = \"normal\", back = \"normal\" }\n\n -- translating front ID\n if altFrontId \u003e 90000 and altFrontId \u003c 90047 then\n altArt.front = \"parallel\"\n elseif altFrontId \u003e 01500 and altFrontId \u003c 01506 then\n altArt.front = \"revised\"\n elseif altFrontId \u003e 98000 then\n altArt.front = \"promo\"\n end\n\n -- translating back ID\n if altBackId \u003e 90000 and altBackId \u003c 90047 then\n altArt.back = \"parallel\"\n elseif altBackId \u003e 01500 and altBackId \u003c 01506 then\n altArt.back = \"revised\"\n elseif altBackId \u003e 98000 then\n altArt.back = \"promo\"\n end\n\n -- updating investigatorID based on alt investigator selection\n -- precedence: parallel \u003e promo \u003e revised\n if altArt.front == \"parallel\" then\n if altArt.back == \"parallel\" then\n investigatorId = investigatorId .. \"-p\"\n else\n investigatorId = investigatorId .. \"-pf\"\n end\n elseif altArt.back == \"parallel\" then\n investigatorId = investigatorId .. \"-pb\"\n elseif altArt.front == \"promo\" or altArt.back == \"promo\" then\n loadAltInvestigator = \"promo\"\n elseif altArt.front == \"revised\" or altArt.back == \"revised\" then\n loadAltInvestigator = \"revised\"\n end\n end\n slots[investigatorId] = 1\n deck.investigator_code = investigatorId\n return loadAltInvestigator\n end\n\n -- Process the card list looking for the customizable cards, and add their upgrade sheets if needed\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number\n -- of those cards which will be spawned\n internal.maybeAddUpgradeSheets = function(slots)\n for cardId, _ in pairs(slots) do\n -- upgrade sheets for customizable cards\n local upgradesheet = allCardsBagApi.getCardById(cardId .. \"-c\")\n if upgradesheet ~= nil then\n slots[cardId .. \"-c\"] = 1\n end\n end\n end\n\n -- Process the card list looking for the Summoned Servitor, and add its minicard to the list if\n -- needed\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number\n -- of those cards which will be spawned\n internal.maybeAddSummonedServitor = function(slots)\n if slots[\"09080\"] ~= nil then\n slots[\"09080-m\"] = 1\n end\n end\n\n -- On the Mend should have 1-per-investigator copies set aside, but ArkhamDB always sends 1. Update\n -- the count based on the investigator count\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number\n -- of those cards which will be spawned\n ---@param playerColor String Color of the player this deck is being loaded for. Used for broadcast if an error occurs\n internal.maybeAddOnTheMend = function(slots, playerColor)\n if slots[\"09006\"] ~= nil then\n local investigatorCount = playAreaApi.getInvestigatorCount()\n if investigatorCount ~= nil then\n slots[\"09006\"] = investigatorCount\n else\n internal.maybePrint(\"Something went wrong with the load, adding 4 copies of On the Mend\", playerColor)\n slots[\"09006\"] = 4\n end\n end\n end\n\n -- Process the card list looking for Reality Acid and adds the reference sheet when needed\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number\n -- of those cards which will be spawned\n internal.maybeAddRealityAcidReference = function(slots)\n if slots[\"89004\"] ~= nil then\n slots[\"89005\"] = 1\n end\n end\n\n -- Process the slot list and looks for any cards which are bonded to those in the deck. Adds those cards to the slot list.\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number of those cards which will be spawned\n internal.extractBondedCards = function(slots)\n -- Create a list of bonded cards first so we don't modify slots while iterating\n local bondedCards = { }\n local bondedList = { }\n for cardId, cardCount in pairs(slots) do\n local card = allCardsBagApi.getCardById(cardId)\n if (card ~= nil and card.metadata.bonded ~= nil) then\n for _, bond in ipairs(card.metadata.bonded) do\n bondedCards[bond.id] = bond.count\n -- We need to know which cards are bonded to determine their position, remember them\n bondedList[bond.id] = true\n -- Also adding taboo versions of bonded cards to the list\n bondedList[bond.id .. \"-t\"] = true\n end\n end\n end\n -- Add any bonded cards to the main slots list\n for bondedId, bondedCount in pairs(bondedCards) do\n slots[bondedId] = bondedCount\n end\n\n return bondedList\n end\n\n -- Check the deck for cards on its taboo list. If they're found, replace the entry in the slot with the Taboo id (i.e. \"XXXX\" becomes \"XXXX-t\")\n ---@param tabooId String The deck's taboo ID, taken from the deck response taboo_id field. May be nil, indicating that no taboo list should be used\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number of those cards which will be spawned\n internal.checkTaboos = function(tabooId, slots, playerColor)\n if tabooId then\n for cardId, _ in pairs(tabooList[tabooId].cards) do\n if slots[cardId] ~= nil then\n -- Make sure there's a taboo version of the card before we replace it\n -- SCED only maintains the most recent taboo cards. If a deck is using\n -- an older taboo list it's possible the card isn't a taboo any more\n local tabooCard = allCardsBagApi.getCardById(cardId .. \"-t\")\n if tabooCard == nil then\n local basicCard = allCardsBagApi.getCardById(cardId)\n internal.maybePrint(\"Taboo version for \" .. basicCard.data.Nickname .. \" is not available. Using standard version\", playerColor)\n else\n slots[cardId .. \"-t\"] = slots[cardId]\n slots[cardId] = nil\n end\n end\n end\n end\n end\n\n internal.maybePrint = function(message, playerColor)\n if playerColor ~= \"None\" then\n printToAll(message, playerColor)\n end\n end\n\n -- Gets the ArkhamDB config info from the configuration object.\n ---@return Table. Configuration data\n internal.getConfiguration = function()\n local configuration = getObjectsWithTag(\"import_configuration_provider\")[1]:getTable(\"configuration\")\n printPriority = configuration.priority\n return configuration\n end\n\n internal.fixUtf16String = function(str)\n return str:gsub(\"\\\\u(%w%w%w%w)\", function(match)\n return string.char(tonumber(match, 16))\n end)\n end\n\n ---@type Request\n Request = {\n is_done = false,\n is_successful = false\n }\n\n -- Creates a new instance of a Request. Should not be directly called. Instead use Request.start and Request.deferred.\n ---@param uri string\n ---@param configure fun(request: Request, status: WebRequestStatus)\n ---@return Request\n function Request:new(uri, configure)\n local this = {}\n\n setmetatable(this, self)\n self.__index = self\n\n if type(uri) == \"table\" then\n uri = table.concat(uri, \"/\")\n end\n\n this.uri = uri\n\n WebRequest.get(uri, function(status)\n configure(this, status)\n end)\n\n return this\n end\n\n -- Creates a new request. on_success should set the request's is_done, is_successful, and content variables.\n -- Deferred should be used when you don't want to set is_done immediately (such as if you want to wait for another request to finish)\n ---@param uri string\n ---@param on_success fun(request: Request, status: WebRequestStatus, vararg any)\n ---@param on_error fun(status: WebRequestStatus)|nil\n ---@vararg any[]\n ---@return Request\n function Request.deferred(uri, on_success, on_error, ...)\n local parameters = table.pack(...)\n return Request:new(uri, function(request, status)\n if (status.is_done) then\n if (status.is_error) then\n request.error_message = on_error and on_error(status, table.unpack(parameters)) or status.error\n request.is_successful = false\n request.is_done = true\n else\n on_success(request, status)\n end\n end\n end)\n end\n\n -- Creates a new request. on_success should return weather the resultant data is as expected, and the processed content of the request.\n ---@param uri string\n ---@param on_success fun(status: WebRequestStatus, vararg any): boolean, any\n ---@param on_error nil|fun(status: WebRequestStatus, vararg any): string\n ---@vararg any[]\n ---@return Request\n function Request.start(uri, on_success, on_error, ...)\n local parameters = table.pack(...)\n return Request.deferred(uri, function(request, status)\n local result, message = on_success(status, table.unpack(parameters))\n if not result then request.error_message = message else request.content = message end\n request.is_successful = result\n request.is_done = true\n end, on_error, table.unpack(parameters))\n end\n\n ---@param requests Request[]\n ---@param on_success fun(content: any[], vararg any[])\n ---@param on_error fun(requests: Request[], vararg any[])|nil\n ---@vararg any\n function Request.with_all(requests, on_success, on_error, ...)\n local parameters = table.pack(...)\n\n Wait.condition(function()\n ---@type any[]\n local results = {}\n\n ---@type Request[]\n local errors = {}\n\n for _, request in ipairs(requests) do\n if request.is_successful then\n table.insert(results, request.content)\n else\n table.insert(errors, request)\n end\n end\n\n if (#errors \u003c= 0) then\n on_success(results, table.unpack(parameters))\n elseif on_error == nil then\n for _, request in ipairs(errors) do\n internal.maybePrint(table.concat({ \"[ERROR]\", request.uri, \":\", request.error_message }))\n end\n else\n on_error(requests, table.unpack(parameters))\n end\n end, function()\n for _, request in ipairs(requests) do\n if not request.is_done then return false end\n end\n return true\n end)\n end\n\n ---@param callback fun(content: any, vararg any)\n function Request:with(callback, ...)\n local arguments = table.pack(...)\n Wait.condition(function()\n if self.is_successful then\n callback(self.content, table.unpack(arguments))\n end\n end, function() return self.is_done\n end)\n end\n\n return ArkhamDb\nend\nend)\n__bundle_register(\"arkhamdb/DeckImporterUi\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal allCardsBagApi = require(\"playercards/AllCardsBagApi\")\n\nlocal INPUT_FIELD_HEIGHT = 340\nlocal INPUT_FIELD_WIDTH = 1500\nlocal FIELD_COLOR = { 0.9, 0.7, 0.5 }\n\nlocal PRIVATE_TOGGLE_LABELS = {}\nPRIVATE_TOGGLE_LABELS[true] = \"Private\"\nPRIVATE_TOGGLE_LABELS[false] = \"Published\"\n\nlocal UPGRADED_TOGGLE_LABELS = {}\nUPGRADED_TOGGLE_LABELS[true] = \"Upgraded\"\nUPGRADED_TOGGLE_LABELS[false] = \"Specific\"\n\nlocal LOAD_INVESTIGATOR_TOGGLE_LABELS = {}\nLOAD_INVESTIGATOR_TOGGLE_LABELS[true] = \"Yes\"\nLOAD_INVESTIGATOR_TOGGLE_LABELS[false] = \"No\"\n\nlocal redDeckId = \"\"\nlocal orangeDeckId = \"\"\nlocal whiteDeckId = \"\"\nlocal greenDeckId = \"\"\n\nlocal privateDeck = true\nlocal loadNewestDeck = true\nlocal loadInvestigators = false\n\n-- Returns a table with the full state of the UI, including options and deck IDs.\n-- This can be used to persist via onSave(), or provide values for a load operation\n-- Table values:\n-- redDeck: Deck ID to load for the red player\n-- orangeDeck: Deck ID to load for the orange player\n-- whiteDeck: Deck ID to load for the white player\n-- greenDeck: Deck ID to load for the green player\n-- private: True to load a private deck, false to load a public deck\n-- loadNewest: True if the most upgraded version of the deck should be loaded\n-- investigators: True if investigator cards should be spawned\nfunction getUiState()\n return {\n redDeck = redDeckId,\n orangeDeck = orangeDeckId,\n whiteDeck = whiteDeckId,\n greenDeck = greenDeckId,\n private = privateDeck,\n loadNewest = loadNewestDeck,\n investigators = loadInvestigators\n }\nend\n\n-- Updates the state of the UI based on the provided table. Any values not provided will be left the same.\n---@param uiStateTable Table of values to update on importer\n-- Table values:\n-- redDeck: Deck ID to load for the red player\n-- orangeDeck: Deck ID to load for the orange player\n-- whiteDeck: Deck ID to load for the white player\n-- greenDeck: Deck ID to load for the green player\n-- private: True to load a private deck, false to load a public deck\n-- loadNewest: True if the most upgraded version of the deck should be loaded\n-- investigators: True if investigator cards should be spawned\nfunction setUiState(uiStateTable)\n -- Callback functions aren't triggered when editing buttons/inputs so values must be set manually\n\n if uiStateTable[\"greenDeck\"] then\n greenDeckId = uiStateTable[\"greenDeck\"]\n self.editInput({index=0, value=greenDeckId})\n end\n if uiStateTable[\"redDeck\"] then\n redDeckId = uiStateTable[\"redDeck\"]\n self.editInput({index=1, value=redDeckId})\n end\n if uiStateTable[\"whiteDeck\"] then\n whiteDeckId = uiStateTable[\"whiteDeck\"]\n self.editInput({index=2, value=whiteDeckId})\n end\n if uiStateTable[\"orangeDeck\"]then\n orangeDeckId = uiStateTable[\"orangeDeck\"]\n self.editInput({index=3, value=orangeDeckId})\n end\n if uiStateTable[\"private\"] then\n privateDeck = uiStateTable[\"private\"]\n self.editButton { index = 0, label = PRIVATE_TOGGLE_LABELS[privateDeck] }\n end\n if uiStateTable[\"loadNewest\"] then\n loadNewestDeck = uiStateTable[\"loadNewest\"]\n self.editButton { index = 1, label = UPGRADED_TOGGLE_LABELS[loadNewestDeck] }\n end\n if uiStateTable[\"investigators\"] then\n loadInvestigators = uiStateTable[\"investigators\"]\n self.editButton { index = 2, label = LOAD_INVESTIGATOR_TOGGLE_LABELS[loadInvestigators] }\n end\nend\n\n-- Sets up the UI for the deck loader, populating fields from the given save state table decoded from onLoad()\nfunction initializeUi(savedUiState)\n if savedUiState ~= nil then\n redDeckId = savedUiState.redDeck\n orangeDeckId = savedUiState.orangeDeck\n whiteDeckId = savedUiState.whiteDeck\n greenDeckId = savedUiState.greenDeck\n privateDeck = savedUiState.private\n loadNewestDeck = savedUiState.loadNewest\n loadInvestigators = savedUiState.investigators\n end\n\n makeOptionToggles()\n makeDeckIdFields()\n makeBuildButton()\nend\n\nfunction makeOptionToggles()\n -- common parameters\n local checkbox_parameters = {}\n checkbox_parameters.function_owner = self\n checkbox_parameters.width = INPUT_FIELD_WIDTH\n checkbox_parameters.height = INPUT_FIELD_HEIGHT\n checkbox_parameters.scale = { 0.1, 0.1, 0.1 }\n checkbox_parameters.font_size = 240\n checkbox_parameters.hover_color = { 0.4, 0.6, 0.8 }\n checkbox_parameters.color = FIELD_COLOR\n\n -- public / private deck\n checkbox_parameters.click_function = \"publicPrivateChanged\"\n checkbox_parameters.position = { 0.25, 0.1, -0.102 }\n checkbox_parameters.tooltip = \"Published or private deck?\\n\\nPLEASE USE A PRIVATE DECK IF JUST FOR TTS TO AVOID FLOODING ARKHAMDB PUBLISHED DECK LISTS!\"\n checkbox_parameters.label = PRIVATE_TOGGLE_LABELS[privateDeck]\n self.createButton(checkbox_parameters)\n\n -- load upgraded?\n checkbox_parameters.click_function = \"loadUpgradedChanged\"\n checkbox_parameters.position = { 0.25, 0.1, -0.01 }\n checkbox_parameters.tooltip = \"Load newest upgrade or exact deck?\"\n checkbox_parameters.label = UPGRADED_TOGGLE_LABELS[loadNewestDeck]\n self.createButton(checkbox_parameters)\n\n -- load investigators?\n checkbox_parameters.click_function = \"loadInvestigatorsChanged\"\n checkbox_parameters.position = { 0.25, 0.1, 0.081 }\n checkbox_parameters.tooltip = \"Spawn investigator cards?\"\n checkbox_parameters.label = LOAD_INVESTIGATOR_TOGGLE_LABELS[loadInvestigators]\n self.createButton(checkbox_parameters)\nend\n\n-- Create the four deck ID entry fields\nfunction makeDeckIdFields()\n local input_parameters = {}\n -- Parameters common to all entry fields\n input_parameters.function_owner = self\n input_parameters.scale = { 0.1, 0.1, 0.1 }\n input_parameters.width = INPUT_FIELD_WIDTH\n input_parameters.height = INPUT_FIELD_HEIGHT\n input_parameters.font_size = 320\n input_parameters.tooltip = \"Deck ID from ArkhamDB URL of the deck\\nPublic URL: 'https://arkhamdb.com/decklist/view/101/knowledge-overwhelming-solo-deck-1.0' = '101'\\nPrivate URL: 'https://arkhamdb.com/deck/view/102' = '102'\"\n input_parameters.alignment = 3 -- Center\n input_parameters.color = FIELD_COLOR\n input_parameters.font_color = { 0, 0, 0 }\n input_parameters.validation = 2 -- Integer\n\n -- Green\n input_parameters.input_function = \"greenDeckChanged\"\n input_parameters.position = { -0.166, 0.1, 0.385 }\n input_parameters.value = greenDeckId\n self.createInput(input_parameters)\n -- Red\n input_parameters.input_function = \"redDeckChanged\"\n input_parameters.position = { 0.171, 0.1, 0.385 }\n input_parameters.value = redDeckId\n self.createInput(input_parameters)\n -- White\n input_parameters.input_function = \"whiteDeckChanged\"\n input_parameters.position = { -0.166, 0.1, 0.474 }\n input_parameters.value = whiteDeckId\n self.createInput(input_parameters)\n -- Orange\n input_parameters.input_function = \"orangeDeckChanged\"\n input_parameters.position = { 0.171, 0.1, 0.474 }\n input_parameters.value = orangeDeckId\n self.createInput(input_parameters)\nend\n\n-- Create the Build All button. This is a transparent button which covers the Build All portion of the background graphic\nfunction makeBuildButton()\n local button_parameters = {}\n button_parameters.click_function = \"loadDecks\"\n button_parameters.function_owner = self\n button_parameters.position = { 0, 0.1, 0.71 }\n button_parameters.width = 320\n button_parameters.height = 30\n button_parameters.color = { 0, 0, 0, 0 }\n button_parameters.tooltip = \"Click to build all four decks!\"\n self.createButton(button_parameters)\nend\n\n-- Event handlers for deck ID change\nfunction redDeckChanged(_, _, inputValue) redDeckId = inputValue end\n\nfunction orangeDeckChanged(_, _, inputValue) orangeDeckId = inputValue end\n\nfunction whiteDeckChanged(_, _, inputValue) whiteDeckId = inputValue end\n\nfunction greenDeckChanged(_, _, inputValue) greenDeckId = inputValue end\n\n-- Event handlers for toggle buttons\nfunction publicPrivateChanged()\n privateDeck = not privateDeck\n self.editButton { index = 0, label = PRIVATE_TOGGLE_LABELS[privateDeck] }\nend\n\nfunction loadUpgradedChanged()\n loadNewestDeck = not loadNewestDeck\n self.editButton { index = 1, label = UPGRADED_TOGGLE_LABELS[loadNewestDeck] }\nend\n\nfunction loadInvestigatorsChanged()\n loadInvestigators = not loadInvestigators\n self.editButton { index = 2, label = LOAD_INVESTIGATOR_TOGGLE_LABELS[loadInvestigators] }\nend\n\nfunction loadDecks()\n -- testLoadLotsOfDecks()\n -- Method in DeckImporterMain, visible due to inclusion\n\n local indexReady = allCardsBagApi.isIndexReady()\n if (not indexReady) then\n broadcastToAll(\"Still loading player cards, please try again in a few seconds\", {0.9, 0.2, 0.2})\n return\n end\n if (redDeckId ~= nil and redDeckId ~= \"\") then\n buildDeck(\"Red\", redDeckId)\n end\n if (orangeDeckId ~= nil and orangeDeckId ~= \"\") then\n buildDeck(\"Orange\", orangeDeckId)\n end\n if (whiteDeckId ~= nil and whiteDeckId ~= \"\") then\n buildDeck(\"White\", whiteDeckId)\n end\n if (greenDeckId ~= nil and greenDeckId ~= \"\") then\n buildDeck(\"Green\", greenDeckId)\n end\nend\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = { }\n local PLAY_AREA_GUID = \"721ba2\"\n local INVESTIGATOR_COUNTER_GUID = \"f182ee\"\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with\n -- 'displacement_excluded'\n ---@param playerColor Color of the player requesting the shift. Used solely to send an error\n --- message in the unlikely case that the scripting zone has been deleted\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"tryObjectEnterContainer\",\n { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightCountedVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\n__bundle_register(\"playercards/AllCardsBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local AllCardsBagApi = {}\n local ALL_CARDS_BAG_GUID = \"15bb07\"\n\n -- Returns a specific card from the bag, based on ArkhamDB ID\n -- @param table:\n -- id: String ID of the card to retrieve\n -- @return: If the indexes are still being constructed, an empty table is\n -- returned. Otherwise, a single table with the following fields\n -- cardData: TTS object data, suitable for spawning the card\n -- cardMetadata: Table of parsed metadata\n AllCardsBagApi.getCardById = function(id)\n return getObjectFromGUID(ALL_CARDS_BAG_GUID).call(\"getCardById\", {id = id})\n end\n\n -- Gets a random basic weakness from the bag. Once a given ID has been returned\n -- it will be removed from the list and cannot be selected again until a reload\n -- occurs or the indexes are rebuilt, which will refresh the list to include all\n -- weaknesses.\n -- @return: String ID of the selected weakness.\n AllCardsBagApi.getRandomWeaknessId = function()\n return getObjectFromGUID(ALL_CARDS_BAG_GUID).call(\"getRandomWeaknessId\")\n end\n\n AllCardsBagApi.isIndexReady = function()\n return getObjectFromGUID(ALL_CARDS_BAG_GUID).call(\"isIndexReady\")\n end\n\n -- Called by Hotfix bags when they load. If we are still loading indexes, then\n -- the all cards and hotfix bags are being loaded together, and we can ignore\n -- this call as the hotfix will be included in the initial indexing. If it is\n -- called once indexing is complete it means the hotfix bag has been added\n -- later, and we should rebuild the index to integrate the hotfix bag.\n AllCardsBagApi.rebuildIndexForHotfix = function()\n return getObjectFromGUID(ALL_CARDS_BAG_GUID).call(\"rebuildIndexForHotfix\")\n end\n\n -- Searches the bag for cards which match the given name and returns a list. Note that this is\n -- an O(n) search without index support. It may be slow.\n -- @param\n -- name String or string fragment to search for names\n -- exact Whether the name match should be exact\n AllCardsBagApi.getCardsByName = function(name, exact)\n return getObjectFromGUID(ALL_CARDS_BAG_GUID).call(\"getCardsByName\", {name = name, exact = exact})\n end\n\n AllCardsBagApi.isBagPresent = function()\n return getObjectFromGUID(ALL_CARDS_BAG_GUID) and true\n end\n\n -- Returns a list of cards from the bag matching a class and level (0 or upgraded)\n -- @param \n -- class: String class to retrieve (\"Guardian\", \"Seeker\", etc)\n -- upgraded: true for upgraded cards (Level 1-5), false for Level 0\n -- @return: If the indexes are still being constructed, returns an empty table.\n -- Otherwise, a list of tables, each with the following fields\n -- cardData: TTS object data, suitable for spawning the card\n -- cardMetadata: Table of parsed metadata\n AllCardsBagApi.getCardsByClassAndLevel = function(class, upgraded)\n return getObjectFromGUID(ALL_CARDS_BAG_GUID).call(\"getCardsByClassAndLevel\", {class = class, upgraded = upgraded})\n end\n\n AllCardsBagApi.getCardsByCycle = function(cycle)\n return getObjectFromGUID(ALL_CARDS_BAG_GUID).call(\"getCardsByCycle\", cycle)\n end\n\n AllCardsBagApi.getUniqueWeaknesses = function()\n return getObjectFromGUID(ALL_CARDS_BAG_GUID).call(\"getUniqueWeaknesses\")\n end\n\n return AllCardsBagApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"arkhamdb/DeckImporterMain\")\nend)\n__bundle_register(\"arkhamdb/DeckImporterMain\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"arkhamdb/DeckImporterUi\")\nrequire(\"playercards/PlayerCardSpawner\")\n\nlocal allCardsBagApi = require(\"playercards/AllCardsBagApi\")\nlocal arkhamDb = require(\"arkhamdb/ArkhamDb\")\nlocal playAreaApi = require(\"core/PlayAreaApi\")\nlocal playmatApi = require(\"playermat/PlaymatApi\")\nlocal zones = require(\"playermat/Zones\")\n\nfunction onLoad(script_state)\n initializeUi(JSON.decode(script_state))\n math.randomseed(os.time())\n arkhamDb.initialize()\nend\n\nfunction onSave() return JSON.encode(getUiState()) end\n\n-- Returns the zone name where the specified card should be placed, based on its metadata.\n---@param cardMetadata Table of card metadata.\n---@return Zone String Name of the zone such as \"Deck\", \"SetAside1\", etc.\n-- See Zones object documentation for a list of valid zones.\nfunction getDefaultCardZone(cardMetadata, bondedList)\n if (cardMetadata.id == \"09080-m\") then -- Have to check the Servitor before other minicards\n return \"SetAside6\"\n elseif (cardMetadata.id == \"09006\") then -- On The Mend is set aside\n return \"SetAside2\"\n elseif cardMetadata.type == \"Investigator\" then\n return \"Investigator\"\n elseif cardMetadata.type == \"Minicard\" then\n return \"Minicard\"\n elseif cardMetadata.type == \"UpgradeSheet\" then\n return \"SetAside4\"\n elseif cardMetadata.startsInPlay then\n return \"BlankTop\"\n elseif cardMetadata.permanent then\n return \"SetAside1\"\n elseif bondedList[cardMetadata.id] then\n return \"SetAside2\"\n -- SetAside3 is used for Ancestral Knowledge / Underworld Market\n else\n return \"Deck\"\n end\nend\n\nfunction buildDeck(playerColor, deckId)\n local uiState = getUiState()\n arkhamDb.getDecklist(\n playerColor,\n deckId,\n uiState.private,\n uiState.loadNewest,\n uiState.investigators,\n loadCards)\nend\n\n-- Process the slot list, which defines the card Ids and counts of cards to load. Spawn those cards\n-- at the appropriate zones and report an error to the user if any could not be loaded.\n-- This is a callback function which handles the results of ArkhamDb.getDecklist()\n-- This method uses an encapsulated coroutine with yields to make the card spawning cleaner.\n--\n---@param slots Table Key-Value table of cardId:count. cardId is the ArkhamDB ID of the card to spawn,\n-- and count is the number which should be spawned\n---@param investigatorId String ArkhamDB ID (code) for this deck's investigator.\n-- Investigator cards should already be added to the slots list if they\n-- should be spawned, but this value is separate to check for special\n-- handling for certain investigators\n---@param bondedList Table A table of cardID keys to meaningless values. Card IDs in this list were added\n-- from a parent bonded card.\n---@param customizations String ArkhamDB data for customizations on customizable cards\n---@param playerColor String Color name of the player mat to place this deck on (e.g. \"Red\")\n---@param loadAltInvestigator String Contains the name of alternative art for the investigator (\"normal\", \"revised\" or \"promo\")\nfunction loadCards(slots, investigatorId, bondedList, customizations, playerColor, loadAltInvestigator)\n function coinside()\n local yPos = {}\n local cardsToSpawn = {}\n for cardId, cardCount in pairs(slots) do\n local card = allCardsBagApi.getCardById(cardId)\n if card ~= nil then\n local cardZone = getDefaultCardZone(card.metadata, bondedList)\n for i = 1, cardCount do\n table.insert(cardsToSpawn, { data = card.data, metadata = card.metadata, zone = cardZone })\n end\n\n slots[cardId] = 0\n end\n end\n\n handleAncestralKnowledge(cardsToSpawn)\n handleUnderworldMarket(cardsToSpawn, playerColor)\n handleHunchDeck(investigatorId, cardsToSpawn, playerColor)\n handleSpiritDeck(investigatorId, cardsToSpawn, playerColor)\n handleCustomizableUpgrades(cardsToSpawn, customizations)\n handlePeteSignatureAssets(investigatorId, cardsToSpawn)\n\n -- Split the card list into separate lists for each zone\n local zoneDecks = buildZoneLists(cardsToSpawn)\n -- Spawn the list for each zone\n for zone, zoneCards in pairs(zoneDecks) do\n local deckPos = zones.getZonePosition(playerColor, zone)\n deckPos.y = 3\n\n local callback = nil\n -- If cards are spread too close together TTS groups them weirdly, selecting multiples\n -- when hovering over a single card. This distance is the minimum to avoid that\n local spreadDistance = 1.15\n if (zone == \"SetAside4\") then\n -- SetAside4 is reserved for customization cards, and we want them spread on the table\n -- so their checkboxes are visible\n -- TO-DO: take into account that spreading will make multiple rows\n -- (this is affected by the user's local settings!)\n if (playerColor == \"White\") then\n deckPos.z = deckPos.z + (#zoneCards - 1) * spreadDistance\n elseif (playerColor == \"Green\") then\n deckPos.x = deckPos.x + (#zoneCards - 1) * spreadDistance\n end\n callback = function(deck) deck.spread(spreadDistance) end\n elseif zone == \"Deck\" then\n callback = function(deck) deckSpawned(deck, playerColor) end\n elseif zone == \"Investigator\" or zone == \"Minicard\" then\n callback = function(card) loadAltArt(card, loadAltInvestigator) end\n end\n Spawner.spawnCards(\n zoneCards,\n deckPos,\n zones.getDefaultCardRotation(playerColor, zone),\n true, -- Sort deck\n callback)\n\n coroutine.yield(0)\n end\n\n -- Look for any cards which haven't been loaded\n local hadError = false\n for cardId, remainingCount in pairs(slots) do\n if remainingCount \u003e 0 then\n hadError = true\n arkhamDb.logCardNotFound(cardId, playerColor)\n end\n end\n if (not hadError) then\n printToAll(\"Deck loaded successfully!\", playerColor)\n end\n return 1\n end\n\n startLuaCoroutine(self, \"coinside\")\nend\n\n-- Callback handler for the main deck spawning. Looks for cards which should start in hand, and\n-- draws them for the appropriate player.\n---@param deck Object Callback-provided spawned deck object\n---@param playerColor String Color of the player to draw the cards to\nfunction deckSpawned(deck, playerColor)\n local player = Player[playmatApi.getPlayerColor(playerColor)]\n local handPos = player.getHandTransform(1).position -- Only one hand zone per player\n local deckCards = deck.getData().ContainedObjects\n -- Process in reverse order so taking cards out doesn't upset the indexing\n for i = #deckCards, 1, -1 do\n local cardMetadata = JSON.decode(deckCards[i].GMNotes) or { }\n if cardMetadata.startsInHand then\n deck.takeObject({ index = i - 1, position = handPos, flip = true, smooth = true})\n end\n end\nend\n\n-- Converts the Raven Quill's selections from card IDs to card names. This could be more elegant\n-- but the inputs are very static so we're using some brute force.\n---@param selectionString String provided by ArkhamDB, indicates the customization selections\n-- Should be either a single card ID or two separated by a ^ (e.g. XXXXX^YYYYY)\nfunction convertRavenQuillSelections(selectionString)\n if (string.len(selectionString) == 5) then\n return getCardName(selectionString)\n elseif (string.len(selectionString) == 11) then\n return getCardName(string.sub(selectionString, 1, 5)) .. \", \" .. getCardName(string.sub(selectionString, 7))\n end\nend\n\n-- Converts Grizzled's selections from a single string with \"^\".\n---@param selectionString String provided by ArkhamDB, indicates the customization selections\n-- Should be two Traits separated by a ^ (e.g. XXXXX^YYYYY)\nfunction convertGrizzledSelections(selectionString)\n return selectionString:gsub(\"%^\", \", \")\nend\n\n-- Returns the simple name of a card given its ID. This will find the card and strip any trailing\n-- SCED-specific suffixes such as (Taboo) or (Level)\nfunction getCardName(cardId)\n local card = allCardsBagApi.getCardById(cardId)\n if (card ~= nil) then\n local name = card.data.Nickname\n if (string.find(name, \" %(\")) then\n return string.sub(name, 1, string.find(name, \" %(\") - 1)\n else\n return name\n end\n end\nend\n\n-- Split a single list of cards into a separate table of lists, keyed by the zone\n---@param cards: Table of {cardData, cardMetadata, zone}\n---@return: Table of {zoneName=card list}\nfunction buildZoneLists(cards)\n local zoneList = {}\n for _, card in ipairs(cards) do\n if zoneList[card.zone] == nil then\n zoneList[card.zone] = {}\n end\n table.insert(zoneList[card.zone], card)\n end\n\n return zoneList\nend\n\n-- Check to see if the deck list has Ancestral Knowledge. If it does, move 5 random skills to SetAside3\n---@param cardList Table Deck list being created\nfunction handleAncestralKnowledge(cardList)\n local hasAncestralKnowledge = false\n local skillList = {}\n -- Have to process the entire list to check for Ancestral Knowledge and get all possible skills, so do both in one pass\n for i, card in ipairs(cardList) do\n if card.metadata.id == \"07303\" then\n hasAncestralKnowledge = true\n card.zone = \"SetAside3\"\n elseif (card.metadata.type == \"Skill\"\n and card.zone == \"Deck\"\n and not card.metadata.weakness) then\n table.insert(skillList, i)\n end\n end\n if hasAncestralKnowledge then\n for i = 1, 5 do\n -- Move 5 random skills to SetAside3\n local skillListIndex = math.random(#skillList)\n cardList[skillList[skillListIndex]].zone = \"UnderSetAside3\"\n table.remove(skillList, skillListIndex)\n end\n end\nend\n\n-- Check for and handle Underworld Market by moving all Illicit cards to UnderSetAside3\n---@param cardList Table Deck list being created\n---@param playerColor String Color this deck is being loaded for\nfunction handleUnderworldMarket(cardList, playerColor)\n local hasMarket = false\n local illicitList = {}\n -- Process the entire list to check for Underworld Market and get all possible skills, doing both in one pass\n for i, card in ipairs(cardList) do\n if card.metadata.id == \"09077\" then\n -- Underworld Market found\n hasMarket = true\n card.zone = \"SetAside3\"\n elseif card.metadata.traits ~= nil and string.find(card.metadata.traits, \"Illicit\", 1, true) and card.zone == \"Deck\" then\n table.insert(illicitList, i)\n end\n end\n\n if hasMarket then\n if #illicitList \u003c 10 then\n printToAll(\"Only \" .. #illicitList ..\n \" Illicit cards in your deck, you can't trigger Underworld Market's ability.\",\n playerColor)\n else\n -- Process cards to move them to the market deck. This is done in reverse\n -- order because the sorting needs to be reversed (deck sorts for face down)\n -- Performance here may be an issue, as table.remove() is an O(n) operation\n -- which makes the full shift O(n^2). But keep it simple unless it becomes\n -- a problem\n for i = #illicitList, 1, -1 do\n local moving = cardList[illicitList[i]]\n moving.zone = \"UnderSetAside3\"\n table.remove(cardList, illicitList[i])\n table.insert(cardList, moving)\n end\n\n if #illicitList \u003e 10 then\n printToAll(\"Moved all \" .. #illicitList ..\n \" Illicit cards to the Market deck, reduce it to 10\",\n playerColor)\n else\n printToAll(\"Built the Market deck\", playerColor)\n end\n end\n end\nend\n\n-- If the investigator is Joe Diamond, extract all Insight events to SetAside5 to build the Hunch\n-- Deck.\n---@param investigatorId String ID for the deck's investigator card. Passed separately because the\n--- investigator may not be included in the cardList\n---@param cardList Table Deck list being created\n---@param playerColor String Color this deck is being loaded for\nfunction handleHunchDeck(investigatorId, cardList, playerColor)\n if investigatorId == \"05002\" then -- Joe Diamond\n local insightList = {}\n for i, card in ipairs(cardList) do\n if (card.metadata.type == \"Event\"\n and card.metadata.traits ~= nil\n and string.match(card.metadata.traits, \"Insight\")\n and card.metadata.bonded_to == nil) then\n table.insert(insightList, i)\n end\n end\n -- Process insights to move them to the hunch deck. This is done in reverse\n -- order because the sorting needs to be reversed (deck sorts for face down)\n -- Performance here may be an issue, as table.remove() is an O(n) operation\n -- which makes the full shift O(n^2). But keep it simple unless it becomes\n -- a problem\n for i = #insightList, 1, -1 do\n local moving = cardList[insightList[i]]\n moving.zone = \"SetAside5\"\n table.remove(cardList, insightList[i])\n table.insert(cardList, moving)\n end\n if #insightList \u003c 11 then\n printToAll(\"Joe's hunch deck must have 11 cards but the deck only has \" .. #insightList ..\n \" Insight events.\", playerColor)\n elseif #insightList \u003e 11 then\n printToAll(\"Moved all \" .. #insightList ..\n \" Insight events to the hunch deck, reduce it to 11.\", playerColor)\n else\n printToAll(\"Built Joe's hunch deck\", playerColor)\n end\n end\nend\n\n-- If the investigator is Parallel Jim Culver, extract all Ally assets to SetAside5 to build the Spirit\n-- Deck.\n---@param investigatorId String ID for the deck's investigator card. Passed separately because the\n--- investigator may not be included in the cardList\n---@param cardList Table Deck list being created\n---@param playerColor String Color this deck is being loaded for\nfunction handleSpiritDeck(investigatorId, cardList, playerColor)\n if investigatorId == \"02004-p\" or investigatorId == \"02004-pb\" then -- Parallel Jim Culver\n local spiritList = {}\n for i, card in ipairs(cardList) do\n if card.metadata.id == \"90053\" or (\n card.metadata.type == \"Asset\"\n and card.metadata.traits ~= nil\n and string.match(card.metadata.traits, \"Ally\")\n and card.metadata.level ~= nil\n and card.metadata.level \u003c 3) then\n table.insert(spiritList, i)\n end\n end\n -- Process allies to move them to the spirit deck. This is done in reverse\n -- order because the sorting needs to be reversed (deck sorts for face down)\n -- Performance here may be an issue, as table.remove() is an O(n) operation\n -- which makes the full shift O(n^2). But keep it simple unless it becomes\n -- a problem\n for i = #spiritList, 1, -1 do\n local moving = cardList[spiritList[i]]\n moving.zone = \"SetAside5\"\n table.remove(cardList, spiritList[i])\n table.insert(cardList, moving)\n end\n if #spiritList \u003c 10 then\n printToAll(\"Jim's spirit deck must have 9 Ally assets but the deck only has \" .. (#spiritList - 1) ..\n \" Ally assets.\", playerColor)\n elseif #spiritList \u003e 11 then\n printToAll(\"Moved all \" .. (#spiritList - 1) ..\n \" Ally assets to the spirit deck, reduce it to 10 (including Vengeful Shade).\", playerColor)\n else\n printToAll(\"Built Jim's spirit deck\", playerColor)\n end\n end\nend\n\n-- For any customization upgrade cards in the card list, process the metadata from the deck to\n-- set the save state to show the correct checkboxes/text field values\n---@param cardList Table Deck list being created\n---@param customizations Table Deck's meta table, extracted from ArkhamDB's deck structure\nfunction handleCustomizableUpgrades(cardList, customizations)\n for _, card in ipairs(cardList) do\n if card.metadata.type == \"UpgradeSheet\" then\n local baseId = string.sub(card.metadata.id, 1, 5)\n local upgrades = customizations[\"cus_\" .. baseId]\n\n if upgrades ~= nil then\n -- initialize tables\n -- markedBoxes: contains the amount of markedBoxes (left to right) per row (starting at row 1)\n -- inputValues: contains the amount of inputValues per row (starting at row 0)\n local selectedUpgrades = { }\n local index_xp = {}\n\n -- get the index and xp values (looks like this: X|X,X|X, ..)\n -- input string from ArkhamDB is split by \",\"\n for str in string.gmatch(customizations[\"cus_\" .. baseId], \"([^,]+)\") do\n table.insert(index_xp, str)\n end\n\n -- split each pair and assign it to the proper position in markedBoxes\n for _, entry in ipairs(index_xp) do\n -- counter increments from 1 to 3 and indicates the part of the string we are on\n -- usually: 1 = row, 2 = amount of check boxes, 3 = entry in inputfield\n local counter = 0\n local row = 0\n\n -- parsing the string for each row\n for str in entry:gmatch(\"([^|]+)\") do\n counter = counter + 1\n\n if counter == 1 then\n row = tonumber(str) + 1\n elseif counter == 2 then\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n end\n selectedUpgrades[row].xp = tonumber(str)\n elseif counter == 3 and str ~= \"\" then\n if baseId == \"09042\" then\n selectedUpgrades[row].text = convertRavenQuillSelections(str)\n elseif baseId == \"09101\" then\n selectedUpgrades[row].text = convertGrizzledSelections(str)\n elseif baseId == \"09079\" then -- Living Ink skill selection\n -- All skills, regardless of row, are placed in upgrade slot 1 as a comma-delimited\n -- list\n if selectedUpgrades[1].text == nil then\n selectedUpgrades[1].text = str\n else\n selectedUpgrades[1].text = selectedUpgrades[1].text .. \",\" .. str\n end\n else\n selectedUpgrades[row].text = str\n end\n end\n end\n end\n\n -- write the loaded values to the save_data of the sheets\n card.data[\"LuaScriptState\"] = JSON.encode({ selections = selectedUpgrades })\n end\n end\n end\nend\n\n-- Handles cards that start in play under specific conditions for Ashcan Pete (Regular Pete - Duke, Parallel Pete - Guitar)\n---@param investigatorId String ID for the deck's investigator card. Passed separately because the\n--- investigator may not be included in the cardList\n---@param cardList Table Deck list being created\nfunction handlePeteSignatureAssets(investigatorId, cardList)\n if investigatorId == \"02005\" or investigatorId == \"02005-pb\" then -- regular Pete's front\n for i, card in ipairs(cardList) do\n if card.metadata.id == \"02014\" then -- Duke\n card.zone = \"BlankTop\"\n end\n end\n elseif investigatorId == \"02005-p\" or investigatorId == \"02005-pf\" then -- parallel Pete's front\n for i, card in ipairs(cardList) do\n if card.metadata.id == \"90047\" then -- Pete's Guitar\n card.zone = \"BlankTop\"\n end\n end\n end\nend\n\n-- Callback function for investigator cards and minicards to set the correct state for alt art\n---@param card Object Card which needs to be set the state for\n---@param loadAltInvestigator String Contains the name of alternative art for the investigator (\"normal\", \"revised\" or \"promo\")\nfunction loadAltArt(card, loadAltInvestigator)\n -- states are set up this way:\n -- 1 - normal, 2 - revised/promo, 3 - promo (if 2 is revised)\n -- This means we can always load the 2nd state for revised and just get the last state for promo\n if loadAltInvestigator == \"normal\" then\n return\n elseif loadAltInvestigator == \"revised\" then\n card.setState(2)\n elseif loadAltInvestigator == \"promo\" then\n local states = card.getStates()\n card.setState(#states)\n end\nend\nend)\n__bundle_register(\"arkhamdb/DeckImporterUi\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal allCardsBagApi = require(\"playercards/AllCardsBagApi\")\n\nlocal INPUT_FIELD_HEIGHT = 340\nlocal INPUT_FIELD_WIDTH = 1500\nlocal FIELD_COLOR = { 0.9, 0.7, 0.5 }\n\nlocal PRIVATE_TOGGLE_LABELS = {}\nPRIVATE_TOGGLE_LABELS[true] = \"Private\"\nPRIVATE_TOGGLE_LABELS[false] = \"Published\"\n\nlocal UPGRADED_TOGGLE_LABELS = {}\nUPGRADED_TOGGLE_LABELS[true] = \"Upgraded\"\nUPGRADED_TOGGLE_LABELS[false] = \"Specific\"\n\nlocal LOAD_INVESTIGATOR_TOGGLE_LABELS = {}\nLOAD_INVESTIGATOR_TOGGLE_LABELS[true] = \"Yes\"\nLOAD_INVESTIGATOR_TOGGLE_LABELS[false] = \"No\"\n\nlocal redDeckId = \"\"\nlocal orangeDeckId = \"\"\nlocal whiteDeckId = \"\"\nlocal greenDeckId = \"\"\n\nlocal privateDeck = true\nlocal loadNewestDeck = true\nlocal loadInvestigators = false\n\n-- Returns a table with the full state of the UI, including options and deck IDs.\n-- This can be used to persist via onSave(), or provide values for a load operation\n-- Table values:\n-- redDeck: Deck ID to load for the red player\n-- orangeDeck: Deck ID to load for the orange player\n-- whiteDeck: Deck ID to load for the white player\n-- greenDeck: Deck ID to load for the green player\n-- private: True to load a private deck, false to load a public deck\n-- loadNewest: True if the most upgraded version of the deck should be loaded\n-- investigators: True if investigator cards should be spawned\nfunction getUiState()\n return {\n redDeck = redDeckId,\n orangeDeck = orangeDeckId,\n whiteDeck = whiteDeckId,\n greenDeck = greenDeckId,\n private = privateDeck,\n loadNewest = loadNewestDeck,\n investigators = loadInvestigators\n }\nend\n\n-- Updates the state of the UI based on the provided table. Any values not provided will be left the same.\n---@param uiStateTable Table of values to update on importer\n-- Table values:\n-- redDeck: Deck ID to load for the red player\n-- orangeDeck: Deck ID to load for the orange player\n-- whiteDeck: Deck ID to load for the white player\n-- greenDeck: Deck ID to load for the green player\n-- private: True to load a private deck, false to load a public deck\n-- loadNewest: True if the most upgraded version of the deck should be loaded\n-- investigators: True if investigator cards should be spawned\nfunction setUiState(uiStateTable)\n self.clearButtons()\n self.clearInputs()\n initializeUi(uiStateTable)\nend\n\n-- Sets up the UI for the deck loader, populating fields from the given save state table decoded from onLoad()\nfunction initializeUi(savedUiState)\n if savedUiState ~= nil then\n redDeckId = savedUiState.redDeck\n orangeDeckId = savedUiState.orangeDeck\n whiteDeckId = savedUiState.whiteDeck\n greenDeckId = savedUiState.greenDeck\n privateDeck = savedUiState.private\n loadNewestDeck = savedUiState.loadNewest\n loadInvestigators = savedUiState.investigators\n end\n\n makeOptionToggles()\n makeDeckIdFields()\n makeBuildButton()\nend\n\nfunction makeOptionToggles()\n -- common parameters\n local checkbox_parameters = {}\n checkbox_parameters.function_owner = self\n checkbox_parameters.width = INPUT_FIELD_WIDTH\n checkbox_parameters.height = INPUT_FIELD_HEIGHT\n checkbox_parameters.scale = { 0.1, 0.1, 0.1 }\n checkbox_parameters.font_size = 240\n checkbox_parameters.hover_color = { 0.4, 0.6, 0.8 }\n checkbox_parameters.color = FIELD_COLOR\n\n -- public / private deck\n checkbox_parameters.click_function = \"publicPrivateChanged\"\n checkbox_parameters.position = { 0.25, 0.1, -0.102 }\n checkbox_parameters.tooltip = \"Published or private deck?\\n\\nPLEASE USE A PRIVATE DECK IF JUST FOR TTS TO AVOID FLOODING ARKHAMDB PUBLISHED DECK LISTS!\"\n checkbox_parameters.label = PRIVATE_TOGGLE_LABELS[privateDeck]\n self.createButton(checkbox_parameters)\n\n -- load upgraded?\n checkbox_parameters.click_function = \"loadUpgradedChanged\"\n checkbox_parameters.position = { 0.25, 0.1, -0.01 }\n checkbox_parameters.tooltip = \"Load newest upgrade or exact deck?\"\n checkbox_parameters.label = UPGRADED_TOGGLE_LABELS[loadNewestDeck]\n self.createButton(checkbox_parameters)\n\n -- load investigators?\n checkbox_parameters.click_function = \"loadInvestigatorsChanged\"\n checkbox_parameters.position = { 0.25, 0.1, 0.081 }\n checkbox_parameters.tooltip = \"Spawn investigator cards?\"\n checkbox_parameters.label = LOAD_INVESTIGATOR_TOGGLE_LABELS[loadInvestigators]\n self.createButton(checkbox_parameters)\nend\n\n-- Create the four deck ID entry fields\nfunction makeDeckIdFields()\n local input_parameters = {}\n -- Parameters common to all entry fields\n input_parameters.function_owner = self\n input_parameters.scale = { 0.1, 0.1, 0.1 }\n input_parameters.width = INPUT_FIELD_WIDTH\n input_parameters.height = INPUT_FIELD_HEIGHT\n input_parameters.font_size = 320\n input_parameters.tooltip = \"Deck ID from ArkhamDB URL of the deck\\nPublic URL: 'https://arkhamdb.com/decklist/view/101/knowledge-overwhelming-solo-deck-1.0' = '101'\\nPrivate URL: 'https://arkhamdb.com/deck/view/102' = '102'\"\n input_parameters.alignment = 3 -- Center\n input_parameters.color = FIELD_COLOR\n input_parameters.font_color = { 0, 0, 0 }\n input_parameters.validation = 2 -- Integer\n\n -- Green\n input_parameters.input_function = \"greenDeckChanged\"\n input_parameters.position = { -0.166, 0.1, 0.385 }\n input_parameters.value = greenDeckId\n self.createInput(input_parameters)\n -- Red\n input_parameters.input_function = \"redDeckChanged\"\n input_parameters.position = { 0.171, 0.1, 0.385 }\n input_parameters.value = redDeckId\n self.createInput(input_parameters)\n -- White\n input_parameters.input_function = \"whiteDeckChanged\"\n input_parameters.position = { -0.166, 0.1, 0.474 }\n input_parameters.value = whiteDeckId\n self.createInput(input_parameters)\n -- Orange\n input_parameters.input_function = \"orangeDeckChanged\"\n input_parameters.position = { 0.171, 0.1, 0.474 }\n input_parameters.value = orangeDeckId\n self.createInput(input_parameters)\nend\n\n-- Create the Build All button. This is a transparent button which covers the Build All portion of the background graphic\nfunction makeBuildButton()\n local button_parameters = {}\n button_parameters.click_function = \"loadDecks\"\n button_parameters.function_owner = self\n button_parameters.position = { 0, 0.1, 0.71 }\n button_parameters.width = 320\n button_parameters.height = 30\n button_parameters.color = { 0, 0, 0, 0 }\n button_parameters.tooltip = \"Click to build all four decks!\"\n self.createButton(button_parameters)\nend\n\n-- Event handlers for deck ID change\nfunction redDeckChanged(_, _, inputValue) redDeckId = inputValue end\n\nfunction orangeDeckChanged(_, _, inputValue) orangeDeckId = inputValue end\n\nfunction whiteDeckChanged(_, _, inputValue) whiteDeckId = inputValue end\n\nfunction greenDeckChanged(_, _, inputValue) greenDeckId = inputValue end\n\n-- Event handlers for toggle buttons\nfunction publicPrivateChanged()\n privateDeck = not privateDeck\n self.editButton { index = 0, label = PRIVATE_TOGGLE_LABELS[privateDeck] }\nend\n\nfunction loadUpgradedChanged()\n loadNewestDeck = not loadNewestDeck\n self.editButton { index = 1, label = UPGRADED_TOGGLE_LABELS[loadNewestDeck] }\nend\n\nfunction loadInvestigatorsChanged()\n loadInvestigators = not loadInvestigators\n self.editButton { index = 2, label = LOAD_INVESTIGATOR_TOGGLE_LABELS[loadInvestigators] }\nend\n\nfunction loadDecks()\n -- testLoadLotsOfDecks()\n -- Method in DeckImporterMain, visible due to inclusion\n\n local indexReady = allCardsBagApi.isIndexReady()\n if (not indexReady) then\n broadcastToAll(\"Still loading player cards, please try again in a few seconds\", {0.9, 0.2, 0.2})\n return\n end\n if (redDeckId ~= nil and redDeckId ~= \"\") then\n buildDeck(\"Red\", redDeckId)\n end\n if (orangeDeckId ~= nil and orangeDeckId ~= \"\") then\n buildDeck(\"Orange\", orangeDeckId)\n end\n if (whiteDeckId ~= nil and whiteDeckId ~= \"\") then\n buildDeck(\"White\", whiteDeckId)\n end\n if (greenDeckId ~= nil and greenDeckId ~= \"\") then\n buildDeck(\"Green\", greenDeckId)\n end\nend\nend)\n__bundle_register(\"playercards/AllCardsBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local AllCardsBagApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getAllCardsBag()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"AllCardsBag\")\n end\n\n -- Returns a specific card from the bag, based on ArkhamDB ID\n ---@param id table String ID of the card to retrieve\n ---@return table table\n -- If the indexes are still being constructed, an empty table is\n -- returned. Otherwise, a single table with the following fields\n -- cardData: TTS object data, suitable for spawning the card\n -- cardMetadata: Table of parsed metadata\n AllCardsBagApi.getCardById = function(id)\n return getAllCardsBag().call(\"getCardById\", {id = id})\n end\n\n -- Gets a random basic weakness from the bag. Once a given ID has been returned\n -- it will be removed from the list and cannot be selected again until a reload\n -- occurs or the indexes are rebuilt, which will refresh the list to include all\n -- weaknesses.\n ---@return id String ID of the selected weakness.\n AllCardsBagApi.getRandomWeaknessId = function()\n return getAllCardsBag().call(\"getRandomWeaknessId\")\n end\n\n AllCardsBagApi.isIndexReady = function()\n return getAllCardsBag().call(\"isIndexReady\")\n end\n\n -- Called by Hotfix bags when they load. If we are still loading indexes, then\n -- the all cards and hotfix bags are being loaded together, and we can ignore\n -- this call as the hotfix will be included in the initial indexing. If it is\n -- called once indexing is complete it means the hotfix bag has been added\n -- later, and we should rebuild the index to integrate the hotfix bag.\n AllCardsBagApi.rebuildIndexForHotfix = function()\n return getAllCardsBag().call(\"rebuildIndexForHotfix\")\n end\n\n -- Searches the bag for cards which match the given name and returns a list. Note that this is\n -- an O(n) search without index support. It may be slow.\n ---@param name String or string fragment to search for names\n ---@param exact Boolean Whether the name match should be exact\n AllCardsBagApi.getCardsByName = function(name, exact)\n return getAllCardsBag().call(\"getCardsByName\", {name = name, exact = exact})\n end\n\n AllCardsBagApi.isBagPresent = function()\n return getAllCardsBag() and true\n end\n\n -- Returns a list of cards from the bag matching a class and level (0 or upgraded)\n ---@param class String class to retrieve (\"Guardian\", \"Seeker\", etc)\n ---@param upgraded Boolean true for upgraded cards (Level 1-5), false for Level 0\n ---@return: If the indexes are still being constructed, returns an empty table.\n -- Otherwise, a list of tables, each with the following fields\n -- cardData: TTS object data, suitable for spawning the card\n -- cardMetadata: Table of parsed metadata\n AllCardsBagApi.getCardsByClassAndLevel = function(class, upgraded)\n return getAllCardsBag().call(\"getCardsByClassAndLevel\", {class = class, upgraded = upgraded})\n end\n\n AllCardsBagApi.getCardsByCycle = function(cycle)\n return getAllCardsBag().call(\"getCardsByCycle\", cycle)\n end\n\n AllCardsBagApi.getUniqueWeaknesses = function()\n return getAllCardsBag().call(\"getUniqueWeaknesses\")\n end\n\n return AllCardsBagApi\nend\nend)\n__bundle_register(\"playercards/PlayerCardSpawner\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Amount to shift for the next card (zShift) or next row of cards (xShift)\n-- Note that the table rotation is weird, and the X axis is vertical while the\n-- Z axis is horizontal\nlocal SPREAD_Z_SHIFT = -2.3\nlocal SPREAD_X_SHIFT = -3.66\n\nSpawner = { }\n\n-- Spawns a list of cards at the given position/rotation. This will separate cards by size -\n-- investigator, standard, and mini, spawning them in that order with larger cards on bottom. If\n-- there are different types, the provided callback will be called once for each type as it spawns\n-- either a card or deck.\n-- @param cardList: A list of Player Card data structures (data/metadata)\n-- @param pos Position table where the cards should be spawned (global)\n-- @param rot Rotation table for the orientation of the spawned cards (global)\n-- @param sort Boolean, true if this list of cards should be sorted before spawning\n-- @param callback Function, callback to be called after the card/deck spawns.\nSpawner.spawnCards = function(cardList, pos, rot, sort, callback)\n if (sort) then\n table.sort(cardList, Spawner.cardComparator)\n end\n\n local miniCards = { }\n local standardCards = { }\n local investigatorCards = { }\n\n for _, card in ipairs(cardList) do\n if (card.metadata.type == \"Investigator\") then\n table.insert(investigatorCards, card)\n elseif (card.metadata.type == \"Minicard\") then\n table.insert(miniCards, card)\n else\n table.insert(standardCards, card)\n end\n end\n -- Spawn each of the three types individually. Each Y position shift accounts for the thickness\n -- of the spawned deck\n local position = { x = pos.x, y = pos.y, z = pos.z }\n Spawner.spawn(investigatorCards, position, { rot.x, rot.y - 90, rot.z }, callback)\n\n position.y = position.y + (#investigatorCards + #standardCards) * 0.07\n Spawner.spawn(standardCards, position, rot, callback)\n\n position.y = position.y + (#standardCards + #miniCards) * 0.07\n Spawner.spawn(miniCards, position, rot, callback)\nend\n\nSpawner.spawnCardSpread = function(cardList, startPos, maxCols, rot, sort, callback)\n if (sort) then\n table.sort(cardList, Spawner.cardComparator)\n end\n\n local position = { x = startPos.x, y = startPos.y, z = startPos.z }\n -- Special handle the first row if we have less than a full single row, but only if there's a\n -- reasonable max column count. Single-row spreads will send a large value for maxCols\n if maxCols \u003c 100 and #cardList \u003c maxCols then\n position.z = startPos.z + ((maxCols - #cardList) / 2 * SPREAD_Z_SHIFT)\n end\n local cardsInRow = 0\n local rows = 0\n for _, card in ipairs(cardList) do\n Spawner.spawn({ card }, position, rot, callback)\n position.z = position.z + SPREAD_Z_SHIFT\n cardsInRow = cardsInRow + 1\n if cardsInRow \u003e= maxCols then\n rows = rows + 1\n local cardsForRow = #cardList - rows * maxCols\n if cardsForRow \u003e maxCols then\n cardsForRow = maxCols\n end\n position.z = startPos.z + ((maxCols - cardsForRow) / 2 * SPREAD_Z_SHIFT)\n position.x = position.x + SPREAD_X_SHIFT\n cardsInRow = 0\n end\n end\nend\n\n-- Spawn a specific list of cards. This method is for internal use and should not be called\n-- directly, use spawnCards instead.\n---@param cardList: A list of Player Card data structures (data/metadata)\n---@param pos table Position where the cards should be spawned (global)\n---@param rot table Rotation for the orientation of the spawned cards (global)\n---@param callback function callback to be called after the card/deck spawns.\nSpawner.spawn = function(cardList, pos, rot, callback)\n if (#cardList == 0) then\n return\n end\n -- Spawn a single card directly\n if (#cardList == 1) then\n spawnObjectData({\n data = cardList[1].data,\n position = pos,\n rotation = rot,\n callback_function = callback,\n })\n return\n end\n -- For multiple cards, construct a deck and spawn that\n local deck = Spawner.buildDeckDataTemplate()\n -- Decks won't inherently scale to the cards in them. The card list being spawned should be all\n -- the same type/size by this point, so use the first card to set the size\n deck.Transform = {\n scaleX = cardList[1].data.Transform.scaleX,\n scaleY = 1,\n scaleZ = cardList[1].data.Transform.scaleZ,\n }\n local sidewaysDeck = true\n for _, spawnCard in ipairs(cardList) do\n Spawner.addCardToDeck(deck, spawnCard.data)\n -- set sidewaysDeck to false if any card is not a sideways card\n sidewaysDeck = (sidewaysDeck and spawnCard.data.SidewaysCard)\n end\n -- set the alt view angle for sideway decks\n if sidewaysDeck then\n deck.AltLookAngle = { x = 0, y = 180, z = 90 }\n end\n spawnObjectData({\n data = deck,\n position = pos,\n rotation = rot,\n callback_function = callback,\n })\nend\n\n-- Inserts a card into the given deck. This does three things:\n-- 1. Add the card's data to ContainedObjects\n-- 2. Add the card's ID (the TTS CardID, not the Arkham ID) to the deck's\n-- ID list. Note that the deck's ID list is \"DeckIDs\" even though it\n-- contains a list of card Ids\n-- 3. Extract the card's CustomDeck table and add it to the deck. The deck's\n-- \"CustomDeck\" field is a list of all CustomDecks used by cards within the\n-- deck, keyed by the DeckID and referencing the custom deck table\n---@param deck: TTS deck data structure to add to\n---@param card: Data for the card to be inserted\nSpawner.addCardToDeck = function(deck, cardData)\n for customDeckId, customDeckData in pairs(cardData.CustomDeck) do\n if (deck.CustomDeck[customDeckId] == nil) then\n -- CustomDeck not added to deck yet, add it\n deck.CustomDeck[customDeckId] = customDeckData\n elseif (deck.CustomDeck[customDeckId].FaceURL == customDeckData.FaceURL) then\n -- CustomDeck for this card matches the current one for the deck, do nothing\n else\n -- CustomDeck data conflict\n local newDeckId = nil\n for deckId, customDeck in pairs(deck.CustomDeck) do\n if (customDeckData.FaceURL == customDeck.FaceURL) then\n newDeckId = deckId\n end\n end\n if (newDeckId == nil) then\n -- No non-conflicting custom deck for this card, add a new one\n newDeckId = Spawner.findNextAvailableId(deck.CustomDeck, \"1000\")\n deck.CustomDeck[newDeckId] = customDeckData\n end\n -- Update the card with the new CustomDeck info\n cardData.CardID = newDeckId..string.sub(cardData.CardID, 5)\n cardData.CustomDeck[customDeckId] = nil\n cardData.CustomDeck[newDeckId] = customDeckData\n break\n end\n end\n table.insert(deck.ContainedObjects, cardData)\n table.insert(deck.DeckIDs, cardData.CardID)\nend\n\n-- Create an empty deck data table which can have cards added to it. This\n-- creates a new table on each call without using metatables or previous\n-- definitions because we can't be sure that TTS doesn't modify the structure\n---@return: Table containing the minimal TTS deck data structure\nSpawner.buildDeckDataTemplate = function()\n local deck = {}\n deck.Name = \"Deck\"\n\n -- Card data. DeckIDs and CustomDeck entries will be built from the cards\n deck.ContainedObjects = {}\n deck.DeckIDs = {}\n deck.CustomDeck = {}\n\n -- Transform is required, Position and Rotation will be overridden by the spawn call so can be omitted here\n deck.Transform = {\n scaleX = 1,\n scaleY = 1,\n scaleZ = 1,\n }\n\n return deck\nend\n\n-- Returns the first ID which does not exist in the given table, starting at startId and increasing\n-- @param objectTable Table keyed by strings which are numbers\n-- @param startId First possible ID.\n-- @return String ID \u003e= startId\nSpawner.findNextAvailableId = function(objectTable, startId)\n local id = startId\n while (objectTable[id] ~= nil) do\n id = tostring(tonumber(id) + 1)\n end\n\n return id\nend\n\n-- Get the PBCN (Permanent/Bonded/Customizable/Normal) value from the given metadata.\n---@return: 1 for Permanent, 2 for Bonded or 4 for Normal. The actual values are\n-- irrelevant as they provide only grouping and the order between them doesn't matter.\nSpawner.getpbcn = function(metadata)\n if metadata.permanent then\n return 1\n elseif metadata.bonded_to ~= nil then\n return 2\n else -- Normal card\n return 3\n end\nend\n\n-- Comparison function used to sort the cards in a deck. Groups bonded or\n-- permanent cards first, then sorts within theose types by name/subname.\n-- Normal cards will sort in standard alphabetical order, while\n-- permanent/bonded/customizable will be in reverse alphabetical order.\n--\n-- Since cards spawn in the order provided by this comparator, with the first\n-- cards ending up at the bottom of a pile, this ordering will spawn in reverse\n-- alphabetical order. This presents the cards in order for non-face-down\n-- areas, and presents them in order when Searching the face-down deck.\nSpawner.cardComparator = function(card1, card2)\n local pbcn1 = Spawner.getpbcn(card1.metadata)\n local pbcn2 = Spawner.getpbcn(card2.metadata)\n if pbcn1 ~= pbcn2 then\n return pbcn1 \u003e pbcn2\n end\n if pbcn1 == 3 then\n if card1.data.Nickname ~= card2.data.Nickname then\n return card1.data.Nickname \u003c card2.data.Nickname\n end\n return card1.data.Description \u003c card2.data.Description\n else\n if card1.data.Nickname ~= card2.data.Nickname then\n return card1.data.Nickname \u003e card2.data.Nickname\n end\n return card1.data.Description \u003e card2.data.Description\n end\nend\nend)\n__bundle_register(\"playermat/Zones\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Sets up and returns coordinates for all possible spawn zones. Because Lua assigns tables by reference\n-- and there is no built-in function to copy a table this is relatively brute force.\n--\n-- Positions are all relative to the player mat, and most are consistent. The\n-- exception are the SetAside# zones, which are placed to the left of the mat\n-- for White/Green, and the right of the mat for Orange/Red.\n--\n-- Investigator: Investigator card area.\n-- Minicard: Placement for the investigator's minicard, just above the player mat\n-- Deck, Discard: Standard locations for the deck and discard piles.\n-- BlankTop: used for assets that start in play (e.g. Duke)\n-- Tarot, Hand1, Hand2, Ally, BlankBottom, Accessory, Arcane1, Arcane2, Body: Asset slot positions\n-- Threat[1-4]: Threat area slots. Threat[1-3] correspond to the named threat area slots, and Threat4 is the blank threat area slot.\n-- SetAside[1-3]: Column closest to the player mat, with 1 at the top and 3 at the bottom.\n-- SetAside[4-6]: Column farther away from the mat, with 4 at the top and 6 at the bottom.\n-- SetAside1: Permanent cards\n-- SetAside2: Bonded cards\n-- SetAside3: Ancestral Knowledge / Underworld Market\n-- SetAside4: Upgrade sheets for customizable cards\n-- SetAside5: Hunch Deck for Joe Diamond\n-- SetAside6: currently unused\ndo\n local playmatApi = require(\"playermat/PlaymatApi\")\n local Zones = { }\n\n local commonZones = {}\n commonZones[\"Investigator\"] = { -1.177, 0, 0.002 }\n commonZones[\"Deck\"] = { -1.82, 0, 0 }\n commonZones[\"Discard\"] = { -1.82, 0, 0.61 }\n commonZones[\"Ally\"] = { -0.615, 0, 0.024 }\n commonZones[\"Body\"] = { -0.630, 0, 0.553 }\n commonZones[\"Hand1\"] = { 0.215, 0, 0.042 }\n commonZones[\"Hand2\"] = { -0.180, 0, 0.037 }\n commonZones[\"Arcane1\"] = { 0.212, 0, 0.559 }\n commonZones[\"Arcane2\"] = { -0.171, 0, 0.557 }\n commonZones[\"Tarot\"] = { 0.602, 0, 0.033 }\n commonZones[\"Accessory\"] = { 0.602, 0, 0.555 }\n commonZones[\"BlankTop\"] = { 1.758, 0, 0.040 }\n commonZones[\"BlankBottom\"] = { 1.754, 0, 0.563 }\n commonZones[\"Threat1\"] = { -0.911, 0, -0.625 }\n commonZones[\"Threat2\"] = { -0.454, 0, -0.625 }\n commonZones[\"Threat3\"] = { 0.002, 0, -0.625 }\n commonZones[\"Threat4\"] = { 0.459, 0, -0.625 }\n\n local zoneData = {}\n zoneData[\"White\"] = {}\n zoneData[\"White\"][\"Investigator\"] = commonZones[\"Investigator\"]\n zoneData[\"White\"][\"Deck\"] = commonZones[\"Deck\"]\n zoneData[\"White\"][\"Discard\"] = commonZones[\"Discard\"]\n zoneData[\"White\"][\"Ally\"] = commonZones[\"Ally\"]\n zoneData[\"White\"][\"Body\"] = commonZones[\"Body\"]\n zoneData[\"White\"][\"Hand1\"] = commonZones[\"Hand1\"]\n zoneData[\"White\"][\"Hand2\"] = commonZones[\"Hand2\"]\n zoneData[\"White\"][\"Arcane1\"] = commonZones[\"Arcane1\"]\n zoneData[\"White\"][\"Arcane2\"] = commonZones[\"Arcane2\"]\n zoneData[\"White\"][\"Tarot\"] = commonZones[\"Tarot\"]\n zoneData[\"White\"][\"Accessory\"] = commonZones[\"Accessory\"]\n zoneData[\"White\"][\"BlankTop\"] = commonZones[\"BlankTop\"]\n zoneData[\"White\"][\"BlankBottom\"] = commonZones[\"BlankBottom\"]\n zoneData[\"White\"][\"Threat1\"] = commonZones[\"Threat1\"]\n zoneData[\"White\"][\"Threat2\"] = commonZones[\"Threat2\"]\n zoneData[\"White\"][\"Threat3\"] = commonZones[\"Threat3\"]\n zoneData[\"White\"][\"Threat4\"] = commonZones[\"Threat4\"]\n zoneData[\"White\"][\"Minicard\"] = { -1, 0, -1.45 }\n zoneData[\"White\"][\"SetAside1\"] = { 2.35, 0, -0.520 }\n zoneData[\"White\"][\"SetAside2\"] = { 2.35, 0, 0.042 }\n zoneData[\"White\"][\"SetAside3\"] = { 2.35, 0, 0.605 }\n zoneData[\"White\"][\"UnderSetAside3\"] = { 2.50, 0, 0.805 }\n zoneData[\"White\"][\"SetAside4\"] = { 2.78, 0, -0.520 }\n zoneData[\"White\"][\"SetAside5\"] = { 2.78, 0, 0.042 }\n zoneData[\"White\"][\"SetAside6\"] = { 2.78, 0, 0.605 }\n zoneData[\"White\"][\"UnderSetAside6\"] = { 2.93, 0, 0.805 }\n\n zoneData[\"Orange\"] = {}\n zoneData[\"Orange\"][\"Investigator\"] = commonZones[\"Investigator\"]\n zoneData[\"Orange\"][\"Deck\"] = commonZones[\"Deck\"]\n zoneData[\"Orange\"][\"Discard\"] = commonZones[\"Discard\"]\n zoneData[\"Orange\"][\"Ally\"] = commonZones[\"Ally\"]\n zoneData[\"Orange\"][\"Body\"] = commonZones[\"Body\"]\n zoneData[\"Orange\"][\"Hand1\"] = commonZones[\"Hand1\"]\n zoneData[\"Orange\"][\"Hand2\"] = commonZones[\"Hand2\"]\n zoneData[\"Orange\"][\"Arcane1\"] = commonZones[\"Arcane1\"]\n zoneData[\"Orange\"][\"Arcane2\"] = commonZones[\"Arcane2\"]\n zoneData[\"Orange\"][\"Tarot\"] = commonZones[\"Tarot\"]\n zoneData[\"Orange\"][\"Accessory\"] = commonZones[\"Accessory\"]\n zoneData[\"Orange\"][\"BlankTop\"] = commonZones[\"BlankTop\"]\n zoneData[\"Orange\"][\"BlankBottom\"] = commonZones[\"BlankBottom\"]\n zoneData[\"Orange\"][\"Threat1\"] = commonZones[\"Threat1\"]\n zoneData[\"Orange\"][\"Threat2\"] = commonZones[\"Threat2\"]\n zoneData[\"Orange\"][\"Threat3\"] = commonZones[\"Threat3\"]\n zoneData[\"Orange\"][\"Threat4\"] = commonZones[\"Threat4\"]\n zoneData[\"Orange\"][\"Minicard\"] = { 1, 0, -1.45 }\n zoneData[\"Orange\"][\"SetAside1\"] = { -2.35, 0, -0.520 }\n zoneData[\"Orange\"][\"SetAside2\"] = { -2.35, 0, 0.042}\n zoneData[\"Orange\"][\"SetAside3\"] = { -2.35, 0, 0.605 }\n zoneData[\"Orange\"][\"UnderSetAside3\"] = { -2.50, 0, 0.805 }\n zoneData[\"Orange\"][\"SetAside4\"] = { -2.78, 0, -0.520 }\n zoneData[\"Orange\"][\"SetAside5\"] = { -2.78, 0, 0.042 }\n zoneData[\"Orange\"][\"SetAside6\"] = { -2.78, 0, 0.605 }\n zoneData[\"Orange\"][\"UnderSetAside6\"] = { -2.93, 0, 0.805 }\n\n -- Green positions are the same as White and Red the same as Orange\n zoneData[\"Red\"] = zoneData[\"Orange\"]\n zoneData[\"Green\"] = zoneData[\"White\"]\n\n -- Gets the global position for the given zone on the specified player mat.\n ---@param playerColor: Color name of the player mat to get the zone position for (e.g. \"Red\")\n ---@param zoneName: Name of the zone to get the position for. See Zones object documentation for a list of valid zones.\n ---@return: Global position table, or nil if an invalid player color or zone is specified\n Zones.getZonePosition = function(playerColor, zoneName)\n if (playerColor ~= \"Red\"\n and playerColor ~= \"Orange\"\n and playerColor ~= \"White\"\n and playerColor ~= \"Green\") then\n return nil\n end\n return playmatApi.transformLocalPosition(zoneData[playerColor][zoneName], playerColor)\n end\n\n -- Return the global rotation for a card on the given player mat, based on its metadata.\n ---@param playerColor: Color name of the player mat to get the rotation for (e.g. \"Red\")\n ---@param cardMetadata: Table of card metadata. Metadata fields type and permanent are required; all others are optional.\n ---@return: Global rotation vector for the given card. This will include the\n -- Y rotation to orient the card on the given player mat as well as a\n -- Z rotation to place the card face up or face down.\n Zones.getDefaultCardRotation = function(playerColor, zone)\n local cardRotation = playmatApi.returnRotation(playerColor)\n if zone == \"Deck\" then\n cardRotation = cardRotation + Vector(0, 0, 180)\n end\n return cardRotation\n end\n\n return Zones\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"arkhamdb/ArkhamDb\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local allCardsBagApi = require(\"playercards/AllCardsBagApi\")\n local playAreaApi = require(\"core/PlayAreaApi\")\n \n local ArkhamDb = { }\n local internal = { }\n\n local RANDOM_WEAKNESS_ID = \"01000\"\n\n local tabooList = { }\n --Forward declaration\n ---@type Request\n local Request = {}\n local configuration\n\n -- Sets up the ArkhamDb interface. Should be called from the parent object on load.\n ArkhamDb.initialize = function()\n configuration = internal.getConfiguration()\n Request.start({ configuration.api_uri, configuration.taboo }, function(status)\n local json = JSON.decode(internal.fixUtf16String(status.text))\n for _, taboo in pairs(json) do\n ---@type \u003cstring, boolean\u003e\n local cards = {}\n\n for _, card in pairs(JSON.decode(taboo.cards)) do\n cards[card.code] = true\n end\n\n tabooList[taboo.id] = {\n date = taboo.date_start,\n cards = cards\n }\n end\n return true, nil\n end)\n end\n\n -- Start the deck build process for the given player color and deck ID. This\n -- will retrieve the deck from ArkhamDB, and pass to a callback for processing.\n ---@param playerColor String. Color name of the player mat to place this deck on (e.g. \"Red\").\n ---@param deckId String. ArkhamDB deck id to be loaded\n ---@param isPrivate Boolean. Whether this deck is published or private on ArkhamDB\n ---@param loadNewest Boolean. Whether the newest version of this deck should be loaded\n ---@param loadInvestigators Boolean. Whether investigator cards should be loaded as part of this\n --- deck\n ---@param callback Function. Callback which will be sent the results of this load. Parameters\n --- to the callback will be:\n --- slots Table. A map of card ID to count in the deck\n --- investigatorCode String. ID of the investigator in this deck\n --- customizations Table. The decoded table of customization upgrades in this deck\n --- playerColor String. Color this deck is being loaded for\n ArkhamDb.getDecklist = function(\n playerColor,\n deckId,\n isPrivate,\n loadNewest,\n loadInvestigators,\n callback)\n -- Get a simple card to see if the bag indexes are complete. If not, abort\n -- the deck load. The called method will handle player notification.\n local checkCard = allCardsBagApi.getCardById(\"01001\")\n if (checkCard ~= nil and checkCard.data == nil) then\n return\n end\n\n local deckUri = { configuration.api_uri,\n isPrivate and configuration.private_deck or configuration.public_deck, deckId }\n\n local deck = Request.start(deckUri, function(status)\n if string.find(status.text, \"\u003c!DOCTYPE html\u003e\") then\n internal.maybePrint(\"Private deck ID \" .. deckId .. \" is not shared\", playerColor)\n return false, table.concat({ \"Private deck \", deckId, \" is not shared\" })\n end\n local json = JSON.decode(status.text)\n\n if not json then\n internal.maybePrint(\"Deck ID \" .. deckId .. \" not found\", playerColor)\n return false, \"Deck not found!\"\n end\n\n return true, json\n end)\n\n deck:with(internal.onDeckResult, playerColor, loadNewest, loadInvestigators, callback)\n end\n\n -- Logs that a card could not be loaded in the mod by printing it to the console in the given\n -- color of the player owning the deck. Attempts to look up the name on ArkhamDB for clarity,\n -- but prints the card ID if the name cannot be retrieved.\n ---@param cardId String. ArkhamDB ID of the card that could not be found\n ---@param playerColor String. Color of the player's deck that had the problem\n ArkhamDb.logCardNotFound = function(cardId, playerColor)\n local request = Request.start({\n configuration.api_uri,\n configuration.cards,\n cardId\n },\n function(result)\n local adbCardInfo = JSON.decode(internal.fixUtf16String(result.text))\n local cardName = adbCardInfo.real_name\n if (cardName ~= nil) then\n if (adbCardInfo.xp ~= nil and adbCardInfo.xp \u003e 0) then\n cardName = cardName .. \" (\" .. adbCardInfo.xp .. \")\"\n end\n internal.maybePrint(\"Card not found: \" .. cardName .. \", ArkhamDB ID \" .. cardId, playerColor)\n else\n internal.maybePrint(\"Card not found in ArkhamDB, ID \" .. cardId, playerColor)\n end\n end)\n end\n\n -- Callback when the deck information is received from ArkhamDB. Parses the\n -- response then applies standard transformations to the deck such as adding\n -- random weaknesses and checking for taboos. Once the deck is processed,\n -- passes to loadCards to actually spawn the defined deck.\n ---@param deck ArkhamImportDeck\n ---@param playerColor String Color name of the player mat to place this deck on (e.g. \"Red\")\n ---@param loadNewest Boolean Whether the newest version of this deck should be loaded\n ---@param loadInvestigators Boolean Whether investigator cards should be loaded as part of this\n --- deck\n ---@param callback Function Callback which will be sent the results of this load. Parameters\n --- to the callback will be:\n --- slots Table. A map of card ID to count in the deck\n --- investigatorCode String. ID of the investigator in this deck\n --- bondedList A table of cardID keys to meaningless values. Card IDs in this list were\n --- added from a parent bonded card.\n --- customizations Table. The decoded table of customization upgrades in this deck\n --- playerColor String. Color this deck is being loaded for\n internal.onDeckResult = function(deck, playerColor, loadNewest, loadInvestigators, callback)\n -- Load the next deck in the upgrade path if the option is enabled\n if (loadNewest and deck.next_deck ~= nil and deck.next_deck ~= \"\") then\n buildDeck(playerColor, deck.next_deck)\n return\n end\n\n internal.maybePrint(table.concat({ \"Found decklist: \", deck.name }), playerColor)\n\n -- Initialize deck slot table and perform common transformations. The order of these should not\n -- be changed, as later steps may act on cards added in each. For example, a random weakness or\n -- investigator may have bonded cards or taboo entries, and should be present\n local slots = deck.slots\n internal.maybeDrawRandomWeakness(slots, playerColor)\n local loadAltInvestigator = \"normal\"\n if loadInvestigators then\n loadAltInvestigator = internal.addInvestigatorCards(deck, slots)\n end\n \n internal.maybeAddSummonedServitor(slots)\n internal.maybeAddOnTheMend(slots, playerColor)\n internal.maybeAddRealityAcidReference(slots)\n local bondList = internal.extractBondedCards(slots)\n internal.checkTaboos(deck.taboo_id, slots, playerColor)\n internal.maybeAddUpgradeSheets(slots)\n\n -- get upgrades for customizable cards\n local customizations = {}\n if deck.meta then\n customizations = JSON.decode(deck.meta)\n end\n\n callback(slots, deck.investigator_code, bondList, customizations, playerColor, loadAltInvestigator)\n end\n\n -- Checks to see if the slot list includes the random weakness ID. If it does,\n -- removes it from the deck and replaces it with the ID of a random basic weakness provided by the\n -- all cards bag\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number\n --- of those cards which will be spawned\n ---@param playerColor String Color of the player this deck is being loaded for. Used for broadcast\n --- if a weakness is added.\n internal.maybeDrawRandomWeakness = function(slots, playerColor)\n local randomWeaknessAmount = slots[RANDOM_WEAKNESS_ID] or 0\n slots[RANDOM_WEAKNESS_ID] = nil\n\n if randomWeaknessAmount ~= 0 then\n for i=1, randomWeaknessAmount do\n local weaknessId = allCardsBagApi.getRandomWeaknessId()\n slots[weaknessId] = (slots[weaknessId] or 0) + 1\n end\n internal.maybePrint(\"Added \" .. randomWeaknessAmount .. \" random basic weakness(es) to deck\", playerColor)\n end\n end\n\n -- Adds both the investigator (XXXXX) and minicard (XXXXX-m) slots with one copy each\n ---@param deck Table The processed ArkhamDB deck response\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the\n --- number of those cards which will be spawned\n ---@return string: Contains the name of the art that should be loaded (\"normal\", \"promo\" or \"revised\")\n internal.addInvestigatorCards = function(deck, slots)\n local investigatorId = deck.investigator_code\n slots[investigatorId .. \"-m\"] = 1\n local deckMeta = JSON.decode(deck.meta)\n -- handling alternative investigator art and parallel investigators\n local loadAltInvestigator = \"normal\"\n if deckMeta ~= nil then\n local altFrontId = tonumber(deckMeta.alternate_front) or 0\n local altBackId = tonumber(deckMeta.alternate_back) or 0\n local altArt = { front = \"normal\", back = \"normal\" }\n\n -- translating front ID\n if altFrontId \u003e 90000 and altFrontId \u003c 90100 then\n altArt.front = \"parallel\"\n elseif altFrontId \u003e 01500 and altFrontId \u003c 01506 then\n altArt.front = \"revised\"\n elseif altFrontId \u003e 98000 then\n altArt.front = \"promo\"\n end\n\n -- translating back ID\n if altBackId \u003e 90000 and altBackId \u003c 90100 then\n altArt.back = \"parallel\"\n elseif altBackId \u003e 01500 and altBackId \u003c 01506 then\n altArt.back = \"revised\"\n elseif altBackId \u003e 98000 then\n altArt.back = \"promo\"\n end\n\n -- updating investigatorID based on alt investigator selection\n -- precedence: parallel \u003e promo \u003e revised\n if altArt.front == \"parallel\" then\n if altArt.back == \"parallel\" then\n investigatorId = investigatorId .. \"-p\"\n else\n investigatorId = investigatorId .. \"-pf\"\n end\n elseif altArt.back == \"parallel\" then\n investigatorId = investigatorId .. \"-pb\"\n elseif altArt.front == \"promo\" or altArt.back == \"promo\" then\n loadAltInvestigator = \"promo\"\n elseif altArt.front == \"revised\" or altArt.back == \"revised\" then\n loadAltInvestigator = \"revised\"\n end\n end\n slots[investigatorId] = 1\n deck.investigator_code = investigatorId\n return loadAltInvestigator\n end\n\n -- Process the card list looking for the customizable cards, and add their upgrade sheets if needed\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number\n -- of those cards which will be spawned\n internal.maybeAddUpgradeSheets = function(slots)\n for cardId, _ in pairs(slots) do\n -- upgrade sheets for customizable cards\n local upgradesheet = allCardsBagApi.getCardById(cardId .. \"-c\")\n if upgradesheet ~= nil then\n slots[cardId .. \"-c\"] = 1\n end\n end\n end\n\n -- Process the card list looking for the Summoned Servitor, and add its minicard to the list if\n -- needed\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number\n -- of those cards which will be spawned\n internal.maybeAddSummonedServitor = function(slots)\n if slots[\"09080\"] ~= nil then\n slots[\"09080-m\"] = 1\n end\n end\n\n -- On the Mend should have 1-per-investigator copies set aside, but ArkhamDB always sends 1. Update\n -- the count based on the investigator count\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number\n -- of those cards which will be spawned\n ---@param playerColor String Color of the player this deck is being loaded for. Used for broadcast if an error occurs\n internal.maybeAddOnTheMend = function(slots, playerColor)\n if slots[\"09006\"] ~= nil then\n local investigatorCount = playAreaApi.getInvestigatorCount()\n if investigatorCount ~= nil then\n slots[\"09006\"] = investigatorCount\n else\n internal.maybePrint(\"Something went wrong with the load, adding 4 copies of On the Mend\", playerColor)\n slots[\"09006\"] = 4\n end\n end\n end\n\n -- Process the card list looking for Reality Acid and adds the reference sheet when needed\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number\n -- of those cards which will be spawned\n internal.maybeAddRealityAcidReference = function(slots)\n if slots[\"89004\"] ~= nil then\n slots[\"89005\"] = 1\n end\n end\n\n -- Process the slot list and looks for any cards which are bonded to those in the deck. Adds those cards to the slot list.\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number of those cards which will be spawned\n internal.extractBondedCards = function(slots)\n -- Create a list of bonded cards first so we don't modify slots while iterating\n local bondedCards = { }\n local bondedList = { }\n for cardId, cardCount in pairs(slots) do\n local card = allCardsBagApi.getCardById(cardId)\n if (card ~= nil and card.metadata.bonded ~= nil) then\n for _, bond in ipairs(card.metadata.bonded) do\n -- add a bonded card for each copy of the parent card (except for Pendant of the Queen)\n if bond.id == \"06022\" then\n bondedCards[bond.id] = bond.count\n else\n bondedCards[bond.id] = bond.count * cardCount\n end\n -- We need to know which cards are bonded to determine their position, remember them\n bondedList[bond.id] = true\n -- Also adding taboo versions of bonded cards to the list\n bondedList[bond.id .. \"-t\"] = true\n end\n end\n end\n -- Add any bonded cards to the main slots list\n for bondedId, bondedCount in pairs(bondedCards) do\n slots[bondedId] = bondedCount\n end\n\n return bondedList\n end\n\n -- Check the deck for cards on its taboo list. If they're found, replace the entry in the slot with the Taboo id (i.e. \"XXXX\" becomes \"XXXX-t\")\n ---@param tabooId String The deck's taboo ID, taken from the deck response taboo_id field. May be nil, indicating that no taboo list should be used\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number of those cards which will be spawned\n internal.checkTaboos = function(tabooId, slots, playerColor)\n if tabooId then\n for cardId, _ in pairs(tabooList[tabooId].cards) do\n if slots[cardId] ~= nil then\n -- Make sure there's a taboo version of the card before we replace it\n -- SCED only maintains the most recent taboo cards. If a deck is using\n -- an older taboo list it's possible the card isn't a taboo any more\n local tabooCard = allCardsBagApi.getCardById(cardId .. \"-t\")\n if tabooCard == nil then\n local basicCard = allCardsBagApi.getCardById(cardId)\n internal.maybePrint(\"Taboo version for \" .. basicCard.data.Nickname .. \" is not available. Using standard version\", playerColor)\n else\n slots[cardId .. \"-t\"] = slots[cardId]\n slots[cardId] = nil\n end\n end\n end\n end\n end\n\n internal.maybePrint = function(message, playerColor)\n if playerColor ~= \"None\" then\n printToAll(message, playerColor)\n end\n end\n\n -- Gets the ArkhamDB config info from the configuration object.\n ---@return Table. Configuration data\n internal.getConfiguration = function()\n local configuration = getObjectsWithTag(\"import_configuration_provider\")[1]:getTable(\"configuration\")\n printPriority = configuration.priority\n return configuration\n end\n\n internal.fixUtf16String = function(str)\n return str:gsub(\"\\\\u(%w%w%w%w)\", function(match)\n return string.char(tonumber(match, 16))\n end)\n end\n\n ---@type Request\n Request = {\n is_done = false,\n is_successful = false\n }\n\n -- Creates a new instance of a Request. Should not be directly called. Instead use Request.start and Request.deferred.\n ---@param uri string\n ---@param configure fun(request: Request, status: WebRequestStatus)\n ---@return Request\n function Request:new(uri, configure)\n local this = {}\n\n setmetatable(this, self)\n self.__index = self\n\n if type(uri) == \"table\" then\n uri = table.concat(uri, \"/\")\n end\n\n this.uri = uri\n\n WebRequest.get(uri, function(status)\n configure(this, status)\n end)\n\n return this\n end\n\n -- Creates a new request. on_success should set the request's is_done, is_successful, and content variables.\n -- Deferred should be used when you don't want to set is_done immediately (such as if you want to wait for another request to finish)\n ---@param uri string\n ---@param on_success fun(request: Request, status: WebRequestStatus, vararg any)\n ---@param on_error fun(status: WebRequestStatus)|nil\n ---@vararg any[]\n ---@return Request\n function Request.deferred(uri, on_success, on_error, ...)\n local parameters = table.pack(...)\n return Request:new(uri, function(request, status)\n if (status.is_done) then\n if (status.is_error) then\n request.error_message = on_error and on_error(status, table.unpack(parameters)) or status.error\n request.is_successful = false\n request.is_done = true\n else\n on_success(request, status)\n end\n end\n end)\n end\n\n -- Creates a new request. on_success should return weather the resultant data is as expected, and the processed content of the request.\n ---@param uri string\n ---@param on_success fun(status: WebRequestStatus, vararg any): boolean, any\n ---@param on_error nil|fun(status: WebRequestStatus, vararg any): string\n ---@vararg any[]\n ---@return Request\n function Request.start(uri, on_success, on_error, ...)\n local parameters = table.pack(...)\n return Request.deferred(uri, function(request, status)\n local result, message = on_success(status, table.unpack(parameters))\n if not result then request.error_message = message else request.content = message end\n request.is_successful = result\n request.is_done = true\n end, on_error, table.unpack(parameters))\n end\n\n ---@param requests Request[]\n ---@param on_success fun(content: any[], vararg any[])\n ---@param on_error fun(requests: Request[], vararg any[])|nil\n ---@vararg any\n function Request.with_all(requests, on_success, on_error, ...)\n local parameters = table.pack(...)\n\n Wait.condition(function()\n ---@type any[]\n local results = {}\n\n ---@type Request[]\n local errors = {}\n\n for _, request in ipairs(requests) do\n if request.is_successful then\n table.insert(results, request.content)\n else\n table.insert(errors, request)\n end\n end\n\n if (#errors \u003c= 0) then\n on_success(results, table.unpack(parameters))\n elseif on_error == nil then\n for _, request in ipairs(errors) do\n internal.maybePrint(table.concat({ \"[ERROR]\", request.uri, \":\", request.error_message }))\n end\n else\n on_error(requests, table.unpack(parameters))\n end\n end, function()\n for _, request in ipairs(requests) do\n if not request.is_done then return false end\n end\n return true\n end)\n end\n\n ---@param callback fun(content: any, vararg any)\n function Request:with(callback, ...)\n local arguments = table.pack(...)\n Wait.condition(function()\n if self.is_successful then\n callback(self.content, table.unpack(arguments))\n end\n end, function() return self.is_done\n end)\n end\n\n return ArkhamDb\nend\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getPlayArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"PlayArea\")\n end\n\n local function getInvestigatorCounter()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"InvestigatorCounter\")\n end\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getInvestigatorCounter().getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n getInvestigatorCounter().call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with 'displacement_excluded'\n ---@param playerColor Color Color of the player requesting the shift for messages\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getPlayArea().call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getPlayArea().call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getPlayArea().call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getPlayArea().call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getPlayArea().call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getPlayArea().call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getPlayArea().call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getPlayArea().call(\"tryObjectEnterContainer\", { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getPlayArea().call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getPlayArea().call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getPlayArea().call(\"countVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getPlayArea().call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getPlayArea().getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getPlayArea().call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getPlayArea().call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getPlayArea().getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "{\"greenDeck\":\"\",\"investigators\":true,\"loadNewest\":true,\"orangeDeck\":\"\",\"private\":true,\"redDeck\":\"\",\"whiteDeck\":\"\"}", "MeasureMovement": false, "Name": "Custom_Tile", @@ -86390,8 +89508,8 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/PlayAreaSelector\")\nend)\n__bundle_register(\"core/PlayAreaSelector\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal playAreaApi = require(\"core/PlayAreaApi\")\n\nlocal controlActive = false\n\n-- parameters for open/close button for reusing\nlocal buttonParameters = {}\nbuttonParameters.function_owner = self\nbuttonParameters.click_function = \"click_toggleControl\"\nbuttonParameters.height = 1500\nbuttonParameters.width = 1500\nbuttonParameters.color = { 1, 1, 1, 0 }\n\nfunction onLoad()\n createOpenCloseButton()\nend\n\n-- click function for main button\nfunction click_toggleControl()\n self.clearButtons()\n self.clearInputs()\n\n controlActive = not controlActive\n createOpenCloseButton()\n\n if not controlActive then return end\n\n -- creates the label, input box and apply button\n self.createButton({\n function_owner = self,\n label = \"Playmat Image Swapper\",\n tooltip = \"\",\n click_function = \"none\",\n position = { 0, 0.15, 2.2 },\n height = 0,\n width = 0,\n font_size = 300,\n font_color = { 1, 1, 1 }\n })\n\n self.createInput({\n function_owner = self,\n label = \"URL\",\n tooltip = \"Enter URL for playmat image\",\n input_function = \"none\",\n alignment = 3,\n position = { 0, 0.15, 3 },\n height = 323,\n width = 4000,\n font_size = 300\n })\n\n self.createButton({\n function_owner = self,\n label = \"Apply Image\\nTo Playmat\",\n tooltip = \"Left-Click: Apply URL\\nRight-Click: Reset to default image\",\n click_function = \"click_applySurface\",\n position = { 0, 0.15, 4.1 },\n height = 460,\n width = 1400,\n font_size = 200\n })\nend\n\n-- click function for apply button\nfunction click_applySurface(_, _, isRightClick)\n playAreaApi.updateSurface(isRightClick and \"\" or self.getInputs()[1].value)\nend\n\nfunction updateSurface(newURL)\n playAreaApi.updateSurface(newURL)\nend\n\n-- input function for the input box\nfunction none() end\n\n-- creates the main button\nfunction createOpenCloseButton()\n buttonParameters.tooltip = (controlActive and \"Close\" or \"Open\") .. \" Playmat Panel\"\n self.createButton(buttonParameters)\nend\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = { }\n local PLAY_AREA_GUID = \"721ba2\"\n local INVESTIGATOR_COUNTER_GUID = \"f182ee\"\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with\n -- 'displacement_excluded'\n ---@param playerColor Color of the player requesting the shift. Used solely to send an error\n --- message in the unlikely case that the scripting zone has been deleted\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"tryObjectEnterContainer\",\n { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightCountedVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/PlayAreaSelector\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/PlayAreaImageData\") -- this fills the variable \"PLAYAREA_IMAGE_DATA\"\nlocal playAreaApi = require(\"core/PlayAreaApi\")\nlocal typeIndex, selectionIndex\n\nfunction onSave() return JSON.encode({typeIndex = typeIndex, selectionIndex = selectionIndex}) end\n\nfunction onLoad(savedData)\n self.createButton({\n function_owner = self,\n click_function = \"onClick_toggleGallery\",\n tooltip = \"Show Image Gallery\",\n height = 1500,\n width = 1500,\n color = { 1, 1, 1, 0 }\n })\n\n local loadedData = JSON.decode(savedData) or {}\n typeIndex = loadedData.typeIndex or 1\n selectionIndex = loadedData.selectionIndex or 1\n Wait.time(updatePlayareaGallery, 0.5)\nend\n\n-- click function for main button\nfunction onClick_toggleGallery()\n Global.call(\"togglePlayareaGallery\")\nend\n\nfunction onClick_defaultImage()\n playAreaApi.updateSurface()\n Global.call(\"togglePlayareaGallery\")\nend\n\nfunction getDataSubTableByIndex(dataTable, index)\n local loopId = 1\n for i, v in pairs(dataTable) do\n if index == loopId then return v end\n loopId = loopId + 1\n end\n return {}\nend\n\nfunction updatePlayareaGallery()\n -- get subtables\n local dataForType = getDataSubTableByIndex(PLAYAREA_IMAGE_DATA, typeIndex)\n local dataForSelection = getDataSubTableByIndex(dataForType, selectionIndex)\n\n -- get global xml to insert elements\n local globalXml = UI.getXmlTable()\n\n -- selectable items\n local itemSelection = getXmlTableElementById(globalXml, 'itemSelection')\n itemSelection.children = {}\n\n local i = 0\n for itemName, _ in pairs(dataForType) do\n i = i + 1\n table.insert(itemSelection.children,\n {\n tag = \"Panel\",\n attributes = { class = \"itemPanel\", id = \"typePanel\" .. i },\n children = {\n tag = \"Text\",\n value = itemName,\n attributes = { class = \"itemText\", id = \"typeListText\" .. i }\n }\n })\n end\n\n -- selectable images for that item\n local playareaList = getXmlTableElementById(globalXml, 'playareaList')\n playareaList.children = {}\n\n for i, v in ipairs(dataForSelection) do\n table.insert(playareaList.children,\n {\n tag = \"VerticalLayout\",\n attributes = { class = \"imageBox\", id = \"image\" .. i },\n children = {\n {\n tag = 'Image',\n attributes = { class = \"playareaImage\", image = v.URL }\n },\n {\n tag = 'Text',\n value = v.Name,\n attributes = { class = \"imageName\" }\n }\n }\n })\n end\n\n playareaList.attributes.height = round(#playareaList.children / 2, 0) * 380\n UI.setXmlTable(globalXml)\n Wait.time(highlightTabAndItem, 0.1)\nend\n\nfunction onClick_imageTab(_, _, tabId)\n typeIndex = tonumber(tabId:sub(9))\n selectionIndex = 1\n updatePlayareaGallery()\nend\n\nfunction onClick_listItem(_, _, listId)\n selectionIndex = tonumber(listId:sub(10))\n updatePlayareaGallery()\nend\n\nfunction onClick_image(_, _, id)\n local imageIndex = tonumber(id:sub(6))\n local dataForType = getDataSubTableByIndex(PLAYAREA_IMAGE_DATA, typeIndex)\n local dataForSelection = getDataSubTableByIndex(dataForType, selectionIndex)\n local newURL = dataForSelection[imageIndex].URL\n playAreaApi.updateSurface(newURL)\n Global.call(\"togglePlayareaGallery\")\nend\n\nfunction highlightTabAndItem()\n -- highlight active tab\n for i = 1, 5 do\n local color = \"#888888\"\n if i == typeIndex then color = \"#ffffff\" end\n UI.setAttribute(\"imageTab\" .. i, \"color\", color)\n end\n\n -- highlight item\n UI.setAttribute(\"typePanel\" .. selectionIndex, \"color\", \"grey\")\n UI.setAttribute(\"typeListText\" .. selectionIndex, \"color\", \"black\")\nend\n\n-- loops through an XML table and returns the specified object\n---@param ui Table XmlTable (get this via getXmlTable)\n---@param id String Id of the object to return\nfunction getXmlTableElementById(ui, id)\n for _, obj in ipairs(ui) do\n if obj.attributes and obj.attributes.id and obj.attributes.id == id then return obj end\n if obj.children then\n local result = getXmlTableElementById(obj.children, id)\n if result then return result end\n end\n end\n return nil\nend\n\n-- utility function\nfunction round(num, numDecimalPlaces)\n local mult = 10 ^ (numDecimalPlaces or 0)\n return math.floor(num * mult + 0.5) / mult\nend\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getPlayArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"PlayArea\")\n end\n\n local function getInvestigatorCounter()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"InvestigatorCounter\")\n end\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getInvestigatorCounter().getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n getInvestigatorCounter().call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with 'displacement_excluded'\n ---@param playerColor Color Color of the player requesting the shift for messages\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getPlayArea().call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getPlayArea().call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getPlayArea().call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getPlayArea().call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getPlayArea().call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getPlayArea().call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getPlayArea().call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getPlayArea().call(\"tryObjectEnterContainer\", { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getPlayArea().call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getPlayArea().call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getPlayArea().call(\"countVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getPlayArea().call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getPlayArea().getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getPlayArea().call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getPlayArea().call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getPlayArea().getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\n__bundle_register(\"core/PlayAreaImageData\", function(require, _LOADED, __bundle_register, __bundle_modules)\nPLAYAREA_IMAGE_DATA = {\n [\"Official Campaigns\"] = {\n [\"Night of the Zealot\"] = {\n {\n Name = \"I - The Gathering 1\",\n URL = \"https://i.ibb.co/6NWqg1K/Zealot-Gathering.jpg\"\n },\n {\n Name = \"III - Devourer Below 1\",\n URL = \"https://i.ibb.co/x5QFzrx/Zealot-3-Devourer-Below-Helen-Castelow.png\"\n },\n {\n Name = \"III - Devourer Below 2\",\n URL = \"https://i.ibb.co/6r6LFGz/Zealot-3-Devourer-Below-Sarah-Miller.png\"\n }\n },\n [\"The Dunwich Legacy\"] = {\n {\n Name = \"I-A - Extracurricular Activity 1\",\n URL = \"https://i.ibb.co/tDxX8KS/Dunwich-1-Extracurricular-Activity-Igor-Kirdeika.jpg\"\n },\n {\n Name = \"I-A - Extracurricular Activity 2\",\n URL = \"https://i.ibb.co/RQ6z0pj/Dunwich-1-Extracurricular-Activity-Joseph-Diaz.jpg\"\n },\n {\n Name = \"I-A - Extracurricular Activity 3\",\n URL = \"https://i.ibb.co/nnJdwL2/Dunwich-1-Extracurricular-Activity-Tomasz-Jedruszek.jpg\"\n },\n {\n Name = \"I-B - House Always Wins 1\",\n URL = \"https://i.ibb.co/8XPLdr9/Dunwich-2-House-Always-Wins-Jonny-Klein.jpg\"\n },\n {\n Name = \"I-B - House Always Wins 2\",\n URL = \"https://i.ibb.co/HtX95GK/Dunwich-2-House-Always-Wins-Robert-Laskey.jpg\"\n },\n {\n Name = \"I-B - House Always Wins 3\",\n URL = \"https://i.ibb.co/MCLP3Sz/Dunwich-2-House-Always-Wins-XX-l.jpg\"\n },\n {\n Name = \"I-B - House Always Wins 4\",\n URL = \"https://i.ibb.co/w7Pf5sd/Dunwich-2-House-Always-Wins-XX-l-2.jpg\"\n },\n {\n Name = \"II - Miskatonic Museum 1\",\n URL = \"https://i.ibb.co/x1Kf7qG/Dunwich-3-Miskatonic-Museum-Emre-Aktuna.jpg\"\n },\n {\n Name = \"II - Miskatonic Museum 2\",\n URL = \"https://i.ibb.co/yWXVPcN/Dunwich-3-Miskatonic-Museum-Richard-Wright.jpg\"\n },\n {\n Name = \"III - Essex County Express\",\n URL = \"https://i.ibb.co/602CMZb/Dunwich-4-Essex-County-Express-David-Alvarez.jpg\"\n },\n {\n Name = \"IV - Blood on the Altar 1\",\n URL = \"https://i.ibb.co/3CYHDhf/Dunwich-5-Blood-on-the-Altar.jpg\"\n },\n {\n Name = \"IV - Blood on the Altar 2\",\n URL = \"https://i.ibb.co/FbxcCY2/Dunwich-5-Blood-on-the-Altar-Chris-Ostrowski.jpg\"\n },\n {\n Name = \"IV - Blood on the Altar 3\",\n URL = \"https://i.ibb.co/sJf6YsZ/Dunwich-5-Blood-on-the-Altar-Lucas-Staniec.jpg\"\n },\n {\n Name = \"IV - Blood on the Altar 4\",\n URL = \"https://i.ibb.co/kBPNGBd/Dunwich-5-Blood-on-the-Altar-Mark-Molnar.jpg\"\n },\n {\n Name = \"V - Undimensioned and Unseen 1\",\n URL = \"https://i.ibb.co/QvfhjDv/Dunwich-6-Undimensioned-and-Unseen-Frej-Agelii.jpg\"\n },\n {\n Name = \"V - Undimensioned and Unseen 2\",\n URL = \"https://i.ibb.co/4VL9gSK/Dunwich-6-Undimensioned-and-Unseen-Lucas-Staniec.jpg\"\n },\n {\n Name = \"V - Undimensioned and Unseen 3\",\n URL = \"https://i.ibb.co/wBFsS8P/Dunwich-6-Undimensioned-and-Unseen-Michal-Teliga-jpg.jpg\"\n },\n {\n Name = \"V - Undimensioned and Unseen 4\",\n URL = \"https://i.ibb.co/wwGDcq6/Dunwich-6-Undimensioned-and-Unseen-Tomasz-Jedruszek.jpg\"\n },\n {\n Name = \"VI - Where Doom Awaits 1\",\n URL = \"https://i.ibb.co/TvMwqj4/Dunwich-7-Where-Doom-Awaits.jpg\"\n },\n {\n Name = \"VI - Where Doom Awaits 2\",\n URL = \"https://i.ibb.co/S6cSLH9/Dunwich-7-Where-Doom-Awaits-3.jpg\"\n },\n {\n Name = \"VI - Where Doom Awaits 3\",\n URL = \"https://i.ibb.co/khBX32g/Dunwich-7-Where-Doom-Awaits-4.jpg\"\n },\n {\n Name = \"VI - Where Doom Awaits 4\",\n URL = \"https://i.ibb.co/S0hcwN8/Dunwich-7-Where-Doom-Awaits-5.jpg\"\n },\n {\n Name = \"VI - Where Doom Awaits 5\",\n URL = \"https://i.ibb.co/Lxv1Bjp/Dunwich-7-Where-Doom-Awaits-Luca-Trentin.jpg\"\n },\n {\n Name = \"VII - Lost in Time and Space 1\",\n URL = \"https://i.ibb.co/rtTpbDx/Dunwich-8-Lost-in-Time-amp-Space.jpg\"\n },\n {\n Name = \"VII - Lost in Time and Space 2\",\n URL = \"https://i.ibb.co/dBXP0GL/Dunwich-8-Lost-in-Time-amp-Space-Chris-Ostrowski.jpg\"\n },\n {\n Name = \"VII - Lost in Time and Space 3\",\n URL = \"https://i.ibb.co/0XcnxFD/Dunwich-8-Lost-in-Time-amp-Space-Lino-Drieghe.jpg\"\n }\n },\n [\"The Path to Carcosa\"] = {\n {\n Name = \"I - Curtain Call\",\n URL = \"https://i.ibb.co/TcnKXJD/Carcosa-1-Curtain-Call-Mark-Molnar.jpg\"\n },\n {\n Name = \"II - Last King 1\",\n URL = \"https://i.ibb.co/JRQJKR8/Carcosa-2-Last-King-Cristi-Balanescu.jpg\"\n },\n {\n Name = \"II - Last King 2\",\n URL = \"https://i.ibb.co/NZzBwgv/Carcosa-2-Last-King-Cristi-Balanescu-2.jpg\"\n },\n {\n Name = \"II - Last King 3\",\n URL = \"https://i.ibb.co/x56ZHt7/Carcosa-2-Last-King-Wu-Mengjia.jpg\"\n },\n {\n Name = \"III - Echoes of the Past\",\n URL = \"https://i.ibb.co/R6gSm0D/Carcosa-3-Echoes-of-the-Past-Heather-Savage.jpg\"\n },\n {\n Name = \"IV - Unspeakable Oath 1\",\n URL = \"https://i.ibb.co/DzzDQQQ/Carcosa-4-Unspeakable-Oath.jpg\"\n },\n {\n Name = \"IV - Unspeakable Oath 2\",\n URL = \"https://i.ibb.co/9gqBzXr/Carcosa-4-Unspeakable-Oath-2-Mark-Molnar.jpg\"\n },\n {\n Name = \"IV - Unspeakable Oath 3\",\n URL = \"https://i.ibb.co/wWL73c9/Carcosa-4-Unspeakable-Oath-Paul-Fairbairn.jpg\"\n },\n {\n Name = \"V - Phantom of Truth 1\",\n URL = \"https://i.ibb.co/mzpz1Dd/Carcosa-5-Phantom-of-Truth-Lucas-Staniec.jpg\"\n },\n {\n Name = \"V - Phantom of Truth 2\",\n URL = \"https://i.ibb.co/Vp1wNbT/Carcosa-5-Phantom-of-Truth-Tomasz-Jedruszek.jpg\"\n },\n {\n Name = \"VI - Pallid Mask 1\",\n URL = \"https://i.ibb.co/Bf5LByY/Carcosa-6-Pallid-Mask-Greg-Bobrowski.jpg\"\n },\n {\n Name = \"VI - Pallid Mask 2\",\n URL = \"https://i.ibb.co/1v1J9Xx/Carcosa-6-Pallid-Mask-Rafal-Pyra.jpg\"\n },\n {\n Name = \"VII - Black Star Rises 1\",\n URL = \"https://i.ibb.co/TB451t7/Carcosa-7-Black-Star-Rises-Audric-Gatoux.jpg\"\n },\n {\n Name = \"VII - Black Star Rises 2\",\n URL = \"https://i.ibb.co/nC8Ncxx/Carcosa-7-Black-Star-Rises-Chris-Kintner.jpg\"\n },\n {\n Name = \"VIII - Dim Carcosa 1\",\n URL = \"https://i.ibb.co/QvS4y3D/Carcosa-8-Dim-Carcosa-Alexandr-Elichev.jpg\"\n },\n {\n Name = \"VIII - Dim Carcosa 2\",\n URL = \"https://i.ibb.co/hR95x7k/Carcosa-8-Dim-Carcosa-Yuri-Shepherd.jpg\"\n }\n },\n [\"The Forgotten Age\"] = {\n {\n Name = \"I - Untamed Wilds 1\",\n URL = \"https://i.ibb.co/BLhwCG1/Forgotten-Age-1-Untamed-Wilds-David-Frasheski.jpg\"\n },\n {\n Name = \"I - Untamed Wilds 2\",\n URL = \"https://i.ibb.co/SnJfsNy/Forgotten-Age-1-Untamed-Wilds-David-Frasheski-2.jpg\"\n },\n {\n Name = \"I - Untamed Wilds 3\",\n URL = \"https://i.ibb.co/kcx1tvp/Forgotten-Age-1-Untamed-Wilds-Ethan-Patrick-Harris.jpg\"\n },\n {\n Name = \"I - Untamed Wilds 4\",\n URL = \"https://i.ibb.co/HPbJwXk/Forgotten-Age-1-Untamed-Wilds-Lucas-Staniec.jpg\"\n },\n {\n Name = \"I - Untamed Wilds 5\",\n URL = \"https://i.ibb.co/bbq1ZrK/Forgotten-Age-1-Untamed-Wilds-Nele-Diel.jpg\"\n },\n {\n Name = \"II - Doom of Etzli 1\",\n URL = \"https://i.ibb.co/Pw4by4q/Forgotten-Age-2-Doom-of-Eztli-Cristi-Balanescu.jpg\"\n },\n {\n Name = \"II - Doom of Etzli 2\",\n URL = \"https://i.ibb.co/xqW6cXR/Forgotten-Age-2-Doom-of-Eztli-Greg-Bobrowski.jpg\"\n },\n {\n Name = \"II - Doom of Etzli 3\",\n URL = \"https://i.ibb.co/kgsC3pb/Forgotten-Age-2-Doom-of-Eztli-Nele-Diel.jpg\"\n },\n {\n Name = \"III - Threads of Fate\",\n URL = \"https://i.ibb.co/Bn0Pjng/Forgotten-Age-3-Threads-of-Fate-Jokubas-Uogintas.jpg\"\n },\n {\n Name = \"IV - Boundary Beyond 1\",\n URL = \"https://i.ibb.co/yPZ9v2X/Forgotten-Age-4-Boundary-Beyond-Greg-Bobrowski-2-jpg.jpg\"\n },\n {\n Name = \"IV - Boundary Beyond 2\",\n URL = \"https://i.ibb.co/vm0JgFs/Forgotten-Age-4-Boundary-Beyond-Greg-Bobrowski-jpg.jpg\"\n },\n {\n Name = \"IV - Boundary Beyond 3\",\n URL = \"https://i.ibb.co/D1rh9Ry/Forgotten-Age-4-Boundary-Beyond-Nele-Diel.jpg\"\n },\n {\n Name = \"V - Heart of the Elders I-1\",\n URL = \"https://i.ibb.co/jzKvv6P/Forgotten-Age-5-Heart-of-the-Elders-I-Lucas-Staniec.jpg\"\n },\n {\n Name = \"V - Heart of the Elders I-2\",\n URL = \"https://i.ibb.co/mR79MX4/Forgotten-Age-5-Heart-of-the-Elders-I-Lucas-Staniec-2.jpg\"\n },\n {\n Name = \"V - Heart of the Elders II\",\n URL = \"https://i.ibb.co/pQSbL0t/Forgotten-Age-5-Heart-of-the-Elders-II-Nele-Diel.jpg\"\n },\n {\n Name = \"VI - City of Archives 1\",\n URL = \"https://i.ibb.co/f04DSPb/Forgotten-Age-6-City-of-Archives.jpg\"\n },\n {\n Name = \"VI - City of Archives 2\",\n URL = \"https://i.ibb.co/WsSBrYj/Forgotten-Age-6-City-of-Archives-2.jpg\"\n },\n {\n Name = \"VI - City of Archives 3\",\n URL = \"https://i.ibb.co/qdPbSZ8/Forgotten-Age-6-City-of-Archives-Chris-Ostrowski.jpg\"\n },\n {\n Name = \"VII - Depths of Yoth 1\",\n URL = \"https://i.ibb.co/dbLKgGv/Forgotten-Age-7-Depths-of-Yoth-Diego-Arbetta.jpg\"\n },\n {\n Name = \"VII - Depths of Yoth 2\",\n URL = \"https://i.ibb.co/NW7Wp98/Forgotten-Age-7-Depths-of-Yoth-Greg-Bobrowski.jpg\"\n },\n {\n Name = \"VII - Depths of Yoth 3\",\n URL = \"https://i.ibb.co/257zr7c/Forgotten-Age-7-Depths-of-Yoth-Greg-Bobrowski-2-jpg.jpg\"\n },\n {\n Name = \"VIII - Shattered Aeons 1\",\n URL = \"https://i.ibb.co/KwnWTGR/Forgotten-Age-8-Shattered-Aeons.jpg\"\n },\n {\n Name = \"VIII - Shattered Aeons 2\",\n URL = \"https://i.ibb.co/b7kVd4F/Forgotten-Age-8-Shattered-Aeons-Alexandr-Elichev.jpg\"\n }\n },\n [\"The Circle Undone\"] = {\n {\n Name = \"0 - Prologue\",\n URL = \"https://i.ibb.co/gm4C6yy/Circle-Undone-0-Prologue-Ted-Galaday.jpg\"\n },\n {\n Name = \"I - Witching Hour\",\n URL = \"https://i.ibb.co/kgJ34WS/Circle-Undone-1-Witching-Hour-Nele-Diel.jpg\"\n },\n {\n Name = \"II - At Death's Doorstep 1\",\n URL = \"https://i.ibb.co/qNWzH0Y/Circle-Undone-2-At-Death-039-s-Doorstep-Emilio-Rodriguez.jpg\"\n },\n {\n Name = \"II - At Death's Doorstep 2\",\n URL = \"https://i.ibb.co/T1zp1QN/Circle-Undone-2-At-Death-039-s-Doorstep-Emilio-Rodriguez-2.jpg\"\n },\n {\n Name = \"II - At Death's Doorstep 3\",\n URL = \"https://i.ibb.co/ZJfYZ1w/Circle-Undone-2-At-Death-039-s-Doorstep-Majid-Azim.jpg\"\n },\n {\n Name = \"III - The Secret Name 1\",\n URL = \"https://i.ibb.co/hsBw4JQ/Circle-Undone-3-Secret-Name-Jeff-Jumper.jpg\"\n },\n {\n Name = \"III - The Secret Name 2\",\n URL = \"https://i.ibb.co/MpcPXR5/Circle-Undone-3-Secret-Name-Pierre-Santamaria.jpg\"\n },\n {\n Name = \"III - The Secret Name 3\",\n URL = \"https://i.ibb.co/LQ8rdKs/Circle-Undone-3-The-Secret-Name-Greg-Bobrowski.jpg\"\n },\n {\n Name = \"III - The Secret Name 4\",\n URL = \"https://i.ibb.co/0D7LzxV/Circle-Undone-3-The-Secret-Name-Robert-Laskey.jpg\"\n },\n {\n Name = \"IV - Wages of Sin 1\",\n URL = \"https://i.ibb.co/fDMqH1C/Circle-Undone-4-Wages-of-Sin-Emilio-Rodriguez.jpg\"\n },\n {\n Name = \"IV - Wages of Sin 2\",\n URL = \"https://i.ibb.co/HDrKkZF/Circle-Undone-4-Wages-of-Sin-Emilio-Rodriguez-2.jpg\"\n },\n {\n Name = \"IV - Wages of Sin 3\",\n URL = \"https://i.ibb.co/vkpG8cM/Circle-Undone-4-Wages-of-Sin-Greg-Bobrowski.jpg\"\n },\n {\n Name = \"IV - Wages of Sin 4\",\n URL = \"https://i.ibb.co/CMj007q/Circle-Undone-4-Wages-of-Sin-Mateusz-Michalski.jpg\"\n },\n {\n Name = \"IV - Wages of Sin 5\",\n URL = \"https://i.ibb.co/sj1bS5x/Circle-Undone-4-Wages-of-Sin-Serge-Da-Silva-Dias.jpg\"\n },\n {\n Name = \"V - For the Greater Good 1\",\n URL = \"https://i.ibb.co/LDyqjbj/Circle-Undone-5-For-the-Greater-Good.jpg\"\n },\n {\n Name = \"V - For the Greater Good 2\",\n URL = \"https://i.ibb.co/pPzXNd1/Circle-Undone-5-For-the-Greater-Good-2.jpg\"\n },\n {\n Name = \"V - For the Greater Good 3\",\n URL = \"https://i.ibb.co/8rMLvJH/Circle-Undone-5-For-the-Greater-Good-Greg-Bobrowski.jpg\"\n },\n {\n Name = \"V - For the Greater Good 4\",\n URL = \"https://i.ibb.co/vj1q4Cm/Circle-Undone-5-For-the-Greater-Good-Robert-Laskey.jpg\"\n },\n {\n Name = \"VI - Union and Disillusioned\",\n URL = \"https://i.ibb.co/n7SD1tB/Circle-Undone-6-Union-amp-Disillusioned-Andreas-Rocha.jpg\"\n },\n {\n Name = \"VII - In the Clutches of Chaos 1\",\n URL = \"https://i.ibb.co/bFXBNh7/Circle-Undone-7-In-the-Clutches-of-Chaos.jpg\"\n },\n {\n Name = \"VII - In the Clutches of Chaos 2\",\n URL = \"https://i.ibb.co/m6DshNg/Circle-Undone-7-In-the-Clutches-of-Chaos-Alexandr-Elichev.jpg\"\n },\n {\n Name = \"VII - In the Clutches of Chaos 3\",\n URL = \"https://i.ibb.co/k2p4yfG/Circle-Undone-7-In-the-Clutches-of-Chaos-Jokubas-Uogintas.jpg\"\n },\n {\n Name = \"VIII - Before the Black Throne 1\",\n URL = \"https://i.ibb.co/9TPwvP6/Circle-Undone-8-Before-the-Black-Throne-Aaron-Luke-Wilson.jpg\"\n },\n {\n Name = \"VIII - Before the Black Throne 2\",\n URL = \"https://i.ibb.co/VNtgH4v/Circle-Undone-8-Before-the-Black-Throne-Greg-Bobrowski.jpg\"\n }\n },\n [\"The Dream-Eaters\"] = {\n {\n Name = \"I-A - Beyond the Gates of Sleep 1\",\n URL = \"https://i.ibb.co/S6sCy7G/Dream-Eaters-1-A-Beyond-the-Gates-of-Sleep-Phoebe-Herring.jpg\"\n },\n {\n Name = \"I-A - Beyond the Gates of Sleep 2\",\n URL = \"https://i.ibb.co/kBfW9SC/Dream-Eaters-1-A-Beyond-the-Gates-of-Sleep-Regina-Kurnya.jpg\"\n },\n {\n Name = \"I-A - Beyond the Gates of Sleep 3\",\n URL = \"https://i.ibb.co/HGvnxdX/Dream-Eaters-1-A-Beyond-the-Gates-of-Sleep-Jason-Scheier.jpg\"\n },\n {\n Name = \"I-B - Waking Nightmare\",\n URL = \"https://i.ibb.co/sWsZCv8/Dream-Eaters-1-B-Waking-Nightmare-Josh-Gould-jpg.jpg\"\n },\n {\n Name = \"II-A - Search for Kadath 1\",\n URL = \"https://i.ibb.co/4SwzCD8/Dream-Eaters-2-A-Search-for-Kadath-Andrei-Khrutskii.jpg\"\n },\n {\n Name = \"II-A - Search for Kadath 2\",\n URL = \"https://i.ibb.co/WpZ4fMc/Dream-Eaters-2-A-Search-for-Kadath-Dan-Iorgulescu.jpg\"\n },\n {\n Name = \"II-A - Search for Kadath 3\",\n URL = \"https://i.ibb.co/jwsn0jf/Dream-Eaters-2-A-Search-for-Kadath-Diana-Tsareva.jpg\"\n },\n {\n Name = \"II-A - Search for Kadath 4\",\n URL = \"https://i.ibb.co/pd9vxmL/Dream-Eaters-2-A-Search-for-Kadath-Helen-Ilnytska.jpg\"\n },\n {\n Name = \"II-A - Search for Kadath 5\",\n URL = \"https://i.ibb.co/MZ7Qtcc/Dream-Eaters-2-A-Search-for-Kadath-Nele-Diel.jpg\"\n },\n {\n Name = \"II-B - Thousand Shapes of Horror 1\",\n URL = \"https://i.ibb.co/9s7M0PP/Dream-Eaters-2-B-Thousand-Shapes-of-Horror-Nele-Diel-2.jpg\"\n },\n {\n Name = \"II-B - Thousand Shapes of Horror 2\",\n URL = \"https://i.ibb.co/T4Pqx0H/Dream-Eaters-2-B-Thousand-Shapes-of-Horror-Nele-Diel.jpg\"\n },\n {\n Name = \"II-B - Thousand Shapes of Horror 3\",\n URL = \"https://i.ibb.co/VJFQVYd/Dream-Eaters-2-B-Thousand-Shapes-of-Horror-Greg-Bobrowski.jpg\"\n },\n {\n Name = \"III-A - Dark Side of the Moon 1\",\n URL = \"https://i.ibb.co/B2DfXLZ/Dream-Eaters-3-A-Dark-Side-of-the-Moon-Dabanli.jpg\"\n },\n {\n Name = \"III-A - Dark Side of the Moon 2\",\n URL = \"https://i.ibb.co/c27JRvv/Dream-Eaters-3-A-Dark-Side-of-the-Moon-Frej-Agelii.jpg\"\n },\n {\n Name = \"III-B - Point of No Return 1\",\n URL = \"https://i.ibb.co/dMGNB9Y/Dream-Eaters-3-B-Point-of-No-Return-Daria-Khlebnikova.jpg\"\n },\n {\n Name = \"III-B - Point of No Return 2\",\n URL = \"https://i.ibb.co/dpXxPmz/Dream-Eaters-3-B-Point-of-No-Return-Karine-Villette.jpg\"\n },\n {\n Name = \"IV-A - Where the Gods Dwell\",\n URL = \"https://i.ibb.co/v4nqw6G/Dream-Eaters-4-A-Where-the-Gods-Dwell-Samantha-Franco.jpg\"\n },\n {\n Name = \"IV-B - Weaver of the Cosmos 1\",\n URL = \"https://i.ibb.co/7btNBS1/Dream-Eaters-4-B-Weaver-of-the-Cosmos-Diana-Franco.jpg\"\n },\n {\n Name = \"IV-B - Weaver of the Cosmos 2\",\n URL = \"https://i.ibb.co/RY7y22b/Dream-Eaters-4-B-Weaver-of-the-Cosmos-Leanna-Crossan.jpg\"\n },\n {\n Name = \"IV-B - Weaver of the Cosmos 3\",\n URL = \"https://i.ibb.co/f8LBbFW/Dream-Eaters-4-B-Weaver-of-the-Cosmos-Nele-Diel.jpg\"\n }\n },\n [\"The Innsmouth Conspiracy\"] = {\n {\n Name = \"I - Pit of Despair 1\",\n URL = \"https://i.ibb.co/2sc0F61/Innsmouth-1-Pit-of-Despair-Amanda-Castrillo.jpg\"\n },\n {\n Name = \"I - Pit of Despair 2\",\n URL = \"https://i.ibb.co/Nj9JLBQ/Innsmouth-1-Pit-of-Despair-J-Mill.jpg\"\n },\n {\n Name = \"II - Vanishing of Elina Harper 1\",\n URL = \"https://i.ibb.co/2j74cVn/Innsmouth-2-Vanishing-of-Elina-Harper-Konstantin-Vohwinkel.jpg\"\n },\n {\n Name = \"II - Vanishing of Elina Harper 2\",\n URL = \"https://i.ibb.co/r2VqHSn/Innsmouth-2-Vanishing-of-Elina-Harper-Mihail-Bila.jpg\"\n },\n {\n Name = \"II - Vanishing of Elina Harper 3\",\n URL = \"https://i.ibb.co/hFQMm7N/Innsmouth-2-Vanishing-of-Elina-Harper-Richard-Wright.jpg\"\n },\n {\n Name = \"II - Vanishing of Elina Harper 4\",\n URL = \"https://i.ibb.co/2nZKGN6/Innsmouth-2-Vanishing-of-Elina-Harper-Tomasz-Jedruszek-1.jpg\"\n },\n {\n Name = \"II - Vanishing of Elina Harper 5\",\n URL = \"https://i.ibb.co/WxLpKrM/Innsmouth-2-Vanishing-of-Elina-Harper-Tomasz-Jedruszek-2.jpg\"\n },\n {\n Name = \"III - In Too Deep 1\",\n URL = \"https://i.ibb.co/SsQ3my4/Innsmouth-3-In-Too-Deep-David-Frasheski.jpg\"\n },\n {\n Name = \"III - In Too Deep 2\",\n URL = \"https://i.ibb.co/jgQ8zQN/Innsmouth-3-In-Too-Deep-Klaudia-Bezak.jpg\"\n },\n {\n Name = \"III - In Too Deep 3\",\n URL = \"https://i.ibb.co/VVgtNM1/Innsmouth-3-In-Too-Deep-Patrik-Antonescu.jpg\"\n },\n {\n Name = \"IV - Devil Reef 1\",\n URL = \"https://i.ibb.co/Jrf6CJ0/Innsmouth-4-Devil-Reef-Ludovic-Sanson.jpg\"\n },\n {\n Name = \"IV - Devil Reef 2\",\n URL = \"https://i.ibb.co/4jfwDZR/Innsmouth-4-Devil-Reef-Marc-Stewart.jpg\"\n },\n {\n Name = \"V - Horror in High Gear 1\",\n URL = \"https://i.ibb.co/vqYJjYJ/Innsmouth-5-Horror-in-High-Gear-Greg-Bobrowski.jpg\"\n },\n {\n Name = \"V - Horror in High Gear 2\",\n URL = \"https://i.ibb.co/yYrzbYS/Innsmouth-5-Horror-in-High-Gear-Greg-Bobrowski-2.jpg\"\n },\n {\n Name = \"V - Horror in High Gear 3\",\n URL = \"https://i.ibb.co/fpKWhGY/Innsmouth-5-Horror-in-High-Gear-Guillem-H-Pongiluppi.jpg\"\n },\n {\n Name = \"V - Horror in High Gear 4\",\n URL = \"https://i.ibb.co/YkLFy7y/Innsmouth-5-Horror-in-High-Gear-Rostyslav-Zagornov.jpg\"\n },\n {\n Name = \"VI - Light in the Fog 1\",\n URL = \"https://i.ibb.co/v1rhgqJ/Innsmouth-6-Light-in-the-Fog-Florian-Aupetit.jpg\"\n },\n {\n Name = \"VI - Light in the Fog 2\",\n URL = \"https://i.ibb.co/Db2pRd6/Innsmouth-6-Light-in-the-Fog-JB-Caillet.jpg\"\n },\n {\n Name = \"VII - Lair of Dagon 1\",\n URL = \"https://i.ibb.co/QPwzQL5/Innsmouth-7-Lair-of-Dagon-Daria-Khlebnikova.jpg\"\n },\n {\n Name = \"VII - Lair of Dagon 2\",\n URL = \"https://i.ibb.co/MZBpCbs/Innsmouth-7-Lair-of-Dagon-Guillem-H-Pongiluppi.jpg\"\n },\n {\n Name = \"VIII - Into the Maelstrom 1\",\n URL = \"https://i.ibb.co/fkSXDgs/Innsmouth-8-Into-the-Maelstrom-Dimitri-Bielak.jpg\"\n },\n {\n Name = \"VIII - Into the Maelstrom 2\",\n URL = \"https://i.ibb.co/k56Dn9q/Innsmouth-8-Into-the-Maelstrom-Mateusz-Michalski.jpg\"\n }\n },\n [\"Edge of the Earth\"] = {\n {\n Name = \"I - Ice and Death 1\",\n URL = \"https://i.ibb.co/FWZMWtW/Edge-1-Ice-and-Death-David-Frasheski.png\"\n },\n {\n Name = \"I - Ice and Death 2\",\n URL = \"https://i.ibb.co/QDGV0jQ/Edge-1-Ice-and-Death-Felix-Riano.png\"\n },\n {\n Name = \"I - Ice and Death 3\",\n URL = \"https://i.ibb.co/hFJQM8v/Edge-1-Ice-and-Death-Mike-Gizienski.png\"\n },\n {\n Name = \"??? - Fatal Mirage\",\n URL = \"https://i.ibb.co/KzwvjJN/Edge-2-Fatal-Mirage-David-Frasheski.png\"\n },\n {\n Name = \"II - Forbidden Peaks 1\",\n URL = \"https://i.ibb.co/C2SLByt/Edge-2-Forbidden-Peaks-David-Frasheski-2.png\"\n },\n {\n Name = \"II - Forbidden Peaks 2\",\n URL = \"https://i.ibb.co/0cGkkBL/Edge-3-Forbidden-Peaks-David-Frasheski.png\"\n },\n {\n Name = \"III - City of Elder Things 1\",\n URL = \"https://i.ibb.co/FbpgBD3/Edge-4-City-Francois-Baranger.png\"\n },\n {\n Name = \"III - City of Elder Things 2\",\n URL = \"https://i.ibb.co/ncRvHr3/Edge-4-City-Francois-Baranger-2.png\"\n },\n {\n Name = \"IV - Heart of Madness 1\",\n URL = \"https://i.ibb.co/rk0qR4z/Edge-5-Heart-of-Madness-Karol-Sollich.png\"\n },\n {\n Name = \"IV - Heart of Madness 2\",\n URL = \"https://i.ibb.co/NVFjx6N/Edge-5-Heart-of-Madness-Miguel-Coimbra.png\"\n }\n },\n [\"The Scarlet Keys\"] = {\n {\n Name = \"5-A Riddles and Rain\",\n URL = \"http://cloud-3.steamusercontent.com/ugc/2037357792057358580/E9E5FE4028C08B3D4883406821221B73C8B5B2C7/\"\n },\n {\n Name = \"11-B Dead Heat\",\n URL = \"http://cloud-3.steamusercontent.com/ugc/2038485431566443853/CAD7771D90141EA6D5FFAFE1EC5E7AD9647C82DB/\"\n },\n {\n Name = \"16-D Sanguine Shadows\",\n URL = \"http://cloud-3.steamusercontent.com/ugc/2037357792057358704/4A7261EB31511467CBC46E876476DD205F528A4B/\"\n },\n {\n Name = \"21-F Dealings in the Dark\",\n URL = \"http://cloud-3.steamusercontent.com/ugc/2037357792057358816/7C9FE4C34CD0A7AE87EF054742D878F310C71AA7/\"\n },\n {\n Name = \"28-I Dancing Mad\",\n URL = \"http://cloud-3.steamusercontent.com/ugc/2037357792056955518/EAB857DD5629EC6A3078FB0A3A703B85B5F514B9/\"\n },\n {\n Name = \"23-K On Thin Ice\",\n URL = \"http://cloud-3.steamusercontent.com/ugc/2038485431566444026/EB5628E254AE25DA89A9C999EAAD995ECF67068E/\"\n },\n {\n Name = \"38-N Dogs of War\",\n URL = \"http://cloud-3.steamusercontent.com/ugc/2038485431566444199/194FD9A713907197471A55411AE300B62C5F5278/\"\n },\n {\n Name = \"46-Q Shades of Suffering\",\n URL = \"http://cloud-3.steamusercontent.com/ugc/2038485431566444330/3ED2CCE95DE933546E1B5CBBF445D773E6D65465/\"\n },\n {\n Name = \"56-Y ???\",\n URL = \"http://cloud-3.steamusercontent.com/ugc/2038485431566444450/FE4C335B0F72E83900A4EED0FD1A1D304D70D6B7/\"\n },\n {\n Name = \"59-Z Congress of Keys I\",\n URL = \"http://cloud-3.steamusercontent.com/ugc/2038485431566444576/5BB32469ED412D59BB0A46E57D226500B1D0568B/\"\n },\n {\n Name = \"59-Z Congress of Keys II\",\n URL = \"http://cloud-3.steamusercontent.com/ugc/2038485431566444690/B01A1FEAB57473D9B6DF11B92D62C214AA1C2C02/\"\n }\n }\n },\n [\"Official Scenarios\"] = {\n [\"The Blob That Ate Everything\"] = {\n {\n Name = \"The Blob That Ate Everything 1\",\n URL = \"https://i.ibb.co/JxFV4ZN/Blob-That-Ate-Everything-Emilio-Rodriguez.jpg\"\n },\n {\n Name = \"The Blob That Ate Everything 2\",\n URL = \"https://i.ibb.co/qJzstWF/Blob-That-Ate-Everything-Emilio-Rodriguez.jpg\"\n }\n },\n [\"Carnevale of Horrors\"] = {\n {\n Name = \"Carnevale of Horrors 1\",\n URL = \"https://i.ibb.co/ZchJBpz/Carnevale-of-Horrors.jpg\"\n },\n },\n [\"Curse of the Rougarou\"] = {\n {\n Name = \"Curse of the Rougarou 1\",\n URL = \"https://i.ibb.co/Qf7Sr7P/Curse-of-the-Rougarou.jpg\"\n },\n {\n Name = \"Curse of the Rougarou 2\",\n URL = \"https://i.ibb.co/hs1Qjp0/Curse-of-the-Rougarou-Ann-Kovaleva.jpg\"\n },\n {\n Name = \"Curse of the Rougarou 3\",\n URL = \"https://i.ibb.co/BK7rmJ9/Curse-of-the-Rougarou-Karine-Villette.jpg\"\n },\n {\n Name = \"Curse of the Rougarou 4\",\n URL = \"https://i.ibb.co/ZxGTC1w/Curse-of-the-Rougarou-Lachlan-Page.jpg\"\n },\n {\n Name = \"Curse of the Rougarou 5\",\n URL = \"https://i.ibb.co/HgNXJhW/Curse-of-the-Rougarou-Vladimir-Manyukhin.jpg\"\n }\n },\n [\"Guardians of the Abyss\"] = {\n {\n Name = \"Guardians of the Abyss 1\",\n URL = \"https://i.ibb.co/gD3R6cw/Guardians-of-the-Abyss-Jake-Murray.jpg\"\n },\n {\n Name = \"Guardians of the Abyss 2\",\n URL = \"https://i.ibb.co/jMHPcvz/Guardians-of-the-Abyss-Jose-Vega.jpg\"\n },\n {\n Name = \"Guardians of the Abyss 3\",\n URL = \"https://i.ibb.co/99pqXQP/Guardians-of-the-Abyss-Koke-Nunez.jpg\"\n },\n {\n Name = \"Guardians of the Abyss 4\",\n URL = \"https://i.ibb.co/QbMvjbx/Guardians-of-the-Abyss-Mike-Szabados.jpg\"\n },\n {\n Name = \"Guardians of the Abyss 5\",\n URL = \"https://i.ibb.co/zFDt9Q8/Guardians-of-the-Abyss-Nele-Diel.jpg\"\n },\n {\n Name = \"Guardians of the Abyss 6\",\n URL = \"https://i.ibb.co/Vpzptmt/Guardians-of-the-Abyss-Yujin-Choo.jpg\"\n }\n },\n [\"Labyrinths of Lunacy\"] = {\n {\n Name = \"Labyrinths of Lunacy 1\",\n URL = \"https://i.ibb.co/f17PMCC/Labyrinths-of-Lunacy-Cordelia-Wolf.jpg\"\n },\n {\n Name = \"Labyrinths of Lunacy 2\",\n URL = \"https://i.ibb.co/44DXfWw/Labyrinths-of-Lunacy-Richard-Wright.jpg\"\n },\n {\n Name = \"Labyrinths of Lunacy 3\",\n URL = \"https://i.ibb.co/jMQhs68/Labyrinths-of-Lunacy-Robert-Berg.jpg\"\n }\n },\n [\"Murder at Excelsior Hotel\"] = {\n {\n Name = \"Murder at Excelsior Hotel 1\",\n URL = \"https://i.ibb.co/5cQ6LvN/Murder-at-Excelsior-Hotel-Alistair-Mitchell.jpg\"\n },\n {\n Name = \"Murder at Excelsior Hotel 2\",\n URL = \"https://i.ibb.co/vBQRHNS/Murder-at-Excelsior-Hotel-Romain-Bayle.jpg\"\n }\n },\n [\"War of the Outer Gods\"] = {\n {\n Name = \"War of the Outer Gods\",\n URL = \"https://i.ibb.co/wLNGFTG/War-of-the-Outer-Gods-Joshua-Cairos.jpg\"\n }\n }\n },\n [\"Fan-Made Campaigns\"] = {\n [\"Cyclopean Foundations\"] = {\n {\n Name = \"I - Lost Moorings 1\",\n URL = \"https://i.ibb.co/DQ76z3c/Cyclopean-1-Lost-Moorings-Care-Line-Art.png\"\n },\n {\n Name = \"I - Lost Moorings 2\",\n URL = \"https://i.ibb.co/c6LJNfr/Cyclopean-1-Lost-Moorings-Jake-Murray.png\"\n },\n {\n Name = \"II - Going Twice\",\n URL = \"https://i.ibb.co/P6h3vbm/Cyclopean-2-Going-Twice-Quentin-Bouilloud.png\"\n },\n {\n Name = \"III - Private Lives\",\n URL = \"https://i.ibb.co/9qK9Fzd/Cyclopean-3-Private-Lives-Christian-Bravery.png\"\n },\n {\n Name = \"IV - Crumbling Masonry 1\",\n URL = \"https://i.ibb.co/pdrGK6p/Cyclopean-4-Crumbling-Masonry-Pete-Amachree.png\"\n },\n {\n Name = \"IV - Crumbling Masonry 2\",\n URL = \"https://i.ibb.co/5RFcGyP/Cyclopean-4-Crumbling-Masonry-Simon-Craghead.png\"\n },\n {\n Name = \"V - Across Dreadful Waters\",\n URL = \"https://i.ibb.co/3mYfFNB/Cyclopean-5-Across-Dreadful-Waters-Ev-Shipard.png\"\n },\n {\n Name = \"VI - Blood From Stones\",\n URL = \"https://i.ibb.co/ynmQNSB/Cyclopean-6-Blood-From-Stones-Marc-Simonetti.png\"\n },\n {\n Name = \"VII - Pyroclastic Flow 1\",\n URL = \"https://i.ibb.co/s1JDkFv/Cyclopean-7-Pyroclastic-Flow-Bastien-Grivet.png\"\n },\n {\n Name = \"VII - Pyroclastic Flow 2\",\n URL = \"https://i.ibb.co/qs8Sk2N/Cyclopean-7-Pyroclastic-Flow-Rachid-Lotf.png\"\n },\n {\n Name = \"VIII - Tomb of Dead Dreams 1\",\n URL = \"https://i.ibb.co/0MwX460/Cyclopean-8-Tomb-of-Dead-Dreams-Guillem-H-Pongiluppi.png\"\n },\n {\n Name = \"VIII - Tomb of Dead Dreams 2\",\n URL = \"https://i.ibb.co/mGnKNcy/Cyclopean-8-Tomb-of-Dead-Dreams-Richard-Benning.png\"\n },\n {\n Name = \"VIII - Tomb of Dead Dreams 3\",\n URL = \"https://i.ibb.co/vmBM8x2/Cyclopean-8-Tomb-of-Dead-Dreams-Walter-Brocca.png\"\n }\n },\n [\"Dark Matter\"] = {\n {\n Name = \"I - Tatterdemalion 1\",\n URL = \"https://i.ibb.co/DRMPGVt/Dark-Matter-1-Tatterdemalion-Andrey-Vozny.jpg\"\n },\n {\n Name = \"I - Tatterdemalion 2\",\n URL = \"https://i.ibb.co/1JzrrX2/Dark-Matter-1-Tatterdemalion-Brian-Taylor.jpg\"\n },\n {\n Name = \"I - Tatterdemalion 3\",\n URL = \"https://i.ibb.co/DzvvgGf/Dark-Matter-1-Tatterdemalion-John-Wallin-Liberto.jpg\"\n },\n {\n Name = \"I - Tatterdemalion 4\",\n URL = \"https://i.ibb.co/sQf85b8/Dark-Matter-1-Tatterdemalion-Paul-Pepera.jpg\"\n },\n {\n Name = \"II - Electric Nightmares 1\",\n URL = \"https://i.ibb.co/hLGVBt7/Dark-Matter-2-Electric-Nightmares-Dean-Lawrence.jpg\"\n },\n {\n Name = \"II - Electric Nightmares 2\",\n URL = \"https://i.ibb.co/cTKZQ61/Dark-Matter-2-Electric-Nightmares-Robert-Thoma.jpg\"\n },\n {\n Name = \"IIIa - Lost Quantum\",\n URL = \"https://i.ibb.co/6vyXv90/Dark-Matter-3-Lost-Quantum-Michael-Rajecki.jpg\"\n },\n {\n Name = \"IIIb - In the Shadow of Earth 1\",\n URL = \"https://i.ibb.co/DfbTKHP/Dark-Matter-4-In-the-Shadow-of-Earth-Jihoo-Kim.jpg\"\n },\n {\n Name = \"IIIb - In the Shadow of Earth 2\",\n URL = \"https://i.ibb.co/MCvPmCb/Dark-Matter-4-In-the-Shadow-of-Earth-N5-Luckybuuncle.jpg\"\n },\n {\n Name = \"IIIc - Strange Moons\",\n URL = \"https://i.ibb.co/b2d8qvg/Dark-Matter-5-Strange-Moons-Hongyu-Yin.jpg\"\n },\n {\n Name = \"V - Fragment of Carcosa 1\",\n URL = \"https://i.ibb.co/7WnTyYT/Dark-Matter-7-Fragment-of-Carcosa-Colin-Moore.jpg\"\n },\n {\n Name = \"V - Fragment of Carcosa 2\",\n URL = \"https://i.ibb.co/mG2Brrd/Dark-Matter-7-Fragments-of-Carcosa-Matthieu-Rebuffat.jpg\"\n },\n {\n Name = \"VI - Starfall 1\",\n URL = \"https://i.ibb.co/CJ3LKL7/Dark-Matter-8-Starfall-Vadim-Sadovski.jpg\"\n },\n {\n Name = \"VI - Starfall 2\",\n URL = \"https://i.ibb.co/Njd1FcB/Dark-Matter-8-Starfall-Vadim-Sadovski-2.jpg\"\n },\n {\n Name = \"VI - Starfall 3\",\n URL = \"https://i.ibb.co/W0Cx7bb/Dark-Matter-8-Starfall-Vadim-Sadovski-3.jpg\"\n }\n },\n [\"The Ghosts of Onigawa\"] = {\n {\n Name = \"I - The Ghosts of Onigawa\",\n URL = \"https://github.com/ArkhamDotCards/theghostsofonigawa/blob/main/product/onigawa-playmat-01.png?raw=true\"\n },\n {\n Name = \"II - In The Shadow Of Mount Kokoro\",\n URL = \"https://github.com/ArkhamDotCards/theghostsofonigawa/blob/main/product/onigawa-playmat-02.png?raw=true\"\n },\n {\n Name = \"III - The Onigawa River\",\n URL = \"https://github.com/ArkhamDotCards/theghostsofonigawa/blob/main/product/onigawa-playmat-03.png?raw=true\"\n },\n {\n Name = \"IV - The Crimson Butterfly\",\n URL = \"https://github.com/ArkhamDotCards/theghostsofonigawa/blob/main/product/onigawa-playmat-04.png?raw=true\"\n },\n {\n Name = \"V - The Koi Conspiracy\",\n URL = \"https://github.com/ArkhamDotCards/theghostsofonigawa/blob/main/product/onigawa-playmat-05.png?raw=true\"\n }\n }\n },\n [\"Fan-Made Scenarios\"] = {\n [\"Side Scenarios (FM)\"] = {\n {\n Name = \"Consternation on the Constellation\",\n URL = \"https://i.ibb.co/Tw2xBP1/Consternation-Constellation.jpg\"\n },\n {\n Name = \"Symphony of Erich Zann\",\n URL = \"https://i.ibb.co/SNr8tqN/Symphony-of-Erich-Zann-Hazel-Yingling.jpg\"\n }\n }\n },\n [\"Other Images\"] = {\n [\"Arkham Locations\"] = {\n {\n Name = \"Downtown 1\",\n URL = \"https://i.ibb.co/FzRk98n/Arkham-Downtown-Cristi-Balanescu.jpg\"\n },\n {\n Name = \"Downtown 2\",\n URL = \"https://i.ibb.co/W2yJ5QZ/Arkham-Downtown-Jokubas-Uogintas.jpg\"\n },\n {\n Name = \"Eastside 1\",\n URL = \"https://i.ibb.co/W3QvdZW/Arkham-Eastside-Cristi-Balanescu.jpg\"\n },\n {\n Name = \"Eastside 2\",\n URL = \"https://i.ibb.co/xfn1Fp8/Arkham-Eastside-Jokubas-Uogintas.jpg\"\n },\n {\n Name = \"French Hill\",\n URL = \"https://i.ibb.co/N7Lk7jc/Arkham-French-Hill-Cristi-Balanescu.jpg\"\n },\n {\n Name = \"Merchant District\",\n URL = \"https://i.ibb.co/HTNCCq4/Arkham-Merchant-District-Jokubas-Uogintas.jpg\"\n },\n {\n Name = \"Generic 1\",\n URL = \"https://i.ibb.co/hswfZD6/Arkham-Guillem-H-Pongiluppi.jpg\"\n },\n {\n Name = \"Generic 2\",\n URL = \"https://i.ibb.co/5h5cMyF/Arkham-Guillem-H-Pongiluppi-2.jpg\"\n },\n {\n Name = \"Generic 3\",\n URL = \"https://i.ibb.co/ZBdVsWt/Arkham-Guillem-H-Pongiluppi-3.jpg\"\n },\n {\n Name = \"Generic 4\",\n URL = \"https://i.ibb.co/6NwbM59/Arkham-Michele-Botticelli.jpg\"\n },\n {\n Name = \"Generic 5\",\n URL = \"https://i.ibb.co/N6sxyq5/Arkham-Mihail-Bila.jpg\"\n },\n {\n Name = \"Generic 6\",\n URL = \"https://i.ibb.co/B393zxv/Arkham-Tomasz-Jedruszek.jpg\"\n },\n {\n Name = \"Generic 7\",\n URL = \"https://i.ibb.co/2WQ2Vt6/Arkham-Tomasz-Jedruszek-2.jpg\"\n },\n {\n Name = \"Generic 8\",\n URL = \"https://i.ibb.co/R7pQ9Y7/Arkham-Tomasz-Jedruszek-3.jpg\"\n },\n {\n Name = \"Miskatonic University\",\n URL = \"https://i.ibb.co/ncz9xjP/Arkham-Miskatonic-University-Jokubas-Uogintas.jpg\"\n },\n {\n Name = \"Northside\",\n URL = \"https://i.ibb.co/sVWx1R3/Arkham-Northside-Jokubas-Uogintas.jpg\"\n },\n {\n Name = \"Rivertown\",\n URL = \"https://i.ibb.co/RyJnHmz/Arkham-Rivertown-Jokubas-Uogintas.jpg\"\n },\n {\n Name = \"Southside\",\n URL = \"https://i.ibb.co/5GW5jg5/Arkham-Southside-Jokubas-Uogintas.jpg\"\n },\n {\n Name = \"Uptown\",\n URL = \"https://i.ibb.co/YXjvkMn/Arkham-Uptown-Jokubas-Uogintas.jpg\"\n }\n },\n [\"Default Image\"] = {\n {\n Name = \"Default Image\",\n URL = \"http://cloud-3.steamusercontent.com/ugc/998015670465071049/FFAE162920D67CF38045EFBD3B85AD0F916147B2/\"\n }\n },\n [\"Unsorted\"] = {\n {\n Name = \"Kingsport\",\n URL = \"https://i.ibb.co/rbkk7ys/Kingsport-Tomasz-Jedruszek.jpg\"\n },\n {\n Name = \"Devil\",\n URL = \"http://cloud-3.steamusercontent.com/ugc/2115062479282248687/DD84A3CB3C4A475A5D093CB413A16A5CEA5FBF79/\"\n },\n {\n Name = \"Mystic Board\",\n URL = \"http://cloud-3.steamusercontent.com/ugc/2115062479282248488/EC27B1215F558A39954C27477D8B4F916CA211E5/\"\n }\n }\n }\n}\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/PlayAreaSelector\")\nend)\nreturn __bundle_require(\"__root\")", + "LuaScriptState": "{\"selectionIndex\":1,\"typeIndex\":1}", "MeasureMovement": false, "Name": "Custom_Token", "Nickname": "Playmat Image Swapper", @@ -87109,6 +90227,251 @@ "Value": 0, "XmlUI": "" }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 9100, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "91": { + "BackIsHidden": true, + "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2223150865961116295/72473371D0DB68709B4B1B9343A748510A1BB30A/", + "NumHeight": 1, + "NumWidth": 1, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"10002\",\n \"type\": \"Event\",\n \"class\": \"Neutral\",\n \"cost\": 2,\n \"traits\": \"Improvised. Upgrade.\",\n \"wildIcons\": 2,\n \"cycle\": \"The Feast of Hemlock Vale\"\n}", + "GUID": "c9fb2f", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "CardCustom", + "Nickname": "Ad Hoc", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tags": [ + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 13.082, + "posY": 3.548, + "posZ": -7.159, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 910300, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "9103": { + "BackIsHidden": true, + "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2223150865961116492/B9D47B63A4285734AC59208BA2F5509EF4B8C138/", + "NumHeight": 1, + "NumWidth": 1, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"10003\",\n \"type\": \"Treachery\",\n \"class\": \"Neutral\",\n \"traits\": \"Blunder.\",\n \"weakness\": true,\n \"cycle\": \"The Feast of Hemlock Vale\"\n}", + "GUID": "0821d5", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "Hasty Repairs", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tags": [ + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 10.69, + "posY": 2.439, + "posZ": 43.876, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 833400, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "8334": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/2223150865961116947/D586147EC3D293A3A1879A4E61CE6FDF3094A746/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2223150865961117168/D42461AB21EC7E1F17DA41E1B6BD58F22E22252B/", + "NumHeight": 1, + "NumWidth": 1, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"10001-m\",\n \"type\": \"Minicard\"\n}", + "GUID": "ceb426", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "CardCustom", + "Nickname": "Wilson Richards", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tags": [ + "Minicard" + ], + "Tooltip": true, + "Transform": { + "posX": 5.756, + "posY": 3.649, + "posZ": 15.392, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.6, + "scaleY": 1, + "scaleZ": 0.6 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 11300, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "113": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/2223150865961116635/ECA77BE1E295589069A336225ED260173BCF349F/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2223150865961116782/ACC14C3F0BA423DF4AE2CDA71BE8B0044ED0DEF0/", + "NumHeight": 1, + "NumWidth": 1, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "The Handyman", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"10001\",\n \"type\": \"Investigator\",\n \"class\": \"Guardian\",\n \"traits\": \"Drifter.\",\n \"willpowerIcons\": 3,\n \"intellectIcons\": 3,\n \"combatIcons\": 3,\n \"agilityIcons\": 3,\n \"cycle\": \"The Feast of Hemlock Vale\"\n}", + "GUID": "54eab5", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "CardCustom", + "Nickname": "Wilson Richards", + "SidewaysCard": true, + "Snap": true, + "Sticky": true, + "Tags": [ + "Investigator", + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 9.227, + "posY": 3.548, + "posZ": 2.42, + "rotX": 0, + "rotY": 180, + "rotZ": 0, + "scaleX": 1.15, + "scaleY": 1, + "scaleZ": 1.15 + }, + "Value": 0, + "XmlUI": "" + }, { "AltLookAngle": { "x": 0, @@ -87418,6 +90781,129 @@ "Value": 0, "XmlUI": "" }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 100, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "1": { + "BackIsHidden": true, + "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2172484009099794816/E5700422279C3B3100E11698F95F7FF2403C6362/", + "NumHeight": 1, + "NumWidth": 1, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"10128\",\n \"type\": \"Asset\",\n \"class\": \"Neutral\",\n \"cost\": 2,\n \"level\": 0,\n \"traits\": \"Ritual.\",\n \"willpowerIcons\": 1,\n \"uses\": [\n {\n \"count\": 4,\n \"type\": \"Charge\",\n \"token\": \"resource\"\n }\n ],\n \"cycle\": \"The Feast of Hemlock Vale\"\n}", + "GUID": "e8765a", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "CardCustom", + "Nickname": "Eldritch Tongue", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tags": [ + "Asset", + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 13, + "posY": 3.5, + "posZ": 6, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 100, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "1": { + "BackIsHidden": true, + "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2172484009099794971/0D542175146E0E2FBBBDCC8110B32A573FDBB03E/", + "NumHeight": 1, + "NumWidth": 1, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"10070\",\n \"type\": \"Event\",\n \"class\": \"Rogue\",\n \"cost\": 1,\n \"level\": 0,\n \"traits\": \"Tactic. Trick.\",\n \"willpowerIcons\": 1,\n \"intellectIcons\": 1,\n \"cycle\": \"The Feast of Hemlock Vale\"\n}", + "GUID": "adf28e", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "CardCustom", + "Nickname": "False Surrender", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tags": [ + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 13.082, + "posY": 3.548, + "posZ": 6.499, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, { "AltLookAngle": { "x": 0, @@ -88315,7 +91801,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = getObjectsWithTag(\"TokenArranger\")[1]\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local MANAGER_GUID = \"5933fb\"\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getObjectFromGUID(MANAGER_GUID)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getObjectFromGUID(MANAGER_GUID).call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/FluteoftheOuterGods4\")\nend)\n__bundle_register(\"playercards/cards/FluteoftheOuterGods4\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Curse\"] = true\n}\n\nSHOW_SINGLE_RELEASE = true\nKEEP_OPEN = true\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getManager()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"BlessCurseManager\")\n end\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getManager()\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getManager().call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getManager().call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getManager().call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getManager().call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getManager().call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/FluteoftheOuterGods4\")\nend)\n__bundle_register(\"playercards/cards/FluteoftheOuterGods4\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Curse\"] = true\n}\n\nSHOW_SINGLE_RELEASE = true\nKEEP_OPEN = true\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenArranger\")\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -88685,7 +92171,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/ShardsoftheVoid3\")\nend)\n__bundle_register(\"playercards/cards/ShardsoftheVoid3\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"0\"] = true\n}\n\nSHOW_SINGLE_RELEASE = true\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = getObjectsWithTag(\"TokenArranger\")[1]\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local MANAGER_GUID = \"5933fb\"\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getObjectFromGUID(MANAGER_GUID)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getObjectFromGUID(MANAGER_GUID).call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/ShardsoftheVoid3\")\nend)\n__bundle_register(\"playercards/cards/ShardsoftheVoid3\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"0\"] = true\n}\n\nSHOW_SINGLE_RELEASE = true\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenArranger\")\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getManager()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"BlessCurseManager\")\n end\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getManager()\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getManager().call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getManager().call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getManager().call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getManager().call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getManager().call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -88993,7 +92479,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/ScrollofSecrets\")\nend)\n__bundle_register(\"playercards/cards/ScrollofSecrets\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- this script is shared between the lvl 0 and lvl 3 versions of Scroll of Secrets\nlocal mythosAreaApi = require(\"core/MythosAreaApi\")\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- get class via metadata and create context menu accordingly\nfunction onLoad()\n local notes = JSON.decode(self.getGMNotes())\n if notes then\n createContextMenu(notes.id)\n else\n print(\"Missing metadata for Scroll of Secrets!\")\n end\nend\n\nfunction createContextMenu(id)\n if id == \"05116\" or id == \"05116-t\" then\n -- lvl 0: draw 1 card from the bottom\n self.addContextMenuItem(\"Draw bottom card\", function(playerColor) contextFunc(playerColor, 1) end)\n elseif id == \"05188\" or id == \"05188-t\" then\n -- seeker lvl 3: draw 3 cards from the bottom\n self.addContextMenuItem(\"Draw bottom card(s)\", function(playerColor) contextFunc(playerColor, 3) end)\n elseif id == \"05189\" or id == \"05189-t\" then\n -- mystic lvl 3: draw 1 card from the bottom\n self.addContextMenuItem(\"Draw bottom card\", function(playerColor) contextFunc(playerColor, 1) end)\n end\nend\n\nfunction contextFunc(playerColor, amount)\n local options = { \"Encounter Deck\" }\n\n -- check for players with a deck and only display them as option\n for _, color in ipairs(Player.getAvailableColors()) do\n local matColor = playmatApi.getMatColor(color)\n local deckAreaObjects = playmatApi.getDeckAreaObjects(matColor)\n\n if deckAreaObjects.draw or deckAreaObjects.topCard then\n table.insert(options, color)\n end\n end\n\n -- show the target selection dialog\n Player[playerColor].showOptionsDialog(\"Select target deck\", options, _, function(owner) drawCardsFromBottom(playerColor, owner, amount) end)\nend\n\nfunction drawCardsFromBottom(playerColor, owner, amount)\n -- variable initialization\n local deck = nil\n local deckSize = 1\n local deckAreaObjects = {}\n\n -- get the respective deck\n if owner == \"Encounter Deck\" then\n deck = mythosAreaApi.getEncounterDeck()\n else\n local matColor = playmatApi.getMatColor(owner)\n deckAreaObjects = playmatApi.getDeckAreaObjects(matColor)\n deck = deckAreaObjects.draw\n end\n\n -- error handling\n if not deck then\n printToColor(\"Couldn't find deck!\", playerColor)\n return\n end\n\n -- set deck size if there is actually a deck and not just a card\n if deck.type == \"Deck\" then\n deckSize = #deck.getObjects()\n end\n\n -- proceed according to deck size\n if deckSize \u003e amount then\n for i = 1, amount do\n local card = deck.takeObject({ top = false, flip = true })\n card.deal(1, playerColor)\n end\n else\n -- deal the whole deck\n deck.deal(amount, playerColor)\n\n if deckSize \u003c amount then\n -- Norman Withers handling\n if deckAreaObjects.topCard then\n deckAreaObjects.topCard.deal(1, playerColor)\n deckSize = deckSize + 1\n end\n\n -- warning message for player\n if deckSize \u003c amount then\n printToColor(\"Deck didn't contain enough cards.\", playerColor)\n end\n end\n end\n printToColor(\"Handle the drawn cards according to the ability text on 'Scroll of Secrets'.\", playerColor)\nend\nend)\n__bundle_register(\"core/MythosAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local MythosAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getMythosArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"MythosArea\")\n end\n\n -- returns the chaos token metadata (if provided through scenario reference card)\n MythosAreaApi.returnTokenData = function()\n return getMythosArea().call(\"returnTokenData\")\n end\n \n -- returns an object reference to the encounter deck\n MythosAreaApi.getEncounterDeck = function()\n return getMythosArea().call(\"getEncounterDeck\")\n end\n\n -- draw an encounter card to the requested position/rotation\n MythosAreaApi.drawEncounterCard = function(pos, rotY, alwaysFaceUp)\n getMythosArea().call(\"drawEncounterCard\", {\n pos = pos,\n rotY = rotY,\n alwaysFaceUp = alwaysFaceUp\n })\n end\n\n return MythosAreaApi\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -89664,7 +93150,7 @@ }, "Description": "Advanced", "DragSelectable": true, - "GMNotes": "{\r\n \"id\": \"90010\",\r\n \"type\": \"Treachery\",\r\n \"class\": \"Neutral\",\r\n \"traits\": \"Task.\",\r\n \"weakness\": true,\r\n \"cycle\": \"Standalone\"\r\n}\r", + "GMNotes": "{\n \"id\": \"90010\",\n \"type\": \"Treachery\",\n \"class\": \"Neutral\",\n \"traits\": \"Task.\",\n \"weakness\": true,\n \"uses\": [\n {\n \"count\": 0,\n \"type\": \"Resource\",\n \"token\": \"resource\"\n }\n ],\n \"cycle\": \"Standalone\"\n}", "GUID": "bd323d", "Grid": true, "GridProjection": false, @@ -94403,7 +97889,7 @@ "UniqueBack": false } }, - "Description": "", + "Description": "Symbol of Righteousness", "DragSelectable": true, "GMNotes": "{\r\n \"id\": \"02006\",\r\n \"type\": \"Asset\",\r\n \"class\": \"Neutral\",\r\n \"cost\": 1,\r\n \"traits\": \"Item. Charm.\",\r\n \"combatIcons\": 2,\r\n \"wildIcons\": 1,\r\n \"cycle\": \"The Dunwich Legacy\"\r\n}\r", "GUID": "66d810", @@ -94441,6 +97927,68 @@ "Value": 0, "XmlUI": "" }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 853100, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "8531": { + "BackIsHidden": true, + "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115062479282090841/27F874D8E240CE62A38A47DDFAAF58D3BD4D0C42/", + "NumHeight": 2, + "NumWidth": 2, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "Symbol of Conviction (Advanced)", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"90060\",\n \"type\": \"Asset\",\n \"class\": \"Neutral\",\n \"cost\": 1,\n \"traits\": \"Item. Charm.\",\n \"combatIcons\": 2,\n \"wildIcons\": 1,\n \"cycle\": \"Path of the Righteous\"\n}", + "GUID": "66d811", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "Zoey's Cross", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tags": [ + "Asset", + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 8.971, + "posY": 4.114, + "posZ": -16.689, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, { "AltLookAngle": { "x": 0, @@ -94907,7 +98455,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playercards/cards/CrystallineElderSign3\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"+1\"] = true,\n [\"Elder Sign\"] = true\n}\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = getObjectsWithTag(\"TokenArranger\")[1]\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local MANAGER_GUID = \"5933fb\"\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getObjectFromGUID(MANAGER_GUID)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getObjectFromGUID(MANAGER_GUID).call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/CrystallineElderSign3\")\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playercards/cards/CrystallineElderSign3\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"+1\"] = true,\n [\"Elder Sign\"] = true\n}\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenArranger\")\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getManager()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"BlessCurseManager\")\n end\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getManager()\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getManager().call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getManager().call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getManager().call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getManager().call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getManager().call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/CrystallineElderSign3\")\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -95400,7 +98948,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/WellConnected\")\nend)\n__bundle_register(\"playercards/cards/WellConnected\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- this script is shared between both the level 0 and the upgraded level 3 version of the card\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\nlocal display = false\nlocal count = 0\nlocal modValue = 5 -- level 0 Well Connected\nlocal loopId = nil\n\nlocal b_display = {\n click_function = \"toggleCounter\",\n function_owner = self,\n position = {0.88,0.5,-1.33},\n font_size = 150,\n width = 175,\n height = 175\n}\n\nfunction onLoad(saved_data)\n local notes = JSON.decode(self.getGMNotes())\n\n if notes.id == \"54006\" then -- hardcoded card id for upgraded Well Connected (3)\n modValue = 4 -- Well Connected (3)\n end\n\n if saved_data != '' then\n local loaded_data = JSON.decode(saved_data)\n display = not loaded_data.saved_display\n\n self.clearButtons()\n toggleCounter()\n end\n \n self.addContextMenuItem('Toggle Counter', toggleCounter)\nend\n\nfunction onSave()\n return JSON.encode({saved_display = display})\nend\n\nfunction toggleCounter()\n display = not display\n\n if display then\n createUpdateDisplay()\n loopId = Wait.time(|| createUpdateDisplay(), 2, -1)\n else\n if loopId ~= nil then\n Wait.stop(loopId)\n end\n \n self.clearButtons()\n loopId = nil\n end\nend\n\nfunction createUpdateDisplay()\n count = math.max(math.floor(getPlayerResources() / modValue), 0)\n\n b_display.label = tostring(count)\n\n if loopId == nil then\n self.createButton(b_display)\n else\n self.editButton(b_display)\n end\nend\n\nfunction getPlayerResources()\n local matColor = playmatApi.getMatColorByPosition(self.getPosition())\n\n return playmatApi.getResourceCount(matColor)\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/WellConnected\")\nend)\n__bundle_register(\"playercards/cards/WellConnected\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- this script is shared between both the level 0 and the upgraded level 3 version of the card\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\nlocal modValue, loopId\nlocal buttonParameters = {\n click_function = \"toggleCounter\",\n tooltip = \"disable counter\",\n function_owner = self,\n position = { 0.88, 0.5, -1.33 },\n font_size = 150,\n width = 175,\n height = 175\n}\n\nfunction onSave() return JSON.encode({ loopId = loopId }) end\n\nfunction onLoad(savedData)\n -- use metadata to detect level and adjust modValue accordingly\n if JSON.decode(self.getGMNotes()).level == 0 then\n modValue = 5\n else\n modValue = 4\n end\n\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.loopId then\n self.createButton(buttonParameters)\n loopId = Wait.time(updateDisplay, 2, -1)\n end\n end\n\n self.addContextMenuItem(\"Toggle Counter\", toggleCounter)\nend\n\nfunction toggleCounter()\n if loopId ~= nil then\n Wait.stop(loopId)\n loopId = nil\n self.clearButtons()\n else\n self.createButton(buttonParameters)\n updateDisplay()\n loopId = Wait.time(updateDisplay, 2, -1)\n end\nend\n\nfunction updateDisplay()\n local matColor = playmatApi.getMatColorByPosition(self.getPosition())\n local resources = playmatApi.getCounterValue(matColor, \"ResourceCounter\")\n local count = tostring(math.floor(resources / modValue))\n self.editButton({ index = 0, label = count })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -97362,7 +100910,7 @@ }, "Description": "", "DragSelectable": true, - "GMNotes": "{\r\n \"id\": \"03239\",\r\n \"type\": \"Event\",\r\n \"class\": \"Neutral\",\r\n \"cost\": 0,\r\n \"level\": 3,\r\n \"traits\": \"Supply.\",\r\n \"cycle\": \"The Path to Carcosa\"\r\n}\r", + "GMNotes": "{\n \"id\": \"03239\",\n \"type\": \"Event\",\n \"class\": \"Neutral\",\n \"cost\": 0,\n \"level\": 3,\n \"traits\": \"Supply.\",\n \"uses\": [\n {\n \"count\": 4,\n \"type\": \"Supply\",\n \"token\": \"resource\"\n }\n ],\n \"cycle\": \"The Path to Carcosa\"\n}", "GUID": "408cb5", "Grid": true, "GridProjection": false, @@ -99524,7 +103072,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/ShieldofFaith2\")\nend)\n__bundle_register(\"playercards/cards/ShieldofFaith2\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Bless\"] = true\n}\n\nSHOW_SINGLE_RELEASE = true\nKEEP_OPEN = true\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = getObjectsWithTag(\"TokenArranger\")[1]\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local MANAGER_GUID = \"5933fb\"\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getObjectFromGUID(MANAGER_GUID)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getObjectFromGUID(MANAGER_GUID).call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/ShieldofFaith2\")\nend)\n__bundle_register(\"playercards/cards/ShieldofFaith2\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Bless\"] = true\n}\n\nSHOW_SINGLE_RELEASE = true\nKEEP_OPEN = true\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenArranger\")\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getManager()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"BlessCurseManager\")\n end\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getManager()\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getManager().call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getManager().call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getManager().call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getManager().call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getManager().call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -101916,7 +105464,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/ScrollofSecrets\")\nend)\n__bundle_register(\"playercards/cards/ScrollofSecrets\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- this script is shared between the lvl 0 and lvl 3 versions of Scroll of Secrets\nlocal mythosAreaApi = require(\"core/MythosAreaApi\")\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- get class via metadata and create context menu accordingly\nfunction onLoad()\n local notes = JSON.decode(self.getGMNotes())\n if notes then\n createContextMenu(notes.id)\n else\n print(\"Missing metadata for Scroll of Secrets!\")\n end\nend\n\nfunction createContextMenu(id)\n if id == \"05116\" or id == \"05116-t\" then\n -- lvl 0: draw 1 card from the bottom\n self.addContextMenuItem(\"Draw bottom card\", function(playerColor) contextFunc(playerColor, 1) end)\n elseif id == \"05188\" or id == \"05188-t\" then\n -- seeker lvl 3: draw 3 cards from the bottom\n self.addContextMenuItem(\"Draw bottom card(s)\", function(playerColor) contextFunc(playerColor, 3) end)\n elseif id == \"05189\" or id == \"05189-t\" then\n -- mystic lvl 3: draw 1 card from the bottom\n self.addContextMenuItem(\"Draw bottom card\", function(playerColor) contextFunc(playerColor, 1) end)\n end\nend\n\nfunction contextFunc(playerColor, amount)\n local options = { \"Encounter Deck\" }\n\n -- check for players with a deck and only display them as option\n for _, color in ipairs(Player.getAvailableColors()) do\n local matColor = playmatApi.getMatColor(color)\n local deckAreaObjects = playmatApi.getDeckAreaObjects(matColor)\n\n if deckAreaObjects.draw or deckAreaObjects.topCard then\n table.insert(options, color)\n end\n end\n\n -- show the target selection dialog\n Player[playerColor].showOptionsDialog(\"Select target deck\", options, _, function(owner) drawCardsFromBottom(playerColor, owner, amount) end)\nend\n\nfunction drawCardsFromBottom(playerColor, owner, amount)\n -- variable initialization\n local deck = nil\n local deckSize = 1\n local deckAreaObjects = {}\n\n -- get the respective deck\n if owner == \"Encounter Deck\" then\n deck = mythosAreaApi.getEncounterDeck()\n else\n local matColor = playmatApi.getMatColor(owner)\n deckAreaObjects = playmatApi.getDeckAreaObjects(matColor)\n deck = deckAreaObjects.draw\n end\n\n -- error handling\n if not deck then\n printToColor(\"Couldn't find deck!\", playerColor)\n return\n end\n\n -- set deck size if there is actually a deck and not just a card\n if deck.type == \"Deck\" then\n deckSize = #deck.getObjects()\n end\n\n -- proceed according to deck size\n if deckSize \u003e amount then\n for i = 1, amount do\n local card = deck.takeObject({ top = false, flip = true })\n card.deal(1, playerColor)\n end\n else\n -- deal the whole deck\n deck.deal(amount, playerColor)\n\n if deckSize \u003c amount then\n -- Norman Withers handling\n if deckAreaObjects.topCard then\n deckAreaObjects.topCard.deal(1, playerColor)\n deckSize = deckSize + 1\n end\n\n -- warning message for player\n if deckSize \u003c amount then\n printToColor(\"Deck didn't contain enough cards.\", playerColor)\n end\n end\n end\n printToColor(\"Handle the drawn cards according to the ability text on 'Scroll of Secrets'.\", playerColor)\nend\nend)\n__bundle_register(\"core/MythosAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local MythosAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getMythosArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"MythosArea\")\n end\n\n -- returns the chaos token metadata (if provided through scenario reference card)\n MythosAreaApi.returnTokenData = function()\n return getMythosArea().call(\"returnTokenData\")\n end\n \n -- returns an object reference to the encounter deck\n MythosAreaApi.getEncounterDeck = function()\n return getMythosArea().call(\"getEncounterDeck\")\n end\n\n -- draw an encounter card to the requested position/rotation\n MythosAreaApi.drawEncounterCard = function(pos, rotY, alwaysFaceUp)\n getMythosArea().call(\"drawEncounterCard\", {\n pos = pos,\n rotY = rotY,\n alwaysFaceUp = alwaysFaceUp\n })\n end\n\n return MythosAreaApi\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -104009,7 +107557,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = getObjectsWithTag(\"TokenArranger\")[1]\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local MANAGER_GUID = \"5933fb\"\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getObjectFromGUID(MANAGER_GUID)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getObjectFromGUID(MANAGER_GUID).call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/RiteofSanctification\")\nend)\n__bundle_register(\"playercards/cards/RiteofSanctification\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Bless\"] = true\n}\n\nSHOW_SINGLE_RELEASE = true\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/RiteofSanctification\")\nend)\n__bundle_register(\"playercards/cards/RiteofSanctification\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Bless\"] = true\n}\n\nSHOW_SINGLE_RELEASE = true\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenArranger\")\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getManager()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"BlessCurseManager\")\n end\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getManager()\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getManager().call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getManager().call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getManager().call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getManager().call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getManager().call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -104182,7 +107730,7 @@ "UniqueBack": false } }, - "Description": "", + "Description": "The Dead Listen", "DragSelectable": true, "GMNotes": "{\r\n \"id\": \"02012\",\r\n \"type\": \"Asset\",\r\n \"class\": \"Neutral\",\r\n \"cost\": 2,\r\n \"traits\": \"Item. Instrument. Relic.\",\r\n \"willpowerIcons\": 2,\r\n \"wildIcons\": 1,\r\n \"cycle\": \"The Dunwich Legacy\"\r\n}\r", "GUID": "03c6a7", @@ -104626,7 +108174,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = getObjectsWithTag(\"TokenArranger\")[1]\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local MANAGER_GUID = \"5933fb\"\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getObjectFromGUID(MANAGER_GUID)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getObjectFromGUID(MANAGER_GUID).call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/TheCodexofAges\")\nend)\n__bundle_register(\"playercards/cards/TheCodexofAges\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Elder Sign\"] = true\n}\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/TheCodexofAges\")\nend)\n__bundle_register(\"playercards/cards/TheCodexofAges\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Elder Sign\"] = true\n}\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenArranger\")\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getManager()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"BlessCurseManager\")\n end\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getManager()\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getManager().call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getManager().call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getManager().call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getManager().call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getManager().call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -105613,7 +109161,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = getObjectsWithTag(\"TokenArranger\")[1]\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local MANAGER_GUID = \"5933fb\"\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getObjectFromGUID(MANAGER_GUID)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getObjectFromGUID(MANAGER_GUID).call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/ProtectiveIncantation1\")\nend)\n__bundle_register(\"playercards/cards/ProtectiveIncantation1\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {}\n\nINVALID_TOKENS = {\n [\"Auto-fail\"] = true\n}\n\nUPDATE_ON_HOVER = true\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playercards/cards/ProtectiveIncantation1\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {}\n\nINVALID_TOKENS = {\n [\"Auto-fail\"] = true\n}\n\nUPDATE_ON_HOVER = true\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenArranger\")\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getManager()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"BlessCurseManager\")\n end\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getManager()\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getManager().call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getManager().call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getManager().call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getManager().call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getManager().call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/ProtectiveIncantation1\")\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -106229,7 +109777,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local MANAGER_GUID = \"5933fb\"\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getObjectFromGUID(MANAGER_GUID)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getObjectFromGUID(MANAGER_GUID).call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/FavoroftheMoon1\")\nend)\n__bundle_register(\"playercards/cards/FavoroftheMoon1\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Curse\"] = true\n}\n\nSHOW_SINGLE_RELEASE = true\nKEEP_OPEN = true\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = getObjectsWithTag(\"TokenArranger\")[1]\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenArranger\")\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getManager()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"BlessCurseManager\")\n end\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getManager()\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getManager().call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getManager().call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getManager().call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getManager().call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getManager().call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/FavoroftheMoon1\")\nend)\n__bundle_register(\"playercards/cards/FavoroftheMoon1\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Curse\"] = true\n}\n\nSHOW_SINGLE_RELEASE = true\nKEEP_OPEN = true\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -107215,7 +110763,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/ScrollofSecrets\")\nend)\n__bundle_register(\"playercards/cards/ScrollofSecrets\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- this script is shared between the lvl 0 and lvl 3 versions of Scroll of Secrets\nlocal mythosAreaApi = require(\"core/MythosAreaApi\")\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- get class via metadata and create context menu accordingly\nfunction onLoad()\n local notes = JSON.decode(self.getGMNotes())\n if notes then\n createContextMenu(notes.id)\n else\n print(\"Missing metadata for Scroll of Secrets!\")\n end\nend\n\nfunction createContextMenu(id)\n if id == \"05116\" or id == \"05116-t\" then\n -- lvl 0: draw 1 card from the bottom\n self.addContextMenuItem(\"Draw bottom card\", function(playerColor) contextFunc(playerColor, 1) end)\n elseif id == \"05188\" or id == \"05188-t\" then\n -- seeker lvl 3: draw 3 cards from the bottom\n self.addContextMenuItem(\"Draw bottom card(s)\", function(playerColor) contextFunc(playerColor, 3) end)\n elseif id == \"05189\" or id == \"05189-t\" then\n -- mystic lvl 3: draw 1 card from the bottom\n self.addContextMenuItem(\"Draw bottom card\", function(playerColor) contextFunc(playerColor, 1) end)\n end\nend\n\nfunction contextFunc(playerColor, amount)\n local options = { \"Encounter Deck\" }\n\n -- check for players with a deck and only display them as option\n for _, color in ipairs(Player.getAvailableColors()) do\n local matColor = playmatApi.getMatColor(color)\n local deckAreaObjects = playmatApi.getDeckAreaObjects(matColor)\n\n if deckAreaObjects.draw or deckAreaObjects.topCard then\n table.insert(options, color)\n end\n end\n\n -- show the target selection dialog\n Player[playerColor].showOptionsDialog(\"Select target deck\", options, _, function(owner) drawCardsFromBottom(playerColor, owner, amount) end)\nend\n\nfunction drawCardsFromBottom(playerColor, owner, amount)\n -- variable initialization\n local deck = nil\n local deckSize = 1\n local deckAreaObjects = {}\n\n -- get the respective deck\n if owner == \"Encounter Deck\" then\n deck = mythosAreaApi.getEncounterDeck()\n else\n local matColor = playmatApi.getMatColor(owner)\n deckAreaObjects = playmatApi.getDeckAreaObjects(matColor)\n deck = deckAreaObjects.draw\n end\n\n -- error handling\n if not deck then\n printToColor(\"Couldn't find deck!\", playerColor)\n return\n end\n\n -- set deck size if there is actually a deck and not just a card\n if deck.type == \"Deck\" then\n deckSize = #deck.getObjects()\n end\n\n -- proceed according to deck size\n if deckSize \u003e amount then\n for i = 1, amount do\n local card = deck.takeObject({ top = false, flip = true })\n card.deal(1, playerColor)\n end\n else\n -- deal the whole deck\n deck.deal(amount, playerColor)\n\n if deckSize \u003c amount then\n -- Norman Withers handling\n if deckAreaObjects.topCard then\n deckAreaObjects.topCard.deal(1, playerColor)\n deckSize = deckSize + 1\n end\n\n -- warning message for player\n if deckSize \u003c amount then\n printToColor(\"Deck didn't contain enough cards.\", playerColor)\n end\n end\n end\n printToColor(\"Handle the drawn cards according to the ability text on 'Scroll of Secrets'.\", playerColor)\nend\nend)\n__bundle_register(\"core/MythosAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local MythosAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getMythosArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"MythosArea\")\n end\n\n -- returns the chaos token metadata (if provided through scenario reference card)\n MythosAreaApi.returnTokenData = function()\n return getMythosArea().call(\"returnTokenData\")\n end\n \n -- returns an object reference to the encounter deck\n MythosAreaApi.getEncounterDeck = function()\n return getMythosArea().call(\"getEncounterDeck\")\n end\n\n -- draw an encounter card to the requested position/rotation\n MythosAreaApi.drawEncounterCard = function(pos, rotY, alwaysFaceUp)\n getMythosArea().call(\"drawEncounterCard\", {\n pos = pos,\n rotY = rotY,\n alwaysFaceUp = alwaysFaceUp\n })\n end\n\n return MythosAreaApi\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -107277,7 +110825,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playercards/cards/Nephthys4\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Bless\"] = true\n}\n\nSHOW_MULTI_RELEASE = 3\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = getObjectsWithTag(\"TokenArranger\")[1]\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local MANAGER_GUID = \"5933fb\"\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getObjectFromGUID(MANAGER_GUID)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getObjectFromGUID(MANAGER_GUID).call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/Nephthys4\")\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/Nephthys4\")\nend)\n__bundle_register(\"playercards/cards/Nephthys4\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Bless\"] = true\n}\n\nSHOW_MULTI_RELEASE = 3\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenArranger\")\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getManager()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"BlessCurseManager\")\n end\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getManager()\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getManager().call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getManager().call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getManager().call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getManager().call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getManager().call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -108202,7 +111750,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/Unrelenting1\")\nend)\n__bundle_register(\"playercards/cards/Unrelenting1\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {}\nINVALID_TOKENS = {\n [\"Auto-fail\"] = true\n}\n\nUPDATE_ON_HOVER = true\nKEEP_OPEN = true\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = getObjectsWithTag(\"TokenArranger\")[1]\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local MANAGER_GUID = \"5933fb\"\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getObjectFromGUID(MANAGER_GUID)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getObjectFromGUID(MANAGER_GUID).call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/Unrelenting1\")\nend)\n__bundle_register(\"playercards/cards/Unrelenting1\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {}\nINVALID_TOKENS = {\n [\"Auto-fail\"] = true\n}\n\nUPDATE_ON_HOVER = true\nKEEP_OPEN = true\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenArranger\")\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getManager()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"BlessCurseManager\")\n end\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getManager()\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getManager().call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getManager().call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getManager().call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getManager().call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getManager().call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -109210,6 +112758,67 @@ "Value": 0, "XmlUI": "" }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 853101, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "8531": { + "BackIsHidden": true, + "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115062479282090841/27F874D8E240CE62A38A47DDFAAF58D3BD4D0C42/", + "NumHeight": 2, + "NumWidth": 2, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "Advanced", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"90061\",\n \"type\": \"Treachery\",\n \"class\": \"Neutral\",\n \"traits\": \"Task.\",\n \"weakness\": true,\n \"cycle\": \"Path of the Righteous\"\n}", + "GUID": "58f535", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "Smite the Wicked", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tags": [ + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 9.014, + "posY": 3.991, + "posZ": -16.698, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, { "AltLookAngle": { "x": 0, @@ -111336,7 +114945,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/TheChthonianStone3\")\nend)\n__bundle_register(\"playercards/cards/TheChthonianStone3\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Skull\"] = true,\n [\"Cultist\"] = true,\n [\"Tablet\"] = true,\n [\"Elder Thing\"] = true,\n}\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = getObjectsWithTag(\"TokenArranger\")[1]\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local MANAGER_GUID = \"5933fb\"\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getObjectFromGUID(MANAGER_GUID)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getObjectFromGUID(MANAGER_GUID).call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/TheChthonianStone3\")\nend)\n__bundle_register(\"playercards/cards/TheChthonianStone3\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Skull\"] = true,\n [\"Cultist\"] = true,\n [\"Tablet\"] = true,\n [\"Elder Thing\"] = true,\n}\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenArranger\")\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getManager()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"BlessCurseManager\")\n end\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getManager()\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getManager().call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getManager().call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getManager().call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getManager().call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getManager().call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -122599,7 +126208,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = getObjectsWithTag(\"TokenArranger\")[1]\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local MANAGER_GUID = \"5933fb\"\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getObjectFromGUID(MANAGER_GUID)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getObjectFromGUID(MANAGER_GUID).call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/FavoroftheSun1\")\nend)\n__bundle_register(\"playercards/cards/FavoroftheSun1\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Bless\"] = true\n}\n\nSHOW_SINGLE_RELEASE = true\nKEEP_OPEN = true\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/FavoroftheSun1\")\nend)\n__bundle_register(\"playercards/cards/FavoroftheSun1\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Bless\"] = true\n}\n\nSHOW_SINGLE_RELEASE = true\nKEEP_OPEN = true\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenArranger\")\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getManager()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"BlessCurseManager\")\n end\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getManager()\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getManager().call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getManager().call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getManager().call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getManager().call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getManager().call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -123341,7 +126950,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/WellConnected\")\nend)\n__bundle_register(\"playercards/cards/WellConnected\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- this script is shared between both the level 0 and the upgraded level 3 version of the card\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\nlocal display = false\nlocal count = 0\nlocal modValue = 5 -- level 0 Well Connected\nlocal loopId = nil\n\nlocal b_display = {\n click_function = \"toggleCounter\",\n function_owner = self,\n position = {0.88,0.5,-1.33},\n font_size = 150,\n width = 175,\n height = 175\n}\n\nfunction onLoad(saved_data)\n local notes = JSON.decode(self.getGMNotes())\n\n if notes.id == \"54006\" then -- hardcoded card id for upgraded Well Connected (3)\n modValue = 4 -- Well Connected (3)\n end\n\n if saved_data != '' then\n local loaded_data = JSON.decode(saved_data)\n display = not loaded_data.saved_display\n\n self.clearButtons()\n toggleCounter()\n end\n \n self.addContextMenuItem('Toggle Counter', toggleCounter)\nend\n\nfunction onSave()\n return JSON.encode({saved_display = display})\nend\n\nfunction toggleCounter()\n display = not display\n\n if display then\n createUpdateDisplay()\n loopId = Wait.time(|| createUpdateDisplay(), 2, -1)\n else\n if loopId ~= nil then\n Wait.stop(loopId)\n end\n \n self.clearButtons()\n loopId = nil\n end\nend\n\nfunction createUpdateDisplay()\n count = math.max(math.floor(getPlayerResources() / modValue), 0)\n\n b_display.label = tostring(count)\n\n if loopId == nil then\n self.createButton(b_display)\n else\n self.editButton(b_display)\n end\nend\n\nfunction getPlayerResources()\n local matColor = playmatApi.getMatColorByPosition(self.getPosition())\n\n return playmatApi.getResourceCount(matColor)\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playercards/cards/WellConnected\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- this script is shared between both the level 0 and the upgraded level 3 version of the card\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\nlocal modValue, loopId\nlocal buttonParameters = {\n click_function = \"toggleCounter\",\n tooltip = \"disable counter\",\n function_owner = self,\n position = { 0.88, 0.5, -1.33 },\n font_size = 150,\n width = 175,\n height = 175\n}\n\nfunction onSave() return JSON.encode({ loopId = loopId }) end\n\nfunction onLoad(savedData)\n -- use metadata to detect level and adjust modValue accordingly\n if JSON.decode(self.getGMNotes()).level == 0 then\n modValue = 5\n else\n modValue = 4\n end\n\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.loopId then\n self.createButton(buttonParameters)\n loopId = Wait.time(updateDisplay, 2, -1)\n end\n end\n\n self.addContextMenuItem(\"Toggle Counter\", toggleCounter)\nend\n\nfunction toggleCounter()\n if loopId ~= nil then\n Wait.stop(loopId)\n loopId = nil\n self.clearButtons()\n else\n self.createButton(buttonParameters)\n updateDisplay()\n loopId = Wait.time(updateDisplay, 2, -1)\n end\nend\n\nfunction updateDisplay()\n local matColor = playmatApi.getMatColorByPosition(self.getPosition())\n local resources = playmatApi.getCounterValue(matColor, \"ResourceCounter\")\n local count = tostring(math.floor(resources / modValue))\n self.editButton({ index = 0, label = count })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/WellConnected\")\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -124141,7 +127750,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/TheChthonianStone\")\nend)\n__bundle_register(\"playercards/cards/TheChthonianStone\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Skull\"] = true,\n [\"Cultist\"] = true,\n [\"Tablet\"] = true,\n [\"Elder Thing\"] = true,\n}\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = getObjectsWithTag(\"TokenArranger\")[1]\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local MANAGER_GUID = \"5933fb\"\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getObjectFromGUID(MANAGER_GUID)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getObjectFromGUID(MANAGER_GUID).call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/TheChthonianStone\")\nend)\n__bundle_register(\"playercards/cards/TheChthonianStone\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Skull\"] = true,\n [\"Cultist\"] = true,\n [\"Tablet\"] = true,\n [\"Elder Thing\"] = true,\n}\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenArranger\")\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getManager()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"BlessCurseManager\")\n end\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getManager()\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getManager().call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getManager().call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getManager().call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getManager().call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getManager().call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -129807,7 +133416,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/HolySpear5\")\nend)\n__bundle_register(\"playercards/cards/HolySpear5\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Bless\"] = true\n}\n\nSHOW_SINGLE_RELEASE = true\nSHOW_MULTI_SEAL = 2\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = getObjectsWithTag(\"TokenArranger\")[1]\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local MANAGER_GUID = \"5933fb\"\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getObjectFromGUID(MANAGER_GUID)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getObjectFromGUID(MANAGER_GUID).call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getManager()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"BlessCurseManager\")\n end\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getManager()\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getManager().call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getManager().call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getManager().call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getManager().call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getManager().call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/HolySpear5\")\nend)\n__bundle_register(\"playercards/cards/HolySpear5\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Bless\"] = true\n}\n\nSHOW_SINGLE_RELEASE = true\nSHOW_MULTI_SEAL = 2\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenArranger\")\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -131372,6 +134981,68 @@ "Value": 0, "XmlUI": "" }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 91200, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "912": { + "BackIsHidden": true, + "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2195002645140651764/97A66D51D85628992E10826FF866E96E310FB177/", + "NumHeight": 1, + "NumWidth": 1, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "Tried Everything Once", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"10097\",\n \"type\": \"Asset\",\n \"class\": \"Mystic\",\n \"cost\": 2,\n \"level\": 2,\n \"traits\": \"Ally. Witch.\",\n \"willpowerIcons\": 2,\n \"cycle\": \"The Feast of Hemlock Vale\"\n}", + "GUID": "9683d2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "Olive McBride", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tags": [ + "Asset", + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 9.134, + "posY": 3.792, + "posZ": -16.723, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, { "AltLookAngle": { "x": 0, @@ -136763,7 +140434,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local MANAGER_GUID = \"5933fb\"\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getObjectFromGUID(MANAGER_GUID)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getObjectFromGUID(MANAGER_GUID).call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/SerpentsofYig\")\nend)\n__bundle_register(\"playercards/cards/SerpentsofYig\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Elder Sign\"] = true\n}\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = getObjectsWithTag(\"TokenArranger\")[1]\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/SerpentsofYig\")\nend)\n__bundle_register(\"playercards/cards/SerpentsofYig\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Elder Sign\"] = true\n}\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenArranger\")\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getManager()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"BlessCurseManager\")\n end\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getManager()\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getManager().call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getManager().call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getManager().call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getManager().call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getManager().call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -137254,7 +140925,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = getObjectsWithTag(\"TokenArranger\")[1]\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local MANAGER_GUID = \"5933fb\"\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getObjectFromGUID(MANAGER_GUID)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getObjectFromGUID(MANAGER_GUID).call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/SealoftheSeventhSign5\")\nend)\n__bundle_register(\"playercards/cards/SealoftheSeventhSign5\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Auto-fail\"] = true\n}\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/SealoftheSeventhSign5\")\nend)\n__bundle_register(\"playercards/cards/SealoftheSeventhSign5\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Auto-fail\"] = true\n}\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenArranger\")\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getManager()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"BlessCurseManager\")\n end\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getManager()\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getManager().call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getManager().call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getManager().call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getManager().call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getManager().call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -138176,7 +141847,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/RadiantSmite1\")\nend)\n__bundle_register(\"playercards/cards/RadiantSmite1\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Bless\"] = true\n}\n\nKEEP_OPEN = true\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = getObjectsWithTag(\"TokenArranger\")[1]\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local MANAGER_GUID = \"5933fb\"\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getObjectFromGUID(MANAGER_GUID)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getObjectFromGUID(MANAGER_GUID).call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getManager()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"BlessCurseManager\")\n end\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getManager()\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getManager().call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getManager().call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getManager().call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getManager().call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getManager().call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/RadiantSmite1\")\nend)\n__bundle_register(\"playercards/cards/RadiantSmite1\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Bless\"] = true\n}\n\nKEEP_OPEN = true\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenArranger\")\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -139713,7 +143384,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/DayofReckoning\")\nend)\n__bundle_register(\"playercards/cards/DayofReckoning\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Elder Sign\"] = true\n}\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = getObjectsWithTag(\"TokenArranger\")[1]\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local MANAGER_GUID = \"5933fb\"\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getObjectFromGUID(MANAGER_GUID)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getObjectFromGUID(MANAGER_GUID).call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenArranger\")\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getManager()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"BlessCurseManager\")\n end\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getManager()\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getManager().call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getManager().call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getManager().call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getManager().call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getManager().call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/DayofReckoning\")\nend)\n__bundle_register(\"playercards/cards/DayofReckoning\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Elder Sign\"] = true\n}\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -142854,7 +146525,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local MANAGER_GUID = \"5933fb\"\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getObjectFromGUID(MANAGER_GUID)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getObjectFromGUID(MANAGER_GUID).call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/DarkRitual\")\nend)\n__bundle_register(\"playercards/cards/DarkRitual\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Curse\"] = true\n}\n\nKEEP_OPEN = true\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = getObjectsWithTag(\"TokenArranger\")[1]\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/DarkRitual\")\nend)\n__bundle_register(\"playercards/cards/DarkRitual\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Curse\"] = true\n}\n\nKEEP_OPEN = true\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenArranger\")\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getManager()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"BlessCurseManager\")\n end\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getManager()\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getManager().call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getManager().call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getManager().call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getManager().call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getManager().call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -143099,7 +146770,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/FamilyInheritance\")\nend)\n__bundle_register(\"playercards/cards/FamilyInheritance\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal tokenManager = require(\"core/token/TokenManager\")\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\nlocal clickableResourceCounter = nil\nlocal foundTokens = 0\n\nfunction onLoad()\n self.addContextMenuItem(\"Add 4 resources\", function(playerColor) add4(playerColor) end)\n self.addContextMenuItem(\"Take all resources\", function(playerColor) takeAll(playerColor) end)\n self.addContextMenuItem(\"Discard all resources\", function(playerColor) loseAll(playerColor) end)\nend\n\nfunction searchSelf()\n clickableResourceCounter = nil\n foundTokens = 0\n\n for _, obj in ipairs(searchArea(self.getPosition(), { 2.5, 0.5, 3.5 })) do\n local obj = obj.hit_object\n if obj.getCustomObject().image ==\n \"http://cloud-3.steamusercontent.com/ugc/1758068501357192910/11DDDC7EF621320962FDCF3AE3211D5EDC3D1573/\" then\n foundTokens = foundTokens + math.abs(obj.getQuantity())\n obj.destruct()\n elseif obj.getMemo() == \"resourceCounter\" then\n foundTokens = obj.getVar(\"val\")\n clickableResourceCounter = obj\n return\n end\n end\nend\n\nfunction add4(playerColor)\n searchSelf()\n\n local newCount = foundTokens + 4\n if clickableResourceCounter then\n clickableResourceCounter.call(\"updateVal\", newCount)\n else\n if newCount \u003e 12 then\n printToColor(\"Count increased to \" .. newCount .. \" resources. Spawning clickable counter instead.\", playerColor)\n tokenManager.spawnResourceCounterToken(self, newCount)\n else\n tokenManager.spawnTokenGroup(self, \"resource\", newCount)\n end\n end\nend\n\nfunction takeAll(playerColor)\n searchSelf()\n local matColor = playmatApi.getMatColorByPosition(self.getPosition())\n playmatApi.gainResources(foundTokens, matColor)\n\n if clickableResourceCounter then\n clickableResourceCounter.call(\"updateVal\", 0)\n end\n printToColor(\"Moved \" .. foundTokens .. \" resource(s) to \" .. matColor .. \"'s resource pool.\", playerColor)\nend\n\nfunction loseAll(playerColor)\n searchSelf()\n\n if clickableResourceCounter then\n clickableResourceCounter.call(\"updateVal\", 0)\n end\n printToColor(\"Discarded \" .. foundTokens .. \" resource(s).\", playerColor)\nend\n\nfunction searchArea(origin, size)\n return Physics.cast({\n origin = origin,\n direction = { 0, 1, 0 },\n orientation = PLAY_ZONE_ROTATION,\n type = 3,\n size = size,\n max_distance = 1\n })\nend\nend)\n__bundle_register(\"core/token/TokenManager\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local optionPanelApi = require(\"core/OptionPanelApi\")\n local playAreaApi = require(\"core/PlayAreaApi\")\n local tokenSpawnTrackerApi = require(\"core/token/TokenSpawnTrackerApi\")\n\n local PLAYER_CARD_TOKEN_OFFSETS = {\n [1] = {\n Vector(0, 3, -0.2)\n },\n [2] = {\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [3] = {\n Vector(0, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [4] = {\n Vector(0.4, 3, -0.9),\n Vector(-0.4, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [5] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [6] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2)\n },\n [7] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0, 3, 0.5)\n },\n [8] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(-0.35, 3, 0.5),\n Vector(0.35, 3, 0.5)\n },\n [9] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5)\n },\n [10] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0, 3, 1.2)\n },\n [11] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(-0.35, 3, 1.2),\n Vector(0.35, 3, 1.2)\n },\n [12] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0.7, 3, 1.2),\n Vector(0, 3, 1.2),\n Vector(-0.7, 3, 1.2)\n }\n }\n\n -- stateIDs for the multi-stated resource tokens\n local stateTable = {\n [\"resource\"] = 1,\n [\"ammo\"] = 2,\n [\"bounty\"] = 3,\n [\"charge\"] = 4,\n [\"evidence\"] = 5,\n [\"secret\"] = 6,\n [\"supply\"] = 7\n }\n\n -- Source for tokens\n local TOKEN_SOURCE_GUID = \"124381\"\n\n -- Table of data extracted from the token source bag, keyed by the Memo on each token which\n -- should match the token type keys (\"resource\", \"clue\", etc)\n local tokenTemplates\n\n local DATA_HELPER_GUID = \"708279\"\n\n local playerCardData\n local locationData\n\n local TokenManager = { }\n local internal = { }\n\n -- Spawns tokens for the card. This function is built to just throw a card at it and let it do\n -- the work once a card has hit an area where it might spawn tokens. It will check to see if\n -- the card has already spawned, find appropriate data from either the uses metadata or the Data\n -- Helper, and spawn the tokens.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n TokenManager.spawnForCard = function(card, extraUses)\n if tokenSpawnTrackerApi.hasSpawnedTokens(card.getGUID()) then\n return\n end\n local metadata = JSON.decode(card.getGMNotes())\n if metadata ~= nil then\n internal.spawnTokensFromUses(card, extraUses)\n else\n internal.spawnTokensFromDataHelper(card)\n end\n end\n\n -- Spawns a set of tokens on the given card.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String Type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param tokenCount Number How many tokens to spawn. For damage or horror this value will be set to the\n -- spawned state object rather than spawning multiple tokens\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnTokenGroup = function(card, tokenType, tokenCount, shiftDown, subType)\n local optionPanel = optionPanelApi.getOptions()\n\n if tokenType == \"damage\" or tokenType == \"horror\" then\n TokenManager.spawnCounterToken(card, tokenType, tokenCount, shiftDown)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"enabled\" then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"custom\" and tokenCount == 0 then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n else\n TokenManager.spawnMultipleTokens(card, tokenType, tokenCount, shiftDown, subType)\n end\n end\n\n -- Spawns a single counter token and sets the value to tokenValue. Used for damage and horror\n -- tokens.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String type of token to spawn, valid values are \"damage\" and \"horror\". Other\n -- types should use spawnMultipleTokens()\n ---@param tokenValue Number Value to set the damage/horror to\n TokenManager.spawnCounterToken = function(card, tokenType, tokenValue, shiftDown)\n if tokenValue \u003c 1 or tokenValue \u003e 50 then return end\n\n local pos = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[1][1] + Vector(0, 0, shiftDown))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, tokenType, rot, function(spawned) spawned.setState(tokenValue) end)\n end\n\n TokenManager.spawnResourceCounterToken = function(card, tokenCount)\n local pos = card.positionToWorld(card.positionToLocal(card.getPosition()) + Vector(0, 0.2, -0.5))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, \"resourceCounter\", rot, function(spawned)\n spawned.call(\"updateVal\", tokenCount)\n end)\n end\n\n -- Spawns a number of tokens.\n ---@param tokenType String type of token to spawn, valid values are resource\", \"doom\", or \"clue\".\n -- Other types should use spawnCounterToken()\n ---@param tokenCount Number How many tokens to spawn\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnMultipleTokens = function(card, tokenType, tokenCount, shiftDown, subType)\n -- not checking the max at this point since clue offsets are calculated dynamically\n if tokenCount \u003c 1 then return end\n\n local offsets = {}\n if tokenType == \"clue\" then\n offsets = internal.buildClueOffsets(card, tokenCount)\n else\n -- only up to 12 offset tables defined\n if tokenCount \u003e 12 then return end\n for i = 1, tokenCount do\n offsets[i] = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[tokenCount][i])\n -- Fix the y-position for the spawn, since positionToWorld considers rotation which can\n -- have bad results for face up/down differences\n offsets[i].y = card.getPosition().y + 0.15\n end\n end\n\n if shiftDown ~= nil then\n -- Copy the offsets to make sure we don't change the static values\n local baseOffsets = offsets\n offsets = { }\n for i, baseOffset in ipairs(baseOffsets) do\n offsets[i] = baseOffset\n offsets[i][3] = offsets[i][3] + shiftDown\n end\n end\n\n if offsets == nil then\n error(\"couldn't find offsets for \" .. tokenCount .. ' tokens')\n return\n end\n\n -- handling for not provided subtype (for example when spawning from custom data helpers)\n if subType == nil then\n subType = \"\"\n end\n \n -- this is used to load the correct state for additional resource tokens (e.g. \"Ammo\")\n local callback = nil\n local stateID = stateTable[string.lower(subType)]\n if tokenType == \"resource\" and stateID ~= nil and stateID ~= 1 then\n callback = function(spawned) spawned.setState(stateID) end\n end\n\n for i = 1, tokenCount do\n TokenManager.spawnToken(offsets[i], tokenType, card.getRotation(), callback)\n end\n end\n\n -- Spawns a single token at the given global position by copying it from the template bag.\n ---@param position Global position to spawn the token\n ---@param tokenType String type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param rotation Vector Rotation to be used for the new token. Only the y-value will be used,\n -- x and z will use the default rotation from the source bag\n ---@param callback function A callback function triggered after the new token is spawned\n TokenManager.spawnToken = function(position, tokenType, rotation, callback)\n internal.initTokenTemplates()\n local loadTokenType = tokenType\n if tokenType == \"clue\" or tokenType == \"doom\" then\n loadTokenType = \"clueDoom\"\n end\n if tokenTemplates[loadTokenType] == nil then\n error(\"Unknown token type '\" .. tokenType .. \"'\")\n return\n end\n local tokenTemplate = tokenTemplates[loadTokenType]\n\n -- Take ONLY the Y-value for rotation, so we don't flip the token coming out of the bag\n local rot = Vector(tokenTemplate.Transform.rotX,\n 270,\n tokenTemplate.Transform.rotZ)\n if rotation ~= nil then\n rot.y = rotation.y\n end\n if tokenType == \"doom\" then\n rot.z = 180\n end\n\n tokenTemplate.Nickname = \"\"\n return spawnObjectData({\n data = tokenTemplate,\n position = position,\n rotation = rot,\n callback_function = callback\n })\n end\n\n -- Checks a card for metadata to maybe replenish it\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n TokenManager.maybeReplenishCard = function(card, uses, mat)\n -- TODO: support for cards with multiple uses AND replenish (as of yet, no official card needs that)\n if uses[1].count and uses[1].replenish then\n internal.replenishTokens(card, uses, mat)\n end\n end\n\n -- Delegate function to the token spawn tracker. Exists to avoid circular dependencies in some\n -- callers.\n ---@param card Object Card object to reset the tokens for\n TokenManager.resetTokensSpawned = function(card)\n tokenSpawnTrackerApi.resetTokensSpawned(card.getGUID())\n end\n\n -- Pushes new player card data into the local copy of the Data Helper player data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addPlayerCardData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n playerCardData[k] = v\n end\n end\n\n -- Pushes new location data into the local copy of the Data Helper location data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addLocationData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n locationData[k] = v\n end\n end\n\n -- Checks to see if the given card has location data in the DataHelper\n ---@param card Object Card to check for data\n ---@return Boolean True if this card has data in the helper, false otherwise\n TokenManager.hasLocationData = function(card)\n internal.initDataHelperData()\n return internal.getLocationData(card) ~= nil\n end\n\n internal.initTokenTemplates = function()\n if tokenTemplates ~= nil then\n return\n end\n tokenTemplates = { }\n local tokenSource = getObjectFromGUID(TOKEN_SOURCE_GUID)\n for _, tokenTemplate in ipairs(tokenSource.getData().ContainedObjects) do\n local tokenName = tokenTemplate.Memo\n tokenTemplates[tokenName] = tokenTemplate\n end\n end\n\n -- Copies the data from the DataHelper. Will only happen once.\n internal.initDataHelperData = function()\n if playerCardData ~= nil then\n return\n end\n local dataHelper = getObjectFromGUID(DATA_HELPER_GUID)\n playerCardData = dataHelper.getTable('PLAYER_CARD_DATA')\n locationData = dataHelper.getTable('LOCATIONS_DATA')\n end\n\n -- Spawn tokens for a card based on the uses metadata. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n internal.spawnTokensFromUses = function(card, extraUses)\n local uses = internal.getUses(card)\n if uses == nil then return end\n\n -- go through tokens to spawn\n local type, token, tokenCount\n for i, useInfo in ipairs(uses) do\n type = useInfo.type\n token = useInfo.token\n tokenCount = (useInfo.count or 0)\n + (useInfo.countPerInvestigator or 0) * playAreaApi.getInvestigatorCount()\n if extraUses ~= nil and extraUses[type] ~= nil then\n tokenCount = tokenCount + extraUses[type]\n end\n -- Shift each spawned group after the first down so they don't pile on each other\n TokenManager.spawnTokenGroup(card, token, tokenCount, (i - 1) * 0.8, type)\n end\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a card based on the data helper data. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n internal.spawnTokensFromDataHelper = function(card)\n internal.initDataHelperData()\n local playerData = internal.getPlayerCardData(card)\n if playerData ~= nil then\n internal.spawnPlayerCardTokensFromDataHelper(card, playerData)\n end\n local locationData = internal.getLocationData(card)\n if locationData ~= nil then\n internal.spawnLocationTokensFromDataHelper(card, locationData)\n end\n end\n\n -- Spawn tokens for a player card using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Player card data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnPlayerCardTokensFromDataHelper = function(card, playerData)\n token = playerData.tokenType\n tokenCount = playerData.tokenCount\n --log(\"Spawning data helper tokens for \"..card.getName()..'['..card.getDescription()..']: '..tokenCount..\"x \"..token)\n TokenManager.spawnTokenGroup(card, token, tokenCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a location using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Location data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnLocationTokensFromDataHelper = function(card, locationData)\n local clueCount = internal.getClueCountFromData(card, locationData)\n if clueCount \u003e 0 then\n TokenManager.spawnTokenGroup(card, \"clue\", clueCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n end\n\n internal.getPlayerCardData = function(card)\n return playerCardData[card.getName() .. ':' .. card.getDescription()]\n or playerCardData[card.getName()]\n end\n\n internal.getLocationData = function(card)\n return locationData[card.getName() .. '_' .. card.getGUID()] or locationData[card.getName()]\n end\n\n internal.getClueCountFromData = function(card, locationData)\n -- Return the number of clues to spawn on this location\n if locationData == nil then\n error('attempted to get clue for unexpected object: ' .. card.getName())\n return 0\n end\n\n --log(card.getName() .. ' : ' .. locationData.type .. ' : ' .. locationData.value .. ' : ' .. locationData.clueSide)\n if ((card.is_face_down and locationData.clueSide == 'back')\n or (not card.is_face_down and locationData.clueSide == 'front')) then\n if locationData.type == 'fixed' then\n return locationData.value\n elseif locationData.type == 'perPlayer' then\n return locationData.value * playAreaApi.getInvestigatorCount()\n end\n error('unexpected location type: ' .. locationData.type)\n end\n return 0\n end\n\n -- Gets the right uses structure for this card, based on metadata and face up/down state\n ---@param card Object Card to pull the uses from\n internal.getUses = function(card)\n local metadata = JSON.decode(card.getGMNotes()) or { }\n if metadata.type == \"Location\" then\n if card.is_face_down and metadata.locationBack ~= nil then\n return metadata.locationBack.uses\n elseif not card.is_face_down and metadata.locationFront ~= nil then\n return metadata.locationFront.uses\n end\n elseif not card.is_face_down then\n return metadata.uses\n end\n\n return nil\n end\n\n -- Dynamically create positions for clues on a card.\n ---@param card Object Card the clues will be placed on\n ---@param count Integer How many clues?\n ---@return Table Array of global positions to spawn the clues at\n internal.buildClueOffsets = function(card, count)\n local pos = card.getPosition()\n local cluePositions = { }\n for i = 1, count do\n local row = math.floor(1 + (i - 1) / 4)\n local column = (i - 1) % 4\n table.insert(cluePositions, Vector(pos.x + 1.5 - 0.55 * row, pos.y + 0.15, pos.z - 0.825 + 0.55 * column))\n end\n return cluePositions\n end\n\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n internal.replenishTokens = function(card, uses, mat)\n local cardPos = card.getPosition()\n\n -- don't continue for cards on the deck (Norman) or in the discard pile\n if mat.positionToLocal(cardPos).x \u003c -1 then return end\n\n -- get current amount of resource tokens on the card\n local search = internal.searchOnCard(cardPos, card.getRotation())\n local clickableResourceCounter = nil\n local foundTokens = 0\n\n for _, obj in ipairs(search) do\n local obj = obj.hit_object\n local memo = obj.getMemo()\n\n if (stateTable[memo] or 0) \u003e 0 then\n foundTokens = foundTokens + math.abs(obj.getQuantity())\n obj.destruct()\n elseif memo == \"resourceCounter\" then\n foundTokens = obj.getVar(\"val\")\n clickableResourceCounter = obj\n break\n end\n end\n\n -- this is the theoretical new amount of uses (to be checked below)\n local newCount = foundTokens + uses[1].replenish\n\n -- if there are already more uses than the replenish amount, keep them\n if foundTokens \u003e uses[1].count then\n newCount = foundTokens\n -- only replenish up until the replenish amount\n elseif newCount \u003e uses[1].count then\n newCount = uses[1].count\n end\n\n -- update the clickable counter or spawn a group of tokens\n if clickableResourceCounter then\n clickableResourceCounter.call(\"updateVal\", newCount)\n else\n TokenManager.spawnTokenGroup(card, uses[1].token, newCount, _, uses[1].type)\n end\n end\n\n -- searches on a card (standard size) and returns the result\n ---@param position Table Position of the card\n ---@param rotation Table Rotation of the card\n internal.searchOnCard = function(position, rotation)\n return Physics.cast({\n origin = position,\n direction = {0, 1, 0},\n orientation = rotation,\n type = 3,\n size = { 2.5, 0.5, 3.5 },\n max_distance = 1,\n debug = false\n })\n end\n\n return TokenManager\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/OptionPanelApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local OptionPanelApi = {}\n\n -- loads saved options\n ---@param options Table New options table\n OptionPanelApi.loadSettings = function(options)\n return Global.call(\"loadSettings\", options)\n end\n\n -- returns option panel table\n OptionPanelApi.getOptions = function()\n return Global.getTable(\"optionPanel\")\n end\n\n return OptionPanelApi\nend\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = { }\n local PLAY_AREA_GUID = \"721ba2\"\n local INVESTIGATOR_COUNTER_GUID = \"f182ee\"\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with\n -- 'displacement_excluded'\n ---@param playerColor Color of the player requesting the shift. Used solely to send an error\n --- message in the unlikely case that the scripting zone has been deleted\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"tryObjectEnterContainer\",\n { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightCountedVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\n__bundle_register(\"core/token/TokenSpawnTrackerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenSpawnTracker = { }\n local SPAWN_TRACKER_GUID = \"e3ffc9\"\n\n TokenSpawnTracker.hasSpawnedTokens = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"hasSpawnedTokens\", cardGuid)\n end\n\n TokenSpawnTracker.markTokensSpawned = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"markTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetTokensSpawned = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetAllAssetAndEvents = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAllAssetAndEvents\")\n end\n\n TokenSpawnTracker.resetAllLocations = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAllLocations\")\n end\n\n TokenSpawnTracker.resetAll = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAll\")\n end\n\n return TokenSpawnTracker\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"core/OptionPanelApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local OptionPanelApi = {}\n\n -- loads saved options\n ---@param options Table New options table\n OptionPanelApi.loadSettings = function(options)\n return Global.call(\"loadSettings\", options)\n end\n\n -- returns option panel table\n OptionPanelApi.getOptions = function()\n return Global.getTable(\"optionPanel\")\n end\n\n return OptionPanelApi\nend\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getPlayArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"PlayArea\")\n end\n\n local function getInvestigatorCounter()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"InvestigatorCounter\")\n end\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getInvestigatorCounter().getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n getInvestigatorCounter().call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with 'displacement_excluded'\n ---@param playerColor Color Color of the player requesting the shift for messages\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getPlayArea().call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getPlayArea().call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getPlayArea().call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getPlayArea().call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getPlayArea().call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getPlayArea().call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getPlayArea().call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getPlayArea().call(\"tryObjectEnterContainer\", { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getPlayArea().call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getPlayArea().call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getPlayArea().call(\"countVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getPlayArea().call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getPlayArea().getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getPlayArea().call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getPlayArea().call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getPlayArea().getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\n__bundle_register(\"core/token/TokenSpawnTrackerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenSpawnTracker = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getSpawnTracker()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenSpawnTracker\")\n end\n\n TokenSpawnTracker.hasSpawnedTokens = function(cardGuid)\n return getSpawnTracker().call(\"hasSpawnedTokens\", cardGuid)\n end\n\n TokenSpawnTracker.markTokensSpawned = function(cardGuid)\n return getSpawnTracker().call(\"markTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetTokensSpawned = function(cardGuid)\n return getSpawnTracker().call(\"resetTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetAllAssetAndEvents = function()\n return getSpawnTracker().call(\"resetAllAssetAndEvents\")\n end\n\n TokenSpawnTracker.resetAllLocations = function()\n return getSpawnTracker().call(\"resetAllLocations\")\n end\n\n TokenSpawnTracker.resetAll = function()\n return getSpawnTracker().call(\"resetAll\")\n end\n\n return TokenSpawnTracker\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/FamilyInheritance\")\nend)\n__bundle_register(\"playercards/cards/FamilyInheritance\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal playmatApi = require(\"playermat/PlaymatApi\")\nlocal tokenManager = require(\"core/token/TokenManager\")\n\nlocal clickableResourceCounter = nil\nlocal foundTokens = 0\n\nfunction onLoad()\n self.addContextMenuItem(\"Add 4 resources\", function(playerColor) add4(playerColor) end)\n self.addContextMenuItem(\"Take all resources\", function(playerColor) takeAll(playerColor) end)\n self.addContextMenuItem(\"Discard all resources\", function(playerColor) loseAll(playerColor) end)\nend\n\nfunction searchSelf()\n clickableResourceCounter = nil\n foundTokens = 0\n\n for _, obj in ipairs(searchArea(self.getPosition(), { 2.5, 0.5, 3.5 })) do\n local obj = obj.hit_object\n local image = obj.getCustomObject().image\n if image == \"http://cloud-3.steamusercontent.com/ugc/1758068501357192910/11DDDC7EF621320962FDCF3AE3211D5EDC3D1573/\" then\n foundTokens = foundTokens + math.abs(obj.getQuantity())\n obj.destruct()\n elseif obj.getMemo() == \"resourceCounter\" then\n foundTokens = obj.getVar(\"val\")\n clickableResourceCounter = obj\n return\n end\n end\nend\n\nfunction add4(playerColor)\n searchSelf()\n\n local newCount = foundTokens + 4\n if clickableResourceCounter then\n clickableResourceCounter.call(\"updateVal\", newCount)\n else\n if newCount \u003e 12 then\n printToColor(\"Count increased to \" .. newCount .. \" resources. Spawning clickable counter instead.\", playerColor)\n tokenManager.spawnResourceCounterToken(self, newCount)\n else\n tokenManager.spawnTokenGroup(self, \"resource\", newCount)\n end\n end\nend\n\nfunction takeAll(playerColor)\n searchSelf()\n local matColor = playmatApi.getMatColorByPosition(self.getPosition())\n playmatApi.updateCounter(matColor, \"ResourceCounter\", _, foundTokens)\n\n if clickableResourceCounter then\n clickableResourceCounter.call(\"updateVal\", 0)\n end\n printToColor(\"Moved \" .. foundTokens .. \" resource(s) to \" .. matColor .. \"'s resource pool.\", playerColor)\nend\n\nfunction loseAll(playerColor)\n searchSelf()\n\n if clickableResourceCounter then\n clickableResourceCounter.call(\"updateVal\", 0)\n end\n printToColor(\"Discarded \" .. foundTokens .. \" resource(s).\", playerColor)\nend\n\nfunction searchArea(origin, size)\n return Physics.cast({\n origin = origin,\n direction = { 0, 1, 0 },\n orientation = PLAY_ZONE_ROTATION,\n type = 3,\n size = size,\n max_distance = 1\n })\nend\nend)\n__bundle_register(\"core/token/TokenManager\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n local optionPanelApi = require(\"core/OptionPanelApi\")\n local playAreaApi = require(\"core/PlayAreaApi\")\n local tokenSpawnTrackerApi = require(\"core/token/TokenSpawnTrackerApi\")\n\n local PLAYER_CARD_TOKEN_OFFSETS = {\n [1] = {\n Vector(0, 3, -0.2)\n },\n [2] = {\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [3] = {\n Vector(0, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [4] = {\n Vector(0.4, 3, -0.9),\n Vector(-0.4, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [5] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.4, 3, -0.2),\n Vector(-0.4, 3, -0.2)\n },\n [6] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2)\n },\n [7] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0, 3, 0.5)\n },\n [8] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(-0.35, 3, 0.5),\n Vector(0.35, 3, 0.5)\n },\n [9] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5)\n },\n [10] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0, 3, 1.2)\n },\n [11] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(-0.35, 3, 1.2),\n Vector(0.35, 3, 1.2)\n },\n [12] = {\n Vector(0.7, 3, -0.9),\n Vector(0, 3, -0.9),\n Vector(-0.7, 3, -0.9),\n Vector(0.7, 3, -0.2),\n Vector(0, 3, -0.2),\n Vector(-0.7, 3, -0.2),\n Vector(0.7, 3, 0.5),\n Vector(0, 3, 0.5),\n Vector(-0.7, 3, 0.5),\n Vector(0.7, 3, 1.2),\n Vector(0, 3, 1.2),\n Vector(-0.7, 3, 1.2)\n }\n }\n\n -- stateIDs for the multi-stated resource tokens\n local stateTable = {\n [\"resource\"] = 1,\n [\"ammo\"] = 2,\n [\"bounty\"] = 3,\n [\"charge\"] = 4,\n [\"evidence\"] = 5,\n [\"secret\"] = 6,\n [\"supply\"] = 7\n }\n\n -- Table of data extracted from the token source bag, keyed by the Memo on each token which\n -- should match the token type keys (\"resource\", \"clue\", etc)\n local tokenTemplates\n\n local playerCardData\n local locationData\n\n local TokenManager = { }\n local internal = { }\n\n -- Spawns tokens for the card. This function is built to just throw a card at it and let it do\n -- the work once a card has hit an area where it might spawn tokens. It will check to see if\n -- the card has already spawned, find appropriate data from either the uses metadata or the Data\n -- Helper, and spawn the tokens.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n TokenManager.spawnForCard = function(card, extraUses)\n if tokenSpawnTrackerApi.hasSpawnedTokens(card.getGUID()) then\n return\n end\n local metadata = JSON.decode(card.getGMNotes())\n if metadata ~= nil then\n internal.spawnTokensFromUses(card, extraUses)\n else\n internal.spawnTokensFromDataHelper(card)\n end\n end\n\n -- Spawns a set of tokens on the given card.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String Type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param tokenCount Number How many tokens to spawn. For damage or horror this value will be set to the\n -- spawned state object rather than spawning multiple tokens\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnTokenGroup = function(card, tokenType, tokenCount, shiftDown, subType)\n local optionPanel = optionPanelApi.getOptions()\n\n if tokenType == \"damage\" or tokenType == \"horror\" then\n TokenManager.spawnCounterToken(card, tokenType, tokenCount, shiftDown)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"enabled\" then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n elseif tokenType == \"resource\" and optionPanel[\"useResourceCounters\"] == \"custom\" and tokenCount == 0 then\n TokenManager.spawnResourceCounterToken(card, tokenCount)\n else\n TokenManager.spawnMultipleTokens(card, tokenType, tokenCount, shiftDown, subType)\n end\n end\n\n -- Spawns a single counter token and sets the value to tokenValue. Used for damage and horror\n -- tokens.\n ---@param card Object Card to spawn tokens on\n ---@param tokenType String type of token to spawn, valid values are \"damage\" and \"horror\". Other\n -- types should use spawnMultipleTokens()\n ---@param tokenValue Number Value to set the damage/horror to\n TokenManager.spawnCounterToken = function(card, tokenType, tokenValue, shiftDown)\n if tokenValue \u003c 1 or tokenValue \u003e 50 then return end\n\n local pos = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[1][1] + Vector(0, 0, shiftDown))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, tokenType, rot, function(spawned) spawned.setState(tokenValue) end)\n end\n\n TokenManager.spawnResourceCounterToken = function(card, tokenCount)\n local pos = card.positionToWorld(card.positionToLocal(card.getPosition()) + Vector(0, 0.2, -0.5))\n local rot = card.getRotation()\n TokenManager.spawnToken(pos, \"resourceCounter\", rot, function(spawned)\n spawned.call(\"updateVal\", tokenCount)\n end)\n end\n\n -- Spawns a number of tokens.\n ---@param tokenType String type of token to spawn, valid values are resource\", \"doom\", or \"clue\".\n -- Other types should use spawnCounterToken()\n ---@param tokenCount Number How many tokens to spawn\n ---@param shiftDown Number An offset for the z-value of this group of tokens\n ---@param subType Number Subtype of token to spawn. This will only differ from the tokenName for resource tokens\n TokenManager.spawnMultipleTokens = function(card, tokenType, tokenCount, shiftDown, subType)\n -- not checking the max at this point since clue offsets are calculated dynamically\n if tokenCount \u003c 1 then return end\n\n local offsets = {}\n if tokenType == \"clue\" then\n offsets = internal.buildClueOffsets(card, tokenCount)\n else\n -- only up to 12 offset tables defined\n if tokenCount \u003e 12 then return end\n for i = 1, tokenCount do\n offsets[i] = card.positionToWorld(PLAYER_CARD_TOKEN_OFFSETS[tokenCount][i])\n -- Fix the y-position for the spawn, since positionToWorld considers rotation which can\n -- have bad results for face up/down differences\n offsets[i].y = card.getPosition().y + 0.15\n end\n end\n\n if shiftDown ~= nil then\n -- Copy the offsets to make sure we don't change the static values\n local baseOffsets = offsets\n offsets = { }\n\n -- get a vector for the shifting (downwards local to the card)\n local shiftDownVector = Vector(0, 0, shiftDown):rotateOver(\"y\", card.getRotation().y)\n for i, baseOffset in ipairs(baseOffsets) do\n offsets[i] = baseOffset + shiftDownVector\n end\n end\n\n if offsets == nil then\n error(\"couldn't find offsets for \" .. tokenCount .. ' tokens')\n return\n end\n\n -- handling for not provided subtype (for example when spawning from custom data helpers)\n if subType == nil then\n subType = \"\"\n end\n \n -- this is used to load the correct state for additional resource tokens (e.g. \"Ammo\")\n local callback = nil\n local stateID = stateTable[string.lower(subType)]\n if tokenType == \"resource\" and stateID ~= nil and stateID ~= 1 then\n callback = function(spawned) spawned.setState(stateID) end\n end\n\n for i = 1, tokenCount do\n TokenManager.spawnToken(offsets[i], tokenType, card.getRotation(), callback)\n end\n end\n\n -- Spawns a single token at the given global position by copying it from the template bag.\n ---@param position Global position to spawn the token\n ---@param tokenType String type of token to spawn, valid values are \"damage\", \"horror\",\n -- \"resource\", \"doom\", or \"clue\"\n ---@param rotation Vector Rotation to be used for the new token. Only the y-value will be used,\n -- x and z will use the default rotation from the source bag\n ---@param callback function A callback function triggered after the new token is spawned\n TokenManager.spawnToken = function(position, tokenType, rotation, callback)\n internal.initTokenTemplates()\n local loadTokenType = tokenType\n if tokenType == \"clue\" or tokenType == \"doom\" then\n loadTokenType = \"clueDoom\"\n end\n if tokenTemplates[loadTokenType] == nil then\n error(\"Unknown token type '\" .. tokenType .. \"'\")\n return\n end\n local tokenTemplate = tokenTemplates[loadTokenType]\n\n -- Take ONLY the Y-value for rotation, so we don't flip the token coming out of the bag\n local rot = Vector(tokenTemplate.Transform.rotX,\n 270,\n tokenTemplate.Transform.rotZ)\n if rotation ~= nil then\n rot.y = rotation.y\n end\n if tokenType == \"doom\" then\n rot.z = 180\n end\n\n tokenTemplate.Nickname = \"\"\n return spawnObjectData({\n data = tokenTemplate,\n position = position,\n rotation = rot,\n callback_function = callback\n })\n end\n\n -- Checks a card for metadata to maybe replenish it\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n TokenManager.maybeReplenishCard = function(card, uses, mat)\n -- TODO: support for cards with multiple uses AND replenish (as of yet, no official card needs that)\n if uses[1].count and uses[1].replenish then\n internal.replenishTokens(card, uses, mat)\n end\n end\n\n -- Delegate function to the token spawn tracker. Exists to avoid circular dependencies in some\n -- callers.\n ---@param card Object Card object to reset the tokens for\n TokenManager.resetTokensSpawned = function(card)\n tokenSpawnTrackerApi.resetTokensSpawned(card.getGUID())\n end\n\n -- Pushes new player card data into the local copy of the Data Helper player data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addPlayerCardData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n playerCardData[k] = v\n end\n end\n\n -- Pushes new location data into the local copy of the Data Helper location data.\n ---@param dataTable Table Key/Value pairs following the DataHelper style\n TokenManager.addLocationData = function(dataTable)\n internal.initDataHelperData()\n for k, v in pairs(dataTable) do\n locationData[k] = v\n end\n end\n\n -- Checks to see if the given card has location data in the DataHelper\n ---@param card Object Card to check for data\n ---@return Boolean True if this card has data in the helper, false otherwise\n TokenManager.hasLocationData = function(card)\n internal.initDataHelperData()\n return internal.getLocationData(card) ~= nil\n end\n\n internal.initTokenTemplates = function()\n if tokenTemplates ~= nil then\n return\n end\n tokenTemplates = {}\n local tokenSource = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenSource\")\n for _, tokenTemplate in ipairs(tokenSource.getData().ContainedObjects) do\n local tokenName = tokenTemplate.Memo\n tokenTemplates[tokenName] = tokenTemplate\n end\n end\n\n -- Copies the data from the DataHelper. Will only happen once.\n internal.initDataHelperData = function()\n if playerCardData ~= nil then\n return\n end\n local dataHelper = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"DataHelper\")\n playerCardData = dataHelper.getTable('PLAYER_CARD_DATA')\n locationData = dataHelper.getTable('LOCATIONS_DATA')\n end\n\n -- Spawn tokens for a card based on the uses metadata. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n ---@param extraUses Table A table of \u003cuse type\u003e=\u003ccount\u003e which will modify the number of tokens\n --- spawned for that type. e.g. Akachi's playmat should pass \"Charge\"=1\n internal.spawnTokensFromUses = function(card, extraUses)\n local uses = internal.getUses(card)\n if uses == nil then return end\n\n -- go through tokens to spawn\n local tokenCount\n for i, useInfo in ipairs(uses) do\n tokenCount = (useInfo.count or 0) + (useInfo.countPerInvestigator or 0) * playAreaApi.getInvestigatorCount()\n if extraUses ~= nil and extraUses[useInfo.type] ~= nil then\n tokenCount = tokenCount + extraUses[useInfo.type]\n end\n -- Shift each spawned group after the first down so they don't pile on each other\n TokenManager.spawnTokenGroup(card, useInfo.token, tokenCount, (i - 1) * 0.8, useInfo.type)\n end\n \n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a card based on the data helper data. This will consider the face up/down state\n -- of the card for both locations and standard cards.\n ---@param card Object Card to maybe spawn tokens for\n internal.spawnTokensFromDataHelper = function(card)\n internal.initDataHelperData()\n local playerData = internal.getPlayerCardData(card)\n if playerData ~= nil then\n internal.spawnPlayerCardTokensFromDataHelper(card, playerData)\n end\n local locationData = internal.getLocationData(card)\n if locationData ~= nil then\n internal.spawnLocationTokensFromDataHelper(card, locationData)\n end\n end\n\n -- Spawn tokens for a player card using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Player card data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnPlayerCardTokensFromDataHelper = function(card, playerData)\n local token = playerData.tokenType\n local tokenCount = playerData.tokenCount\n TokenManager.spawnTokenGroup(card, token, tokenCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n\n -- Spawn tokens for a location using data retrieved from the Data Helper.\n ---@param card Object Card to maybe spawn tokens for\n ---@param playerData Table Location data structure retrieved from the DataHelper. Should be\n -- the right data for this card.\n internal.spawnLocationTokensFromDataHelper = function(card, locationData)\n local clueCount = internal.getClueCountFromData(card, locationData)\n if clueCount \u003e 0 then\n TokenManager.spawnTokenGroup(card, \"clue\", clueCount)\n tokenSpawnTrackerApi.markTokensSpawned(card.getGUID())\n end\n end\n\n internal.getPlayerCardData = function(card)\n return playerCardData[card.getName() .. ':' .. card.getDescription()]\n or playerCardData[card.getName()]\n end\n\n internal.getLocationData = function(card)\n return locationData[card.getName() .. '_' .. card.getGUID()] or locationData[card.getName()]\n end\n\n internal.getClueCountFromData = function(card, locationData)\n -- Return the number of clues to spawn on this location\n if locationData == nil then\n error('attempted to get clue for unexpected object: ' .. card.getName())\n return 0\n end\n\n if ((card.is_face_down and locationData.clueSide == 'back')\n or (not card.is_face_down and locationData.clueSide == 'front')) then\n if locationData.type == 'fixed' then\n return locationData.value\n elseif locationData.type == 'perPlayer' then\n return locationData.value * playAreaApi.getInvestigatorCount()\n end\n error('unexpected location type: ' .. locationData.type)\n end\n return 0\n end\n\n -- Gets the right uses structure for this card, based on metadata and face up/down state\n ---@param card Object Card to pull the uses from\n internal.getUses = function(card)\n local metadata = JSON.decode(card.getGMNotes()) or { }\n if metadata.type == \"Location\" then\n if card.is_face_down and metadata.locationBack ~= nil then\n return metadata.locationBack.uses\n elseif not card.is_face_down and metadata.locationFront ~= nil then\n return metadata.locationFront.uses\n end\n elseif not card.is_face_down then\n return metadata.uses\n end\n\n return nil\n end\n\n -- Dynamically create positions for clues on a card.\n ---@param card Object Card the clues will be placed on\n ---@param count Integer How many clues?\n ---@return Table Array of global positions to spawn the clues at\n internal.buildClueOffsets = function(card, count)\n local pos = card.getPosition()\n local cluePositions = { }\n for i = 1, count do\n local row = math.floor(1 + (i - 1) / 4)\n local column = (i - 1) % 4\n table.insert(cluePositions, Vector(pos.x + 1.5 - 0.55 * row, pos.y + 0.15, pos.z - 0.825 + 0.55 * column))\n end\n return cluePositions\n end\n\n ---@param card Object Card object to be replenished\n ---@param uses Table The already decoded metadata.uses (to avoid decoding again)\n ---@param mat Object The playmat the card is placed on (for rotation and casting)\n internal.replenishTokens = function(card, uses, mat)\n local cardPos = card.getPosition()\n\n -- don't continue for cards on the deck (Norman) or in the discard pile\n if mat.positionToLocal(cardPos).x \u003c -1 then return end\n\n -- get current amount of resource tokens on the card\n local search = internal.searchOnCard(cardPos, card.getRotation())\n local clickableResourceCounter = nil\n local foundTokens = 0\n\n for _, obj in ipairs(search) do\n local obj = obj.hit_object\n local memo = obj.getMemo()\n\n if (stateTable[memo] or 0) \u003e 0 then\n foundTokens = foundTokens + math.abs(obj.getQuantity())\n obj.destruct()\n elseif memo == \"resourceCounter\" then\n foundTokens = obj.getVar(\"val\")\n clickableResourceCounter = obj\n break\n end\n end\n\n -- this is the theoretical new amount of uses (to be checked below)\n local newCount = foundTokens + uses[1].replenish\n\n -- if there are already more uses than the replenish amount, keep them\n if foundTokens \u003e uses[1].count then\n newCount = foundTokens\n -- only replenish up until the replenish amount\n elseif newCount \u003e uses[1].count then\n newCount = uses[1].count\n end\n\n -- update the clickable counter or spawn a group of tokens\n if clickableResourceCounter then\n clickableResourceCounter.call(\"updateVal\", newCount)\n else\n TokenManager.spawnTokenGroup(card, uses[1].token, newCount, _, uses[1].type)\n end\n end\n\n -- searches on a card (standard size) and returns the result\n ---@param position Table Position of the card\n ---@param rotation Table Rotation of the card\n internal.searchOnCard = function(position, rotation)\n return Physics.cast({\n origin = position,\n direction = {0, 1, 0},\n orientation = rotation,\n type = 3,\n size = { 2.5, 0.5, 3.5 },\n max_distance = 1,\n debug = false\n })\n end\n\n return TokenManager\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -144827,7 +148498,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playercards/cards/ShortSupply\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal playmatAPI = require(\"playermat/PlaymatApi\")\n\nfunction onLoad()\n self.addContextMenuItem(\"Discard 10 cards\", shortSupply)\nend\n\n-- called by context menu entry\nfunction shortSupply(color)\n local matColor = playmatAPI.getMatColorByPosition(self.getPosition())\n\n -- get draw deck and discard position\n local drawDeck = playmatAPI.getDrawDeck(matColor)\n local discardPos = playmatAPI.getDiscardPosition(matColor)\n\n -- error handling\n if discardPos == nil then\n broadcastToColor(\"Couldn't retrieve discard position from playermat!\", color, \"Red\")\n return\n end\n\n if drawDeck == nil then\n broadcastToColor(\"Deck not found!\", color, \"Yellow\")\n return\n elseif drawDeck.tag ~= \"Deck\" then\n broadcastToColor(\"Deck only contains a single card!\", color, \"Yellow\")\n return\n end\n\n -- discard cards\n broadcastToColor(\"Discarding top 10 cards for player color '\" .. matColor .. \"'.\", color, \"White\")\n for i = 1, 10 do\n drawDeck.takeObject({ flip = true, position = { discardPos.x, 2 + 0.075 * i, discardPos.z } })\n end\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/ShortSupply\")\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/ShortSupply\")\nend)\n__bundle_register(\"playercards/cards/ShortSupply\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\nfunction onLoad()\n self.addContextMenuItem(\"Discard 10 cards\", shortSupply)\nend\n\n-- called by context menu entry\nfunction shortSupply(color)\n local matColor = playmatApi.getMatColorByPosition(self.getPosition())\n\n -- get draw deck and discard position\n local deckAreaObjects = playmatApi.getDeckAreaObjects(matColor)\n local drawDeck = deckAreaObjects.draw\n local discardPos = playmatApi.getDiscardPosition(matColor)\n\n -- error handling\n if discardPos == nil then\n broadcastToColor(\"Couldn't retrieve discard position from playermat!\", color, \"Red\")\n return\n end\n\n if drawDeck == nil then\n broadcastToColor(\"Deck not found!\", color, \"Yellow\")\n return\n elseif drawDeck.type ~= \"Deck\" then\n broadcastToColor(\"Deck only contains a single card!\", color, \"Yellow\")\n return\n end\n\n -- discard cards\n broadcastToColor(\"Discarding top 10 cards for player color '\" .. matColor .. \"'.\", color, \"White\")\n for i = 1, 10 do\n drawDeck.takeObject({ flip = true, position = { discardPos.x, 2 + 0.075 * i, discardPos.z } })\n end\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -153858,6 +157529,192 @@ "Value": 0, "XmlUI": "" }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 773402, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "7734": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/2115062479282091065/71F159724883E9587669DB96B16A5E047DA5B6FA/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115062479282091273/DA3424FFAA9F826D8DCD2F3AB75C220309C5101F/", + "NumHeight": 2, + "NumWidth": 4, + "Type": 0, + "UniqueBack": true + } + }, + "Description": "The Chef", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"02001-p\",\n \"type\": \"Investigator\",\n \"class\": \"Guardian\",\n \"traits\": \"Believer. Hunter.\",\n \"willpowerIcons\": 4,\n \"intellectIcons\": 2,\n \"combatIcons\": 4,\n \"agilityIcons\": 2,\n \"cycle\": \"Path of the Righteous\"\n}", + "GUID": "98a0e2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "Zoey Samaras (Parallel)", + "SidewaysCard": true, + "Snap": true, + "Sticky": true, + "Tags": [ + "Investigator", + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 18.448, + "posY": 1.587, + "posZ": -73.088, + "rotX": 0, + "rotY": 180, + "rotZ": 0, + "scaleX": 1.15, + "scaleY": 1, + "scaleZ": 1.15 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 773502, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "7735": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/2115062479282091065/71F159724883E9587669DB96B16A5E047DA5B6FA/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/1656727981627737050/3CFF9E3825033909543AD1CF843361D9243538EE/", + "NumHeight": 2, + "NumWidth": 4, + "Type": 0, + "UniqueBack": true + } + }, + "Description": "The Chef", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"02001-pb\",\n \"type\": \"Investigator\",\n \"class\": \"Guardian\",\n \"traits\": \"Believer. Hunter.\",\n \"willpowerIcons\": 4,\n \"intellectIcons\": 2,\n \"combatIcons\": 4,\n \"agilityIcons\": 2,\n \"cycle\": \"Path of the Righteous\"\n}", + "GUID": "98a0e4", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "Zoey Samaras (Parallel Back)", + "SidewaysCard": true, + "Snap": true, + "Sticky": true, + "Tags": [ + "Investigator", + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 18.448, + "posY": 1.587, + "posZ": -73.088, + "rotX": 0, + "rotY": 180, + "rotZ": 0, + "scaleX": 1.15, + "scaleY": 1, + "scaleZ": 1.15 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 773602, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "7736": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/1656727981627737648/F371339538812F68E38AAC0D520C525250DAC5C0/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115062479282091273/DA3424FFAA9F826D8DCD2F3AB75C220309C5101F/", + "NumHeight": 2, + "NumWidth": 4, + "Type": 0, + "UniqueBack": true + } + }, + "Description": "The Chef", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"02001-pf\",\n \"type\": \"Investigator\",\n \"class\": \"Guardian\",\n \"traits\": \"Believer. Hunter.\",\n \"willpowerIcons\": 4,\n \"intellectIcons\": 2,\n \"combatIcons\": 4,\n \"agilityIcons\": 2,\n \"cycle\": \"Path of the Righteous\"\n}", + "GUID": "98a0e3", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "Zoey Samaras (Parallel Front)", + "SidewaysCard": true, + "Snap": true, + "Sticky": true, + "Tags": [ + "Investigator", + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 18.448, + "posY": 1.587, + "posZ": -73.088, + "rotX": 0, + "rotY": 180, + "rotZ": 0, + "scaleX": 1.15, + "scaleY": 1, + "scaleZ": 1.15 + }, + "Value": 0, + "XmlUI": "" + }, { "AltLookAngle": { "x": 0, @@ -158300,7 +162157,7 @@ }, "Description": "The Urchin", "DragSelectable": true, - "GMNotes": "{\r\n \"id\": \"01005-pf\",\r\n \"type\": \"Investigator\",\r\n \"class\": \"Survivor\",\r\n \"traits\": \"Drifter.\",\r\n \"willpowerIcons\": 4,\r\n \"intellectIcons\": 3,\r\n \"combatIcons\": 1,\r\n \"agilityIcons\": 4,\r\n \"cycle\": \"Core\"\r\n}\r", + "GMNotes": "{\n \"id\": \"01005-pf\",\n \"type\": \"Investigator\",\n \"class\": \"Survivor\",\n \"traits\": \"Drifter. Blessed. Cursed.\",\n \"willpowerIcons\": 4,\n \"intellectIcons\": 3,\n \"combatIcons\": 1,\n \"agilityIcons\": 4,\n \"cycle\": \"Core\"\n}", "GUID": "61503e", "Grid": true, "GridProjection": false, @@ -158362,7 +162219,7 @@ }, "Description": "The Urchin", "DragSelectable": true, - "GMNotes": "{\r\n \"id\": \"01005-p\",\r\n \"type\": \"Investigator\",\r\n \"class\": \"Survivor\",\r\n \"traits\": \"Drifter.\",\r\n \"willpowerIcons\": 4,\r\n \"intellectIcons\": 3,\r\n \"combatIcons\": 1,\r\n \"agilityIcons\": 4,\r\n \"cycle\": \"Core\"\r\n}\r", + "GMNotes": "{\n \"id\": \"01005-p\",\n \"type\": \"Investigator\",\n \"class\": \"Survivor\",\n \"traits\": \"Drifter. Blessed. Cursed.\",\n \"willpowerIcons\": 4,\n \"intellectIcons\": 3,\n \"combatIcons\": 1,\n \"agilityIcons\": 4,\n \"cycle\": \"Core\"\n}", "GUID": "fd91ea", "Grid": true, "GridProjection": false, @@ -164459,7 +168316,7 @@ }, "Description": "Signature", "DragSelectable": true, - "GMNotes": "{\r\n \"id\": \"01011\",\r\n \"alternate_ids\": [\r\n \"01511\"\r\n ],\r\n \"type\": \"Treachery\",\r\n \"class\": \"Neutral\",\r\n \"traits\": \"Task.\",\r\n \"weakness\": true,\r\n \"cycle\": \"Core\"\r\n}\r", + "GMNotes": "{\n \"id\": \"01011\",\n \"alternate_ids\": [\n \"01511\"\n ],\n \"type\": \"Treachery\",\n \"class\": \"Neutral\",\n \"traits\": \"Task.\",\n \"weakness\": true,\n \"uses\": [\n {\n \"count\": 0,\n \"type\": \"Resource\",\n \"token\": \"resource\"\n }\n ],\n \"cycle\": \"Core\"\n}", "GUID": "47d6c9", "Grid": true, "GridProjection": false, @@ -173501,7 +177358,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playercards/customizable/SummonedServitorUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Summoned Servitor\n\n-- Color information for buttons\nboxSize = 35\n\n-- static values\nxInitial = -0.935\nxOffset = 0.068\n\n-- Locations of the slot selectors\nSLOT_ICON_POSITIONS = {\n arcane = { x = 0.160, z = 0.65 },\n ally = { x = -0.073, z = 0.65 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nSLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n--selectedSlot = SLOT_INDICES.none\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.92,\n count = 1,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.625,\n count = 1,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.33,\n count = 1,\n }\n },\n [4] = {\n checkboxes = {\n posZ = 0.055,\n count = 1,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.26,\n count = 1,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.56,\n count = 2,\n }\n -- Row 6 includes the selection of Arcane/Ally slot, presented with buttons but stored\n -- as a text field\n },\n [7] = {\n checkboxes = {\n posZ = 0.765,\n count = 3,\n },\n },\n [8] = {\n checkboxes = {\n posZ = 1.06,\n count = 5,\n },\n },\n}\n\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/SummonedServitorUpgradeSheet\")\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/SummonedServitorUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/SummonedServitorUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Summoned Servitor\n\n-- Color information for buttons\nboxSize = 35\n\n-- static values\nxInitial = -0.935\nxOffset = 0.068\n\n-- Locations of the slot selectors\nSLOT_ICON_POSITIONS = {\n arcane = { x = 0.160, z = 0.65 },\n ally = { x = -0.073, z = 0.65 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nSLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n--selectedSlot = SLOT_INDICES.none\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.92,\n count = 1,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.625,\n count = 1,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.33,\n count = 1,\n }\n },\n [4] = {\n checkboxes = {\n posZ = 0.055,\n count = 1,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.26,\n count = 1,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.56,\n count = 2,\n }\n -- Row 6 includes the selection of Arcane/Ally slot, presented with buttons but stored\n -- as a text field\n },\n [7] = {\n checkboxes = {\n posZ = 0.765,\n count = 3,\n },\n },\n [8] = {\n checkboxes = {\n posZ = 1.06,\n count = 5,\n },\n },\n}\n\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "[[0,0,0,0,0,0,0,0,0,0],[\"\"]]", "MeasureMovement": false, "Name": "CardCustom", @@ -173562,7 +177419,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/RunicAxeUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/RunicAxeUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Runic Axe\n\n-- Color information for buttons\nboxSize = 38\n\n-- static values\nxInitial = -0.935\nxOffset = 0.0705\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.92,\n count = 1,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.715,\n count = 1,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.415,\n count = 1,\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.018,\n count = 1,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.265,\n count = 1,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.66,\n count = 3,\n }\n },\n [7] = {\n checkboxes = {\n posZ = 0.86,\n count = 3,\n },\n },\n [8] = {\n checkboxes = {\n posZ = 1.065,\n count = 4,\n },\n },\n}\n\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/RunicAxeUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/RunicAxeUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Runic Axe\n\n-- Color information for buttons\nboxSize = 38\n\n-- static values\nxInitial = -0.935\nxOffset = 0.0705\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.92,\n count = 1,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.715,\n count = 1,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.415,\n count = 1,\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.018,\n count = 1,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.265,\n count = 1,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.66,\n count = 3,\n }\n },\n [7] = {\n checkboxes = {\n posZ = 0.86,\n count = 3,\n },\n },\n [8] = {\n checkboxes = {\n posZ = 1.065,\n count = 4,\n },\n },\n}\n\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "[[0,0,0,0,0,0,0,0,0,0],[\"\",\"\",\"\",\"\",\"\"]]", "MeasureMovement": false, "Name": "CardCustom", @@ -173623,7 +177480,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/PowerWordUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/PowerWordUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Power Word\n\n-- Color information for buttons\nboxSize = 38\n\n-- static values\nxInitial = -0.933\nxOffset = 0.069\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.905,\n count = 1,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.6,\n count = 1,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.32,\n count = 1,\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.02,\n count = 1,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.28,\n count = 2,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.48,\n count = 3,\n }\n },\n [7] = {\n checkboxes = {\n posZ = 0.775,\n count = 3,\n },\n },\n [8] = {\n checkboxes = {\n posZ = 0.975,\n count = 3,\n },\n },\n}\n\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/PowerWordUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/PowerWordUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Power Word\n\n-- Color information for buttons\nboxSize = 38\n\n-- static values\nxInitial = -0.933\nxOffset = 0.069\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.905,\n count = 1,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.6,\n count = 1,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.32,\n count = 1,\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.02,\n count = 1,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.28,\n count = 2,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.48,\n count = 3,\n }\n },\n [7] = {\n checkboxes = {\n posZ = 0.775,\n count = 3,\n },\n },\n [8] = {\n checkboxes = {\n posZ = 0.975,\n count = 3,\n },\n },\n}\n\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "[[0,0,0,0,0,0,0,0,0,0],[\"\",\"\",\"\",\"\",\"\"]]", "MeasureMovement": false, "Name": "CardCustom", @@ -173684,7 +177541,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/PocketMultiToolUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/PocketMultiToolUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Pocket Multi Tool\n\n-- Color information for buttons\nboxSize = 40\n\n-- static values\nxInitial = -0.933\nxOffset = 0.075\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.892,\n count = 1,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.560,\n count = 1,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.326,\n count = 2,\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.092,\n count = 2,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.142,\n count = 2,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.376,\n count = 3,\n }\n },\n [7] = {\n checkboxes = {\n posZ = 0.610,\n count = 4,\n },\n },\n}\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/PocketMultiToolUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/PocketMultiToolUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Pocket Multi Tool\n\n-- Color information for buttons\nboxSize = 40\n\n-- static values\nxInitial = -0.933\nxOffset = 0.075\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.892,\n count = 1,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.560,\n count = 1,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.326,\n count = 2,\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.092,\n count = 2,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.142,\n count = 2,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.376,\n count = 3,\n }\n },\n [7] = {\n checkboxes = {\n posZ = 0.610,\n count = 4,\n },\n },\n}\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "[[0,0,0,0,0,0,0,0,0,0],[\"\",\"\",\"\",\"\",\"\"]]", "MeasureMovement": false, "Name": "CardCustom", @@ -173745,7 +177602,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/MakeshiftTrapUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/MakeshiftTrapUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Makeshift Trap\n\n-- Color information for buttons\nboxSize = 39\n\n-- static values\nxInitial = -0.935\nxOffset = 0.0735\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.889,\n count = 1,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.655,\n count = 1,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.325,\n count = 2,\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.085,\n count = 2,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.252,\n count = 2,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.585,\n count = 3,\n }\n },\n [7] = {\n checkboxes = {\n posZ = 0.927,\n count = 4,\n },\n },\n}\n\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/MakeshiftTrapUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/MakeshiftTrapUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Makeshift Trap\n\n-- Color information for buttons\nboxSize = 39\n\n-- static values\nxInitial = -0.935\nxOffset = 0.0735\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.889,\n count = 1,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.655,\n count = 1,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.325,\n count = 2,\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.085,\n count = 2,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.252,\n count = 2,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.585,\n count = 3,\n }\n },\n [7] = {\n checkboxes = {\n posZ = 0.927,\n count = 4,\n },\n },\n}\n\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "[[0,0,0,0,0,0,0,0,0,0],[\"\",\"\",\"\",\"\",\"\"]]", "MeasureMovement": false, "Name": "CardCustom", @@ -173806,7 +177663,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/LivingInkUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/LivingInkUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Living Ink\n\n-- Size information for buttons\nboxSize = 40\n\n-- static values\nxInitial = -0.935\nxOffset = 0.075\n\n-- Locations of the skill selectors\nSKILL_ICON_POSITIONS = {\n willpower = { x = 0.085, z = -0.88 },\n intellect = { x = -0.183, z = -0.88 },\n combat = { x = -0.473, z = -0.88 },\n agility = { x = -0.74, z = -0.88 },\n}\n\ncustomizations = {\n [1] = { }, -- Empty placeholder for skill selection row, handled by custom skill display\n [2] = {\n checkboxes = {\n posZ = -0.69,\n count = 1,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.355,\n count = 1,\n }\n },\n [4] = {\n checkboxes = {\n posZ = 0.0855,\n count = 2,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.425,\n count = 2,\n }\n },\n [6] = {\n checkboxes = {\n posZ = 0.555,\n count = 3,\n },\n },\n [7] = {\n checkboxes = {\n posZ = 0.685,\n count = 3,\n }\n },\n [8] = {\n checkboxes = {\n posZ = 1.02,\n count = 3,\n },\n },\n}\n\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/LivingInkUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/LivingInkUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Living Ink\n\n-- Size information for buttons\nboxSize = 40\n\n-- static values\nxInitial = -0.935\nxOffset = 0.075\n\n-- Locations of the skill selectors\nSKILL_ICON_POSITIONS = {\n willpower = { x = 0.085, z = -0.88 },\n intellect = { x = -0.183, z = -0.88 },\n combat = { x = -0.473, z = -0.88 },\n agility = { x = -0.74, z = -0.88 },\n}\n\ncustomizations = {\n [1] = { }, -- Empty placeholder for skill selection row, handled by custom skill display\n [2] = {\n checkboxes = {\n posZ = -0.69,\n count = 1,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.355,\n count = 1,\n }\n },\n [4] = {\n checkboxes = {\n posZ = 0.0855,\n count = 2,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.425,\n count = 2,\n }\n },\n [6] = {\n checkboxes = {\n posZ = 0.555,\n count = 3,\n },\n },\n [7] = {\n checkboxes = {\n posZ = 0.685,\n count = 3,\n }\n },\n [8] = {\n checkboxes = {\n posZ = 1.02,\n count = 3,\n },\n },\n}\n\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "[[0,0,0,0,0,0,0,0,0,0],[]]", "MeasureMovement": false, "Name": "CardCustom", @@ -173867,7 +177724,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/HyperphysicalShotcasterUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/HyperphysicalShotcasterUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Hyperphysical Shotcaster\n\n-- Color information for buttons\nboxSize = 38\n\n-- static values\nxInitial = -0.935\nxOffset = 0.069\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.9,\n count = 2,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.615,\n count = 2,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.237,\n count = 2,\n }\n },\n [4] = {\n checkboxes = {\n posZ = 0.232,\n count = 2,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.61,\n count = 2,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.988,\n count = 4,\n }\n },\n [7] = {\n checkboxes = {\n posZ = 1.185,\n count = 4,\n },\n },\n}\n\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/HyperphysicalShotcasterUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/HyperphysicalShotcasterUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Hyperphysical Shotcaster\n\n-- Color information for buttons\nboxSize = 38\n\n-- static values\nxInitial = -0.935\nxOffset = 0.069\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.9,\n count = 2,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.615,\n count = 2,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.237,\n count = 2,\n }\n },\n [4] = {\n checkboxes = {\n posZ = 0.232,\n count = 2,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.61,\n count = 2,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.988,\n count = 4,\n }\n },\n [7] = {\n checkboxes = {\n posZ = 1.185,\n count = 4,\n },\n },\n}\n\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "[[0,0,0,0,0,0,0,0,0,0],[\"\",\"\",\"\",\"\",\"\"]]", "MeasureMovement": false, "Name": "CardCustom", @@ -173928,7 +177785,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/HuntersArmorUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/HuntersArmorUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Hunter's Armor\n\n-- Color information for buttons\nboxSize = 40\n\n-- static values\nxInitial = -0.933\nxOffset = 0.075\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.892,\n count = 1,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.560,\n count = 2,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.220,\n count = 2,\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.092,\n count = 2,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.047,\n count = 2,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.376,\n count = 3,\n }\n },\n [7] = {\n checkboxes = {\n posZ = 0.820,\n count = 3,\n },\n },\n}\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/HuntersArmorUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/HuntersArmorUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Hunter's Armor\n\n-- Color information for buttons\nboxSize = 40\n\n-- static values\nxInitial = -0.933\nxOffset = 0.075\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.892,\n count = 1,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.560,\n count = 2,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.220,\n count = 2,\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.092,\n count = 2,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.047,\n count = 2,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.376,\n count = 3,\n }\n },\n [7] = {\n checkboxes = {\n posZ = 0.820,\n count = 3,\n },\n },\n}\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "[[0,0,0,0,0,0,0,0,0,0],[\"\",\"\",\"\",\"\",\"\"]]", "MeasureMovement": false, "Name": "CardCustom", @@ -173989,7 +177846,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/HonedInstinctUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/HonedInstinctUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Honed Instinct\n\n-- Color information for buttons\nboxSize = 38\n\n-- static values\nxInitial = -0.935\nxOffset = 0.069\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.905,\n count = 1,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.705,\n count = 1,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.5,\n count = 1,\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.29,\n count = 1,\n }\n },\n [5] = {\n checkboxes = {\n posZ = -0.09,\n count = 1,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.12,\n count = 2,\n }\n },\n [7] = {\n checkboxes = {\n posZ = 0.325,\n count = 3,\n },\n },\n [8] = {\n checkboxes = {\n posZ = 0.62,\n count = 5,\n }\n },\n}\n\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/HonedInstinctUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/HonedInstinctUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Honed Instinct\n\n-- Color information for buttons\nboxSize = 38\n\n-- static values\nxInitial = -0.935\nxOffset = 0.069\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.905,\n count = 1,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.705,\n count = 1,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.5,\n count = 1,\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.29,\n count = 1,\n }\n },\n [5] = {\n checkboxes = {\n posZ = -0.09,\n count = 1,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.12,\n count = 2,\n }\n },\n [7] = {\n checkboxes = {\n posZ = 0.325,\n count = 3,\n },\n },\n [8] = {\n checkboxes = {\n posZ = 0.62,\n count = 5,\n }\n },\n}\n\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "[[0,0,0,0,0,0,0,0,0,0],[\"\",\"\",\"\",\"\",\"\"]]", "MeasureMovement": false, "Name": "CardCustom", @@ -174050,7 +177907,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/GrizzledUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/GrizzledUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Grizzled\n\n-- Color information for buttons and input boxes\nboxSize = 40\ninputFontsize = 50\n\n-- static values\nxInitial = -0.933\nxOffset = 0.075\n\ncustomizations = {\n [1] = {\n textField = {\n position = { 0.3, 0.25, -0.91 },\n width = 600\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.71,\n count = 1,\n },\n textField = {\n position = { 0.005, 0.25, -0.58 },\n width = 875\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.458,\n count = 2,\n },\n textField = {\n position = { 0.005, 0.25, -0.32 },\n width = 875\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.205,\n count = 3,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.362,\n count = 4,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.82,\n count = 5,\n },\n },\n}\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/GrizzledUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/GrizzledUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Grizzled\n\n-- Color information for buttons and input boxes\nboxSize = 40\ninputFontsize = 50\n\n-- static values\nxInitial = -0.933\nxOffset = 0.075\n\ncustomizations = {\n [1] = {\n textField = {\n position = { 0.3, 0.25, -0.91 },\n width = 600\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.71,\n count = 1,\n },\n textField = {\n position = { 0.005, 0.25, -0.58 },\n width = 875\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.458,\n count = 2,\n },\n textField = {\n position = { 0.005, 0.25, -0.32 },\n width = 875\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.205,\n count = 3,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.362,\n count = 4,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.82,\n count = 5,\n },\n },\n}\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "[[0,0,0,0,0,0,0,0,0,0],[\"\",\"\",\"\",\"\",\"\"]]", "MeasureMovement": false, "Name": "CardCustom", @@ -174111,7 +177968,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/FriendsinLowPlacesUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/FriendsinLowPlacesUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Friends in Low Places\n\n-- Color information for buttons and input boxes\nboxSize = 36\ninputFontsize = 50\n\n-- static values\nxInitial = -0.935\nxOffset = 0.0685\n\ncustomizations = {\n [1] = {\n textField = {\n position = { 0.275, 0.25, -0.91 },\n width = 640\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.725,\n count = 1,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.44,\n count = 2,\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.05,\n count = 2,\n },\n textField = {\n position = { 0.6295, 0.25, -0.44 },\n width = 290\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.25,\n count = 2,\n }\n },\n [6] = {\n checkboxes = {\n posZ = 0.545,\n count = 2,\n },\n },\n [7] = {\n checkboxes = {\n posZ = 0.75,\n count = 3,\n }\n },\n [8] = {\n checkboxes = {\n posZ = 0.95,\n count = 3,\n }\n },\n}\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/FriendsinLowPlacesUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/FriendsinLowPlacesUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Friends in Low Places\n\n-- Color information for buttons and input boxes\nboxSize = 36\ninputFontsize = 50\n\n-- static values\nxInitial = -0.935\nxOffset = 0.0685\n\ncustomizations = {\n [1] = {\n textField = {\n position = { 0.275, 0.25, -0.91 },\n width = 640\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.725,\n count = 1,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.44,\n count = 2,\n },\n textField = {\n position = { 0.6295, 0.25, -0.44 },\n width = 290\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.05,\n count = 2,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.25,\n count = 2,\n }\n },\n [6] = {\n checkboxes = {\n posZ = 0.545,\n count = 2,\n },\n },\n [7] = {\n checkboxes = {\n posZ = 0.75,\n count = 3,\n }\n },\n [8] = {\n checkboxes = {\n posZ = 0.95,\n count = 3,\n }\n },\n}\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "[[0,0,0,0,0,0,0,0,0,0],[\"\",\"\",\"\",\"\",\"\"]]", "MeasureMovement": false, "Name": "CardCustom", @@ -174172,7 +178029,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/EmpiricalHypothesisUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/EmpiricalHypothesisUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Empirical Hypothesis\n\n-- Color information for buttons\nboxSize = 37\n\n-- static values\nxInitial = -0.935\nxOffset = 0.069\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.905,\n count = 1,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.7,\n count = 1,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.505,\n count = 1,\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.3,\n count = 1,\n }\n },\n [5] = {\n checkboxes = {\n posZ = -0.09,\n count = 2,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.3,\n count = 2,\n }\n },\n [7] = {\n checkboxes = {\n posZ = 0.592,\n count = 3,\n },\n },\n [8] = {\n checkboxes = {\n posZ = 0.888,\n count = 4,\n }\n },\n}\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playercards/customizable/EmpiricalHypothesisUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Empirical Hypothesis\n\n-- Color information for buttons\nboxSize = 37\n\n-- static values\nxInitial = -0.935\nxOffset = 0.069\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.905,\n count = 1,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.7,\n count = 1,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.505,\n count = 1,\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.3,\n count = 1,\n }\n },\n [5] = {\n checkboxes = {\n posZ = -0.09,\n count = 2,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.3,\n count = 2,\n }\n },\n [7] = {\n checkboxes = {\n posZ = 0.592,\n count = 3,\n },\n },\n [8] = {\n checkboxes = {\n posZ = 0.888,\n count = 4,\n }\n },\n}\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/EmpiricalHypothesisUpgradeSheet\")\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "[[0,0,0,0,0,0,0,0,0,0],[\"\",\"\",\"\",\"\",\"\"]]", "MeasureMovement": false, "Name": "CardCustom", @@ -174233,7 +178090,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/DamningTestimonyUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/DamningTestimonyUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Damning Testimony\n\n-- Color information for buttons\nboxSize = 40\n\n-- static values\nxInitial = -0.935\nxOffset = 0.075\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.925,\n count = 1,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.475,\n count = 2,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.25,\n count = 2,\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.01,\n count = 3,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.428,\n count = 3,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.772,\n count = 4,\n }\n },\n}\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/DamningTestimonyUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/DamningTestimonyUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Damning Testimony\n\n-- Color information for buttons\nboxSize = 40\n\n-- static values\nxInitial = -0.935\nxOffset = 0.075\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.925,\n count = 1,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.475,\n count = 2,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.25,\n count = 2,\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.01,\n count = 3,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.428,\n count = 3,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.772,\n count = 4,\n }\n },\n}\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "[[0,0,0,0,0,0,0,0,0,0],[\"\",\"\",\"\",\"\",\"\"]]", "MeasureMovement": false, "Name": "CardCustom", @@ -174294,7 +178151,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/CustomModificationsUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/CustomModificationsUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Custom Modifications\n\n-- Color information for buttons\nboxSize = 38\n\n-- static values\nxInitial = -0.935\nxOffset = 0.0735\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.895,\n count = 1,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.455,\n count = 2,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.215,\n count = 2,\n }\n },\n [4] = {\n checkboxes = {\n posZ = 0.115,\n count = 3,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.453,\n count = 3,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.794,\n count = 4,\n }\n },\n}\n\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playercards/customizable/CustomModificationsUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Custom Modifications\n\n-- Color information for buttons\nboxSize = 38\n\n-- static values\nxInitial = -0.935\nxOffset = 0.0735\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.895,\n count = 1,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.455,\n count = 2,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.215,\n count = 2,\n }\n },\n [4] = {\n checkboxes = {\n posZ = 0.115,\n count = 3,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.453,\n count = 3,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.794,\n count = 4,\n }\n },\n}\n\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/CustomModificationsUpgradeSheet\")\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "[[0,0,0,0,0,0,0,0,0,0],[\"\",\"\",\"\",\"\",\"\"]]", "MeasureMovement": false, "Name": "CardCustom", @@ -174355,7 +178212,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/AlchemicalDistillationUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/AlchemicalDistillationUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Alchemical Distillation\n\n-- Color information for buttons\nboxSize = 40\n\n-- static values\nxInitial = -0.933\nxOffset = 0.075\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.892,\n count = 1,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.665,\n count = 1,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.43,\n count = 1,\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.092,\n count = 2,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.142,\n count = 2,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.376,\n count = 4,\n }\n },\n [7] = {\n checkboxes = {\n posZ = 0.815,\n count = 5,\n }\n },\n}\n\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/AlchemicalDistillationUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/AlchemicalDistillationUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Alchemical Distillation\n\n-- Color information for buttons\nboxSize = 40\n\n-- static values\nxInitial = -0.933\nxOffset = 0.075\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.892,\n count = 1,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.665,\n count = 1,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.43,\n count = 1,\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.092,\n count = 2,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.142,\n count = 2,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.376,\n count = 4,\n }\n },\n [7] = {\n checkboxes = {\n posZ = 0.815,\n count = 5,\n }\n },\n}\n\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "[[0,0,0,0,0,0,0,0,0,0],[\"\",\"\",\"\",\"\",\"\"]]", "MeasureMovement": false, "Name": "CardCustom", @@ -174972,7 +178829,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/TheRavenQuillUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/TheRavenQuillUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: The Raven Quill\n\n-- Color information for buttons and input boxes\nboxSize = 37\ninputFontsize = 38\n\n-- static values\nxInitial = -0.935\nxOffset = 0.0705\n\ncustomizations = {\n [1] = {\n textField = {\n position = { 0.5, 0.25, -0.905 },\n width = 425\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.72,\n count = 1,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.52,\n count = 1,\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.305,\n count = 2,\n }\n },\n [5] = {\n checkboxes = {\n posZ = -0.105,\n count = 2,\n },\n textField = {\n position = { 0.125, 0.25, 0 },\n width = 775\n }\n },\n [6] = {\n checkboxes = {\n posZ = 0.1,\n count = 2,\n }\n },\n [7] = {\n checkboxes = {\n posZ = 0.4,\n count = 3,\n }\n },\n [8] = {\n checkboxes = {\n posZ = 0.695,\n count = 4,\n }\n },\n}\n\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/TheRavenQuillUpgradeSheet\")\nend)\n__bundle_register(\"playercards/customizable/TheRavenQuillUpgradeSheet\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: The Raven Quill\n\n-- Color information for buttons and input boxes\nboxSize = 37\ninputFontsize = 38\n\n-- static values\nxInitial = -0.935\nxOffset = 0.0705\n\ncustomizations = {\n [1] = {\n textField = {\n position = { 0.5, 0.25, -0.905 },\n width = 425\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.72,\n count = 1,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.52,\n count = 1,\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.305,\n count = 2,\n }\n },\n [5] = {\n checkboxes = {\n posZ = -0.105,\n count = 2,\n },\n textField = {\n position = { 0.125, 0.25, 0 },\n width = 775\n }\n },\n [6] = {\n checkboxes = {\n posZ = 0.1,\n count = 2,\n }\n },\n [7] = {\n checkboxes = {\n posZ = 0.4,\n count = 3,\n }\n },\n [8] = {\n checkboxes = {\n posZ = 0.695,\n count = 4,\n }\n },\n}\n\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "[[0,0,0,0,0,0,0,0,0,0],[\"\",\"\",\"\",\"\",\"\"]]", "MeasureMovement": false, "Name": "CardCustom", @@ -175015,7 +178872,7 @@ "2664": { "BackIsHidden": true, "BackURL": "http://cloud-3.steamusercontent.com/ugc/1874087305860121579/39578AC78E34DAA169AB4DE4246BB1E002528B8C/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/1874087305860119704/FCC908E5C313759E9E478D5952C74179DF80ADA8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021605474902965618/1DA915D6106D951592457701CBA262B73CBEDE6B/", "NumHeight": 5, "NumWidth": 7, "Type": 0, @@ -178133,7 +181990,7 @@ "2664": { "BackIsHidden": true, "BackURL": "http://cloud-3.steamusercontent.com/ugc/1874087305860121579/39578AC78E34DAA169AB4DE4246BB1E002528B8C/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/1874087305860119704/FCC908E5C313759E9E478D5952C74179DF80ADA8/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021605474902965618/1DA915D6106D951592457701CBA262B73CBEDE6B/", "NumHeight": 5, "NumWidth": 7, "Type": 0, @@ -178523,7 +182380,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/RunicAxeUpgradeSheetTaboo\")\nend)\n__bundle_register(\"playercards/customizable/RunicAxeUpgradeSheetTaboo\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Runic Axe (Taboo)\n\n-- Color information for buttons\nboxSize = 38\n\n-- static values\nxInitial = -0.935\nxOffset = 0.0705\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.92,\n count = 1,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.715,\n count = 1,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.415,\n count = 1,\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.018,\n count = 2,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.265,\n count = 1,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.66,\n count = 3,\n }\n },\n [7] = {\n checkboxes = {\n posZ = 0.86,\n count = 3,\n },\n },\n [8] = {\n checkboxes = {\n posZ = 1.065,\n count = 4,\n },\n },\n}\n\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/RunicAxeUpgradeSheetTaboo\")\nend)\n__bundle_register(\"playercards/customizable/RunicAxeUpgradeSheetTaboo\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Runic Axe (Taboo)\n\n-- Color information for buttons\nboxSize = 38\n\n-- static values\nxInitial = -0.935\nxOffset = 0.0705\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.92,\n count = 1,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.715,\n count = 1,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.415,\n count = 1,\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.018,\n count = 2,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.265,\n count = 1,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.66,\n count = 3,\n }\n },\n [7] = {\n checkboxes = {\n posZ = 0.86,\n count = 3,\n },\n },\n [8] = {\n checkboxes = {\n posZ = 1.065,\n count = 4,\n },\n },\n}\n\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "[[0,0,0,0,0,0,0,0,0,0],[\"\",\"\",\"\",\"\",\"\"]]", "MeasureMovement": false, "Name": "Card", @@ -178584,7 +182441,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/PowerWordUpgradeSheetTaboo\")\nend)\n__bundle_register(\"playercards/customizable/PowerWordUpgradeSheetTaboo\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Power Word (Taboo)\n\n-- Color information for buttons\nboxSize = 38\n\n-- static values\nxInitial = -0.933\nxOffset = 0.069\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.905,\n count = 1,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.6,\n count = 1,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.42,\n count = 1,\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.12,\n count = 1,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.18,\n count = 2,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.38,\n count = 3,\n }\n },\n [7] = {\n checkboxes = {\n posZ = 0.675,\n count = 3,\n },\n },\n [8] = {\n checkboxes = {\n posZ = 0.875,\n count = 3,\n },\n },\n}\n\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/customizable/PowerWordUpgradeSheetTaboo\")\nend)\n__bundle_register(\"playercards/customizable/PowerWordUpgradeSheetTaboo\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Customizable Cards: Power Word (Taboo)\n\n-- Color information for buttons\nboxSize = 38\n\n-- static values\nxInitial = -0.933\nxOffset = 0.069\n\ncustomizations = {\n [1] = {\n checkboxes = {\n posZ = -0.905,\n count = 1,\n }\n },\n [2] = {\n checkboxes = {\n posZ = -0.6,\n count = 1,\n }\n },\n [3] = {\n checkboxes = {\n posZ = -0.42,\n count = 1,\n }\n },\n [4] = {\n checkboxes = {\n posZ = -0.12,\n count = 1,\n }\n },\n [5] = {\n checkboxes = {\n posZ = 0.18,\n count = 2,\n },\n },\n [6] = {\n checkboxes = {\n posZ = 0.38,\n count = 3,\n }\n },\n [7] = {\n checkboxes = {\n posZ = 0.675,\n count = 3,\n },\n },\n [8] = {\n checkboxes = {\n posZ = 0.875,\n count = 3,\n },\n },\n}\n\nrequire(\"playercards/customizable/UpgradeSheetLibrary\")\nend)\n__bundle_register(\"playercards/customizable/UpgradeSheetLibrary\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Common code for handling customizable card upgrade sheets\n-- Define UI elements in the base card file, then include this\n-- UI element definition is an array of tables, each with this structure. A row may include\n-- checkboxes (number defined by count), a text field, both, or neither (if the row has custom\n-- handling, as Living Ink does)\n-- {\n-- checkboxes = {\n-- posZ = -0.71,\n-- count = 1,\n-- },\n-- textField = {\n-- position = { 0.005, 0.25, -0.58 },\n-- width = 875\n-- }\n-- }\n-- Fields should also be defined for xInitial (left edge of the checkboxes) and xOffset (amount to\n-- shift X from one box to the next) as well as boxSize (checkboxes) and inputFontSize.\n--\n-- selectedUpgrades holds the state of checkboxes and text input, each element being:\n-- selectedUpgrades[row] = { xp = #, text = \"\" }\n\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- Y position for UI elements. Visibility of checkboxes moves the checkbox inside the card object\n-- when not selected.\nlocal Y_VISIBLE = 0.25\nlocal Y_INVISIBLE = -0.5\n\n-- Used for Summoned Servitor and Living Ink\nlocal VECTOR_COLOR = {\n unselected = { 0.5, 0.5, 0.5, 0.75 },\n mystic = { 0.597, 0.195, 0.796 }\n}\n\n-- These match with ArkhamDB's way of storing the data in the dropdown menu\nlocal SUMMONED_SERVITOR_SLOT_INDICES = { arcane = \"1\", ally = \"0\", none = \"\" }\n\nlocal rowCheckboxFirstIndex = { }\nlocal rowInputIndex = { }\nlocal selectedUpgrades = { }\n\n-- save state when going into bags / decks\nfunction onDestroy() self.script_state = onSave() end\n\nfunction onSave()\n return JSON.encode({\n selections = selectedUpgrades\n })\nend\n\n-- Startup procedure\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n if loadedData.selections ~= nil then\n selectedUpgrades = loadedData.selections\n end\n end\n\n selfId = getSelfId()\n\n maybeLoadLivingInkSkills()\n createUi()\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\n\n self.addContextMenuItem(\"Clear Selections\", function() resetSelections() end)\n self.addContextMenuItem(\"Scale: 1x\", function() self.setScale({ 1, 1, 1 }) end)\n self.addContextMenuItem(\"Scale: 2x\", function() self.setScale({ 2, 1, 2 }) end)\n self.addContextMenuItem(\"Scale: 3x\", function() self.setScale({ 3, 1, 3 }) end)\nend\n\n-- Grabs the ID from the metadata for special functions (Living Ink, Summoned Servitor)\nfunction getSelfId()\n local metadata = JSON.decode(self.getGMNotes())\n return metadata.id\nend\n\nfunction isUpgradeActive(row)\n return customizations[row] ~= nil\n and customizations[row].checkboxes ~= nil\n and customizations[row].checkboxes.count ~= nil\n and customizations[row].checkboxes.count \u003e 0\n and selectedUpgrades[row] ~= nil\n and selectedUpgrades[row].xp ~= nil\n and selectedUpgrades[row].xp \u003e= customizations[row].checkboxes.count\nend\n\nfunction resetSelections()\n selectedUpgrades = { }\n updateDisplay()\nend\n\nfunction createUi()\n if customizations == nil then\n return\n end\n for i = 1, #customizations do\n if customizations[i].checkboxes ~= nil then\n createRowCheckboxes(i)\n end\n if customizations[i].textField ~= nil then\n createRowTextField(i)\n end\n end\n maybeMakeLivingInkSkillSelectionButtons()\n maybeMakeServitorSlotSelectionButtons()\n updateDisplay()\nend\n\nfunction createRowCheckboxes(rowIndex)\n local checkboxes = customizations[rowIndex].checkboxes\n rowCheckboxFirstIndex[rowIndex] = 0\n local previousButtons = self.getButtons()\n if previousButtons ~= nil then\n rowCheckboxFirstIndex[rowIndex] = #previousButtons\n end\n for col = 1, checkboxes.count do\n local funcName = \"checkboxRow\" .. rowIndex .. \"Col\" .. col\n local func = function() clickCheckbox(rowIndex, col) end\n self.setVar(funcName, func)\n local checkboxPos = getCheckboxPosition(rowIndex, col)\n\n self.createButton({\n click_function = funcName,\n function_owner = self,\n position = checkboxPos,\n height = boxSize * 10,\n width = boxSize * 10,\n font_size = 1000,\n scale = { 0.1, 0.1, 0.1 },\n color = { 0, 0, 0 },\n font_color = { 0, 0, 0 }\n })\n end\nend\n\nfunction getCheckboxPosition(row, col)\n return {\n x = xInitial + col * xOffset,\n y = Y_VISIBLE,\n z = customizations[row].checkboxes.posZ\n }\nend\n\nfunction createRowTextField(rowIndex)\n local textField = customizations[rowIndex].textField\n\n rowInputIndex[rowIndex] = 0\n local previousInputs = self.getInputs()\n if previousInputs ~= nil then\n rowInputIndex[rowIndex] = #previousInputs\n end\n local funcName = \"textbox\" .. rowIndex\n local func = function(_, _, val, sel) clickTextbox(rowIndex, val, sel) end\n self.setVar(funcName, func)\n\n self.createInput({\n input_function = funcName,\n function_owner = self,\n label = \"Click to type\",\n alignment = 2,\n position = textField.position,\n scale = { 0.1, 0.1, 0.1 },\n width = textField.width * 10,\n height = inputFontsize * 10 + 75,\n font_size = inputFontsize * 10.5,\n color = \"White\",\n value = \"\"\n })\nend\n\nfunction updateDisplay()\n for i = 1, #customizations do\n updateRowDisplay(i)\n end\n maybeUpdateLivingInkSkillDisplay()\n maybeUpdateServitorSlotDisplay()\nend\n\nfunction updateRowDisplay(rowIndex)\n if customizations[rowIndex].checkboxes ~= nil then\n updateCheckboxes(rowIndex)\n end\n if customizations[rowIndex].textField ~= nil then\n updateTextField(rowIndex)\n end\nend\n\nfunction updateCheckboxes(rowIndex)\n local checkboxCount = customizations[rowIndex].checkboxes.count\n local selected = 0\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].xp ~= nil then\n selected = selectedUpgrades[rowIndex].xp\n end\n local checkboxIndex = rowCheckboxFirstIndex[rowIndex]\n for col = 1, checkboxCount do\n local pos = getCheckboxPosition(rowIndex, col)\n if col \u003c= selected then\n pos.y = Y_VISIBLE\n else\n pos.y = Y_INVISIBLE\n end\n self.editButton({\n index = checkboxIndex,\n position = pos\n })\n checkboxIndex = checkboxIndex + 1\n end\nend\n\nfunction updateTextField(rowIndex)\n local inputIndex = rowInputIndex[rowIndex]\n if selectedUpgrades[rowIndex] ~= nil and selectedUpgrades[rowIndex].text ~= nil then\n self.editInput({\n index = inputIndex,\n value = \" \" .. selectedUpgrades[rowIndex].text\n })\n end\nend\n\nfunction clickCheckbox(row, col, buttonIndex)\n if selectedUpgrades[row] == nil then\n selectedUpgrades[row] = { }\n selectedUpgrades[row].xp = 0\n end\n if selectedUpgrades[row].xp == col then\n selectedUpgrades[row].xp = col - 1\n else\n selectedUpgrades[row].xp = col\n end\n updateCheckboxes(row)\n playmatApi.syncAllCustomizableCards()\nend\n\n-- Updates saved value for given text box when it loses focus\nfunction clickTextbox(rowIndex, value, selected)\n if selected == false then\n if selectedUpgrades[rowIndex] == nil then\n selectedUpgrades[rowIndex] = { }\n end\n selectedUpgrades[rowIndex].text = value:gsub(\"^%s*(.-)%s*$\", \"%1\")\n -- Editing isn't actually done yet, and will block the update. Wait a frame so it's finished\n Wait.frames(function() updateRowDisplay(rowIndex) end, 1)\n end\nend\n\n---------------------------------------------------------\n-- Living Ink related functions\n---------------------------------------------------------\n\n-- Builds the list of boolean skill selections from the Row 1 text field\nfunction maybeLoadLivingInkSkills()\n if selfId ~= \"09079-c\" then return end\n selectedSkills = {\n willpower = false,\n intellect = false,\n combat = false,\n agility = false\n }\n if selectedUpgrades[1] ~= nil and selectedUpgrades[1].text ~= nil then\n for skill in string.gmatch(selectedUpgrades[1].text, \"([^,]+)\") do\n selectedSkills[skill] = true\n end\n end\nend\n\nfunction clickSkill(skillname)\n selectedSkills[skillname] = not selectedSkills[skillname]\n maybeUpdateLivingInkSkillDisplay()\n updateSelectedLivingInkSkillText()\nend\n\n-- Creates the invisible buttons overlaying the skill icons\nfunction maybeMakeLivingInkSkillSelectionButtons()\n if selfId ~= \"09079-c\" then return end\n\n local buttonData = {\n function_owner = self,\n position = { y = 0.2 },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n\n for skillname, _ in pairs(selectedSkills) do\n local funcName = \"clickSkill\" .. skillname\n self.setVar(funcName, function() clickSkill(skillname) end)\n\n buttonData.click_function = funcName\n buttonData.position.x = -1 * SKILL_ICON_POSITIONS[skillname].x\n buttonData.position.z = SKILL_ICON_POSITIONS[skillname].z\n self.createButton(buttonData)\n end\nend\n\n-- Builds a comma-delimited string of skills and places it in the Row 1 text field\nfunction updateSelectedLivingInkSkillText()\n local skillString = \"\"\n if selectedSkills.willpower then\n skillString = skillString .. \"willpower\" .. \",\"\n end\n if selectedSkills.intellect then\n skillString = skillString .. \"intellect\" .. \",\"\n end\n if selectedSkills.combat then\n skillString = skillString .. \"combat\" .. \",\"\n end\n if selectedSkills.agility then\n skillString = skillString .. \"agility\" .. \",\"\n end\n if selectedUpgrades[1] == nil then\n selectedUpgrades[1] = { }\n end\n selectedUpgrades[1].text = skillString\nend\n\n-- Refresh the vector circles indicating a skill is selected. Since we can only have one table of\n-- vectors set, have to refresh all 4 at once\nfunction maybeUpdateLivingInkSkillDisplay()\n if selfId ~= \"09079-c\" then return end\n local circles = {}\n for skill, isSelected in pairs(selectedSkills) do\n if isSelected then\n local circle = getCircleVector(SKILL_ICON_POSITIONS[skill])\n if circle ~= nil then\n table.insert(circles, circle)\n end\n end\n end\n self.setVectorLines(circles)\nend\n\nfunction getCircleVector(center)\n local diameter = Vector(0, 0, 0.1)\n local pointOfOrigin = Vector(center.x, Y_VISIBLE, center.z)\n local vec\n local vecList = {}\n local arcStep = 5\n for i = 0, 360, arcStep do\n diameter:rotateOver('y', arcStep)\n vec = pointOfOrigin + diameter\n vec.y = pointOfOrigin.y\n table.insert(vecList, vec)\n end\n\n return {\n points = vecList,\n color = VECTOR_COLOR.mystic,\n thickness = 0.02,\n }\nend\n\n---------------------------------------------------------\n-- Summoned Servitor related functions\n---------------------------------------------------------\n\n-- Creates the invisible buttons overlaying the slot words\nfunction maybeMakeServitorSlotSelectionButtons()\n if selfId ~= \"09080-c\" then return end\n\n local buttonData = {\n click_function = \"clickArcane\",\n function_owner = self,\n position = { x = -1 * SLOT_ICON_POSITIONS.arcane.x, y = 0.2, z = SLOT_ICON_POSITIONS.arcane.z },\n height = 130,\n width = 130,\n color = { 0, 0, 0, 0 },\n }\n self.createButton(buttonData)\n\n buttonData.click_function = \"clickAlly\"\n buttonData.position.x = -1 * SLOT_ICON_POSITIONS.ally.x\n self.createButton(buttonData)\nend\n\n-- toggles the clicked slot\nfunction clickArcane()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.arcane\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- toggles the clicked slot\nfunction clickAlly()\n if selectedUpgrades[6] == nil then\n selectedUpgrades[6] = { }\n end\n if selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.none\n else\n selectedUpgrades[6].text = SUMMONED_SERVITOR_SLOT_INDICES.ally\n end\n maybeUpdateServitorSlotDisplay()\nend\n\n-- Refresh the vector circles indicating a slot is selected.\nfunction maybeUpdateServitorSlotDisplay()\n if selfId ~= \"09080-c\" then return end\n\n local center = SLOT_ICON_POSITIONS[\"arcane\"]\n local arcaneVecList = {\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.12, Y_VISIBLE, center.z + 0.05),\n }\n\n center = SLOT_ICON_POSITIONS[\"ally\"]\n local allyVecList = {\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z + 0.05),\n Vector(center.x - 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z - 0.05),\n Vector(center.x + 0.07, Y_VISIBLE, center.z + 0.05),\n }\n\n local arcaneVecColor = VECTOR_COLOR.unselected\n local allyVecColor = VECTOR_COLOR.unselected\n\n if selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.arcane then\n arcaneVecColor = VECTOR_COLOR.mystic\n elseif selectedUpgrades[6] ~= nil and selectedUpgrades[6].text == SUMMONED_SERVITOR_SLOT_INDICES.ally then\n allyVecColor = VECTOR_COLOR.mystic\n end\n\n self.setVectorLines({\n {\n points = arcaneVecList,\n color = arcaneVecColor,\n thickness = 0.02,\n },\n {\n points = allyVecList,\n color = allyVecColor,\n thickness = 0.02,\n }\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "[[0,0,0,0,0,0,0,0,0,0],[\"\",\"\",\"\",\"\",\"\"]]", "MeasureMovement": false, "Name": "Card", @@ -178627,7 +182484,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -178689,7 +182546,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -178750,7 +182607,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -178811,7 +182668,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -178872,7 +182729,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -178933,7 +182790,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -178994,7 +182851,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -179055,7 +182912,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -179116,7 +182973,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -179178,7 +183035,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -179240,7 +183097,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -179301,7 +183158,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -179362,7 +183219,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -179424,7 +183281,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -179485,7 +183342,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -179547,7 +183404,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -179608,7 +183465,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -179669,7 +183526,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -179731,7 +183588,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -179792,7 +183649,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -179853,7 +183710,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -179915,7 +183772,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -179977,7 +183834,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -180039,7 +183896,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -180057,7 +183914,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playercards/cards/FluteoftheOuterGods4\", function(require, _LOADED, __bundle_register, __bundle_modules)\nVALID_TOKENS = {\n [\"Curse\"] = true\n}\n\nSHOW_SINGLE_RELEASE = true\nKEEP_OPEN = true\n\nrequire(\"playercards/CardsThatSealTokens\")\nend)\n__bundle_register(\"playercards/CardsThatSealTokens\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Library for cards that seal tokens\nThis file is used to add sealing option to cards' context menu.\nValid options (set before requiring this file):\n\nUPDATE_ON_HOVER --@type: boolean\n - automatically updates the context menu options when the card is hovered\n - the \"Read Bag\" function reads the content of the chaos bag to update the context menu\n - example usage: \"Unrelenting\" (to only display valid tokens)\n\nKEEP_OPEN --@type: boolean\n- meant for cards that seal single tokens multiple times (one by one)\n- makes the context menu stay open after selecting an option\n- example usage: \"Unrelenting\"\n\nSHOW_SINGLE_RELEASE --@type: boolean\n - enables an entry in the context menu\n - this entry allows releasing a single token\n - example usage: \"Holy Spear\" (to keep the other tokens and just release one)\n\nSHOW_MULTI_RELEASE --@type: number (amount of tokens to release at once)\n - enables an entry in the context menu\n - this entry allows releasing of multiple tokens at once\n - example usage: \"Nephthys\" (to release 3 bless tokens at once)\n\nSHOW_MULTI_SEAL --@type: number (amount of tokens to seal at once)\n - enables an entry in the context menu\n - this entry allows sealing of multiple tokens at once\n - example usage: \"Holy Spear\" (to seal two bless tokens at once)\n\nVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens should be abled to be sealed\n - needs to be defined for each card -\u003e even if empty\n - example usage: \"The Chthonian Stone\"\n \u003e VALID_TOKENS = {\n \u003e [\"Skull\"] = true,\n \u003e [\"Cultist\"] = true,\n \u003e [\"Tablet\"] = true,\n \u003e [\"Elder Thing\"] = true,\n \u003e }\n\nINVALID_TOKENS --@type: table ([tokenName] = true)\n - this table defines which tokens are invalid for sealing\n - only needs to be defined if needed\n - usually combined with empty \"VALID_TOKENS\" table\n - example usage: \"Protective Incantation\" (not allowed to seal Auto-fail)\n\n----------------------------------------------------------\nExample 1: Crystalline Elder Sign\nThis card can only seal the \"+1\" or \"Elder Sign\" token,\nit does not need specific options for multi-sealing or releasing.\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"+1\"] = true,\n \u003e [\"Elder Sign\"] = true\n \u003e }\n \u003e require...\n----------------------------------------------------------\nExample 2: Holy Spear\nThis card features the following abilities (just listing the relevant parts):\n- releasing a single bless token\n- sealing two bless tokens\nThus it should be implemented like this:\n \u003e VALID_TOKENS = {\n \u003e [\"Bless\"] = true\n \u003e }\n \u003e SHOW_SINGLE_RELEASE = true\n \u003e SHOW_MULTI_SEAL = 2\n \u003e require...\n----------------------------------------------------------]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal tokenArrangerApi = require(\"accessories/TokenArrangerApi\")\n\nlocal sealedTokens = {}\nlocal ID_URL_MAP = {}\nlocal tokensInBag = {}\n\nfunction onSave() return JSON.encode(sealedTokens) end\n\nfunction onLoad(savedData)\n sealedTokens = JSON.decode(savedData) or {}\n ID_URL_MAP = chaosBagApi.getIdUrlMap()\n generateContextMenu()\n self.addTag(\"CardThatSeals\")\nend\n\n-- builds the context menu\nfunction generateContextMenu()\n -- conditional single or multi release options\n if SHOW_SINGLE_RELEASE then\n self.addContextMenuItem(\"Release token\", releaseOneToken)\n elseif SHOW_MULTI_RELEASE then\n self.addContextMenuItem(\"Release \" .. SHOW_MULTI_RELEASE .. \" token(s)\", releaseMultipleTokens)\n else\n self.addContextMenuItem(\"Release token(s)\", releaseAllTokens)\n end\n\n -- main context menu options to seal tokens\n for _, map in pairs(ID_URL_MAP) do\n if (VALID_TOKENS[map.name] ~= nil) or (UPDATE_ON_HOVER and tokensInBag[map.name] and not INVALID_TOKENS[map.name]) then\n if not SHOW_MULTI_SEAL then\n self.addContextMenuItem(\"Seal \" .. map.name, function(playerColor)\n sealToken(map.name, playerColor)\n end, KEEP_OPEN)\n else\n self.addContextMenuItem(\"Seal \" .. SHOW_MULTI_SEAL .. \" \" .. map.name, function(playerColor)\n readBag()\n local allowed = true\n local notFound\n\n for name, _ in pairs(VALID_TOKENS) do\n if (tokensInBag[name] or 0) \u003c SHOW_MULTI_SEAL then\n allowed = false\n notFound = name\n end\n end\n\n if allowed then\n for i = 1, SHOW_MULTI_SEAL do\n sealToken(map.name, playerColor)\n end\n else\n printToColor(\"Not enough \" .. notFound .. \" tokens in the chaos bag.\", playerColor)\n end\n end)\n end\n end\n end\nend\n\n-- generates a list of chaos tokens that is in the chaos bag\nfunction readBag()\n local chaosbag = chaosBagApi.findChaosBag()\n tokensInBag = {}\n\n for _, token in ipairs(chaosbag.getObjects()) do\n tokensInBag[token.name] = (tokensInBag[token.name] or 0) + 1\n end\nend\n\n-- native event from TTS - used to update the context menu for cards like \"Unrelenting\"\nfunction onHover()\n if UPDATE_ON_HOVER then\n readBag()\n self.clearContextMenu()\n generateContextMenu()\n end\nend\n\n-- seals the named token on this card\nfunction sealToken(name, playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n local chaosbag = chaosBagApi.findChaosBag()\n for i, obj in ipairs(chaosbag.getObjects()) do\n if obj.name == name then\n chaosbag.takeObject({\n position = self.getPosition() + Vector(0, 0.5 + 0.1 * #sealedTokens, 0),\n rotation = self.getRotation(),\n index = i - 1,\n smooth = false,\n callback_function = function(token)\n local guid = token.getGUID()\n table.insert(sealedTokens, guid)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.sealedToken(name, guid)\n end\n end\n })\n return\n end\n end\n printToColor(name .. \" token not found in chaos bag\", playerColor)\nend\n\n-- release the last sealed token\nfunction releaseOneToken(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token\", playerColor)\n putTokenAway(table.remove(sealedTokens))\n end\nend\n\n-- release multiple tokens at once\nfunction releaseMultipleTokens(playerColor)\n if SHOW_MULTI_RELEASE \u003c= #sealedTokens then\n for i = 1, SHOW_MULTI_RELEASE do\n putTokenAway(table.remove(sealedTokens))\n end\n printToColor(\"Releasing \" .. SHOW_MULTI_RELEASE .. \" tokens\", playerColor)\n else\n printToColor(\"Not enough tokens sealed.\", playerColor)\n end\nend\n\n-- releases all sealed tokens\nfunction releaseAllTokens(playerColor)\n if not chaosBagApi.canTouchChaosTokens() then return end\n if #sealedTokens == 0 then\n printToColor(\"No sealed token(s) found\", playerColor)\n else\n printToColor(\"Releasing token(s)\", playerColor)\n for _, guid in ipairs(sealedTokens) do\n putTokenAway(guid)\n end\n sealedTokens = {}\n end\nend\n\n-- returns the token (referenced by GUID) to the chaos bag\nfunction putTokenAway(guid)\n local token = getObjectFromGUID(guid)\n if not token then return end\n\n local name = token.getName()\n local chaosbag = chaosBagApi.findChaosBag()\n chaosbag.putObject(token)\n tokenArrangerApi.layout()\n if name == \"Bless\" or name == \"Curse\" then\n blessCurseManagerApi.releasedToken(name, guid)\n end\nend\nend)\n__bundle_register(\"accessories/TokenArrangerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenArrangerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- local function to call the token arranger, if it is on the table\n ---@param functionName String Name of the function to cal\n ---@param argument Variant Parameter to pass\n local function callIfExistent(functionName, argument)\n local tokenArranger = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenArranger\")\n if tokenArranger ~= nil then\n tokenArranger.call(functionName, argument)\n end\n end\n\n -- updates the token modifiers with the provided data\n ---@param tokenData Table Contains the chaos token metadata\n TokenArrangerApi.onTokenDataChanged = function(fullData)\n callIfExistent(\"onTokenDataChanged\", fullData)\n end\n\n -- deletes already laid out tokens\n TokenArrangerApi.deleteCopiedTokens = function()\n callIfExistent(\"deleteCopiedTokens\")\n end\n\n -- updates the laid out tokens\n TokenArrangerApi.layout = function()\n Wait.time(function() callIfExistent(\"layout\") end, 0.1)\n end\n\n return TokenArrangerApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getManager()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"BlessCurseManager\")\n end\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getManager()\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getManager().call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getManager().call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getManager().call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getManager().call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getManager().call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/FluteoftheOuterGods4\")\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -180101,7 +183958,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -180163,7 +184020,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -180224,7 +184081,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -180285,7 +184142,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -180346,7 +184203,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -180364,7 +184221,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playercards/cards/ScrollofSecrets\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- this script is shared between the lvl 0 and lvl 3 versions of Scroll of Secrets\nlocal mythosAreaApi = require(\"core/MythosAreaApi\")\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- get class via metadata and create context menu accordingly\nfunction onLoad()\n local notes = JSON.decode(self.getGMNotes())\n if notes then\n createContextMenu(notes.id)\n else\n print(\"Missing metadata for Scroll of Secrets!\")\n end\nend\n\nfunction createContextMenu(id)\n if id == \"05116\" or id == \"05116-t\" then\n -- lvl 0: draw 1 card from the bottom\n self.addContextMenuItem(\"Draw bottom card\", function(playerColor) contextFunc(playerColor, 1) end)\n elseif id == \"05188\" or id == \"05188-t\" then\n -- seeker lvl 3: draw 3 cards from the bottom\n self.addContextMenuItem(\"Draw bottom card(s)\", function(playerColor) contextFunc(playerColor, 3) end)\n elseif id == \"05189\" or id == \"05189-t\" then\n -- mystic lvl 3: draw 1 card from the bottom\n self.addContextMenuItem(\"Draw bottom card\", function(playerColor) contextFunc(playerColor, 1) end)\n end\nend\n\nfunction contextFunc(playerColor, amount)\n local options = { \"Encounter Deck\" }\n\n -- check for players with a deck and only display them as option\n for _, color in ipairs(Player.getAvailableColors()) do\n local matColor = playmatApi.getMatColor(color)\n local deckAreaObjects = playmatApi.getDeckAreaObjects(matColor)\n\n if deckAreaObjects.draw or deckAreaObjects.topCard then\n table.insert(options, color)\n end\n end\n\n -- show the target selection dialog\n Player[playerColor].showOptionsDialog(\"Select target deck\", options, _, function(owner) drawCardsFromBottom(playerColor, owner, amount) end)\nend\n\nfunction drawCardsFromBottom(playerColor, owner, amount)\n -- variable initialization\n local deck = nil\n local deckSize = 1\n local deckAreaObjects = {}\n\n -- get the respective deck\n if owner == \"Encounter Deck\" then\n deck = mythosAreaApi.getEncounterDeck()\n else\n local matColor = playmatApi.getMatColor(owner)\n deckAreaObjects = playmatApi.getDeckAreaObjects(matColor)\n deck = deckAreaObjects.draw\n end\n\n -- error handling\n if not deck then\n printToColor(\"Couldn't find deck!\", playerColor)\n return\n end\n\n -- set deck size if there is actually a deck and not just a card\n if deck.type == \"Deck\" then\n deckSize = #deck.getObjects()\n end\n\n -- proceed according to deck size\n if deckSize \u003e amount then\n for i = 1, amount do\n local card = deck.takeObject({ top = false, flip = true })\n card.deal(1, playerColor)\n end\n else\n -- deal the whole deck\n deck.deal(amount, playerColor)\n\n if deckSize \u003c amount then\n -- Norman Withers handling\n if deckAreaObjects.topCard then\n deckAreaObjects.topCard.deal(1, playerColor)\n deckSize = deckSize + 1\n end\n\n -- warning message for player\n if deckSize \u003c amount then\n printToColor(\"Deck didn't contain enough cards.\", playerColor)\n end\n end\n end\n printToColor(\"Handle the drawn cards according to the ability text on 'Scroll of Secrets'.\", playerColor)\nend\nend)\n__bundle_register(\"core/MythosAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local MythosAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getMythosArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"MythosArea\")\n end\n\n -- returns the chaos token metadata (if provided through scenario reference card)\n MythosAreaApi.returnTokenData = function()\n return getMythosArea().call(\"returnTokenData\")\n end\n \n -- returns an object reference to the encounter deck\n MythosAreaApi.getEncounterDeck = function()\n return getMythosArea().call(\"getEncounterDeck\")\n end\n\n -- draw an encounter card to the requested position/rotation\n MythosAreaApi.drawEncounterCard = function(pos, rotY, alwaysFaceUp)\n getMythosArea().call(\"drawEncounterCard\", {\n pos = pos,\n rotY = rotY,\n alwaysFaceUp = alwaysFaceUp\n })\n end\n\n return MythosAreaApi\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/ScrollofSecrets\")\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -180408,7 +184265,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -180469,7 +184326,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -180531,7 +184388,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -180593,7 +184450,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -180654,7 +184511,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -180716,7 +184573,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -180778,7 +184635,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -180840,7 +184697,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -180901,7 +184758,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -180962,7 +184819,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -181024,7 +184881,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -181042,7 +184899,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/ScrollofSecrets\")\nend)\n__bundle_register(\"playercards/cards/ScrollofSecrets\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- this script is shared between the lvl 0 and lvl 3 versions of Scroll of Secrets\nlocal mythosAreaApi = require(\"core/MythosAreaApi\")\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- get class via metadata and create context menu accordingly\nfunction onLoad()\n local notes = JSON.decode(self.getGMNotes())\n if notes then\n createContextMenu(notes.id)\n else\n print(\"Missing metadata for Scroll of Secrets!\")\n end\nend\n\nfunction createContextMenu(id)\n if id == \"05116\" or id == \"05116-t\" then\n -- lvl 0: draw 1 card from the bottom\n self.addContextMenuItem(\"Draw bottom card\", function(playerColor) contextFunc(playerColor, 1) end)\n elseif id == \"05188\" or id == \"05188-t\" then\n -- seeker lvl 3: draw 3 cards from the bottom\n self.addContextMenuItem(\"Draw bottom card(s)\", function(playerColor) contextFunc(playerColor, 3) end)\n elseif id == \"05189\" or id == \"05189-t\" then\n -- mystic lvl 3: draw 1 card from the bottom\n self.addContextMenuItem(\"Draw bottom card\", function(playerColor) contextFunc(playerColor, 1) end)\n end\nend\n\nfunction contextFunc(playerColor, amount)\n local options = { \"Encounter Deck\" }\n\n -- check for players with a deck and only display them as option\n for _, color in ipairs(Player.getAvailableColors()) do\n local matColor = playmatApi.getMatColor(color)\n local deckAreaObjects = playmatApi.getDeckAreaObjects(matColor)\n\n if deckAreaObjects.draw or deckAreaObjects.topCard then\n table.insert(options, color)\n end\n end\n\n -- show the target selection dialog\n Player[playerColor].showOptionsDialog(\"Select target deck\", options, _, function(owner) drawCardsFromBottom(playerColor, owner, amount) end)\nend\n\nfunction drawCardsFromBottom(playerColor, owner, amount)\n -- variable initialization\n local deck = nil\n local deckSize = 1\n local deckAreaObjects = {}\n\n -- get the respective deck\n if owner == \"Encounter Deck\" then\n deck = mythosAreaApi.getEncounterDeck()\n else\n local matColor = playmatApi.getMatColor(owner)\n deckAreaObjects = playmatApi.getDeckAreaObjects(matColor)\n deck = deckAreaObjects.draw\n end\n\n -- error handling\n if not deck then\n printToColor(\"Couldn't find deck!\", playerColor)\n return\n end\n\n -- set deck size if there is actually a deck and not just a card\n if deck.type == \"Deck\" then\n deckSize = #deck.getObjects()\n end\n\n -- proceed according to deck size\n if deckSize \u003e amount then\n for i = 1, amount do\n local card = deck.takeObject({ top = false, flip = true })\n card.deal(1, playerColor)\n end\n else\n -- deal the whole deck\n deck.deal(amount, playerColor)\n\n if deckSize \u003c amount then\n -- Norman Withers handling\n if deckAreaObjects.topCard then\n deckAreaObjects.topCard.deal(1, playerColor)\n deckSize = deckSize + 1\n end\n\n -- warning message for player\n if deckSize \u003c amount then\n printToColor(\"Deck didn't contain enough cards.\", playerColor)\n end\n end\n end\n printToColor(\"Handle the drawn cards according to the ability text on 'Scroll of Secrets'.\", playerColor)\nend\nend)\n__bundle_register(\"core/MythosAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local MythosAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getMythosArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"MythosArea\")\n end\n\n -- returns the chaos token metadata (if provided through scenario reference card)\n MythosAreaApi.returnTokenData = function()\n return getMythosArea().call(\"returnTokenData\")\n end\n \n -- returns an object reference to the encounter deck\n MythosAreaApi.getEncounterDeck = function()\n return getMythosArea().call(\"getEncounterDeck\")\n end\n\n -- draw an encounter card to the requested position/rotation\n MythosAreaApi.drawEncounterCard = function(pos, rotY, alwaysFaceUp)\n getMythosArea().call(\"drawEncounterCard\", {\n pos = pos,\n rotY = rotY,\n alwaysFaceUp = alwaysFaceUp\n })\n end\n\n return MythosAreaApi\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -181086,7 +184943,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -181148,7 +185005,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -181209,7 +185066,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -181271,14 +185128,14 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, "UniqueBack": false } }, - "Description": "arctic Archaeologist", + "Description": "Arctic Archaeologist", "DragSelectable": true, "GMNotes": "{\n \"id\": \"08032-t\",\n \"type\": \"Asset\",\n \"class\": \"Seeker\",\n \"cost\": 4,\n \"level\": 0,\n \"traits\": \"Ally. Miskatonic. Wayfarer.\",\n \"intellectIcons\": 1,\n \"cycle\": \"Edge of the Earth\"\n}", "GUID": "a03cd7", @@ -181333,7 +185190,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -181395,7 +185252,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -181457,7 +185314,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -181518,7 +185375,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -181580,7 +185437,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -181641,7 +185498,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -181702,7 +185559,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -181764,7 +185621,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -181826,7 +185683,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -181835,7 +185692,7 @@ }, "Description": "", "DragSelectable": true, - "GMNotes": "{\n \"id\": \"05189-t\",\n \"type\": \"Asset\",\n \"class\": \"Mystic\",\n \"cost\": 1,\n \"level\": 3,\n \"traits\": \"Item. Tome.\",\n \"willpowerIcons\": 1,\n \"intellectIcons\": 1,\n \"uses\": [\n {\n \"count\": 4,\n \"type\": \"Secret\",\n \"token\": \"resource\"\n }\n ],\n \"cycle\": \"The Circle Undone\"\n}", + "GMNotes": "{\n \"id\": \"05188-t\",\n \"type\": \"Asset\",\n \"class\": \"Seeker\",\n \"cost\": 1,\n \"level\": 3,\n \"traits\": \"Item. Tome.\",\n \"intellectIcons\": 2,\n \"uses\": [\n {\n \"count\": 3,\n \"type\": \"Secret\",\n \"token\": \"resource\"\n }\n ],\n \"cycle\": \"The Circle Undone\"\n}", "GUID": "84a7df", "Grid": true, "GridProjection": false, @@ -181844,7 +185701,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playercards/cards/ScrollofSecrets\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- this script is shared between the lvl 0 and lvl 3 versions of Scroll of Secrets\nlocal mythosAreaApi = require(\"core/MythosAreaApi\")\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- get class via metadata and create context menu accordingly\nfunction onLoad()\n local notes = JSON.decode(self.getGMNotes())\n if notes then\n createContextMenu(notes.id)\n else\n print(\"Missing metadata for Scroll of Secrets!\")\n end\nend\n\nfunction createContextMenu(id)\n if id == \"05116\" or id == \"05116-t\" then\n -- lvl 0: draw 1 card from the bottom\n self.addContextMenuItem(\"Draw bottom card\", function(playerColor) contextFunc(playerColor, 1) end)\n elseif id == \"05188\" or id == \"05188-t\" then\n -- seeker lvl 3: draw 3 cards from the bottom\n self.addContextMenuItem(\"Draw bottom card(s)\", function(playerColor) contextFunc(playerColor, 3) end)\n elseif id == \"05189\" or id == \"05189-t\" then\n -- mystic lvl 3: draw 1 card from the bottom\n self.addContextMenuItem(\"Draw bottom card\", function(playerColor) contextFunc(playerColor, 1) end)\n end\nend\n\nfunction contextFunc(playerColor, amount)\n local options = { \"Encounter Deck\" }\n\n -- check for players with a deck and only display them as option\n for _, color in ipairs(Player.getAvailableColors()) do\n local matColor = playmatApi.getMatColor(color)\n local deckAreaObjects = playmatApi.getDeckAreaObjects(matColor)\n\n if deckAreaObjects.draw or deckAreaObjects.topCard then\n table.insert(options, color)\n end\n end\n\n -- show the target selection dialog\n Player[playerColor].showOptionsDialog(\"Select target deck\", options, _, function(owner) drawCardsFromBottom(playerColor, owner, amount) end)\nend\n\nfunction drawCardsFromBottom(playerColor, owner, amount)\n -- variable initialization\n local deck = nil\n local deckSize = 1\n local deckAreaObjects = {}\n\n -- get the respective deck\n if owner == \"Encounter Deck\" then\n deck = mythosAreaApi.getEncounterDeck()\n else\n local matColor = playmatApi.getMatColor(owner)\n deckAreaObjects = playmatApi.getDeckAreaObjects(matColor)\n deck = deckAreaObjects.draw\n end\n\n -- error handling\n if not deck then\n printToColor(\"Couldn't find deck!\", playerColor)\n return\n end\n\n -- set deck size if there is actually a deck and not just a card\n if deck.type == \"Deck\" then\n deckSize = #deck.getObjects()\n end\n\n -- proceed according to deck size\n if deckSize \u003e amount then\n for i = 1, amount do\n local card = deck.takeObject({ top = false, flip = true })\n card.deal(1, playerColor)\n end\n else\n -- deal the whole deck\n deck.deal(amount, playerColor)\n\n if deckSize \u003c amount then\n -- Norman Withers handling\n if deckAreaObjects.topCard then\n deckAreaObjects.topCard.deal(1, playerColor)\n deckSize = deckSize + 1\n end\n\n -- warning message for player\n if deckSize \u003c amount then\n printToColor(\"Deck didn't contain enough cards.\", playerColor)\n end\n end\n end\n printToColor(\"Handle the drawn cards according to the ability text on 'Scroll of Secrets'.\", playerColor)\nend\nend)\n__bundle_register(\"core/MythosAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local MythosAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getMythosArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"MythosArea\")\n end\n\n -- returns the chaos token metadata (if provided through scenario reference card)\n MythosAreaApi.returnTokenData = function()\n return getMythosArea().call(\"returnTokenData\")\n end\n \n -- returns an object reference to the encounter deck\n MythosAreaApi.getEncounterDeck = function()\n return getMythosArea().call(\"getEncounterDeck\")\n end\n\n -- draw an encounter card to the requested position/rotation\n MythosAreaApi.drawEncounterCard = function(pos, rotY, alwaysFaceUp)\n getMythosArea().call(\"drawEncounterCard\", {\n pos = pos,\n rotY = rotY,\n alwaysFaceUp = alwaysFaceUp\n })\n end\n\n return MythosAreaApi\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/cards/ScrollofSecrets\")\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Card", @@ -181888,7 +185745,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -181949,7 +185806,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -182010,7 +185867,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -182072,7 +185929,7 @@ "3": { "BackIsHidden": true, "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2021607899142908284/92DF67E4310BCDFAD6C4BB12D31155DBF6B07A25/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2115061845812962486/A68B8BF7E4862F21369DAC4A37D813EC664EAC34/", "NumHeight": 6, "NumWidth": 10, "Type": 0, @@ -182326,7 +186183,7 @@ }, "Description": "", "DragSelectable": true, - "GMNotes": "{\n \"id\": \"10045\",\n \"type\": \"Event\",\n \"class\": \"Seeker\",\n \"cost\": 1,\n \"level\": 0,\n \"traits\": \"Insight. Science.\",\n \"cycle\": \"The Feast of Hemlock Vale\"\n}", + "GMNotes": "{\n \"id\": \"10045\",\n \"type\": \"Event\",\n \"class\": \"Seeker\",\n \"cost\": 1,\n \"traits\": \"Insight. Science.\",\n \"cycle\": \"The Feast of Hemlock Vale\"\n}", "GUID": "6543e6", "Grid": true, "GridProjection": false, @@ -182853,6 +186710,1299 @@ }, "Value": 0, "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 847000, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "8470": { + "BackIsHidden": false, + "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2149964195986880793/517FBB4FF8F72900B9E123DB865BCAD625F6506C/", + "NumHeight": 2, + "NumWidth": 2, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "The Dead Speak (Advanced)", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"90050\",\n \"type\": \"Asset\",\n \"class\": \"Neutral\",\n \"cost\": 2,\n \"traits\": \"Item. Instrument. Relic.\",\n \"willpowerIcons\": 2,\n \"wildIcons\": 2,\n \"cycle\": \"The Dunwich Legacy\"\n}", + "GUID": "7dfd5f", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "Jim's Trumpet", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tags": [ + "Asset", + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 78.511, + "posY": 3.229, + "posZ": 27.011, + "rotX": 359, + "rotY": 270, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 846700, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "8467": { + "BackIsHidden": false, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/2149964195987018702/54C63785F3AA474F635F58BC506C86A318432BD7/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2149964195987018793/0AED4BF62C4FF3206778AD36FDB9C8E482CD3F9E/", + "NumHeight": 2, + "NumWidth": 4, + "Type": 0, + "UniqueBack": true + } + }, + "Description": "The Musician", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"02004-p\",\n \"type\": \"Investigator\",\n \"class\": \"Mystic\",\n \"traits\": \"Performer. Cursed.\",\n \"willpowerIcons\": 4,\n \"intellectIcons\": 3,\n \"combatIcons\": 3,\n \"agilityIcons\": 2,\n \"cycle\": \"The Dunwich Legacy\"\n}", + "GUID": "72bf31", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "Jim Culver (Parallel)", + "SidewaysCard": true, + "Snap": true, + "Sticky": true, + "Tags": [ + "Investigator", + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 82.182, + "posY": 3.193, + "posZ": 26.386, + "rotX": 0, + "rotY": 180, + "rotZ": 0, + "scaleX": 1.15, + "scaleY": 1, + "scaleZ": 1.15 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 846905, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "8469": { + "BackIsHidden": false, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/1656727981627737648/F371339538812F68E38AAC0D520C525250DAC5C0/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2149964195987018793/0AED4BF62C4FF3206778AD36FDB9C8E482CD3F9E/", + "NumHeight": 2, + "NumWidth": 4, + "Type": 0, + "UniqueBack": true + } + }, + "Description": "The Musician", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"02004-pf\",\n \"type\": \"Investigator\",\n \"class\": \"Mystic\",\n \"traits\": \"Performer. Cursed.\",\n \"willpowerIcons\": 4,\n \"intellectIcons\": 3,\n \"combatIcons\": 3,\n \"agilityIcons\": 2,\n \"cycle\": \"The Dunwich Legacy\"\n}", + "GUID": "c5fc80", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "Jim Culver (Parallel Front)", + "SidewaysCard": true, + "Snap": true, + "Sticky": true, + "Tags": [ + "Investigator", + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 82.087, + "posY": 3.193, + "posZ": 22.484, + "rotX": 0, + "rotY": 180, + "rotZ": 0, + "scaleX": 1.15, + "scaleY": 1, + "scaleZ": 1.15 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 847002, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "8470": { + "BackIsHidden": false, + "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2149964195986880793/517FBB4FF8F72900B9E123DB865BCAD625F6506C/", + "NumHeight": 2, + "NumWidth": 2, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"90053\",\n \"type\": \"Enemy\",\n \"class\": \"Neutral\",\n \"traits\": \"Monster. Geist\",\n \"weakness\": true,\n \"cycle\": \"Laid to Rest\"\n}", + "GUID": "73bc8e", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "Vengeful Shade", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tags": [ + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 78.455, + "posY": 3.193, + "posZ": 20.547, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 847001, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "8470": { + "BackIsHidden": false, + "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2149964195986880793/517FBB4FF8F72900B9E123DB865BCAD625F6506C/", + "NumHeight": 2, + "NumWidth": 2, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "Advanced", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"90051\",\n \"type\": \"Treachery\",\n \"class\": \"Neutral\",\n \"traits\": \"Endtimes.\",\n \"weakness\": true,\n \"cycle\": \"The Dunwich Legacy\"\n}", + "GUID": "561775", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "Final Rhapsody", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tags": [ + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 78.419, + "posY": 3.193, + "posZ": 23.541, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 846805, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "8468": { + "BackIsHidden": false, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/2149964195987018702/54C63785F3AA474F635F58BC506C86A318432BD7/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/1656727981627737050/3CFF9E3825033909543AD1CF843361D9243538EE/", + "NumHeight": 2, + "NumWidth": 4, + "Type": 0, + "UniqueBack": true + } + }, + "Description": "The Musician", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"02004-pb\",\n \"type\": \"Investigator\",\n \"class\": \"Mystic\",\n \"traits\": \"Performer.\",\n \"willpowerIcons\": 4,\n \"intellectIcons\": 3,\n \"combatIcons\": 3,\n \"agilityIcons\": 2,\n \"cycle\": \"The Dunwich Legacy\"\n}", + "GUID": "aba863", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Card", + "Nickname": "Jim Culver (Parallel Back)", + "SidewaysCard": true, + "Snap": true, + "Sticky": true, + "Tags": [ + "Investigator", + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 82.206, + "posY": 3.193, + "posZ": 18.459, + "rotX": 0, + "rotY": 180, + "rotZ": 0, + "scaleX": 1.15, + "scaleY": 1, + "scaleZ": 1.15 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 847100, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "8471": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/2149964195986881059/864F6EBBD2900ED6D145B8AF12F2F8C180375C83/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2149964195986880989/13172BC914A0D729B4EFD9845FA9FDFCAB6F77F7/", + "NumHeight": 1, + "NumWidth": 1, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "Bleak Netherworld", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"90052\",\n \"type\": \"Asset\",\n \"class\": \"Neutral\",\n \"permanent\": true,\n \"startsInPlay\": true,\n \"cycle\": \"Laid to Rest\"\n}", + "GUID": "37ab47", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "CardCustom", + "Nickname": "The Beyond", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tags": [ + "Asset", + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 78.532, + "posY": 3.193, + "posZ": 17.888, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 400, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "4": { + "BackIsHidden": true, + "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2172484009070978111/18BFD42CF7BACCF65559E63F576AF35920520FDB/", + "NumHeight": 1, + "NumWidth": 1, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "Friend or Foe?", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"10119\",\n \"type\": \"Asset\",\n \"class\": \"Survivor\",\n \"cost\": 1,\n \"level\": 2,\n \"traits\": \"Ally. Creature. Cursed.\",\n \"agilityIcons\": 1,\n \"cycle\": \"The Feast of Hemlock Vale\"\n}", + "GUID": "2a0ba5", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "CardCustom", + "Nickname": "\"Devil\"", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tags": [ + "Asset", + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 13.082, + "posY": 3.548, + "posZ": -9.433, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 847400, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "8474": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/2172484009071330401/BD2BC1B3E8367C3EFE3AEB90170E46F1C617BBFC/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2172484009071330650/87864D232E414AF361F6559398AE0C3F40E02760/", + "NumHeight": 1, + "NumWidth": 1, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"10009-m\",\n \"type\": \"Minicard\"\n}", + "GUID": "cea425", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "CardCustom", + "Nickname": "Alessandra Zorzi", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tags": [ + "Minicard" + ], + "Tooltip": true, + "Transform": { + "posX": 5.756, + "posY": 3.649, + "posZ": 15.392, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 0.6, + "scaleY": 1, + "scaleZ": 0.6 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 1100, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "11": { + "BackIsHidden": true, + "BackURL": "http://cloud-3.steamusercontent.com/ugc/2172484009071330094/3AEFB558D789BC525F50DCC0217FA17627EB91BF/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2172484009071330266/6DD06B74E6DD4F473AB47C39DD17DF9FAD8B1455/", + "NumHeight": 1, + "NumWidth": 1, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "The Countess", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"10009\",\n \"type\": \"Investigator\",\n \"class\": \"Rogue\",\n \"traits\": \"Drifter. Socialite.\",\n \"willpowerIcons\": 3,\n \"intellectIcons\": 4,\n \"combatIcons\": 2,\n \"agilityIcons\": 4,\n \"cycle\": \"The Feast of Hemlock Vale\"\n}", + "GUID": "54eaa5", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "CardCustom", + "Nickname": "Alessandra Zorzi", + "SidewaysCard": true, + "Snap": true, + "Sticky": true, + "Tags": [ + "Investigator", + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 9.227, + "posY": 3.548, + "posZ": 2.42, + "rotX": 0, + "rotY": 180, + "rotZ": 0, + "scaleX": 1.15, + "scaleY": 1, + "scaleZ": 1.15 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 1000, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "10": { + "BackIsHidden": true, + "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2172484009071331144/5BF472F3A7B8E786FE4942B38201E09E8291A77A/", + "NumHeight": 1, + "NumWidth": 1, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"10011\",\n \"type\": \"Enemy\",\n \"class\": \"Neutral\",\n \"traits\": \"Humanoid. Criminal.\",\n \"weakness\": true,\n \"cycle\": \"The Feast of Hemlock Vale\"\n}", + "GUID": "541ba9", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "CardCustom", + "Nickname": "Zamacona", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tags": [ + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 9.325, + "posY": 3.548, + "posZ": -3.112, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 900, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "9": { + "BackIsHidden": true, + "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2172484009070978691/AE0143320D2C6CE35BCF1BFE50ABBCAA82546854/", + "NumHeight": 1, + "NumWidth": 1, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "Cursed Blade", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"10092\",\n \"type\": \"Asset\",\n \"class\": \"Mystic\",\n \"cost\": 2,\n \"level\": 0,\n \"traits\": \"Item. Weapon. Melee. Cursed.\",\n \"combatIcons\": 1,\n \"cycle\": \"The Feast of Hemlock Vale\"\n}", + "GUID": "c9fb1f", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "CardCustom", + "Nickname": "Wicked Athame", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tags": [ + "Asset", + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 13.082, + "posY": 3.548, + "posZ": -7.159, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 200, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "2": { + "BackIsHidden": true, + "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2172484009071331078/3553DC91D67F802BAFFE9F674DBE991C2D439867/", + "NumHeight": 1, + "NumWidth": 1, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"10010\",\n \"type\": \"Event\",\n \"class\": \"Neutral\",\n \"cost\": 2,\n \"traits\": \"Trick.\",\n \"wildIcons\": 1,\n \"cycle\": \"The Feast of Hemlock Vale\"\n}", + "GUID": "019526", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "CardCustom", + "Nickname": "Beguile", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tags": [ + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 9.325, + "posY": 3.548, + "posZ": -0.836, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 800, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "8": { + "BackIsHidden": true, + "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2172484009070978580/2878CF06EFC74C7701A21D5CABB22901293285A4/", + "NumHeight": 1, + "NumWidth": 1, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"10022\",\n \"type\": \"Asset\",\n \"class\": \"Guardian\",\n \"cost\": 2,\n \"level\": 0,\n \"traits\": \"Item. Charm. Blessed.\",\n \"willpowerIcons\": 1,\n \"cycle\": \"The Feast of Hemlock Vale\"\n}", + "GUID": "860c1e", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "CardCustom", + "Nickname": "Ofuda", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tags": [ + "Asset", + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 13.082, + "posY": 3.548, + "posZ": -4.88, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 600, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "6": { + "BackIsHidden": true, + "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2172484009070978340/8858A9F24148B2C04A3ED876597BD966FEE114EC/", + "NumHeight": 1, + "NumWidth": 1, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"10072\",\n \"type\": \"Event\",\n \"class\": \"Rogue\",\n \"cost\": 0,\n \"level\": 0,\n \"traits\": \"Gambit. Trick.\",\n \"willpowerIcons\": 1,\n \"agilityIcons\": 1,\n \"cycle\": \"The Feast of Hemlock Vale\"\n}", + "GUID": "40e1ca", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "CardCustom", + "Nickname": "\"I'll Pay You Back!\"", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tags": [ + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 13.082, + "posY": 3.548, + "posZ": -2.604, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 700, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "7": { + "BackIsHidden": true, + "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2172484009070978467/E0468E7962843128806C87A8C14BDCA5EF46A2D8/", + "NumHeight": 1, + "NumWidth": 1, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "Dubious Source", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"10132\",\n \"type\": \"Asset\",\n \"class\": \"Neutral\",\n \"level\": 3,\n \"traits\": \"Boon. Pact.\",\n \"permanent\": true,\n \"cycle\": \"The Feast of Hemlock Vale\"\n}", + "GUID": "acd0c2", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "CardCustom", + "Nickname": "Occult Reliquary", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tags": [ + "Asset", + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 13.082, + "posY": 3.548, + "posZ": 1.947, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 500, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "5": { + "BackIsHidden": true, + "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2172484009099857520/D9FD0353EAE4B1CEB3A3F220C26B09543FD71BD3/", + "NumHeight": 1, + "NumWidth": 1, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"10071\",\n \"type\": \"Event\",\n \"class\": \"Rogue\",\n \"cost\": 0,\n \"level\": 0,\n \"traits\": \"Trick. Illicit.\",\n \"intellectIcons\": 1,\n \"agilityIcons\": 1,\n \"cycle\": \"The Feast of Hemlock Vale\"\n}", + "GUID": "df75d7", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "CardCustom", + "Nickname": "Grift", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tags": [ + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 13.082, + "posY": 3.548, + "posZ": -0.328, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 300, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "3": { + "BackIsHidden": true, + "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2172484009070977979/A629DD5733453F892F57514EC5950E087486896F/", + "NumHeight": 1, + "NumWidth": 1, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"10046\",\n \"type\": \"Event\",\n \"class\": \"Seeker\",\n \"cost\": 1,\n \"level\": 0,\n \"traits\": \"Insight. Science. Cursed.\",\n \"willpowerIcons\": 1,\n \"intellectIcons\": 1,\n \"cycle\": \"The Feast of Hemlock Vale\"\n}", + "GUID": "133868", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "CardCustom", + "Nickname": "Control Variable", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tags": [ + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 13.082, + "posY": 3.548, + "posZ": 4.223, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 9400, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "94": { + "BackIsHidden": true, + "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2195002645128569861/7143A7BF20E37A069E170A21D77C16C91D81374D/", + "NumHeight": 1, + "NumWidth": 1, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"10064\",\n \"type\": \"Asset\",\n \"class\": \"Rogue\",\n \"cost\": 2,\n \"level\": 0,\n \"traits\": \"Item. Tome. Illicit.\",\n \"willpowerIcons\": 1,\n \"cycle\": \"The Feast of Hemlock Vale\"\n}", + "GUID": "de456d", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "CardCustom", + "Nickname": "Blackmail File", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tags": [ + "Asset", + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 13.082, + "posY": 3.548, + "posZ": -7.159, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 9200, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "92": { + "BackIsHidden": true, + "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2195002645128570001/1519803ABED2FA378473CDEDA000B057BB06A63B/", + "NumHeight": 1, + "NumWidth": 1, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"10091\",\n \"type\": \"Asset\",\n \"class\": \"Mystic\",\n \"cost\": 1,\n \"level\": 0,\n \"traits\": \"Talent. Ritual.\",\n \"uses\": [\n {\n \"count\": 6,\n \"type\": \"Offering\",\n \"token\": \"resource\"\n }\n ],\n \"willpowerIcons\": 1,\n \"cycle\": \"The Feast of Hemlock Vale\"\n}", + "GUID": "c763aa", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "CardCustom", + "Nickname": "Speak to the Dead", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tags": [ + "Asset", + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 13.082, + "posY": 3.548, + "posZ": -7.159, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "CardID": 100, + "ColorDiffuse": { + "b": 0.71324, + "g": 0.71324, + "r": 0.71324 + }, + "CustomDeck": { + "1": { + "BackIsHidden": true, + "BackURL": "https://i.imgur.com/EcbhVuh.jpg/", + "FaceURL": "http://cloud-3.steamusercontent.com/ugc/2172484009070977509/27A8CCF2BC48CAD909180D64177E86B8232F66C6/", + "NumHeight": 1, + "NumWidth": 1, + "Type": 0, + "UniqueBack": false + } + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "{\n \"id\": \"10095\",\n \"type\": \"Skill\",\n \"class\": \"Mystic\",\n \"level\": 0,\n \"traits\": \"Innate. Cursed.\",\n \"wildIcons\": 1,\n \"cycle\": \"The Feast of Hemlock Vale\"\n}", + "GUID": "e91c5e", + "Grid": true, + "GridProjection": false, + "Hands": true, + "HideWhenFaceDown": true, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "CardCustom", + "Nickname": "Accursed", + "SidewaysCard": false, + "Snap": true, + "Sticky": true, + "Tags": [ + "PlayerCard" + ], + "Tooltip": true, + "Transform": { + "posX": 13.082, + "posY": 3.548, + "posZ": 6.499, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" } ], "Description": "", @@ -182866,7 +188016,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/AllCardsBag\")\nend)\n__bundle_register(\"playercards/AllCardsBag\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal cardIdIndex = { }\nlocal classAndLevelIndex = { }\nlocal basicWeaknessList = { }\nlocal uniqueWeaknessList = { }\nlocal cycleIndex = { }\n\nlocal indexingDone = false\nlocal allowRemoval = false\n\nfunction onLoad()\n self.addContextMenuItem(\"Rebuild Index\", startIndexBuild)\n math.randomseed(os.time())\n Wait.frames(startIndexBuild, 30)\nend\n\n-- Called by Hotfix bags when they load. If we are still loading indexes, then\n-- the all cards and hotfix bags are being loaded together, and we can ignore\n-- this call as the hotfix will be included in the initial indexing. If it is\n-- called once indexing is complete it means the hotfix bag has been added\n-- later, and we should rebuild the index to integrate the hotfix bag.\nfunction rebuildIndexForHotfix()\n if (indexingDone) then\n startIndexBuild()\n end\nend\n\n-- Resets all current bag indexes\nfunction clearIndexes()\n indexingDone = false\n cardIdIndex = { }\n classAndLevelIndex = { }\n classAndLevelIndex[\"Guardian-upgrade\"] = { }\n classAndLevelIndex[\"Seeker-upgrade\"] = { }\n classAndLevelIndex[\"Mystic-upgrade\"] = { }\n classAndLevelIndex[\"Survivor-upgrade\"] = { }\n classAndLevelIndex[\"Rogue-upgrade\"] = { }\n classAndLevelIndex[\"Neutral-upgrade\"] = { }\n classAndLevelIndex[\"Guardian-level0\"] = { }\n classAndLevelIndex[\"Seeker-level0\"] = { }\n classAndLevelIndex[\"Mystic-level0\"] = { }\n classAndLevelIndex[\"Survivor-level0\"] = { }\n classAndLevelIndex[\"Rogue-level0\"] = { }\n classAndLevelIndex[\"Neutral-level0\"] = { }\n cycleIndex = { }\n basicWeaknessList = { }\n uniqueWeaknessList = { }\nend\n\n-- Clears the bag indexes and starts the coroutine to rebuild the indexes\nfunction startIndexBuild(playerColor)\n clearIndexes()\n startLuaCoroutine(self, \"buildIndex\")\nend\n\nfunction onObjectLeaveContainer(container, object)\n if (container == self and not allowRemoval) then\n broadcastToAll(\n \"Removing cards from the All Player Cards bag may break some functions. Please replace the card.\",\n {0.9, 0.2, 0.2}\n )\n end\nend\n\n-- Debug option to suppress the warning when cards are removed from the bag\nfunction setAllowCardRemoval()\n allowRemoval = true\nend\n\n-- Create the card indexes by iterating all cards in the bag, parsing their\n-- metadata, and creating the keyed lookup tables for the cards. This is a\n-- coroutine which will spread the workload by processing 20 cards before\n-- yielding. Based on the current count of cards this will require\n-- approximately 60 frames to complete.\nfunction buildIndex()\n indexingDone = false\n if (self.getData().ContainedObjects == nil) then\n return 1\n end\n for i, cardData in ipairs(self.getData().ContainedObjects) do\n local cardMetadata = JSON.decode(cardData.GMNotes)\n if (cardMetadata ~= nil) then\n addCardToIndex(cardData, cardMetadata)\n end\n if (i % 20 == 0) then\n coroutine.yield(0)\n end\n end\n local hotfixBags = getObjectsWithTag(\"AllCardsHotfix\")\n for _, hotfixBag in ipairs(hotfixBags) do\n if (#hotfixBag.getObjects() \u003e 0) then\n for i, cardData in ipairs(hotfixBag.getData().ContainedObjects) do\n local cardMetadata = JSON.decode(cardData.GMNotes)\n if (cardMetadata ~= nil) then\n addCardToIndex(cardData, cardMetadata)\n end\n end\n end\n end\n buildSupplementalIndexes()\n indexingDone = true\n return 1\nend\n\n-- Adds a card to any indexes it should be a part of, based on its metadata.\n-- Param cardData: TTS object data for the card\n-- Param cardMetadata: SCED metadata for the card\nfunction addCardToIndex(cardData, cardMetadata)\n cardIdIndex[cardMetadata.id] = { data = cardData, metadata = cardMetadata }\n if (cardMetadata.alternate_ids ~= nil) then\n for _, alternateId in ipairs(cardMetadata.alternate_ids) do\n cardIdIndex[alternateId] = { data = cardData, metadata = cardMetadata }\n end\n end\nend\n\nfunction buildSupplementalIndexes()\n for cardId, card in pairs(cardIdIndex) do\n local cardData = card.data\n local cardMetadata = card.metadata\n -- If the ID key and the metadata ID don't match this is a duplicate card created by an\n -- alternate_id, and we should skip it\n if cardId == cardMetadata.id then\n -- Add card to the basic weakness list, if appropriate. Some weaknesses have\n -- multiple copies, and are added multiple times\n if cardMetadata.weakness then\n table.insert(uniqueWeaknessList, cardMetadata.id)\n if cardMetadata.basicWeaknessCount ~= nil then\n for i = 1, cardMetadata.basicWeaknessCount do\n table.insert(basicWeaknessList, cardMetadata.id)\n end\n end\n end\n\n -- Add the card to the appropriate class and level indexes\n local isGuardian = false\n local isSeeker = false\n local isMystic = false\n local isRogue = false\n local isSurvivor = false\n local isNeutral = false\n local upgradeKey\n -- Excludes signature cards (which have no class or level) and alternate\n -- ID entries\n if (cardMetadata.class ~= nil and cardMetadata.level ~= nil) then\n isGuardian = string.match(cardMetadata.class, \"Guardian\")\n isSeeker = string.match(cardMetadata.class, \"Seeker\")\n isMystic = string.match(cardMetadata.class, \"Mystic\")\n isRogue = string.match(cardMetadata.class, \"Rogue\")\n isSurvivor = string.match(cardMetadata.class, \"Survivor\")\n isNeutral = string.match(cardMetadata.class, \"Neutral\")\n if (cardMetadata.level \u003e 0) then\n upgradeKey = \"-upgrade\"\n else\n upgradeKey = \"-level0\"\n end\n if (isGuardian) then\n table.insert(classAndLevelIndex[\"Guardian\"..upgradeKey], cardMetadata.id)\n end\n if (isSeeker) then\n table.insert(classAndLevelIndex[\"Seeker\"..upgradeKey], cardMetadata.id)\n end\n if (isMystic) then\n table.insert(classAndLevelIndex[\"Mystic\"..upgradeKey], cardMetadata.id)\n end\n if (isRogue) then\n table.insert(classAndLevelIndex[\"Rogue\"..upgradeKey], cardMetadata.id)\n end\n if (isSurvivor) then\n table.insert(classAndLevelIndex[\"Survivor\"..upgradeKey], cardMetadata.id)\n end\n if (isNeutral) then\n table.insert(classAndLevelIndex[\"Neutral\"..upgradeKey], cardMetadata.id)\n end\n\n local cycleName = cardMetadata.cycle\n if cycleName ~= nil then\n cycleName = string.lower(cycleName)\n if string.match(cycleName, \"return\") then\n cycleName = string.sub(cycleName, 11)\n end\n if cycleName == \"the night of the zealot\" then\n cycleName = \"core\"\n end\n if cycleIndex[cycleName] == nil then\n cycleIndex[cycleName] = { }\n end\n table.insert(cycleIndex[cycleName], cardMetadata.id)\n end\n end\n end\n end\n for _, indexTable in pairs(classAndLevelIndex) do\n table.sort(indexTable, cardComparator)\n end\n for _, indexTable in pairs(cycleIndex) do\n table.sort(indexTable)\n end\n table.sort(basicWeaknessList, cardComparator)\n table.sort(uniqueWeaknessList, cardComparator)\nend\n\n-- Comparison function used to sort the class card bag indexes. Sorts by card\n-- level, then name, then subname.\nfunction cardComparator(id1, id2)\n local card1 = cardIdIndex[id1]\n local card2 = cardIdIndex[id2]\n\n if (card1.metadata.level ~= card2.metadata.level) then\n return card1.metadata.level \u003c card2.metadata.level\n end\n if (card1.data.Nickname ~= card2.data.Nickname) then\n return card1.data.Nickname \u003c card2.data.Nickname\n end\n return card1.data.Description \u003c card2.data.Description\nend\n\nfunction isIndexReady()\n return indexingDone\nend\n\n-- Returns a specific card from the bag, based on ArkhamDB ID\n-- Params table:\n-- id: String ID of the card to retrieve\n-- Return: If the indexes are still being constructed, an empty table is\n-- returned. Otherwise, a single table with the following fields\n-- cardData: TTS object data, suitable for spawning the card\n-- cardMetadata: Table of parsed metadata\nfunction getCardById(params)\n if (not indexingDone) then\n broadcastToAll(\"Still loading player cards, please try again in a few seconds\", {0.9, 0.2, 0.2})\n return { }\n end\n return cardIdIndex[params.id]\nend\n\n-- Returns a list of cards from the bag matching a class and level (0 or upgraded)\n-- Params table:\n-- class: String class to retrieve (\"Guardian\", \"Seeker\", etc)\n-- isUpgraded: true for upgraded cards (Level 1-5), false for Level 0\n-- Return: If the indexes are still being constructed, returns an empty table.\n-- Otherwise, a list of tables, each with the following fields\n-- cardData: TTS object data, suitable for spawning the card\n-- cardMetadata: Table of parsed metadata\nfunction getCardsByClassAndLevel(params)\n if (not indexingDone) then\n broadcastToAll(\"Still loading player cards, please try again in a few seconds\", {0.9, 0.2, 0.2})\n return { }\n end\n local upgradeKey\n if (params.upgraded) then\n upgradeKey = \"-upgrade\"\n else\n upgradeKey = \"-level0\"\n end\n return classAndLevelIndex[params.class..upgradeKey];\nend\n\nfunction getCardsByCycle(cycleName)\n if (not indexingDone) then\n broadcastToAll(\"Still loading player cards, please try again in a few seconds\", {0.9, 0.2, 0.2})\n return { }\n end\n return cycleIndex[string.lower(cycleName)]\nend\n\n-- Searches the bag for cards which match the given name and returns a list. Note that this is\n-- an O(n) search without index support. It may be slow.\n-- Parameter array must contain these fields to define the search:\n-- name String or string fragment to search for names\n-- exact Whether the name match should be exact\nfunction getCardsByName(params)\n local name = params.name\n local exact = params.exact\n local results = { }\n -- Track cards (by ID) that we've added to avoid duplicates that may come from alternate IDs\n local addedCards = { }\n for _, cardData in pairs(cardIdIndex) do\n if (not addedCards[cardData.metadata.id]) then\n if (exact and (string.lower(cardData.data.Nickname) == string.lower(name)))\n or (not exact and string.find(string.lower(cardData.data.Nickname), string.lower(name), 1, true)) then\n table.insert(results, cardData)\n addedCards[cardData.metadata.id] = true\n end\n end\n end\n return results\nend\n\n-- Gets a random basic weakness from the bag. Once a given ID has been returned\n-- it will be removed from the list and cannot be selected again until a reload\n-- occurs or the indexes are rebuilt, which will refresh the list to include all\n-- weaknesses.\n-- Return: String ID of the selected weakness.\nfunction getRandomWeaknessId()\n local availableWeaknesses = buildAvailableWeaknesses()\n if (#availableWeaknesses \u003e 0) then\n return availableWeaknesses[math.random(#availableWeaknesses)]\n end\nend\n\n-- Constructs a list of available basic weaknesses by starting with the full pool of basic\n-- weaknesses then removing any which are currently in the play or deck construction areas\n-- Return: Table array of weakness IDs which are valid to choose from\nfunction buildAvailableWeaknesses()\n local weaknessesInPlay = { }\n local allObjects = getAllObjects()\n for _, object in ipairs(allObjects) do\n if (object.name == \"Deck\") then\n for _, cardData in ipairs(object.getData().ContainedObjects) do\n local cardMetadata = JSON.decode(cardData.GMNotes)\n incrementWeaknessCount(weaknessesInPlay, cardMetadata)\n end\n elseif (object.name == \"Card\") then\n local cardMetadata = JSON.decode(object.getGMNotes())\n incrementWeaknessCount(weaknessesInPlay, cardMetadata)\n end\n end\n\n local availableWeaknesses = { }\n for _, weaknessId in ipairs(basicWeaknessList) do\n if (weaknessesInPlay[weaknessId] ~= nil and weaknessesInPlay[weaknessId] \u003e 0) then\n weaknessesInPlay[weaknessId] = weaknessesInPlay[weaknessId] - 1\n else\n table.insert(availableWeaknesses, weaknessId)\n end\n end\n return availableWeaknesses\nend\n\nfunction getBasicWeaknesses()\n return basicWeaknessList\nend\n\nfunction getUniqueWeaknesses()\n return uniqueWeaknessList\nend\n\n-- Helper function that adds one to the table entry for the number of weaknesses in play\nfunction incrementWeaknessCount(table, cardMetadata)\n if (isBasicWeakness(cardMetadata)) then\n if (table[cardMetadata.id] == nil) then\n table[cardMetadata.id] = 1\n else\n table[cardMetadata.id] = table[cardMetadata.id] + 1\n end\n end\nend\n\nfunction isBasicWeakness(cardMetadata)\n return cardMetadata ~= nil\n and cardMetadata.weakness\n and cardMetadata.basicWeaknessCount ~= nil\n and cardMetadata.basicWeaknessCount \u003e 0\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playercards/AllCardsBag\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal cardIdIndex = { }\nlocal classAndLevelIndex = { }\nlocal basicWeaknessList = { }\nlocal uniqueWeaknessList = { }\nlocal cycleIndex = { }\n\nlocal indexingDone = false\nlocal allowRemoval = false\n\nfunction onLoad()\n self.addContextMenuItem(\"Rebuild Index\", startIndexBuild)\n math.randomseed(os.time())\n Wait.frames(startIndexBuild, 30)\nend\n\n-- Called by Hotfix bags when they load. If we are still loading indexes, then\n-- the all cards and hotfix bags are being loaded together, and we can ignore\n-- this call as the hotfix will be included in the initial indexing. If it is\n-- called once indexing is complete it means the hotfix bag has been added\n-- later, and we should rebuild the index to integrate the hotfix bag.\nfunction rebuildIndexForHotfix()\n if (indexingDone) then\n startIndexBuild()\n end\nend\n\n-- Resets all current bag indexes\nfunction clearIndexes()\n indexingDone = false\n cardIdIndex = { }\n classAndLevelIndex = { }\n classAndLevelIndex[\"Guardian-upgrade\"] = { }\n classAndLevelIndex[\"Seeker-upgrade\"] = { }\n classAndLevelIndex[\"Mystic-upgrade\"] = { }\n classAndLevelIndex[\"Survivor-upgrade\"] = { }\n classAndLevelIndex[\"Rogue-upgrade\"] = { }\n classAndLevelIndex[\"Neutral-upgrade\"] = { }\n classAndLevelIndex[\"Guardian-level0\"] = { }\n classAndLevelIndex[\"Seeker-level0\"] = { }\n classAndLevelIndex[\"Mystic-level0\"] = { }\n classAndLevelIndex[\"Survivor-level0\"] = { }\n classAndLevelIndex[\"Rogue-level0\"] = { }\n classAndLevelIndex[\"Neutral-level0\"] = { }\n cycleIndex = { }\n basicWeaknessList = { }\n uniqueWeaknessList = { }\nend\n\n-- Clears the bag indexes and starts the coroutine to rebuild the indexes\nfunction startIndexBuild(playerColor)\n clearIndexes()\n startLuaCoroutine(self, \"buildIndex\")\nend\n\nfunction onObjectLeaveContainer(container, object)\n if (container == self and not allowRemoval) then\n broadcastToAll(\n \"Removing cards from the All Player Cards bag may break some functions. Please replace the card.\",\n {0.9, 0.2, 0.2}\n )\n end\nend\n\n-- Debug option to suppress the warning when cards are removed from the bag\nfunction setAllowCardRemoval()\n allowRemoval = true\nend\n\n-- Create the card indexes by iterating all cards in the bag, parsing their\n-- metadata, and creating the keyed lookup tables for the cards. This is a\n-- coroutine which will spread the workload by processing 20 cards before\n-- yielding. Based on the current count of cards this will require\n-- approximately 60 frames to complete.\nfunction buildIndex()\n indexingDone = false\n if (self.getData().ContainedObjects == nil) then\n return 1\n end\n for i, cardData in ipairs(self.getData().ContainedObjects) do\n local cardMetadata = JSON.decode(cardData.GMNotes)\n if (cardMetadata ~= nil) then\n addCardToIndex(cardData, cardMetadata)\n end\n if (i % 20 == 0) then\n coroutine.yield(0)\n end\n end\n local hotfixBags = getObjectsWithTag(\"AllCardsHotfix\")\n for _, hotfixBag in ipairs(hotfixBags) do\n if (#hotfixBag.getObjects() \u003e 0) then\n for i, cardData in ipairs(hotfixBag.getData().ContainedObjects) do\n local cardMetadata = JSON.decode(cardData.GMNotes)\n if (cardMetadata ~= nil) then\n addCardToIndex(cardData, cardMetadata)\n end\n end\n end\n end\n buildSupplementalIndexes()\n indexingDone = true\n return 1\nend\n\n-- Adds a card to any indexes it should be a part of, based on its metadata.\n-- Param cardData: TTS object data for the card\n-- Param cardMetadata: SCED metadata for the card\nfunction addCardToIndex(cardData, cardMetadata)\n cardIdIndex[cardMetadata.id] = { data = cardData, metadata = cardMetadata }\n if (cardMetadata.alternate_ids ~= nil) then\n for _, alternateId in ipairs(cardMetadata.alternate_ids) do\n cardIdIndex[alternateId] = { data = cardData, metadata = cardMetadata }\n end\n end\nend\n\nfunction buildSupplementalIndexes()\n for cardId, card in pairs(cardIdIndex) do\n local cardData = card.data\n local cardMetadata = card.metadata\n -- If the ID key and the metadata ID don't match this is a duplicate card created by an\n -- alternate_id, and we should skip it\n if cardId == cardMetadata.id then\n -- Add card to the basic weakness list, if appropriate. Some weaknesses have\n -- multiple copies, and are added multiple times\n if cardMetadata.weakness then\n table.insert(uniqueWeaknessList, cardMetadata.id)\n if cardMetadata.basicWeaknessCount ~= nil then\n for i = 1, cardMetadata.basicWeaknessCount do\n table.insert(basicWeaknessList, cardMetadata.id)\n end\n end\n end\n\n -- Add the card to the appropriate class and level indexes\n local isGuardian = false\n local isSeeker = false\n local isMystic = false\n local isRogue = false\n local isSurvivor = false\n local isNeutral = false\n local upgradeKey\n -- Excludes signature cards (which have no class or level) and alternate\n -- ID entries\n if (cardMetadata.class ~= nil and cardMetadata.level ~= nil) then\n isGuardian = string.match(cardMetadata.class, \"Guardian\")\n isSeeker = string.match(cardMetadata.class, \"Seeker\")\n isMystic = string.match(cardMetadata.class, \"Mystic\")\n isRogue = string.match(cardMetadata.class, \"Rogue\")\n isSurvivor = string.match(cardMetadata.class, \"Survivor\")\n isNeutral = string.match(cardMetadata.class, \"Neutral\")\n if (cardMetadata.level \u003e 0) then\n upgradeKey = \"-upgrade\"\n else\n upgradeKey = \"-level0\"\n end\n if (isGuardian) then\n table.insert(classAndLevelIndex[\"Guardian\"..upgradeKey], cardMetadata.id)\n end\n if (isSeeker) then\n table.insert(classAndLevelIndex[\"Seeker\"..upgradeKey], cardMetadata.id)\n end\n if (isMystic) then\n table.insert(classAndLevelIndex[\"Mystic\"..upgradeKey], cardMetadata.id)\n end\n if (isRogue) then\n table.insert(classAndLevelIndex[\"Rogue\"..upgradeKey], cardMetadata.id)\n end\n if (isSurvivor) then\n table.insert(classAndLevelIndex[\"Survivor\"..upgradeKey], cardMetadata.id)\n end\n if (isNeutral) then\n table.insert(classAndLevelIndex[\"Neutral\"..upgradeKey], cardMetadata.id)\n end\n\n local cycleName = cardMetadata.cycle\n if cycleName ~= nil then\n cycleName = string.lower(cycleName)\n if string.match(cycleName, \"return\") then\n cycleName = string.sub(cycleName, 11)\n end\n if cycleName == \"the night of the zealot\" then\n cycleName = \"core\"\n end\n if cycleIndex[cycleName] == nil then\n cycleIndex[cycleName] = { }\n end\n table.insert(cycleIndex[cycleName], cardMetadata.id)\n end\n end\n end\n end\n for _, indexTable in pairs(classAndLevelIndex) do\n table.sort(indexTable, cardComparator)\n end\n for _, indexTable in pairs(cycleIndex) do\n table.sort(indexTable)\n end\n table.sort(basicWeaknessList, cardComparator)\n table.sort(uniqueWeaknessList, cardComparator)\nend\n\n-- Comparison function used to sort the class card bag indexes. Sorts by card\n-- level, then name, then subname.\nfunction cardComparator(id1, id2)\n local card1 = cardIdIndex[id1]\n local card2 = cardIdIndex[id2]\n\n if (card1.metadata.level ~= card2.metadata.level) then\n return card1.metadata.level \u003c card2.metadata.level\n end\n if (card1.data.Nickname ~= card2.data.Nickname) then\n return card1.data.Nickname \u003c card2.data.Nickname\n end\n return card1.data.Description \u003c card2.data.Description\nend\n\nfunction isIndexReady()\n return indexingDone\nend\n\n-- Returns a specific card from the bag, based on ArkhamDB ID\n-- Params table:\n-- id: String ID of the card to retrieve\n-- Return: If the indexes are still being constructed, an empty table is\n-- returned. Otherwise, a single table with the following fields\n-- cardData: TTS object data, suitable for spawning the card\n-- cardMetadata: Table of parsed metadata\nfunction getCardById(params)\n if (not indexingDone) then\n broadcastToAll(\"Still loading player cards, please try again in a few seconds\", {0.9, 0.2, 0.2})\n return { }\n end\n return cardIdIndex[params.id]\nend\n\n-- Returns a list of cards from the bag matching a class and level (0 or upgraded)\n-- Params table:\n-- class: String class to retrieve (\"Guardian\", \"Seeker\", etc)\n-- isUpgraded: true for upgraded cards (Level 1-5), false for Level 0\n-- Return: If the indexes are still being constructed, returns an empty table.\n-- Otherwise, a list of tables, each with the following fields\n-- cardData: TTS object data, suitable for spawning the card\n-- cardMetadata: Table of parsed metadata\nfunction getCardsByClassAndLevel(params)\n if (not indexingDone) then\n broadcastToAll(\"Still loading player cards, please try again in a few seconds\", {0.9, 0.2, 0.2})\n return { }\n end\n local upgradeKey\n if (params.upgraded) then\n upgradeKey = \"-upgrade\"\n else\n upgradeKey = \"-level0\"\n end\n return classAndLevelIndex[params.class..upgradeKey];\nend\n\nfunction getCardsByCycle(cycleName)\n if (not indexingDone) then\n broadcastToAll(\"Still loading player cards, please try again in a few seconds\", {0.9, 0.2, 0.2})\n return { }\n end\n return cycleIndex[string.lower(cycleName)]\nend\n\n-- Searches the bag for cards which match the given name and returns a list. Note that this is\n-- an O(n) search without index support. It may be slow.\n-- Parameter array must contain these fields to define the search:\n-- name String or string fragment to search for names\n-- exact Whether the name match should be exact\nfunction getCardsByName(params)\n local name = params.name\n local exact = params.exact\n local results = { }\n -- Track cards (by ID) that we've added to avoid duplicates that may come from alternate IDs\n local addedCards = { }\n for _, cardData in pairs(cardIdIndex) do\n if (not addedCards[cardData.metadata.id]) then\n if (exact and (string.lower(cardData.data.Nickname) == string.lower(name)))\n or (not exact and string.find(string.lower(cardData.data.Nickname), string.lower(name), 1, true)) then\n table.insert(results, cardData)\n addedCards[cardData.metadata.id] = true\n end\n end\n end\n return results\nend\n\n-- Gets a random basic weakness from the bag. Once a given ID has been returned\n-- it will be removed from the list and cannot be selected again until a reload\n-- occurs or the indexes are rebuilt, which will refresh the list to include all\n-- weaknesses.\n-- Return: String ID of the selected weakness.\nfunction getRandomWeaknessId()\n local availableWeaknesses = buildAvailableWeaknesses()\n if (#availableWeaknesses \u003e 0) then\n return availableWeaknesses[math.random(#availableWeaknesses)]\n end\nend\n\n-- Constructs a list of available basic weaknesses by starting with the full pool of basic\n-- weaknesses then removing any which are currently in the play or deck construction areas\n-- Return: Table array of weakness IDs which are valid to choose from\nfunction buildAvailableWeaknesses()\n local weaknessesInPlay = { }\n local allObjects = getAllObjects()\n for _, object in ipairs(allObjects) do\n if (object.name == \"Deck\") then\n for _, cardData in ipairs(object.getData().ContainedObjects) do\n local cardMetadata = JSON.decode(cardData.GMNotes)\n incrementWeaknessCount(weaknessesInPlay, cardMetadata)\n end\n elseif (object.name == \"Card\") then\n local cardMetadata = JSON.decode(object.getGMNotes())\n incrementWeaknessCount(weaknessesInPlay, cardMetadata)\n end\n end\n\n local availableWeaknesses = { }\n for _, weaknessId in ipairs(basicWeaknessList) do\n if (weaknessesInPlay[weaknessId] ~= nil and weaknessesInPlay[weaknessId] \u003e 0) then\n weaknessesInPlay[weaknessId] = weaknessesInPlay[weaknessId] - 1\n else\n table.insert(availableWeaknesses, weaknessId)\n end\n end\n return availableWeaknesses\nend\n\nfunction getBasicWeaknesses()\n return basicWeaknessList\nend\n\nfunction getUniqueWeaknesses()\n return uniqueWeaknessList\nend\n\n-- Helper function that adds one to the table entry for the number of weaknesses in play\nfunction incrementWeaknessCount(table, cardMetadata)\n if (isBasicWeakness(cardMetadata)) then\n if (table[cardMetadata.id] == nil) then\n table[cardMetadata.id] = 1\n else\n table[cardMetadata.id] = table[cardMetadata.id] + 1\n end\n end\nend\n\nfunction isBasicWeakness(cardMetadata)\n return cardMetadata ~= nil\n and cardMetadata.weakness\n and cardMetadata.basicWeaknessCount ~= nil\n and cardMetadata.basicWeaknessCount \u003e 0\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/AllCardsBag\")\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MaterialIndex": -1, "MeasureMovement": false, @@ -183108,7 +188258,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playermat/InvestigatorSkillTracker\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal BUTTON_PARAMETERS = {}\nBUTTON_PARAMETERS.function_owner = self\nBUTTON_PARAMETERS.height = 650\nBUTTON_PARAMETERS.width = 700\nBUTTON_PARAMETERS.position = { x = -4.775, y = 0.1, z = -0.03 }\nBUTTON_PARAMETERS.color = { 0, 0, 0, 0 }\nBUTTON_PARAMETERS.font_color = { 0, 0, 0, 100 }\nBUTTON_PARAMETERS.font_size = 450\n\nfunction onSave() return JSON.encode(stats) end\n\n-- load stats and make buttons (left to right)\nfunction onLoad(saved_data)\n stats = JSON.decode(saved_data) or { 1, 1, 1, 1 }\n\n for i = 1, 4 do\n BUTTON_PARAMETERS.label = stats[i] .. \" \"\n BUTTON_PARAMETERS.position.x = BUTTON_PARAMETERS.position.x + 1.91\n BUTTON_PARAMETERS.click_function = attachIndex(\"button_click\", i)\n self.createButton(BUTTON_PARAMETERS)\n end\n\n self.addContextMenuItem(\"Reset to 1s\", function() updateStats({ 1, 1, 1, 1 }) end)\nend\n\n-- helper function to carry index\nfunction attachIndex(click_function, index)\n local fn_name = click_function .. index\n _G[fn_name] = function(obj, player_color, isRightClick)\n _G[click_function](obj, player_color, isRightClick, index)\n end\n return fn_name\nend\n\nfunction button_click(_, _, isRightClick, index)\n stats[index] = math.min(math.max(stats[index] + (isRightClick and -1 or 1), 0), 99)\n changeButton(index)\nend\n\nfunction changeButton(index)\n local font_size = BUTTON_PARAMETERS.font_size\n local whitespace = \" \"\n\n if stats[index] \u003e 9 then\n font_size = BUTTON_PARAMETERS.font_size * 0.65\n whitespace = \" \"\n end\n\n self.editButton({ index = index - 1, label = stats[index] .. whitespace, font_size = font_size })\nend\n\n-- formatting of \"newStats\": {Willpower, Intellect, Fight, Agility}\nfunction updateStats(newStats)\n if newStats and #newStats == 4 then\n stats = newStats\n elseif newStats then\n printToAll(\"Provided new stats are incomplete or incorrectly formatted.\", \"Red\")\n return\n end\n\n for i = 1, 4 do changeButton(i) end\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playermat/InvestigatorSkillTracker\")\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playermat/InvestigatorSkillTracker\")\nend)\n__bundle_register(\"playermat/InvestigatorSkillTracker\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal BUTTON_PARAMETERS = {}\nBUTTON_PARAMETERS.function_owner = self\nBUTTON_PARAMETERS.height = 650\nBUTTON_PARAMETERS.width = 700\nBUTTON_PARAMETERS.position = { x = -4.775, y = 0.1, z = -0.03 }\nBUTTON_PARAMETERS.color = { 0, 0, 0, 0 }\nBUTTON_PARAMETERS.font_color = { 0, 0, 0, 100 }\nBUTTON_PARAMETERS.font_size = 450\n\nfunction onSave() return JSON.encode(stats) end\n\n-- load stats and make buttons (left to right)\nfunction onLoad(saved_data)\n stats = JSON.decode(saved_data) or { 1, 1, 1, 1 }\n\n for i = 1, 4 do\n BUTTON_PARAMETERS.label = stats[i] .. \" \"\n BUTTON_PARAMETERS.position.x = BUTTON_PARAMETERS.position.x + 1.91\n BUTTON_PARAMETERS.click_function = attachIndex(\"button_click\", i)\n self.createButton(BUTTON_PARAMETERS)\n end\n\n self.addContextMenuItem(\"Reset to 1s\", function() updateStats({ 1, 1, 1, 1 }) end)\nend\n\n-- helper function to carry index\nfunction attachIndex(click_function, index)\n local fn_name = click_function .. index\n _G[fn_name] = function(obj, player_color, isRightClick)\n _G[click_function](obj, player_color, isRightClick, index)\n end\n return fn_name\nend\n\nfunction button_click(_, _, isRightClick, index)\n stats[index] = math.min(math.max(stats[index] + (isRightClick and -1 or 1), 0), 99)\n changeButton(index)\nend\n\nfunction changeButton(index)\n local font_size = BUTTON_PARAMETERS.font_size\n local whitespace = \" \"\n\n if stats[index] \u003e 9 then\n font_size = BUTTON_PARAMETERS.font_size * 0.65\n whitespace = \" \"\n end\n\n self.editButton({ index = index - 1, label = stats[index] .. whitespace, font_size = font_size })\nend\n\n-- formatting of \"newStats\": {Willpower, Intellect, Fight, Agility}\nfunction updateStats(newStats)\n if newStats and #newStats == 4 then\n stats = newStats\n elseif newStats then\n printToAll(\"Provided new stats are incomplete or incorrectly formatted.\", \"Red\")\n return\n end\n\n for i = 1, 4 do changeButton(i) end\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "[1,1,1,1]", "MeasureMovement": false, "Name": "Custom_Token", @@ -183238,7 +188388,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/CardSearch\")\nend)\n__bundle_register(\"playercards/CardSearch\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/PlayerCardSpawner\")\n\nlocal allCardsBagApi = require(\"playercards/AllCardsBagApi\")\n\nlocal buttonParameters = {}\nbuttonParameters.function_owner = self\nbuttonParameters.height = 200\nbuttonParameters.width = 1200\nbuttonParameters.font_size = 75\n\nlocal BUTTON_LABELS = {}\n\nBUTTON_LABELS[\"spawn\"] = {}\nBUTTON_LABELS[\"spawn\"][true] = \"Mode: Spawn all matching cards \"\nBUTTON_LABELS[\"spawn\"][false] = \"Mode: Spawn first matching card\"\n\nBUTTON_LABELS[\"search\"] = {}\nBUTTON_LABELS[\"search\"][true] = \"Mode: Name matches search term\"\nBUTTON_LABELS[\"search\"][false] = \"Mode: Name contains search term\"\n\nlocal inputParameters = {}\ninputParameters.label = \"Click to enter card name\"\ninputParameters.input_function = \"input_func\"\ninputParameters.function_owner = self\ninputParameters.alignment = 2\ninputParameters.position = { 0, 0.05, -1.6 }\ninputParameters.width = 1200\ninputParameters.height = 130\ninputParameters.font_size = 107\n\n-- main code\nfunction onSave()\n return JSON.encode({ spawnAll, searchExact, inputParameters.value })\nend\n\nfunction onLoad(savedData)\n local loadedData = JSON.decode(savedData)\n spawnAll = loadedData[1] or false\n searchExact = loadedData[2] or false\n inputParameters.value = loadedData[3] or \"\"\n\n -- index 0: button for spawn mode\n buttonParameters.click_function = \"search\"\n buttonParameters.label = \"Spawn matching card(s)!\"\n buttonParameters.position = { 0, 0.06, 1.15 }\n self.createButton(buttonParameters)\n\n -- index 1: button for spawn mode\n buttonParameters.click_function = \"spawnMode\"\n buttonParameters.label = BUTTON_LABELS[\"spawn\"][spawnAll]\n buttonParameters.position[3] = buttonParameters.position[3] + 0.4\n self.createButton(buttonParameters)\n\n -- index 2: button for search mode\n buttonParameters.click_function = \"searchMode\"\n buttonParameters.label = BUTTON_LABELS[\"search\"][searchExact]\n buttonParameters.position[3] = buttonParameters.position[3] + 0.4\n self.createButton(buttonParameters)\n\n self.createInput(inputParameters)\nend\n\nfunction spawnMode()\n spawnAll = not spawnAll\n self.editButton({ index = 1, label = BUTTON_LABELS[\"spawn\"][spawnAll] })\nend\n\nfunction searchMode()\n searchExact = not searchExact\n self.editButton({ index = 2, label = BUTTON_LABELS[\"search\"][searchExact] })\nend\n\n-- if \"Enter press\" (\\n) is found, start search and recreate input\nfunction input_func(_, _, input, stillEditing)\n if not stillEditing then\n inputParameters.value = input\n elseif string.find(input, \"%\\n\") ~= nil then\n inputParameters.value = input.gsub(input, \"%\\n\", \"\")\n search()\n self.removeInput(0)\n self.createInput(inputParameters)\n end\nend\n\nfunction search()\n if inputParameters.value == nil or string.len(inputParameters.value) == 0 then\n printToAll(\"Please enter a search string.\", \"Yellow\")\n return\n end\n\n if string.len(inputParameters.value) \u003c 3 then\n printToAll(\"Please enter a longer search string.\", \"Yellow\")\n return\n end\n \n if not allCardsBagApi.isBagPresent() then\n printToAll(\"Player card bag couldn't be found.\", \"Red\")\n return\n end\n\n -- search all objects in bag\n local cardList = allCardsBagApi.getCardsByName(inputParameters.value, searchExact)\n if cardList == nil or #cardList == 0 then\n printToAll(\"No match found.\", \"Red\")\n return\n end\n if (#cardList \u003e 100) then\n printToAll(\"Matched more than 100 cards, please try a more specific search.\", \"Yellow\")\n return\n end\n\n -- sort table by name (reverse for multiple results, because bottom card spawns first)\n table.sort(cardList, function(k1, k2) return spawnAll == (k1.data.Nickname \u003e k2.data.Nickname) end)\n\n local rot = self.getRotation()\n local pos = self.positionToWorld(Vector(0, 2, -0.225))\n Spawner.spawnCards(cardList, pos, rot, true)\nend\nend)\n__bundle_register(\"playercards/AllCardsBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local AllCardsBagApi = {}\n local ALL_CARDS_BAG_GUID = \"15bb07\"\n\n -- Returns a specific card from the bag, based on ArkhamDB ID\n -- @param table:\n -- id: String ID of the card to retrieve\n -- @return: If the indexes are still being constructed, an empty table is\n -- returned. Otherwise, a single table with the following fields\n -- cardData: TTS object data, suitable for spawning the card\n -- cardMetadata: Table of parsed metadata\n AllCardsBagApi.getCardById = function(id)\n return getObjectFromGUID(ALL_CARDS_BAG_GUID).call(\"getCardById\", {id = id})\n end\n\n -- Gets a random basic weakness from the bag. Once a given ID has been returned\n -- it will be removed from the list and cannot be selected again until a reload\n -- occurs or the indexes are rebuilt, which will refresh the list to include all\n -- weaknesses.\n -- @return: String ID of the selected weakness.\n AllCardsBagApi.getRandomWeaknessId = function()\n return getObjectFromGUID(ALL_CARDS_BAG_GUID).call(\"getRandomWeaknessId\")\n end\n\n AllCardsBagApi.isIndexReady = function()\n return getObjectFromGUID(ALL_CARDS_BAG_GUID).call(\"isIndexReady\")\n end\n\n -- Called by Hotfix bags when they load. If we are still loading indexes, then\n -- the all cards and hotfix bags are being loaded together, and we can ignore\n -- this call as the hotfix will be included in the initial indexing. If it is\n -- called once indexing is complete it means the hotfix bag has been added\n -- later, and we should rebuild the index to integrate the hotfix bag.\n AllCardsBagApi.rebuildIndexForHotfix = function()\n return getObjectFromGUID(ALL_CARDS_BAG_GUID).call(\"rebuildIndexForHotfix\")\n end\n\n -- Searches the bag for cards which match the given name and returns a list. Note that this is\n -- an O(n) search without index support. It may be slow.\n -- @param\n -- name String or string fragment to search for names\n -- exact Whether the name match should be exact\n AllCardsBagApi.getCardsByName = function(name, exact)\n return getObjectFromGUID(ALL_CARDS_BAG_GUID).call(\"getCardsByName\", {name = name, exact = exact})\n end\n\n AllCardsBagApi.isBagPresent = function()\n return getObjectFromGUID(ALL_CARDS_BAG_GUID) and true\n end\n\n -- Returns a list of cards from the bag matching a class and level (0 or upgraded)\n -- @param \n -- class: String class to retrieve (\"Guardian\", \"Seeker\", etc)\n -- upgraded: true for upgraded cards (Level 1-5), false for Level 0\n -- @return: If the indexes are still being constructed, returns an empty table.\n -- Otherwise, a list of tables, each with the following fields\n -- cardData: TTS object data, suitable for spawning the card\n -- cardMetadata: Table of parsed metadata\n AllCardsBagApi.getCardsByClassAndLevel = function(class, upgraded)\n return getObjectFromGUID(ALL_CARDS_BAG_GUID).call(\"getCardsByClassAndLevel\", {class = class, upgraded = upgraded})\n end\n\n AllCardsBagApi.getCardsByCycle = function(cycle)\n return getObjectFromGUID(ALL_CARDS_BAG_GUID).call(\"getCardsByCycle\", cycle)\n end\n\n AllCardsBagApi.getUniqueWeaknesses = function()\n return getObjectFromGUID(ALL_CARDS_BAG_GUID).call(\"getUniqueWeaknesses\")\n end\n\n return AllCardsBagApi\nend\nend)\n__bundle_register(\"playercards/PlayerCardSpawner\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Amount to shift for the next card (zShift) or next row of cards (xShift)\n-- Note that the table rotation is weird, and the X axis is vertical while the\n-- Z axis is horizontal\nlocal SPREAD_Z_SHIFT = -2.3\nlocal SPREAD_X_SHIFT = -3.66\n\nSpawner = { }\n\n-- Spawns a list of cards at the given position/rotation. This will separate cards by size -\n-- investigator, standard, and mini, spawning them in that order with larger cards on bottom. If\n-- there are different types, the provided callback will be called once for each type as it spawns\n-- either a card or deck.\n-- @param cardList: A list of Player Card data structures (data/metadata)\n-- @param pos Position table where the cards should be spawned (global)\n-- @param rot Rotation table for the orientation of the spawned cards (global)\n-- @param sort Boolean, true if this list of cards should be sorted before spawning\n-- @param callback Function, callback to be called after the card/deck spawns.\nSpawner.spawnCards = function(cardList, pos, rot, sort, callback)\n if (sort) then\n table.sort(cardList, Spawner.cardComparator)\n end\n\n local miniCards = { }\n local standardCards = { }\n local investigatorCards = { }\n\n for _, card in ipairs(cardList) do\n if (card.metadata.type == \"Investigator\") then\n table.insert(investigatorCards, card)\n elseif (card.metadata.type == \"Minicard\") then\n table.insert(miniCards, card)\n else\n table.insert(standardCards, card)\n end\n end\n -- Spawn each of the three types individually. Each Y position shift accounts for the thickness\n -- of the spawned deck\n local position = { x = pos.x, y = pos.y, z = pos.z }\n Spawner.spawn(investigatorCards, position, { rot.x, rot.y - 90, rot.z }, callback)\n\n position.y = position.y + (#investigatorCards + #standardCards) * 0.07\n Spawner.spawn(standardCards, position, rot, callback)\n\n position.y = position.y + (#standardCards + #miniCards) * 0.07\n Spawner.spawn(miniCards, position, rot, callback)\nend\n\nSpawner.spawnCardSpread = function(cardList, startPos, maxCols, rot, sort, callback)\n if (sort) then\n table.sort(cardList, Spawner.cardComparator)\n end\n\n local position = { x = startPos.x, y = startPos.y, z = startPos.z }\n -- Special handle the first row if we have less than a full single row, but only if there's a\n -- reasonable max column count. Single-row spreads will send a large value for maxCols\n if maxCols \u003c 100 and #cardList \u003c maxCols then\n position.z = startPos.z + ((maxCols - #cardList) / 2 * SPREAD_Z_SHIFT)\n end\n local cardsInRow = 0\n local rows = 0\n for _, card in ipairs(cardList) do\n Spawner.spawn({ card }, position, rot, callback)\n position.z = position.z + SPREAD_Z_SHIFT\n cardsInRow = cardsInRow + 1\n if cardsInRow \u003e= maxCols then\n rows = rows + 1\n local cardsForRow = #cardList - rows * maxCols\n if cardsForRow \u003e maxCols then\n cardsForRow = maxCols\n end\n position.z = startPos.z + ((maxCols - cardsForRow) / 2 * SPREAD_Z_SHIFT)\n position.x = position.x + SPREAD_X_SHIFT\n cardsInRow = 0\n end\n end\nend\n\n-- Spawn a specific list of cards. This method is for internal use and should not be called\n-- directly, use spawnCards instead.\n---@param cardList: A list of Player Card data structures (data/metadata)\n---@param pos table Position where the cards should be spawned (global)\n---@param rot table Rotation for the orientation of the spawned cards (global)\n---@param callback function callback to be called after the card/deck spawns.\nSpawner.spawn = function(cardList, pos, rot, callback)\n if (#cardList == 0) then\n return\n end\n -- Spawn a single card directly\n if (#cardList == 1) then\n spawnObjectData({\n data = cardList[1].data,\n position = pos,\n rotation = rot,\n callback_function = callback,\n })\n return\n end\n -- For multiple cards, construct a deck and spawn that\n local deck = Spawner.buildDeckDataTemplate()\n -- Decks won't inherently scale to the cards in them. The card list being spawned should be all\n -- the same type/size by this point, so use the first card to set the size\n deck.Transform = {\n scaleX = cardList[1].data.Transform.scaleX,\n scaleY = 1,\n scaleZ = cardList[1].data.Transform.scaleZ,\n }\n local sidewaysDeck = true\n for _, spawnCard in ipairs(cardList) do\n Spawner.addCardToDeck(deck, spawnCard.data)\n -- set sidewaysDeck to false if any card is not a sideways card\n sidewaysDeck = (sidewaysDeck and spawnCard.data.SidewaysCard)\n end\n -- set the alt view angle for sideway decks\n if sidewaysDeck then\n deck.AltLookAngle = { x = 0, y = 180, z = 90 }\n end\n spawnObjectData({\n data = deck,\n position = pos,\n rotation = rot,\n callback_function = callback,\n })\nend\n\n-- Inserts a card into the given deck. This does three things:\n-- 1. Add the card's data to ContainedObjects\n-- 2. Add the card's ID (the TTS CardID, not the Arkham ID) to the deck's\n-- ID list. Note that the deck's ID list is \"DeckIDs\" even though it\n-- contains a list of card Ids\n-- 3. Extract the card's CustomDeck table and add it to the deck. The deck's\n-- \"CustomDeck\" field is a list of all CustomDecks used by cards within the\n-- deck, keyed by the DeckID and referencing the custom deck table\n---@param deck: TTS deck data structure to add to\n---@param card: Data for the card to be inserted\nSpawner.addCardToDeck = function(deck, cardData)\n for customDeckId, customDeckData in pairs(cardData.CustomDeck) do\n if (deck.CustomDeck[customDeckId] == nil) then\n -- CustomDeck not added to deck yet, add it\n deck.CustomDeck[customDeckId] = customDeckData\n elseif (deck.CustomDeck[customDeckId].FaceURL == customDeckData.FaceURL) then\n -- CustomDeck for this card matches the current one for the deck, do nothing\n else\n -- CustomDeck data conflict\n local newDeckId = nil\n for deckId, customDeck in pairs(deck.CustomDeck) do\n if (customDeckData.FaceURL == customDeck.FaceURL) then\n newDeckId = deckId\n end\n end\n if (newDeckId == nil) then\n -- No non-conflicting custom deck for this card, add a new one\n newDeckId = Spawner.findNextAvailableId(deck.CustomDeck, \"1000\")\n deck.CustomDeck[newDeckId] = customDeckData\n end\n -- Update the card with the new CustomDeck info\n cardData.CardID = newDeckId..string.sub(cardData.CardID, 5)\n cardData.CustomDeck[customDeckId] = nil\n cardData.CustomDeck[newDeckId] = customDeckData\n break\n end\n end\n table.insert(deck.ContainedObjects, cardData)\n table.insert(deck.DeckIDs, cardData.CardID)\nend\n\n-- Create an empty deck data table which can have cards added to it. This\n-- creates a new table on each call without using metatables or previous\n-- definitions because we can't be sure that TTS doesn't modify the structure\n---@return: Table containing the minimal TTS deck data structure\nSpawner.buildDeckDataTemplate = function()\n local deck = {}\n deck.Name = \"Deck\"\n\n -- Card data. DeckIDs and CustomDeck entries will be built from the cards\n deck.ContainedObjects = {}\n deck.DeckIDs = {}\n deck.CustomDeck = {}\n\n -- Transform is required, Position and Rotation will be overridden by the spawn call so can be omitted here\n deck.Transform = {\n scaleX = 1,\n scaleY = 1,\n scaleZ = 1,\n }\n\n return deck\nend\n\n-- Returns the first ID which does not exist in the given table, starting at startId and increasing\n-- @param objectTable Table keyed by strings which are numbers\n-- @param startId First possible ID.\n-- @return String ID \u003e= startId\nSpawner.findNextAvailableId = function(objectTable, startId)\n local id = startId\n while (objectTable[id] ~= nil) do\n id = tostring(tonumber(id) + 1)\n end\n\n return id\nend\n\n-- Get the PBCN (Permanent/Bonded/Customizable/Normal) value from the given metadata.\n---@return: 1 for Permanent, 2 for Bonded or 4 for Normal. The actual values are\n-- irrelevant as they provide only grouping and the order between them doesn't matter.\nSpawner.getpbcn = function(metadata)\n if metadata.permanent then\n return 1\n elseif metadata.bonded_to ~= nil then\n return 2\n else -- Normal card\n return 3\n end\nend\n\n-- Comparison function used to sort the cards in a deck. Groups bonded or\n-- permanent cards first, then sorts within theose types by name/subname.\n-- Normal cards will sort in standard alphabetical order, while\n-- permanent/bonded/customizable will be in reverse alphabetical order.\n--\n-- Since cards spawn in the order provided by this comparator, with the first\n-- cards ending up at the bottom of a pile, this ordering will spawn in reverse\n-- alphabetical order. This presents the cards in order for non-face-down\n-- areas, and presents them in order when Searching the face-down deck.\nSpawner.cardComparator = function(card1, card2)\n local pbcn1 = Spawner.getpbcn(card1.metadata)\n local pbcn2 = Spawner.getpbcn(card2.metadata)\n if pbcn1 ~= pbcn2 then\n return pbcn1 \u003e pbcn2\n end\n if pbcn1 == 3 then\n if card1.data.Nickname ~= card2.data.Nickname then\n return card1.data.Nickname \u003c card2.data.Nickname\n end\n return card1.data.Description \u003c card2.data.Description\n else\n if card1.data.Nickname ~= card2.data.Nickname then\n return card1.data.Nickname \u003e card2.data.Nickname\n end\n return card1.data.Description \u003e card2.data.Description\n end\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/CardSearch\")\nend)\n__bundle_register(\"playercards/CardSearch\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/PlayerCardSpawner\")\n\nlocal allCardsBagApi = require(\"playercards/AllCardsBagApi\")\n\nlocal buttonParameters = {}\nbuttonParameters.function_owner = self\nbuttonParameters.height = 200\nbuttonParameters.width = 1200\nbuttonParameters.font_size = 75\n\nlocal BUTTON_LABELS = {}\n\nBUTTON_LABELS[\"spawn\"] = {}\nBUTTON_LABELS[\"spawn\"][true] = \"Mode: Spawn all matching cards \"\nBUTTON_LABELS[\"spawn\"][false] = \"Mode: Spawn first matching card\"\n\nBUTTON_LABELS[\"search\"] = {}\nBUTTON_LABELS[\"search\"][true] = \"Mode: Name matches search term\"\nBUTTON_LABELS[\"search\"][false] = \"Mode: Name contains search term\"\n\nlocal inputParameters = {}\ninputParameters.label = \"Click to enter card name\"\ninputParameters.input_function = \"input_func\"\ninputParameters.function_owner = self\ninputParameters.alignment = 2\ninputParameters.position = { 0, 0.05, -1.6 }\ninputParameters.width = 1200\ninputParameters.height = 130\ninputParameters.font_size = 107\n\n-- main code\nfunction onSave()\n return JSON.encode({ spawnAll, searchExact, inputParameters.value })\nend\n\nfunction onLoad(savedData)\n local loadedData = JSON.decode(savedData)\n spawnAll = loadedData[1] or false\n searchExact = loadedData[2] or false\n inputParameters.value = loadedData[3] or \"\"\n\n -- index 0: button for spawn mode\n buttonParameters.click_function = \"search\"\n buttonParameters.label = \"Spawn matching card(s)!\"\n buttonParameters.position = { 0, 0.06, 1.15 }\n self.createButton(buttonParameters)\n\n -- index 1: button for spawn mode\n buttonParameters.click_function = \"spawnMode\"\n buttonParameters.label = BUTTON_LABELS[\"spawn\"][spawnAll]\n buttonParameters.position[3] = buttonParameters.position[3] + 0.4\n self.createButton(buttonParameters)\n\n -- index 2: button for search mode\n buttonParameters.click_function = \"searchMode\"\n buttonParameters.label = BUTTON_LABELS[\"search\"][searchExact]\n buttonParameters.position[3] = buttonParameters.position[3] + 0.4\n self.createButton(buttonParameters)\n\n self.createInput(inputParameters)\nend\n\nfunction spawnMode()\n spawnAll = not spawnAll\n self.editButton({ index = 1, label = BUTTON_LABELS[\"spawn\"][spawnAll] })\nend\n\nfunction searchMode()\n searchExact = not searchExact\n self.editButton({ index = 2, label = BUTTON_LABELS[\"search\"][searchExact] })\nend\n\n-- if \"Enter press\" (\\n) is found, start search and recreate input\nfunction input_func(_, _, input, stillEditing)\n if not stillEditing then\n inputParameters.value = input\n elseif string.find(input, \"%\\n\") ~= nil then\n inputParameters.value = input.gsub(input, \"%\\n\", \"\")\n search()\n self.removeInput(0)\n self.createInput(inputParameters)\n end\nend\n\nfunction search()\n if inputParameters.value == nil or string.len(inputParameters.value) == 0 then\n printToAll(\"Please enter a search string.\", \"Yellow\")\n return\n end\n\n if string.len(inputParameters.value) \u003c 3 then\n printToAll(\"Please enter a longer search string.\", \"Yellow\")\n return\n end\n \n if not allCardsBagApi.isBagPresent() then\n printToAll(\"Player card bag couldn't be found.\", \"Red\")\n return\n end\n\n -- search all objects in bag\n local cardList = allCardsBagApi.getCardsByName(inputParameters.value, searchExact)\n if cardList == nil or #cardList == 0 then\n printToAll(\"No match found.\", \"Red\")\n return\n end\n if (#cardList \u003e 100) then\n printToAll(\"Matched more than 100 cards, please try a more specific search.\", \"Yellow\")\n return\n end\n\n -- sort table by name (reverse for multiple results, because bottom card spawns first)\n table.sort(cardList, function(k1, k2) return spawnAll == (k1.data.Nickname \u003e k2.data.Nickname) end)\n\n local rot = self.getRotation()\n local pos = self.positionToWorld(Vector(0, 2, -0.225))\n Spawner.spawnCards(cardList, pos, rot, true)\nend\nend)\n__bundle_register(\"playercards/AllCardsBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local AllCardsBagApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getAllCardsBag()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"AllCardsBag\")\n end\n\n -- Returns a specific card from the bag, based on ArkhamDB ID\n ---@param id table String ID of the card to retrieve\n ---@return table table\n -- If the indexes are still being constructed, an empty table is\n -- returned. Otherwise, a single table with the following fields\n -- cardData: TTS object data, suitable for spawning the card\n -- cardMetadata: Table of parsed metadata\n AllCardsBagApi.getCardById = function(id)\n return getAllCardsBag().call(\"getCardById\", {id = id})\n end\n\n -- Gets a random basic weakness from the bag. Once a given ID has been returned\n -- it will be removed from the list and cannot be selected again until a reload\n -- occurs or the indexes are rebuilt, which will refresh the list to include all\n -- weaknesses.\n ---@return id String ID of the selected weakness.\n AllCardsBagApi.getRandomWeaknessId = function()\n return getAllCardsBag().call(\"getRandomWeaknessId\")\n end\n\n AllCardsBagApi.isIndexReady = function()\n return getAllCardsBag().call(\"isIndexReady\")\n end\n\n -- Called by Hotfix bags when they load. If we are still loading indexes, then\n -- the all cards and hotfix bags are being loaded together, and we can ignore\n -- this call as the hotfix will be included in the initial indexing. If it is\n -- called once indexing is complete it means the hotfix bag has been added\n -- later, and we should rebuild the index to integrate the hotfix bag.\n AllCardsBagApi.rebuildIndexForHotfix = function()\n return getAllCardsBag().call(\"rebuildIndexForHotfix\")\n end\n\n -- Searches the bag for cards which match the given name and returns a list. Note that this is\n -- an O(n) search without index support. It may be slow.\n ---@param name String or string fragment to search for names\n ---@param exact Boolean Whether the name match should be exact\n AllCardsBagApi.getCardsByName = function(name, exact)\n return getAllCardsBag().call(\"getCardsByName\", {name = name, exact = exact})\n end\n\n AllCardsBagApi.isBagPresent = function()\n return getAllCardsBag() and true\n end\n\n -- Returns a list of cards from the bag matching a class and level (0 or upgraded)\n ---@param class String class to retrieve (\"Guardian\", \"Seeker\", etc)\n ---@param upgraded Boolean true for upgraded cards (Level 1-5), false for Level 0\n ---@return: If the indexes are still being constructed, returns an empty table.\n -- Otherwise, a list of tables, each with the following fields\n -- cardData: TTS object data, suitable for spawning the card\n -- cardMetadata: Table of parsed metadata\n AllCardsBagApi.getCardsByClassAndLevel = function(class, upgraded)\n return getAllCardsBag().call(\"getCardsByClassAndLevel\", {class = class, upgraded = upgraded})\n end\n\n AllCardsBagApi.getCardsByCycle = function(cycle)\n return getAllCardsBag().call(\"getCardsByCycle\", cycle)\n end\n\n AllCardsBagApi.getUniqueWeaknesses = function()\n return getAllCardsBag().call(\"getUniqueWeaknesses\")\n end\n\n return AllCardsBagApi\nend\nend)\n__bundle_register(\"playercards/PlayerCardSpawner\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Amount to shift for the next card (zShift) or next row of cards (xShift)\n-- Note that the table rotation is weird, and the X axis is vertical while the\n-- Z axis is horizontal\nlocal SPREAD_Z_SHIFT = -2.3\nlocal SPREAD_X_SHIFT = -3.66\n\nSpawner = { }\n\n-- Spawns a list of cards at the given position/rotation. This will separate cards by size -\n-- investigator, standard, and mini, spawning them in that order with larger cards on bottom. If\n-- there are different types, the provided callback will be called once for each type as it spawns\n-- either a card or deck.\n-- @param cardList: A list of Player Card data structures (data/metadata)\n-- @param pos Position table where the cards should be spawned (global)\n-- @param rot Rotation table for the orientation of the spawned cards (global)\n-- @param sort Boolean, true if this list of cards should be sorted before spawning\n-- @param callback Function, callback to be called after the card/deck spawns.\nSpawner.spawnCards = function(cardList, pos, rot, sort, callback)\n if (sort) then\n table.sort(cardList, Spawner.cardComparator)\n end\n\n local miniCards = { }\n local standardCards = { }\n local investigatorCards = { }\n\n for _, card in ipairs(cardList) do\n if (card.metadata.type == \"Investigator\") then\n table.insert(investigatorCards, card)\n elseif (card.metadata.type == \"Minicard\") then\n table.insert(miniCards, card)\n else\n table.insert(standardCards, card)\n end\n end\n -- Spawn each of the three types individually. Each Y position shift accounts for the thickness\n -- of the spawned deck\n local position = { x = pos.x, y = pos.y, z = pos.z }\n Spawner.spawn(investigatorCards, position, { rot.x, rot.y - 90, rot.z }, callback)\n\n position.y = position.y + (#investigatorCards + #standardCards) * 0.07\n Spawner.spawn(standardCards, position, rot, callback)\n\n position.y = position.y + (#standardCards + #miniCards) * 0.07\n Spawner.spawn(miniCards, position, rot, callback)\nend\n\nSpawner.spawnCardSpread = function(cardList, startPos, maxCols, rot, sort, callback)\n if (sort) then\n table.sort(cardList, Spawner.cardComparator)\n end\n\n local position = { x = startPos.x, y = startPos.y, z = startPos.z }\n -- Special handle the first row if we have less than a full single row, but only if there's a\n -- reasonable max column count. Single-row spreads will send a large value for maxCols\n if maxCols \u003c 100 and #cardList \u003c maxCols then\n position.z = startPos.z + ((maxCols - #cardList) / 2 * SPREAD_Z_SHIFT)\n end\n local cardsInRow = 0\n local rows = 0\n for _, card in ipairs(cardList) do\n Spawner.spawn({ card }, position, rot, callback)\n position.z = position.z + SPREAD_Z_SHIFT\n cardsInRow = cardsInRow + 1\n if cardsInRow \u003e= maxCols then\n rows = rows + 1\n local cardsForRow = #cardList - rows * maxCols\n if cardsForRow \u003e maxCols then\n cardsForRow = maxCols\n end\n position.z = startPos.z + ((maxCols - cardsForRow) / 2 * SPREAD_Z_SHIFT)\n position.x = position.x + SPREAD_X_SHIFT\n cardsInRow = 0\n end\n end\nend\n\n-- Spawn a specific list of cards. This method is for internal use and should not be called\n-- directly, use spawnCards instead.\n---@param cardList: A list of Player Card data structures (data/metadata)\n---@param pos table Position where the cards should be spawned (global)\n---@param rot table Rotation for the orientation of the spawned cards (global)\n---@param callback function callback to be called after the card/deck spawns.\nSpawner.spawn = function(cardList, pos, rot, callback)\n if (#cardList == 0) then\n return\n end\n -- Spawn a single card directly\n if (#cardList == 1) then\n spawnObjectData({\n data = cardList[1].data,\n position = pos,\n rotation = rot,\n callback_function = callback,\n })\n return\n end\n -- For multiple cards, construct a deck and spawn that\n local deck = Spawner.buildDeckDataTemplate()\n -- Decks won't inherently scale to the cards in them. The card list being spawned should be all\n -- the same type/size by this point, so use the first card to set the size\n deck.Transform = {\n scaleX = cardList[1].data.Transform.scaleX,\n scaleY = 1,\n scaleZ = cardList[1].data.Transform.scaleZ,\n }\n local sidewaysDeck = true\n for _, spawnCard in ipairs(cardList) do\n Spawner.addCardToDeck(deck, spawnCard.data)\n -- set sidewaysDeck to false if any card is not a sideways card\n sidewaysDeck = (sidewaysDeck and spawnCard.data.SidewaysCard)\n end\n -- set the alt view angle for sideway decks\n if sidewaysDeck then\n deck.AltLookAngle = { x = 0, y = 180, z = 90 }\n end\n spawnObjectData({\n data = deck,\n position = pos,\n rotation = rot,\n callback_function = callback,\n })\nend\n\n-- Inserts a card into the given deck. This does three things:\n-- 1. Add the card's data to ContainedObjects\n-- 2. Add the card's ID (the TTS CardID, not the Arkham ID) to the deck's\n-- ID list. Note that the deck's ID list is \"DeckIDs\" even though it\n-- contains a list of card Ids\n-- 3. Extract the card's CustomDeck table and add it to the deck. The deck's\n-- \"CustomDeck\" field is a list of all CustomDecks used by cards within the\n-- deck, keyed by the DeckID and referencing the custom deck table\n---@param deck: TTS deck data structure to add to\n---@param card: Data for the card to be inserted\nSpawner.addCardToDeck = function(deck, cardData)\n for customDeckId, customDeckData in pairs(cardData.CustomDeck) do\n if (deck.CustomDeck[customDeckId] == nil) then\n -- CustomDeck not added to deck yet, add it\n deck.CustomDeck[customDeckId] = customDeckData\n elseif (deck.CustomDeck[customDeckId].FaceURL == customDeckData.FaceURL) then\n -- CustomDeck for this card matches the current one for the deck, do nothing\n else\n -- CustomDeck data conflict\n local newDeckId = nil\n for deckId, customDeck in pairs(deck.CustomDeck) do\n if (customDeckData.FaceURL == customDeck.FaceURL) then\n newDeckId = deckId\n end\n end\n if (newDeckId == nil) then\n -- No non-conflicting custom deck for this card, add a new one\n newDeckId = Spawner.findNextAvailableId(deck.CustomDeck, \"1000\")\n deck.CustomDeck[newDeckId] = customDeckData\n end\n -- Update the card with the new CustomDeck info\n cardData.CardID = newDeckId..string.sub(cardData.CardID, 5)\n cardData.CustomDeck[customDeckId] = nil\n cardData.CustomDeck[newDeckId] = customDeckData\n break\n end\n end\n table.insert(deck.ContainedObjects, cardData)\n table.insert(deck.DeckIDs, cardData.CardID)\nend\n\n-- Create an empty deck data table which can have cards added to it. This\n-- creates a new table on each call without using metatables or previous\n-- definitions because we can't be sure that TTS doesn't modify the structure\n---@return: Table containing the minimal TTS deck data structure\nSpawner.buildDeckDataTemplate = function()\n local deck = {}\n deck.Name = \"Deck\"\n\n -- Card data. DeckIDs and CustomDeck entries will be built from the cards\n deck.ContainedObjects = {}\n deck.DeckIDs = {}\n deck.CustomDeck = {}\n\n -- Transform is required, Position and Rotation will be overridden by the spawn call so can be omitted here\n deck.Transform = {\n scaleX = 1,\n scaleY = 1,\n scaleZ = 1,\n }\n\n return deck\nend\n\n-- Returns the first ID which does not exist in the given table, starting at startId and increasing\n-- @param objectTable Table keyed by strings which are numbers\n-- @param startId First possible ID.\n-- @return String ID \u003e= startId\nSpawner.findNextAvailableId = function(objectTable, startId)\n local id = startId\n while (objectTable[id] ~= nil) do\n id = tostring(tonumber(id) + 1)\n end\n\n return id\nend\n\n-- Get the PBCN (Permanent/Bonded/Customizable/Normal) value from the given metadata.\n---@return: 1 for Permanent, 2 for Bonded or 4 for Normal. The actual values are\n-- irrelevant as they provide only grouping and the order between them doesn't matter.\nSpawner.getpbcn = function(metadata)\n if metadata.permanent then\n return 1\n elseif metadata.bonded_to ~= nil then\n return 2\n else -- Normal card\n return 3\n end\nend\n\n-- Comparison function used to sort the cards in a deck. Groups bonded or\n-- permanent cards first, then sorts within theose types by name/subname.\n-- Normal cards will sort in standard alphabetical order, while\n-- permanent/bonded/customizable will be in reverse alphabetical order.\n--\n-- Since cards spawn in the order provided by this comparator, with the first\n-- cards ending up at the bottom of a pile, this ordering will spawn in reverse\n-- alphabetical order. This presents the cards in order for non-face-down\n-- areas, and presents them in order when Searching the face-down deck.\nSpawner.cardComparator = function(card1, card2)\n local pbcn1 = Spawner.getpbcn(card1.metadata)\n local pbcn2 = Spawner.getpbcn(card2.metadata)\n if pbcn1 ~= pbcn2 then\n return pbcn1 \u003e pbcn2\n end\n if pbcn1 == 3 then\n if card1.data.Nickname ~= card2.data.Nickname then\n return card1.data.Nickname \u003c card2.data.Nickname\n end\n return card1.data.Description \u003c card2.data.Description\n else\n if card1.data.Nickname ~= card2.data.Nickname then\n return card1.data.Nickname \u003e card2.data.Nickname\n end\n return card1.data.Description \u003e card2.data.Description\n end\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "[true,false,\"\"]", "MeasureMovement": false, "Name": "Custom_Token", @@ -183574,7 +188724,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/token/TokenSpawnTracker\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal spawnedCardGuids = { }\n\nlocal HAND_ZONES = { }\nHAND_ZONES[\"a70eee\"] = true -- White\nHAND_ZONES[\"0285cc\"] = true -- Green\nHAND_ZONES[\"5fe087\"] = true -- Orange\nHAND_ZONES[\"be2f17\"] = true -- Red\n\nfunction onLoad(saveState)\n if saveState ~= nil then\n local saveTable = JSON.decode(saveState) or { }\n spawnedCardGuids = saveTable.cards or { }\n end\n\n createResetMenuItems()\nend\n\nfunction onSave()\n return JSON.encode({\n cards = spawnedCardGuids\n })\nend\n\nfunction createResetMenuItems()\n self.addContextMenuItem(\"Reset All\", resetAll)\n self.addContextMenuItem(\"Reset Locations\", resetAllLocations)\n self.addContextMenuItem(\"Reset Player Cards\", resetAllAssetAndEvents)\nend\n\nfunction hasSpawnedTokens(cardGuid)\n return spawnedCardGuids[cardGuid] == true\nend\n\nfunction markTokensSpawned(cardGuid)\n spawnedCardGuids[cardGuid] = true\nend\n\nfunction resetTokensSpawned(cardGuid)\n spawnedCardGuids[cardGuid] = nil\nend\n\nfunction resetAllAssetAndEvents()\n local resetList = { }\n for cardGuid, _ in pairs(spawnedCardGuids) do\n local card = getObjectFromGUID(cardGuid)\n if card ~= nil then\n local cardMetadata = JSON.decode(card.getGMNotes()) or { }\n -- Check this by type rather than the PlayerCard tag so we don't reset weaknesses\n if cardMetadata.type == \"Asset\" or cardMetadata.type == \"Event\" then\n resetList[cardGuid] = true\n end\n end\n end\n for cardGuid, _ in pairs(resetList) do\n spawnedCardGuids[cardGuid] = nil\n end\nend\n\nfunction resetAllLocations()\n local resetList = { }\n for cardGuid, _ in pairs(spawnedCardGuids) do\n local card = getObjectFromGUID(cardGuid)\n if card ~= nil then\n local cardMetadata = JSON.decode(card.getGMNotes()) or { }\n -- Check this by type rather than the PlayerCard tag so we don't reset weaknesses\n if cardMetadata.type == \"Location\" then\n resetList[cardGuid] = true\n end\n end\n end\n for cardGuid, _ in pairs(resetList) do\n spawnedCardGuids[cardGuid] = nil\n end\nend\n\nfunction resetAll()\n spawnedCardGuids = { }\nend\n\n-- Listener to reset card token spawns when they enter a hand.\nfunction onObjectEnterZone(zone, enterObject)\n if HAND_ZONES[zone.getGUID()] then\n resetTokensSpawned(enterObject.getGUID())\n end\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/token/TokenSpawnTracker\")\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/token/TokenSpawnTracker\")\nend)\n__bundle_register(\"core/token/TokenSpawnTracker\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal spawnedCardGuids = {}\n\nfunction onSave() return JSON.encode({ cards = spawnedCardGuids }) end\n\nfunction onLoad(saveState)\n if saveState ~= nil then\n local saveTable = JSON.decode(saveState) or {}\n spawnedCardGuids = saveTable.cards or {}\n end\n createResetMenuItems()\nend\n\nfunction createResetMenuItems()\n self.addContextMenuItem(\"Reset All\", resetAll)\n self.addContextMenuItem(\"Reset Locations\", resetAllLocations)\n self.addContextMenuItem(\"Reset Player Cards\", resetAllAssetAndEvents)\nend\n\nfunction hasSpawnedTokens(cardGuid)\n return spawnedCardGuids[cardGuid] == true\nend\n\nfunction markTokensSpawned(cardGuid)\n spawnedCardGuids[cardGuid] = true\nend\n\nfunction resetTokensSpawned(cardGuid)\n spawnedCardGuids[cardGuid] = nil\nend\n\nfunction resetAll() spawnedCardGuids = {} end\n\nfunction resetAllLocations() resetSpecificTypes(\"Location\") end\n\nfunction resetAllAssetAndEvents() resetSpecificTypes(\"Asset\", \"Event\") end\n\nfunction resetSpecificTypes(type1, type2)\n local resetList = {}\n for cardGuid, _ in pairs(spawnedCardGuids) do\n local card = getObjectFromGUID(cardGuid)\n if card ~= nil then\n local cardMetadata = JSON.decode(card.getGMNotes()) or {}\n -- Check this by type rather than the PlayerCard tag so we don't reset weaknesses\n if cardMetadata.type == type1 or cardMetadata.type == type2 then\n resetList[cardGuid] = true\n end\n end\n end\n for cardGuid, _ in pairs(resetList) do\n spawnedCardGuids[cardGuid] = nil\n end\nend\n\n-- Listener to reset card token spawns when they enter a hand.\nfunction onObjectEnterZone(zone, enterObject)\n if zone.type == \"Hand\" and enterObject.type == \"Card\" then\n resetTokensSpawned(enterObject.getGUID())\n end\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "{\"cards\":[]}", "MeasureMovement": false, "Name": "Checker_white", @@ -187868,7 +193018,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/tour/TourStarter\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal tourManager = require(\"core/tour/TourManager\")\n\nfunction onLoad()\n self.createButton({\n click_function = \"startTour\",\n function_owner = self,\n position = { 1.27, 0.05, 0.035},\n width = 500,\n height = 20,\n color = { 0, 0, 0, 0 },\n -- TTS has a minium height for buttons, have to scale the Z-axis down to get the right size\n scale = { 1, 1, 0.82 },\n tooltip = \"Start the Tour\",\n })\n self.createButton({\n click_function = \"deleteStarter\",\n function_owner = self,\n position = { 1.27, 0.05, 0.309},\n width = 500,\n height = 20,\n color = { 0, 0, 0, 0 },\n -- TTS has a minium height for buttons, have to scale the Z-axis down to get the right size\n scale = { 1, 1, 0.82 },\n tooltip = \"Delete this Panel\",\n })\nend\n\nfunction startTour(_, playerColor, _)\n tourManager.startTour(playerColor)\nend\n\nfunction deleteStarter(_, _, _)\n self.destruct()\nend\nend)\n__bundle_register(\"core/tour/TourManager\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n require(\"core/tour/TourScript\")\n require(\"core/tour/TourCard\")\n local TourManager = { }\n local internal = { }\n\n -- Base IDs for various tour card UI elements. Actual IDs will have _[playerColor] appended\n local CARD_ID = \"tourCard\"\n local LEFT_NARRATOR_ID = \"tourNarratorImageLeft\"\n local RIGHT_NARRATOR_ID = \"tourNarratorImageRight\"\n local BUBBLE_ID = \"tourSpeechBubble\"\n local TEXT_ID = \"tourText\"\n local NEXT_BUTTON_ID = \"tourNext\"\n local STOP_BUTTON_ID = \"tourStop\"\n\n -- Table centerpoint for the camera hook object. Camera handling is a bit erratic so it doesn't\n -- always land right where you think it's going to, but it's close\n local HOOK_CAMERA_HOME = {\n x = -30.2,\n y = 60,\n z = 0,\n }\n\n -- Default (0) position for the camera, as defined in the mod. If we don't recreate this position\n -- EXACTLY when exiting the tour then camera controls get weird\n local DEFAULT_CAMERA_POS = {\n position = { x = -22.265, y = -2.5, z = 5.2575},\n pitch=64.343,\n yaw=90.333,\n distance=104.7}\n\n -- Global XML coordinates where we can present a card\n local SCREEN_POSITIONS = {\n center = \"0 0 0\",\n north = \"0 300 0\",\n east = \"600 0 0\",\n west = \"-600 0 0\",\n south = \"0 -300 0\",\n -- Northwest is only used by the Mandy card, move it a little right than standard so it's\n -- closer to the importer\n northwest = \"-500 300 0\",\n northeast = \"600 300 0\",\n southwest = \"-600 -300 0\",\n -- Used by the Diana and Wini cards referencing the bottom-right global controls, moved a little\n -- closer to them\n southeast = \"730 -365 0\"\n }\n\n -- Tracks the current state of the tours. Keyed by player color to keep each player's tour\n -- separate, will hold the camera hook and current card.\n local tourState = { }\n\n -- Kicks off the tour by initializing the card and camera hook. A callback on the hook creation\n -- will then show the first card.\n ---@param playerColor String Player color to start the tour for\n TourManager.startTour = function(playerColor)\n tourState[playerColor] = {\n currentCardIndex = 1\n }\n -- Camera gets really screwy when we finalize if we don't start settled in ThirdPerson at the\n -- default position before attaching to the hook. Unfortunately there are no callbacks for when\n -- the movement is done, but the delay seems to handle it\n Player[playerColor].setCameraMode(\"ThirdPerson\")\n Player[playerColor].lookAt(DEFAULT_CAMERA_POS)\n -- Initial camera rotation is painfully slow. White and Orange players are likely oriented\n -- correctly, but need a longer start delay for Green and Red\n local delay = 0.5\n if playerColor ~= \"White\" and playerColor ~= \"Orange\" then\n delay = 2\n broadcastToColor(\"Starting the tour, please wait...\", playerColor)\n end\n Wait.time(function()\n internal.createTourCard(playerColor)\n -- XML update to add the new card takes a few frames to load, wait for it to finish then\n -- create the hook\n Wait.condition(\n function()\n internal.createCameraHook(playerColor)\n end,\n function()\n return not Global.UI.loading\n end\n )\n end, delay)\n end\n\n -- Shows the next card in the tour script. This method is exposed (rather than being part of\n -- internal) because the XMLUI callbacks expect the method to be on the object directly.\n ---@param player Player object to show the next card for, provided by XMLUI callback\n function nextCard(player)\n internal.hideCard(player.color)\n Wait.time(function()\n tourState[player.color].currentCardIndex = tourState[player.color].currentCardIndex + 1\n if tourState[player.color].currentCardIndex \u003e #TOUR_SCRIPT then\n internal.finalizeTour(player.color)\n else\n internal.showCurrentCard(player.color)\n end\n end, 0.3)\n end\n\n -- Ends the tour and cleans up the camera. This method is exposed (rather than being part of\n -- internal) because the XMLUI callbacks expect the method to be on the object directly.\n ---@param player Player object to end the tour for, provided by XMLUI callback\n function stopTour(player)\n internal.hideCard(player.color)\n Wait.time(function()\n internal.finalizeTour(player.color)\n end, 0.3)\n end\n\n -- Updates the card UI for the script at the current index, moves the camera to the proper\n -- position, and shows the card.\n ---@param playerColor String Player color to show the current card for\n internal.showCurrentCard = function(playerColor)\n internal.updateCardDisplay(playerColor)\n local delay = 0\n local cardIndex = tourState[playerColor].currentCardIndex\n local hook = getObjectFromGUID(tourState[playerColor].cameraHookGuid)\n\n if not TOUR_SCRIPT[cardIndex].skipCentering then\n hook.setPositionSmooth(HOOK_CAMERA_HOME, false, false)\n delay = delay + 0.5\n end\n local lookPos\n if TOUR_SCRIPT[cardIndex].showObj ~= nil then\n local lookAtObj = getObjectFromGUID(TOUR_SCRIPT[cardIndex].showObj)\n lookPos = lookAtObj.getPosition()\n lookPos.y = TOUR_SCRIPT[cardIndex].distanceFromObj or 0\n -- Since camera isn't directly above the hook, changing the Y affects the visual position of\n -- whatever object we're trying to look at. This is an approximation, but close enough to\n -- keep the object more centered\n lookPos.x = lookPos.x - lookPos.y / 2\n elseif TOUR_SCRIPT[cardIndex].showPos ~= nil then\n lookPos = TOUR_SCRIPT[cardIndex].showPos\n end\n if lookPos ~= nil then\n Wait.time(function()\n hook.setPositionSmooth(lookPos, false, false)\n end, delay)\n delay = delay + 0.5\n end\n Wait.time(function() Global.UI.show(internal.getUiId(CARD_ID, playerColor)) end, delay)\n end\n\n -- Hides the current card being shown to a player. This can be in preparation for showing the\n -- next card, or ending the tour.\n ---@param playerColor String Player color to hide the current card for\n internal.hideCard = function(playerColor)\n Global.UI.hide(internal.getUiId(CARD_ID, playerColor))\n end\n\n -- Cleans up all the various resources associated with the tour, and (hopefully) resets the\n -- camera to the default position. Camera handling is erratic, the final card in the script\n -- should include instructions for the player to fix it.\n ---@param playerColor String Player color to clean up\n internal.finalizeTour = function(playerColor)\n local cameraHook = getObjectFromGUID(tourState[playerColor].cameraHookGuid)\n cameraHook.destruct()\n Player[playerColor].setCameraMode(\"ThirdPerson\")\n tourState[playerColor] = nil\n Wait.frames(function()\n Player[playerColor].lookAt(DEFAULT_CAMERA_POS)\n end, 3)\n end\n\n -- Updates the card UI to show the appropriate card configuration.\n ---@param playerColor String Player color to update card for\n internal.updateCardDisplay = function(playerColor)\n local index = tourState[playerColor].currentCardIndex\n Global.UI.setAttribute(internal.getUiId(LEFT_NARRATOR_ID, playerColor), \"image\", \"Inv-\" .. TOUR_SCRIPT[index].narrator)\n Global.UI.setAttribute(internal.getUiId(RIGHT_NARRATOR_ID, playerColor), \"image\", \"Inv-\" .. TOUR_SCRIPT[index].narrator)\n Global.UI.setAttribute(internal.getUiId(TEXT_ID, playerColor), \"text\", \"\\\"\" .. TOUR_SCRIPT[index].text .. \"\\\"\")\n local cardPos = TOUR_SCRIPT[index].position or \"north\"\n Global.UI.setAttribute(internal.getUiId(CARD_ID, playerColor), \"position\", SCREEN_POSITIONS[cardPos])\n Global.UI.setAttribute(internal.getUiId(NEXT_BUTTON_ID, playerColor), \"active\", index \u003c #TOUR_SCRIPT)\n\n -- Adjust images so the narrator is on the left or right, as defined by the card\n if TOUR_SCRIPT[index].speakerSide == \"right\" then\n Global.UI.setAttribute(internal.getUiId(LEFT_NARRATOR_ID, playerColor), \"active\", false)\n Global.UI.setAttribute(internal.getUiId(RIGHT_NARRATOR_ID, playerColor), \"active\", true)\n Global.UI.setAttribute(internal.getUiId(BUBBLE_ID, playerColor), \"rotation\", \"0 180 0\")\n Global.UI.setAttribute(internal.getUiId(TEXT_ID, playerColor), \"offsetXY\", \"-15 -15\")\n Global.UI.setAttribute(internal.getUiId(NEXT_BUTTON_ID, playerColor), \"offsetXY\", \"-35 -45\")\n Global.UI.setAttribute(internal.getUiId(STOP_BUTTON_ID, playerColor), \"offsetXY\", \"5 -45\")\n else\n Global.UI.setAttribute(internal.getUiId(LEFT_NARRATOR_ID, playerColor), \"active\", true)\n Global.UI.setAttribute(internal.getUiId(RIGHT_NARRATOR_ID, playerColor), \"active\", false)\n Global.UI.setAttribute(internal.getUiId(BUBBLE_ID, playerColor), \"rotation\", \"0 0 0\")\n Global.UI.setAttribute(internal.getUiId(TEXT_ID, playerColor), \"offsetXY\", \"15 -15\")\n Global.UI.setAttribute(internal.getUiId(NEXT_BUTTON_ID, playerColor), \"offsetXY\", \"-5 -45\")\n Global.UI.setAttribute(internal.getUiId(STOP_BUTTON_ID, playerColor), \"offsetXY\", \"35 -45\")\n end\n end\n\n -- Creates a small, transparent object which the camera will be attached to in order to move the\n -- user's view around the table. This should be called only at the beginning of the tour. Once\n -- creation is complete the user's camera will be attached to the hook and the first card will be\n -- shown.\n ---@param playerColor String Player color to create the hook for\n internal.createCameraHook = function(playerColor)\n local hookData = {\n Name = \"BlockSquare\",\n Transform = {\n posX = HOOK_CAMERA_HOME.x,\n posY = HOOK_CAMERA_HOME.y,\n posZ = HOOK_CAMERA_HOME.z,\n rotX = 0,\n rotY = 270.0,\n rotZ = 0,\n scaleX = 0.1,\n scaleY = 0.1,\n scaleZ = 0.1,\n },\n ColorDiffuse = {\n r = 0,\n g = 0,\n b = 0,\n a = 0,\n },\n Locked = true,\n GMNotes = playerColor\n }\n\n spawnObjectData({ data = hookData, callback_function = internal.onHookCreated })\n end\n\n -- Callback for creation of the camera hook object. Will attach the camera and show the current\n -- (presumably first) card.\n ---@param hook Created object\n internal.onHookCreated = function(hook)\n local playerColor = hook.getGMNotes()\n tourState[playerColor].cameraHookGuid = hook.getGUID()\n Player[playerColor].attachCameraToObject({\n object = hook,\n offset = { x = -20, y = 30, z = 0 }\n })\n internal.showCurrentCard(playerColor)\n end\n\n -- Creates an XMLUI entry in Global for a player-specific tour card. Dynamically creating this\n -- is somewhat complex, but ensures we can properly handle any player color.\n ---@param playerColor String Player color to create the card for\n internal.createTourCard = function(playerColor)\n -- Make sure the card doesn't exist before we create a new one\n if Global.UI.getAttributes(internal.getUiId(CARD_ID, playerColor)) ~= nil then\n return\n end\n tourCardTemplate.attributes.id = internal.getUiId(CARD_ID, playerColor)\n tourCardTemplate.children[1].attributes.id = internal.getUiId(LEFT_NARRATOR_ID, playerColor)\n tourCardTemplate.children[2].attributes.id = internal.getUiId(RIGHT_NARRATOR_ID, playerColor)\n tourCardTemplate.children[3].attributes.id = internal.getUiId(BUBBLE_ID, playerColor)\n tourCardTemplate.children[4].attributes.id = internal.getUiId(TEXT_ID, playerColor)\n tourCardTemplate.children[5].attributes.id = internal.getUiId(NEXT_BUTTON_ID, playerColor)\n tourCardTemplate.children[5].attributes.onClick = self.getGUID()..\"/nextCard\"\n tourCardTemplate.children[6].attributes.id = internal.getUiId(STOP_BUTTON_ID, playerColor)\n tourCardTemplate.children[6].attributes.onClick = self.getGUID()..\"/stopTour\"\n internal.setDeepVisibility(tourCardTemplate, playerColor)\n\n local globalXml = Global.UI.getXmlTable()\n table.insert(globalXml, tourCardTemplate)\n Global.UI.setXmlTable(globalXml)\n end\n\n -- Panels don't cause their children to inherit their visibility value, so this recurses down the\n -- XML table to set all children to the same visibility.\n ---@param xmlUi Table. Lua table describing the XML\n ---@param playerColor String. String color of the player to make this visible for\n internal.setDeepVisibility = function(xmlUi, playerColor)\n xmlUi.attributes.visibility = \"\" .. playerColor\n if xmlUi.children ~= nil then\n for _, child in ipairs(xmlUi.children) do\n internal.setDeepVisibility(child, playerColor)\n end\n end\n end\n\n internal.getUiId = function(baseId, playerColor)\n return baseId .. \"_\" .. playerColor\n end\n\n return TourManager\nend\nend)\n__bundle_register(\"core/tour/TourCard\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Table definition for the tour card layout. This is functionally XMLUI in Lua form, but using\n-- this for dynamic creation ensures we can handle any player color without needing 10\n-- near-duplicate definitions in Global.xml\n\ntourCardTemplate = {\n tag = \"Panel\",\n attributes = {\n id = \"tourCard\",\n height = 215,\n width = 330,\n rotation = \"0 0 0\",\n position = \"0 300 30\",\n showAnimation = \"FadeIn\",\n hideAnimation = \"FadeOut\",\n active=false,\n },\n children = {\n {\n tag = \"Image\",\n attributes = {\n id = \"tourNarratorImageLeft\",\n height=120,\n width=80,\n rectAlignment=\"UpperLeft\",\n offsetXY = \"-80 0\",\n -- Image will be set when the card is updated\n }\n },\n {\n tag = \"Image\",\n attributes = {\n id = \"tourNarratorImageRight\",\n active = false,\n height=125,\n width=80,\n rectAlignment=\"UpperRight\",\n offsetXY = \"80 0\"\n -- Image will be set when the card is updated\n }\n },\n {\n tag = \"Image\",\n attributes = {\n id = \"tourSpeechBubble\",\n color = \"#F5F5DC\",\n height = 215,\n width = 330,\n rectAlignment = \"MiddleCenter\",\n image = \"SpeechBubble\",\n },\n },\n {\n tag = \"Text\",\n attributes = {\n id = \"tourText\",\n -- Everything on this is double-sized and scaled down to keep the text sharps\n height = 370,\n width = 520,\n scale = \"0.5 0.5 1\",\n rectAlignment = \"UpperCenter\",\n offsetXY = \"15 -15\",\n resizeTextForBestFit = true,\n resizeTextMinSize = 20,\n resizeTextMaxSize = 32,\n color = \"#050505\",\n alignment = \"UpperLeft\",\n horizontalOverflow = \"wrap\",\n }\n },\n {\n tag = \"Image\",\n attributes = {\n id = \"tourNext\",\n height = 45,\n width = 45,\n rectAlignment = \"LowerRight\",\n offsetXY = \"-5 -45\",\n image = \"NextArrow\"\n },\n },\n {\n tag = \"Image\",\n attributes = {\n id = \"tourStop\",\n height = 45,\n width = 45,\n rectAlignment = \"LowerLeft\",\n offsetXY = \"35 -45\",\n image = \"Exit\"\n }\n },\n }\n}\nend)\n__bundle_register(\"core/tour/TourScript\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Script for the SCED tour. Documentation and definitions to come.\n\nTOUR_SCRIPT = {\n {\n narrator = \"Roland\",\n text = \"Despite my best efforts, looks like you found us. You may live to regret that. As long as you're here though we might as well show you around.\\n\\nUse the arrow to move forward, and if the horrors get to be too much you can quit whenever you like. Ready to get started?\",\n position = \"center\"\n },\n {\n narrator = \"Darrell\",\n text = \"Cameras can be tricky things. Best you leave handling it to the professionals during the tour. Don't try to move the camera until the tour is complete.\\n\\nOnce we're done, remember you can use the 'p' key to switch back to third-person mode, and the spacebar to reset the position.\",\n position = \"center\",\n speakerSide = \"right\",\n },\n {\n narrator = \"Daisy\",\n text = \"If you're new to the game, the library here has everything you'll need. A little research can go a long way, and looking into old newspapers for the weird and unusual can yield some surprisingly helpful information.\\n\\nI put a few right there that might prove enlightening.\",\n showObj = \"d99993\",\n distanceFromObj = 20,\n position = \"west\",\n speakerSide = \"right\"\n },\n {\n narrator = \"Mandy\",\n text = \"To survive what's coming you'll need a deck. If it's safely hidden away on ArkhamDB you can load it here, and even find the newest version after an upgrade without changing the ID.\\n\\nNo need to publish all your decks, use 'Private' and you can see it. Just make sure to select 'Make your decks public' in ArkhamDB.\",\n showObj = \"a28140\",\n distanceFromObj = -5,\n position = \"northwest\",\n skipCentering = true,\n },\n {\n narrator = \"Daniela\",\n text = \"I prefer the hands-on approach to building things, if you do too you can build a deck yourself.\\n\\nAll the cards you could ever need are here, laid out like a disassembled engine. Place the cards on the table, copy them for your deck, and you'll be ready for anything.\",\n showObj = \"2d30ee\",\n distanceFromObj = -7,\n position = \"south\",\n speakerSide = \"right\"\n },\n {\n narrator = \"Finn\",\n text = \"Ready to face the unknown? We've smuggled shocking revelations and devious enemies from all over the world. Download the campaign you want to play, then Place it on the table to see the scenarios.\\n\\nJust remember - if it turns out to be too much for you, I was never here.\",\n showObj = \"aca04c\",\n distanceFromObj = 20,\n position = \"northwest\",\n },\n {\n narrator = \"Diana\",\n text = \"These symbols on the bottom right are a repository of arcane knowledge, containing all the official content to download plus some deviously creative works from fans. One should beware those who seem too fond of the darkness, but you cannot deny the quality of their efforts.\\n\\nDon't see anything here? Only promoted players can access these.\",\n position = \"southeast\",\n },\n {\n narrator = \"Winifred\",\n text = \"No good aviator would fly a plane she didn't know and hadn't tweaked a bit herself. The gear icon contains settings to customize your play experience, from alternate ways to track your clues to a variety of helpers to streamline the game.\\n\\nEverything here is optional, but who doesn't want to go as fast as they can? Just remember that all settings affect all players, so strap in and trust your pilot!\",\n position = \"southeast\",\n },\n {\n narrator = \"Amina\",\n text = \"This is the Mythos area. Encounter cards, acts, and agenda will all be placed here while the large map below is where you will be exploring - be sure to set the number of investigators!\\n\\nYou can count doom on the agenda by clicking the large counter, and the smaller will automatically count doom tokens on the table. The chaos bag is in that book over on the right, and you can add or remove tokens from it whenever you need.\",\n showPos = { x = -2.85, y = 0, z = 0.55 },\n position = \"north\",\n speakerSide = \"right\"\n },\n {\n narrator = \"Gloria\",\n text = \"The evils that lurk in this world are out there, creeping ever closer. When they find you, this will easily draw a card from the encounter deck. The deck will even reshuffle itself when needed, for the enemies we face are unending.\",\n showPos = { x = -35, y = -20, z = 28 },\n position = \"west\",\n },\n {\n narrator = \"Jacqueline\",\n text = \"When the ire of fate finds you and the chaos looms, this large button will draw a chaos token. Click it again to return the token to the bag.\\n\\nWhether a vision of the future or a curse from the opponents we face, if you need additional tokens a right-click will draw more. I wish you luck, but have a vision of red tentacles reaching for you...\",\n showPos = { x = -35, y = -20, z = 4.25 },\n position = \"north\",\n skipCentering = true,\n speakerSide = \"right\"\n },\n {\n narrator = \"Preston\",\n text = \"I can afford to buy what I need, but for those less well-off we've provided an endless pool of tokens to track your game. Simply drag one out of the pools here.\\n\\nResources are my favorite of course, but damage and horror are as inevitable as taxes. I leave those to my bookkeeper though. Those tokens can work like counters, use the number keys to change the value.\",\n showObj = \"9fadf9\",\n position = \"north\",\n skipCentering = true,\n speakerSide = \"right\"\n },\n {\n narrator = \"Norman\",\n text = \"That's the end of the tour, but there's much more to discover if you look in the right places. Some cards have helpers on the right-click menu, and every new version adds new content and functions.\\n\\nDon't be afraid to explore, and best of luck out there! We'll all need it...\",\n position = \"center\",\n speakerSide = \"right\"\n },\n}\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/tour/TourStarter\")\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/tour/TourStarter\")\nend)\n__bundle_register(\"core/tour/TourStarter\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal tourManager = require(\"core/tour/TourManager\")\n\nfunction onLoad()\n self.createButton({\n click_function = \"startTour\",\n function_owner = self,\n position = { 1.27, 0.05, 0.035},\n width = 500,\n height = 20,\n color = { 0, 0, 0, 0 },\n -- TTS has a minium height for buttons, have to scale the Z-axis down to get the right size\n scale = { 1, 1, 0.82 },\n tooltip = \"Start the Tour\",\n })\n self.createButton({\n click_function = \"deleteStarter\",\n function_owner = self,\n position = { 1.27, 0.05, 0.309},\n width = 500,\n height = 20,\n color = { 0, 0, 0, 0 },\n -- TTS has a minium height for buttons, have to scale the Z-axis down to get the right size\n scale = { 1, 1, 0.82 },\n tooltip = \"Delete this Panel\",\n })\nend\n\nfunction startTour(_, playerColor, _)\n tourManager.startTour(playerColor)\nend\n\nfunction deleteStarter(_, _, _)\n self.destruct()\nend\nend)\n__bundle_register(\"core/tour/TourManager\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n require(\"core/tour/TourScript\")\n require(\"core/tour/TourCard\")\n local TourManager = {}\n local internal = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Base IDs for various tour card UI elements. Actual IDs will have _[playerColor] appended\n local CARD_ID = \"tourCard\"\n local LEFT_NARRATOR_ID = \"tourNarratorImageLeft\"\n local RIGHT_NARRATOR_ID = \"tourNarratorImageRight\"\n local BUBBLE_ID = \"tourSpeechBubble\"\n local TEXT_ID = \"tourText\"\n local NEXT_BUTTON_ID = \"tourNext\"\n local STOP_BUTTON_ID = \"tourStop\"\n\n -- Table centerpoint for the camera hook object. Camera handling is a bit erratic so it doesn't\n -- always land right where you think it's going to, but it's close\n local HOOK_CAMERA_HOME = {\n x = -30.2,\n y = 60,\n z = 0,\n }\n\n -- Default (0) position for the camera, as defined in the mod. If we don't recreate this position\n -- EXACTLY when exiting the tour then camera controls get weird\n local DEFAULT_CAMERA_POS = {\n position = { x = -22.265, y = -2.5, z = 5.2575},\n pitch=64.343,\n yaw=90.333,\n distance=104.7}\n\n -- Global XML coordinates where we can present a card\n local SCREEN_POSITIONS = {\n center = \"0 0 0\",\n north = \"0 300 0\",\n east = \"600 0 0\",\n west = \"-600 0 0\",\n south = \"0 -300 0\",\n -- Northwest is only used by the Mandy card, move it a little right than standard so it's\n -- closer to the importer\n northwest = \"-500 300 0\",\n northeast = \"600 300 0\",\n southwest = \"-600 -300 0\",\n -- Used by the Diana and Wini cards referencing the bottom-right global controls, moved a little\n -- closer to them\n southeast = \"730 -365 0\"\n }\n\n -- Tracks the current state of the tours. Keyed by player color to keep each player's tour\n -- separate, will hold the camera hook and current card.\n local tourState = { }\n\n -- Kicks off the tour by initializing the card and camera hook. A callback on the hook creation\n -- will then show the first card.\n ---@param playerColor String Player color to start the tour for\n TourManager.startTour = function(playerColor)\n tourState[playerColor] = {\n currentCardIndex = 1\n }\n -- Camera gets really screwy when we finalize if we don't start settled in ThirdPerson at the\n -- default position before attaching to the hook. Unfortunately there are no callbacks for when\n -- the movement is done, but the delay seems to handle it\n Player[playerColor].setCameraMode(\"ThirdPerson\")\n Player[playerColor].lookAt(DEFAULT_CAMERA_POS)\n -- Initial camera rotation is painfully slow. White and Orange players are likely oriented\n -- correctly, but need a longer start delay for Green and Red\n local delay = 0.5\n if playerColor ~= \"White\" and playerColor ~= \"Orange\" then\n delay = 2\n broadcastToColor(\"Starting the tour, please wait...\", playerColor)\n end\n Wait.time(function()\n internal.createTourCard(playerColor)\n -- XML update to add the new card takes a few frames to load, wait for it to finish then\n -- create the hook\n Wait.condition(\n function()\n internal.createCameraHook(playerColor)\n end,\n function()\n return not Global.UI.loading\n end\n )\n end, delay)\n end\n\n -- Shows the next card in the tour script. This method is exposed (rather than being part of\n -- internal) because the XMLUI callbacks expect the method to be on the object directly.\n ---@param player Player object to show the next card for, provided by XMLUI callback\n function nextCard(player)\n internal.hideCard(player.color)\n Wait.time(function()\n tourState[player.color].currentCardIndex = tourState[player.color].currentCardIndex + 1\n if tourState[player.color].currentCardIndex \u003e #TOUR_SCRIPT then\n internal.finalizeTour(player.color)\n else\n internal.showCurrentCard(player.color)\n end\n end, 0.3)\n end\n\n -- Ends the tour and cleans up the camera. This method is exposed (rather than being part of\n -- internal) because the XMLUI callbacks expect the method to be on the object directly.\n ---@param player Player object to end the tour for, provided by XMLUI callback\n function stopTour(player)\n internal.hideCard(player.color)\n Wait.time(function()\n internal.finalizeTour(player.color)\n end, 0.3)\n end\n\n -- Updates the card UI for the script at the current index, moves the camera to the proper\n -- position, and shows the card.\n ---@param playerColor String Player color to show the current card for\n internal.showCurrentCard = function(playerColor)\n internal.updateCardDisplay(playerColor)\n local delay = 0\n local cardIndex = tourState[playerColor].currentCardIndex\n local hook = getObjectFromGUID(tourState[playerColor].cameraHookGuid)\n\n if not TOUR_SCRIPT[cardIndex].skipCentering then\n hook.setPositionSmooth(HOOK_CAMERA_HOME, false, false)\n delay = delay + 0.5\n end\n local lookPos\n local objReferenceData = TOUR_SCRIPT[cardIndex].objReferenceData\n if objReferenceData ~= nil then\n local lookAtObj = guidReferenceApi.getObjectByOwnerAndType(objReferenceData.owner, objReferenceData.type)\n lookPos = lookAtObj.getPosition()\n lookPos.y = TOUR_SCRIPT[cardIndex].distanceFromObj or 0\n -- Since camera isn't directly above the hook, changing the Y affects the visual position of\n -- whatever object we're trying to look at. This is an approximation, but close enough to\n -- keep the object more centered\n lookPos.x = lookPos.x - lookPos.y / 2\n elseif TOUR_SCRIPT[cardIndex].showPos ~= nil then\n lookPos = TOUR_SCRIPT[cardIndex].showPos\n end\n if lookPos ~= nil then\n Wait.time(function()\n hook.setPositionSmooth(lookPos, false, false)\n end, delay)\n delay = delay + 0.5\n end\n Wait.time(function() Global.UI.show(internal.getUiId(CARD_ID, playerColor)) end, delay)\n end\n\n -- Hides the current card being shown to a player. This can be in preparation for showing the\n -- next card, or ending the tour.\n ---@param playerColor String Player color to hide the current card for\n internal.hideCard = function(playerColor)\n Global.UI.hide(internal.getUiId(CARD_ID, playerColor))\n end\n\n -- Cleans up all the various resources associated with the tour, and (hopefully) resets the\n -- camera to the default position. Camera handling is erratic, the final card in the script\n -- should include instructions for the player to fix it.\n ---@param playerColor String Player color to clean up\n internal.finalizeTour = function(playerColor)\n local cameraHook = getObjectFromGUID(tourState[playerColor].cameraHookGuid)\n cameraHook.destruct()\n Player[playerColor].setCameraMode(\"ThirdPerson\")\n tourState[playerColor] = nil\n Wait.frames(function()\n Player[playerColor].lookAt(DEFAULT_CAMERA_POS)\n end, 3)\n end\n\n -- Updates the card UI to show the appropriate card configuration.\n ---@param playerColor String Player color to update card for\n internal.updateCardDisplay = function(playerColor)\n local index = tourState[playerColor].currentCardIndex\n Global.UI.setAttribute(internal.getUiId(LEFT_NARRATOR_ID, playerColor), \"image\", \"Inv-\" .. TOUR_SCRIPT[index].narrator)\n Global.UI.setAttribute(internal.getUiId(RIGHT_NARRATOR_ID, playerColor), \"image\", \"Inv-\" .. TOUR_SCRIPT[index].narrator)\n Global.UI.setAttribute(internal.getUiId(TEXT_ID, playerColor), \"text\", \"\\\"\" .. TOUR_SCRIPT[index].text .. \"\\\"\")\n local cardPos = TOUR_SCRIPT[index].position or \"north\"\n Global.UI.setAttribute(internal.getUiId(CARD_ID, playerColor), \"position\", SCREEN_POSITIONS[cardPos])\n Global.UI.setAttribute(internal.getUiId(NEXT_BUTTON_ID, playerColor), \"active\", index \u003c #TOUR_SCRIPT)\n\n -- Adjust images so the narrator is on the left or right, as defined by the card\n if TOUR_SCRIPT[index].speakerSide == \"right\" then\n Global.UI.setAttribute(internal.getUiId(LEFT_NARRATOR_ID, playerColor), \"active\", false)\n Global.UI.setAttribute(internal.getUiId(RIGHT_NARRATOR_ID, playerColor), \"active\", true)\n Global.UI.setAttribute(internal.getUiId(BUBBLE_ID, playerColor), \"rotation\", \"0 180 0\")\n Global.UI.setAttribute(internal.getUiId(TEXT_ID, playerColor), \"offsetXY\", \"-15 -15\")\n Global.UI.setAttribute(internal.getUiId(NEXT_BUTTON_ID, playerColor), \"offsetXY\", \"-35 -45\")\n Global.UI.setAttribute(internal.getUiId(STOP_BUTTON_ID, playerColor), \"offsetXY\", \"5 -45\")\n else\n Global.UI.setAttribute(internal.getUiId(LEFT_NARRATOR_ID, playerColor), \"active\", true)\n Global.UI.setAttribute(internal.getUiId(RIGHT_NARRATOR_ID, playerColor), \"active\", false)\n Global.UI.setAttribute(internal.getUiId(BUBBLE_ID, playerColor), \"rotation\", \"0 0 0\")\n Global.UI.setAttribute(internal.getUiId(TEXT_ID, playerColor), \"offsetXY\", \"15 -15\")\n Global.UI.setAttribute(internal.getUiId(NEXT_BUTTON_ID, playerColor), \"offsetXY\", \"-5 -45\")\n Global.UI.setAttribute(internal.getUiId(STOP_BUTTON_ID, playerColor), \"offsetXY\", \"35 -45\")\n end\n end\n\n -- Creates a small, transparent object which the camera will be attached to in order to move the\n -- user's view around the table. This should be called only at the beginning of the tour. Once\n -- creation is complete the user's camera will be attached to the hook and the first card will be\n -- shown.\n ---@param playerColor String Player color to create the hook for\n internal.createCameraHook = function(playerColor)\n local hookData = {\n Name = \"BlockSquare\",\n Transform = {\n posX = HOOK_CAMERA_HOME.x,\n posY = HOOK_CAMERA_HOME.y,\n posZ = HOOK_CAMERA_HOME.z,\n rotX = 0,\n rotY = 270.0,\n rotZ = 0,\n scaleX = 0.1,\n scaleY = 0.1,\n scaleZ = 0.1,\n },\n ColorDiffuse = {\n r = 0,\n g = 0,\n b = 0,\n a = 0,\n },\n Locked = true,\n GMNotes = playerColor\n }\n\n spawnObjectData({ data = hookData, callback_function = internal.onHookCreated })\n end\n\n -- Callback for creation of the camera hook object. Will attach the camera and show the current\n -- (presumably first) card.\n ---@param hook Created object\n internal.onHookCreated = function(hook)\n local playerColor = hook.getGMNotes()\n tourState[playerColor].cameraHookGuid = hook.getGUID()\n Player[playerColor].attachCameraToObject({\n object = hook,\n offset = { x = -20, y = 30, z = 0 }\n })\n internal.showCurrentCard(playerColor)\n end\n\n -- Creates an XMLUI entry in Global for a player-specific tour card. Dynamically creating this\n -- is somewhat complex, but ensures we can properly handle any player color.\n ---@param playerColor String Player color to create the card for\n internal.createTourCard = function(playerColor)\n -- Make sure the card doesn't exist before we create a new one\n if Global.UI.getAttributes(internal.getUiId(CARD_ID, playerColor)) ~= nil then\n return\n end\n tourCardTemplate.attributes.id = internal.getUiId(CARD_ID, playerColor)\n tourCardTemplate.children[1].attributes.id = internal.getUiId(LEFT_NARRATOR_ID, playerColor)\n tourCardTemplate.children[2].attributes.id = internal.getUiId(RIGHT_NARRATOR_ID, playerColor)\n tourCardTemplate.children[3].attributes.id = internal.getUiId(BUBBLE_ID, playerColor)\n tourCardTemplate.children[4].attributes.id = internal.getUiId(TEXT_ID, playerColor)\n tourCardTemplate.children[5].attributes.id = internal.getUiId(NEXT_BUTTON_ID, playerColor)\n tourCardTemplate.children[5].attributes.onClick = self.getGUID()..\"/nextCard\"\n tourCardTemplate.children[6].attributes.id = internal.getUiId(STOP_BUTTON_ID, playerColor)\n tourCardTemplate.children[6].attributes.onClick = self.getGUID()..\"/stopTour\"\n internal.setDeepVisibility(tourCardTemplate, playerColor)\n\n local globalXml = Global.UI.getXmlTable()\n table.insert(globalXml, tourCardTemplate)\n Global.UI.setXmlTable(globalXml)\n end\n\n -- Panels don't cause their children to inherit their visibility value, so this recurses down the\n -- XML table to set all children to the same visibility.\n ---@param xmlUi Table. Lua table describing the XML\n ---@param playerColor String. String color of the player to make this visible for\n internal.setDeepVisibility = function(xmlUi, playerColor)\n xmlUi.attributes.visibility = \"\" .. playerColor\n if xmlUi.children ~= nil then\n for _, child in ipairs(xmlUi.children) do\n internal.setDeepVisibility(child, playerColor)\n end\n end\n end\n\n internal.getUiId = function(baseId, playerColor)\n return baseId .. \"_\" .. playerColor\n end\n\n return TourManager\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"core/tour/TourCard\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Table definition for the tour card layout. This is functionally XMLUI in Lua form, but using\n-- this for dynamic creation ensures we can handle any player color without needing 10\n-- near-duplicate definitions in Global.xml\n\ntourCardTemplate = {\n tag = \"Panel\",\n attributes = {\n id = \"tourCard\",\n height = 215,\n width = 330,\n rotation = \"0 0 0\",\n position = \"0 300 30\",\n showAnimation = \"FadeIn\",\n hideAnimation = \"FadeOut\",\n active=false,\n },\n children = {\n {\n tag = \"Image\",\n attributes = {\n id = \"tourNarratorImageLeft\",\n height=120,\n width=80,\n rectAlignment=\"UpperLeft\",\n offsetXY = \"-80 0\",\n -- Image will be set when the card is updated\n }\n },\n {\n tag = \"Image\",\n attributes = {\n id = \"tourNarratorImageRight\",\n active = false,\n height=125,\n width=80,\n rectAlignment=\"UpperRight\",\n offsetXY = \"80 0\"\n -- Image will be set when the card is updated\n }\n },\n {\n tag = \"Image\",\n attributes = {\n id = \"tourSpeechBubble\",\n color = \"#F5F5DC\",\n height = 215,\n width = 330,\n rectAlignment = \"MiddleCenter\",\n image = \"SpeechBubble\",\n },\n },\n {\n tag = \"Text\",\n attributes = {\n id = \"tourText\",\n -- Everything on this is double-sized and scaled down to keep the text sharps\n height = 370,\n width = 520,\n scale = \"0.5 0.5 1\",\n rectAlignment = \"UpperCenter\",\n offsetXY = \"15 -15\",\n resizeTextForBestFit = true,\n resizeTextMinSize = 20,\n resizeTextMaxSize = 32,\n color = \"#050505\",\n alignment = \"UpperLeft\",\n horizontalOverflow = \"wrap\",\n }\n },\n {\n tag = \"Image\",\n attributes = {\n id = \"tourNext\",\n height = 45,\n width = 45,\n rectAlignment = \"LowerRight\",\n offsetXY = \"-5 -45\",\n image = \"NextArrow\"\n },\n },\n {\n tag = \"Image\",\n attributes = {\n id = \"tourStop\",\n height = 45,\n width = 45,\n rectAlignment = \"LowerLeft\",\n offsetXY = \"35 -45\",\n image = \"Exit\"\n }\n },\n }\n}\nend)\n__bundle_register(\"core/tour/TourScript\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Script for the SCED tour. Documentation and definitions to come.\n\nTOUR_SCRIPT = {\n {\n narrator = \"Roland\",\n text = \"Despite my best efforts, looks like you found us. You may live to regret that. As long as you're here though we might as well show you around.\\n\\nUse the arrow to move forward, and if the horrors get to be too much you can quit whenever you like. Ready to get started?\",\n position = \"center\"\n },\n {\n narrator = \"Darrell\",\n text = \"Cameras can be tricky things. Best you leave handling it to the professionals during the tour. Don't try to move the camera until the tour is complete.\\n\\nOnce we're done, remember you can use the 'p' key to switch back to third-person mode, and the spacebar to reset the position.\",\n position = \"center\",\n speakerSide = \"right\",\n },\n {\n narrator = \"Daisy\",\n text = \"If you're new to the game, the library here has everything you'll need. A little research can go a long way, and looking into old newspapers for the weird and unusual can yield some surprisingly helpful information.\\n\\nI put a few right there that might prove enlightening.\",\n objReferenceData = { owner = \"Mythos\", type = \"RulesReference\" },\n distanceFromObj = 20,\n position = \"west\",\n speakerSide = \"right\"\n },\n {\n narrator = \"Mandy\",\n text = \"To survive what's coming you'll need a deck. If it's safely hidden away on ArkhamDB you can load it here, and even find the newest version after an upgrade without changing the ID.\\n\\nNo need to publish all your decks, use 'Private' and you can see it. Just make sure to select 'Make your decks public' in ArkhamDB.\",\n objReferenceData = { owner = \"Mythos\", type = \"DeckImporter\" },\n distanceFromObj = -5,\n position = \"northwest\",\n skipCentering = true,\n },\n {\n narrator = \"Daniela\",\n text = \"I prefer the hands-on approach to building things, if you do too you can build a deck yourself.\\n\\nAll the cards you could ever need are here, laid out like a disassembled engine. Place the cards on the table, copy them for your deck, and you'll be ready for anything.\",\n objReferenceData = { owner = \"Mythos\", type = \"PlayerCardPanel\" },\n distanceFromObj = -7,\n position = \"south\",\n speakerSide = \"right\"\n },\n {\n narrator = \"Finn\",\n text = \"Ready to face the unknown? We've smuggled shocking revelations and devious enemies from all over the world. Download the campaign you want to play, then Place it on the table to see the scenarios.\\n\\nJust remember - if it turns out to be too much for you, I was never here.\",\n objReferenceData = { owner = \"Mythos\", type = \"CampaignThePathToCarcosa\" },\n distanceFromObj = 20,\n position = \"northwest\",\n },\n {\n narrator = \"Diana\",\n text = \"These symbols on the bottom right are a repository of arcane knowledge, containing all the official content to download plus some deviously creative works from fans. One should beware those who seem too fond of the darkness, but you cannot deny the quality of their efforts.\\n\\nDon't see anything here? Only promoted players can access these.\",\n position = \"southeast\",\n },\n {\n narrator = \"Winifred\",\n text = \"No good aviator would fly a plane she didn't know and hadn't tweaked a bit herself. The gear icon contains settings to customize your play experience, from alternate ways to track your clues to a variety of helpers to streamline the game.\\n\\nEverything here is optional, but who doesn't want to go as fast as they can? Just remember that all settings affect all players, so strap in and trust your pilot!\",\n position = \"southeast\",\n },\n {\n narrator = \"Amina\",\n text = \"This is the Mythos area. Encounter cards, acts, and agenda will all be placed here while the large map below is where you will be exploring - be sure to set the number of investigators!\\n\\nYou can count doom on the agenda by clicking the large counter, and the smaller will automatically count doom tokens on the table. The chaos bag is in that book over on the right, and you can add or remove tokens from it whenever you need.\",\n showPos = { x = -2.85, y = 0, z = 0.55 },\n position = \"north\",\n speakerSide = \"right\"\n },\n {\n narrator = \"Gloria\",\n text = \"The evils that lurk in this world are out there, creeping ever closer. When they find you, this will easily draw a card from the encounter deck. The deck will even reshuffle itself when needed, for the enemies we face are unending.\",\n showPos = { x = -35, y = -20, z = 28 },\n position = \"west\",\n },\n {\n narrator = \"Jacqueline\",\n text = \"When the ire of fate finds you and the chaos looms, this large button will draw a chaos token. Click it again to return the token to the bag.\\n\\nWhether a vision of the future or a curse from the opponents we face, if you need additional tokens a right-click will draw more. I wish you luck, but have a vision of red tentacles reaching for you...\",\n showPos = { x = -35, y = -20, z = 4.25 },\n position = \"north\",\n skipCentering = true,\n speakerSide = \"right\"\n },\n {\n narrator = \"Preston\",\n text = \"I can afford to buy what I need, but for those less well-off we've provided an endless pool of tokens to track your game. Simply drag one out of the pools here.\\n\\nResources are my favorite of course, but damage and horror are as inevitable as taxes. I leave those to my bookkeeper though. Those tokens can work like counters, use the number keys to change the value.\",\n objReferenceData = { owner = \"Mythos\", type = \"ResourceTokenBag\" },\n position = \"north\",\n skipCentering = true,\n speakerSide = \"right\"\n },\n {\n narrator = \"Norman\",\n text = \"That's the end of the tour, but there's much more to discover if you look in the right places. Some cards have helpers on the right-click menu, and every new version adds new content and functions.\\n\\nDon't be afraid to explore, and best of luck out there! We'll all need it...\",\n position = \"center\",\n speakerSide = \"right\"\n },\n}\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Custom_Token", @@ -187925,7 +193075,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playercards/PlayerCardSpawner\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Amount to shift for the next card (zShift) or next row of cards (xShift)\n-- Note that the table rotation is weird, and the X axis is vertical while the\n-- Z axis is horizontal\nlocal SPREAD_Z_SHIFT = -2.3\nlocal SPREAD_X_SHIFT = -3.66\n\nSpawner = { }\n\n-- Spawns a list of cards at the given position/rotation. This will separate cards by size -\n-- investigator, standard, and mini, spawning them in that order with larger cards on bottom. If\n-- there are different types, the provided callback will be called once for each type as it spawns\n-- either a card or deck.\n-- @param cardList: A list of Player Card data structures (data/metadata)\n-- @param pos Position table where the cards should be spawned (global)\n-- @param rot Rotation table for the orientation of the spawned cards (global)\n-- @param sort Boolean, true if this list of cards should be sorted before spawning\n-- @param callback Function, callback to be called after the card/deck spawns.\nSpawner.spawnCards = function(cardList, pos, rot, sort, callback)\n if (sort) then\n table.sort(cardList, Spawner.cardComparator)\n end\n\n local miniCards = { }\n local standardCards = { }\n local investigatorCards = { }\n\n for _, card in ipairs(cardList) do\n if (card.metadata.type == \"Investigator\") then\n table.insert(investigatorCards, card)\n elseif (card.metadata.type == \"Minicard\") then\n table.insert(miniCards, card)\n else\n table.insert(standardCards, card)\n end\n end\n -- Spawn each of the three types individually. Each Y position shift accounts for the thickness\n -- of the spawned deck\n local position = { x = pos.x, y = pos.y, z = pos.z }\n Spawner.spawn(investigatorCards, position, { rot.x, rot.y - 90, rot.z }, callback)\n\n position.y = position.y + (#investigatorCards + #standardCards) * 0.07\n Spawner.spawn(standardCards, position, rot, callback)\n\n position.y = position.y + (#standardCards + #miniCards) * 0.07\n Spawner.spawn(miniCards, position, rot, callback)\nend\n\nSpawner.spawnCardSpread = function(cardList, startPos, maxCols, rot, sort, callback)\n if (sort) then\n table.sort(cardList, Spawner.cardComparator)\n end\n\n local position = { x = startPos.x, y = startPos.y, z = startPos.z }\n -- Special handle the first row if we have less than a full single row, but only if there's a\n -- reasonable max column count. Single-row spreads will send a large value for maxCols\n if maxCols \u003c 100 and #cardList \u003c maxCols then\n position.z = startPos.z + ((maxCols - #cardList) / 2 * SPREAD_Z_SHIFT)\n end\n local cardsInRow = 0\n local rows = 0\n for _, card in ipairs(cardList) do\n Spawner.spawn({ card }, position, rot, callback)\n position.z = position.z + SPREAD_Z_SHIFT\n cardsInRow = cardsInRow + 1\n if cardsInRow \u003e= maxCols then\n rows = rows + 1\n local cardsForRow = #cardList - rows * maxCols\n if cardsForRow \u003e maxCols then\n cardsForRow = maxCols\n end\n position.z = startPos.z + ((maxCols - cardsForRow) / 2 * SPREAD_Z_SHIFT)\n position.x = position.x + SPREAD_X_SHIFT\n cardsInRow = 0\n end\n end\nend\n\n-- Spawn a specific list of cards. This method is for internal use and should not be called\n-- directly, use spawnCards instead.\n---@param cardList: A list of Player Card data structures (data/metadata)\n---@param pos table Position where the cards should be spawned (global)\n---@param rot table Rotation for the orientation of the spawned cards (global)\n---@param callback function callback to be called after the card/deck spawns.\nSpawner.spawn = function(cardList, pos, rot, callback)\n if (#cardList == 0) then\n return\n end\n -- Spawn a single card directly\n if (#cardList == 1) then\n spawnObjectData({\n data = cardList[1].data,\n position = pos,\n rotation = rot,\n callback_function = callback,\n })\n return\n end\n -- For multiple cards, construct a deck and spawn that\n local deck = Spawner.buildDeckDataTemplate()\n -- Decks won't inherently scale to the cards in them. The card list being spawned should be all\n -- the same type/size by this point, so use the first card to set the size\n deck.Transform = {\n scaleX = cardList[1].data.Transform.scaleX,\n scaleY = 1,\n scaleZ = cardList[1].data.Transform.scaleZ,\n }\n local sidewaysDeck = true\n for _, spawnCard in ipairs(cardList) do\n Spawner.addCardToDeck(deck, spawnCard.data)\n -- set sidewaysDeck to false if any card is not a sideways card\n sidewaysDeck = (sidewaysDeck and spawnCard.data.SidewaysCard)\n end\n -- set the alt view angle for sideway decks\n if sidewaysDeck then\n deck.AltLookAngle = { x = 0, y = 180, z = 90 }\n end\n spawnObjectData({\n data = deck,\n position = pos,\n rotation = rot,\n callback_function = callback,\n })\nend\n\n-- Inserts a card into the given deck. This does three things:\n-- 1. Add the card's data to ContainedObjects\n-- 2. Add the card's ID (the TTS CardID, not the Arkham ID) to the deck's\n-- ID list. Note that the deck's ID list is \"DeckIDs\" even though it\n-- contains a list of card Ids\n-- 3. Extract the card's CustomDeck table and add it to the deck. The deck's\n-- \"CustomDeck\" field is a list of all CustomDecks used by cards within the\n-- deck, keyed by the DeckID and referencing the custom deck table\n---@param deck: TTS deck data structure to add to\n---@param card: Data for the card to be inserted\nSpawner.addCardToDeck = function(deck, cardData)\n for customDeckId, customDeckData in pairs(cardData.CustomDeck) do\n if (deck.CustomDeck[customDeckId] == nil) then\n -- CustomDeck not added to deck yet, add it\n deck.CustomDeck[customDeckId] = customDeckData\n elseif (deck.CustomDeck[customDeckId].FaceURL == customDeckData.FaceURL) then\n -- CustomDeck for this card matches the current one for the deck, do nothing\n else\n -- CustomDeck data conflict\n local newDeckId = nil\n for deckId, customDeck in pairs(deck.CustomDeck) do\n if (customDeckData.FaceURL == customDeck.FaceURL) then\n newDeckId = deckId\n end\n end\n if (newDeckId == nil) then\n -- No non-conflicting custom deck for this card, add a new one\n newDeckId = Spawner.findNextAvailableId(deck.CustomDeck, \"1000\")\n deck.CustomDeck[newDeckId] = customDeckData\n end\n -- Update the card with the new CustomDeck info\n cardData.CardID = newDeckId..string.sub(cardData.CardID, 5)\n cardData.CustomDeck[customDeckId] = nil\n cardData.CustomDeck[newDeckId] = customDeckData\n break\n end\n end\n table.insert(deck.ContainedObjects, cardData)\n table.insert(deck.DeckIDs, cardData.CardID)\nend\n\n-- Create an empty deck data table which can have cards added to it. This\n-- creates a new table on each call without using metatables or previous\n-- definitions because we can't be sure that TTS doesn't modify the structure\n---@return: Table containing the minimal TTS deck data structure\nSpawner.buildDeckDataTemplate = function()\n local deck = {}\n deck.Name = \"Deck\"\n\n -- Card data. DeckIDs and CustomDeck entries will be built from the cards\n deck.ContainedObjects = {}\n deck.DeckIDs = {}\n deck.CustomDeck = {}\n\n -- Transform is required, Position and Rotation will be overridden by the spawn call so can be omitted here\n deck.Transform = {\n scaleX = 1,\n scaleY = 1,\n scaleZ = 1,\n }\n\n return deck\nend\n\n-- Returns the first ID which does not exist in the given table, starting at startId and increasing\n-- @param objectTable Table keyed by strings which are numbers\n-- @param startId First possible ID.\n-- @return String ID \u003e= startId\nSpawner.findNextAvailableId = function(objectTable, startId)\n local id = startId\n while (objectTable[id] ~= nil) do\n id = tostring(tonumber(id) + 1)\n end\n\n return id\nend\n\n-- Get the PBCN (Permanent/Bonded/Customizable/Normal) value from the given metadata.\n---@return: 1 for Permanent, 2 for Bonded or 4 for Normal. The actual values are\n-- irrelevant as they provide only grouping and the order between them doesn't matter.\nSpawner.getpbcn = function(metadata)\n if metadata.permanent then\n return 1\n elseif metadata.bonded_to ~= nil then\n return 2\n else -- Normal card\n return 3\n end\nend\n\n-- Comparison function used to sort the cards in a deck. Groups bonded or\n-- permanent cards first, then sorts within theose types by name/subname.\n-- Normal cards will sort in standard alphabetical order, while\n-- permanent/bonded/customizable will be in reverse alphabetical order.\n--\n-- Since cards spawn in the order provided by this comparator, with the first\n-- cards ending up at the bottom of a pile, this ordering will spawn in reverse\n-- alphabetical order. This presents the cards in order for non-face-down\n-- areas, and presents them in order when Searching the face-down deck.\nSpawner.cardComparator = function(card1, card2)\n local pbcn1 = Spawner.getpbcn(card1.metadata)\n local pbcn2 = Spawner.getpbcn(card2.metadata)\n if pbcn1 ~= pbcn2 then\n return pbcn1 \u003e pbcn2\n end\n if pbcn1 == 3 then\n if card1.data.Nickname ~= card2.data.Nickname then\n return card1.data.Nickname \u003c card2.data.Nickname\n end\n return card1.data.Description \u003c card2.data.Description\n else\n if card1.data.Nickname ~= card2.data.Nickname then\n return card1.data.Nickname \u003e card2.data.Nickname\n end\n return card1.data.Description \u003e card2.data.Description\n end\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/PlayerCardPanel\")\nend)\n__bundle_register(\"playercards/PlayerCardPanel\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/PlayerCardPanelData\")\n\nlocal allCardsBagApi = require(\"playercards/AllCardsBagApi\")\nlocal arkhamDb = require(\"arkhamdb/ArkhamDb\")\nlocal spawnBag = require(\"playercards/SpawnBag\")\n\n-- Size and position information for the three rows of class buttons\nlocal CIRCLE_BUTTON_SIZE = 250\nlocal CLASS_BUTTONS_X_OFFSET = 0.1325\nlocal INVESTIGATOR_ROW_START = Vector(0.125, 0.1, -0.447)\nlocal LEVEL_ZERO_ROW_START = Vector(0.125, 0.1, -0.007)\nlocal UPGRADED_ROW_START = Vector(0.125, 0.1, 0.333)\n\n-- Size and position information for the two blocks of other buttons\nlocal MISC_BUTTONS_X_OFFSET = 0.155\nlocal WEAKNESS_ROW_START = Vector(0.157, 0.1, 0.666)\nlocal OTHER_ROW_START = Vector(0.605, 0.1, 0.666)\n\n-- Size and position information for the Cycle (box) buttons\nlocal CYCLE_BUTTON_SIZE = 468\nlocal CYCLE_BUTTON_START = Vector(-0.716, 0.1, -0.39)\nlocal CYCLE_COLUMN_COUNT = 3\nlocal CYCLE_BUTTONS_X_OFFSET = 0.267\nlocal CYCLE_BUTTONS_Z_OFFSET = 0.2665\n\nlocal STARTER_DECK_MODE_SELECTED_COLOR = { 0.2, 0.2, 0.2, 0.8 }\nlocal TRANSPARENT = { 0, 0, 0, 0 }\nlocal STARTER_DECK_MODE_STARTERS = \"starters\"\nlocal STARTER_DECK_MODE_CARDS_ONLY = \"cards\"\n\nlocal FACE_UP_ROTATION = { x = 0, y = 270, z = 0}\nlocal FACE_DOWN_ROTATION = { x = 0, y = 270, z = 180}\n\n-- ---------- IMPORTANT ----------\n-- Coordinates defined below are in global dimensions relative to the panel - DO NOT USE THESE\n-- DIRECTLY. Call scalePositions() before use, and reference the variables below\n\n-- Layout width for a single card, in global coordinate space\nlocal CARD_WIDTH = 2.3\n\n-- Coordinates to begin laying out cards. These vary based on the cards that are being placed by\n-- considering the width of the cards, number of cards, and desired spread intervals.\n-- IMPORTANT! Because of the mix of global card sizes and relative-to-scale positions, the X and Y\n-- coordinates on these provide global disances while the Z is local.\nlocal START_POSITIONS = {\n classCards = Vector(CARD_WIDTH * 9.5, 2, 1.4),\n investigator = Vector(6 * 2.5, 2, 1.3),\n cycle = Vector(CARD_WIDTH * 9.5, 2, 2.4),\n other = Vector(CARD_WIDTH * 9.5, 2, 1.4),\n randomWeakness = Vector(0, 2, 1.4),\n -- Because the card spread is handled by the SpawnBag, we don't know (programatically) where this\n -- should be placed. If more customizable cards are added it will need to be moved.\n summonedServitor = Vector(CARD_WIDTH * -6.5, 2, 1.7),\n}\n\n-- Shifts to move rows of cards, and groups of rows, as different groupings are laid out\nlocal CARD_ROW_OFFSET = 3.7\nlocal CARD_GROUP_OFFSET = 2\n\n-- Position offsets for investigator decks in investigator mode, defines the spacing for how the\n-- rows and columns are laid out\nlocal INVESTIGATOR_POSITION_SHIFT_ROW = Vector(0, 0, 11)\nlocal INVESTIGATOR_POSITION_SHIFT_COL = Vector(-6, 0, 0)\nlocal INVESTIGATOR_MAX_COLS = 6\n\n-- Positions relative to the minicard to place other stacks. Both signature card piles and starter\n-- decks use SIGNATURE_OFFSET\nlocal INVESTIGATOR_CARD_OFFSET = Vector(0, 0, 2.55)\nlocal INVESTIGATOR_SIGNATURE_OFFSET = Vector(0, 0, 5.75)\n\n-- USE THESE! Positions and offset shifts accounting for the scale of the panel\nlocal startPositions\nlocal cardRowOffset\nlocal cardGroupOffset\nlocal investigatorPositionShiftRow\nlocal investigatorPositionShiftCol\nlocal investigatorCardOffset\nlocal investigatorSignatureOffset\n\nlocal CLASS_LIST = { \"Guardian\", \"Seeker\", \"Rogue\", \"Mystic\", \"Survivor\", \"Neutral\" }\nlocal CYCLE_LIST = {\n \"Core\",\n \"The Dunwich Legacy\",\n \"The Path to Carcosa\",\n \"The Forgotten Age\",\n \"The Circle Undone\",\n \"The Dream-Eaters\",\n \"The Innsmouth Conspiracy\",\n \"Edge of the Earth\",\n \"The Scarlet Keys\",\n \"The Feast of Hemlock Vale\",\n \"Investigator Packs\"\n}\n\nlocal excludedNonBasicWeaknesses\n\nlocal starterDeckMode = STARTER_DECK_MODE_CARDS_ONLY\nlocal helpVisibleToPlayers = { }\n\nfunction onSave()\n local saveState = {\n spawnBagState = spawnBag.getStateForSave(),\n }\n return JSON.encode(saveState)\nend\n\nfunction onLoad(savedData)\n arkhamDb.initialize()\n if (savedData ~= nil) then\n local saveState = JSON.decode(savedData) or { }\n if (saveState.spawnBagState ~= nil) then\n spawnBag.loadFromSave(saveState.spawnBagState)\n end\n end\n buildExcludedWeaknessList()\n createButtons()\nend\n\n-- Build a list of non-basic weaknesses which should be excluded from the last weakness set,\n-- including all signature cards and evolved weaknesses.\nfunction buildExcludedWeaknessList()\n excludedNonBasicWeaknesses = { }\n for _, investigator in pairs(INVESTIGATORS) do\n for _, signatureId in ipairs(investigator.signatures) do\n excludedNonBasicWeaknesses[signatureId] = true\n end\n end\n for _, weaknessId in ipairs(EVOLVED_WEAKNESSES) do\n excludedNonBasicWeaknesses[weaknessId] = true\n end\nend\n\nfunction createButtons()\n createHelpButton()\n createInvestigatorButtons()\n createLevelZeroButtons()\n createUpgradedButtons()\n createWeaknessButtons()\n createOtherButtons()\n createCycleButtons()\n createClearButton()\n -- Create investigator mode buttons last so the indexes are set when we need to update them\n createInvestigatorModeButtons()\nend\n\nfunction createHelpButton()\n self.createButton({\n function_owner = self,\n click_function = \"toggleHelp\",\n position = Vector(0.845, 0.1, -0.855),\n rotation = Vector(0, 0, 0),\n height = 180,\n width = 180,\n scale = Vector(0.25, 1, 0.25),\n color = TRANSPARENT,\n })\nend\n\nfunction createInvestigatorButtons()\n local invButtonParams = {\n function_owner = self,\n rotation = Vector(0, 0, 0),\n height = CIRCLE_BUTTON_SIZE,\n width = CIRCLE_BUTTON_SIZE,\n scale = Vector(0.25, 1, 0.25),\n color = TRANSPARENT,\n }\n local buttonPos = INVESTIGATOR_ROW_START:copy()\n for _, class in ipairs(CLASS_LIST) do\n invButtonParams.click_function = \"spawnInvestigators\" .. class\n invButtonParams.position = buttonPos\n self.createButton(invButtonParams)\n buttonPos.x = buttonPos.x + CLASS_BUTTONS_X_OFFSET\n self.setVar(invButtonParams.click_function, function(_, _, _) spawnInvestigatorGroup(class) end)\n end\nend\n\nfunction createLevelZeroButtons()\n local l0ButtonParams = {\n function_owner = self,\n rotation = Vector(0, 0, 0),\n height = CIRCLE_BUTTON_SIZE,\n width = CIRCLE_BUTTON_SIZE,\n scale = Vector(0.25, 1, 0.25),\n color = TRANSPARENT,\n }\n local buttonPos = LEVEL_ZERO_ROW_START:copy()\n for _, class in ipairs(CLASS_LIST) do\n l0ButtonParams.click_function = \"spawnBasic\" .. class\n l0ButtonParams.position = buttonPos\n self.createButton(l0ButtonParams)\n buttonPos.x = buttonPos.x + CLASS_BUTTONS_X_OFFSET\n self.setVar(l0ButtonParams.click_function, function(_, _, _) spawnClassCards(class, false) end)\n end\nend\n\nfunction createUpgradedButtons()\n local upgradedButtonParams = {\n function_owner = self,\n rotation = Vector(0, 0, 0),\n height = CIRCLE_BUTTON_SIZE,\n width = CIRCLE_BUTTON_SIZE,\n scale = Vector(0.25, 1, 0.25),\n color = TRANSPARENT,\n }\n local buttonPos = UPGRADED_ROW_START:copy()\n for _, class in ipairs(CLASS_LIST) do\n upgradedButtonParams.click_function = \"spawnUpgraded\" .. class\n upgradedButtonParams.position = buttonPos\n self.createButton(upgradedButtonParams)\n buttonPos.x = buttonPos.x + CLASS_BUTTONS_X_OFFSET\n self.setVar(upgradedButtonParams.click_function, function(_, _, _) spawnClassCards(class, true) end)\n end\nend\n\nfunction createWeaknessButtons()\n local weaknessButtonParams = {\n function_owner = self,\n rotation = Vector(0, 0, 0),\n height = CIRCLE_BUTTON_SIZE,\n width = CIRCLE_BUTTON_SIZE,\n scale = Vector(0.25, 1, 0.25),\n color = TRANSPARENT,\n }\n local buttonPos = WEAKNESS_ROW_START:copy()\n weaknessButtonParams.click_function = \"spawnWeaknesses\"\n weaknessButtonParams.tooltip = \"All Weaknesses\"\n weaknessButtonParams.position = buttonPos\n self.createButton(weaknessButtonParams)\n buttonPos.x = buttonPos.x + MISC_BUTTONS_X_OFFSET\n weaknessButtonParams.click_function = \"spawnRandomWeakness\"\n weaknessButtonParams.tooltip = \"Random Basic Weakness\"\n weaknessButtonParams.position = buttonPos\n self.createButton(weaknessButtonParams)\nend\n\nfunction createOtherButtons()\n local otherButtonParams = {\n function_owner = self,\n rotation = Vector(0, 0, 0),\n height = CIRCLE_BUTTON_SIZE,\n width = CIRCLE_BUTTON_SIZE,\n scale = Vector(0.25, 1, 0.25),\n color = TRANSPARENT,\n }\n local buttonPos = OTHER_ROW_START:copy()\n otherButtonParams.click_function = \"spawnBonded\"\n otherButtonParams.tooltip = \"Bonded Cards\"\n otherButtonParams.position = buttonPos\n self.createButton(otherButtonParams)\n buttonPos.x = buttonPos.x + MISC_BUTTONS_X_OFFSET\n otherButtonParams.click_function = \"spawnUpgradeSheets\"\n otherButtonParams.tooltip = \"Customization Upgrade Sheets\"\n otherButtonParams.position = buttonPos\n self.createButton(otherButtonParams)\nend\n\nfunction createCycleButtons()\n local cycleButtonParams = {\n function_owner = self,\n rotation = Vector(0, 0, 0),\n height = CYCLE_BUTTON_SIZE,\n width = CYCLE_BUTTON_SIZE,\n scale = Vector(0.25, 1, 0.25),\n color = TRANSPARENT,\n }\n local buttonPos = CYCLE_BUTTON_START:copy()\n local rowCount = 0\n local colCount = 0\n for _, cycle in ipairs(CYCLE_LIST) do\n cycleButtonParams.click_function = \"spawnCycle\" .. cycle\n cycleButtonParams.position = buttonPos\n cycleButtonParams.tooltip = cycle\n self.createButton(cycleButtonParams)\n self.setVar(cycleButtonParams.click_function, function(_, _, _) spawnCycle(cycle) end)\n colCount = colCount + 1\n -- If we've reached the end of a row, shift down and back to the first column\n if colCount \u003e= CYCLE_COLUMN_COUNT then\n buttonPos = CYCLE_BUTTON_START:copy()\n rowCount = rowCount + 1\n colCount = 0\n buttonPos.z = buttonPos.z + CYCLE_BUTTONS_Z_OFFSET * rowCount\n if rowCount == 3 then\n -- Account for two centered buttons on the final row\n buttonPos.x = buttonPos.x + CYCLE_BUTTONS_X_OFFSET / 2\n --[[ Account for centered button on the final row\n buttonPos.x = buttonPos.x + CYCLE_BUTTONS_X_OFFSET\n ]]\n end\n else\n buttonPos.x = buttonPos.x + CYCLE_BUTTONS_X_OFFSET\n end\n end\nend\n\nfunction createClearButton()\n self.createButton({\n function_owner = self,\n click_function = \"deleteAll\",\n position = Vector(0, 0.1, 0.852),\n rotation = Vector(0, 0, 0),\n height = 170,\n width = 750,\n scale = Vector(0.25, 1, 0.25),\n color = TRANSPARENT,\n })\nend\n\nfunction createInvestigatorModeButtons()\n local starterMode = starterDeckMode == STARTER_DECK_MODE_STARTERS\n\n self.createButton({\n function_owner = self,\n click_function = \"setCardsOnlyMode\",\n position = Vector(0.251, 0.1, -0.322),\n rotation = Vector(0, 0, 0),\n height = 170,\n width = 760,\n scale = Vector(0.25, 1, 0.25),\n color = starterMode and TRANSPARENT or STARTER_DECK_MODE_SELECTED_COLOR\n })\n self.createButton({\n function_owner = self,\n click_function = \"setStarterDeckMode\",\n position = Vector(0.66, 0.1, -0.322),\n rotation = Vector(0, 0, 0),\n height = 170,\n width = 760,\n scale = Vector(0.25, 1, 0.25),\n color = starterMode and STARTER_DECK_MODE_SELECTED_COLOR or TRANSPARENT\n })\n local checkX = starterMode and 0.52 or 0.11\n self.createButton({\n function_owner = self,\n label = \"✓\",\n click_function = \"doNothing\",\n position = Vector(checkX, 0.11, -0.317),\n rotation = Vector(0, 0, 0),\n height = 0,\n width = 0,\n scale = Vector(0.3, 1, 0.3),\n font_color = { 0, 0, 0 },\n color = { 1, 1, 1 }\n })\nend\n\nfunction toggleHelp(_, playerColor, _)\n if helpVisibleToPlayers[playerColor] then\n helpVisibleToPlayers[playerColor] = nil\n else\n helpVisibleToPlayers[playerColor] = true\n end\n updateHelpVisibility()\nend\n\nfunction updateHelpVisibility()\n local visibility = \"\"\n for player, _ in pairs(helpVisibleToPlayers) do\n if string.len(visibility) \u003e 0 then\n visibility = visibility .. \"|\" .. player\n else\n visibility = player\n end\n end\n self.UI.setAttribute(\"helpText\", \"visibility\", visibility)\n self.UI.setAttribute(\"helpPanel\", \"visibility\", visibility)\n self.UI.setAttribute(\"helpPanel\", \"active\", string.len(visibility) \u003e 0)\nend\n\nfunction setStarterDeckMode()\n starterDeckMode = STARTER_DECK_MODE_STARTERS\n updateStarterModeButtons()\nend\n\nfunction setCardsOnlyMode()\n starterDeckMode = STARTER_DECK_MODE_CARDS_ONLY\n updateStarterModeButtons()\nend\n\nfunction updateStarterModeButtons()\n local buttonCount = #self.getButtons()\n -- Buttons are 0-indexed, so the last three are -1, -2, and -3 from the size\n self.removeButton(buttonCount - 1)\n self.removeButton(buttonCount - 2)\n self.removeButton(buttonCount - 3)\n createInvestigatorModeButtons()\nend\n\n-- Clears the table and updates positions based on scale. Should be called before ANY card\n-- placement\nfunction prepareToPlaceCards()\n deleteAll()\n scalePositions()\nend\n\n-- Updates the positions based on the current object scale to ensure the relative layout functions\n-- properly at different scales.\nfunction scalePositions()\n -- Assume scaling is consistent in X and Z dimensions\n local scale = 1 / self.getScale().x\n startPositions = { }\n for key, pos in pairs(START_POSITIONS) do\n -- Because a scaled object means a different global size, using global distance for Z results in\n -- the cards being closer or farther depending on the scale. Leave the Z values and only scale\n -- X and Y\n startPositions[key] = Vector(pos)\n startPositions[key].x = startPositions[key].x * scale\n startPositions[key].y = startPositions[key].y * scale\n end\n cardRowOffset = CARD_ROW_OFFSET * scale\n cardGroupOffset = CARD_GROUP_OFFSET * scale\n investigatorPositionShiftRow = Vector(INVESTIGATOR_POSITION_SHIFT_ROW):scale(scale)\n investigatorPositionShiftCol = Vector(INVESTIGATOR_POSITION_SHIFT_COL):scale(scale)\n investigatorCardOffset = Vector(INVESTIGATOR_CARD_OFFSET):scale(scale)\n investigatorSignatureOffset = Vector(INVESTIGATOR_SIGNATURE_OFFSET):scale(scale)\nend\n\n-- Deletes all cards currently placed on the table\nfunction deleteAll()\n spawnBag.recall(true)\nend\n\n-- Spawn an investigator group, based on the current UI setting for either investigators or starter\n-- decks.\n---@param groupName String. Name of the group to spawn, matching a key in InvestigatorPanelData\nfunction spawnInvestigatorGroup(groupName)\n local starterMode = starterDeckMode == STARTER_DECK_MODE_STARTERS\n prepareToPlaceCards()\n Wait.frames(function()\n if starterMode then\n spawnStarters(groupName)\n else\n spawnInvestigators(groupName)\n end\n end, 2)\nend\n\n-- Spawn cards for all investigators in the given group. This creates piles for all defined\n-- investigator cards and minicards as well as the signature cards.\n---@param groupName String. Name of the group to spawn, matching a key in InvestigatorPanelData\nfunction spawnInvestigators(groupName)\n if INVESTIGATOR_GROUPS[groupName] == nil then\n printToAll(\"No \" .. groupName .. \" data yet\")\n return\n end\n\n local col = 1\n local row = 1\n local investigatorCount = #INVESTIGATOR_GROUPS[groupName]\n local position = getInvestigatorRowStartPos(investigatorCount, row)\n\n for i, investigatorName in ipairs(INVESTIGATOR_GROUPS[groupName]) do\n for _, spawnSpec in ipairs(buildInvestigatorSpawnSpec(\n investigatorName, INVESTIGATORS[investigatorName], position, false)) do\n spawnBag.spawn(spawnSpec)\n end\n position:add(investigatorPositionShiftCol)\n col = col + 1\n if col \u003e INVESTIGATOR_MAX_COLS then\n col = 1\n row = row + 1\n position = getInvestigatorRowStartPos(investigatorCount, row)\n end\n end\nend\n\nfunction getInvestigatorRowStartPos(investigatorCount, row)\n local rowStart = Vector(startPositions.investigator)\n rowStart:add(Vector(\n investigatorPositionShiftRow.x * (row - 1),\n investigatorPositionShiftRow.y * (row - 1),\n investigatorPositionShiftRow.z * (row - 1)))\n local investigatorsInRow =\n math.min(investigatorCount - INVESTIGATOR_MAX_COLS * (row - 1), INVESTIGATOR_MAX_COLS)\n rowStart:add(Vector(\n investigatorPositionShiftCol.x * (INVESTIGATOR_MAX_COLS - investigatorsInRow) / 2,\n investigatorPositionShiftCol.y * (INVESTIGATOR_MAX_COLS - investigatorsInRow) / 2,\n investigatorPositionShiftCol.z * (INVESTIGATOR_MAX_COLS - investigatorsInRow) / 2))\n\n return rowStart\nend\n\n-- Creates the spawn spec for the investigator's signature cards.\n---@param investigatorName String. Name of the investigator, matching a key in\n--- InvestigatorPanelData\n---@param investigatorData Table. Spawn definition for the investigator, retrieved from\n--- INVESTIGATORS\n---@param position Vector. Where to spawn the minicard; investigagor cards will be placed below\nfunction buildInvestigatorSpawnSpec(investigatorName, investigatorData, position)\n local sigPos = Vector(position):add(investigatorSignatureOffset)\n local spawns = buildCommonSpawnSpec(investigatorName, investigatorData, position)\n table.insert(spawns, {\n name = investigatorName..\"signatures\",\n cards = investigatorData.signatures,\n globalPos = self.positionToWorld(sigPos),\n rotation = FACE_UP_ROTATION,\n })\n\n return spawns\nend\n\n-- Builds the spawn specs for minicards and investigator cards. These are common enough to be\n-- shared, and will only differ in whether they spawn the full stack of possible investigator and\n-- minicards, or only the first of each.\n---@param investigatorName String. Name of the investigator, matching a key in\n--- InvestigatorPanelData\n---@param investigatorData Table. Spawn definition for the investigator, retrieved from\n--- INVESTIGATORS\n---@param position Vector. Where to spawn the minicard; investigagor cards will be placed below\n---@param oneCardOnly Boolean. If true, will spawn only the first card in the investigator card\n--- and minicard lists. Otherwise, spawn them all in a deck\nfunction buildCommonSpawnSpec(investigatorName, investigatorData, position, oneCardOnly)\n local cardPos = Vector(position):add(investigatorCardOffset)\n return {\n {\n name = investigatorName..\"minicards\",\n cards = oneCardOnly and { investigatorData.minicards[1] } or investigatorData.minicards,\n globalPos = self.positionToWorld(position),\n rotation = FACE_UP_ROTATION,\n },\n {\n name = investigatorName..\"cards\",\n cards = oneCardOnly and { investigatorData.cards[1] } or investigatorData.cards,\n globalPos = self.positionToWorld(cardPos),\n rotation = FACE_UP_ROTATION,\n },\n }\nend\n\n-- Spawns all starter decks (single minicard and investigator card, plus the starter deck) for\n-- investigators in the given group.\n---@param groupName String. Name of the group to spawn, matching a key in InvestigatorPanelData\nfunction spawnStarters(groupName)\n local col = 1\n local row = 1\n local investigatorCount = #INVESTIGATOR_GROUPS[groupName]\n local position = getInvestigatorRowStartPos(investigatorCount, row)\n for _, investigatorName in ipairs(INVESTIGATOR_GROUPS[groupName]) do\n spawnStarterDeck(investigatorName, INVESTIGATORS[investigatorName], position)\n position:add(investigatorPositionShiftCol)\n col = col + 1\n if col \u003e INVESTIGATOR_MAX_COLS then\n col = 1\n row = row + 1\n position = getInvestigatorRowStartPos(investigatorCount, row)\n end\n end\nend\n\n-- Spawns the defined starter deck for the given investigator's.\n---@param investigatorName String. Name of the investigator, matching a key in\n--- InvestigatorPanelData\nfunction spawnStarterDeck(investigatorName, investigatorData, position)\n for _, spawnSpec in ipairs(\n buildCommonSpawnSpec(investigatorName, INVESTIGATORS[investigatorName], position, true)) do\n spawnBag.spawn(spawnSpec)\n end\n local deckPos = Vector(position):add(investigatorSignatureOffset)\n arkhamDb.getDecklist(\"None\", investigatorData.starterDeck, true, false, false, function(slots)\n local cardIdList = { }\n for id, count in pairs(slots) do\n for i = 1, count do\n table.insert(cardIdList, id)\n end\n end\n spawnBag.spawn({\n name = investigatorName..\"starter\",\n cards = cardIdList,\n globalPos = self.positionToWorld(deckPos),\n rotation = FACE_DOWN_ROTATION\n })\n end)\nend\n-- Clears the currently placed cards, then places cards for the given class and level spread\n---@param cardClass String. Class to place (\"Guardian\", \"Seeker\", etc)\n---@param isUpgraded Boolean. If true, spawn the Level 1-5 cards. Otherwise, Level 0.\nfunction spawnClassCards(cardClass, isUpgraded)\n prepareToPlaceCards()\n Wait.frames(function() placeClassCards(cardClass, isUpgraded) end, 2)\nend\n\n-- Spawn the class cards.\n---@param cardClass String. Class to place (\"Guardian\", \"Seeker\", etc)\n---@param isUpgraded Boolean. If true, spawn the Level 1-5 cards. Otherwise, Level 0.\nfunction placeClassCards(cardClass, isUpgraded)\n local indexReady = allCardsBagApi.isIndexReady()\n if (not indexReady) then\n broadcastToAll(\"Still loading player cards, please try again in a few seconds\", {0.9, 0.2, 0.2})\n return\n end\n local cardIdList = allCardsBagApi.getCardsByClassAndLevel(cardClass, isUpgraded)\n\n local skillList = { }\n local eventList = { }\n local assetList = { }\n for _, cardId in ipairs(cardIdList) do\n local cardMetadata = allCardsBagApi.getCardById(cardId).metadata\n if (cardMetadata.type == \"Skill\") then\n table.insert(skillList, cardId)\n elseif (cardMetadata.type == \"Event\") then\n table.insert(eventList, cardId)\n elseif (cardMetadata.type == \"Asset\") then\n table.insert(assetList, cardId)\n end\n end\n local groupPos = Vector(startPositions.classCards)\n if #skillList \u003e 0 then\n spawnBag.spawn({\n name = cardClass .. (isUpgraded and \"upgraded\" or \"basic\"),\n cards = skillList,\n globalPos = self.positionToWorld(groupPos),\n rotation = FACE_UP_ROTATION,\n spread = true,\n spreadCols = 20\n })\n groupPos.z = groupPos.z + math.ceil(#skillList / 20) * cardRowOffset + cardGroupOffset\n end\n if #eventList \u003e 0 then\n spawnBag.spawn({\n name = cardClass .. \"event\" .. (isUpgraded and \"upgraded\" or \"basic\"),\n cards = eventList,\n globalPos = self.positionToWorld(groupPos),\n rotation = FACE_UP_ROTATION,\n spread = true,\n spreadCols = 20\n })\n groupPos.z = groupPos.z + math.ceil(#eventList / 20) * cardRowOffset + cardGroupOffset\n end\n if #assetList \u003e 0 then\n spawnBag.spawn({\n name = cardClass .. \"asset\" .. (isUpgraded and \"upgraded\" or \"basic\"),\n cards = assetList,\n globalPos = self.positionToWorld(groupPos),\n rotation = FACE_UP_ROTATION,\n spread = true,\n spreadCols = 20\n })\n end\nend\n\n-- Spawns the investigator sets and all cards for the given cycle\n---@param cycle String Name of a cycle, should match the standard used in card metadata\nfunction spawnCycle(cycle)\n prepareToPlaceCards()\n spawnInvestigators(cycle)\n local indexReady = allCardsBagApi.isIndexReady()\n if (not indexReady) then\n broadcastToAll(\"Still loading player cards, please try again in a few seconds\", {0.9, 0.2, 0.2})\n return\n end\n local cycleCardList = allCardsBagApi.getCardsByCycle(cycle)\n local copiedList = { }\n for i, id in ipairs(cycleCardList) do\n copiedList[i] = id\n end\n spawnBag.spawn({\n name = \"cycle\"..cycle,\n cards = copiedList,\n globalPos = self.positionToWorld(startPositions.cycle),\n rotation = FACE_UP_ROTATION,\n spread = true,\n spreadCols = 20\n })\nend\n\nfunction spawnBonded()\n prepareToPlaceCards()\n spawnBag.spawn({\n name = \"bonded\",\n cards = BONDED_CARD_LIST,\n globalPos = self.positionToWorld(startPositions.classCards),\n rotation = FACE_UP_ROTATION,\n spread = true,\n spreadCols = 20\n })\nend\n\nfunction spawnUpgradeSheets()\n prepareToPlaceCards()\n spawnBag.spawn({\n name = \"upgradeSheets\",\n cards = UPGRADE_SHEET_LIST,\n globalPos = self.positionToWorld(startPositions.classCards),\n rotation = FACE_UP_ROTATION,\n spread = true,\n spreadCols = 20\n })\n spawnBag.spawn({\n name = \"servitor\",\n cards = { \"09080-m\" },\n globalPos = self.positionToWorld(startPositions.summonedServitor),\n rotation = FACE_UP_ROTATION,\n })\nend\n\n-- Clears the current cards, and places all basic weaknesses on the table.\nfunction spawnWeaknesses()\n prepareToPlaceCards()\n local indexReady = allCardsBagApi.isIndexReady()\n if (not indexReady) then\n broadcastToAll(\"Still loading player cards, please try again in a few seconds\", {0.9, 0.2, 0.2})\n return\n end\n local weaknessIdList = allCardsBagApi.getUniqueWeaknesses()\n local basicWeaknessList = { }\n local otherWeaknessList = { }\n for i, id in ipairs(weaknessIdList) do\n local cardMetadata = allCardsBagApi.getCardById(id).metadata\n if cardMetadata.basicWeaknessCount ~= nil and cardMetadata.basicWeaknessCount \u003e 0 then\n table.insert(basicWeaknessList, id)\n elseif excludedNonBasicWeaknesses[id] == nil then\n table.insert(otherWeaknessList, id)\n end\n end\n local groupPos = Vector(startPositions.classCards)\n spawnBag.spawn({\n name = \"basicWeaknesses\",\n cards = basicWeaknessList,\n globalPos = self.positionToWorld(groupPos),\n rotation = FACE_UP_ROTATION,\n spread = true,\n spreadCols = 20\n })\n groupPos.z = groupPos.z + math.ceil(#basicWeaknessList / 20) * cardRowOffset + cardGroupOffset\n spawnBag.spawn({\n name = \"evolvedWeaknesses\",\n cards = EVOLVED_WEAKNESSES,\n globalPos = self.positionToWorld(groupPos),\n rotation = FACE_UP_ROTATION,\n spread = true,\n spreadCols = 20\n })\n groupPos.z = groupPos.z + math.ceil(#EVOLVED_WEAKNESSES / 20) * cardRowOffset + cardGroupOffset\n spawnBag.spawn({\n name = \"otherWeaknesses\",\n cards = otherWeaknessList,\n globalPos = self.positionToWorld(groupPos),\n rotation = FACE_UP_ROTATION,\n spread = true,\n spreadCols = 20\n })\nend\n\nfunction spawnRandomWeakness()\n prepareToPlaceCards()\n local weaknessId = allCardsBagApi.getRandomWeaknessId()\n if (weaknessId == nil) then\n broadcastToAll(\"All basic weaknesses are in play!\", {0.9, 0.2, 0.2})\n return\n end\n spawnBag.spawn({\n name = \"randomWeakness\",\n cards = { weaknessId },\n globalPos = self.positionToWorld(startPositions.randomWeakness),\n rotation = FACE_UP_ROTATION,\n })\nend\nend)\n__bundle_register(\"arkhamdb/ArkhamDb\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local allCardsBagApi = require(\"playercards/AllCardsBagApi\")\n local playAreaApi = require(\"core/PlayAreaApi\")\n \n local ArkhamDb = { }\n local internal = { }\n\n local RANDOM_WEAKNESS_ID = \"01000\"\n\n local tabooList = { }\n --Forward declaration\n ---@type Request\n local Request = {}\n local configuration\n\n -- Sets up the ArkhamDb interface. Should be called from the parent object on load.\n ArkhamDb.initialize = function()\n configuration = internal.getConfiguration()\n Request.start({ configuration.api_uri, configuration.taboo }, function(status)\n local json = JSON.decode(internal.fixUtf16String(status.text))\n for _, taboo in pairs(json) do\n ---@type \u003cstring, boolean\u003e\n local cards = {}\n\n for _, card in pairs(JSON.decode(taboo.cards)) do\n cards[card.code] = true\n end\n\n tabooList[taboo.id] = {\n date = taboo.date_start,\n cards = cards\n }\n end\n return true, nil\n end)\n end\n\n -- Start the deck build process for the given player color and deck ID. This\n -- will retrieve the deck from ArkhamDB, and pass to a callback for processing.\n ---@param playerColor String. Color name of the player mat to place this deck on (e.g. \"Red\").\n ---@param deckId String. ArkhamDB deck id to be loaded\n ---@param isPrivate Boolean. Whether this deck is published or private on ArkhamDB\n ---@param loadNewest Boolean. Whether the newest version of this deck should be loaded\n ---@param loadInvestigators Boolean. Whether investigator cards should be loaded as part of this\n --- deck\n ---@param callback Function. Callback which will be sent the results of this load. Parameters\n --- to the callback will be:\n --- slots Table. A map of card ID to count in the deck\n --- investigatorCode String. ID of the investigator in this deck\n --- customizations Table. The decoded table of customization upgrades in this deck\n --- playerColor String. Color this deck is being loaded for\n ArkhamDb.getDecklist = function(\n playerColor,\n deckId,\n isPrivate,\n loadNewest,\n loadInvestigators,\n callback)\n -- Get a simple card to see if the bag indexes are complete. If not, abort\n -- the deck load. The called method will handle player notification.\n local checkCard = allCardsBagApi.getCardById(\"01001\")\n if (checkCard ~= nil and checkCard.data == nil) then\n return\n end\n\n local deckUri = { configuration.api_uri,\n isPrivate and configuration.private_deck or configuration.public_deck, deckId }\n\n local deck = Request.start(deckUri, function(status)\n if string.find(status.text, \"\u003c!DOCTYPE html\u003e\") then\n internal.maybePrint(\"Private deck ID \" .. deckId .. \" is not shared\", playerColor)\n return false, table.concat({ \"Private deck \", deckId, \" is not shared\" })\n end\n local json = JSON.decode(status.text)\n\n if not json then\n internal.maybePrint(\"Deck ID \" .. deckId .. \" not found\", playerColor)\n return false, \"Deck not found!\"\n end\n\n return true, json\n end)\n\n deck:with(internal.onDeckResult, playerColor, loadNewest, loadInvestigators, callback)\n end\n\n -- Logs that a card could not be loaded in the mod by printing it to the console in the given\n -- color of the player owning the deck. Attempts to look up the name on ArkhamDB for clarity,\n -- but prints the card ID if the name cannot be retrieved.\n ---@param cardId String. ArkhamDB ID of the card that could not be found\n ---@param playerColor String. Color of the player's deck that had the problem\n ArkhamDb.logCardNotFound = function(cardId, playerColor)\n local request = Request.start({\n configuration.api_uri,\n configuration.cards,\n cardId\n },\n function(result)\n local adbCardInfo = JSON.decode(internal.fixUtf16String(result.text))\n local cardName = adbCardInfo.real_name\n if (cardName ~= nil) then\n if (adbCardInfo.xp ~= nil and adbCardInfo.xp \u003e 0) then\n cardName = cardName .. \" (\" .. adbCardInfo.xp .. \")\"\n end\n internal.maybePrint(\"Card not found: \" .. cardName .. \", ArkhamDB ID \" .. cardId, playerColor)\n else\n internal.maybePrint(\"Card not found in ArkhamDB, ID \" .. cardId, playerColor)\n end\n end)\n end\n\n -- Callback when the deck information is received from ArkhamDB. Parses the\n -- response then applies standard transformations to the deck such as adding\n -- random weaknesses and checking for taboos. Once the deck is processed,\n -- passes to loadCards to actually spawn the defined deck.\n ---@param deck ArkhamImportDeck\n ---@param playerColor String Color name of the player mat to place this deck on (e.g. \"Red\")\n ---@param loadNewest Boolean Whether the newest version of this deck should be loaded\n ---@param loadInvestigators Boolean Whether investigator cards should be loaded as part of this\n --- deck\n ---@param callback Function Callback which will be sent the results of this load. Parameters\n --- to the callback will be:\n --- slots Table. A map of card ID to count in the deck\n --- investigatorCode String. ID of the investigator in this deck\n --- bondedList A table of cardID keys to meaningless values. Card IDs in this list were\n --- added from a parent bonded card.\n --- customizations Table. The decoded table of customization upgrades in this deck\n --- playerColor String. Color this deck is being loaded for\n internal.onDeckResult = function(deck, playerColor, loadNewest, loadInvestigators, callback)\n -- Load the next deck in the upgrade path if the option is enabled\n if (loadNewest and deck.next_deck ~= nil and deck.next_deck ~= \"\") then\n buildDeck(playerColor, deck.next_deck)\n return\n end\n\n internal.maybePrint(table.concat({ \"Found decklist: \", deck.name }), playerColor)\n\n -- Initialize deck slot table and perform common transformations. The order of these should not\n -- be changed, as later steps may act on cards added in each. For example, a random weakness or\n -- investigator may have bonded cards or taboo entries, and should be present\n local slots = deck.slots\n internal.maybeDrawRandomWeakness(slots, playerColor)\n local loadAltInvestigator = \"normal\"\n if loadInvestigators then\n loadAltInvestigator = internal.addInvestigatorCards(deck, slots)\n end\n \n internal.maybeAddSummonedServitor(slots)\n internal.maybeAddOnTheMend(slots, playerColor)\n internal.maybeAddRealityAcidReference(slots)\n local bondList = internal.extractBondedCards(slots)\n internal.checkTaboos(deck.taboo_id, slots, playerColor)\n internal.maybeAddUpgradeSheets(slots)\n\n -- get upgrades for customizable cards\n local customizations = {}\n if deck.meta then\n customizations = JSON.decode(deck.meta)\n end\n\n callback(slots, deck.investigator_code, bondList, customizations, playerColor, loadAltInvestigator)\n end\n\n -- Checks to see if the slot list includes the random weakness ID. If it does,\n -- removes it from the deck and replaces it with the ID of a random basic weakness provided by the\n -- all cards bag\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number\n --- of those cards which will be spawned\n ---@param playerColor String Color of the player this deck is being loaded for. Used for broadcast\n --- if a weakness is added.\n internal.maybeDrawRandomWeakness = function(slots, playerColor)\n local randomWeaknessAmount = slots[RANDOM_WEAKNESS_ID] or 0\n slots[RANDOM_WEAKNESS_ID] = nil\n\n if randomWeaknessAmount ~= 0 then\n for i=1, randomWeaknessAmount do\n local weaknessId = allCardsBagApi.getRandomWeaknessId()\n slots[weaknessId] = (slots[weaknessId] or 0) + 1\n end\n internal.maybePrint(\"Added \" .. randomWeaknessAmount .. \" random basic weakness(es) to deck\", playerColor)\n end\n end\n\n -- Adds both the investigator (XXXXX) and minicard (XXXXX-m) slots with one copy each\n ---@param deck Table The processed ArkhamDB deck response\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the\n --- number of those cards which will be spawned\n ---@return string: Contains the name of the art that should be loaded (\"normal\", \"promo\" or \"revised\")\n internal.addInvestigatorCards = function(deck, slots)\n local investigatorId = deck.investigator_code\n slots[investigatorId .. \"-m\"] = 1\n local deckMeta = JSON.decode(deck.meta)\n -- handling alternative investigator art and parallel investigators\n local loadAltInvestigator = \"normal\"\n if deckMeta ~= nil then\n local altFrontId = tonumber(deckMeta.alternate_front) or 0\n local altBackId = tonumber(deckMeta.alternate_back) or 0\n local altArt = { front = \"normal\", back = \"normal\" }\n\n -- translating front ID\n if altFrontId \u003e 90000 and altFrontId \u003c 90047 then\n altArt.front = \"parallel\"\n elseif altFrontId \u003e 01500 and altFrontId \u003c 01506 then\n altArt.front = \"revised\"\n elseif altFrontId \u003e 98000 then\n altArt.front = \"promo\"\n end\n\n -- translating back ID\n if altBackId \u003e 90000 and altBackId \u003c 90047 then\n altArt.back = \"parallel\"\n elseif altBackId \u003e 01500 and altBackId \u003c 01506 then\n altArt.back = \"revised\"\n elseif altBackId \u003e 98000 then\n altArt.back = \"promo\"\n end\n\n -- updating investigatorID based on alt investigator selection\n -- precedence: parallel \u003e promo \u003e revised\n if altArt.front == \"parallel\" then\n if altArt.back == \"parallel\" then\n investigatorId = investigatorId .. \"-p\"\n else\n investigatorId = investigatorId .. \"-pf\"\n end\n elseif altArt.back == \"parallel\" then\n investigatorId = investigatorId .. \"-pb\"\n elseif altArt.front == \"promo\" or altArt.back == \"promo\" then\n loadAltInvestigator = \"promo\"\n elseif altArt.front == \"revised\" or altArt.back == \"revised\" then\n loadAltInvestigator = \"revised\"\n end\n end\n slots[investigatorId] = 1\n deck.investigator_code = investigatorId\n return loadAltInvestigator\n end\n\n -- Process the card list looking for the customizable cards, and add their upgrade sheets if needed\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number\n -- of those cards which will be spawned\n internal.maybeAddUpgradeSheets = function(slots)\n for cardId, _ in pairs(slots) do\n -- upgrade sheets for customizable cards\n local upgradesheet = allCardsBagApi.getCardById(cardId .. \"-c\")\n if upgradesheet ~= nil then\n slots[cardId .. \"-c\"] = 1\n end\n end\n end\n\n -- Process the card list looking for the Summoned Servitor, and add its minicard to the list if\n -- needed\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number\n -- of those cards which will be spawned\n internal.maybeAddSummonedServitor = function(slots)\n if slots[\"09080\"] ~= nil then\n slots[\"09080-m\"] = 1\n end\n end\n\n -- On the Mend should have 1-per-investigator copies set aside, but ArkhamDB always sends 1. Update\n -- the count based on the investigator count\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number\n -- of those cards which will be spawned\n ---@param playerColor String Color of the player this deck is being loaded for. Used for broadcast if an error occurs\n internal.maybeAddOnTheMend = function(slots, playerColor)\n if slots[\"09006\"] ~= nil then\n local investigatorCount = playAreaApi.getInvestigatorCount()\n if investigatorCount ~= nil then\n slots[\"09006\"] = investigatorCount\n else\n internal.maybePrint(\"Something went wrong with the load, adding 4 copies of On the Mend\", playerColor)\n slots[\"09006\"] = 4\n end\n end\n end\n\n -- Process the card list looking for Reality Acid and adds the reference sheet when needed\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number\n -- of those cards which will be spawned\n internal.maybeAddRealityAcidReference = function(slots)\n if slots[\"89004\"] ~= nil then\n slots[\"89005\"] = 1\n end\n end\n\n -- Process the slot list and looks for any cards which are bonded to those in the deck. Adds those cards to the slot list.\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number of those cards which will be spawned\n internal.extractBondedCards = function(slots)\n -- Create a list of bonded cards first so we don't modify slots while iterating\n local bondedCards = { }\n local bondedList = { }\n for cardId, cardCount in pairs(slots) do\n local card = allCardsBagApi.getCardById(cardId)\n if (card ~= nil and card.metadata.bonded ~= nil) then\n for _, bond in ipairs(card.metadata.bonded) do\n bondedCards[bond.id] = bond.count\n -- We need to know which cards are bonded to determine their position, remember them\n bondedList[bond.id] = true\n -- Also adding taboo versions of bonded cards to the list\n bondedList[bond.id .. \"-t\"] = true\n end\n end\n end\n -- Add any bonded cards to the main slots list\n for bondedId, bondedCount in pairs(bondedCards) do\n slots[bondedId] = bondedCount\n end\n\n return bondedList\n end\n\n -- Check the deck for cards on its taboo list. If they're found, replace the entry in the slot with the Taboo id (i.e. \"XXXX\" becomes \"XXXX-t\")\n ---@param tabooId String The deck's taboo ID, taken from the deck response taboo_id field. May be nil, indicating that no taboo list should be used\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number of those cards which will be spawned\n internal.checkTaboos = function(tabooId, slots, playerColor)\n if tabooId then\n for cardId, _ in pairs(tabooList[tabooId].cards) do\n if slots[cardId] ~= nil then\n -- Make sure there's a taboo version of the card before we replace it\n -- SCED only maintains the most recent taboo cards. If a deck is using\n -- an older taboo list it's possible the card isn't a taboo any more\n local tabooCard = allCardsBagApi.getCardById(cardId .. \"-t\")\n if tabooCard == nil then\n local basicCard = allCardsBagApi.getCardById(cardId)\n internal.maybePrint(\"Taboo version for \" .. basicCard.data.Nickname .. \" is not available. Using standard version\", playerColor)\n else\n slots[cardId .. \"-t\"] = slots[cardId]\n slots[cardId] = nil\n end\n end\n end\n end\n end\n\n internal.maybePrint = function(message, playerColor)\n if playerColor ~= \"None\" then\n printToAll(message, playerColor)\n end\n end\n\n -- Gets the ArkhamDB config info from the configuration object.\n ---@return Table. Configuration data\n internal.getConfiguration = function()\n local configuration = getObjectsWithTag(\"import_configuration_provider\")[1]:getTable(\"configuration\")\n printPriority = configuration.priority\n return configuration\n end\n\n internal.fixUtf16String = function(str)\n return str:gsub(\"\\\\u(%w%w%w%w)\", function(match)\n return string.char(tonumber(match, 16))\n end)\n end\n\n ---@type Request\n Request = {\n is_done = false,\n is_successful = false\n }\n\n -- Creates a new instance of a Request. Should not be directly called. Instead use Request.start and Request.deferred.\n ---@param uri string\n ---@param configure fun(request: Request, status: WebRequestStatus)\n ---@return Request\n function Request:new(uri, configure)\n local this = {}\n\n setmetatable(this, self)\n self.__index = self\n\n if type(uri) == \"table\" then\n uri = table.concat(uri, \"/\")\n end\n\n this.uri = uri\n\n WebRequest.get(uri, function(status)\n configure(this, status)\n end)\n\n return this\n end\n\n -- Creates a new request. on_success should set the request's is_done, is_successful, and content variables.\n -- Deferred should be used when you don't want to set is_done immediately (such as if you want to wait for another request to finish)\n ---@param uri string\n ---@param on_success fun(request: Request, status: WebRequestStatus, vararg any)\n ---@param on_error fun(status: WebRequestStatus)|nil\n ---@vararg any[]\n ---@return Request\n function Request.deferred(uri, on_success, on_error, ...)\n local parameters = table.pack(...)\n return Request:new(uri, function(request, status)\n if (status.is_done) then\n if (status.is_error) then\n request.error_message = on_error and on_error(status, table.unpack(parameters)) or status.error\n request.is_successful = false\n request.is_done = true\n else\n on_success(request, status)\n end\n end\n end)\n end\n\n -- Creates a new request. on_success should return weather the resultant data is as expected, and the processed content of the request.\n ---@param uri string\n ---@param on_success fun(status: WebRequestStatus, vararg any): boolean, any\n ---@param on_error nil|fun(status: WebRequestStatus, vararg any): string\n ---@vararg any[]\n ---@return Request\n function Request.start(uri, on_success, on_error, ...)\n local parameters = table.pack(...)\n return Request.deferred(uri, function(request, status)\n local result, message = on_success(status, table.unpack(parameters))\n if not result then request.error_message = message else request.content = message end\n request.is_successful = result\n request.is_done = true\n end, on_error, table.unpack(parameters))\n end\n\n ---@param requests Request[]\n ---@param on_success fun(content: any[], vararg any[])\n ---@param on_error fun(requests: Request[], vararg any[])|nil\n ---@vararg any\n function Request.with_all(requests, on_success, on_error, ...)\n local parameters = table.pack(...)\n\n Wait.condition(function()\n ---@type any[]\n local results = {}\n\n ---@type Request[]\n local errors = {}\n\n for _, request in ipairs(requests) do\n if request.is_successful then\n table.insert(results, request.content)\n else\n table.insert(errors, request)\n end\n end\n\n if (#errors \u003c= 0) then\n on_success(results, table.unpack(parameters))\n elseif on_error == nil then\n for _, request in ipairs(errors) do\n internal.maybePrint(table.concat({ \"[ERROR]\", request.uri, \":\", request.error_message }))\n end\n else\n on_error(requests, table.unpack(parameters))\n end\n end, function()\n for _, request in ipairs(requests) do\n if not request.is_done then return false end\n end\n return true\n end)\n end\n\n ---@param callback fun(content: any, vararg any)\n function Request:with(callback, ...)\n local arguments = table.pack(...)\n Wait.condition(function()\n if self.is_successful then\n callback(self.content, table.unpack(arguments))\n end\n end, function() return self.is_done\n end)\n end\n\n return ArkhamDb\nend\nend)\n__bundle_register(\"playercards/AllCardsBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local AllCardsBagApi = {}\n local ALL_CARDS_BAG_GUID = \"15bb07\"\n\n -- Returns a specific card from the bag, based on ArkhamDB ID\n -- @param table:\n -- id: String ID of the card to retrieve\n -- @return: If the indexes are still being constructed, an empty table is\n -- returned. Otherwise, a single table with the following fields\n -- cardData: TTS object data, suitable for spawning the card\n -- cardMetadata: Table of parsed metadata\n AllCardsBagApi.getCardById = function(id)\n return getObjectFromGUID(ALL_CARDS_BAG_GUID).call(\"getCardById\", {id = id})\n end\n\n -- Gets a random basic weakness from the bag. Once a given ID has been returned\n -- it will be removed from the list and cannot be selected again until a reload\n -- occurs or the indexes are rebuilt, which will refresh the list to include all\n -- weaknesses.\n -- @return: String ID of the selected weakness.\n AllCardsBagApi.getRandomWeaknessId = function()\n return getObjectFromGUID(ALL_CARDS_BAG_GUID).call(\"getRandomWeaknessId\")\n end\n\n AllCardsBagApi.isIndexReady = function()\n return getObjectFromGUID(ALL_CARDS_BAG_GUID).call(\"isIndexReady\")\n end\n\n -- Called by Hotfix bags when they load. If we are still loading indexes, then\n -- the all cards and hotfix bags are being loaded together, and we can ignore\n -- this call as the hotfix will be included in the initial indexing. If it is\n -- called once indexing is complete it means the hotfix bag has been added\n -- later, and we should rebuild the index to integrate the hotfix bag.\n AllCardsBagApi.rebuildIndexForHotfix = function()\n return getObjectFromGUID(ALL_CARDS_BAG_GUID).call(\"rebuildIndexForHotfix\")\n end\n\n -- Searches the bag for cards which match the given name and returns a list. Note that this is\n -- an O(n) search without index support. It may be slow.\n -- @param\n -- name String or string fragment to search for names\n -- exact Whether the name match should be exact\n AllCardsBagApi.getCardsByName = function(name, exact)\n return getObjectFromGUID(ALL_CARDS_BAG_GUID).call(\"getCardsByName\", {name = name, exact = exact})\n end\n\n AllCardsBagApi.isBagPresent = function()\n return getObjectFromGUID(ALL_CARDS_BAG_GUID) and true\n end\n\n -- Returns a list of cards from the bag matching a class and level (0 or upgraded)\n -- @param \n -- class: String class to retrieve (\"Guardian\", \"Seeker\", etc)\n -- upgraded: true for upgraded cards (Level 1-5), false for Level 0\n -- @return: If the indexes are still being constructed, returns an empty table.\n -- Otherwise, a list of tables, each with the following fields\n -- cardData: TTS object data, suitable for spawning the card\n -- cardMetadata: Table of parsed metadata\n AllCardsBagApi.getCardsByClassAndLevel = function(class, upgraded)\n return getObjectFromGUID(ALL_CARDS_BAG_GUID).call(\"getCardsByClassAndLevel\", {class = class, upgraded = upgraded})\n end\n\n AllCardsBagApi.getCardsByCycle = function(cycle)\n return getObjectFromGUID(ALL_CARDS_BAG_GUID).call(\"getCardsByCycle\", cycle)\n end\n\n AllCardsBagApi.getUniqueWeaknesses = function()\n return getObjectFromGUID(ALL_CARDS_BAG_GUID).call(\"getUniqueWeaknesses\")\n end\n\n return AllCardsBagApi\nend\nend)\n__bundle_register(\"playercards/PlayerCardPanelData\", function(require, _LOADED, __bundle_register, __bundle_modules)\nBONDED_CARD_LIST = {\n \"05314\", -- Soothing Melody\n \"06277\", -- Wish Eater\n \"06019\", -- Bloodlust\n \"06022\", -- Pendant of the Queen\n \"05317\", -- Blood-rite\n \"06113\", -- Essence of the Dream\n \"06028\", -- Stars Are Right\n \"06025\", -- Guardian of the Crystallizer\n \"06283\", -- Unbound Beast\n \"06032\", -- Zeal\n \"06031\", -- Hope\n \"06033\", -- Augur\n \"06331\", -- Dream Parasite\n \"06015a\", -- Dream-Gate\n\t\t\"10045\" -- Uncanny Growth\n}\n\nUPGRADE_SHEET_LIST = {\n \"09040-c\", -- Alchemical Distillation\n \"09023-c\", -- Custom Modifications\n \"09059-c\", -- Damning Testimony\n \"09041-c\", -- Emperical Hypothesis\n \"09060-c\", -- Friends in Low Places\n \"09101-c\", -- Grizzled\n \"09061-c\", -- Honed Instinct\n \"09021-c\", -- Hunter's Armor\n \"09119-c\", -- Hyperphysical Shotcaster\n \"09079-c\", -- Living Ink\n \"09100-c\", -- Makeshift Trap\n \"09099-c\", -- Pocket Multi Tool\n \"09081-c\", -- Power Word\n\t\"09081-t-c\", -- Power Word (Taboo)\n \"09022-c\", -- Runic Axe\n\t\"09022-t-c\", -- Runic Axe (Taboo)\n \"09080-c\", -- Summoned Servitor\n \"09042-c\", -- Raven's Quill\n}\n\nEVOLVED_WEAKNESSES = {\n \"04039\",\n \"04041\",\n \"04042\",\n \"53014\",\n \"53015\",\n}\n\n------------------ START INVESTIGATOR DATA DEFINITION ------------------\nINVESTIGATOR_GROUPS = {\n [\"Guardian\"] = {\n \"Roland Banks\",\n \t\"Zoey Samaras\",\n \t\"Mark Harrigan\",\n \t\"Leo Anderson\",\n \t\"Carolyn Fern\",\n \t\"Tommy Muldoon\",\n \t\"Nathaniel Cho\",\n \t\"Sister Mary\",\n \t\"Daniela Reyes\",\n \t\"Carson Sinclair\"\n },\n [\"Seeker\"] = {\n \"Daisy Walker\",\n \t\"Rex Murphy\",\n \t\"Minh Thi Phan\",\n \t\"Ursula Downs\",\n \t\"Joe Diamond\",\n \t\"Mandy Thompson\",\n \t\"Harvey Walters\",\n \t\"Amanda Sharpe\",\n \t\"Norman Withers\",\n \t\"Vincent Lee\"\n },\n [\"Rogue\"] = {\n \t\"\\\"Skids\\\" O'Toole\",\n \t\"Jenny Barnes\",\n \t\"Sefina Rousseau\",\n \t\"Finn Edwards\",\n \t\"Preston Fairmont\",\n \t\"Tony Morgan\",\n \t\"Winifred Habbamock\",\n \t\"Trish Scarborough\",\n \t\"Monterey Jack\",\n \t\"Kymani Jones\"\n },\n [\"Mystic\"] = {\n \t\"Agnes Baker\",\n \t\"Jim Culver\",\n \t\"Akachi Onyele\",\n \t\"Father Mateo\",\n \t\"Diana Stanley\",\n \t\"Marie Lambeau\",\n \t\"Luke Robinson\",\n \t\"Jacqueline Fine\",\n \t\"Dexter Drake\",\n \t\"Lily Chen\",\n \t\"Amina Zidane\",\n \t\"Gloria Goldberg\"\n },\n [\"Survivor\"] = {\n \t\"Wendy Adams\",\n \t\"\\\"Ashcan\\\" Pete\",\n \t\"William Yorick\",\n \t\"Calvin Wright\",\n \t\"Rita Young\",\n \t\"Patrice Hathaway\",\n \t\"Stella Clark\",\n \t\"Silas Marsh\",\n \t\"Bob Jenkins\",\n \t\"Darrell Simmons\"\n },\n [\"Neutral\"] = {\n \t\"Lola Hayes\",\n \t\"Charlie Kane\",\n \t\"Subject 5U-21\"\n },\n [\"Core\"] = {\n \"Roland Banks\",\n \"Daisy Walker\",\n \"\\\"Skids\\\" O'Toole\",\n \"Agnes Baker\",\n \"Wendy Adams\"\n },\n [\"The Dunwich Legacy\"] = {\n \t\"Zoey Samaras\",\n \t\"Rex Murphy\",\n \t\"Jenny Barnes\",\n \t\"Jim Culver\",\n \t\"\\\"Ashcan\\\" Pete\"\n },\n [\"The Path to Carcosa\"] = {\n \t\"Mark Harrigan\",\n \t\"Minh Thi Phan\",\n \t\"Sefina Rousseau\",\n \t\"Akachi Onyele\",\n \t\"William Yorick\",\n \t\"Lola Hayes\"\n },\n [\"The Forgotten Age\"] = {\n \t\"Leo Anderson\",\n \t\"Ursula Downs\",\n \t\"Finn Edwards\",\n \t\"Father Mateo\",\n \t\"Calvin Wright\"\n },\n [\"The Circle Undone\"] = {\n \t\"Carolyn Fern\",\n \t\"Joe Diamond\",\n \t\"Preston Fairmont\",\n \t\"Diana Stanley\",\n \t\"Rita Young\",\n \t\"Marie Lambeau\"\n },\n [\"The Dream-Eaters\"] = {\n \t\"Tommy Muldoon\",\n \t\"Mandy Thompson\",\n \t\"Tony Morgan\",\n \t\"Luke Robinson\",\n \t\"Patrice Hathaway\"\n },\n [\"Investigator Packs\"] = {\n \t\"Nathaniel Cho\",\n \t\"Harvey Walters\",\n \t\"Winifred Habbamock\",\n \t\"Jacqueline Fine\",\n \t\"Stella Clark\",\n \t\"Gloria Goldberg\"\n },\n [\"The Innsmouth Conspiracy\"] = {\n \t\"Sister Mary\",\n \t\"Amanda Sharpe\",\n \t\"Trish Scarborough\",\n \t\"Dexter Drake\",\n \t\"Silas Marsh\"\n },\n [\"Edge of the Earth\"] = {\n \t\"Daniela Reyes\",\n \t\"Norman Withers\",\n \t\"Monterey Jack\",\n \t\"Lily Chen\",\n \t\"Bob Jenkins\"\n },\n [\"The Scarlet Keys\"] = {\n \t\"Carson Sinclair\",\n \t\"Vincent Lee\",\n \t\"Kymani Jones\",\n \t\"Amina Zidane\",\n \t\"Darrell Simmons\",\n \t\"Charlie Kane\"\n },\n\t[\"The Feast of Hemlock Vale\"] = {\n\t\t-- placeholder for future addition of investigators once we have their backs\n }\n}\n\nINVESTIGATORS = { }\n--Core--\nINVESTIGATORS[\"Roland Banks\"] = {\n cards = { \"01001\", \"01001-p\", \"01001-pf\", \"01001-pb\" },\n minicards = { \"01001-m\" },\n signatures = { \"01006\", \"01007\", \"90030\", \"90031\", \"90025\", \"90026\", \"90027\", \"90028\", \"90029\", \"98005\", \"98006\" },\n starterDeck = \"2624931\"\n}\nINVESTIGATORS[\"Daisy Walker\"] = {\n cards = { \"01002\", \"01002-p\", \"01002-pf\", \"01002-pb\" },\n minicards = { \"01002-m\" },\n signatures = { \"01008\", \"01009\", \"90002\", \"90003\" },\n starterDeck = \"2624938\"\n}\nINVESTIGATORS[\"\\\"Skids\\\" O'Toole\"] = {\n\tcards = { \"01003\", \"01003-p\", \"01003-pf\", \"01003-pb\" },\n\tminicards = { \"01003-m\" },\n\tsignatures = { \"01010\", \"01011\", \"90009\", \"90010\" },\n\tstarterDeck = \"2624940\"\n}\nINVESTIGATORS[\"Agnes Baker\"] = {\n\tcards = { \"01004\", \"01004-p\", \"01004-pf\", \"01004-pb\" },\n\tminicards = { \"01004-m\" },\n\tsignatures = { \"01012\", \"01013\", \"90018\", \"90019\" },\n\tstarterDeck = \"2624944\"\n}\nINVESTIGATORS[\"Wendy Adams\"] = {\n\tcards = { \"01005\", \"01005-p\", \"01005-pf\", \"01005-pb\"},\n\tminicards = { \"01005-m\" },\n\tsignatures = { \"01014\", \"01015\", \"01515\", \"90039\", \"90040\", \"90038\" },\n\tstarterDeck = \"2624949\"\n}\n--Dunwich--\nINVESTIGATORS[\"Zoey Samaras\"] = {\n\tcards = { \"02001\" },\n\tminicards = { \"02001-m\" },\n\tsignatures = { \"02006\", \"02007\" },\n\tstarterDeck = \"2624950\"\n}\nINVESTIGATORS[\"Rex Murphy\"] = {\n\tcards = { \"02002\", \"02002-t\" },\n\tminicards = { \"02002-m\" },\n\tsignatures = { \"02008\", \"02009\" },\n\tstarterDeck = \"2624958\"\n}\nINVESTIGATORS[\"Jenny Barnes\"] = {\n\tcards = { \"02003\" },\n\tminicards = { \"02003-m\" },\n\tsignatures = { \"02010\", \"02011\", \"98002\", \"98003\" },\n\tstarterDeck = \"2624961\"\n}\nINVESTIGATORS[\"Jim Culver\"] = {\n\tcards = { \"02004\" },\n\tminicards = { \"02004-m\" },\n\tsignatures = { \"02012\", \"02013\" },\n\tstarterDeck = \"2624965\"\n}\nINVESTIGATORS[\"\\\"Ashcan\\\" Pete\"] = {\n\tcards = { \"02005\", \"02005-p\", \"02005-pf\", \"02005-pb\" },\n\tminicards = { \"02005-m\" },\n\tsignatures = { \"02014\", \"02015\", \"90047\", \"90048\" },\n\tstarterDeck = \"2624969\"\n}\n--Carcosa--\nINVESTIGATORS[\"Mark Harrigan\"] = {\n\tcards = { \"03001\" },\n\tminicards = { \"03001-m\" },\n\tsignatures = { \"03007\", \"03008\", \"03009\" },\n\tstarterDeck = \"2624975\"\n}\nINVESTIGATORS[\"Minh Thi Phan\"] = {\n\tcards = { \"03002\" },\n\tminicards = { \"03002-m\" },\n\tsignatures = { \"03010\", \"03011\" },\n\tstarterDeck = \"2624979\"\n}\nINVESTIGATORS[\"Sefina Rousseau\"] = {\n\tcards = { \"03003\" },\n\tminicards = { \"03003-m\" },\n\tsignatures = { \"03012\", \"03012\", \"03012\", \"03013\" },\n\tstarterDeck = \"2624981\"\n}\nINVESTIGATORS[\"Akachi Onyele\"] = {\n\tcards = { \"03004\" },\n\tminicards = { \"03004-m\" },\n\tsignatures = { \"03014\", \"03015\" },\n\tstarterDeck = \"2624984\"\n}\nINVESTIGATORS[\"William Yorick\"] = {\n\tcards = { \"03005\" },\n\tminicards = { \"03005-m\" },\n\tsignatures = { \"03016\", \"03017\" },\n\tstarterDeck = \"2624988\"\n}\nINVESTIGATORS[\"Lola Hayes\"] = {\n\tcards = { \"03006\", \"03006-t\" },\n\tminicards = { \"03006-m\" },\n\tsignatures = { \"03018\", \"03018\", \"03019\", \"03019\", \"03019-t\", \"03019-t\" },\n\tstarterDeck = \"2624990\"\n}\n--Forgotten--\nINVESTIGATORS[\"Leo Anderson\"] = {\n\tcards = { \"04001\" },\n\tminicards = { \"04001-m\" },\n\tsignatures = { \"04006\", \"04007\" },\n\tstarterDeck = \"2624994\"\n}\nINVESTIGATORS[\"Ursula Downs\"] = {\n\tcards = { \"04002\" },\n\tminicards = { \"04002-m\" },\n\tsignatures = { \"04008\", \"04009\" },\n\tstarterDeck = \"2625000\"\n}\nINVESTIGATORS[\"Finn Edwards\"] = {\n\tcards = { \"04003\" },\n\tminicards = { \"04003-m\" },\n\tsignatures = { \"04010\", \"04011\", \"04012\" },\n\tstarterDeck = \"2625003\"\n}\nINVESTIGATORS[\"Father Mateo\"] = {\n\tcards = { \"04004\" },\n\tminicards = { \"04004-m\" },\n\tsignatures = { \"04013\", \"04014\" },\n\tstarterDeck = \"2625005\"\n}\nINVESTIGATORS[\"Calvin Wright\"] = {\n\tcards = { \"04005\" },\n\tminicards = { \"04005-m\" },\n\tsignatures = { \"04015\", \"04016\" },\n\tstarterDeck = \"2625007\"\n}\n--Circle--\nINVESTIGATORS[\"Carolyn Fern\"] = {\n\tcards = { \"05001\" },\n\tminicards = { \"05001-m\" },\n\tsignatures = { \"05007\", \"05008\", \"98011\", \"98012\" },\n\tstarterDeck = \"2626342\"\n}\nINVESTIGATORS[\"Joe Diamond\"] = {\n\tcards = { \"05002\" },\n\tminicards = { \"05002-m\" },\n\tsignatures = { \"05009\", \"05010\" },\n\tstarterDeck = \"2626347\"\n}\nINVESTIGATORS[\"Preston Fairmont\"] = {\n\tcards = { \"05003\" },\n\tminicards = { \"05003-m\" },\n\tsignatures = { \"05011\", \"05012\" },\n\tstarterDeck = \"2626365\"\n}\nINVESTIGATORS[\"Diana Stanley\"] = {\n\tcards = { \"05004\" },\n\tminicards = { \"05004-m\" },\n\tsignatures = { \"05013\", \"05014\", \"05015\" },\n\tstarterDeck = \"2626385\"\n}\nINVESTIGATORS[\"Rita Young\"] = {\n\tcards = { \"05005\" },\n\tminicards = { \"05005-m\" },\n\tsignatures = { \"05016\", \"05017\" },\n\tstarterDeck = \"2626387\"\n}\nINVESTIGATORS[\"Marie Lambeau\"] = {\n\tcards = { \"05006\" },\n\tminicards = { \"05006-m\" },\n\tsignatures = { \"05018\", \"05019\" },\n\tstarterDeck = \"2626395\"\n}\n--Dream--\nINVESTIGATORS[\"Tommy Muldoon\"] = {\n\tcards = { \"06001\" },\n\tminicards = { \"06001-m\" },\n\tsignatures = { \"06006\", \"06007\" },\n\tstarterDeck = \"2626402\"\n}\nINVESTIGATORS[\"Mandy Thompson\"] = {\n\tcards = { \"06002\", \"06002-t\" },\n\tminicards = { \"06002-m\" },\n\tsignatures = { \"06008\", \"06008\", \"06008\", \"06009\" },\n\tstarterDeck = \"2626410\"\n}\nINVESTIGATORS[\"Tony Morgan\"] = {\n\tcards = { \"06003\" },\n\tminicards = { \"06003-m\" },\n\tsignatures = { \"06010\", \"06011\", \"06011\", \"06012\" },\n\tstarterDeck = \"2626446\"\n}\nINVESTIGATORS[\"Luke Robinson\"] = {\n\tcards = { \"06004\" },\n\tminicards = { \"06004-m\" },\n\tsignatures = { \"06013\", \"06014\", \"06015\" },\n\tstarterDeck = \"2626452\"\n}\nINVESTIGATORS[\"Patrice Hathaway\"] = {\n\tcards = { \"06005\" },\n\tminicards = { \"06005-m\" },\n\tsignatures = { \"06016\", \"06017\" },\n\tstarterDeck = \"2626461\"\n}\n--Starter--\nINVESTIGATORS[\"Nathaniel Cho\"] = {\n\tcards = { \"60101\" },\n\tminicards = { \"60101-m\" },\n\tsignatures = { \"60102\", \"60103\" },\n\tstarterDeck = \"2643925\"\n}\nINVESTIGATORS[\"Harvey Walters\"] = {\n\tcards = { \"60201\" },\n\tminicards = { \"60201-m\" },\n\tsignatures = { \"60202\", \"60203\" },\n\tstarterDeck = \"2643928\"\n}\nINVESTIGATORS[\"Winifred Habbamock\"] = {\n\tcards = { \"60301\" },\n\tminicards = { \"60301-m\" },\n\tsignatures = { \"60302\", \"60303\" },\n\tstarterDeck = \"2643931\"\n}\nINVESTIGATORS[\"Jacqueline Fine\"] = {\n\tcards = { \"60401\" },\n\tminicards = { \"60401-m\" },\n\tsignatures = { \"60402\", \"60403\" },\n\tstarterDeck = \"2643932\"\n}\nINVESTIGATORS[\"Stella Clark\"] = {\n\tcards = { \"60501\" },\n\tminicards = { \"60501-m\" },\n\tsignatures = { \"60502\", \"60502\", \"60502\", \"60503\" },\n\tstarterDeck = \"2643934\"\n}\n--Innsmouth--\nINVESTIGATORS[\"Sister Mary\"] = {\n\tcards = { \"07001\" },\n\tminicards = { \"07001-m\" },\n\tsignatures = { \"07006\", \"07007\" },\n\tstarterDeck = \"2626464\"\n}\nINVESTIGATORS[\"Amanda Sharpe\"] = {\n\tcards = { \"07002\" },\n\tminicards = { \"07002-m\" },\n\tsignatures = { \"07008\", \"07009\" },\n\tstarterDeck = \"2626469\"\n}\nINVESTIGATORS[\"Trish Scarborough\"] = {\n\tcards = { \"07003\", \"07003-t\" },\n\tminicards = { \"07003-m\" },\n\tsignatures = { \"07010\", \"07011\" },\n\tstarterDeck = \"2626479\"\n}\nINVESTIGATORS[\"Dexter Drake\"] = {\n\tcards = { \"07004\" },\n\tminicards = { \"07004-m\" },\n\tsignatures = { \"07012\", \"07013\", \"98017\", \"98018\" },\n\tstarterDeck = \"2626672\"\n}\nINVESTIGATORS[\"Silas Marsh\"] = {\n\tcards = { \"07005\" },\n\tminicards = { \"07005-m\" },\n\tsignatures = { \"07014\", \"07015\", \"07016\", \"98014\", \"98015\" },\n\tstarterDeck = \"2626685\"\n}\n--Edge--\nINVESTIGATORS[\"Daniela Reyes\"] = {\n\tcards = { \"08001\" },\n\tminicards = { \"08001-m\" },\n\tsignatures = {\"08002\", \"08003\" },\n\tstarterDeck = \"2634588\"\n}\nINVESTIGATORS[\"Norman Withers\"] = {\n\tcards = { \"08004\" },\n\tminicards = { \"08004-m\" },\n\tsignatures = { \"08005\", \"08006\", \"98008\", \"98009\" },\n\tstarterDeck = \"2634603\"\n}\nINVESTIGATORS[\"Monterey Jack\"] = {\n\tcards = { \"08007\" },\n\tminicards = { \"08007-m\" },\n\tsignatures = { \"08008\", \"08009\" },\n\tstarterDeck = \"2634652\"\n}\nINVESTIGATORS[\"Lily Chen\"] = {\n\tcards = { \"08010\" },\n\tminicards = { \"08010-m\" },\n\tsignatures = { \"08011a\", \"08012a\", \"08013a\", \"08014a\", \"08015\", \"08015\", \"08015\", \"08015\" },\n\tstarterDeck = \"2634658\"\n}\nINVESTIGATORS[\"Bob Jenkins\"] = {\n\tcards = { \"08016\" },\n\tminicards = { \"08016-m\" },\n\tsignatures = { \"08017\", \"08018\" },\n\tstarterDeck = \"2634643\"\n}\n--Scarlet--\nINVESTIGATORS[\"Carson Sinclair\"] = {\n\tcards = { \"09001\" },\n\tminicards = { \"09001-m\" },\n\tsignatures = { \"09002\", \"09002\", \"09003\" },\n\tstarterDeck = \"2634667\t\"\n}\nINVESTIGATORS[\"Vincent Lee\"] = {\n\tcards = { \"09004\" },\n\tminicards = { \"09004-m\" },\n\tsignatures = { \"09005\", \"09006\", \"09006\", \"09006\", \"09006\", \"09007\" },\n\tstarterDeck = \"2634675\"\n}\nINVESTIGATORS[\"Kymani Jones\"] = {\n\tcards = { \"09008\" },\n\tminicards = { \"09008-m\" },\n\tsignatures = { \"09009\", \"09010\" },\n\tstarterDeck = \"2634701\"\n}\nINVESTIGATORS[\"Amina Zidane\"] = {\n\tcards = { \"09011\" },\n\tminicards = { \"09011-m\" },\n\tsignatures = { \"09012\", \"09013\", \"09014\" },\n\tstarterDeck = \"2634697\"\n}\nINVESTIGATORS[\"Darrell Simmons\"] = {\n\tcards = { \"09015\" },\n\tminicards = { \"09015-m\" },\n\tsignatures = { \"09016\", \"09017\" },\n\tstarterDeck = \"2634757\"\n}\nINVESTIGATORS[\"Charlie Kane\"] = {\n\tcards = { \"09018\" },\n\tminicards = { \"09018-m\" },\n\tsignatures = { \"09019\", \"09020\" },\n\tstarterDeck = \"2634706\"\n}\nINVESTIGATORS[\"Subject 5U-21\"] = {\n\tcards = { \"89001\" },\n\tminicards = { \"89001-m\" },\n\tsignatures = { \"89002\", \"89003\", \"89003\", \"89003\", \"89004\", \"89004\", \"89004\", \"89005\" },\n\tstarterDeck = \"2624990\" -- Lola's deck id until Suzi is on ArkhamDB\n}\n\n--Promo--\nINVESTIGATORS[\"Gloria Goldberg\"] = {\n\tcards = { \"98019\" },\n\tminicards = { \"98019-m\" },\n\tsignatures = { \"98020\", \"98021\" },\n\tstarterDeck = \"2636199\"\n}\n------------------ END INVESTIGATOR DATA DEFINITION ------------------\nend)\n__bundle_register(\"playercards/SpawnBag\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/PlayerCardSpawner\")\n\n-- Allows spawning of defined lists of cards which will be created from the template in the All\n-- Player Cards bag. SpawnBag.spawn will create objects based on a table definition, while\n-- SpawnBag.recall will clean them all up. Recall will be limited to a small area around the\n-- spawned objects. Objects moved out of this area will not be cleaned up.\n--\n-- SpawnSpec: Spawning requires a spawn specification with the following structure:\n-- {\n-- name: Name of this spawn content, used for internal tracking. Multiple specs can be spawned,\n-- but each requires a separate name\n-- cards: A list of card IDs to be spawned\n-- globalPos: Where the spawned objects should be placed, in global coordinates. This should be\n-- a valid Vector with x, y, and z defined, e.g. { x = 5, y = 1, z = 15 }\n-- rotation: Rotation for the spawned objects. X=180 should be used for face down items. As with\n-- globalPos, this should be a valid Vector with x, y, and z defined\n-- spread: Optional Boolean. If present and true, cards will be spawned next to each other in a\n-- spread moving to the right. globalPos will define the location of the first card, each\n-- after that will be moved a predefined distance\n-- spreadCols: Optional integer. If spread is true, specifies the maximum columns cards will be\n-- laid out in before starting a new row. If spread is true but spreadCols is not set, all\n-- cards will be in a single row (however long that may be)\n-- }\n-- See BondedBag.ttslua for an example\ndo\n local allCardsBagApi = require(\"playercards/AllCardsBagApi\")\n\n local SpawnBag = { }\n local internal = { }\n\n -- To assist debugging, will draw a box around the recall zone when it's set up\n local SHOW_RECALL_ZONE = false\n\n -- Distance to expand the recall zone around any added object.\n local RECALL_BUFFER_X = 0.9\n local RECALL_BUFFER_Z = 0.5\n\n -- In order to mimic the behavior of the previous memory buttons we use a temporary bag when\n -- recalling objects. This bag is tiny and transparent, and will be placed at the same location as\n -- this object. Once all placed cards are recalled bag to this bag, it will be destroyed\n local RECALL_BAG = {\n Name = \"Bag\",\n Transform = {\n scaleX = 0.01,\n scaleY = 0.01,\n scaleZ = 0.01,\n },\n ColorDiffuse = {\n r = 0,\n g = 0,\n b = 0,\n a = 0,\n },\n Locked = true,\n Grid = true,\n Snap = false,\n Tooltip = false,\n }\n\n -- Tracks what has been placed by this \"bag\" so they can be recalled\n local placedSpecs = { }\n local placedObjectGuids = { }\n local recallZone = nil\n\n -- Loads a table of saved state, extracted during the parent object's onLoad\n SpawnBag.loadFromSave = function(saveTable)\n placedSpecs = saveTable.placed\n placedObjectGuids = saveTable.placedObjects\n recallZone = saveTable.recall\n end\n\n -- Generates a table of save state that can be included in the parent object's onSave\n SpawnBag.getStateForSave = function()\n return {\n placed = placedSpecs,\n placedObjects = placedObjectGuids,\n recall = recallZone,\n }\n end\n\n -- Places the given spawnSpec on the table. See SpawnBag.ttslua header for spawnSpec table data and\n -- examples\n SpawnBag.spawn = function(spawnSpec)\n -- Limit to one placement at a time\n if (placedSpecs[spawnSpec.name]) then\n return\n end\n if (spawnSpec == nil) then\n -- TODO: error here\n return\n end\n local cardsToSpawn = { }\n local cardList = spawnSpec.cards\n for _, cardId in ipairs(cardList) do\n local cardData = allCardsBagApi.getCardById(cardId)\n if (cardData ~= nil) then\n table.insert(cardsToSpawn, cardData)\n else\n -- TODO: error here\n end\n end\n if (spawnSpec.spread) then\n Spawner.spawnCardSpread(cardsToSpawn, spawnSpec.globalPos, spawnSpec.spreadCols or 9999, spawnSpec.rotation, false, internal.recordPlacedObject)\n else\n -- TTS decks come out in reverse order of the cards, reverse the list so the input order stays\n -- This only applies for decks; spreads are spawned by us in the order given\n if spawnSpec.rotation.z != 180 then\n cardsToSpawn = internal.reverseList(cardsToSpawn)\n end\n Spawner.spawnCards(cardsToSpawn, spawnSpec.globalPos, spawnSpec.rotation, false, internal.recordPlacedObject)\n end\n placedSpecs[spawnSpec.name] = true\n end\n\n -- Recalls all spawned objects to the bag, and clears the placedObjectGuids list\n ---@param fast Boolean. If true, cards will be deleted directly without faking the bag recall.\n SpawnBag.recall = function(fast)\n if fast then\n internal.deleteSpawned()\n else\n internal.recallSpawned()\n end\n\n -- We've recalled everything we can, some cards may have been moved out of the\n -- card area. Just reset at this point.\n placedSpecs = { }\n placedObjectGuids = { }\n recallZone = nil\n end\n\n -- Deleted all spawned cards.\n internal.deleteSpawned = function()\n for guid, _ in pairs(placedObjectGuids) do\n local obj = getObjectFromGUID(guid)\n if (obj ~= nil) then\n if (internal.isInRecallZone(obj)) then\n obj.destruct()\n end\n placedObjectGuids[guid] = nil\n end\n end\n end\n\n -- Recalls spawned cards with a fake bag that replicates the memory bag recall style.\n internal.recallSpawned = function()\n local trash = spawnObjectData({data = RECALL_BAG, position = self.getPosition()})\n for guid, _ in pairs(placedObjectGuids) do\n local obj = getObjectFromGUID(guid)\n if (obj ~= nil) then\n if (internal.isInRecallZone(obj)) then\n trash.putObject(obj)\n end\n placedObjectGuids[guid] = nil\n end\n end\n\n trash.destruct()\n end\n\n\n -- Callback for when an object has been spawned. Tracks the object for later recall and updates the\n -- recall zone.\n internal.recordPlacedObject = function(spawned)\n placedObjectGuids[spawned.getGUID()] = true\n internal.expandRecallZone(spawned)\n end\n\n -- Expands the current recall zone based on the position of the given object. The recall zone will\n -- be maintained as the bounding box of the extreme object positions, plus a small amount of buffer\n internal.expandRecallZone = function(spawnedCard)\n local pos = spawnedCard.getPosition()\n if (recallZone == nil) then\n -- First card out of the bag, initialize surrounding that\n recallZone = { }\n recallZone.upperLeft = { x = pos.x + RECALL_BUFFER_X, z = pos.z + RECALL_BUFFER_Z }\n recallZone.lowerRight = { x = pos.x - RECALL_BUFFER_X, z = pos.z - RECALL_BUFFER_Z }\n return\n else\n if (pos.x \u003e recallZone.upperLeft.x) then\n recallZone.upperLeft.x = pos.x + RECALL_BUFFER_X\n end\n if (pos.x \u003c recallZone.lowerRight.x) then\n recallZone.lowerRight.x = pos.x - RECALL_BUFFER_X\n end\n if (pos.z \u003e recallZone.upperLeft.z) then\n recallZone.upperLeft.z = pos.z + RECALL_BUFFER_Z\n end\n if (pos.z \u003c recallZone.lowerRight.z) then\n recallZone.lowerRight.z = pos.z - RECALL_BUFFER_Z\n end\n end\n if (SHOW_RECALL_ZONE) then\n local y = 1.5\n local thick = 0.05\n Global.setVectorLines({\n {\n points = { {recallZone.upperLeft.x,y,recallZone.upperLeft.z}, {recallZone.upperLeft.x,y,recallZone.lowerRight.z} },\n color = {1,0,0},\n thickness = thick,\n rotation = {0,0,0},\n },\n {\n points = { {recallZone.upperLeft.x,y,recallZone.lowerRight.z}, {recallZone.lowerRight.x,y,recallZone.lowerRight.z} },\n color = {1,0,0},\n thickness = thick,\n rotation = {0,0,0},\n },\n {\n points = { {recallZone.lowerRight.x,y,recallZone.lowerRight.z}, {recallZone.lowerRight.x,y,recallZone.upperLeft.z} },\n color = {1,0,0},\n thickness = thick,\n rotation = {0,0,0},\n },\n {\n points = { {recallZone.lowerRight.x,y,recallZone.upperLeft.z}, {recallZone.upperLeft.x,y,recallZone.upperLeft.z} },\n color = {1,0,0},\n thickness = thick,\n rotation = {0,0,0},\n },\n })\n end\n end\n\n -- Checks to see if the given object is in the current recall zone. If there isn't a recall zone,\n -- will return true so that everything can be easily cleaned up.\n internal.isInRecallZone = function(obj)\n if (recallZone == nil) then\n return true\n end\n local pos = obj.getPosition()\n return (pos.x \u003c recallZone.upperLeft.x and pos.x \u003e recallZone.lowerRight.x\n and pos.z \u003c recallZone.upperLeft.z and pos.z \u003e recallZone.lowerRight.z)\n end\n\n internal.reverseList = function(list)\n local reversed = { }\n for i = 1, #list do\n reversed[i] = list[#list - i + 1]\n end\n\n return reversed\n end\n\n return SpawnBag\nend\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = { }\n local PLAY_AREA_GUID = \"721ba2\"\n local INVESTIGATOR_COUNTER_GUID = \"f182ee\"\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with\n -- 'displacement_excluded'\n ---@param playerColor Color of the player requesting the shift. Used solely to send an error\n --- message in the unlikely case that the scripting zone has been deleted\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"tryObjectEnterContainer\",\n { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightCountedVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"arkhamdb/ArkhamDb\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local allCardsBagApi = require(\"playercards/AllCardsBagApi\")\n local playAreaApi = require(\"core/PlayAreaApi\")\n \n local ArkhamDb = { }\n local internal = { }\n\n local RANDOM_WEAKNESS_ID = \"01000\"\n\n local tabooList = { }\n --Forward declaration\n ---@type Request\n local Request = {}\n local configuration\n\n -- Sets up the ArkhamDb interface. Should be called from the parent object on load.\n ArkhamDb.initialize = function()\n configuration = internal.getConfiguration()\n Request.start({ configuration.api_uri, configuration.taboo }, function(status)\n local json = JSON.decode(internal.fixUtf16String(status.text))\n for _, taboo in pairs(json) do\n ---@type \u003cstring, boolean\u003e\n local cards = {}\n\n for _, card in pairs(JSON.decode(taboo.cards)) do\n cards[card.code] = true\n end\n\n tabooList[taboo.id] = {\n date = taboo.date_start,\n cards = cards\n }\n end\n return true, nil\n end)\n end\n\n -- Start the deck build process for the given player color and deck ID. This\n -- will retrieve the deck from ArkhamDB, and pass to a callback for processing.\n ---@param playerColor String. Color name of the player mat to place this deck on (e.g. \"Red\").\n ---@param deckId String. ArkhamDB deck id to be loaded\n ---@param isPrivate Boolean. Whether this deck is published or private on ArkhamDB\n ---@param loadNewest Boolean. Whether the newest version of this deck should be loaded\n ---@param loadInvestigators Boolean. Whether investigator cards should be loaded as part of this\n --- deck\n ---@param callback Function. Callback which will be sent the results of this load. Parameters\n --- to the callback will be:\n --- slots Table. A map of card ID to count in the deck\n --- investigatorCode String. ID of the investigator in this deck\n --- customizations Table. The decoded table of customization upgrades in this deck\n --- playerColor String. Color this deck is being loaded for\n ArkhamDb.getDecklist = function(\n playerColor,\n deckId,\n isPrivate,\n loadNewest,\n loadInvestigators,\n callback)\n -- Get a simple card to see if the bag indexes are complete. If not, abort\n -- the deck load. The called method will handle player notification.\n local checkCard = allCardsBagApi.getCardById(\"01001\")\n if (checkCard ~= nil and checkCard.data == nil) then\n return\n end\n\n local deckUri = { configuration.api_uri,\n isPrivate and configuration.private_deck or configuration.public_deck, deckId }\n\n local deck = Request.start(deckUri, function(status)\n if string.find(status.text, \"\u003c!DOCTYPE html\u003e\") then\n internal.maybePrint(\"Private deck ID \" .. deckId .. \" is not shared\", playerColor)\n return false, table.concat({ \"Private deck \", deckId, \" is not shared\" })\n end\n local json = JSON.decode(status.text)\n\n if not json then\n internal.maybePrint(\"Deck ID \" .. deckId .. \" not found\", playerColor)\n return false, \"Deck not found!\"\n end\n\n return true, json\n end)\n\n deck:with(internal.onDeckResult, playerColor, loadNewest, loadInvestigators, callback)\n end\n\n -- Logs that a card could not be loaded in the mod by printing it to the console in the given\n -- color of the player owning the deck. Attempts to look up the name on ArkhamDB for clarity,\n -- but prints the card ID if the name cannot be retrieved.\n ---@param cardId String. ArkhamDB ID of the card that could not be found\n ---@param playerColor String. Color of the player's deck that had the problem\n ArkhamDb.logCardNotFound = function(cardId, playerColor)\n local request = Request.start({\n configuration.api_uri,\n configuration.cards,\n cardId\n },\n function(result)\n local adbCardInfo = JSON.decode(internal.fixUtf16String(result.text))\n local cardName = adbCardInfo.real_name\n if (cardName ~= nil) then\n if (adbCardInfo.xp ~= nil and adbCardInfo.xp \u003e 0) then\n cardName = cardName .. \" (\" .. adbCardInfo.xp .. \")\"\n end\n internal.maybePrint(\"Card not found: \" .. cardName .. \", ArkhamDB ID \" .. cardId, playerColor)\n else\n internal.maybePrint(\"Card not found in ArkhamDB, ID \" .. cardId, playerColor)\n end\n end)\n end\n\n -- Callback when the deck information is received from ArkhamDB. Parses the\n -- response then applies standard transformations to the deck such as adding\n -- random weaknesses and checking for taboos. Once the deck is processed,\n -- passes to loadCards to actually spawn the defined deck.\n ---@param deck ArkhamImportDeck\n ---@param playerColor String Color name of the player mat to place this deck on (e.g. \"Red\")\n ---@param loadNewest Boolean Whether the newest version of this deck should be loaded\n ---@param loadInvestigators Boolean Whether investigator cards should be loaded as part of this\n --- deck\n ---@param callback Function Callback which will be sent the results of this load. Parameters\n --- to the callback will be:\n --- slots Table. A map of card ID to count in the deck\n --- investigatorCode String. ID of the investigator in this deck\n --- bondedList A table of cardID keys to meaningless values. Card IDs in this list were\n --- added from a parent bonded card.\n --- customizations Table. The decoded table of customization upgrades in this deck\n --- playerColor String. Color this deck is being loaded for\n internal.onDeckResult = function(deck, playerColor, loadNewest, loadInvestigators, callback)\n -- Load the next deck in the upgrade path if the option is enabled\n if (loadNewest and deck.next_deck ~= nil and deck.next_deck ~= \"\") then\n buildDeck(playerColor, deck.next_deck)\n return\n end\n\n internal.maybePrint(table.concat({ \"Found decklist: \", deck.name }), playerColor)\n\n -- Initialize deck slot table and perform common transformations. The order of these should not\n -- be changed, as later steps may act on cards added in each. For example, a random weakness or\n -- investigator may have bonded cards or taboo entries, and should be present\n local slots = deck.slots\n internal.maybeDrawRandomWeakness(slots, playerColor)\n local loadAltInvestigator = \"normal\"\n if loadInvestigators then\n loadAltInvestigator = internal.addInvestigatorCards(deck, slots)\n end\n \n internal.maybeAddSummonedServitor(slots)\n internal.maybeAddOnTheMend(slots, playerColor)\n internal.maybeAddRealityAcidReference(slots)\n local bondList = internal.extractBondedCards(slots)\n internal.checkTaboos(deck.taboo_id, slots, playerColor)\n internal.maybeAddUpgradeSheets(slots)\n\n -- get upgrades for customizable cards\n local customizations = {}\n if deck.meta then\n customizations = JSON.decode(deck.meta)\n end\n\n callback(slots, deck.investigator_code, bondList, customizations, playerColor, loadAltInvestigator)\n end\n\n -- Checks to see if the slot list includes the random weakness ID. If it does,\n -- removes it from the deck and replaces it with the ID of a random basic weakness provided by the\n -- all cards bag\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number\n --- of those cards which will be spawned\n ---@param playerColor String Color of the player this deck is being loaded for. Used for broadcast\n --- if a weakness is added.\n internal.maybeDrawRandomWeakness = function(slots, playerColor)\n local randomWeaknessAmount = slots[RANDOM_WEAKNESS_ID] or 0\n slots[RANDOM_WEAKNESS_ID] = nil\n\n if randomWeaknessAmount ~= 0 then\n for i=1, randomWeaknessAmount do\n local weaknessId = allCardsBagApi.getRandomWeaknessId()\n slots[weaknessId] = (slots[weaknessId] or 0) + 1\n end\n internal.maybePrint(\"Added \" .. randomWeaknessAmount .. \" random basic weakness(es) to deck\", playerColor)\n end\n end\n\n -- Adds both the investigator (XXXXX) and minicard (XXXXX-m) slots with one copy each\n ---@param deck Table The processed ArkhamDB deck response\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the\n --- number of those cards which will be spawned\n ---@return string: Contains the name of the art that should be loaded (\"normal\", \"promo\" or \"revised\")\n internal.addInvestigatorCards = function(deck, slots)\n local investigatorId = deck.investigator_code\n slots[investigatorId .. \"-m\"] = 1\n local deckMeta = JSON.decode(deck.meta)\n -- handling alternative investigator art and parallel investigators\n local loadAltInvestigator = \"normal\"\n if deckMeta ~= nil then\n local altFrontId = tonumber(deckMeta.alternate_front) or 0\n local altBackId = tonumber(deckMeta.alternate_back) or 0\n local altArt = { front = \"normal\", back = \"normal\" }\n\n -- translating front ID\n if altFrontId \u003e 90000 and altFrontId \u003c 90100 then\n altArt.front = \"parallel\"\n elseif altFrontId \u003e 01500 and altFrontId \u003c 01506 then\n altArt.front = \"revised\"\n elseif altFrontId \u003e 98000 then\n altArt.front = \"promo\"\n end\n\n -- translating back ID\n if altBackId \u003e 90000 and altBackId \u003c 90100 then\n altArt.back = \"parallel\"\n elseif altBackId \u003e 01500 and altBackId \u003c 01506 then\n altArt.back = \"revised\"\n elseif altBackId \u003e 98000 then\n altArt.back = \"promo\"\n end\n\n -- updating investigatorID based on alt investigator selection\n -- precedence: parallel \u003e promo \u003e revised\n if altArt.front == \"parallel\" then\n if altArt.back == \"parallel\" then\n investigatorId = investigatorId .. \"-p\"\n else\n investigatorId = investigatorId .. \"-pf\"\n end\n elseif altArt.back == \"parallel\" then\n investigatorId = investigatorId .. \"-pb\"\n elseif altArt.front == \"promo\" or altArt.back == \"promo\" then\n loadAltInvestigator = \"promo\"\n elseif altArt.front == \"revised\" or altArt.back == \"revised\" then\n loadAltInvestigator = \"revised\"\n end\n end\n slots[investigatorId] = 1\n deck.investigator_code = investigatorId\n return loadAltInvestigator\n end\n\n -- Process the card list looking for the customizable cards, and add their upgrade sheets if needed\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number\n -- of those cards which will be spawned\n internal.maybeAddUpgradeSheets = function(slots)\n for cardId, _ in pairs(slots) do\n -- upgrade sheets for customizable cards\n local upgradesheet = allCardsBagApi.getCardById(cardId .. \"-c\")\n if upgradesheet ~= nil then\n slots[cardId .. \"-c\"] = 1\n end\n end\n end\n\n -- Process the card list looking for the Summoned Servitor, and add its minicard to the list if\n -- needed\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number\n -- of those cards which will be spawned\n internal.maybeAddSummonedServitor = function(slots)\n if slots[\"09080\"] ~= nil then\n slots[\"09080-m\"] = 1\n end\n end\n\n -- On the Mend should have 1-per-investigator copies set aside, but ArkhamDB always sends 1. Update\n -- the count based on the investigator count\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number\n -- of those cards which will be spawned\n ---@param playerColor String Color of the player this deck is being loaded for. Used for broadcast if an error occurs\n internal.maybeAddOnTheMend = function(slots, playerColor)\n if slots[\"09006\"] ~= nil then\n local investigatorCount = playAreaApi.getInvestigatorCount()\n if investigatorCount ~= nil then\n slots[\"09006\"] = investigatorCount\n else\n internal.maybePrint(\"Something went wrong with the load, adding 4 copies of On the Mend\", playerColor)\n slots[\"09006\"] = 4\n end\n end\n end\n\n -- Process the card list looking for Reality Acid and adds the reference sheet when needed\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number\n -- of those cards which will be spawned\n internal.maybeAddRealityAcidReference = function(slots)\n if slots[\"89004\"] ~= nil then\n slots[\"89005\"] = 1\n end\n end\n\n -- Process the slot list and looks for any cards which are bonded to those in the deck. Adds those cards to the slot list.\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number of those cards which will be spawned\n internal.extractBondedCards = function(slots)\n -- Create a list of bonded cards first so we don't modify slots while iterating\n local bondedCards = { }\n local bondedList = { }\n for cardId, cardCount in pairs(slots) do\n local card = allCardsBagApi.getCardById(cardId)\n if (card ~= nil and card.metadata.bonded ~= nil) then\n for _, bond in ipairs(card.metadata.bonded) do\n -- add a bonded card for each copy of the parent card (except for Pendant of the Queen)\n if bond.id == \"06022\" then\n bondedCards[bond.id] = bond.count\n else\n bondedCards[bond.id] = bond.count * cardCount\n end\n -- We need to know which cards are bonded to determine their position, remember them\n bondedList[bond.id] = true\n -- Also adding taboo versions of bonded cards to the list\n bondedList[bond.id .. \"-t\"] = true\n end\n end\n end\n -- Add any bonded cards to the main slots list\n for bondedId, bondedCount in pairs(bondedCards) do\n slots[bondedId] = bondedCount\n end\n\n return bondedList\n end\n\n -- Check the deck for cards on its taboo list. If they're found, replace the entry in the slot with the Taboo id (i.e. \"XXXX\" becomes \"XXXX-t\")\n ---@param tabooId String The deck's taboo ID, taken from the deck response taboo_id field. May be nil, indicating that no taboo list should be used\n ---@param slots Table The slot list for cards in this deck. Table key is the cardId, value is the number of those cards which will be spawned\n internal.checkTaboos = function(tabooId, slots, playerColor)\n if tabooId then\n for cardId, _ in pairs(tabooList[tabooId].cards) do\n if slots[cardId] ~= nil then\n -- Make sure there's a taboo version of the card before we replace it\n -- SCED only maintains the most recent taboo cards. If a deck is using\n -- an older taboo list it's possible the card isn't a taboo any more\n local tabooCard = allCardsBagApi.getCardById(cardId .. \"-t\")\n if tabooCard == nil then\n local basicCard = allCardsBagApi.getCardById(cardId)\n internal.maybePrint(\"Taboo version for \" .. basicCard.data.Nickname .. \" is not available. Using standard version\", playerColor)\n else\n slots[cardId .. \"-t\"] = slots[cardId]\n slots[cardId] = nil\n end\n end\n end\n end\n end\n\n internal.maybePrint = function(message, playerColor)\n if playerColor ~= \"None\" then\n printToAll(message, playerColor)\n end\n end\n\n -- Gets the ArkhamDB config info from the configuration object.\n ---@return Table. Configuration data\n internal.getConfiguration = function()\n local configuration = getObjectsWithTag(\"import_configuration_provider\")[1]:getTable(\"configuration\")\n printPriority = configuration.priority\n return configuration\n end\n\n internal.fixUtf16String = function(str)\n return str:gsub(\"\\\\u(%w%w%w%w)\", function(match)\n return string.char(tonumber(match, 16))\n end)\n end\n\n ---@type Request\n Request = {\n is_done = false,\n is_successful = false\n }\n\n -- Creates a new instance of a Request. Should not be directly called. Instead use Request.start and Request.deferred.\n ---@param uri string\n ---@param configure fun(request: Request, status: WebRequestStatus)\n ---@return Request\n function Request:new(uri, configure)\n local this = {}\n\n setmetatable(this, self)\n self.__index = self\n\n if type(uri) == \"table\" then\n uri = table.concat(uri, \"/\")\n end\n\n this.uri = uri\n\n WebRequest.get(uri, function(status)\n configure(this, status)\n end)\n\n return this\n end\n\n -- Creates a new request. on_success should set the request's is_done, is_successful, and content variables.\n -- Deferred should be used when you don't want to set is_done immediately (such as if you want to wait for another request to finish)\n ---@param uri string\n ---@param on_success fun(request: Request, status: WebRequestStatus, vararg any)\n ---@param on_error fun(status: WebRequestStatus)|nil\n ---@vararg any[]\n ---@return Request\n function Request.deferred(uri, on_success, on_error, ...)\n local parameters = table.pack(...)\n return Request:new(uri, function(request, status)\n if (status.is_done) then\n if (status.is_error) then\n request.error_message = on_error and on_error(status, table.unpack(parameters)) or status.error\n request.is_successful = false\n request.is_done = true\n else\n on_success(request, status)\n end\n end\n end)\n end\n\n -- Creates a new request. on_success should return weather the resultant data is as expected, and the processed content of the request.\n ---@param uri string\n ---@param on_success fun(status: WebRequestStatus, vararg any): boolean, any\n ---@param on_error nil|fun(status: WebRequestStatus, vararg any): string\n ---@vararg any[]\n ---@return Request\n function Request.start(uri, on_success, on_error, ...)\n local parameters = table.pack(...)\n return Request.deferred(uri, function(request, status)\n local result, message = on_success(status, table.unpack(parameters))\n if not result then request.error_message = message else request.content = message end\n request.is_successful = result\n request.is_done = true\n end, on_error, table.unpack(parameters))\n end\n\n ---@param requests Request[]\n ---@param on_success fun(content: any[], vararg any[])\n ---@param on_error fun(requests: Request[], vararg any[])|nil\n ---@vararg any\n function Request.with_all(requests, on_success, on_error, ...)\n local parameters = table.pack(...)\n\n Wait.condition(function()\n ---@type any[]\n local results = {}\n\n ---@type Request[]\n local errors = {}\n\n for _, request in ipairs(requests) do\n if request.is_successful then\n table.insert(results, request.content)\n else\n table.insert(errors, request)\n end\n end\n\n if (#errors \u003c= 0) then\n on_success(results, table.unpack(parameters))\n elseif on_error == nil then\n for _, request in ipairs(errors) do\n internal.maybePrint(table.concat({ \"[ERROR]\", request.uri, \":\", request.error_message }))\n end\n else\n on_error(requests, table.unpack(parameters))\n end\n end, function()\n for _, request in ipairs(requests) do\n if not request.is_done then return false end\n end\n return true\n end)\n end\n\n ---@param callback fun(content: any, vararg any)\n function Request:with(callback, ...)\n local arguments = table.pack(...)\n Wait.condition(function()\n if self.is_successful then\n callback(self.content, table.unpack(arguments))\n end\n end, function() return self.is_done\n end)\n end\n\n return ArkhamDb\nend\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getPlayArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"PlayArea\")\n end\n\n local function getInvestigatorCounter()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"InvestigatorCounter\")\n end\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getInvestigatorCounter().getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n getInvestigatorCounter().call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with 'displacement_excluded'\n ---@param playerColor Color Color of the player requesting the shift for messages\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getPlayArea().call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getPlayArea().call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getPlayArea().call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getPlayArea().call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getPlayArea().call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getPlayArea().call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getPlayArea().call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getPlayArea().call(\"tryObjectEnterContainer\", { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getPlayArea().call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getPlayArea().call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getPlayArea().call(\"countVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getPlayArea().call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getPlayArea().getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getPlayArea().call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getPlayArea().call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getPlayArea().getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/PlayerCardPanel\")\nend)\n__bundle_register(\"playercards/PlayerCardPanel\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/PlayerCardPanelData\")\n\nlocal allCardsBagApi = require(\"playercards/AllCardsBagApi\")\nlocal arkhamDb = require(\"arkhamdb/ArkhamDb\")\nlocal spawnBag = require(\"playercards/SpawnBag\")\n\n-- Size and position information for the three rows of class buttons\nlocal CIRCLE_BUTTON_SIZE = 250\nlocal CLASS_BUTTONS_X_OFFSET = 0.1325\nlocal INVESTIGATOR_ROW_START = Vector(0.125, 0.1, -0.447)\nlocal LEVEL_ZERO_ROW_START = Vector(0.125, 0.1, -0.007)\nlocal UPGRADED_ROW_START = Vector(0.125, 0.1, 0.333)\n\n-- Size and position information for the two blocks of other buttons\nlocal MISC_BUTTONS_X_OFFSET = 0.155\nlocal WEAKNESS_ROW_START = Vector(0.157, 0.1, 0.666)\nlocal OTHER_ROW_START = Vector(0.605, 0.1, 0.666)\n\n-- Size and position information for the Cycle (box) buttons\nlocal CYCLE_BUTTON_SIZE = 468\nlocal CYCLE_BUTTON_START = Vector(-0.716, 0.1, -0.39)\nlocal CYCLE_COLUMN_COUNT = 3\nlocal CYCLE_BUTTONS_X_OFFSET = 0.267\nlocal CYCLE_BUTTONS_Z_OFFSET = 0.2665\n\nlocal STARTER_DECK_MODE_SELECTED_COLOR = { 0.2, 0.2, 0.2, 0.8 }\nlocal TRANSPARENT = { 0, 0, 0, 0 }\nlocal STARTER_DECK_MODE_STARTERS = \"starters\"\nlocal STARTER_DECK_MODE_CARDS_ONLY = \"cards\"\n\nlocal FACE_UP_ROTATION = { x = 0, y = 270, z = 0}\nlocal FACE_DOWN_ROTATION = { x = 0, y = 270, z = 180}\n\n-- ---------- IMPORTANT ----------\n-- Coordinates defined below are in global dimensions relative to the panel - DO NOT USE THESE\n-- DIRECTLY. Call scalePositions() before use, and reference the variables below\n\n-- Layout width for a single card, in global coordinate space\nlocal CARD_WIDTH = 2.3\n\n-- Coordinates to begin laying out cards. These vary based on the cards that are being placed by\n-- considering the width of the cards, number of cards, and desired spread intervals.\n-- IMPORTANT! Because of the mix of global card sizes and relative-to-scale positions, the X and Y\n-- coordinates on these provide global disances while the Z is local.\nlocal START_POSITIONS = {\n classCards = Vector(CARD_WIDTH * 9.5, 2, 1.4),\n investigator = Vector(6 * 2.5, 2, 1.3),\n cycle = Vector(CARD_WIDTH * 9.5, 2, 2.4),\n other = Vector(CARD_WIDTH * 9.5, 2, 1.4),\n randomWeakness = Vector(0, 2, 1.4),\n -- Because the card spread is handled by the SpawnBag, we don't know (programatically) where this\n -- should be placed. If more customizable cards are added it will need to be moved.\n summonedServitor = Vector(CARD_WIDTH * -7.5, 2, 1.7),\n}\n\n-- Shifts to move rows of cards, and groups of rows, as different groupings are laid out\nlocal CARD_ROW_OFFSET = 3.7\nlocal CARD_GROUP_OFFSET = 2\n\n-- Position offsets for investigator decks in investigator mode, defines the spacing for how the\n-- rows and columns are laid out\nlocal INVESTIGATOR_POSITION_SHIFT_ROW = Vector(0, 0, 11)\nlocal INVESTIGATOR_POSITION_SHIFT_COL = Vector(-6, 0, 0)\nlocal INVESTIGATOR_MAX_COLS = 6\n\n-- Positions relative to the minicard to place other stacks. Both signature card piles and starter\n-- decks use SIGNATURE_OFFSET\nlocal INVESTIGATOR_CARD_OFFSET = Vector(0, 0, 2.55)\nlocal INVESTIGATOR_SIGNATURE_OFFSET = Vector(0, 0, 5.75)\n\n-- USE THESE! Positions and offset shifts accounting for the scale of the panel\nlocal startPositions\nlocal cardRowOffset\nlocal cardGroupOffset\nlocal investigatorPositionShiftRow\nlocal investigatorPositionShiftCol\nlocal investigatorCardOffset\nlocal investigatorSignatureOffset\n\nlocal CLASS_LIST = { \"Guardian\", \"Seeker\", \"Rogue\", \"Mystic\", \"Survivor\", \"Neutral\" }\nlocal CYCLE_LIST = {\n \"Core\",\n \"The Dunwich Legacy\",\n \"The Path to Carcosa\",\n \"The Forgotten Age\",\n \"The Circle Undone\",\n \"The Dream-Eaters\",\n \"The Innsmouth Conspiracy\",\n \"Edge of the Earth\",\n \"The Scarlet Keys\",\n \"The Feast of Hemlock Vale\",\n \"Investigator Packs\"\n}\n\nlocal excludedNonBasicWeaknesses\n\nlocal starterDeckMode = STARTER_DECK_MODE_CARDS_ONLY\nlocal helpVisibleToPlayers = { }\n\nfunction onSave()\n local saveState = {\n spawnBagState = spawnBag.getStateForSave(),\n }\n return JSON.encode(saveState)\nend\n\nfunction onLoad(savedData)\n arkhamDb.initialize()\n if (savedData ~= nil) then\n local saveState = JSON.decode(savedData) or { }\n if (saveState.spawnBagState ~= nil) then\n spawnBag.loadFromSave(saveState.spawnBagState)\n end\n end\n buildExcludedWeaknessList()\n createButtons()\nend\n\n-- Build a list of non-basic weaknesses which should be excluded from the last weakness set,\n-- including all signature cards and evolved weaknesses.\nfunction buildExcludedWeaknessList()\n excludedNonBasicWeaknesses = { }\n for _, investigator in pairs(INVESTIGATORS) do\n for _, signatureId in ipairs(investigator.signatures) do\n excludedNonBasicWeaknesses[signatureId] = true\n end\n end\n for _, weaknessId in ipairs(EVOLVED_WEAKNESSES) do\n excludedNonBasicWeaknesses[weaknessId] = true\n end\nend\n\nfunction createButtons()\n createHelpButton()\n createInvestigatorButtons()\n createLevelZeroButtons()\n createUpgradedButtons()\n createWeaknessButtons()\n createOtherButtons()\n createCycleButtons()\n createClearButton()\n -- Create investigator mode buttons last so the indexes are set when we need to update them\n createInvestigatorModeButtons()\nend\n\nfunction createHelpButton()\n self.createButton({\n function_owner = self,\n click_function = \"toggleHelp\",\n position = Vector(0.845, 0.1, -0.855),\n rotation = Vector(0, 0, 0),\n height = 180,\n width = 180,\n scale = Vector(0.25, 1, 0.25),\n color = TRANSPARENT,\n })\nend\n\nfunction createInvestigatorButtons()\n local invButtonParams = {\n function_owner = self,\n rotation = Vector(0, 0, 0),\n height = CIRCLE_BUTTON_SIZE,\n width = CIRCLE_BUTTON_SIZE,\n scale = Vector(0.25, 1, 0.25),\n color = TRANSPARENT,\n }\n local buttonPos = INVESTIGATOR_ROW_START:copy()\n for _, class in ipairs(CLASS_LIST) do\n invButtonParams.click_function = \"spawnInvestigators\" .. class\n invButtonParams.position = buttonPos\n self.createButton(invButtonParams)\n buttonPos.x = buttonPos.x + CLASS_BUTTONS_X_OFFSET\n self.setVar(invButtonParams.click_function, function(_, _, _) spawnInvestigatorGroup(class) end)\n end\nend\n\nfunction createLevelZeroButtons()\n local l0ButtonParams = {\n function_owner = self,\n rotation = Vector(0, 0, 0),\n height = CIRCLE_BUTTON_SIZE,\n width = CIRCLE_BUTTON_SIZE,\n scale = Vector(0.25, 1, 0.25),\n color = TRANSPARENT,\n }\n local buttonPos = LEVEL_ZERO_ROW_START:copy()\n for _, class in ipairs(CLASS_LIST) do\n l0ButtonParams.click_function = \"spawnBasic\" .. class\n l0ButtonParams.position = buttonPos\n self.createButton(l0ButtonParams)\n buttonPos.x = buttonPos.x + CLASS_BUTTONS_X_OFFSET\n self.setVar(l0ButtonParams.click_function, function(_, _, _) spawnClassCards(class, false) end)\n end\nend\n\nfunction createUpgradedButtons()\n local upgradedButtonParams = {\n function_owner = self,\n rotation = Vector(0, 0, 0),\n height = CIRCLE_BUTTON_SIZE,\n width = CIRCLE_BUTTON_SIZE,\n scale = Vector(0.25, 1, 0.25),\n color = TRANSPARENT,\n }\n local buttonPos = UPGRADED_ROW_START:copy()\n for _, class in ipairs(CLASS_LIST) do\n upgradedButtonParams.click_function = \"spawnUpgraded\" .. class\n upgradedButtonParams.position = buttonPos\n self.createButton(upgradedButtonParams)\n buttonPos.x = buttonPos.x + CLASS_BUTTONS_X_OFFSET\n self.setVar(upgradedButtonParams.click_function, function(_, _, _) spawnClassCards(class, true) end)\n end\nend\n\nfunction createWeaknessButtons()\n local weaknessButtonParams = {\n function_owner = self,\n rotation = Vector(0, 0, 0),\n height = CIRCLE_BUTTON_SIZE,\n width = CIRCLE_BUTTON_SIZE,\n scale = Vector(0.25, 1, 0.25),\n color = TRANSPARENT,\n }\n local buttonPos = WEAKNESS_ROW_START:copy()\n weaknessButtonParams.click_function = \"spawnWeaknesses\"\n weaknessButtonParams.tooltip = \"All Weaknesses\"\n weaknessButtonParams.position = buttonPos\n self.createButton(weaknessButtonParams)\n buttonPos.x = buttonPos.x + MISC_BUTTONS_X_OFFSET\n weaknessButtonParams.click_function = \"spawnRandomWeakness\"\n weaknessButtonParams.tooltip = \"Random Basic Weakness\"\n weaknessButtonParams.position = buttonPos\n self.createButton(weaknessButtonParams)\nend\n\nfunction createOtherButtons()\n local otherButtonParams = {\n function_owner = self,\n rotation = Vector(0, 0, 0),\n height = CIRCLE_BUTTON_SIZE,\n width = CIRCLE_BUTTON_SIZE,\n scale = Vector(0.25, 1, 0.25),\n color = TRANSPARENT,\n }\n local buttonPos = OTHER_ROW_START:copy()\n otherButtonParams.click_function = \"spawnBonded\"\n otherButtonParams.tooltip = \"Bonded Cards\"\n otherButtonParams.position = buttonPos\n self.createButton(otherButtonParams)\n buttonPos.x = buttonPos.x + MISC_BUTTONS_X_OFFSET\n otherButtonParams.click_function = \"spawnUpgradeSheets\"\n otherButtonParams.tooltip = \"Customization Upgrade Sheets\"\n otherButtonParams.position = buttonPos\n self.createButton(otherButtonParams)\nend\n\nfunction createCycleButtons()\n local cycleButtonParams = {\n function_owner = self,\n rotation = Vector(0, 0, 0),\n height = CYCLE_BUTTON_SIZE,\n width = CYCLE_BUTTON_SIZE,\n scale = Vector(0.25, 1, 0.25),\n color = TRANSPARENT,\n }\n local buttonPos = CYCLE_BUTTON_START:copy()\n local rowCount = 0\n local colCount = 0\n for _, cycle in ipairs(CYCLE_LIST) do\n cycleButtonParams.click_function = \"spawnCycle\" .. cycle\n cycleButtonParams.position = buttonPos\n cycleButtonParams.tooltip = cycle\n self.createButton(cycleButtonParams)\n self.setVar(cycleButtonParams.click_function, function(_, _, _) spawnCycle(cycle) end)\n colCount = colCount + 1\n -- If we've reached the end of a row, shift down and back to the first column\n if colCount \u003e= CYCLE_COLUMN_COUNT then\n buttonPos = CYCLE_BUTTON_START:copy()\n rowCount = rowCount + 1\n colCount = 0\n buttonPos.z = buttonPos.z + CYCLE_BUTTONS_Z_OFFSET * rowCount\n if rowCount == 3 then\n -- Account for two centered buttons on the final row\n buttonPos.x = buttonPos.x + CYCLE_BUTTONS_X_OFFSET / 2\n --[[ Account for centered button on the final row\n buttonPos.x = buttonPos.x + CYCLE_BUTTONS_X_OFFSET\n ]]\n end\n else\n buttonPos.x = buttonPos.x + CYCLE_BUTTONS_X_OFFSET\n end\n end\nend\n\nfunction createClearButton()\n self.createButton({\n function_owner = self,\n click_function = \"deleteAll\",\n position = Vector(0, 0.1, 0.852),\n rotation = Vector(0, 0, 0),\n height = 170,\n width = 750,\n scale = Vector(0.25, 1, 0.25),\n color = TRANSPARENT,\n })\nend\n\nfunction createInvestigatorModeButtons()\n local starterMode = starterDeckMode == STARTER_DECK_MODE_STARTERS\n\n self.createButton({\n function_owner = self,\n click_function = \"setCardsOnlyMode\",\n position = Vector(0.251, 0.1, -0.322),\n rotation = Vector(0, 0, 0),\n height = 170,\n width = 760,\n scale = Vector(0.25, 1, 0.25),\n color = starterMode and TRANSPARENT or STARTER_DECK_MODE_SELECTED_COLOR\n })\n self.createButton({\n function_owner = self,\n click_function = \"setStarterDeckMode\",\n position = Vector(0.66, 0.1, -0.322),\n rotation = Vector(0, 0, 0),\n height = 170,\n width = 760,\n scale = Vector(0.25, 1, 0.25),\n color = starterMode and STARTER_DECK_MODE_SELECTED_COLOR or TRANSPARENT\n })\n local checkX = starterMode and 0.52 or 0.11\n self.createButton({\n function_owner = self,\n label = \"✓\",\n click_function = \"doNothing\",\n position = Vector(checkX, 0.11, -0.317),\n rotation = Vector(0, 0, 0),\n height = 0,\n width = 0,\n scale = Vector(0.3, 1, 0.3),\n font_color = { 0, 0, 0 },\n color = { 1, 1, 1 }\n })\nend\n\nfunction toggleHelp(_, playerColor, _)\n if helpVisibleToPlayers[playerColor] then\n helpVisibleToPlayers[playerColor] = nil\n else\n helpVisibleToPlayers[playerColor] = true\n end\n updateHelpVisibility()\nend\n\nfunction updateHelpVisibility()\n local visibility = \"\"\n for player, _ in pairs(helpVisibleToPlayers) do\n if string.len(visibility) \u003e 0 then\n visibility = visibility .. \"|\" .. player\n else\n visibility = player\n end\n end\n self.UI.setAttribute(\"helpText\", \"visibility\", visibility)\n self.UI.setAttribute(\"helpPanel\", \"visibility\", visibility)\n self.UI.setAttribute(\"helpPanel\", \"active\", string.len(visibility) \u003e 0)\nend\n\nfunction setStarterDeckMode()\n starterDeckMode = STARTER_DECK_MODE_STARTERS\n updateStarterModeButtons()\nend\n\nfunction setCardsOnlyMode()\n starterDeckMode = STARTER_DECK_MODE_CARDS_ONLY\n updateStarterModeButtons()\nend\n\nfunction updateStarterModeButtons()\n local buttonCount = #self.getButtons()\n -- Buttons are 0-indexed, so the last three are -1, -2, and -3 from the size\n self.removeButton(buttonCount - 1)\n self.removeButton(buttonCount - 2)\n self.removeButton(buttonCount - 3)\n createInvestigatorModeButtons()\nend\n\n-- Clears the table and updates positions based on scale. Should be called before ANY card\n-- placement\nfunction prepareToPlaceCards()\n deleteAll()\n scalePositions()\nend\n\n-- Updates the positions based on the current object scale to ensure the relative layout functions\n-- properly at different scales.\nfunction scalePositions()\n -- Assume scaling is consistent in X and Z dimensions\n local scale = 1 / self.getScale().x\n startPositions = { }\n for key, pos in pairs(START_POSITIONS) do\n -- Because a scaled object means a different global size, using global distance for Z results in\n -- the cards being closer or farther depending on the scale. Leave the Z values and only scale\n -- X and Y\n startPositions[key] = Vector(pos)\n startPositions[key].x = startPositions[key].x * scale\n startPositions[key].y = startPositions[key].y * scale\n end\n cardRowOffset = CARD_ROW_OFFSET * scale\n cardGroupOffset = CARD_GROUP_OFFSET * scale\n investigatorPositionShiftRow = Vector(INVESTIGATOR_POSITION_SHIFT_ROW):scale(scale)\n investigatorPositionShiftCol = Vector(INVESTIGATOR_POSITION_SHIFT_COL):scale(scale)\n investigatorCardOffset = Vector(INVESTIGATOR_CARD_OFFSET):scale(scale)\n investigatorSignatureOffset = Vector(INVESTIGATOR_SIGNATURE_OFFSET):scale(scale)\nend\n\n-- Deletes all cards currently placed on the table\nfunction deleteAll()\n spawnBag.recall(true)\nend\n\n-- Spawn an investigator group, based on the current UI setting for either investigators or starter\n-- decks.\n---@param groupName String. Name of the group to spawn, matching a key in InvestigatorPanelData\nfunction spawnInvestigatorGroup(groupName)\n local starterMode = starterDeckMode == STARTER_DECK_MODE_STARTERS\n prepareToPlaceCards()\n Wait.frames(function()\n if starterMode then\n spawnStarters(groupName)\n else\n spawnInvestigators(groupName)\n end\n end, 2)\nend\n\n-- Spawn cards for all investigators in the given group. This creates piles for all defined\n-- investigator cards and minicards as well as the signature cards.\n---@param groupName String. Name of the group to spawn, matching a key in InvestigatorPanelData\nfunction spawnInvestigators(groupName)\n if INVESTIGATOR_GROUPS[groupName] == nil then\n printToAll(\"No \" .. groupName .. \" data yet\")\n return\n end\n\n local col = 1\n local row = 1\n local investigatorCount = #INVESTIGATOR_GROUPS[groupName]\n local position = getInvestigatorRowStartPos(investigatorCount, row)\n\n for i, investigatorName in ipairs(INVESTIGATOR_GROUPS[groupName]) do\n for _, spawnSpec in ipairs(buildInvestigatorSpawnSpec(\n investigatorName, INVESTIGATORS[investigatorName], position, false)) do\n spawnBag.spawn(spawnSpec)\n end\n position:add(investigatorPositionShiftCol)\n col = col + 1\n if col \u003e INVESTIGATOR_MAX_COLS then\n col = 1\n row = row + 1\n position = getInvestigatorRowStartPos(investigatorCount, row)\n end\n end\nend\n\nfunction getInvestigatorRowStartPos(investigatorCount, row)\n local rowStart = Vector(startPositions.investigator)\n rowStart:add(Vector(\n investigatorPositionShiftRow.x * (row - 1),\n investigatorPositionShiftRow.y * (row - 1),\n investigatorPositionShiftRow.z * (row - 1)))\n local investigatorsInRow =\n math.min(investigatorCount - INVESTIGATOR_MAX_COLS * (row - 1), INVESTIGATOR_MAX_COLS)\n rowStart:add(Vector(\n investigatorPositionShiftCol.x * (INVESTIGATOR_MAX_COLS - investigatorsInRow) / 2,\n investigatorPositionShiftCol.y * (INVESTIGATOR_MAX_COLS - investigatorsInRow) / 2,\n investigatorPositionShiftCol.z * (INVESTIGATOR_MAX_COLS - investigatorsInRow) / 2))\n\n return rowStart\nend\n\n-- Creates the spawn spec for the investigator's signature cards.\n---@param investigatorName String. Name of the investigator, matching a key in\n--- InvestigatorPanelData\n---@param investigatorData Table. Spawn definition for the investigator, retrieved from\n--- INVESTIGATORS\n---@param position Vector. Where to spawn the minicard; investigagor cards will be placed below\nfunction buildInvestigatorSpawnSpec(investigatorName, investigatorData, position)\n local sigPos = Vector(position):add(investigatorSignatureOffset)\n local spawns = buildCommonSpawnSpec(investigatorName, investigatorData, position)\n table.insert(spawns, {\n name = investigatorName..\"signatures\",\n cards = investigatorData.signatures,\n globalPos = self.positionToWorld(sigPos),\n rotation = FACE_UP_ROTATION,\n })\n\n return spawns\nend\n\n-- Builds the spawn specs for minicards and investigator cards. These are common enough to be\n-- shared, and will only differ in whether they spawn the full stack of possible investigator and\n-- minicards, or only the first of each.\n---@param investigatorName String. Name of the investigator, matching a key in\n--- InvestigatorPanelData\n---@param investigatorData Table. Spawn definition for the investigator, retrieved from\n--- INVESTIGATORS\n---@param position Vector. Where to spawn the minicard; investigagor cards will be placed below\n---@param oneCardOnly Boolean. If true, will spawn only the first card in the investigator card\n--- and minicard lists. Otherwise, spawn them all in a deck\nfunction buildCommonSpawnSpec(investigatorName, investigatorData, position, oneCardOnly)\n local cardPos = Vector(position):add(investigatorCardOffset)\n return {\n {\n name = investigatorName..\"minicards\",\n cards = oneCardOnly and { investigatorData.minicards[1] } or investigatorData.minicards,\n globalPos = self.positionToWorld(position),\n rotation = FACE_UP_ROTATION,\n },\n {\n name = investigatorName..\"cards\",\n cards = oneCardOnly and { investigatorData.cards[1] } or investigatorData.cards,\n globalPos = self.positionToWorld(cardPos),\n rotation = FACE_UP_ROTATION,\n },\n }\nend\n\n-- Spawns all starter decks (single minicard and investigator card, plus the starter deck) for\n-- investigators in the given group.\n---@param groupName String. Name of the group to spawn, matching a key in InvestigatorPanelData\nfunction spawnStarters(groupName)\n local col = 1\n local row = 1\n local investigatorCount = #INVESTIGATOR_GROUPS[groupName]\n local position = getInvestigatorRowStartPos(investigatorCount, row)\n for _, investigatorName in ipairs(INVESTIGATOR_GROUPS[groupName]) do\n spawnStarterDeck(investigatorName, INVESTIGATORS[investigatorName], position)\n position:add(investigatorPositionShiftCol)\n col = col + 1\n if col \u003e INVESTIGATOR_MAX_COLS then\n col = 1\n row = row + 1\n position = getInvestigatorRowStartPos(investigatorCount, row)\n end\n end\nend\n\n-- Spawns the defined starter deck for the given investigator's.\n---@param investigatorName String. Name of the investigator, matching a key in\n--- InvestigatorPanelData\nfunction spawnStarterDeck(investigatorName, investigatorData, position)\n for _, spawnSpec in ipairs(\n buildCommonSpawnSpec(investigatorName, INVESTIGATORS[investigatorName], position, true)) do\n spawnBag.spawn(spawnSpec)\n end\n local deckPos = Vector(position):add(investigatorSignatureOffset)\n arkhamDb.getDecklist(\"None\", investigatorData.starterDeck, true, false, false, function(slots)\n local cardIdList = { }\n for id, count in pairs(slots) do\n for i = 1, count do\n table.insert(cardIdList, id)\n end\n end\n spawnBag.spawn({\n name = investigatorName..\"starter\",\n cards = cardIdList,\n globalPos = self.positionToWorld(deckPos),\n rotation = FACE_DOWN_ROTATION\n })\n end)\nend\n-- Clears the currently placed cards, then places cards for the given class and level spread\n---@param cardClass String. Class to place (\"Guardian\", \"Seeker\", etc)\n---@param isUpgraded Boolean. If true, spawn the Level 1-5 cards. Otherwise, Level 0.\nfunction spawnClassCards(cardClass, isUpgraded)\n prepareToPlaceCards()\n Wait.frames(function() placeClassCards(cardClass, isUpgraded) end, 2)\nend\n\n-- Spawn the class cards.\n---@param cardClass String. Class to place (\"Guardian\", \"Seeker\", etc)\n---@param isUpgraded Boolean. If true, spawn the Level 1-5 cards. Otherwise, Level 0.\nfunction placeClassCards(cardClass, isUpgraded)\n local indexReady = allCardsBagApi.isIndexReady()\n if (not indexReady) then\n broadcastToAll(\"Still loading player cards, please try again in a few seconds\", {0.9, 0.2, 0.2})\n return\n end\n local cardIdList = allCardsBagApi.getCardsByClassAndLevel(cardClass, isUpgraded)\n\n local skillList = { }\n local eventList = { }\n local assetList = { }\n for _, cardId in ipairs(cardIdList) do\n local cardMetadata = allCardsBagApi.getCardById(cardId).metadata\n if (cardMetadata.type == \"Skill\") then\n table.insert(skillList, cardId)\n elseif (cardMetadata.type == \"Event\") then\n table.insert(eventList, cardId)\n elseif (cardMetadata.type == \"Asset\") then\n table.insert(assetList, cardId)\n end\n end\n local groupPos = Vector(startPositions.classCards)\n if #skillList \u003e 0 then\n spawnBag.spawn({\n name = cardClass .. (isUpgraded and \"upgraded\" or \"basic\"),\n cards = skillList,\n globalPos = self.positionToWorld(groupPos),\n rotation = FACE_UP_ROTATION,\n spread = true,\n spreadCols = 20\n })\n groupPos.z = groupPos.z + math.ceil(#skillList / 20) * cardRowOffset + cardGroupOffset\n end\n if #eventList \u003e 0 then\n spawnBag.spawn({\n name = cardClass .. \"event\" .. (isUpgraded and \"upgraded\" or \"basic\"),\n cards = eventList,\n globalPos = self.positionToWorld(groupPos),\n rotation = FACE_UP_ROTATION,\n spread = true,\n spreadCols = 20\n })\n groupPos.z = groupPos.z + math.ceil(#eventList / 20) * cardRowOffset + cardGroupOffset\n end\n if #assetList \u003e 0 then\n spawnBag.spawn({\n name = cardClass .. \"asset\" .. (isUpgraded and \"upgraded\" or \"basic\"),\n cards = assetList,\n globalPos = self.positionToWorld(groupPos),\n rotation = FACE_UP_ROTATION,\n spread = true,\n spreadCols = 20\n })\n end\nend\n\n-- Spawns the investigator sets and all cards for the given cycle\n---@param cycle String Name of a cycle, should match the standard used in card metadata\nfunction spawnCycle(cycle)\n prepareToPlaceCards()\n spawnInvestigators(cycle)\n local indexReady = allCardsBagApi.isIndexReady()\n if (not indexReady) then\n broadcastToAll(\"Still loading player cards, please try again in a few seconds\", {0.9, 0.2, 0.2})\n return\n end\n local cycleCardList = allCardsBagApi.getCardsByCycle(cycle)\n local copiedList = { }\n for i, id in ipairs(cycleCardList) do\n copiedList[i] = id\n end\n spawnBag.spawn({\n name = \"cycle\"..cycle,\n cards = copiedList,\n globalPos = self.positionToWorld(startPositions.cycle),\n rotation = FACE_UP_ROTATION,\n spread = true,\n spreadCols = 20\n })\nend\n\nfunction spawnBonded()\n prepareToPlaceCards()\n spawnBag.spawn({\n name = \"bonded\",\n cards = BONDED_CARD_LIST,\n globalPos = self.positionToWorld(startPositions.classCards),\n rotation = FACE_UP_ROTATION,\n spread = true,\n spreadCols = 20\n })\nend\n\nfunction spawnUpgradeSheets()\n prepareToPlaceCards()\n spawnBag.spawn({\n name = \"upgradeSheets\",\n cards = UPGRADE_SHEET_LIST,\n globalPos = self.positionToWorld(startPositions.classCards),\n rotation = FACE_UP_ROTATION,\n spread = true,\n spreadCols = 20\n })\n spawnBag.spawn({\n name = \"servitor\",\n cards = { \"09080-m\" },\n globalPos = self.positionToWorld(startPositions.summonedServitor),\n rotation = FACE_UP_ROTATION,\n })\nend\n\n-- Clears the current cards, and places all basic weaknesses on the table.\nfunction spawnWeaknesses()\n prepareToPlaceCards()\n local indexReady = allCardsBagApi.isIndexReady()\n if (not indexReady) then\n broadcastToAll(\"Still loading player cards, please try again in a few seconds\", {0.9, 0.2, 0.2})\n return\n end\n local weaknessIdList = allCardsBagApi.getUniqueWeaknesses()\n local basicWeaknessList = { }\n local otherWeaknessList = { }\n for i, id in ipairs(weaknessIdList) do\n local cardMetadata = allCardsBagApi.getCardById(id).metadata\n if cardMetadata.basicWeaknessCount ~= nil and cardMetadata.basicWeaknessCount \u003e 0 then\n table.insert(basicWeaknessList, id)\n elseif excludedNonBasicWeaknesses[id] == nil then\n table.insert(otherWeaknessList, id)\n end\n end\n local groupPos = Vector(startPositions.classCards)\n spawnBag.spawn({\n name = \"basicWeaknesses\",\n cards = basicWeaknessList,\n globalPos = self.positionToWorld(groupPos),\n rotation = FACE_UP_ROTATION,\n spread = true,\n spreadCols = 20\n })\n groupPos.z = groupPos.z + math.ceil(#basicWeaknessList / 20) * cardRowOffset + cardGroupOffset\n spawnBag.spawn({\n name = \"evolvedWeaknesses\",\n cards = EVOLVED_WEAKNESSES,\n globalPos = self.positionToWorld(groupPos),\n rotation = FACE_UP_ROTATION,\n spread = true,\n spreadCols = 20\n })\n groupPos.z = groupPos.z + math.ceil(#EVOLVED_WEAKNESSES / 20) * cardRowOffset + cardGroupOffset\n spawnBag.spawn({\n name = \"otherWeaknesses\",\n cards = otherWeaknessList,\n globalPos = self.positionToWorld(groupPos),\n rotation = FACE_UP_ROTATION,\n spread = true,\n spreadCols = 20\n })\nend\n\nfunction spawnRandomWeakness()\n prepareToPlaceCards()\n local weaknessId = allCardsBagApi.getRandomWeaknessId()\n if (weaknessId == nil) then\n broadcastToAll(\"All basic weaknesses are in play!\", {0.9, 0.2, 0.2})\n return\n end\n spawnBag.spawn({\n name = \"randomWeakness\",\n cards = { weaknessId },\n globalPos = self.positionToWorld(startPositions.randomWeakness),\n rotation = FACE_UP_ROTATION,\n })\nend\nend)\n__bundle_register(\"playercards/AllCardsBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local AllCardsBagApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getAllCardsBag()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"AllCardsBag\")\n end\n\n -- Returns a specific card from the bag, based on ArkhamDB ID\n ---@param id table String ID of the card to retrieve\n ---@return table table\n -- If the indexes are still being constructed, an empty table is\n -- returned. Otherwise, a single table with the following fields\n -- cardData: TTS object data, suitable for spawning the card\n -- cardMetadata: Table of parsed metadata\n AllCardsBagApi.getCardById = function(id)\n return getAllCardsBag().call(\"getCardById\", {id = id})\n end\n\n -- Gets a random basic weakness from the bag. Once a given ID has been returned\n -- it will be removed from the list and cannot be selected again until a reload\n -- occurs or the indexes are rebuilt, which will refresh the list to include all\n -- weaknesses.\n ---@return id String ID of the selected weakness.\n AllCardsBagApi.getRandomWeaknessId = function()\n return getAllCardsBag().call(\"getRandomWeaknessId\")\n end\n\n AllCardsBagApi.isIndexReady = function()\n return getAllCardsBag().call(\"isIndexReady\")\n end\n\n -- Called by Hotfix bags when they load. If we are still loading indexes, then\n -- the all cards and hotfix bags are being loaded together, and we can ignore\n -- this call as the hotfix will be included in the initial indexing. If it is\n -- called once indexing is complete it means the hotfix bag has been added\n -- later, and we should rebuild the index to integrate the hotfix bag.\n AllCardsBagApi.rebuildIndexForHotfix = function()\n return getAllCardsBag().call(\"rebuildIndexForHotfix\")\n end\n\n -- Searches the bag for cards which match the given name and returns a list. Note that this is\n -- an O(n) search without index support. It may be slow.\n ---@param name String or string fragment to search for names\n ---@param exact Boolean Whether the name match should be exact\n AllCardsBagApi.getCardsByName = function(name, exact)\n return getAllCardsBag().call(\"getCardsByName\", {name = name, exact = exact})\n end\n\n AllCardsBagApi.isBagPresent = function()\n return getAllCardsBag() and true\n end\n\n -- Returns a list of cards from the bag matching a class and level (0 or upgraded)\n ---@param class String class to retrieve (\"Guardian\", \"Seeker\", etc)\n ---@param upgraded Boolean true for upgraded cards (Level 1-5), false for Level 0\n ---@return: If the indexes are still being constructed, returns an empty table.\n -- Otherwise, a list of tables, each with the following fields\n -- cardData: TTS object data, suitable for spawning the card\n -- cardMetadata: Table of parsed metadata\n AllCardsBagApi.getCardsByClassAndLevel = function(class, upgraded)\n return getAllCardsBag().call(\"getCardsByClassAndLevel\", {class = class, upgraded = upgraded})\n end\n\n AllCardsBagApi.getCardsByCycle = function(cycle)\n return getAllCardsBag().call(\"getCardsByCycle\", cycle)\n end\n\n AllCardsBagApi.getUniqueWeaknesses = function()\n return getAllCardsBag().call(\"getUniqueWeaknesses\")\n end\n\n return AllCardsBagApi\nend\nend)\n__bundle_register(\"playercards/PlayerCardPanelData\", function(require, _LOADED, __bundle_register, __bundle_modules)\nBONDED_CARD_LIST = {\n\t\"05314\", -- Soothing Melody\n\t\"06277\", -- Wish Eater\n\t\"06019\", -- Bloodlust\n\t\"06022\", -- Pendant of the Queen\n\t\"05317\", -- Blood-rite\n\t\"06113\", -- Essence of the Dream\n\t\"06028\", -- Stars Are Right\n\t\"06025\", -- Guardian of the Crystallizer\n\t\"06283\", -- Unbound Beast\n\t\"06032\", -- Zeal\n\t\"06031\", -- Hope\n\t\"06033\", -- Augur\n\t\"06331\", -- Dream Parasite\n\t\"06015a\", -- Dream-Gate\n\t\"10045\" -- Uncanny Growth\n}\n\nUPGRADE_SHEET_LIST = {\n\t\"09040-c\", -- Alchemical Distillation\n\t\"09023-c\", -- Custom Modifications\n\t\"09059-c\", -- Damning Testimony\n\t\"09041-c\", -- Emperical Hypothesis\n\t\"09060-c\", -- Friends in Low Places\n\t\"09101-c\", -- Grizzled\n\t\"09061-c\", -- Honed Instinct\n\t\"09021-c\", -- Hunter's Armor\n\t\"09119-c\", -- Hyperphysical Shotcaster\n\t\"09079-c\", -- Living Ink\n\t\"09100-c\", -- Makeshift Trap\n\t\"09099-c\", -- Pocket Multi Tool\n\t\"09081-c\", -- Power Word\n\t\"09081-t-c\", -- Power Word (Taboo)\n\t\"09022-c\", -- Runic Axe\n\t\"09022-t-c\", -- Runic Axe (Taboo)\n\t\"09080-c\", -- Summoned Servitor\n\t\"09042-c\", -- Raven's Quill\n}\n\nEVOLVED_WEAKNESSES = {\n\t\"04039\",\n\t\"04041\",\n\t\"04042\",\n\t\"53014\",\n\t\"53015\",\n}\n\n------------------ START INVESTIGATOR DATA DEFINITION ------------------\nINVESTIGATOR_GROUPS = {\n [\"Guardian\"] = {\n \"Roland Banks\",\n \t\"Zoey Samaras\",\n \t\"Mark Harrigan\",\n \t\"Leo Anderson\",\n \t\"Carolyn Fern\",\n \t\"Tommy Muldoon\",\n \t\"Nathaniel Cho\",\n \t\"Sister Mary\",\n \t\"Daniela Reyes\",\n \t\"Carson Sinclair\",\n\t\t\"Wilson Richards\"\n },\n [\"Seeker\"] = {\n \"Daisy Walker\",\n \t\"Rex Murphy\",\n \t\"Minh Thi Phan\",\n \t\"Ursula Downs\",\n \t\"Joe Diamond\",\n \t\"Mandy Thompson\",\n \t\"Harvey Walters\",\n \t\"Amanda Sharpe\",\n \t\"Norman Withers\",\n \t\"Vincent Lee\"\n },\n [\"Rogue\"] = {\n \t\"\\\"Skids\\\" O'Toole\",\n \t\"Jenny Barnes\",\n \t\"Sefina Rousseau\",\n \t\"Finn Edwards\",\n \t\"Preston Fairmont\",\n \t\"Tony Morgan\",\n \t\"Winifred Habbamock\",\n \t\"Trish Scarborough\",\n \t\"Monterey Jack\",\n \t\"Kymani Jones\",\n\t\t\"Alessandra Zorzi\"\n },\n [\"Mystic\"] = {\n \t\"Agnes Baker\",\n \t\"Jim Culver\",\n \t\"Akachi Onyele\",\n \t\"Father Mateo\",\n \t\"Diana Stanley\",\n \t\"Marie Lambeau\",\n \t\"Luke Robinson\",\n \t\"Jacqueline Fine\",\n \t\"Dexter Drake\",\n \t\"Lily Chen\",\n \t\"Amina Zidane\",\n \t\"Gloria Goldberg\"\n },\n [\"Survivor\"] = {\n \t\"Wendy Adams\",\n \t\"\\\"Ashcan\\\" Pete\",\n \t\"William Yorick\",\n \t\"Calvin Wright\",\n \t\"Rita Young\",\n \t\"Patrice Hathaway\",\n \t\"Stella Clark\",\n \t\"Silas Marsh\",\n \t\"Bob Jenkins\",\n \t\"Darrell Simmons\"\n },\n [\"Neutral\"] = {\n \t\"Lola Hayes\",\n \t\"Charlie Kane\",\n \t\"Subject 5U-21\"\n },\n [\"Core\"] = {\n \"Roland Banks\",\n \"Daisy Walker\",\n \"\\\"Skids\\\" O'Toole\",\n \"Agnes Baker\",\n \"Wendy Adams\"\n },\n [\"The Dunwich Legacy\"] = {\n \t\"Zoey Samaras\",\n \t\"Rex Murphy\",\n \t\"Jenny Barnes\",\n \t\"Jim Culver\",\n \t\"\\\"Ashcan\\\" Pete\"\n },\n [\"The Path to Carcosa\"] = {\n \t\"Mark Harrigan\",\n \t\"Minh Thi Phan\",\n \t\"Sefina Rousseau\",\n \t\"Akachi Onyele\",\n \t\"William Yorick\",\n \t\"Lola Hayes\"\n },\n [\"The Forgotten Age\"] = {\n \t\"Leo Anderson\",\n \t\"Ursula Downs\",\n \t\"Finn Edwards\",\n \t\"Father Mateo\",\n \t\"Calvin Wright\"\n },\n [\"The Circle Undone\"] = {\n \t\"Carolyn Fern\",\n \t\"Joe Diamond\",\n \t\"Preston Fairmont\",\n \t\"Diana Stanley\",\n \t\"Rita Young\",\n \t\"Marie Lambeau\"\n },\n [\"The Dream-Eaters\"] = {\n \t\"Tommy Muldoon\",\n \t\"Mandy Thompson\",\n \t\"Tony Morgan\",\n \t\"Luke Robinson\",\n \t\"Patrice Hathaway\"\n },\n [\"Investigator Packs\"] = {\n \t\"Nathaniel Cho\",\n \t\"Harvey Walters\",\n \t\"Winifred Habbamock\",\n \t\"Jacqueline Fine\",\n \t\"Stella Clark\",\n \t\"Gloria Goldberg\"\n },\n [\"The Innsmouth Conspiracy\"] = {\n \t\"Sister Mary\",\n \t\"Amanda Sharpe\",\n \t\"Trish Scarborough\",\n \t\"Dexter Drake\",\n \t\"Silas Marsh\"\n },\n [\"Edge of the Earth\"] = {\n \t\"Daniela Reyes\",\n \t\"Norman Withers\",\n \t\"Monterey Jack\",\n \t\"Lily Chen\",\n \t\"Bob Jenkins\"\n },\n [\"The Scarlet Keys\"] = {\n \t\"Carson Sinclair\",\n \t\"Vincent Lee\",\n \t\"Kymani Jones\",\n \t\"Amina Zidane\",\n \t\"Darrell Simmons\",\n \t\"Charlie Kane\"\n },\n\t[\"The Feast of Hemlock Vale\"] = {\n\t\t\"Alessandra Zorzi\",\n\t\t\"Wilson Richards\"\n\t}\n}\n\nINVESTIGATORS = {}\n--Core--\nINVESTIGATORS[\"Roland Banks\"] = {\n\tcards = { \"01001\", \"01001-p\", \"01001-pf\", \"01001-pb\" },\n\tminicards = { \"01001-m\" },\n\tsignatures = { \"01006\", \"01007\", \"90030\", \"90031\", \"90025\", \"90026\", \"90027\", \"90028\", \"90029\", \"98005\", \"98006\" },\n\tstarterDeck = \"2624931\"\n}\nINVESTIGATORS[\"Daisy Walker\"] = {\n\tcards = { \"01002\", \"01002-p\", \"01002-pf\", \"01002-pb\" },\n\tminicards = { \"01002-m\" },\n\tsignatures = { \"01008\", \"01009\", \"90002\", \"90003\" },\n\tstarterDeck = \"2624938\"\n}\nINVESTIGATORS[\"\\\"Skids\\\" O'Toole\"] = {\n\tcards = { \"01003\", \"01003-p\", \"01003-pf\", \"01003-pb\" },\n\tminicards = { \"01003-m\" },\n\tsignatures = { \"01010\", \"01011\", \"90009\", \"90010\" },\n\tstarterDeck = \"2624940\"\n}\nINVESTIGATORS[\"Agnes Baker\"] = {\n\tcards = { \"01004\", \"01004-p\", \"01004-pf\", \"01004-pb\" },\n\tminicards = { \"01004-m\" },\n\tsignatures = { \"01012\", \"01013\", \"90018\", \"90019\" },\n\tstarterDeck = \"2624944\"\n}\nINVESTIGATORS[\"Wendy Adams\"] = {\n\tcards = { \"01005\", \"01005-p\", \"01005-pf\", \"01005-pb\" },\n\tminicards = { \"01005-m\" },\n\tsignatures = { \"01014\", \"01015\", \"01515\", \"90039\", \"90040\", \"90038\" },\n\tstarterDeck = \"2624949\"\n}\n--Dunwich--\nINVESTIGATORS[\"Zoey Samaras\"] = {\n\tcards = { \"02001\", \"02001-p\", \"02001-pf\", \"02001-pb\" },\n\tminicards = { \"02001-m\" },\n\tsignatures = { \"02006\", \"02007\", \"90060\", \"90061\" },\n\tstarterDeck = \"2624950\"\n}\nINVESTIGATORS[\"Rex Murphy\"] = {\n\tcards = { \"02002\", \"02002-t\" },\n\tminicards = { \"02002-m\" },\n\tsignatures = { \"02008\", \"02009\" },\n\tstarterDeck = \"2624958\"\n}\nINVESTIGATORS[\"Jenny Barnes\"] = {\n\tcards = { \"02003\" },\n\tminicards = { \"02003-m\" },\n\tsignatures = { \"02010\", \"02011\", \"98002\", \"98003\" },\n\tstarterDeck = \"2624961\"\n}\nINVESTIGATORS[\"Jim Culver\"] = {\n\tcards = { \"02004\", \"02004-p\", \"02004-pf\", \"02004-pb\" },\n\tminicards = { \"02004-m\" },\n\tsignatures = { \"02012\", \"02013\", \"90050\", \"90051\", \"90052\", \"90053\" },\n\tstarterDeck = \"2624965\"\n}\nINVESTIGATORS[\"\\\"Ashcan\\\" Pete\"] = {\n\tcards = { \"02005\", \"02005-p\", \"02005-pf\", \"02005-pb\" },\n\tminicards = { \"02005-m\" },\n\tsignatures = { \"02014\", \"02015\", \"90047\", \"90048\" },\n\tstarterDeck = \"2624969\"\n}\n--Carcosa--\nINVESTIGATORS[\"Mark Harrigan\"] = {\n\tcards = { \"03001\" },\n\tminicards = { \"03001-m\" },\n\tsignatures = { \"03007\", \"03008\", \"03009\" },\n\tstarterDeck = \"2624975\"\n}\nINVESTIGATORS[\"Minh Thi Phan\"] = {\n\tcards = { \"03002\" },\n\tminicards = { \"03002-m\" },\n\tsignatures = { \"03010\", \"03011\" },\n\tstarterDeck = \"2624979\"\n}\nINVESTIGATORS[\"Sefina Rousseau\"] = {\n\tcards = { \"03003\" },\n\tminicards = { \"03003-m\" },\n\tsignatures = { \"03012\", \"03012\", \"03012\", \"03013\" },\n\tstarterDeck = \"2624981\"\n}\nINVESTIGATORS[\"Akachi Onyele\"] = {\n\tcards = { \"03004\" },\n\tminicards = { \"03004-m\" },\n\tsignatures = { \"03014\", \"03015\" },\n\tstarterDeck = \"2624984\"\n}\nINVESTIGATORS[\"William Yorick\"] = {\n\tcards = { \"03005\" },\n\tminicards = { \"03005-m\" },\n\tsignatures = { \"03016\", \"03017\" },\n\tstarterDeck = \"2624988\"\n}\nINVESTIGATORS[\"Lola Hayes\"] = {\n\tcards = { \"03006\", \"03006-t\" },\n\tminicards = { \"03006-m\" },\n\tsignatures = { \"03018\", \"03018\", \"03019\", \"03019\", \"03019-t\", \"03019-t\" },\n\tstarterDeck = \"2624990\"\n}\n--Forgotten--\nINVESTIGATORS[\"Leo Anderson\"] = {\n\tcards = { \"04001\" },\n\tminicards = { \"04001-m\" },\n\tsignatures = { \"04006\", \"04007\" },\n\tstarterDeck = \"2624994\"\n}\nINVESTIGATORS[\"Ursula Downs\"] = {\n\tcards = { \"04002\" },\n\tminicards = { \"04002-m\" },\n\tsignatures = { \"04008\", \"04009\" },\n\tstarterDeck = \"2625000\"\n}\nINVESTIGATORS[\"Finn Edwards\"] = {\n\tcards = { \"04003\" },\n\tminicards = { \"04003-m\" },\n\tsignatures = { \"04010\", \"04011\", \"04012\" },\n\tstarterDeck = \"2625003\"\n}\nINVESTIGATORS[\"Father Mateo\"] = {\n\tcards = { \"04004\" },\n\tminicards = { \"04004-m\" },\n\tsignatures = { \"04013\", \"04014\" },\n\tstarterDeck = \"2625005\"\n}\nINVESTIGATORS[\"Calvin Wright\"] = {\n\tcards = { \"04005\" },\n\tminicards = { \"04005-m\" },\n\tsignatures = { \"04015\", \"04016\" },\n\tstarterDeck = \"2625007\"\n}\n--Circle--\nINVESTIGATORS[\"Carolyn Fern\"] = {\n\tcards = { \"05001\" },\n\tminicards = { \"05001-m\" },\n\tsignatures = { \"05007\", \"05008\", \"98011\", \"98012\" },\n\tstarterDeck = \"2626342\"\n}\nINVESTIGATORS[\"Joe Diamond\"] = {\n\tcards = { \"05002\" },\n\tminicards = { \"05002-m\" },\n\tsignatures = { \"05009\", \"05010\" },\n\tstarterDeck = \"2626347\"\n}\nINVESTIGATORS[\"Preston Fairmont\"] = {\n\tcards = { \"05003\" },\n\tminicards = { \"05003-m\" },\n\tsignatures = { \"05011\", \"05012\" },\n\tstarterDeck = \"2626365\"\n}\nINVESTIGATORS[\"Diana Stanley\"] = {\n\tcards = { \"05004\" },\n\tminicards = { \"05004-m\" },\n\tsignatures = { \"05013\", \"05014\", \"05015\" },\n\tstarterDeck = \"2626385\"\n}\nINVESTIGATORS[\"Rita Young\"] = {\n\tcards = { \"05005\" },\n\tminicards = { \"05005-m\" },\n\tsignatures = { \"05016\", \"05017\" },\n\tstarterDeck = \"2626387\"\n}\nINVESTIGATORS[\"Marie Lambeau\"] = {\n\tcards = { \"05006\" },\n\tminicards = { \"05006-m\" },\n\tsignatures = { \"05018\", \"05019\" },\n\tstarterDeck = \"2626395\"\n}\n--Dream--\nINVESTIGATORS[\"Tommy Muldoon\"] = {\n\tcards = { \"06001\" },\n\tminicards = { \"06001-m\" },\n\tsignatures = { \"06006\", \"06007\" },\n\tstarterDeck = \"2626402\"\n}\nINVESTIGATORS[\"Mandy Thompson\"] = {\n\tcards = { \"06002\", \"06002-t\" },\n\tminicards = { \"06002-m\" },\n\tsignatures = { \"06008\", \"06008\", \"06008\", \"06009\" },\n\tstarterDeck = \"2626410\"\n}\nINVESTIGATORS[\"Tony Morgan\"] = {\n\tcards = { \"06003\" },\n\tminicards = { \"06003-m\" },\n\tsignatures = { \"06010\", \"06011\", \"06011\", \"06012\" },\n\tstarterDeck = \"2626446\"\n}\nINVESTIGATORS[\"Luke Robinson\"] = {\n\tcards = { \"06004\" },\n\tminicards = { \"06004-m\" },\n\tsignatures = { \"06013\", \"06014\", \"06015\" },\n\tstarterDeck = \"2626452\"\n}\nINVESTIGATORS[\"Patrice Hathaway\"] = {\n\tcards = { \"06005\" },\n\tminicards = { \"06005-m\" },\n\tsignatures = { \"06016\", \"06017\" },\n\tstarterDeck = \"2626461\"\n}\n--Starter--\nINVESTIGATORS[\"Nathaniel Cho\"] = {\n\tcards = { \"60101\" },\n\tminicards = { \"60101-m\" },\n\tsignatures = { \"60102\", \"60103\" },\n\tstarterDeck = \"2643925\"\n}\nINVESTIGATORS[\"Harvey Walters\"] = {\n\tcards = { \"60201\" },\n\tminicards = { \"60201-m\" },\n\tsignatures = { \"60202\", \"60203\" },\n\tstarterDeck = \"2643928\"\n}\nINVESTIGATORS[\"Winifred Habbamock\"] = {\n\tcards = { \"60301\" },\n\tminicards = { \"60301-m\" },\n\tsignatures = { \"60302\", \"60303\" },\n\tstarterDeck = \"2643931\"\n}\nINVESTIGATORS[\"Jacqueline Fine\"] = {\n\tcards = { \"60401\" },\n\tminicards = { \"60401-m\" },\n\tsignatures = { \"60402\", \"60403\" },\n\tstarterDeck = \"2643932\"\n}\nINVESTIGATORS[\"Stella Clark\"] = {\n\tcards = { \"60501\" },\n\tminicards = { \"60501-m\" },\n\tsignatures = { \"60502\", \"60502\", \"60502\", \"60503\" },\n\tstarterDeck = \"2643934\"\n}\n--Innsmouth--\nINVESTIGATORS[\"Sister Mary\"] = {\n\tcards = { \"07001\" },\n\tminicards = { \"07001-m\" },\n\tsignatures = { \"07006\", \"07007\" },\n\tstarterDeck = \"2626464\"\n}\nINVESTIGATORS[\"Amanda Sharpe\"] = {\n\tcards = { \"07002\" },\n\tminicards = { \"07002-m\" },\n\tsignatures = { \"07008\", \"07009\" },\n\tstarterDeck = \"2626469\"\n}\nINVESTIGATORS[\"Trish Scarborough\"] = {\n\tcards = { \"07003\", \"07003-t\" },\n\tminicards = { \"07003-m\" },\n\tsignatures = { \"07010\", \"07011\" },\n\tstarterDeck = \"2626479\"\n}\nINVESTIGATORS[\"Dexter Drake\"] = {\n\tcards = { \"07004\" },\n\tminicards = { \"07004-m\" },\n\tsignatures = { \"07012\", \"07013\", \"98017\", \"98018\" },\n\tstarterDeck = \"2626672\"\n}\nINVESTIGATORS[\"Silas Marsh\"] = {\n\tcards = { \"07005\" },\n\tminicards = { \"07005-m\" },\n\tsignatures = { \"07014\", \"07015\", \"07016\", \"98014\", \"98015\" },\n\tstarterDeck = \"2626685\"\n}\n--Edge--\nINVESTIGATORS[\"Daniela Reyes\"] = {\n\tcards = { \"08001\" },\n\tminicards = { \"08001-m\" },\n\tsignatures = { \"08002\", \"08003\" },\n\tstarterDeck = \"2634588\"\n}\nINVESTIGATORS[\"Norman Withers\"] = {\n\tcards = { \"08004\" },\n\tminicards = { \"08004-m\" },\n\tsignatures = { \"08005\", \"08006\", \"98008\", \"98009\" },\n\tstarterDeck = \"2634603\"\n}\nINVESTIGATORS[\"Monterey Jack\"] = {\n\tcards = { \"08007\" },\n\tminicards = { \"08007-m\" },\n\tsignatures = { \"08008\", \"08009\" },\n\tstarterDeck = \"2634652\"\n}\nINVESTIGATORS[\"Lily Chen\"] = {\n\tcards = { \"08010\" },\n\tminicards = { \"08010-m\" },\n\tsignatures = { \"08011a\", \"08012a\", \"08013a\", \"08014a\", \"08015\", \"08015\", \"08015\", \"08015\" },\n\tstarterDeck = \"2634658\"\n}\nINVESTIGATORS[\"Bob Jenkins\"] = {\n\tcards = { \"08016\" },\n\tminicards = { \"08016-m\" },\n\tsignatures = { \"08017\", \"08018\" },\n\tstarterDeck = \"2634643\"\n}\n--Scarlet--\nINVESTIGATORS[\"Carson Sinclair\"] = {\n\tcards = { \"09001\" },\n\tminicards = { \"09001-m\" },\n\tsignatures = { \"09002\", \"09002\", \"09003\" },\n\tstarterDeck = \"2634667\"\n}\nINVESTIGATORS[\"Vincent Lee\"] = {\n\tcards = { \"09004\" },\n\tminicards = { \"09004-m\" },\n\tsignatures = { \"09005\", \"09006\", \"09006\", \"09006\", \"09006\", \"09007\" },\n\tstarterDeck = \"2634675\"\n}\nINVESTIGATORS[\"Kymani Jones\"] = {\n\tcards = { \"09008\" },\n\tminicards = { \"09008-m\" },\n\tsignatures = { \"09009\", \"09010\" },\n\tstarterDeck = \"2634701\"\n}\nINVESTIGATORS[\"Amina Zidane\"] = {\n\tcards = { \"09011\" },\n\tminicards = { \"09011-m\" },\n\tsignatures = { \"09012\", \"09013\", \"09014\" },\n\tstarterDeck = \"2634697\"\n}\nINVESTIGATORS[\"Darrell Simmons\"] = {\n\tcards = { \"09015\" },\n\tminicards = { \"09015-m\" },\n\tsignatures = { \"09016\", \"09017\" },\n\tstarterDeck = \"2634757\"\n}\nINVESTIGATORS[\"Charlie Kane\"] = {\n\tcards = { \"09018\" },\n\tminicards = { \"09018-m\" },\n\tsignatures = { \"09019\", \"09020\" },\n\tstarterDeck = \"2634706\"\n}\n--Hemlock Vale--\nINVESTIGATORS[\"Alessandra Zorzi\"] = {\n\tcards = { \"10009\" },\n\tminicards = { \"10009-m\" },\n\tsignatures = { \"10010\", \"10010\", \"10010\", \"10011\" },\n\tstarterDeck = \"2643931\" --winifred deck as placeholder\n}\nINVESTIGATORS[\"Wilson Richards\"] = {\n\tcards = { \"10001\" },\n\tminicards = { \"10001-m\" },\n\tsignatures = { \"10002\", \"10003\" },\n\tstarterDeck = \"2634667\" --carson deck as placeholder\n}\n--PnP--\nINVESTIGATORS[\"Subject 5U-21\"] = {\n\tcards = { \"89001\" },\n\tminicards = { \"89001-m\" },\n\tsignatures = { \"89002\", \"89003\", \"89003\", \"89003\", \"89004\", \"89004\", \"89004\", \"89005\" },\n\tstarterDeck = \"2624990\" -- Lola's deck id until Suzi is on ArkhamDB\n}\n--Promo--\nINVESTIGATORS[\"Gloria Goldberg\"] = {\n\tcards = { \"98019\" },\n\tminicards = { \"98019-m\" },\n\tsignatures = { \"98020\", \"98021\" },\n\tstarterDeck = \"2636199\"\n}\n------------------ END INVESTIGATOR DATA DEFINITION ------------------\nend)\n__bundle_register(\"playercards/SpawnBag\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"playercards/PlayerCardSpawner\")\n\n-- Allows spawning of defined lists of cards which will be created from the template in the All\n-- Player Cards bag. SpawnBag.spawn will create objects based on a table definition, while\n-- SpawnBag.recall will clean them all up. Recall will be limited to a small area around the\n-- spawned objects. Objects moved out of this area will not be cleaned up.\n--\n-- SpawnSpec: Spawning requires a spawn specification with the following structure:\n-- {\n-- name: Name of this spawn content, used for internal tracking. Multiple specs can be spawned,\n-- but each requires a separate name\n-- cards: A list of card IDs to be spawned\n-- globalPos: Where the spawned objects should be placed, in global coordinates. This should be\n-- a valid Vector with x, y, and z defined, e.g. { x = 5, y = 1, z = 15 }\n-- rotation: Rotation for the spawned objects. X=180 should be used for face down items. As with\n-- globalPos, this should be a valid Vector with x, y, and z defined\n-- spread: Optional Boolean. If present and true, cards will be spawned next to each other in a\n-- spread moving to the right. globalPos will define the location of the first card, each\n-- after that will be moved a predefined distance\n-- spreadCols: Optional integer. If spread is true, specifies the maximum columns cards will be\n-- laid out in before starting a new row. If spread is true but spreadCols is not set, all\n-- cards will be in a single row (however long that may be)\n-- }\n-- See BondedBag.ttslua for an example\ndo\n local allCardsBagApi = require(\"playercards/AllCardsBagApi\")\n\n local SpawnBag = { }\n local internal = { }\n\n -- To assist debugging, will draw a box around the recall zone when it's set up\n local SHOW_RECALL_ZONE = false\n\n -- Distance to expand the recall zone around any added object.\n local RECALL_BUFFER_X = 0.9\n local RECALL_BUFFER_Z = 0.5\n\n -- In order to mimic the behavior of the previous memory buttons we use a temporary bag when\n -- recalling objects. This bag is tiny and transparent, and will be placed at the same location as\n -- this object. Once all placed cards are recalled bag to this bag, it will be destroyed\n local RECALL_BAG = {\n Name = \"Bag\",\n Transform = {\n scaleX = 0.01,\n scaleY = 0.01,\n scaleZ = 0.01,\n },\n ColorDiffuse = {\n r = 0,\n g = 0,\n b = 0,\n a = 0,\n },\n Locked = true,\n Grid = true,\n Snap = false,\n Tooltip = false,\n }\n\n -- Tracks what has been placed by this \"bag\" so they can be recalled\n local placedSpecs = { }\n local placedObjectGuids = { }\n local recallZone = nil\n\n -- Loads a table of saved state, extracted during the parent object's onLoad\n SpawnBag.loadFromSave = function(saveTable)\n placedSpecs = saveTable.placed\n placedObjectGuids = saveTable.placedObjects\n recallZone = saveTable.recall\n end\n\n -- Generates a table of save state that can be included in the parent object's onSave\n SpawnBag.getStateForSave = function()\n return {\n placed = placedSpecs,\n placedObjects = placedObjectGuids,\n recall = recallZone,\n }\n end\n\n -- Places the given spawnSpec on the table. See SpawnBag.ttslua header for spawnSpec table data and\n -- examples\n SpawnBag.spawn = function(spawnSpec)\n -- Limit to one placement at a time\n if (placedSpecs[spawnSpec.name]) then\n return\n end\n if (spawnSpec == nil) then\n -- TODO: error here\n return\n end\n local cardsToSpawn = { }\n local cardList = spawnSpec.cards\n for _, cardId in ipairs(cardList) do\n local cardData = allCardsBagApi.getCardById(cardId)\n if (cardData ~= nil) then\n table.insert(cardsToSpawn, cardData)\n else\n -- TODO: error here\n end\n end\n if (spawnSpec.spread) then\n Spawner.spawnCardSpread(cardsToSpawn, spawnSpec.globalPos, spawnSpec.spreadCols or 9999, spawnSpec.rotation, false, internal.recordPlacedObject)\n else\n -- TTS decks come out in reverse order of the cards, reverse the list so the input order stays\n -- This only applies for decks; spreads are spawned by us in the order given\n if spawnSpec.rotation.z != 180 then\n cardsToSpawn = internal.reverseList(cardsToSpawn)\n end\n Spawner.spawnCards(cardsToSpawn, spawnSpec.globalPos, spawnSpec.rotation, false, internal.recordPlacedObject)\n end\n placedSpecs[spawnSpec.name] = true\n end\n\n -- Recalls all spawned objects to the bag, and clears the placedObjectGuids list\n ---@param fast Boolean. If true, cards will be deleted directly without faking the bag recall.\n SpawnBag.recall = function(fast)\n if fast then\n internal.deleteSpawned()\n else\n internal.recallSpawned()\n end\n\n -- We've recalled everything we can, some cards may have been moved out of the\n -- card area. Just reset at this point.\n placedSpecs = { }\n placedObjectGuids = { }\n recallZone = nil\n end\n\n -- Deleted all spawned cards.\n internal.deleteSpawned = function()\n for guid, _ in pairs(placedObjectGuids) do\n local obj = getObjectFromGUID(guid)\n if (obj ~= nil) then\n if (internal.isInRecallZone(obj)) then\n obj.destruct()\n end\n placedObjectGuids[guid] = nil\n end\n end\n end\n\n -- Recalls spawned cards with a fake bag that replicates the memory bag recall style.\n internal.recallSpawned = function()\n local trash = spawnObjectData({data = RECALL_BAG, position = self.getPosition()})\n for guid, _ in pairs(placedObjectGuids) do\n local obj = getObjectFromGUID(guid)\n if (obj ~= nil) then\n if (internal.isInRecallZone(obj)) then\n trash.putObject(obj)\n end\n placedObjectGuids[guid] = nil\n end\n end\n\n trash.destruct()\n end\n\n\n -- Callback for when an object has been spawned. Tracks the object for later recall and updates the\n -- recall zone.\n internal.recordPlacedObject = function(spawned)\n placedObjectGuids[spawned.getGUID()] = true\n internal.expandRecallZone(spawned)\n end\n\n -- Expands the current recall zone based on the position of the given object. The recall zone will\n -- be maintained as the bounding box of the extreme object positions, plus a small amount of buffer\n internal.expandRecallZone = function(spawnedCard)\n local pos = spawnedCard.getPosition()\n if (recallZone == nil) then\n -- First card out of the bag, initialize surrounding that\n recallZone = { }\n recallZone.upperLeft = { x = pos.x + RECALL_BUFFER_X, z = pos.z + RECALL_BUFFER_Z }\n recallZone.lowerRight = { x = pos.x - RECALL_BUFFER_X, z = pos.z - RECALL_BUFFER_Z }\n return\n else\n if (pos.x \u003e recallZone.upperLeft.x) then\n recallZone.upperLeft.x = pos.x + RECALL_BUFFER_X\n end\n if (pos.x \u003c recallZone.lowerRight.x) then\n recallZone.lowerRight.x = pos.x - RECALL_BUFFER_X\n end\n if (pos.z \u003e recallZone.upperLeft.z) then\n recallZone.upperLeft.z = pos.z + RECALL_BUFFER_Z\n end\n if (pos.z \u003c recallZone.lowerRight.z) then\n recallZone.lowerRight.z = pos.z - RECALL_BUFFER_Z\n end\n end\n if (SHOW_RECALL_ZONE) then\n local y = 1.5\n local thick = 0.05\n Global.setVectorLines({\n {\n points = { {recallZone.upperLeft.x,y,recallZone.upperLeft.z}, {recallZone.upperLeft.x,y,recallZone.lowerRight.z} },\n color = {1,0,0},\n thickness = thick,\n rotation = {0,0,0},\n },\n {\n points = { {recallZone.upperLeft.x,y,recallZone.lowerRight.z}, {recallZone.lowerRight.x,y,recallZone.lowerRight.z} },\n color = {1,0,0},\n thickness = thick,\n rotation = {0,0,0},\n },\n {\n points = { {recallZone.lowerRight.x,y,recallZone.lowerRight.z}, {recallZone.lowerRight.x,y,recallZone.upperLeft.z} },\n color = {1,0,0},\n thickness = thick,\n rotation = {0,0,0},\n },\n {\n points = { {recallZone.lowerRight.x,y,recallZone.upperLeft.z}, {recallZone.upperLeft.x,y,recallZone.upperLeft.z} },\n color = {1,0,0},\n thickness = thick,\n rotation = {0,0,0},\n },\n })\n end\n end\n\n -- Checks to see if the given object is in the current recall zone. If there isn't a recall zone,\n -- will return true so that everything can be easily cleaned up.\n internal.isInRecallZone = function(obj)\n if (recallZone == nil) then\n return true\n end\n local pos = obj.getPosition()\n return (pos.x \u003c recallZone.upperLeft.x and pos.x \u003e recallZone.lowerRight.x\n and pos.z \u003c recallZone.upperLeft.z and pos.z \u003e recallZone.lowerRight.z)\n end\n\n internal.reverseList = function(list)\n local reversed = { }\n for i = 1, #list do\n reversed[i] = list[#list - i + 1]\n end\n\n return reversed\n end\n\n return SpawnBag\nend\nend)\n__bundle_register(\"playercards/PlayerCardSpawner\", function(require, _LOADED, __bundle_register, __bundle_modules)\n-- Amount to shift for the next card (zShift) or next row of cards (xShift)\n-- Note that the table rotation is weird, and the X axis is vertical while the\n-- Z axis is horizontal\nlocal SPREAD_Z_SHIFT = -2.3\nlocal SPREAD_X_SHIFT = -3.66\n\nSpawner = { }\n\n-- Spawns a list of cards at the given position/rotation. This will separate cards by size -\n-- investigator, standard, and mini, spawning them in that order with larger cards on bottom. If\n-- there are different types, the provided callback will be called once for each type as it spawns\n-- either a card or deck.\n-- @param cardList: A list of Player Card data structures (data/metadata)\n-- @param pos Position table where the cards should be spawned (global)\n-- @param rot Rotation table for the orientation of the spawned cards (global)\n-- @param sort Boolean, true if this list of cards should be sorted before spawning\n-- @param callback Function, callback to be called after the card/deck spawns.\nSpawner.spawnCards = function(cardList, pos, rot, sort, callback)\n if (sort) then\n table.sort(cardList, Spawner.cardComparator)\n end\n\n local miniCards = { }\n local standardCards = { }\n local investigatorCards = { }\n\n for _, card in ipairs(cardList) do\n if (card.metadata.type == \"Investigator\") then\n table.insert(investigatorCards, card)\n elseif (card.metadata.type == \"Minicard\") then\n table.insert(miniCards, card)\n else\n table.insert(standardCards, card)\n end\n end\n -- Spawn each of the three types individually. Each Y position shift accounts for the thickness\n -- of the spawned deck\n local position = { x = pos.x, y = pos.y, z = pos.z }\n Spawner.spawn(investigatorCards, position, { rot.x, rot.y - 90, rot.z }, callback)\n\n position.y = position.y + (#investigatorCards + #standardCards) * 0.07\n Spawner.spawn(standardCards, position, rot, callback)\n\n position.y = position.y + (#standardCards + #miniCards) * 0.07\n Spawner.spawn(miniCards, position, rot, callback)\nend\n\nSpawner.spawnCardSpread = function(cardList, startPos, maxCols, rot, sort, callback)\n if (sort) then\n table.sort(cardList, Spawner.cardComparator)\n end\n\n local position = { x = startPos.x, y = startPos.y, z = startPos.z }\n -- Special handle the first row if we have less than a full single row, but only if there's a\n -- reasonable max column count. Single-row spreads will send a large value for maxCols\n if maxCols \u003c 100 and #cardList \u003c maxCols then\n position.z = startPos.z + ((maxCols - #cardList) / 2 * SPREAD_Z_SHIFT)\n end\n local cardsInRow = 0\n local rows = 0\n for _, card in ipairs(cardList) do\n Spawner.spawn({ card }, position, rot, callback)\n position.z = position.z + SPREAD_Z_SHIFT\n cardsInRow = cardsInRow + 1\n if cardsInRow \u003e= maxCols then\n rows = rows + 1\n local cardsForRow = #cardList - rows * maxCols\n if cardsForRow \u003e maxCols then\n cardsForRow = maxCols\n end\n position.z = startPos.z + ((maxCols - cardsForRow) / 2 * SPREAD_Z_SHIFT)\n position.x = position.x + SPREAD_X_SHIFT\n cardsInRow = 0\n end\n end\nend\n\n-- Spawn a specific list of cards. This method is for internal use and should not be called\n-- directly, use spawnCards instead.\n---@param cardList: A list of Player Card data structures (data/metadata)\n---@param pos table Position where the cards should be spawned (global)\n---@param rot table Rotation for the orientation of the spawned cards (global)\n---@param callback function callback to be called after the card/deck spawns.\nSpawner.spawn = function(cardList, pos, rot, callback)\n if (#cardList == 0) then\n return\n end\n -- Spawn a single card directly\n if (#cardList == 1) then\n spawnObjectData({\n data = cardList[1].data,\n position = pos,\n rotation = rot,\n callback_function = callback,\n })\n return\n end\n -- For multiple cards, construct a deck and spawn that\n local deck = Spawner.buildDeckDataTemplate()\n -- Decks won't inherently scale to the cards in them. The card list being spawned should be all\n -- the same type/size by this point, so use the first card to set the size\n deck.Transform = {\n scaleX = cardList[1].data.Transform.scaleX,\n scaleY = 1,\n scaleZ = cardList[1].data.Transform.scaleZ,\n }\n local sidewaysDeck = true\n for _, spawnCard in ipairs(cardList) do\n Spawner.addCardToDeck(deck, spawnCard.data)\n -- set sidewaysDeck to false if any card is not a sideways card\n sidewaysDeck = (sidewaysDeck and spawnCard.data.SidewaysCard)\n end\n -- set the alt view angle for sideway decks\n if sidewaysDeck then\n deck.AltLookAngle = { x = 0, y = 180, z = 90 }\n end\n spawnObjectData({\n data = deck,\n position = pos,\n rotation = rot,\n callback_function = callback,\n })\nend\n\n-- Inserts a card into the given deck. This does three things:\n-- 1. Add the card's data to ContainedObjects\n-- 2. Add the card's ID (the TTS CardID, not the Arkham ID) to the deck's\n-- ID list. Note that the deck's ID list is \"DeckIDs\" even though it\n-- contains a list of card Ids\n-- 3. Extract the card's CustomDeck table and add it to the deck. The deck's\n-- \"CustomDeck\" field is a list of all CustomDecks used by cards within the\n-- deck, keyed by the DeckID and referencing the custom deck table\n---@param deck: TTS deck data structure to add to\n---@param card: Data for the card to be inserted\nSpawner.addCardToDeck = function(deck, cardData)\n for customDeckId, customDeckData in pairs(cardData.CustomDeck) do\n if (deck.CustomDeck[customDeckId] == nil) then\n -- CustomDeck not added to deck yet, add it\n deck.CustomDeck[customDeckId] = customDeckData\n elseif (deck.CustomDeck[customDeckId].FaceURL == customDeckData.FaceURL) then\n -- CustomDeck for this card matches the current one for the deck, do nothing\n else\n -- CustomDeck data conflict\n local newDeckId = nil\n for deckId, customDeck in pairs(deck.CustomDeck) do\n if (customDeckData.FaceURL == customDeck.FaceURL) then\n newDeckId = deckId\n end\n end\n if (newDeckId == nil) then\n -- No non-conflicting custom deck for this card, add a new one\n newDeckId = Spawner.findNextAvailableId(deck.CustomDeck, \"1000\")\n deck.CustomDeck[newDeckId] = customDeckData\n end\n -- Update the card with the new CustomDeck info\n cardData.CardID = newDeckId..string.sub(cardData.CardID, 5)\n cardData.CustomDeck[customDeckId] = nil\n cardData.CustomDeck[newDeckId] = customDeckData\n break\n end\n end\n table.insert(deck.ContainedObjects, cardData)\n table.insert(deck.DeckIDs, cardData.CardID)\nend\n\n-- Create an empty deck data table which can have cards added to it. This\n-- creates a new table on each call without using metatables or previous\n-- definitions because we can't be sure that TTS doesn't modify the structure\n---@return: Table containing the minimal TTS deck data structure\nSpawner.buildDeckDataTemplate = function()\n local deck = {}\n deck.Name = \"Deck\"\n\n -- Card data. DeckIDs and CustomDeck entries will be built from the cards\n deck.ContainedObjects = {}\n deck.DeckIDs = {}\n deck.CustomDeck = {}\n\n -- Transform is required, Position and Rotation will be overridden by the spawn call so can be omitted here\n deck.Transform = {\n scaleX = 1,\n scaleY = 1,\n scaleZ = 1,\n }\n\n return deck\nend\n\n-- Returns the first ID which does not exist in the given table, starting at startId and increasing\n-- @param objectTable Table keyed by strings which are numbers\n-- @param startId First possible ID.\n-- @return String ID \u003e= startId\nSpawner.findNextAvailableId = function(objectTable, startId)\n local id = startId\n while (objectTable[id] ~= nil) do\n id = tostring(tonumber(id) + 1)\n end\n\n return id\nend\n\n-- Get the PBCN (Permanent/Bonded/Customizable/Normal) value from the given metadata.\n---@return: 1 for Permanent, 2 for Bonded or 4 for Normal. The actual values are\n-- irrelevant as they provide only grouping and the order between them doesn't matter.\nSpawner.getpbcn = function(metadata)\n if metadata.permanent then\n return 1\n elseif metadata.bonded_to ~= nil then\n return 2\n else -- Normal card\n return 3\n end\nend\n\n-- Comparison function used to sort the cards in a deck. Groups bonded or\n-- permanent cards first, then sorts within theose types by name/subname.\n-- Normal cards will sort in standard alphabetical order, while\n-- permanent/bonded/customizable will be in reverse alphabetical order.\n--\n-- Since cards spawn in the order provided by this comparator, with the first\n-- cards ending up at the bottom of a pile, this ordering will spawn in reverse\n-- alphabetical order. This presents the cards in order for non-face-down\n-- areas, and presents them in order when Searching the face-down deck.\nSpawner.cardComparator = function(card1, card2)\n local pbcn1 = Spawner.getpbcn(card1.metadata)\n local pbcn2 = Spawner.getpbcn(card2.metadata)\n if pbcn1 ~= pbcn2 then\n return pbcn1 \u003e pbcn2\n end\n if pbcn1 == 3 then\n if card1.data.Nickname ~= card2.data.Nickname then\n return card1.data.Nickname \u003c card2.data.Nickname\n end\n return card1.data.Description \u003c card2.data.Description\n else\n if card1.data.Nickname ~= card2.data.Nickname then\n return card1.data.Nickname \u003e card2.data.Nickname\n end\n return card1.data.Description \u003e card2.data.Description\n end\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "{\"spawnBagState\":{\"placed\":[],\"placedObjects\":[]}}", "MeasureMovement": false, "Name": "Custom_Tile", @@ -187982,7 +193132,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"util/TokenRemover\")\nend)\n__bundle_register(\"util/TokenRemover\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal zone = nil\nlocal tokenChecker = require(\"core/token/TokenChecker\")\n\n-- general code\nfunction onSave()\n return JSON.encode(zone and zone.getGUID() or nil)\nend\n\nfunction onLoad(savedData)\n if savedData ~= \"\" and savedData ~= nil then\n zone = getObjectFromGUID(JSON.decode(savedData))\n end\n setMenu(zone == nil)\nend\n\n-- context menu functions\nfunction enable()\n local scale = self.getScale()\n zone = spawnObject({\n type = \"ScriptingTrigger\",\n position = self.getPosition() + Vector(0, 2.5 + 0.11, 0),\n rotation = self.getRotation(),\n scale = { scale.x * 2, 5, scale.z * 2 }\n })\n setMenu(false)\nend\n\nfunction disable()\n if zone ~= nil then zone.destruct() end\n setMenu(true)\nend\n\n-- core functions\nfunction setMenu(isEnabled)\n self.clearContextMenu()\n if isEnabled then\n self.addContextMenuItem(\"Enable\", enable)\n else\n self.addContextMenuItem(\"Disable\", disable)\n end\nend\n\nfunction onObjectEnterScriptingZone(entering, object)\n if zone ~= entering then return end\n if object == self or object.type == \"Deck\" or object.type == \"Card\" then return end\n if tokenChecker.isChaosToken(object) then return end\n object.destruct()\nend\n\nfunction onPickUp()\n disable()\nend\nend)\n__bundle_register(\"core/token/TokenChecker\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local CHAOS_TOKEN_NAMES = {\n [\"Elder Sign\"] = true,\n [\"+1\"] = true,\n [\"0\"] = true,\n [\"-1\"] = true,\n [\"-2\"] = true,\n [\"-3\"] = true,\n [\"-4\"] = true,\n [\"-5\"] = true,\n [\"-6\"] = true,\n [\"-7\"] = true,\n [\"-8\"] = true,\n [\"Skull\"] = true,\n [\"Cultist\"] = true,\n [\"Tablet\"] = true,\n [\"Elder Thing\"] = true,\n [\"Auto-fail\"] = true,\n [\"Bless\"] = true,\n [\"Curse\"] = true,\n [\"Frost\"] = true\n }\n\n local TokenChecker = {}\n\n -- returns true if the passed object is a chaos token (by name)\n TokenChecker.isChaosToken = function(obj)\n if CHAOS_TOKEN_NAMES[obj.getName()] then\n return true\n else\n return false\n end\n end\n\n return TokenChecker\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"util/TokenRemover\")\nend)\n__bundle_register(\"util/TokenRemover\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal zone = nil\n\n-- general code\nfunction onSave()\n return JSON.encode(zone and zone.getGUID() or nil)\nend\n\nfunction onLoad(savedData)\n if savedData ~= \"\" and savedData ~= nil then\n zone = getObjectFromGUID(JSON.decode(savedData))\n end\n setMenu(zone == nil)\nend\n\n-- context menu functions\nfunction enable()\n local scale = self.getScale()\n zone = spawnObject({\n type = \"ScriptingTrigger\",\n position = self.getPosition() + Vector(0, 3.5 + 0.11, 0),\n rotation = self.getRotation(),\n scale = { scale.x * 2, 7, scale.z * 2 }\n })\n zone.setName(\"TokenDiscardZone\")\n setMenu(false)\nend\n\nfunction disable()\n if zone ~= nil then zone.destruct() end\n setMenu(true)\nend\n\n-- core functions\nfunction setMenu(isEnabled)\n self.clearContextMenu()\n if isEnabled then\n self.addContextMenuItem(\"Enable\", enable)\n else\n self.addContextMenuItem(\"Disable\", disable)\n end\nend\n\nfunction onPickUp()\n disable()\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "null", "MeasureMovement": false, "Name": "Custom_Tile", @@ -188042,7 +193192,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"util/TokenRemover\")\nend)\n__bundle_register(\"util/TokenRemover\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal zone = nil\nlocal tokenChecker = require(\"core/token/TokenChecker\")\n\n-- general code\nfunction onSave()\n return JSON.encode(zone and zone.getGUID() or nil)\nend\n\nfunction onLoad(savedData)\n if savedData ~= \"\" and savedData ~= nil then\n zone = getObjectFromGUID(JSON.decode(savedData))\n end\n setMenu(zone == nil)\nend\n\n-- context menu functions\nfunction enable()\n local scale = self.getScale()\n zone = spawnObject({\n type = \"ScriptingTrigger\",\n position = self.getPosition() + Vector(0, 2.5 + 0.11, 0),\n rotation = self.getRotation(),\n scale = { scale.x * 2, 5, scale.z * 2 }\n })\n setMenu(false)\nend\n\nfunction disable()\n if zone ~= nil then zone.destruct() end\n setMenu(true)\nend\n\n-- core functions\nfunction setMenu(isEnabled)\n self.clearContextMenu()\n if isEnabled then\n self.addContextMenuItem(\"Enable\", enable)\n else\n self.addContextMenuItem(\"Disable\", disable)\n end\nend\n\nfunction onObjectEnterScriptingZone(entering, object)\n if zone ~= entering then return end\n if object == self or object.type == \"Deck\" or object.type == \"Card\" then return end\n if tokenChecker.isChaosToken(object) then return end\n object.destruct()\nend\n\nfunction onPickUp()\n disable()\nend\nend)\n__bundle_register(\"core/token/TokenChecker\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local CHAOS_TOKEN_NAMES = {\n [\"Elder Sign\"] = true,\n [\"+1\"] = true,\n [\"0\"] = true,\n [\"-1\"] = true,\n [\"-2\"] = true,\n [\"-3\"] = true,\n [\"-4\"] = true,\n [\"-5\"] = true,\n [\"-6\"] = true,\n [\"-7\"] = true,\n [\"-8\"] = true,\n [\"Skull\"] = true,\n [\"Cultist\"] = true,\n [\"Tablet\"] = true,\n [\"Elder Thing\"] = true,\n [\"Auto-fail\"] = true,\n [\"Bless\"] = true,\n [\"Curse\"] = true,\n [\"Frost\"] = true\n }\n\n local TokenChecker = {}\n\n -- returns true if the passed object is a chaos token (by name)\n TokenChecker.isChaosToken = function(obj)\n if CHAOS_TOKEN_NAMES[obj.getName()] then\n return true\n else\n return false\n end\n end\n\n return TokenChecker\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"util/TokenRemover\")\nend)\n__bundle_register(\"util/TokenRemover\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal zone = nil\n\n-- general code\nfunction onSave()\n return JSON.encode(zone and zone.getGUID() or nil)\nend\n\nfunction onLoad(savedData)\n if savedData ~= \"\" and savedData ~= nil then\n zone = getObjectFromGUID(JSON.decode(savedData))\n end\n setMenu(zone == nil)\nend\n\n-- context menu functions\nfunction enable()\n local scale = self.getScale()\n zone = spawnObject({\n type = \"ScriptingTrigger\",\n position = self.getPosition() + Vector(0, 3.5 + 0.11, 0),\n rotation = self.getRotation(),\n scale = { scale.x * 2, 7, scale.z * 2 }\n })\n zone.setName(\"TokenDiscardZone\")\n setMenu(false)\nend\n\nfunction disable()\n if zone ~= nil then zone.destruct() end\n setMenu(true)\nend\n\n-- core functions\nfunction setMenu(isEnabled)\n self.clearContextMenu()\n if isEnabled then\n self.addContextMenuItem(\"Enable\", enable)\n else\n self.addContextMenuItem(\"Disable\", disable)\n end\nend\n\nfunction onPickUp()\n disable()\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "null", "MeasureMovement": false, "Name": "Custom_Tile", @@ -188067,6 +193217,250 @@ "Value": 0, "XmlUI": "" }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "CustomImage": { + "CustomTile": { + "Stackable": false, + "Stretch": true, + "Thickness": 0.1, + "Type": 0 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "http://cloud-3.steamusercontent.com/ugc/1767069252728653004/7BD6E4B8763FE70DB6ADB22B62504361D3778309/", + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/1767069252728651946/04A700179A71859B828E30D2877D802749B8223C/", + "WidthScale": 0 + }, + "Description": "See Notebook for details.", + "DragSelectable": true, + "GMNotes": "", + "GUID": "0a5a29", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": true, + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"util/TokenRemover\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal zone = nil\n\n-- general code\nfunction onSave()\n return JSON.encode(zone and zone.getGUID() or nil)\nend\n\nfunction onLoad(savedData)\n if savedData ~= \"\" and savedData ~= nil then\n zone = getObjectFromGUID(JSON.decode(savedData))\n end\n setMenu(zone == nil)\nend\n\n-- context menu functions\nfunction enable()\n local scale = self.getScale()\n zone = spawnObject({\n type = \"ScriptingTrigger\",\n position = self.getPosition() + Vector(0, 3.5 + 0.11, 0),\n rotation = self.getRotation(),\n scale = { scale.x * 2, 7, scale.z * 2 }\n })\n zone.setName(\"TokenDiscardZone\")\n setMenu(false)\nend\n\nfunction disable()\n if zone ~= nil then zone.destruct() end\n setMenu(true)\nend\n\n-- core functions\nfunction setMenu(isEnabled)\n self.clearContextMenu()\n if isEnabled then\n self.addContextMenuItem(\"Enable\", enable)\n else\n self.addContextMenuItem(\"Disable\", disable)\n end\nend\n\nfunction onPickUp()\n disable()\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"util/TokenRemover\")\nend)\nreturn __bundle_require(\"__root\")", + "LuaScriptState": "null", + "MeasureMovement": false, + "Name": "Custom_Tile", + "Nickname": "Token Remover", + "Snap": true, + "Sticky": true, + "Tags": [ + "CleanUpHelper_ignore" + ], + "Tooltip": true, + "Transform": { + "posX": -58.5, + "posY": 1.481, + "posZ": 0, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "a": 0.5098, + "b": 1, + "g": 1, + "r": 1 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "457de3", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": true, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "ScriptingTrigger", + "Nickname": "TokenDiscardZone", + "Snap": true, + "Sticky": true, + "Tooltip": false, + "Transform": { + "posX": -65, + "posY": 1.5, + "posZ": 16.1, + "rotX": 0, + "rotY": 90, + "rotZ": 0, + "scaleX": 22, + "scaleY": 0.5, + "scaleZ": 5 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "a": 0.5098, + "b": 1, + "g": 1, + "r": 1 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "457de4", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": true, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "ScriptingTrigger", + "Nickname": "TokenDiscardZone", + "Snap": true, + "Sticky": true, + "Tooltip": false, + "Transform": { + "posX": -65, + "posY": 1.5, + "posZ": -16.1, + "rotX": 0, + "rotY": 90, + "rotZ": 0, + "scaleX": 22, + "scaleY": 0.5, + "scaleZ": 5 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "a": 0.5098, + "b": 1, + "g": 1, + "r": 1 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "457de5", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": true, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "ScriptingTrigger", + "Nickname": "TokenDiscardZone", + "Snap": true, + "Sticky": true, + "Tooltip": false, + "Transform": { + "posX": -30.35, + "posY": 1.5, + "posZ": 36.6, + "rotX": 0, + "rotY": 180, + "rotZ": 0, + "scaleX": 22, + "scaleY": 0.5, + "scaleZ": 5 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "a": 0.5098, + "b": 1, + "g": 1, + "r": 1 + }, + "Description": "", + "DragSelectable": true, + "GMNotes": "", + "GUID": "457de6", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": true, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "ScriptingTrigger", + "Nickname": "TokenDiscardZone", + "Snap": true, + "Sticky": true, + "Tooltip": false, + "Transform": { + "posX": -30.35, + "posY": 1.5, + "posZ": -36.6, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 22, + "scaleY": 0.5, + "scaleZ": 5 + }, + "Value": 0, + "XmlUI": "" + }, { "AltLookAngle": { "x": 0, @@ -188844,12445 +194238,6 @@ "Value": 0, "XmlUI": "" }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "Bag": { - "Order": 0 - }, - "ColorDiffuse": { - "b": 1, - "g": 1, - "r": 1 - }, - "ContainedObjects": [ - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1697276706767572704/331469F5EAD01108E83C7662B9949F4AC3D00313/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "Created by Samirashul", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_weird_west.json", - "GUID": "58ddca", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Weird West Custom Investigators", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -20.939, - "posY": 2.009, - "posZ": 81.007, - "rotX": 359, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1697277697641042816/D60194A8F22DA3032E6C2AC2EE040E6321A2B259/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_touhou_project.json", - "GUID": "c5c294", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Touhou Project Investigators", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -35.717, - "posY": 1.973, - "posZ": -126.28, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1853807409892957080/8BAF356ADEADE6CF377438200268899C64FA420E/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_SNC.json", - "GUID": "48b4ca", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Streets of New Capenna", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -24.825, - "posY": 2.361, - "posZ": -62.966, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142947772/120E2BA8DF8C4E2AAC9E059FA046CC3A6229ECDF/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_strange_aeons.json", - "GUID": "d78bd2", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Strange Aeons Custom Investigators", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -17.434, - "posY": 2.826, - "posZ": -101.73, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "b": 0.34902, - "g": 0.34902, - "r": 0.35294 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1754686449895581106/83D855A76FC7568415189A03882317685F6B55EE/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "By Mint Tea Fan", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_replacements.json", - "GUID": "b06fd9", - "Grid": true, - "GridProjection": false, - "Hands": true, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Signature Replacements", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -44.34, - "posY": 1.973, - "posZ": -111.047, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "https://i.imgur.com/etJMio6.png", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/core_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "https://arkham.cards", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_memphis.json", - "GUID": "073201", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Sands Of Memphis (Investigator Expansion)", - "Snap": true, - "Sticky": true, - "Tags": [ - "LargeBox" - ], - "Tooltip": true, - "Transform": { - "posX": -47.192, - "posY": 2.828, - "posZ": -121.341, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 1, - "scaleY": 0.14, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1697282751257289223/D03666A291CC5705A3656865488583FF4AB762B4/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_shadows_of_arkham.json", - "GUID": "2e5eef", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Shadows of Arkham Player Cards", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -17.12, - "posY": 3.27, - "posZ": -93.318, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/2062129724651762962/3EE544183397D062C39D90FAE8E6C0DA6BF6320F/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "by Mattastrophic", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_red_coterie.json", - "GUID": "de13e3", - "Grid": true, - "GridProjection": false, - "Hands": true, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Red Coterie", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 25, - "posY": 1.5, - "posZ": 49, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1862800022614300553/046FEA88FB8D4DB6BE0AC9898149058EF32BFD0A/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "Mint Tea Fan", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_rabbit_hole.json", - "GUID": "b7ff06", - "Grid": true, - "GridProjection": false, - "Hands": true, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Rabbit Hole Expansion", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -44.314, - "posY": 1.973, - "posZ": -114.792, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1597043896926982160/40A0068DAB05395205E184765110430CAADDA2CF/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_pokemon_eldritch_edition.json", - "GUID": "1fb7ce", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Pokemon: Eldritch Edition Custom Investigators", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -20.939, - "posY": 1.963, - "posZ": 81.007, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0.4999999, - "SpecularColor": { - "b": 0.735294163, - "g": 0.735294163, - "r": 0.735294163 - }, - "SpecularIntensity": 0.3, - "SpecularSharpness": 8 - }, - "DiffuseURL": "https://i.imgur.com/ftafgpa.pnghttps://i.imgur.com/ftafgpa.png", - "MaterialIndex": 2, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "by The Popest", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_nightmare_town.json", - "GUID": "e32a71", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Nightmare Pack - EN", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -45.871, - "posY": 1.973, - "posZ": -114.771, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1684870715280907223/1E9DE758F089D7F880ADC8CA594F9AA938743F8B/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "By Game#0398", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_maximillion_pegasus.json", - "GUID": "4608c8", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Maximillion Pegasus Custom Investigator", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -20.939, - "posY": 1.963, - "posZ": 81.007, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1667985852037525429/FFCBAFD8EF7EFD1127F4482DF01FFD8AE9638B4D/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_mass_effect.json", - "GUID": "b82c6f", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Mass Effect Investigators", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -20.939, - "posY": 1.962, - "posZ": 81.007, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1903353113607751170/B835836D4DB21CA06206BF84EEAAD6B3E6C157CB/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_magical_girl.json", - "GUID": "814e2a", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Magical Girl Arkham Project", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -57.863, - "posY": 2.38, - "posZ": -72.018, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "b": 0.34902, - "g": 0.34902, - "r": 0.35294 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1754686449895663371/D5D8A1205E220C2ED2D0CA50705FBADE82C053BF/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "By Mint Tea Fan", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_lola_hayes_rework.json", - "GUID": "197f36", - "Grid": true, - "GridProjection": false, - "Hands": true, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Lola Hayes Rework", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -33.926, - "posY": 1.973, - "posZ": -99.815, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1011563111884720834/103D38A8FBBFA64EB66439667F8775B15FC679C9/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_idol_thoughts.json", - "GUID": "991ff9", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Idol Thoughts Custom Investigators", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -21.835, - "posY": 1.973, - "posZ": 81.635, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "https://dl.airtable.com/.attachmentThumbnails/e9dd0f33f26dcf0a628d962e0806de04/b41b19e1", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/core_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "https://arkham.cards", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_onigawa.json", - "GUID": "c19cfa", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Ghosts Of Onigawa (Investigator Expansion)", - "Snap": true, - "Sticky": true, - "Tags": [ - "LargeBox" - ], - "Tooltip": true, - "Transform": { - "posX": -47.192, - "posY": 2.828, - "posZ": -121.341, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 1, - "scaleY": 0.14, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1597044073919531303/A7A92208CADC509C2546E65242ADDC8EF88FEAB8/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "By /u/corpboy", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_gender_swapped.json", - "GUID": "33272e", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Gender Swapped Investigators", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -20.939, - "posY": 1.978, - "posZ": 81.007, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1655599785039299268/52DB5C3A0E600D6AECB0B851ECF90C5B3D016421/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "By Donelloth. As Seen in Bad Blood!", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_elspeth_baudin.json", - "GUID": "84c153", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Elspeth Baudin Custom Investigator", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -20.939, - "posY": 1.963, - "posZ": 81.007, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1646593716898209387/B827263B809A6C8E1042BDF1C8D33E58458C2EF4/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_dont_starve.json", - "GUID": "2e69d0", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Don't Starve Investigators", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -20.939, - "posY": 1.978, - "posZ": 81.007, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142900469/BDA1068C5A88459AE805540FE05B8092C4F8F392/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_delta_green_convergence.json", - "GUID": "84be1d", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Delta Green Convergence Custom Investigators", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -33.849, - "posY": 2.001, - "posZ": -87.567, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1898848485543773146/5255CF70ED228D9C98E4C9F4F010577A77B5C46E/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_dead_space.json", - "GUID": "880860", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Dead Space Investigators", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 19.669, - "posY": 2.25, - "posZ": -97.901, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/2055380534214131870/37E74A27D78CFDC8F320B15F02C5379834EA6202/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_city_of_secrets.json", - "GUID": "1ee775", - "Grid": true, - "GridProjection": false, - "Hands": true, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "City of Secrets", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 0, - "posY": 1.5, - "posZ": -10, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/2001337710389944672/AFEE73925C29D5330493528D81D26D499E2ABFCE/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "by TheBeard", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_circus_ex_mortis.json", - "GUID": "195936", - "Grid": true, - "GridProjection": false, - "Hands": true, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Circus Ex Mortis Investigator Expansion", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 0, - "posY": 1.5, - "posZ": -10, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1785092789057549667/7230A58735443DF70B24F5BAFD93B4FBBC1B28D7/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/core_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_cartoon_funtime.json", - "GUID": "524fbc", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Cartoon Investigators", - "Snap": true, - "Sticky": true, - "Tags": [ - "LargeBox" - ], - "Tooltip": true, - "Transform": { - "posX": -23.615, - "posY": 1.916, - "posZ": -135.631, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 1, - "scaleY": 0.14, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/2048620433331970643/2C2D6388AD3BAEC8B9C474B8810CF3E042E5D725/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "by AtomicZ", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_buffy.json", - "GUID": "6bf40f", - "Grid": true, - "GridProjection": false, - "Hands": true, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Buffy the Vampire Slayer", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 0, - "posY": 1.5, - "posZ": -10, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0.7999996, - "SpecularColor": { - "b": 0.735294163, - "g": 0.735294163, - "r": 0.735294163 - }, - "SpecularIntensity": 5, - "SpecularSharpness": 8 - }, - "DiffuseURL": "https://i.imgur.com/F4W3qLq.jpg", - "MaterialIndex": 2, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "by The Popest", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_battle_goes_on.json", - "GUID": "dd90c5", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Battle Goes On", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 18.946, - "posY": 1.916, - "posZ": -135.806, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 0.02353, - "g": 0.00392, - "r": 0.02353 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/764975951334960553/C518D80E31E27DB23EEAC8CF9253E59798865790/", - "MaterialIndex": 1, - "MeshURL": "http://cloud-3.steamusercontent.com/ugc/764975951334964971/3078F312706FC974833ECD2A359B87FD4F283509/", - "NormalURL": "http://cloud-3.steamusercontent.com/ugc/764975951334960069/E70E4A58A1B7827F1E5E2AF9FF44DF0BD5DA33F7/", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_bad_batch.json", - "GUID": "0a1d16", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Bad Batch", - "PhysicsMaterial": { - "BounceCombine": 0, - "Bounciness": 0, - "DynamicFriction": 0.6, - "FrictionCombine": 0, - "StaticFriction": 0.6 - }, - "Rigidbody": { - "AngularDrag": 5, - "Drag": 5, - "Mass": 1.375, - "UseGravity": true - }, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -22.821, - "posY": 2.225, - "posZ": -97.676, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2, - "scaleY": 2, - "scaleZ": 2 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1799728983834465397/5B8C8FFC332DCC1F09FEA1617F0F3446F06821DB/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "By Mint Tea Fan", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_artifact.json", - "GUID": "2f8332", - "Grid": true, - "GridProjection": false, - "Hands": true, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Artifact Expansion 1.3", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -34.314, - "posY": 2.001, - "posZ": -85.687, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1862816781492027399/65707471C1DAF2E107F9ACDD28B5D65FDABBCE79/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "Mint Tea Fan", - "DragSelectable": true, - "GMNotes": "fancreations/investigators_aespa.json", - "GUID": "ec74df", - "Grid": true, - "GridProjection": false, - "Hands": true, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Aespa Investigators", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -19.774, - "posY": 1.916, - "posZ": -106.215, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - } - ], - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1597044073919513962/49846EAC1BFF6C62218A7933D1754ED37F4C72C8/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/core_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 6 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "ed4ca7", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": true, - "LuaScript": "", - "LuaScriptState": "", - "MaterialIndex": -1, - "MeasureMovement": false, - "MeshIndex": -1, - "Name": "Custom_Model_Bag", - "Nickname": "Community-Created Player Cards/Investigators", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 60, - "posY": 1.481, - "posZ": 89, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 0.75, - "scaleY": 0.1, - "scaleZ": 0.75 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "Bag": { - "Order": 0 - }, - "ColorDiffuse": { - "b": 1, - "g": 0.99217, - "r": 1 - }, - "ContainedObjects": [ - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "Bag": { - "Order": 0 - }, - "ColorDiffuse": { - "b": 1, - "g": 1, - "r": 1 - }, - "ContainedObjects": [ - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1824531491067739120/4AD2D51DAC6215F2866BB2AD15D47109B432B999/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_the_undying.json", - "GUID": "965030", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Undying", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -55.358, - "posY": 6.299, - "posZ": -85.712, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142949442/404A26E158B9EBC1069A5FBA9BA2331CBFD7851B/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_the_thing_in_the_woods.json", - "GUID": "c90c49", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Thing in the Woods", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -11.013, - "posY": 1.624, - "posZ": 67.684, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1254763972105175718/5A09C7E8EBCC79DD9E405FF6F83E49C2C27D5F29/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_symphony_of_erich_zann.json", - "GUID": "b7c6be", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Symphony of Erich Zann", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -10.144, - "posY": 1.669, - "posZ": 67.991, - "rotX": 0, - "rotY": 270, - "rotZ": 357, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142948942/FA97D7EF94B715ADD1EEE40831114451FBED200B/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_the_svalbard_event.json", - "GUID": "7bc42b", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Svalbard Event", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -10.243, - "posY": 1.625, - "posZ": 67.29, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1845919769156839538/7ED48DF559525AF388EDAABCDEED4EE9D25E872A/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_jekyll.json", - "GUID": "695a4d", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Strange Case of Dr. Jekyll and Mr. Hyde", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -26.198, - "posY": 1.916, - "posZ": -120.925, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142943616/2B7B73A110A3EC225C854F85AB009F04859E3806/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_stolen_bacillus.json", - "GUID": "bfefd4", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Stolen Baillius", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -9.008, - "posY": 1.615, - "posZ": 66.398, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142946225/F5A6228957B37E945B425681115D09E7B8543BC6/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_the_red_room.json", - "GUID": "fa4327", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Red Room", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -11.088, - "posY": 1.624, - "posZ": 66.553, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142945578/6BA34FBD61F7AD38DE8B2B9E5D5F067406B7CC77/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_the_pensher_wyrm.json", - "GUID": "504f38", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Pensher Wyrm", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -9.37, - "posY": 1.625, - "posZ": 65.415, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.2, - "scaleZ": 2.46 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142940439/EE68DD668C18F8F8C61B0F2BABA6D548B17A6EA7/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_the_nephew_calls.json", - "GUID": "3ddd12", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Nephew Calls", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -9.291, - "posY": 1.625, - "posZ": 65.329, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.2, - "scaleZ": 2.46 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1797477398306699180/7C5363FFCCDCD4A1AF2A0C71B2A7E5F96D5ACCA4/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_the_nameless_city.json", - "GUID": "9d3083", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Nameless City", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -10.526, - "posY": 1.625, - "posZ": 65.906, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.45, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1617311203420460064/3D20A71D13F484BEEBCF572E827CD38FF3DF57E4/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_sleepy_hollow.json", - "GUID": "0500f1", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Legend of Sleepy Hollow", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 7.669, - "posY": 3.37, - "posZ": -40.855, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": 0, - "posY": 0, - "posZ": 0, - "rotX": 270, - "rotY": 0, - "rotZ": 0, - "scaleX": 2, - "scaleY": 2, - "scaleZ": 2 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/2005838139148126671/D2A8004B560ED3623F3326F3F97B8B181AEC6371/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_the_invisible_man.json", - "GUID": "17d01a", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Invisible Man", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 20, - "posY": 1.5, - "posZ": 0, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142935568/34A42BC3AEF7764F8D7BB242DB08FD36B8EC6DCB/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_grand_oak_hotel.json", - "GUID": "5ccf55", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Grand Oak Hotel", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -7.458, - "posY": 1.624, - "posZ": 64.612, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.2, - "scaleZ": 2.46 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142936385/DCE942F9A1172E9C55A36E4593F5CDC71D9BC3AD/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_the_festival.json", - "GUID": "29d22a", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Festival", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -9.309, - "posY": 1.625, - "posZ": 64.664, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.2, - "scaleZ": 2.46 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1771580824970152646/1C2D909AF92814C33B43D22F0EE1D6B8FD260998/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_house_of_usher.json", - "GUID": "42bdd3", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Fall of the House of Usher", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 15.113, - "posY": 3.183, - "posZ": -58.666, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1870695908503531344/DE3BBAD0CF8FCE5B05B8B18B44F049ECF06BCA5A/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_valdemar.json", - "GUID": "238d6f", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Facts in the Case of M. Valdemar", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -10.602, - "posY": 1.679, - "posZ": 64.245, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.2, - "scaleZ": 2.46 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142921541/F138D6DF73FB79AC6D1C420869299A481AFA7B90/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_the_curse_of_amulotep.json", - "GUID": "0d7a8d", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Curse of Amulotep", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -6.697, - "posY": 1.623, - "posZ": 66.348, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.2, - "scaleZ": 2.46 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142919895/4026718A421BE11AC64320BE9BC2515B364D066E/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_color_out_of_space.json", - "GUID": "5b81ff", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Colour out of Space", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -9.932, - "posY": 1.624, - "posZ": 64.798, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142920786/52ED9B6276539BF3E1F332C363B21B3D7F6960AA/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_the_collector.json", - "GUID": "9810eb", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Collector", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -10.602, - "posY": 1.679, - "posZ": 64.245, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.2, - "scaleZ": 2.46 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142948271/A763104B91306431654FBA9E3D88FE0E23CE6E6E/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_stranger_things.json", - "GUID": "408301", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Stranger Things", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -11.225, - "posY": 1.624, - "posZ": 66.498, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": 0, - "posY": 0, - "posZ": 0, - "rotX": 270, - "rotY": 0, - "rotZ": 0, - "scaleX": 2, - "scaleY": 2, - "scaleZ": 2 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "https://github.com/ArkhamDotCards/returntothewendigo/blob/main/product/enUS/wendigo-boxart-difuse.png?raw=true", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_return_to_the_wendigo.json", - "GUID": "33f0f3", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Return to the Wendigo", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 20, - "posY": 1.5, - "posZ": 5, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": 0, - "posY": 0, - "posZ": 0, - "rotX": 270, - "rotY": 0, - "rotZ": 0, - "scaleX": 2, - "scaleY": 2, - "scaleZ": 2 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "https://github.com/ArkhamDotCards/returntoconsternationontheconstellation/blob/main/product/enUS/constellation-boxart-difuse.png?raw=true", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_return_to_consternation_on_the_constellation.json", - "GUID": "34ec55", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Return to Consternation on the Constellation", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 20, - "posY": 1.5, - "posZ": -5, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1620690956766119953/F8003A1B5AC39F2D2DABFF6D0AA2168CEC8BFA2C/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_miskatonic_mouse.json", - "GUID": "6defb8", - "Grid": true, - "GridProjection": false, - "Hands": true, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Miskatonic Mouse", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -9.063, - "posY": 1.626, - "posZ": 67.736, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142939810/7A53406FA1EFA9D556EF559B24A679E566114745/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_masks_of_nyarlathotep.json", - "GUID": "94a1f8", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Masks of Nyarlathotep – New York", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -10.843, - "posY": 1.622, - "posZ": 67.306, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.2, - "scaleZ": 2.46 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142938527/354E6204BB01AED91EAEB19D99E4D95620F99C56/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "An Android Universe crossover adventure", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_last_call_at_roxies.json", - "GUID": "c6a1ca", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Last Call at Roxie's", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -9.756, - "posY": 1.625, - "posZ": 64.388, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.2, - "scaleZ": 2.46 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142937041/3253F31B9483C3B5D0A98BA7E479E006FBF8D270/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_knightfall.json", - "GUID": "df62e8", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Knightfall", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -8.954, - "posY": 1.625, - "posZ": 65.45, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.2, - "scaleZ": 2.46 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/790858329422808079/1407B0AB89A9DBCFEE07A84A0979829556D84A78/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_jennys_choice.json", - "GUID": "a61b48", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Jenny's Choice", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -7.721, - "posY": 1.625, - "posZ": 66.962, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1016065907889320438/3DC5DD89D5DB56BE6EFDAC4A96E8063765576EA1/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_in_blackest_pits.json", - "GUID": "68380c", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "In Blackest Pits", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -10.332, - "posY": 1.625, - "posZ": 65.717, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142976303/C24C7169FD11E5D151DD2F754D5B9A5563D5DABB/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_happys_funhouse.json", - "GUID": "e7d9f8", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Happy's Funhouse", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -9.661, - "posY": 1.626, - "posZ": 67.684, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1746802526940892011/A775E42F9014CD75B091D7D060012681E58B906E/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "By Davi", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_fortune_or_folly.json", - "GUID": "7fa06f", - "Grid": true, - "GridProjection": false, - "Hands": true, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Fortune or Folly - Parallel Rex Murphy Set", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -9.336, - "posY": 1.625, - "posZ": 65.413, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1646593716898209387/B827263B809A6C8E1042BDF1C8D33E58458C2EF4/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_dont_starve.json", - "GUID": "ffc7ef", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Don't Starve", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -10.844, - "posY": 1.624, - "posZ": 65.409, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142900469/BDA1068C5A88459AE805540FE05B8092C4F8F392/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_delta_green.json", - "GUID": "ac164e", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Delta Green Convergence", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -10.226, - "posY": 1.625, - "posZ": 66.493, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1487830597915523099/252BD2089F9DEF3F337BB8AE681939DE98C1EFA7/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_darkness_falls.json", - "GUID": "c6a612", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Darkness Falls", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -9.268, - "posY": 1.626, - "posZ": 66.131, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1844797993644656426/EC19A65BD3119D5FA229F502D65D1D8DAA9E0ECB/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "Mint Tea Fan \u0026 Hauke", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_cosmic_pantheon.json", - "GUID": "ec74df", - "Grid": true, - "GridProjection": false, - "Hands": true, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Cosmic Pantheon", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 28.565, - "posY": 2.713, - "posZ": -13.986, - "rotX": 0, - "rotY": 270, - "rotZ": 357, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/762723517666349452/B8551E1479CED3BADEF4AF3B0A727EB7768C0289/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_consternation_on_the_constellation.json", - "GUID": "0ec730", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Consternation on the Constellation", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -9.232, - "posY": 1.658, - "posZ": 64.298, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1474319121422110285/8BA9D8C5CFA6D4E35DFC2077002CB2256DCFB2D7/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "A Farkham-con Original. Requires 3 XP", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_carnevale_of_spiders.json", - "GUID": "e57017", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Carnevale of Spiders", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -8.964, - "posY": 1.624, - "posZ": 64.592, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142919243/F3ED3E5B6B8725F536FCDA4FB2D40E1D11725037/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_bridge_of_sighs.json", - "GUID": "578e97", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Bridge of Sighs", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -8.301, - "posY": 1.625, - "posZ": 66.344, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.2, - "scaleZ": 2.46 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142918658/204E105211839B1E202E834F4A5C69E8E6A50A28/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_salem.json", - "GUID": "4237da", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Blood Spilled in Salem", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -10.624, - "posY": 1.623, - "posZ": 65.302, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.2, - "scaleZ": 2.46 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1865053883967763315/27C1F4299B5381DF5A40739696DC4CE6197D2BDC/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_incidents.json", - "GUID": "f1bfa2", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Arkham Incidents", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 59.762, - "posY": 3.398, - "posZ": -68.94, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142901599/7EE6EF24852C443DF5E92CF9498881E321CEE75A/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/scenario_wendigo.json", - "GUID": "4d5fa0", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Against the Wendigo", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 20.297, - "posY": 1.808, - "posZ": 7.547, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - } - ], - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1758068588410864087/97EBA1F7BA51181A664CE5A733AB092BA843E32D/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/core_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 6 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "5db60c", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "{\"ml\":[]}", - "MaterialIndex": -1, - "MeasureMovement": false, - "MeshIndex": -1, - "Name": "Custom_Model_Bag", - "Nickname": "Fan-Made Standalone Scenarios", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -9, - "posY": 1.481, - "posZ": -50, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 0.5, - "scaleY": 0.1, - "scaleZ": 0.5 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "Bag": { - "Order": 0 - }, - "ColorDiffuse": { - "b": 1, - "g": 1, - "r": 1 - }, - "ContainedObjects": [ - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142974098/BF07864708BDE2804C0495637DDD55E85CC883EA/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_winter_winds.json", - "GUID": "754057", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Winter Winds", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -20.939, - "posY": 1.614, - "posZ": 76.407, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1461933574036562700/261026F89C2322BF6390608AAB7DE43BEFB6240A/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_war_of_the_world.json", - "GUID": "19d469", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The War of the Worlds", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -9.099, - "posY": 1.625, - "posZ": 67.407, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142947772/120E2BA8DF8C4E2AAC9E059FA046CC3A6229ECDF/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "A Pathfinder Adventure for Arkham Horror", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_strange_aeons.json", - "GUID": "2abdd6", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Strange Aeons", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -9.015, - "posY": 1.627, - "posZ": 68.426, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "b": 0.40592, - "g": 0.40592, - "r": 0.40592 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "https://i.ibb.co/SrtzMNN/souls-of-darkness.png", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_souls_of_darkness.json", - "GUID": "a94e6b", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Souls of Darkness", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 18.626, - "posY": 1.849, - "posZ": 24.429, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "https://i.imgur.com/uGpKv09.png", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/core_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_memphis.json", - "GUID": "2634e3", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Sands Of Memphis Campaign Expansion", - "Snap": true, - "Sticky": true, - "Tags": [ - "LargeBox" - ], - "Tooltip": true, - "Transform": { - "posX": 0, - "posY": 1.5, - "posZ": -5, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 1, - "scaleY": 0.14, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 0, - "rotZ": 0, - "scaleX": 2, - "scaleY": 2, - "scaleZ": 2 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27843, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/2021606446230436832/9485F353EEE9717261DC545E0AE772A33A9E7E73/", - "MaterialIndex": 3, - "MeshURL": "http://pastebin.com/raw.php?i=uWAmuNZ2", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "v3", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_unofficial_return_to_tic.json", - "GUID": "bba2b6", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The (Unofficial) Return to The Innsmouth Conspiracy ", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -16.34, - "posY": 3.317, - "posZ": -73.441, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2, - "scaleY": 0.11, - "scaleZ": 1.69 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1597043896926982160/40A0068DAB05395205E184765110430CAADDA2CF/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_pokemon_eldrich_edition.json", - "GUID": "75fe78", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Pokemon Eldritch Edition", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -9.739, - "posY": 1.626, - "posZ": 67.217, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142944953/7A5D3A94BF4A7798157C999A3E1CEAAFC3652CAC/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_parallel_universe.json", - "GUID": "28e0a1", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Parallel Universe", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -8.766, - "posY": 1.626, - "posZ": 70.116, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142944372/7F67F8FDAD99C9C2A6A6A5E98C548681117D092C/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_outsider.json", - "GUID": "3c175c", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Outsider", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -8.832, - "posY": 1.627, - "posZ": 67.762, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1017195498765395843/F0F85DBE17C72D5D09BD012DEDBB9E154EB07E7B/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_ordo_templi_orientis.json", - "GUID": "608bea", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Ordo Templi Orientis", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -9.515, - "posY": 1.626, - "posZ": 67.753, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1705159936395227290/3E915F544AB47D63A4B1D05B0412216586EFA34A/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_of_sphinx_and_sands.json", - "GUID": "edb650", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Of Sphinx and Sands", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -9.647, - "posY": 1.626, - "posZ": 69.454, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142942211/3504BAF688D57DC30E7E1E2009A0FD4951D3BA58/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_north_country_cycle.json", - "GUID": "aaceca", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "North Country Cycle", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -8.64, - "posY": 1.625, - "posZ": 66.443, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1860561550045252585/5B883A570DB12EF90E66C9AC83D48B64A397F27D/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_machining_a_mystery.json", - "GUID": "79b36d", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Machining A Mystery", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -23.947, - "posY": 2.361, - "posZ": -59.241, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142939236/70113DAB44263CD5EA5A0913B4325A57B8113A4C/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_london_set.json", - "GUID": "0f96ac", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The London Set", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -7.639, - "posY": 1.626, - "posZ": 68.545, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142937909/81868D8E838249B9D5C467282B6EF12DC5879CA5/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_kiedy_sny_staj%C4%85_si%C4%99_rzeczywi%C5%9Bci%C4%85.json", - "GUID": "acdf16", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Kiedy sny Stają się Rzeczywiścią", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -7.368, - "posY": 1.626, - "posZ": 68.075, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.2, - "scaleZ": 2.46 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1673610640345018565/0AFEB7913AD4F24AA04D2CB7DCD97106F58D33D9/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "version 1.41", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_kaimonogatari.json", - "GUID": "2df25a", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Kaimonogatari", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -7.323, - "posY": 1.626, - "posZ": 68.341, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1847049778276522891/B0F1D72796E5A43963B6EFA6B7FD870A89B139AF/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_jumanji.json", - "GUID": "b46db2", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Jumanji", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 17.141, - "posY": 3.386, - "posZ": -31.21, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142946871/EAA18FFE753B1ED020A9F3117E9654B093369D26/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_into_the_shadowland.json", - "GUID": "019847", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Into the Shadowlands", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -5.02, - "posY": 1.62, - "posZ": 70.208, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1011563111884720834/103D38A8FBBFA64EB66439667F8775B15FC679C9/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_idol_thoughts.json", - "GUID": "2d417b", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Idol Thoughts", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -7.851, - "posY": 1.626, - "posZ": 68.831, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27843, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/2088037933344388834/4ECD1EA2BEA99E4C49F25B6C3077258791E4A9C4/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_heart_of_darkness.json", - "GUID": "cc95ff", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Heart of Darkness", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 12.25, - "posY": 1.5, - "posZ": 12, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27843, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/2005838229417815473/BC879D878262BA9FBD9040AE4F952468C3C4C2CC/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_half-life.json", - "GUID": "b46db2", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Half-Life", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -23.669, - "posY": 1.971, - "posZ": -108.203, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "https://uploads-ssl.webflow.com/608a6a98b5956379a9c9e768/60eb7c9fb63de7d60d8d67ec_boxart-defuse.png", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/core_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_onigawa.json", - "GUID": "8daa73", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Ghosts Of Onigawa Campaign Expansion", - "Snap": true, - "Sticky": true, - "Tags": [ - "LargeBox" - ], - "Tooltip": true, - "Transform": { - "posX": -1.059, - "posY": 4.289, - "posZ": 4.033, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 1, - "scaleY": 0.14, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/core_h_COL.obj", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "https://i.imgur.com/T97bYDU.pnghttps://i.imgur.com/T97bYDU.png", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/core_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_future_reflections.json", - "GUID": "0f0680", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Future Reflections", - "Snap": true, - "Sticky": true, - "Tags": [ - "LargeBox" - ], - "Tooltip": true, - "Transform": { - "posX": -9.202, - "posY": 1.629, - "posZ": 68.859, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 1, - "scaleY": 0.14, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1823394900012495167/63C400A27475E745FF94F8837D7A8AECC7F837F4/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/core_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_essence_of_humanity.json", - "GUID": "691339", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Essence of Humanity Campaign Box", - "Snap": true, - "Sticky": true, - "Tags": [ - "LargeBox" - ], - "Tooltip": true, - "Transform": { - "posX": 35.297, - "posY": 4.151, - "posZ": -6.402, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 1, - "scaleY": 0.14, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142922162/AD09D68EC542F778CCA3A4F5B33E17EF50AFE31B/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_dying_star.json", - "GUID": "bcfff6", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Dying Star", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -8.439, - "posY": 1.626, - "posZ": 68.396, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1699532377258479383/73EBF45477C1D927159E5993D99AD144641037EA/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "Final Release", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_dark_matter.json", - "GUID": "d713f4", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Dark Matter", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -8.253, - "posY": 1.626, - "posZ": 69.268, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "b": 0.39199, - "g": 0.39199, - "r": 0.39199 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1692775970051821718/827267BBD7EFBAD3EA384A5A04629B2E5BD88EE5/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_darkham_horror.json", - "GUID": "bc7fa7", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Darkham Horror", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 36.927, - "posY": 2.295, - "posZ": -84.235, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1746813422552975974/8FB3A4AF2D5A102720F630961A2270572ABA2317/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_cyclopean_foundations.json", - "GUID": "169eb9", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Cyclopean Foundations", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -7.513, - "posY": 1.625, - "posZ": 67.901, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "https://i.imgur.com/Vn2CXra.png", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "version 1.1", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_crown_of_egil.json", - "GUID": "7458b7", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Crown of Egil", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -7.139, - "posY": 1.625, - "posZ": 68.797, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": 0, - "posY": 0, - "posZ": 0, - "rotX": 270, - "rotY": 0, - "rotZ": 0, - "scaleX": 2, - "scaleY": 2, - "scaleZ": 2 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "b": 0.40592, - "g": 0.40592, - "r": 0.40592 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1972044023032948791/D32BECDAF5C9309577EE0CE585E980F62EFBCEF3/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_color_out_of_oz.json", - "GUID": "be7d21", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Color Out of Oz", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -37.697, - "posY": 3.218, - "posZ": -97.695, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/2018214163836048989/445ECEB6725E5387C41EEB8FBC69A3F247A5AD13/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/core_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "lv426", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_close_encounters.json", - "GUID": "4f5421", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Close Encounters of the LV-426 Kind", - "Snap": true, - "Sticky": true, - "Tags": [ - "LargeBox" - ], - "Tooltip": true, - "Transform": { - "posX": -14.861, - "posY": 2.58, - "posZ": -72.355, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 1, - "scaleY": 0.14, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27843, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/2001337710389944099/BC4BADD35E9E87F6BC0BAC93F0FCEB168848AAAC/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_circus_ex_mortis.json", - "GUID": "93b8cb", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Circus Ex Mortis Campaign", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -4.068, - "posY": 1.971, - "posZ": -123.425, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1754685726010541421/DC8223A713D02261326877B51FC717A9BAA217B8/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "5 Scenario Custom Cycle", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_celtic_rising.json", - "GUID": "4d305a", - "Grid": true, - "GridProjection": false, - "Hands": true, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Celtic Rising", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 26.688, - "posY": 5.16, - "posZ": -36.151, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1767067672754132384/EBC8D780049D2612C6BC0603BD87E94769C34D19/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_call_of_the_plaguebearer.json", - "GUID": "613b64", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Call of the Plaguebearer", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -6.243, - "posY": 1.624, - "posZ": 68.903, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/core_h_COL.obj", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "https://i.imgur.com/WtioCq1.jpg", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/core_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_bloodborne.json", - "GUID": "24fb2b", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Bloodborne - City of the Unseen", - "Snap": true, - "Sticky": true, - "Tags": [ - "LargeBox" - ], - "Tooltip": true, - "Transform": { - "posX": -9.282, - "posY": 2.682, - "posZ": -109.458, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 1, - "scaleY": 0.14, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/core_h_COL.obj", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1479949766318759506/9BAB9C45ECB33AC5A0F83806B5EF79A6D89C1D31/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/core_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_betrayal_at_mountains.json", - "GUID": "ef939a", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Betrayal at the Mountains of Madness", - "Snap": true, - "Sticky": true, - "Tags": [ - "LargeBox" - ], - "Tooltip": true, - "Transform": { - "posX": 61.155, - "posY": 3.407, - "posZ": -57.217, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 1, - "scaleY": 0.14, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/798737729142917748/FA44959693A82787BC34D6FA2487911AB24E619B/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_approaching_storm.json", - "GUID": "ab6b9a", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "The Approaching Storm", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -8.544, - "posY": 1.627, - "posZ": 69.136, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "a": 0.27451, - "b": 1, - "g": 1, - "r": 1 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1478823218929917964/80063921C2355FE26816A0E40F88D31F9EF5C4A6/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_alice_in_wonderland.json", - "GUID": "39916d", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Alice in Wonderland", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 15.308, - "posY": 1.825, - "posZ": -2.201, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "b": 0.40592, - "g": 0.40592, - "r": 0.40592 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1811004822724765158/DE184EBA95BF16D06DC2528B30E9058A87C7567E/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_ages_unwound.json", - "GUID": "f7e5eb", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Ages Unwound", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 18.626, - "posY": 1.849, - "posZ": 24.429, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" - } - ], - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1758068588410858852/B3312EB929FDEF7CB2B88F98CD757950B919B147/", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/core_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 6 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "89c32e", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "{\"ml\":[]}", - "MaterialIndex": -1, - "MeasureMovement": false, - "MeshIndex": -1, - "Name": "Custom_Model_Bag", - "Nickname": "Fan-Made Campaigns", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -9, - "posY": 1.481, - "posZ": -60, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 0.5, - "scaleY": 0.1, - "scaleZ": 0.5 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "Bag": { - "Order": 0 - }, - "ColorDiffuse": { - "b": 0, - "g": 0, - "r": 0 - }, - "ContainedObjects": [ - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "ContainedObjects": [ - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33001, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "63bde8", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -5.625, - "posY": 1.171, - "posZ": 0.319, - "rotX": 0, - "rotY": 180, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33034, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "0e05f2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.326, - "posY": 1.032, - "posZ": -3.647, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33033, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "9537b5", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -0.481, - "posY": 1.176, - "posZ": -3.573, - "rotX": 0, - "rotY": 0, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - } - ], - "CustomDeck": { - "330": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724071043/C8D7BE5AC836B4FBE1E6F4D4C52F8B85FE53CAC8/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526721823383/9C6FEA16C9541D3D98EB4CF0B636B9CF030F249E/", - "NumHeight": 5, - "NumWidth": 8, - "Type": 0, - "UniqueBack": false - } - }, - "DeckIDs": [ - 33000, - 33001, - 33002, - 33003, - 33004, - 33005, - 33006, - 33007, - 33008, - 33009, - 33010, - 33011, - 33012, - 33013, - 33014, - 33015, - 33016, - 33017, - 33018, - 33019, - 33020, - 33021, - 33022, - 33023, - 33024, - 33025, - 33026, - 33027, - 33028, - 33029, - 33030, - 33031, - 33032, - 33034, - 33033 - ], - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "5f3cba", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Deck", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 16.499, - "posY": 3.612, - "posZ": -39.144, - "rotX": 357, - "rotY": 270, - "rotZ": 185, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "b": 1, - "g": 1, - "r": 1 - }, - "Description": "\n\nAt the start of each scenario, each investigator is dealt 2 secret objectives, they choose one. If they complete their secret objective at any time during the scenario, they add the card to their PERSONAL victory display.\n\n", - "DragSelectable": true, - "GMNotes": "", - "GUID": "f3dfc9", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Notecard", - "Nickname": "HOW TO USE SECRET OBJ.", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 17.175, - "posY": 3.594, - "posZ": -38.818, - "rotX": 0, - "rotY": 90, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "ContainedObjects": [ - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33111, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "331": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724051130/604A4D98487815A81408F37D5FD4BD5201DDF087/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526724050690/73976114CA4EE3BB8BB03159476CAFAB63F551D3/", - "NumHeight": 4, - "NumWidth": 6, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "5249d8", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 7.158, - "posY": 1.231, - "posZ": 2.808, - "rotX": 0, - "rotY": 180, - "rotZ": 359, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33101, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "331": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724051130/604A4D98487815A81408F37D5FD4BD5201DDF087/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526724050690/73976114CA4EE3BB8BB03159476CAFAB63F551D3/", - "NumHeight": 4, - "NumWidth": 6, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "9e01c2", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 7.354, - "posY": 1.152, - "posZ": 2.884, - "rotX": 0, - "rotY": 180, - "rotZ": 1, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33111, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "331": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724051130/604A4D98487815A81408F37D5FD4BD5201DDF087/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526724050690/73976114CA4EE3BB8BB03159476CAFAB63F551D3/", - "NumHeight": 4, - "NumWidth": 6, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "5249d8", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 7.158, - "posY": 1.231, - "posZ": 2.808, - "rotX": 0, - "rotY": 180, - "rotZ": 359, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33111, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "331": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724051130/604A4D98487815A81408F37D5FD4BD5201DDF087/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526724050690/73976114CA4EE3BB8BB03159476CAFAB63F551D3/", - "NumHeight": 4, - "NumWidth": 6, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "5249d8", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 7.158, - "posY": 1.231, - "posZ": 2.808, - "rotX": 0, - "rotY": 180, - "rotZ": 359, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33111, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "331": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724051130/604A4D98487815A81408F37D5FD4BD5201DDF087/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526724050690/73976114CA4EE3BB8BB03159476CAFAB63F551D3/", - "NumHeight": 4, - "NumWidth": 6, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "5249d8", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 7.158, - "posY": 1.231, - "posZ": 2.808, - "rotX": 0, - "rotY": 180, - "rotZ": 359, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33111, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "331": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724051130/604A4D98487815A81408F37D5FD4BD5201DDF087/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526724050690/73976114CA4EE3BB8BB03159476CAFAB63F551D3/", - "NumHeight": 4, - "NumWidth": 6, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "5249d8", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 7.158, - "posY": 1.231, - "posZ": 2.808, - "rotX": 0, - "rotY": 180, - "rotZ": 359, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33111, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "331": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724051130/604A4D98487815A81408F37D5FD4BD5201DDF087/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526724050690/73976114CA4EE3BB8BB03159476CAFAB63F551D3/", - "NumHeight": 4, - "NumWidth": 6, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "5249d8", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 7.158, - "posY": 1.231, - "posZ": 2.808, - "rotX": 0, - "rotY": 180, - "rotZ": 359, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33111, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "331": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724051130/604A4D98487815A81408F37D5FD4BD5201DDF087/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526724050690/73976114CA4EE3BB8BB03159476CAFAB63F551D3/", - "NumHeight": 4, - "NumWidth": 6, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "5249d8", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 7.158, - "posY": 1.231, - "posZ": 2.808, - "rotX": 0, - "rotY": 180, - "rotZ": 359, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33111, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "331": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724051130/604A4D98487815A81408F37D5FD4BD5201DDF087/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526724050690/73976114CA4EE3BB8BB03159476CAFAB63F551D3/", - "NumHeight": 4, - "NumWidth": 6, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "5249d8", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 7.158, - "posY": 1.231, - "posZ": 2.808, - "rotX": 0, - "rotY": 180, - "rotZ": 359, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33111, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "331": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724051130/604A4D98487815A81408F37D5FD4BD5201DDF087/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526724050690/73976114CA4EE3BB8BB03159476CAFAB63F551D3/", - "NumHeight": 4, - "NumWidth": 6, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "5249d8", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 7.158, - "posY": 1.231, - "posZ": 2.808, - "rotX": 0, - "rotY": 180, - "rotZ": 359, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33111, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "331": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724051130/604A4D98487815A81408F37D5FD4BD5201DDF087/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526724050690/73976114CA4EE3BB8BB03159476CAFAB63F551D3/", - "NumHeight": 4, - "NumWidth": 6, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "5249d8", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 7.158, - "posY": 1.231, - "posZ": 2.808, - "rotX": 0, - "rotY": 180, - "rotZ": 359, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "CardID": 33111, - "ColorDiffuse": { - "b": 0.71324, - "g": 0.71324, - "r": 0.71324 - }, - "CustomDeck": { - "331": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724051130/604A4D98487815A81408F37D5FD4BD5201DDF087/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526724050690/73976114CA4EE3BB8BB03159476CAFAB63F551D3/", - "NumHeight": 4, - "NumWidth": 6, - "Type": 0, - "UniqueBack": false - } - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "5249d8", - "Grid": true, - "GridProjection": false, - "Hands": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Card", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 7.158, - "posY": 1.231, - "posZ": 2.808, - "rotX": 0, - "rotY": 180, - "rotZ": 359, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - } - ], - "CustomDeck": { - "331": { - "BackIsHidden": true, - "BackURL": "http://cloud-3.steamusercontent.com/ugc/976605526724051130/604A4D98487815A81408F37D5FD4BD5201DDF087/", - "FaceURL": "http://cloud-3.steamusercontent.com/ugc/976605526724050690/73976114CA4EE3BB8BB03159476CAFAB63F551D3/", - "NumHeight": 4, - "NumWidth": 6, - "Type": 0, - "UniqueBack": false - } - }, - "DeckIDs": [ - 33100, - 33101, - 33102, - 33103, - 33104, - 33105, - 33106, - 33107, - 33108, - 33109, - 33110, - 33111 - ], - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "1e8a13", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": true, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Deck", - "Nickname": "", - "SidewaysCard": false, - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 14.368, - "posY": 3.614, - "posZ": -31.021, - "rotX": 0, - "rotY": 270, - "rotZ": 180, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "b": 1, - "g": 1, - "r": 1 - }, - "Description": "\nAt the start of each scenario, investigators may collectively choose to draw a random ultimatum. These ultimatums significantly ramp up the difficulty of the game, but reward them should they overcome the challenges.", - "DragSelectable": true, - "GMNotes": "", - "GUID": "ed4645", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Notecard", - "Nickname": "HOW TO USE ULTIMATUMS", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 13.5, - "posY": 3.57, - "posZ": -31.298, - "rotX": 336, - "rotY": 87, - "rotZ": 7, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - } - ], - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "b2077d", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MaterialIndex": -1, - "MeasureMovement": false, - "MeshIndex": -1, - "Name": "Bag", - "Nickname": "Secret Objectives \u0026 Ultimatums", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -9, - "posY": 1.296, - "posZ": -55, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 1, - "scaleY": 1, - "scaleZ": 1 - }, - "Value": 0, - "XmlUI": "" - } - ], - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1758068588410888435/EDEEC5792F4161A1F125EF7F65AB1C1DC8FDBC27/", - "MaterialIndex": 3, - "MeshURL": "http://pastebin.com/raw.php?i=uWAmuNZ2", - "NormalURL": "", - "TypeIndex": 6 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "", - "GUID": "66e97c", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Utility memory bag by Directsun\r\n-- Version 2.5.2\r\n-- Fork of Memory Bag 2.0 by MrStump\r\n\r\nfunction updateSave()\r\n local data_to_save = {[\"ml\"]=memoryList}\r\n saved_data = JSON.encode(data_to_save)\r\n self.script_state = saved_data\r\nend\r\n\r\nfunction combineMemoryFromBagsWithin()\r\n local bagObjList = self.getObjects()\r\n for _, bagObj in ipairs(bagObjList) do\r\n local data = bagObj.lua_script_state\r\n if data ~= nil then\r\n local j = JSON.decode(data)\r\n if j ~= nil and j.ml ~= nil then\r\n for guid, entry in pairs(j.ml) do\r\n memoryList[guid] = entry\r\n end\r\n end\r\n end\r\n end\r\nend\r\n\r\nfunction updateMemoryWithMoves()\r\n memoryList = memoryListBackup\r\n --get the first transposed object's coordinates\r\n local obj = getObjectFromGUID(moveGuid)\r\n\r\n -- p1 is where needs to go, p2 is where it was\r\n local refObjPos = memoryList[moveGuid].pos\r\n local deltaPos = findOffsetDistance(obj.getPosition(), refObjPos, nil)\r\n local movedRotation = obj.getRotation()\r\n for guid, entry in pairs(memoryList) do\r\n memoryList[guid].pos.x = entry.pos.x - deltaPos.x\r\n memoryList[guid].pos.y = entry.pos.y - deltaPos.y\r\n memoryList[guid].pos.z = entry.pos.z - deltaPos.z\r\n -- memoryList[guid].rot.x = movedRotation.x\r\n -- memoryList[guid].rot.y = movedRotation.y\r\n -- memoryList[guid].rot.z = movedRotation.z\r\n end\r\n\r\n --theList[obj.getGUID()] = {\r\n -- pos={x=round(pos.x,4), y=round(pos.y,4), z=round(pos.z,4)},\r\n -- rot={x=round(rot.x,4), y=round(rot.y,4), z=round(rot.z,4)},\r\n -- lock=obj.getLock()\r\n --}\r\n moveList = {}\r\nend\r\n\r\nfunction onload(saved_data)\r\n fresh = true\r\n if saved_data ~= \"\" then\r\n local loaded_data = JSON.decode(saved_data)\r\n --Set up information off of loaded_data\r\n memoryList = loaded_data.ml\r\n else\r\n --Set up information for if there is no saved saved data\r\n memoryList = {}\r\n end\r\n\r\n moveList = {}\r\n moveGuid = nil\r\n\r\n if next(memoryList) == nil then\r\n createSetupButton()\r\n else\r\n fresh = false\r\n createMemoryActionButtons()\r\n end\r\nend\r\n\r\n\r\n--Beginning Setup\r\n\r\n\r\n--Make setup button\r\nfunction createSetupButton()\r\n self.createButton({\r\n label=\"Setup\", click_function=\"buttonClick_setup\", function_owner=self,\r\n position={0,0.1,-6}, rotation={0,0,0}, height=500, width=1200,\r\n font_size=350, color={0,0,0}, font_color={1,1,1}\r\n })\r\nend\r\n\r\n--Triggered by Transpose button\r\nfunction buttonClick_transpose()\r\n moveGuid = nil\r\n broadcastToAll(\"Select one object and move it- all objects will move relative to the new location\", {0.75, 0.75, 1})\r\n memoryListBackup = duplicateTable(memoryList)\r\n memoryList = {}\r\n moveList = {}\r\n self.clearButtons()\r\n createButtonsOnAllObjects(true)\r\n createSetupActionButtons(true)\r\nend\r\n\r\n--Triggered by setup button,\r\nfunction buttonClick_setup()\r\n memoryListBackup = duplicateTable(memoryList)\r\n memoryList = {}\r\n self.clearButtons()\r\n createButtonsOnAllObjects(false)\r\n createSetupActionButtons(false)\r\nend\r\n\r\nfunction getAllObjectsInMemory()\r\n local objTable = {}\r\n local curObj = {}\r\n\r\n for guid in pairs(memoryListBackup) do\r\n curObj = getObjectFromGUID(guid)\r\n table.insert(objTable, curObj)\r\n end\r\n\r\n return objTable\r\n -- return getAllObjects()\r\nend\r\n\r\n--Creates selection buttons on objects\r\nfunction createButtonsOnAllObjects(move)\r\n local howManyButtons = 0\r\n\r\n local objsToHaveButtons = {}\r\n if move == true then\r\n objsToHaveButtons = getAllObjectsInMemory()\r\n else\r\n objsToHaveButtons = getAllObjects()\r\n end\r\n\r\n for _, obj in ipairs(objsToHaveButtons) do\r\n if obj ~= self then\r\n local dummyIndex = howManyButtons\r\n --On a normal bag, the button positions aren't the same size as the bag.\r\n globalScaleFactor = 1 * 1/self.getScale().x\r\n --Super sweet math to set button positions\r\n local selfPos = self.getPosition()\r\n local objPos = obj.getPosition()\r\n local deltaPos = findOffsetDistance(selfPos, objPos, obj)\r\n local objPos = rotateLocalCoordinates(deltaPos, self)\r\n objPos.x = -objPos.x * globalScaleFactor\r\n objPos.y = objPos.y * globalScaleFactor + 4\r\n objPos.z = objPos.z * globalScaleFactor\r\n --Offset rotation of bag\r\n local rot = self.getRotation()\r\n rot.y = -rot.y + 180\r\n --Create function\r\n local funcName = \"selectButton_\" .. howManyButtons\r\n local func = function() buttonClick_selection(dummyIndex, obj, move) end\r\n local color = {0.75,0.25,0.25,0.6}\r\n local colorMove = {0,0,1,0.6}\r\n if move == true then\r\n color = colorMove\r\n end\r\n self.setVar(funcName, func)\r\n self.createButton({\r\n click_function=funcName, function_owner=self,\r\n position=objPos, rotation=rot, height=1000, width=1000,\r\n color=color,\r\n })\r\n howManyButtons = howManyButtons + 1\r\n end\r\n end\r\nend\r\n\r\n--Creates submit and cancel buttons\r\nfunction createSetupActionButtons(move)\r\n self.createButton({\r\n label=\"Cancel\", click_function=\"buttonClick_cancel\", function_owner=self,\r\n position={0,1,-2}, rotation={0,0,0}, height=240, width=550,\r\n font_size=150, color={0,0,0}, font_color={1,1,1}\r\n })\r\n\r\n self.createButton({\r\n label=\"Submit\", click_function=\"buttonClick_submit\", function_owner=self,\r\n position={-1.2,1,-2}, rotation={0,0,0}, height=240, width=570,\r\n font_size=150, color={0,0,0}, font_color={1,1,1}\r\n })\r\n\r\n if move == false then\r\n self.createButton({\r\n label=\"Add\", click_function=\"buttonClick_add\", function_owner=self,\r\n position={-1.2,1,2}, rotation={0,0,0}, height=240, width=550,\r\n font_size=150, color={0,0,0}, font_color={0.25,1,0.25}\r\n })\r\n\r\n if fresh == false then\r\n self.createButton({\r\n label=\"Set New\", click_function=\"buttonClick_setNew\", function_owner=self,\r\n position={0,1,2}, rotation={0,0,0}, height=240, width=600,\r\n font_size=150, color={0,0,0}, font_color={0.75,0.75,1}\r\n })\r\n self.createButton({\r\n label=\"Remove\", click_function=\"buttonClick_remove\", function_owner=self,\r\n position={1.3,1,2}, rotation={0,0,0}, height=240, width=600,\r\n font_size=150, color={0,0,0}, font_color={1,0.25,0.25}\r\n })\r\n end\r\n end\r\n\r\n self.createButton({\r\n label=\"Reset\", click_function=\"buttonClick_reset\", function_owner=self,\r\n position={1.2,1,-2}, rotation={0,0,0}, height=240, width=500,\r\n font_size=150, color={0,0,0}, font_color={1,1,1}\r\n })\r\nend\r\n\r\n\r\n--During Setup\r\n\r\n\r\n--Checks or unchecks buttons\r\nfunction buttonClick_selection(index, obj, move)\r\n local colorMove = {0,0,1,0.6}\r\n local color = {0,1,0,0.6}\r\n\r\n previousGuid = selectedGuid\r\n selectedGuid = obj.getGUID()\r\n\r\n theList = memoryList\r\n if move == true then\r\n theList = moveList\r\n if previousGuid ~= nil and previousGuid ~= selectedGuid then\r\n local prevObj = getObjectFromGUID(previousGuid)\r\n prevObj.highlightOff()\r\n self.editButton({index=previousIndex, color=colorMove})\r\n theList[previousGuid] = nil\r\n end\r\n previousIndex = index\r\n end\r\n\r\n if theList[selectedGuid] == nil then\r\n self.editButton({index=index, color=color})\r\n --Adding pos/rot to memory table\r\n local pos, rot = obj.getPosition(), obj.getRotation()\r\n --I need to add it like this or it won't save due to indexing issue\r\n theList[obj.getGUID()] = {\r\n pos={x=round(pos.x,4), y=round(pos.y,4), z=round(pos.z,4)},\r\n rot={x=round(rot.x,4), y=round(rot.y,4), z=round(rot.z,4)},\r\n lock=obj.getLock()\r\n }\r\n obj.highlightOn({0,1,0})\r\n else\r\n color = {0.75,0.25,0.25,0.6}\r\n if move == true then\r\n color = colorMove\r\n end\r\n self.editButton({index=index, color=color})\r\n theList[obj.getGUID()] = nil\r\n obj.highlightOff()\r\n end\r\nend\r\n\r\n--Cancels selection process\r\nfunction buttonClick_cancel()\r\n memoryList = memoryListBackup\r\n moveList = {}\r\n self.clearButtons()\r\n if next(memoryList) == nil then\r\n createSetupButton()\r\n else\r\n createMemoryActionButtons()\r\n end\r\n removeAllHighlights()\r\n broadcastToAll(\"Selection Canceled\", {1,1,1})\r\n moveGuid = nil\r\nend\r\n\r\n--Saves selections\r\nfunction buttonClick_submit()\r\n fresh = false\r\n if next(moveList) ~= nil then\r\n for guid in pairs(moveList) do\r\n moveGuid = guid\r\n end\r\n if memoryListBackup[moveGuid] == nil then\r\n broadcastToAll(\"Item selected for moving is not already in memory\", {1, 0.25, 0.25})\r\n else\r\n broadcastToAll(\"Moving all items in memory relative to new objects position!\", {0.75, 0.75, 1})\r\n self.clearButtons()\r\n createMemoryActionButtons()\r\n local count = 0\r\n for guid in pairs(moveList) do\r\n moveGuid = guid\r\n count = count + 1\r\n local obj = getObjectFromGUID(guid)\r\n if obj ~= nil then obj.highlightOff() end\r\n end\r\n updateMemoryWithMoves()\r\n updateSave()\r\n buttonClick_place()\r\n end\r\n elseif next(memoryList) == nil and moveGuid == nil then\r\n memoryList = memoryListBackup\r\n broadcastToAll(\"No selections made.\", {0.75, 0.25, 0.25})\r\n end\r\n combineMemoryFromBagsWithin()\r\n self.clearButtons()\r\n createMemoryActionButtons()\r\n local count = 0\r\n for guid in pairs(memoryList) do\r\n count = count + 1\r\n local obj = getObjectFromGUID(guid)\r\n if obj ~= nil then obj.highlightOff() end\r\n end\r\n broadcastToAll(count..\" Objects Saved\", {1,1,1})\r\n updateSave()\r\n moveGuid = nil\r\nend\r\n\r\nfunction combineTables(first_table, second_table)\r\n for k,v in pairs(second_table) do first_table[k] = v end\r\nend\r\n\r\nfunction buttonClick_add()\r\n fresh = false\r\n combineTables(memoryList, memoryListBackup)\r\n broadcastToAll(\"Adding internal bags and selections to existing memory\", {0.25, 0.75, 0.25})\r\n combineMemoryFromBagsWithin()\r\n self.clearButtons()\r\n createMemoryActionButtons()\r\n local count = 0\r\n for guid in pairs(memoryList) do\r\n count = count + 1\r\n local obj = getObjectFromGUID(guid)\r\n if obj ~= nil then obj.highlightOff() end\r\n end\r\n broadcastToAll(count..\" Objects Saved\", {1,1,1})\r\n updateSave()\r\nend\r\n\r\nfunction buttonClick_remove()\r\n broadcastToAll(\"Removing Selected Entries From Memory\", {1.0, 0.25, 0.25})\r\n self.clearButtons()\r\n createMemoryActionButtons()\r\n local count = 0\r\n for guid in pairs(memoryList) do\r\n count = count + 1\r\n memoryListBackup[guid] = nil\r\n local obj = getObjectFromGUID(guid)\r\n if obj ~= nil then obj.highlightOff() end\r\n end\r\n broadcastToAll(count..\" Objects Removed\", {1,1,1})\r\n memoryList = memoryListBackup\r\n updateSave()\r\nend\r\n\r\nfunction buttonClick_setNew()\r\n broadcastToAll(\"Setting new position relative to items in memory\", {0.75, 0.75, 1})\r\n self.clearButtons()\r\n createMemoryActionButtons()\r\n local count = 0\r\n for _, obj in ipairs(getAllObjects()) do\r\n guid = obj.guid\r\n if memoryListBackup[guid] ~= nil then\r\n count = count + 1\r\n memoryListBackup[guid].pos = obj.getPosition()\r\n memoryListBackup[guid].rot = obj.getRotation()\r\n memoryListBackup[guid].lock = obj.getLock()\r\n end\r\n end\r\n broadcastToAll(count..\" Objects Saved\", {1,1,1})\r\n memoryList = memoryListBackup\r\n updateSave()\r\nend\r\n\r\n--Resets bag to starting status\r\nfunction buttonClick_reset()\r\n fresh = true\r\n memoryList = {}\r\n self.clearButtons()\r\n createSetupButton()\r\n removeAllHighlights()\r\n broadcastToAll(\"Tool Reset\", {1,1,1})\r\n updateSave()\r\nend\r\n\r\n\r\n--After Setup\r\n\r\n\r\n--Creates recall and place buttons\r\nfunction createMemoryActionButtons()\r\n self.createButton({\r\n label=\"Place\", click_function=\"buttonClick_place\", function_owner=self,\r\n position={0.7,1,2}, rotation={0,0,0}, height=280, width=600,\r\n font_size=200, color={0,0,0}, font_color={1,1,1}\r\n })\r\n self.createButton({\r\n label=\"Recall\", click_function=\"buttonClick_recall\", function_owner=self,\r\n position={-0.7,1,2}, rotation={0,0,0}, height=280, width=650,\r\n font_size=200, color={0,0,0}, font_color={1,1,1}\r\n })\r\n self.createButton({\r\n label=\"Setup\", click_function=\"buttonClick_setup\", function_owner=self,\r\n position={0,1,-2}, rotation={0,0,0}, height=240, width=500,\r\n font_size=150, color={0,0,0}, font_color={1,1,1}\r\n })\r\n\r\n--- self.createButton({\r\n--- label=\"Move\", click_function=\"buttonClick_transpose\", function_owner=self,\r\n--- position={-2.8,0.3,0}, rotation={0,0,0}, height=350, width=800,\r\n--- font_size=250, color={0,0,0}, font_color={0.75,0.75,1}\r\n--- })\r\nend\r\n\r\n--Sends objects from bag/table to their saved position/rotation\r\nfunction buttonClick_place()\r\n local bagObjList = self.getObjects()\r\n for guid, entry in pairs(memoryList) do\r\n local obj = getObjectFromGUID(guid)\r\n --If obj is out on the table, move it to the saved pos/rot\r\n if obj ~= nil then\r\n obj.setPositionSmooth(entry.pos)\r\n obj.setRotationSmooth(entry.rot)\r\n obj.setLock(entry.lock)\r\n else\r\n --If obj is inside of the bag\r\n for _, bagObj in ipairs(bagObjList) do\r\n if bagObj.guid == guid then\r\n local item = self.takeObject({\r\n guid=guid, position=entry.pos, rotation=entry.rot, smooth=false\r\n })\r\n item.setLock(entry.lock)\r\n break\r\n end\r\n end\r\n end\r\n end\r\n broadcastToAll(\"Objects Placed\", {1,1,1})\r\nend\r\n\r\n--Recalls objects to bag from table\r\nfunction buttonClick_recall()\r\n for guid, entry in pairs(memoryList) do\r\n local obj = getObjectFromGUID(guid)\r\n if obj ~= nil then self.putObject(obj) end\r\n end\r\n broadcastToAll(\"Objects Recalled\", {1,1,1})\r\nend\r\n\r\n\r\n--Utility functions\r\n\r\n\r\n--Find delta (difference) between 2 x/y/z coordinates\r\nfunction findOffsetDistance(p1, p2, obj)\r\n local yOffset = 0\r\n if obj ~= nil then\r\n local bounds = obj.getBounds()\r\n yOffset = (bounds.size.y - bounds.offset.y)\r\n end\r\n local deltaPos = {}\r\n deltaPos.x = (p2.x-p1.x)\r\n deltaPos.y = (p2.y-p1.y) + yOffset\r\n deltaPos.z = (p2.z-p1.z)\r\n return deltaPos\r\nend\r\n\r\n--Used to rotate a set of coordinates by an angle\r\nfunction rotateLocalCoordinates(desiredPos, obj)\r\n\tlocal objPos, objRot = obj.getPosition(), obj.getRotation()\r\n local angle = math.rad(objRot.y)\r\n\tlocal x = desiredPos.x * math.cos(angle) - desiredPos.z * math.sin(angle)\r\n\tlocal z = desiredPos.x * math.sin(angle) + desiredPos.z * math.cos(angle)\r\n\t--return {x=objPos.x+x, y=objPos.y+desiredPos.y, z=objPos.z+z}\r\n return {x=x, y=desiredPos.y, z=z}\r\nend\r\n\r\nfunction rotateMyCoordinates(desiredPos, obj)\r\n\tlocal angle = math.rad(obj.getRotation().y)\r\n local x = desiredPos.x * math.sin(angle)\r\n\tlocal z = desiredPos.z * math.cos(angle)\r\n return {x=x, y=desiredPos.y, z=z}\r\nend\r\n\r\n--Coroutine delay, in seconds\r\nfunction wait(time)\r\n local start = os.time()\r\n repeat coroutine.yield(0) until os.time() \u003e start + time\r\nend\r\n\r\n--Duplicates a table (needed to prevent it making reference to the same objects)\r\nfunction duplicateTable(oldTable)\r\n local newTable = {}\r\n for k, v in pairs(oldTable) do\r\n newTable[k] = v\r\n end\r\n return newTable\r\nend\r\n\r\n--Moves scripted highlight from all objects\r\nfunction removeAllHighlights()\r\n for _, obj in ipairs(getAllObjects()) do\r\n obj.highlightOff()\r\n end\r\nend\r\n\r\n--Round number (num) to the Nth decimal (dec)\r\nfunction round(num, dec)\r\n local mult = 10^(dec or 0)\r\n return math.floor(num * mult + 0.5) / mult\r\nend\r", - "LuaScriptState": "{\"ml\":{\"5db60c\":{\"lock\":false,\"pos\":{\"x\":-9,\"y\":1.4815,\"z\":-50},\"rot\":{\"x\":0,\"y\":270.0001,\"z\":0}},\"89c32e\":{\"lock\":false,\"pos\":{\"x\":-9,\"y\":1.4815,\"z\":-60},\"rot\":{\"x\":0,\"y\":270.0001,\"z\":0}},\"b2077d\":{\"lock\":false,\"pos\":{\"x\":-9,\"y\":1.2965,\"z\":-55},\"rot\":{\"x\":0,\"y\":269.9973,\"z\":0}}}}\r", - "MaterialIndex": -1, - "MeasureMovement": false, - "MeshIndex": -1, - "Name": "Custom_Model_Bag", - "Nickname": "Fan-Made Scenarios/Campaigns/Miscellany", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 0, - "posY": 1.866, - "posZ": -55, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 1.76, - "scaleY": 0.11, - "scaleZ": 1.49 - }, - "Value": 0, - "XmlUI": "" - }, { "AltLookAngle": { "x": 0, @@ -201644,7 +194599,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/VictoryDisplay\")\nend)\n__bundle_register(\"core/VictoryDisplay\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal playAreaApi = require(\"core/PlayAreaApi\")\nlocal tokenChecker = require(\"core/token/TokenChecker\")\n\nlocal pendingCall = false\nlocal messageSent = {}\nlocal missingData = {}\nlocal countedVP = {}\n\nlocal highlightMissing = false\nlocal highlightCounted = false\n\nlocal TRASHCAN\nlocal TRASHCAN_GUID = \"70b9f6\"\n\n-- button creation when loading the game\nfunction onLoad()\n TRASHCAN = getObjectFromGUID(TRASHCAN_GUID)\n\n -- index 0: VP - \"Display\"\n local buttonParameters = {}\n buttonParameters.label = \"0\"\n buttonParameters.click_function = \"none\"\n buttonParameters.function_owner = self\n buttonParameters.scale = { 0.15, 0.15, 0.15 }\n buttonParameters.width = 0\n buttonParameters.height = 0\n buttonParameters.font_size = 600\n buttonParameters.font_color = { 1, 1, 1 }\n buttonParameters.position = { x = -0.72, y = 0.06, z = -0.69 }\n self.createButton(buttonParameters)\n\n -- index 1: VP - \"Play Area\"\n buttonParameters.position.x = 0.65\n self.createButton(buttonParameters)\n\n -- index 2: VP - \"Total\"\n buttonParameters.position.x = 1.69\n self.createButton(buttonParameters)\n\n -- index 3: highlighting button (missing data)\n self.createButton({\n label = \"!\",\n click_function = \"highlightMissingData\",\n tooltip = \"Enable highlighting of cards without metadata (VP on these is not counted).\",\n function_owner = self,\n scale = { 0.15, 0.15, 0.15 },\n color = { 1, 0, 0 },\n width = 700,\n height = 800,\n font_size = 700,\n font_color = { 1, 1, 1 },\n position = { x = 1.82, y = 0.06, z = -1.32 }\n })\n\n -- index 4: highlighting button (counted VP)\n self.createButton({\n label = \"?\",\n click_function = \"highlightCountedVP\",\n tooltip = \"Enable highlighting of cards with VP.\",\n function_owner = self,\n scale = { 0.15, 0.15, 0.15 },\n color = { 0, 1, 0 },\n width = 700,\n height = 800,\n font_size = 700,\n font_color = { 1, 1, 1 },\n position = { x = 1.5, y = 0.06, z = -1.32 }\n })\n\n -- update the display label once\n Wait.time(updateCount, 1)\nend\n\n---------------------------------------------------------\n-- events with descriptions\n---------------------------------------------------------\n\n-- dropping an object on the victory display\nfunction onCollisionEnter()\n startUpdate()\nend\n\n-- removing an object from the victory display\nfunction onCollisionExit()\n startUpdate()\nend\n\n-- picking a clue or location up\nfunction onObjectPickUp(_, obj)\n maybeUpdate(obj)\nend\n\n-- dropping a clue or location\nfunction onObjectDrop(_, obj)\n maybeUpdate(obj, 1)\nend\n\n-- flipping a clue/doom or location\nfunction onObjectRotate(obj, _, flip, _, _, oldFlip)\n if flip == oldFlip then return end\n maybeUpdate(obj, 1, true)\nend\n\n-- destroying a clue or location\nfunction onObjectDestroy(obj)\n maybeUpdate(obj)\nend\n\n---------------------------------------------------------\n-- main functionality\n---------------------------------------------------------\n\nfunction maybeUpdate(obj, delay, flipped)\n -- stop if there is already an update call running\n if pendingCall then return end\n\n -- stop if obj is nil (by e.g. dropping a clue onto another and making a stack)\n if obj == nil then return end\n\n -- only continue for clues / doom tokens or locations\n if obj.hasTag(\"Location\") then\n elseif obj.memo == \"clueDoom\" then\n -- only continue if the clue side is up or a doom token is being flipped\n if obj.is_face_down == true and flipped ~= true then return end\n else\n return\n end\n\n -- only continue if the obj in in the play area\n if not playAreaApi.isInPlayArea(obj) then return end\n\n startUpdate(delay)\nend\n\n-- starts an update\nfunction startUpdate(delay)\n -- stop if there is already an update call running\n if pendingCall then return end\n pendingCall = true\n delay = tonumber(delay) or 0\n Wait.time(updateCount, delay + 0.2)\nend\n\n-- counts the VP in the victory display and request the VP count from the play area\nfunction updateCount()\n missingData = {}\n countedVP = {}\n local victoryPoints = {}\n victoryPoints.display = 0\n victoryPoints.playArea = playAreaApi.countVP()\n\n -- count cards in victory display\n for _, v in ipairs(searchOnObj(self)) do\n local obj = v.hit_object\n\n -- check metadata for VP\n if obj.tag == \"Card\" then\n local VP = getCardVP(obj, JSON.decode(obj.getGMNotes()))\n victoryPoints.display = victoryPoints.display + VP\n if VP \u003e 0 then\n table.insert(countedVP, obj)\n end\n\n -- handling for stacked cards\n elseif obj.tag == \"Deck\" then\n local VP = 0\n for _, deepObj in ipairs(obj.getObjects()) do\n local deepVP = getCardVP(obj, JSON.decode(deepObj.gm_notes))\n victoryPoints.display = victoryPoints.display + deepVP\n if deepVP \u003e 0 then\n VP = VP + 1\n end\n end\n if VP \u003e 0 then\n table.insert(countedVP, obj)\n end\n end\n end\n\n -- update the buttons that are used as labels\n self.editButton({ index = 0, label = victoryPoints.display })\n self.editButton({ index = 1, label = victoryPoints.playArea })\n self.editButton({ index = 2, label = victoryPoints.display + victoryPoints.playArea })\n\n -- allow new update calls\n pendingCall = false\nend\n\n-- gets the VP count from the notes\nfunction getCardVP(obj, notes)\n local cardVP\n if notes ~= nil then\n -- enemy, treachery etc.\n cardVP = tonumber(notes.victory)\n\n -- location\n if not cardVP then\n -- check the correct side of the location\n if not obj.is_face_down and notes.locationFront ~= nil then\n cardVP = tonumber(notes.locationFront.victory)\n elseif notes.locationBack ~= nil then\n cardVP = tonumber(notes.locationBack.victory)\n end\n end\n if (cardVP or 0) \u003e 0 then\n table.insert(countedVP, obj)\n end\n else\n table.insert(missingData, obj)\n end\n return cardVP or 0\nend\n\n-- toggles the highlight for objects with missing metadata\nfunction highlightMissingData()\n self.editButton({\n index = 3,\n tooltip = (highlightMissing and \"Enable\" or \"Disable\") ..\n \" highlighting of cards without metadata (VP on these is not counted).\"\n })\n for _, obj in pairs(missingData) do\n if obj ~= nil then\n if highlightMissing then\n obj.highlightOff(\"Red\")\n else\n obj.highlightOn(\"Red\")\n end\n end\n end\n playAreaApi.highlightMissingData(highlightMissing)\n highlightMissing = not highlightMissing\nend\n\n-- toggles the highlight for objects that were counted\nfunction highlightCountedVP()\n self.editButton({\n index = 4,\n tooltip = (highlightCounted and \"Enable\" or \"Disable\") ..\n \" highlighting of cards with VP.\"\n })\n for _, obj in pairs(countedVP) do\n if obj ~= nil then\n if highlightCounted then\n obj.highlightOff(\"Green\")\n else\n obj.highlightOn(\"Green\")\n end\n end\n end\n playAreaApi.highlightCountedVP(highlightCounted)\n highlightCounted = not highlightCounted\nend\n\n-- places the provided card in the first empty spot\nfunction placeCard(card)\n -- check snap point states\n local snaps = self.getSnapPoints()\n table.sort(snaps, function(a, b) return a.position.x \u003e b.position.x end)\n table.sort(snaps, function(a, b) return a.position.z \u003c b.position.z end)\n\n -- get first empty slot\n local fullSlots = {}\n local positions = {}\n for i, snap in ipairs(snaps) do\n positions[i] = self.positionToWorld(snap.position)\n local hits = checkSnapPointState(positions[i])\n\n -- first hit is self, additional hits must be cards / decks\n if #hits \u003e 1 then\n fullSlots[i] = true\n end\n end\n\n -- remove tokens from the card\n for _, v in ipairs(searchOnObj(card)) do\n local obj = v.hit_object\n\n -- don't touch decks / cards\n if obj.tag == \"Deck\" or obj.tag == \"Card\" then\n -- put chaos tokens back into bag\n elseif tokenChecker.isChaosToken(obj) then\n local chaosBag = chaosBagApi.findChaosBag()\n chaosBag.putObject(obj)\n elseif obj.memo ~= nil and obj.getLock() == false then\n TRASHCAN.putObject(obj)\n end\n end\n \n -- place the card\n local name = card.getName() or \"Unnamed card\"\n for i = 1, 10 do\n if fullSlots[i] ~= true then\n local rot = { 0, 270, card.getRotation().z }\n card.setPositionSmooth(positions[i], false, true)\n card.setRotation(rot)\n broadcastToAll(\"Victory Display: \" .. name .. \" placed into slot \" .. i .. \".\", \"Green\")\n return\n end\n end\n\n broadcastToAll(\"Victory Display is full! \" .. name .. \" placed into slot 1.\", \"Orange\")\n card.setPositionSmooth(positions[1], false, true)\nend\n\n---------------------------------------------------------\n-- utility functions\n---------------------------------------------------------\n\n-- searches on an object\nfunction searchOnObj(obj)\n return Physics.cast({\n direction = { 0, 1, 0 },\n max_distance = 0.5,\n type = 3,\n size = obj.getBounds().size,\n origin = obj.getPosition()\n })\nend\n\nfunction checkSnapPointState(pos)\n return Physics.cast({\n direction = { 0, 1, 0 },\n max_distance = 0.1,\n type = 3,\n size = { 0.1, 0.1, 0.1 },\n origin = pos\n })\nend\n\n-- search a table for a value, return true if found (else returns false)\nfunction tableContains(table, value)\n for _, v in ipairs(table) do\n if v == value then\n return true\n end\n end\n return false\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = { }\n local PLAY_AREA_GUID = \"721ba2\"\n local INVESTIGATOR_COUNTER_GUID = \"f182ee\"\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with\n -- 'displacement_excluded'\n ---@param playerColor Color of the player requesting the shift. Used solely to send an error\n --- message in the unlikely case that the scripting zone has been deleted\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"tryObjectEnterContainer\",\n { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightCountedVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\n__bundle_register(\"core/token/TokenChecker\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local CHAOS_TOKEN_NAMES = {\n [\"Elder Sign\"] = true,\n [\"+1\"] = true,\n [\"0\"] = true,\n [\"-1\"] = true,\n [\"-2\"] = true,\n [\"-3\"] = true,\n [\"-4\"] = true,\n [\"-5\"] = true,\n [\"-6\"] = true,\n [\"-7\"] = true,\n [\"-8\"] = true,\n [\"Skull\"] = true,\n [\"Cultist\"] = true,\n [\"Tablet\"] = true,\n [\"Elder Thing\"] = true,\n [\"Auto-fail\"] = true,\n [\"Bless\"] = true,\n [\"Curse\"] = true,\n [\"Frost\"] = true\n }\n\n local TokenChecker = {}\n\n -- returns true if the passed object is a chaos token (by name)\n TokenChecker.isChaosToken = function(obj)\n if CHAOS_TOKEN_NAMES[obj.getName()] then\n return true\n else\n return false\n end\n end\n\n return TokenChecker\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getPlayArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"PlayArea\")\n end\n\n local function getInvestigatorCounter()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"InvestigatorCounter\")\n end\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getInvestigatorCounter().getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n getInvestigatorCounter().call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with 'displacement_excluded'\n ---@param playerColor Color Color of the player requesting the shift for messages\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getPlayArea().call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getPlayArea().call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getPlayArea().call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getPlayArea().call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getPlayArea().call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getPlayArea().call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getPlayArea().call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getPlayArea().call(\"tryObjectEnterContainer\", { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getPlayArea().call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getPlayArea().call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getPlayArea().call(\"countVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getPlayArea().call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getPlayArea().getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getPlayArea().call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getPlayArea().call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getPlayArea().getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\n__bundle_register(\"core/token/TokenChecker\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local CHAOS_TOKEN_NAMES = {\n [\"Elder Sign\"] = true,\n [\"+1\"] = true,\n [\"0\"] = true,\n [\"-1\"] = true,\n [\"-2\"] = true,\n [\"-3\"] = true,\n [\"-4\"] = true,\n [\"-5\"] = true,\n [\"-6\"] = true,\n [\"-7\"] = true,\n [\"-8\"] = true,\n [\"Skull\"] = true,\n [\"Cultist\"] = true,\n [\"Tablet\"] = true,\n [\"Elder Thing\"] = true,\n [\"Auto-fail\"] = true,\n [\"Bless\"] = true,\n [\"Curse\"] = true,\n [\"Frost\"] = true\n }\n\n local TokenChecker = {}\n\n -- returns true if the passed object is a chaos token (by name)\n TokenChecker.isChaosToken = function(obj)\n if CHAOS_TOKEN_NAMES[obj.getName()] then\n return true\n else\n return false\n end\n end\n\n return TokenChecker\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/VictoryDisplay\")\nend)\n__bundle_register(\"core/VictoryDisplay\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal guidReferenceApi = require(\"core/GUIDReferenceApi\")\nlocal playAreaApi = require(\"core/PlayAreaApi\")\nlocal tokenChecker = require(\"core/token/TokenChecker\")\n\nlocal pendingCall = false\nlocal messageSent = {}\nlocal missingData = {}\nlocal countedVP = {}\n\nlocal highlightMissing = false\nlocal highlightCounted = false\n\n-- button creation when loading the game\nfunction onLoad()\n -- index 0: VP - \"Display\"\n local buttonParameters = {}\n buttonParameters.label = \"0\"\n buttonParameters.click_function = \"none\"\n buttonParameters.function_owner = self\n buttonParameters.scale = { 0.15, 0.15, 0.15 }\n buttonParameters.width = 0\n buttonParameters.height = 0\n buttonParameters.font_size = 600\n buttonParameters.font_color = { 1, 1, 1 }\n buttonParameters.position = { x = -0.72, y = 0.06, z = -0.69 }\n self.createButton(buttonParameters)\n\n -- index 1: VP - \"Play Area\"\n buttonParameters.position.x = 0.65\n self.createButton(buttonParameters)\n\n -- index 2: VP - \"Total\"\n buttonParameters.position.x = 1.69\n self.createButton(buttonParameters)\n\n -- index 3: highlighting button (missing data)\n self.createButton({\n label = \"!\",\n click_function = \"highlightMissingData\",\n tooltip = \"Enable highlighting of cards without metadata (VP on these is not counted).\",\n function_owner = self,\n scale = { 0.15, 0.15, 0.15 },\n color = { 1, 0, 0 },\n width = 700,\n height = 800,\n font_size = 700,\n font_color = { 1, 1, 1 },\n position = { x = 1.82, y = 0.06, z = -1.32 }\n })\n\n -- index 4: highlighting button (counted VP)\n self.createButton({\n label = \"?\",\n click_function = \"highlightCountedVP\",\n tooltip = \"Enable highlighting of cards with VP.\",\n function_owner = self,\n scale = { 0.15, 0.15, 0.15 },\n color = { 0, 1, 0 },\n width = 700,\n height = 800,\n font_size = 700,\n font_color = { 1, 1, 1 },\n position = { x = 1.5, y = 0.06, z = -1.32 }\n })\n\n -- update the display label once\n Wait.time(updateCount, 1)\nend\n\n---------------------------------------------------------\n-- events with descriptions\n---------------------------------------------------------\n\n-- dropping an object on the victory display\nfunction onCollisionEnter()\n startUpdate()\nend\n\n-- removing an object from the victory display\nfunction onCollisionExit()\n startUpdate()\nend\n\n-- picking a clue or location up\nfunction onObjectPickUp(_, obj)\n maybeUpdate(obj)\nend\n\n-- dropping a clue or location\nfunction onObjectDrop(_, obj)\n maybeUpdate(obj, 1)\nend\n\n-- flipping a clue/doom or location\nfunction onObjectRotate(obj, _, flip, _, _, oldFlip)\n if flip == oldFlip then return end\n maybeUpdate(obj, 1, true)\nend\n\n-- destroying a clue or location\nfunction onObjectDestroy(obj)\n maybeUpdate(obj)\nend\n\n---------------------------------------------------------\n-- main functionality\n---------------------------------------------------------\n\nfunction maybeUpdate(obj, delay, flipped)\n -- stop if there is already an update call running\n if pendingCall then return end\n\n -- stop if obj is nil (by e.g. dropping a clue onto another and making a stack)\n if obj == nil then return end\n\n -- only continue for clues / doom tokens or locations\n if obj.hasTag(\"Location\") then\n elseif obj.memo == \"clueDoom\" then\n -- only continue if the clue side is up or a doom token is being flipped\n if obj.is_face_down == true and flipped ~= true then return end\n else\n return\n end\n\n -- only continue if the obj in in the play area\n if not playAreaApi.isInPlayArea(obj) then return end\n\n startUpdate(delay)\nend\n\n-- starts an update\nfunction startUpdate(delay)\n -- stop if there is already an update call running\n if pendingCall then return end\n pendingCall = true\n delay = tonumber(delay) or 0\n Wait.time(updateCount, delay + 0.2)\nend\n\n-- counts the VP in the victory display and request the VP count from the play area\nfunction updateCount()\n missingData = {}\n countedVP = {}\n local victoryPoints = {}\n victoryPoints.display = 0\n victoryPoints.playArea = playAreaApi.countVP()\n\n -- count cards in victory display\n for _, v in ipairs(searchOnObj(self)) do\n local obj = v.hit_object\n\n -- check metadata for VP\n if obj.tag == \"Card\" then\n local VP = getCardVP(obj, JSON.decode(obj.getGMNotes()))\n victoryPoints.display = victoryPoints.display + VP\n if VP \u003e 0 then\n table.insert(countedVP, obj)\n end\n\n -- handling for stacked cards\n elseif obj.tag == \"Deck\" then\n local VP = 0\n for _, deepObj in ipairs(obj.getObjects()) do\n local deepVP = getCardVP(obj, JSON.decode(deepObj.gm_notes))\n victoryPoints.display = victoryPoints.display + deepVP\n if deepVP \u003e 0 then\n VP = VP + 1\n end\n end\n if VP \u003e 0 then\n table.insert(countedVP, obj)\n end\n end\n end\n\n -- update the buttons that are used as labels\n self.editButton({ index = 0, label = victoryPoints.display })\n self.editButton({ index = 1, label = victoryPoints.playArea })\n self.editButton({ index = 2, label = victoryPoints.display + victoryPoints.playArea })\n\n -- allow new update calls\n pendingCall = false\nend\n\n-- gets the VP count from the notes\nfunction getCardVP(obj, notes)\n local cardVP\n if notes ~= nil then\n -- enemy, treachery etc.\n cardVP = tonumber(notes.victory)\n\n -- location\n if not cardVP then\n -- check the correct side of the location\n if not obj.is_face_down and notes.locationFront ~= nil then\n cardVP = tonumber(notes.locationFront.victory)\n elseif notes.locationBack ~= nil then\n cardVP = tonumber(notes.locationBack.victory)\n end\n end\n if (cardVP or 0) \u003e 0 then\n table.insert(countedVP, obj)\n end\n else\n table.insert(missingData, obj)\n end\n return cardVP or 0\nend\n\n-- toggles the highlight for objects with missing metadata\nfunction highlightMissingData()\n self.editButton({\n index = 3,\n tooltip = (highlightMissing and \"Enable\" or \"Disable\") .. \" highlighting of cards without metadata (VP on these is not counted).\"\n })\n for _, obj in pairs(missingData) do\n if obj ~= nil then\n if highlightMissing then\n obj.highlightOff(\"Red\")\n else\n obj.highlightOn(\"Red\")\n end\n end\n end\n playAreaApi.highlightMissingData(highlightMissing)\n highlightMissing = not highlightMissing\nend\n\n-- toggles the highlight for objects that were counted\nfunction highlightCountedVP()\n self.editButton({\n index = 4,\n tooltip = (highlightCounted and \"Enable\" or \"Disable\") .. \" highlighting of cards with VP.\"\n })\n for _, obj in pairs(countedVP) do\n if obj ~= nil then\n if highlightCounted then\n obj.highlightOff(\"Green\")\n else\n obj.highlightOn(\"Green\")\n end\n end\n end\n playAreaApi.highlightCountedVP(highlightCounted)\n highlightCounted = not highlightCounted\nend\n\n-- places the provided card in the first empty spot\nfunction placeCard(card)\n local trash = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"Trash\")\n \n -- check snap point states\n local snaps = self.getSnapPoints()\n table.sort(snaps, function(a, b) return a.position.x \u003e b.position.x end)\n table.sort(snaps, function(a, b) return a.position.z \u003c b.position.z end)\n\n -- get first empty slot\n local fullSlots = {}\n local positions = {}\n for i, snap in ipairs(snaps) do\n positions[i] = self.positionToWorld(snap.position)\n local hits = checkSnapPointState(positions[i])\n\n -- first hit is self, additional hits must be cards / decks\n if #hits \u003e 1 then\n fullSlots[i] = true\n end\n end\n\n -- remove tokens from the card\n for _, v in ipairs(searchOnObj(card)) do\n local obj = v.hit_object\n\n -- don't touch decks / cards\n if obj.tag == \"Deck\" or obj.tag == \"Card\" then\n -- put chaos tokens back into bag\n elseif tokenChecker.isChaosToken(obj) then\n local chaosBag = chaosBagApi.findChaosBag()\n chaosBag.putObject(obj)\n elseif obj.memo ~= nil and obj.getLock() == false then\n trash.putObject(obj)\n end\n end\n \n -- place the card\n local name = card.getName() or \"Unnamed card\"\n for i = 1, 10 do\n if fullSlots[i] ~= true then\n local rot = { 0, 270, card.getRotation().z }\n card.setPositionSmooth(positions[i], false, true)\n card.setRotation(rot)\n broadcastToAll(\"Victory Display: \" .. name .. \" placed into slot \" .. i .. \".\", \"Green\")\n return\n end\n end\n\n broadcastToAll(\"Victory Display is full! \" .. name .. \" placed into slot 1.\", \"Orange\")\n card.setPositionSmooth(positions[1], false, true)\nend\n\n---------------------------------------------------------\n-- utility functions\n---------------------------------------------------------\n\n-- searches on an object\nfunction searchOnObj(obj)\n return Physics.cast({\n direction = { 0, 1, 0 },\n max_distance = 0.5,\n type = 3,\n size = obj.getBounds().size,\n origin = obj.getPosition()\n })\nend\n\nfunction checkSnapPointState(pos)\n return Physics.cast({\n direction = { 0, 1, 0 },\n max_distance = 0.1,\n type = 3,\n size = { 0.1, 0.1, 0.1 },\n origin = pos\n })\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Custom_Token", @@ -205276,7 +198231,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"accessories/SearchAssistant\")\nend)\n__bundle_register(\"accessories/SearchAssistant\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- forward declaration of variables that are used across functions\nlocal matColor, handColor, setAsidePosition, setAsideRotation, drawDeckPosition\n\nlocal quickParameters = {}\nquickParameters.function_owner = self\nquickParameters.font_size = 165\nquickParameters.width = 275\nquickParameters.height = 275\nquickParameters.color = \"White\"\n\n-- common parameters\nlocal buttonParameters = {}\nbuttonParameters.function_owner = self\nbuttonParameters.font_size = 125\nbuttonParameters.width = 650\nbuttonParameters.height = 225\nbuttonParameters.color = \"White\"\n\nlocal inputParameters = {}\ninputParameters.function_owner = self\ninputParameters.input_function = \"updateSearchNumber\"\ninputParameters.tooltip = \"custom search amount\"\ninputParameters.label = \"#\"\ninputParameters.font_size = 175\ninputParameters.width = 400\ninputParameters.height = inputParameters.font_size + 23\ninputParameters.position = { 0, 0.11, 0 }\ninputParameters.alignment = 3\ninputParameters.validation = 2\n\nfunction onLoad()\n normalView()\nend\n\n-- regular view with search box\nfunction normalView()\n self.clearButtons()\n self.clearInputs()\n self.createInput(inputParameters)\n\n -- create custom search button\n buttonParameters.click_function = \"searchCustom\"\n buttonParameters.tooltip = \"Search the entered number of cards\"\n buttonParameters.position = { 0, 0.11, 0.65 }\n buttonParameters.label = \"Search\"\n self.createButton(buttonParameters)\n\n -- create buttons to search 3, 6 or 9 cards\n quickParameters.click_function = \"search3\"\n quickParameters.label = \"3\"\n quickParameters.position = { -0.65, 0.11, -0.65 }\n self.createButton(quickParameters)\n\n quickParameters.click_function = \"search6\"\n quickParameters.label = \"6\"\n quickParameters.position = { 0, 0.11, -0.65 }\n self.createButton(quickParameters)\n\n quickParameters.click_function = \"search9\"\n quickParameters.label = \"9\"\n quickParameters.position = { 0.65, 0.11, -0.65 }\n self.createButton(quickParameters)\nend\n\n-- click functions\nfunction search3(_, playerColor) startSearch(playerColor, 3) end\nfunction search6(_, playerColor) startSearch(playerColor, 6) end\nfunction search9(_, playerColor) startSearch(playerColor, 9) end\n\n-- view during a search with \"done\" buttons\nfunction searchView()\n self.clearButtons()\n self.clearInputs()\n\n -- create the \"End Search\" button\n buttonParameters.click_function = \"endSearch\"\n buttonParameters.tooltip = \"Left-click: Return cards and shuffle\\nRight-click: Return cards without shuffling\"\n buttonParameters.position = { 0, 0.11, 0 }\n buttonParameters.label = \"End Search\"\n self.createButton(buttonParameters)\nend\n\n-- input_function to get number of cards to search\nfunction updateSearchNumber(_, _, input)\n inputParameters.value = tonumber(input)\nend\n\n-- starts the search with the number from the input field\nfunction searchCustom(_, messageColor)\n local number = inputParameters.value\n if number ~= nil then\n startSearch(messageColor, number)\n else\n printToColor(\"Enter the number of cards to search in the textbox.\", messageColor, \"Orange\")\n end\nend\n\n-- start the search (change UI, set handCards aside, draw cards)\nfunction startSearch(messageColor, number)\n matColor = playmatApi.getMatColorByPosition(self.getPosition())\n handColor = playmatApi.getPlayerColor(matColor)\n\n -- get draw deck\n local drawDeck = playmatApi.getDrawDeck(matColor)\n if drawDeck == nil then\n printToColor(matColor .. \" draw deck could not be found!\", messageColor, \"Red\")\n return\n end\n\n drawDeckPosition = drawDeck.getPosition()\n printToColor(\"Place target(s) of search on set aside hand.\", messageColor, \"Green\")\n\n -- get playmat orientation\n local offset = -15\n if matColor == \"Orange\" or matColor == \"Red\" then\n offset = 15\n end\n\n -- get position and rotation for set aside cards\n local handData = Player[handColor].getHandTransform()\n local handCards = Player[handColor].getHandObjects()\n setAsidePosition = handData.position + offset * handData.right\n setAsideRotation = { handData.rotation.x, handData.rotation.y + 180, 180 }\n\n for i = #handCards, 1, -1 do\n handCards[i].setPosition(setAsidePosition - Vector(0, i * 0.3, 0))\n handCards[i].setRotation(setAsideRotation)\n end\n\n -- handling for Norman Withers\n for _, v in ipairs(searchArea(drawDeckPosition)) do\n local object = v.hit_object\n if object.tag == \"Card\" and not object.is_face_down then\n object.flip()\n Wait.time(function() drawDeck = playmatApi.getDrawDeck(matColor) end, 1)\n break\n end\n end\n\n Wait.time(function() drawDeck.deal(number, handColor) end, 1)\n searchView()\nend\n\n-- place handCards back into deck and optionally shuffle\nfunction endSearch(_, _, isRightClick)\n local handCards = Player[handColor].getHandObjects()\n\n for i = #handCards, 1, -1 do\n handCards[i].setPosition(drawDeckPosition + Vector(0, 6 - i * 0.3, 0))\n handCards[i].setRotation(setAsideRotation)\n end\n\n if not isRightClick then\n Wait.time(function()\n local deck = playmatApi.getDrawDeck(matColor)\n if deck ~= nil then\n deck.shuffle()\n end\n end, 2)\n end\n\n -- draw set aside cards (from the ground!)\n for _, v in ipairs(searchArea(setAsidePosition - Vector(0, 5, 0))) do\n local obj = v.hit_object\n if obj.tag == \"Deck\" then\n Wait.time(function()\n obj.deal(#obj.getObjects(), handColor)\n end, 1)\n break\n elseif obj.tag == \"Card\" then\n obj.setPosition(Player[handColor].getHandTransform().position)\n obj.flip()\n break\n end\n end\n\n normalView()\nend\n\n-- utility function\nfunction searchArea(position)\n return Physics.cast({\n origin = position,\n direction = { 0, 1, 0 },\n type = 3,\n size = { 2, 2, 2 },\n max_distance = 0\n })\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"accessories/SearchAssistant\")\nend)\n__bundle_register(\"accessories/SearchAssistant\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- forward declaration of variables that are used across functions\nlocal matColor, handColor, setAsidePosition, setAsideRotation, drawDeckPosition, topCardDetected\n\nlocal quickParameters = {}\nquickParameters.function_owner = self\nquickParameters.font_size = 165\nquickParameters.width = 275\nquickParameters.height = 275\nquickParameters.color = \"White\"\n\n-- common parameters\nlocal buttonParameters = {}\nbuttonParameters.function_owner = self\nbuttonParameters.font_size = 125\nbuttonParameters.width = 650\nbuttonParameters.height = 225\nbuttonParameters.color = \"White\"\n\nlocal inputParameters = {}\ninputParameters.function_owner = self\ninputParameters.input_function = \"updateSearchNumber\"\ninputParameters.tooltip = \"custom search amount\"\ninputParameters.label = \"#\"\ninputParameters.font_size = 175\ninputParameters.width = 400\ninputParameters.height = inputParameters.font_size + 23\ninputParameters.position = { 0, 0.11, 0 }\ninputParameters.alignment = 3\ninputParameters.validation = 2\n\nfunction onLoad()\n normalView()\nend\n\n-- regular view with search box\nfunction normalView()\n self.clearButtons()\n self.clearInputs()\n self.createInput(inputParameters)\n\n -- create custom search button\n buttonParameters.click_function = \"searchCustom\"\n buttonParameters.tooltip = \"Search the entered number of cards\"\n buttonParameters.position = { 0, 0.11, 0.65 }\n buttonParameters.label = \"Search\"\n self.createButton(buttonParameters)\n\n -- create buttons to search 3, 6 or 9 cards\n quickParameters.click_function = \"search3\"\n quickParameters.label = \"3\"\n quickParameters.position = { -0.65, 0.11, -0.65 }\n self.createButton(quickParameters)\n\n quickParameters.click_function = \"search6\"\n quickParameters.label = \"6\"\n quickParameters.position = { 0, 0.11, -0.65 }\n self.createButton(quickParameters)\n\n quickParameters.click_function = \"search9\"\n quickParameters.label = \"9\"\n quickParameters.position = { 0.65, 0.11, -0.65 }\n self.createButton(quickParameters)\nend\n\n-- click functions\nfunction search3(_, playerColor) startSearch(playerColor, 3) end\nfunction search6(_, playerColor) startSearch(playerColor, 6) end\nfunction search9(_, playerColor) startSearch(playerColor, 9) end\n\n-- view during a search with \"done\" buttons\nfunction searchView()\n self.clearButtons()\n self.clearInputs()\n\n -- create the \"End Search\" button\n buttonParameters.click_function = \"endSearch\"\n buttonParameters.tooltip = \"Left-click: Return cards and shuffle\\nRight-click: Return cards without shuffling\"\n buttonParameters.position = { 0, 0.11, 0 }\n buttonParameters.label = \"End Search\"\n self.createButton(buttonParameters)\nend\n\n-- input_function to get number of cards to search\nfunction updateSearchNumber(_, _, input)\n inputParameters.value = tonumber(input)\nend\n\n-- starts the search with the number from the input field\nfunction searchCustom(_, messageColor)\n local number = inputParameters.value\n if number ~= nil then\n startSearch(messageColor, number)\n else\n printToColor(\"Enter the number of cards to search in the textbox.\", messageColor, \"Orange\")\n end\nend\n\n-- start the search (change UI, set handCards aside, draw cards)\nfunction startSearch(messageColor, number)\n matColor = playmatApi.getMatColorByPosition(self.getPosition())\n handColor = playmatApi.getPlayerColor(matColor)\n topCardDetected = false\n\n -- get draw deck\n local deckAreaObjects = playmatApi.getDeckAreaObjects(matColor)\n if deckAreaObjects.draw == nil then\n printToColor(matColor .. \" draw deck could not be found!\", messageColor, \"Red\")\n return\n end\n\n -- get bounds to know the height of the deck\n local bounds = deckAreaObjects.draw.getBounds()\n drawDeckPosition = bounds.center + Vector(0, bounds.size.y / 2 + 0.2, 0)\n printToColor(\"Place target(s) of search on set aside hand.\", messageColor, \"Green\")\n\n -- get playmat orientation\n local offset = -15\n if matColor == \"Orange\" or matColor == \"Red\" then\n offset = 15\n end\n\n -- get position and rotation for set aside cards\n local handData = Player[handColor].getHandTransform()\n local handCards = Player[handColor].getHandObjects()\n setAsidePosition = handData.position + offset * handData.right\n setAsideRotation = { handData.rotation.x, handData.rotation.y + 180, 180 }\n\n -- set y-value\n setAsidePosition.y = 1.5\n\n for i = #handCards, 1, -1 do\n handCards[i].setPosition(setAsidePosition + Vector(0, (#handCards - i) * 0.1, 0))\n handCards[i].setRotation(setAsideRotation)\n end\n\n -- handling for Norman Withers\n if deckAreaObjects.topCard then\n deckAreaObjects.topCard.flip()\n topCardDetected = true\n end\n\n searchView()\n\n Wait.time(function()\n deckAreaObjects = playmatApi.getDeckAreaObjects(matColor)\n deckAreaObjects.draw.deal(number, handColor)\n end, 1)\nend\n\n-- place handCards back into deck and optionally shuffle\nfunction endSearch(_, _, isRightClick)\n local handCards = Player[handColor].getHandObjects()\n\n for i = #handCards, 1, -1 do\n handCards[i].setPosition(drawDeckPosition + Vector(0, (#handCards - i) * 0.1, 0))\n handCards[i].setRotation(setAsideRotation)\n end\n\n -- draw set aside cards (from the ground!)\n for _, v in ipairs(searchArea(setAsidePosition)) do\n local obj = v.hit_object\n if obj.type == \"Deck\" then\n Wait.time(function()\n obj.deal(#obj.getObjects(), handColor)\n end, 1)\n break\n elseif obj.type == \"Card\" then\n obj.setPosition(Player[handColor].getHandTransform().position)\n obj.flip()\n break\n end\n end\n\n normalView()\n\n -- delay is to wait for cards to enter deck\n if not isRightClick then\n Wait.time(function()\n local deckAreaObjects = playmatApi.getDeckAreaObjects(matColor)\n if deckAreaObjects.draw then\n deckAreaObjects.draw.shuffle()\n end\n end, #handCards * 0.1)\n end\n\n -- Norman Withers handling\n if topCardDetected then\n Wait.time(function() playmatApi.flipTopCardFromDeck(matColor) end, #handCards * 0.1)\n end\nend\n\n-- utility function\nfunction searchArea(position)\n return Physics.cast({\n origin = position,\n direction = { 0, 1, 0 },\n type = 3,\n size = { 2, 2, 2 },\n max_distance = 0\n })\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Custom_Tile", @@ -205337,7 +198292,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"accessories/HandHelper\")\nend)\n__bundle_register(\"accessories/HandHelper\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- forward declaration of variables that are used across functions\nlocal matColor, handColor, loopId, hovering\n\nfunction onLoad()\n local buttonParamaters = {}\n buttonParamaters.function_owner = self\n\n -- index 0: button as hand size label\n buttonParamaters.hover_color = \"White\"\n buttonParamaters.click_function = \"none\"\n buttonParamaters.position = { 0, 0.11, -0.4 }\n buttonParamaters.height = 0\n buttonParamaters.width = 0\n buttonParamaters.font_size = 500\n buttonParamaters.font_color = \"White\"\n self.createButton(buttonParamaters)\n\n -- index 1: button to toggle \"des\"\n buttonParamaters.label = \"DES: ✗\"\n buttonParamaters.click_function = \"none\"\n buttonParamaters.position = { 0, 0.11, 0.25 }\n buttonParamaters.height = 0\n buttonParamaters.width = 0\n buttonParamaters.font_size = 120\n self.createButton(buttonParamaters)\n\n -- index 2: button to discard a card\n buttonParamaters.label = \"discard random card\"\n buttonParamaters.click_function = \"discardRandom\"\n buttonParamaters.position = { 0, 0.11, 0.7 }\n buttonParamaters.height = 175\n buttonParamaters.width = 900\n buttonParamaters.font_size = 90\n buttonParamaters.font_color = \"Black\"\n self.createButton(buttonParamaters)\n\n updateColors()\n\n -- start loop to update card count\n loopId = Wait.time(updateValue, 1, -1)\nend\n\n-- updates colors when object is dropped somewhere\nfunction onDrop() updateColors() end\n\n-- toggles counting method briefly\nfunction onObjectHover(hover_color, obj)\n -- only continue if correct player hovers over \"self\"\n if obj ~= self or hover_color ~= handColor or hovering then return end\n\n -- toggle this flag so this doesn't get executed multiple times during the delay\n hovering = true\n\n -- stop loop, toggle \"des\" and displayed value briefly, then start new loop after 2s\n Wait.stop(loopId)\n updateValue(true)\n Wait.time(function()\n loopId = Wait.time(updateValue, 1, -1)\n hovering = false\n end, 1)\nend\n\n-- updates the matcolor and handcolor variable\nfunction updateColors()\n matColor = playmatApi.getMatColorByPosition(self.getPosition())\n handColor = playmatApi.getPlayerColor(matColor)\n self.setName(handColor .. \" Hand Helper\")\nend\n\n-- count cards in hand (by name for DES)\nfunction updateValue(toggle)\n -- update colors if handColor doesn't own a handzone\n if Player[handColor].getHandCount() == 0 then\n updateColors()\n end\n\n -- if there is still no handzone, then end here\n if Player[handColor].getHandCount() == 0 then return end\n\n -- get state of \"Dream-Enhancing Serum\" from playermat and update button label\n local des = playmatApi.isDES(matColor)\n if toggle then des = not des end\n self.editButton({ index = 1, label = \"DES: \" .. (des and \"✓\" or \"✗\") })\n\n -- count cards in hand\n local hand = Player[handColor].getHandObjects()\n local size = 0\n\n if des then\n local cardHash = {}\n for _, obj in pairs(hand) do\n if obj.tag == \"Card\" then\n local name = obj.getName()\n local title = string.match(name, '(.+)(%s%(%d+%))') or name\n cardHash[title] = true\n end\n end\n for _, title in pairs(cardHash) do\n size = size + 1\n end\n else\n for _, obj in pairs(hand) do\n if obj.tag == \"Card\" then size = size + 1 end\n end\n end\n\n -- update button label and color\n self.editButton({ index = 0, font_color = des and \"Green\" or \"White\", label = size })\nend\n\n-- discards a random non-hidden card from hand\nfunction discardRandom()\n playmatApi.doDiscardOne(matColor)\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"accessories/HandHelper\")\nend)\n__bundle_register(\"accessories/HandHelper\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\n-- forward declaration of variables that are used across functions\nlocal matColor, handColor, loopId, hovering\n\nfunction onLoad()\n local buttonParamaters = {}\n buttonParamaters.function_owner = self\n\n -- index 0: button as hand size label\n buttonParamaters.hover_color = \"White\"\n buttonParamaters.click_function = \"none\"\n buttonParamaters.position = { 0, 0.11, -0.4 }\n buttonParamaters.height = 0\n buttonParamaters.width = 0\n buttonParamaters.font_size = 500\n buttonParamaters.font_color = \"White\"\n self.createButton(buttonParamaters)\n\n -- index 1: button to toggle \"des\"\n buttonParamaters.label = \"DES: ✗\"\n buttonParamaters.click_function = \"none\"\n buttonParamaters.position = { 0, 0.11, 0.25 }\n buttonParamaters.height = 0\n buttonParamaters.width = 0\n buttonParamaters.font_size = 120\n self.createButton(buttonParamaters)\n\n -- index 2: button to discard a card\n buttonParamaters.label = \"discard random card\"\n buttonParamaters.click_function = \"discardRandom\"\n buttonParamaters.position = { 0, 0.11, 0.7 }\n buttonParamaters.height = 175\n buttonParamaters.width = 900\n buttonParamaters.font_size = 90\n buttonParamaters.font_color = \"Black\"\n self.createButton(buttonParamaters)\n\n updateColors()\n\n -- start loop to update card count\n loopId = Wait.time(updateValue, 1, -1)\nend\n\n-- updates colors when object is dropped somewhere\nfunction onDrop() updateColors() end\n\n-- toggles counting method briefly\nfunction onObjectHover(hover_color, obj)\n -- only continue if correct player hovers over \"self\"\n if obj ~= self or hover_color ~= handColor or hovering then return end\n\n -- toggle this flag so this doesn't get executed multiple times during the delay\n hovering = true\n\n -- stop loop, toggle \"des\" and displayed value briefly, then start new loop after 2s\n Wait.stop(loopId)\n updateValue(true)\n Wait.time(function()\n loopId = Wait.time(updateValue, 1, -1)\n hovering = false\n end, 1)\nend\n\n-- updates the matcolor and handcolor variable\nfunction updateColors()\n matColor = playmatApi.getMatColorByPosition(self.getPosition())\n handColor = playmatApi.getPlayerColor(matColor)\n self.setName(handColor .. \" Hand Helper\")\nend\n\n-- count cards in hand (by name for DES)\nfunction updateValue(toggle)\n -- update colors if handColor doesn't own a handzone\n if Player[handColor].getHandCount() == 0 then\n updateColors()\n end\n\n -- if there is still no handzone, then end here\n if Player[handColor].getHandCount() == 0 then return end\n\n -- get state of \"Dream-Enhancing Serum\" from playermat and update button label\n local des = playmatApi.isDES(matColor)\n if toggle then des = not des end\n self.editButton({ index = 1, label = \"DES: \" .. (des and \"✓\" or \"✗\") })\n\n -- count cards in hand\n local hand = Player[handColor].getHandObjects()\n local size = 0\n\n if des then\n local cardHash = {}\n for _, obj in pairs(hand) do\n if obj.tag == \"Card\" then\n local name = obj.getName()\n local title = string.match(name, '(.+)(%s%(%d+%))') or name\n cardHash[title] = true\n end\n end\n for _, title in pairs(cardHash) do\n size = size + 1\n end\n else\n for _, obj in pairs(hand) do\n if obj.tag == \"Card\" then size = size + 1 end\n end\n end\n\n -- update button label and color\n self.editButton({ index = 0, font_color = des and \"Green\" or \"White\", label = size })\nend\n\n-- discards a random non-hidden card from hand\nfunction discardRandom()\n playmatApi.doDiscardOne(matColor)\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Custom_Tile", @@ -205398,7 +198353,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"accessories/DisplacementTool\")\nend)\n__bundle_register(\"accessories/DisplacementTool\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal playAreaApi = require(\"core/PlayAreaApi\")\n\nlocal UI_offset = 1.15\n\nlocal buttonParamaters = {}\nbuttonParamaters.function_owner = self\nbuttonParamaters.label = \"\"\nbuttonParamaters.height = 500\nbuttonParamaters.width = 500\nbuttonParamaters.color = { 0, 0, 0, 0 }\n\nfunction onLoad()\n -- index 0: left\n buttonParamaters.click_function = \"shift_left\"\n buttonParamaters.tooltip = \"Move left\"\n buttonParamaters.position = { -UI_offset, 0, 0 }\n self.createButton(buttonParamaters)\n\n -- index 1: right\n buttonParamaters.click_function = \"shift_right\"\n buttonParamaters.tooltip = \"Move right\"\n buttonParamaters.position = { UI_offset, 0, 0 }\n self.createButton(buttonParamaters)\n\n -- index 2: up\n buttonParamaters.click_function = \"shift_up\"\n buttonParamaters.tooltip = \"Move up\"\n buttonParamaters.position = { 0, 0, -UI_offset }\n self.createButton(buttonParamaters)\n\n -- index 3: down\n buttonParamaters.click_function = \"shift_down\"\n buttonParamaters.tooltip = \"Move down\"\n buttonParamaters.position = { 0, 0, UI_offset }\n self.createButton(buttonParamaters)\nend\n\nfunction shift_left(color) playAreaApi.shiftContentsLeft(color) end\n\nfunction shift_right(color) playAreaApi.shiftContentsRight(color) end\n\nfunction shift_up(color) playAreaApi.shiftContentsUp(color) end\n\nfunction shift_down(color) playAreaApi.shiftContentsDown(color) end\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = { }\n local PLAY_AREA_GUID = \"721ba2\"\n local INVESTIGATOR_COUNTER_GUID = \"f182ee\"\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with\n -- 'displacement_excluded'\n ---@param playerColor Color of the player requesting the shift. Used solely to send an error\n --- message in the unlikely case that the scripting zone has been deleted\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"tryObjectEnterContainer\",\n { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightCountedVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"accessories/DisplacementTool\")\nend)\n__bundle_register(\"accessories/DisplacementTool\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal playAreaApi = require(\"core/PlayAreaApi\")\n\nlocal UI_offset = 1.15\n\nlocal buttonParamaters = {}\nbuttonParamaters.function_owner = self\nbuttonParamaters.label = \"\"\nbuttonParamaters.height = 500\nbuttonParamaters.width = 500\nbuttonParamaters.color = { 0, 0, 0, 0 }\n\nfunction onLoad()\n -- index 0: left\n buttonParamaters.click_function = \"shift_left\"\n buttonParamaters.tooltip = \"Move left\"\n buttonParamaters.position = { -UI_offset, 0, 0 }\n self.createButton(buttonParamaters)\n\n -- index 1: right\n buttonParamaters.click_function = \"shift_right\"\n buttonParamaters.tooltip = \"Move right\"\n buttonParamaters.position = { UI_offset, 0, 0 }\n self.createButton(buttonParamaters)\n\n -- index 2: up\n buttonParamaters.click_function = \"shift_up\"\n buttonParamaters.tooltip = \"Move up\"\n buttonParamaters.position = { 0, 0, -UI_offset }\n self.createButton(buttonParamaters)\n\n -- index 3: down\n buttonParamaters.click_function = \"shift_down\"\n buttonParamaters.tooltip = \"Move down\"\n buttonParamaters.position = { 0, 0, UI_offset }\n self.createButton(buttonParamaters)\nend\n\nfunction shift_left(color) playAreaApi.shiftContentsLeft(color) end\n\nfunction shift_right(color) playAreaApi.shiftContentsRight(color) end\n\nfunction shift_up(color) playAreaApi.shiftContentsUp(color) end\n\nfunction shift_down(color) playAreaApi.shiftContentsDown(color) end\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getPlayArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"PlayArea\")\n end\n\n local function getInvestigatorCounter()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"InvestigatorCounter\")\n end\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getInvestigatorCounter().getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n getInvestigatorCounter().call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with 'displacement_excluded'\n ---@param playerColor Color Color of the player requesting the shift for messages\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getPlayArea().call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getPlayArea().call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getPlayArea().call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getPlayArea().call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getPlayArea().call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getPlayArea().call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getPlayArea().call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getPlayArea().call(\"tryObjectEnterContainer\", { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getPlayArea().call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getPlayArea().call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getPlayArea().call(\"countVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getPlayArea().call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getPlayArea().getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getPlayArea().call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getPlayArea().call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getPlayArea().getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Custom_Token", @@ -205476,7 +198431,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = { }\n local PLAY_AREA_GUID = \"721ba2\"\n local INVESTIGATOR_COUNTER_GUID = \"f182ee\"\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with\n -- 'displacement_excluded'\n ---@param playerColor Color of the player requesting the shift. Used solely to send an error\n --- message in the unlikely case that the scripting zone has been deleted\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"tryObjectEnterContainer\",\n { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightCountedVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\n__bundle_register(\"core/SoundCubeApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local SoundCubeApi = {}\n\n -- this table links the name of a trigger effect to its index\n local soundIndices = {\n [\"Vacuum\"] = 0,\n [\"Deep Bell\"] = 1,\n [\"Dark Souls\"] = 2\n }\n\n local function playTriggerEffect(index)\n getObjectsWithTag(\"SoundCube\")[1].AssetBundle.playTriggerEffect(index)\n end\n\n -- plays the by name requested sound\n ---@param soundName String Name of the sound to play\n SoundCubeApi.playSoundByName = function(soundName)\n playTriggerEffect(soundIndices[soundName])\n end\n\n return SoundCubeApi\nend\nend)\n__bundle_register(\"core/token/TokenSpawnTrackerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenSpawnTracker = { }\n local SPAWN_TRACKER_GUID = \"e3ffc9\"\n\n TokenSpawnTracker.hasSpawnedTokens = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"hasSpawnedTokens\", cardGuid)\n end\n\n TokenSpawnTracker.markTokensSpawned = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"markTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetTokensSpawned = function(cardGuid)\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetAllAssetAndEvents = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAllAssetAndEvents\")\n end\n\n TokenSpawnTracker.resetAllLocations = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAllLocations\")\n end\n\n TokenSpawnTracker.resetAll = function()\n return getObjectFromGUID(SPAWN_TRACKER_GUID).call(\"resetAll\")\n end\n\n return TokenSpawnTracker\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"accessories/CleanUpHelper\")\nend)\n__bundle_register(\"accessories/CleanUpHelper\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Cleans up the table for the next scenario in a campaign:\n- sets counters to default values (resources and doom) or trauma values (health and sanity, if not disabled) from campaign log\n- puts everything on playmats and hands into respective trashcans\n- use the IGNORE_TAG to exclude objects from tidying (default: \"CleanUpHelper_Ignore\")]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal playAreaApi = require(\"core/PlayAreaApi\")\nlocal playmatApi = require(\"playermat/PlaymatApi\")\nlocal soundCubeApi = require(\"core/SoundCubeApi\")\nlocal tokenSpawnTrackerApi = require(\"core/token/TokenSpawnTrackerApi\")\n\n-- these objects will be ignored\nlocal IGNORE_GUIDS = {\n -- big playmat, change image panel and investigator counter\n \"b7b45b\", \"f182ee\", \"721ba2\",\n -- bless/curse manager\n \"afa06b\", \"bd0253\", \"5933fb\",\n -- stuff on agenda/act playmat\n \"85c4c6\", \"4a3aa4\", \"fea079\", \"b015d8\", \"11e0cf\", \"9f334f\", \"70b9f6\", \"0a5a29\",\n -- doom/location token bag\n \"47ffc3\", \"170f10\",\n -- table\n \"4ee1f2\"\n}\n\n-- objects with this tag will be ignored\nlocal IGNORE_TAG = \"CleanUpHelper_ignore\"\n\n-- colors and order for following tables\nlocal COLORS = { \"White\", \"Orange\", \"Green\", \"Red\", \"Agenda\" }\n\n-- counter GUIDS (4x damage and 4x horror)\nlocal DAMAGE_HORROR_GUIDS = {\n \"eb08d6\", \"e64eec\", \"1f5a0a\", \"591a45\",\n \"468e88\", \"0257d9\", \"7b5729\", \"beb964\",\n}\n\nlocal campaignLog\nlocal RESET_VALUES = {}\n\n-- GUIDS of objects (in order of ownership relating to 'COLORS')\nlocal PLAYERMAT_GUIDS = { \"8b081b\", \"bd0ff4\", \"383d8b\", \"0840d5\" }\nlocal RESOURCE_GUIDS = { \"4406f0\", \"816d84\", \"cd15ac\", \"a4b60d\" }\nlocal TRACKER_GUIDS = { \"e598c2\", \"b4a5f7\", \"af7ed7\", \"e74881\" }\nlocal CLUE_GUIDS = { \"d86b7c\", \"1769ed\", \"032300\", \"37be78\" }\nlocal CLUE_CLICKER_GUIDS = { \"db85d6\", \"3f22e5\", \"891403\", \"4111de\" }\nlocal TRASHCAN_GUIDS = { \"147e80\", \"f7b6c8\", \"5f896a\", \"4b8594\", \"70b9f6\" }\n\n-- values for physics.cast (4 entries for player zones, 5th entry for agenda/act deck, 6th for campaign log)\nlocal PHYSICS_POSITION = {\n { -54.5, 2, 21 },\n { -54.5, 2, -21 },\n { -27.0, 2, 26 },\n { -27.0, 2, -26 },\n { -02.0, 2, 10 },\n { -00.0, 2, -27 }\n}\n\nlocal PHYSICS_ROTATION = {\n 270,\n 270,\n 0,\n 180,\n 270,\n 0\n}\n\nlocal PHYSICS_SCALE = {\n { 36.6, 1, 14.5 },\n { 36.6, 1, 14.5 },\n { 34.0, 1, 14.5 },\n { 34.0, 1, 14.5 },\n { 55.0, 1, 13.5 },\n { 05.0, 1, 05.0 }\n}\n\nlocal optionsVisible = false\nlocal options = {}\noptions[\"importTrauma\"] = true\noptions[\"tidyPlayermats\"] = true\noptions[\"removeDrawnLines\"] = false\n\nlocal buttonParameters = {}\nbuttonParameters.function_owner = self\n\nlocal loadingFailedBefore = false\n\n---------------------------------------------------------\n-- option loading and GUI setup\n---------------------------------------------------------\n\nfunction onSave()\n return JSON.encode({ options = options })\nend\n\nfunction onLoad(savedData)\n if savedData ~= nil then\n local loadedData = JSON.decode(savedData)\n options = loadedData.options\n -- update UI to match saved state\n for id, state in pairs(options) do\n self.UI.setAttribute(id, \"image\", state and \"option_on\" or \"option_off\")\n end\n end\n\n -- index 0: button as label\n buttonParameters.label = \"Clean Up Helper\"\n buttonParameters.click_function = \"none\"\n buttonParameters.position = { x = 0, y = 0.1, z = -1.3 }\n buttonParameters.height = 0\n buttonParameters.width = 0\n buttonParameters.font_size = 230\n buttonParameters.font_color = Color(0, 0, 0)\n self.createButton(buttonParameters)\n\n -- index 1: option button\n buttonParameters.label = \"Settings\"\n buttonParameters.click_function = \"showOrHideOptions\"\n buttonParameters.color = { 0, 0, 0, 0.96 }\n buttonParameters.position.z = -0.1\n buttonParameters.height = 350\n buttonParameters.width = 1000\n buttonParameters.font_size = 190\n buttonParameters.font_color = \"White\"\n self.createButton(buttonParameters)\n\n -- index 2: start button\n buttonParameters.label = \"Reset play areas\"\n buttonParameters.click_function = \"cleanUp\"\n buttonParameters.position.z = 1.1\n buttonParameters.width = 1550\n self.createButton(buttonParameters)\n\n -- create single table for ignoring\n for _, v in ipairs(CLUE_GUIDS) do table.insert(IGNORE_GUIDS, v) end\n for _, v in ipairs(CLUE_CLICKER_GUIDS) do table.insert(IGNORE_GUIDS, v) end\n for _, v in ipairs(RESOURCE_GUIDS) do table.insert(IGNORE_GUIDS, v) end\n for _, v in ipairs(TRASHCAN_GUIDS) do table.insert(IGNORE_GUIDS, v) end\n for _, v in ipairs(PLAYERMAT_GUIDS) do table.insert(IGNORE_GUIDS, v) end\n for _, v in ipairs(DAMAGE_HORROR_GUIDS) do table.insert(IGNORE_GUIDS, v) end\nend\n\n---------------------------------------------------------\n-- click functions for option buttons\n---------------------------------------------------------\n\n-- changes the UI state and the internal variable for the togglebuttons\nfunction optionButtonClick(_, id)\n local currentState = options[id]\n local newState = (currentState and \"option_off\" or \"option_on\")\n options[id] = not currentState\n self.UI.setAttribute(id, \"image\", newState)\nend\n\n-- shows or hides the option panel\nfunction showOrHideOptions()\n optionsVisible = not optionsVisible\n\n if optionsVisible then\n self.UI.show(\"options\")\n else\n self.UI.hide(\"options\")\n end\nend\n\n---------------------------------------------------------\n-- main function\n---------------------------------------------------------\n\nfunction cleanUp(_, color)\n printToAll(\"------------------------------\", \"White\")\n printToAll(\"Clean up started!\", \"Orange\")\n printToAll(\"Resetting counters...\", \"White\")\n\n soundCubeApi.playSoundByName(\"Vacuum\")\n ignoreCustomDataHelper()\n getTrauma()\n\n -- delay to account for potential state change\n Wait.time(function()\n updateCounters(RESOURCE_GUIDS, 5, \"Resource\")\n updateCounters(CLUE_CLICKER_GUIDS, 0, \"Clue clicker\")\n updateCounters(DAMAGE_HORROR_GUIDS, RESET_VALUES, \"Damage / Horror\")\n end, 0.2)\n\n resetSkillTrackers()\n resetDoomCounter()\n blessCurseManagerApi.removeAll(color)\n removeLines()\n discardHands()\n tokenSpawnTrackerApi.resetAll()\n chaosBagApi.returnChaosTokens()\n chaosBagApi.releaseAllSealedTokens(color)\n\n printToAll(\"Tidying main play area...\", \"White\")\n startLuaCoroutine(self, \"tidyPlayareaCoroutine\")\nend\n\n---------------------------------------------------------\n-- modular functions, called by other functions\n---------------------------------------------------------\n\nfunction updateCounters(tableOfGUIDs, newValues, info)\n -- instead of a table, this will be used if just a single value is provided\n local singleValue = tonumber(newValues)\n\n for i, guid in ipairs(tableOfGUIDs) do\n local TOKEN = getObjectFromGUID(guid)\n local newValue = singleValue or newValues[i]\n\n if TOKEN ~= nil then\n TOKEN.call(\"updateVal\", newValue)\n else\n printToAll(info .. \": No. \" .. i .. \" could not be found.\", \"Yellow\")\n end\n end\nend\n\n-- set investigator skill trackers to \"1, 1, 1, 1\"\nfunction resetSkillTrackers()\n for i, guid in ipairs(TRACKER_GUIDS) do\n local obj = getObjectFromGUID(guid)\n\n if obj ~= nil then\n obj.call(\"updateStats\", { 1, 1, 1, 1 })\n else\n printToAll(\"Skill tracker for \" .. COLORS[i] .. \" playmat could not be found.\", \"Yellow\")\n end\n end\nend\n\n-- reset doom on agenda\nfunction resetDoomCounter()\n local doomCounter = getObjectFromGUID(\"85c4c6\")\n\n if doomCounter ~= nil then\n doomCounter.call(\"updateVal\")\n else\n printToAll(\"Doom counter could not be found.\", \"Yellow\")\n end\nend\n\n-- gets the GUID of a custom data helper (if present) and adds it to the ignore list\nfunction ignoreCustomDataHelper()\n local customDataHelper = playAreaApi.getCustomDataHelper()\n if customDataHelper then\n table.insert(IGNORE_GUIDS, customDataHelper.getGUID())\n end\nend\n\n-- read values for trauma from campaign log if enabled\nfunction getTrauma()\n RESET_VALUES = {\n 0, 0, 0, 0,\n 0, 0, 0, 0\n }\n\n -- stop here if trauma import is disabled\n if not options[\"importTrauma\"] then\n printToAll(\"Default values for health and sanity loaded.\", \"Yellow\")\n return\n end\n\n -- get campaign log\n campaignLog = findObjects(6)[1]\n if campaignLog == nil then\n printToAll(\"Campaign log not found in standard position!\", \"Yellow\")\n printToAll(\"Default values for health and sanity loaded.\", \"Yellow\")\n return\n end\n campaignLog = campaignLog.hit_object\n loadTrauma()\nend\n\n-- gets data from campaign log if possible\nfunction loadTrauma()\n -- check if \"returnTrauma\" function exists to avoid calling nil\n local trauma = campaignLog.getVar(\"returnTrauma\")\n\n if trauma ~= nil then\n printToAll(\"Trauma values found in campaign log!\", \"Green\")\n RESET_VALUES = campaignLog.call(\"returnTrauma\")\n loadingFailedBefore = false\n elseif loadingFailedBefore then\n printToAll(\"Trauma values could not be found in campaign log!\", \"Yellow\")\n printToAll(\"Default values for health and sanity loaded.\", \"Yellow\")\n loadingFailedBefore = false\n else\n -- set campaign log to first state\n local stateId = campaignLog.getStateId()\n\n if stateId ~= 1 then\n campaignLog = campaignLog.setState(1)\n end\n loadingFailedBefore = true\n\n -- small delay to account for potential state change\n Wait.time(loadTrauma, 0.1)\n end\nend\n\n-- remove drawn lines\nfunction removeLines()\n if options[\"removeDrawnLines\"] then\n printToAll(\"Removing vector lines...\", \"White\")\n Global.setVectorLines({})\n end\nend\n\n-- discard all hand objects\nfunction discardHands()\n if not options[\"tidyPlayermats\"] then return end\n for i = 1, 4 do\n local trashcan = getObjectFromGUID(TRASHCAN_GUIDS[i])\n if trashcan == nil then return end\n local hand = Player[playmatApi.getPlayerColor(COLORS[i])].getHandObjects()\n for j = #hand, 1, -1 do\n trashcan.putObject(hand[j])\n end\n end\nend\n\n-- clean up for play area\nfunction tidyPlayareaCoroutine()\n local trashcan = getObjectFromGUID(TRASHCAN_GUIDS[5])\n local PLAYMATZONE = getObjectFromGUID(\"a2f932\")\n\n if PLAYMATZONE == nil then\n printToAll(\"Scripting zone for main play area could not be found!\", \"Red\")\n elseif trashcan == nil then\n printToAll(\"Trashcan for main play area could not be found!\", \"Red\")\n else\n for _, obj in ipairs(PLAYMATZONE.getObjects()) do\n -- ignore these elements\n if not tableContains(IGNORE_GUIDS, obj.getGUID()) and obj.hasTag(IGNORE_TAG) == false then\n coroutine.yield(0)\n trashcan.putObject(obj)\n end\n end\n end\n\n printToAll(\"Tidying playermats and agenda mat...\", \"White\")\n startLuaCoroutine(self, \"tidyPlayerMatCoroutine\")\n return 1\nend\n\n-- clean up for the four playermats and the agenda/act playmat\nfunction tidyPlayerMatCoroutine()\n for i = 1, 5 do\n -- only continue for playermat (1-4) if option enabled\n if options[\"tidyPlayermats\"] or i == 5 then\n -- delay for animation purpose\n for k = 1, 30 do coroutine.yield(0) end\n\n -- get respective trashcan\n local trashcan = getObjectFromGUID(TRASHCAN_GUIDS[i])\n if trashcan == nil then\n printToAll(\"Trashcan for \" .. COLORS[i] .. \" playmat could not be found!\", \"Red\")\n return 1\n end\n\n for _, entry in ipairs(findObjects(i)) do\n local obj = entry.hit_object\n local desc_low = string.lower(obj.getDescription())\n\n -- ignore these elements\n if not tableContains(IGNORE_GUIDS, obj.getGUID()) and obj.hasTag(IGNORE_TAG) == false and\n desc_low ~= \"chaos bag\" and desc_low ~= \"action token\" then\n coroutine.yield(0)\n trashcan.putObject(obj)\n\n -- flip action tokens back to ready\n elseif desc_low == \"action token\" and obj.is_face_down then\n obj.flip()\n end\n end\n\n -- reset \"activeInvestigatorId\"\n if i \u003c 5 then\n local playermat = getObjectFromGUID(PLAYERMAT_GUIDS[i])\n if playermat then\n playermat.setVar(\"activeInvestigatorId\", \"00000\")\n end\n end\n end\n end\n\n local datahelper = getObjectFromGUID(\"708279\")\n if datahelper then\n datahelper.setTable(\"SPAWNED_PLAYER_CARD_GUIDS\", {})\n end\n\n printToAll(\"Clean up completed!\", \"Green\")\n return 1\nend\n\n---------------------------------------------------------\n-- helper functions\n---------------------------------------------------------\n\n-- find objects depending on index (1 to 4 for playermats, 5 for agenda/act playmat, 6 for campaign log)\nfunction findObjects(num)\n return Physics.cast({\n direction = { 0, 1, 0 },\n max_distance = 1,\n type = 3,\n size = PHYSICS_SCALE[num],\n origin = PHYSICS_POSITION[num],\n orientation = { 0, PHYSICS_ROTATION[num], 0 },\n debug = false\n })\nend\n\n-- search a table for a value, return true if found (else returns false)\nfunction tableContains(table, value)\n for _, v in ipairs(table) do\n if v == value then\n return true\n end\n end\n return false\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local MANAGER_GUID = \"5933fb\"\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getObjectFromGUID(MANAGER_GUID)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getObjectFromGUID(MANAGER_GUID).call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getPlayArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"PlayArea\")\n end\n\n local function getInvestigatorCounter()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"InvestigatorCounter\")\n end\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getInvestigatorCounter().getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n getInvestigatorCounter().call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with 'displacement_excluded'\n ---@param playerColor Color Color of the player requesting the shift for messages\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getPlayArea().call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getPlayArea().call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getPlayArea().call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getPlayArea().call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getPlayArea().call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getPlayArea().call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getPlayArea().call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getPlayArea().call(\"tryObjectEnterContainer\", { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getPlayArea().call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getPlayArea().call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getPlayArea().call(\"countVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getPlayArea().call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getPlayArea().getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getPlayArea().call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getPlayArea().call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getPlayArea().getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\n__bundle_register(\"core/SoundCubeApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local SoundCubeApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- this table links the name of a trigger effect to its index\n local soundIndices = {\n [\"Vacuum\"] = 0,\n [\"Deep Bell\"] = 1,\n [\"Dark Souls\"] = 2\n }\n\n local function playTriggerEffect(index)\n local SoundCube = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"SoundCube\")\n SoundCube.AssetBundle.playTriggerEffect(index)\n end\n\n -- plays the by name requested sound\n ---@param soundName String Name of the sound to play\n SoundCubeApi.playSoundByName = function(soundName)\n playTriggerEffect(soundIndices[soundName])\n end\n\n return SoundCubeApi\nend\nend)\n__bundle_register(\"core/token/TokenSpawnTrackerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local TokenSpawnTracker = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getSpawnTracker()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TokenSpawnTracker\")\n end\n\n TokenSpawnTracker.hasSpawnedTokens = function(cardGuid)\n return getSpawnTracker().call(\"hasSpawnedTokens\", cardGuid)\n end\n\n TokenSpawnTracker.markTokensSpawned = function(cardGuid)\n return getSpawnTracker().call(\"markTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetTokensSpawned = function(cardGuid)\n return getSpawnTracker().call(\"resetTokensSpawned\", cardGuid)\n end\n\n TokenSpawnTracker.resetAllAssetAndEvents = function()\n return getSpawnTracker().call(\"resetAllAssetAndEvents\")\n end\n\n TokenSpawnTracker.resetAllLocations = function()\n return getSpawnTracker().call(\"resetAllLocations\")\n end\n\n TokenSpawnTracker.resetAll = function()\n return getSpawnTracker().call(\"resetAll\")\n end\n\n return TokenSpawnTracker\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"accessories/CleanUpHelper\")\nend)\n__bundle_register(\"accessories/CleanUpHelper\", function(require, _LOADED, __bundle_register, __bundle_modules)\n--[[ Cleans up the table for the next scenario in a campaign:\n- sets counters to default values (resources and doom) or trauma values (health and sanity, if not disabled) from campaign log\n- puts everything on playmats and hands into respective trashcans\n- use the IGNORE_TAG to exclude objects from tidying (default: \"CleanUpHelper_Ignore\")]]\n\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal guidReferenceApi = require(\"core/GUIDReferenceApi\")\nlocal playAreaApi = require(\"core/PlayAreaApi\")\nlocal playmatApi = require(\"playermat/PlaymatApi\")\nlocal soundCubeApi = require(\"core/SoundCubeApi\")\nlocal tokenSpawnTrackerApi = require(\"core/token/TokenSpawnTrackerApi\")\n\n-- objects with this tag will be ignored\nlocal IGNORE_TAG = \"CleanUpHelper_ignore\"\n\n-- colors and order for following tables\nlocal COLORS = { \"White\", \"Orange\", \"Green\", \"Red\", \"Mythos\" }\nlocal campaignLog\nlocal RESET_VALUES = {}\nlocal loadingFailedBefore = false\nlocal optionsVisible = false\n\nlocal options = {}\noptions[\"importTrauma\"] = true\noptions[\"tidyPlayermats\"] = true\noptions[\"removeDrawnLines\"] = false\n\nlocal buttonParameters = {}\nbuttonParameters.function_owner = self\n\n\n---------------------------------------------------------\n-- option loading and GUI setup\n---------------------------------------------------------\n\nfunction onSave()\n return JSON.encode({ options = options })\nend\n\nfunction onLoad(savedData)\n if savedData ~= nil then\n local loadedData = JSON.decode(savedData)\n options = loadedData.options\n -- update UI to match saved state\n for id, state in pairs(options) do\n self.UI.setAttribute(id, \"image\", state and \"option_on\" or \"option_off\")\n end\n end\n\n -- index 0: button as label\n buttonParameters.label = \"Clean Up Helper\"\n buttonParameters.click_function = \"none\"\n buttonParameters.position = { x = 0, y = 0.1, z = -1.3 }\n buttonParameters.height = 0\n buttonParameters.width = 0\n buttonParameters.font_size = 230\n buttonParameters.font_color = Color(0, 0, 0)\n self.createButton(buttonParameters)\n\n -- index 1: option button\n buttonParameters.label = \"Settings\"\n buttonParameters.click_function = \"showOrHideOptions\"\n buttonParameters.color = { 0, 0, 0, 0.96 }\n buttonParameters.position.z = -0.1\n buttonParameters.height = 350\n buttonParameters.width = 1000\n buttonParameters.font_size = 190\n buttonParameters.font_color = \"White\"\n self.createButton(buttonParameters)\n\n -- index 2: start button\n buttonParameters.label = \"Reset play areas\"\n buttonParameters.click_function = \"cleanUp\"\n buttonParameters.position.z = 1.1\n buttonParameters.width = 1550\n self.createButton(buttonParameters)\nend\n\n---------------------------------------------------------\n-- click functions for option buttons\n---------------------------------------------------------\n\n-- changes the UI state and the internal variable for the togglebuttons\nfunction optionButtonClick(_, id)\n local currentState = options[id]\n local newState = (currentState and \"option_off\" or \"option_on\")\n options[id] = not currentState\n self.UI.setAttribute(id, \"image\", newState)\nend\n\n-- shows or hides the option panel\nfunction showOrHideOptions()\n optionsVisible = not optionsVisible\n\n if optionsVisible then\n self.UI.show(\"options\")\n else\n self.UI.hide(\"options\")\n end\nend\n\n---------------------------------------------------------\n-- main function\n---------------------------------------------------------\n\nfunction cleanUp(_, color)\n printToAll(\"------------------------------\", \"White\")\n printToAll(\"Clean up started!\", \"Orange\")\n printToAll(\"Resetting counters...\", \"White\")\n\n soundCubeApi.playSoundByName(\"Vacuum\")\n ignoreCustomDataHelper()\n getTrauma()\n\n -- delay to account for potential state change\n Wait.time(updateCounters, 0.2)\n\n resetDoomCounter()\n blessCurseManagerApi.removeAll(color)\n removeLines()\n discardHands()\n tokenSpawnTrackerApi.resetAll()\n chaosBagApi.returnChaosTokens()\n chaosBagApi.releaseAllSealedTokens(color)\n\n printToAll(\"Tidying main play area...\", \"White\")\n startLuaCoroutine(self, \"tidyPlayareaCoroutine\")\nend\n\n---------------------------------------------------------\n-- modular functions, called by other functions\n---------------------------------------------------------\n\nfunction updateCounters()\n playmatApi.updateCounter(\"All\", \"ResourceCounter\" , 5)\n playmatApi.updateCounter(\"All\", \"ClickableClueCounter\" , 0)\n playmatApi.resetSkillTracker(\"All\")\n\n for i = 1, 4 do\n playmatApi.updateCounter(COLORS[i], \"DamageCounter\", RESET_VALUES.Damage[i])\n playmatApi.updateCounter(COLORS[i], \"HorrorCounter\", RESET_VALUES.Horror[i])\n end\nend\n\n-- reset doom on agenda\nfunction resetDoomCounter()\n local doomCounter = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"DoomCounter\")\n if doomCounter ~= nil then\n doomCounter.call(\"updateVal\")\n else\n printToAll(\"Doom counter could not be found.\", \"Yellow\")\n end\nend\n\n-- adds the ignore tag to the custom data helper\nfunction ignoreCustomDataHelper()\n local customDataHelper = playAreaApi.getCustomDataHelper()\n if customDataHelper then\n customDataHelper.addTag(IGNORE_TAG)\n end\nend\n\n-- read values for trauma from campaign log if enabled\nfunction getTrauma()\n RESET_VALUES = {\n Damage = { 0, 0, 0, 0 },\n Horror = { 0, 0, 0, 0 }\n }\n\n -- stop here if trauma import is disabled\n if not options[\"importTrauma\"] then\n printToAll(\"Default values for health and sanity loaded.\", \"Yellow\")\n return\n end\n\n -- get campaign log\n campaignLog = getObjectsWithTag(\"CampaignLog\")[1]\n if campaignLog == nil then\n printToAll(\"Campaign log not found in standard position!\", \"Yellow\")\n printToAll(\"Default values for health and sanity loaded.\", \"Yellow\")\n return\n end\n loadTrauma()\nend\n\n-- gets data from campaign log if possible\nfunction loadTrauma()\n -- check if \"returnTrauma\" function exists to avoid calling nil\n local trauma = campaignLog.getVar(\"returnTrauma\")\n\n if trauma ~= nil then\n printToAll(\"Trauma values found in campaign log!\", \"Green\")\n trauma = campaignLog.call(\"returnTrauma\")\n for i = 1, 8 do\n if i \u003c 5 then\n RESET_VALUES.Damage[i] = trauma[i]\n else\n RESET_VALUES.Horror[i-4] = trauma[i]\n end\n end\n loadingFailedBefore = false\n elseif loadingFailedBefore then\n printToAll(\"Trauma values could not be found in campaign log!\", \"Yellow\")\n printToAll(\"Default values for health and sanity loaded.\", \"Yellow\")\n loadingFailedBefore = false\n else\n -- set campaign log to first state\n local stateId = campaignLog.getStateId()\n\n if stateId ~= 1 then\n campaignLog = campaignLog.setState(1)\n end\n loadingFailedBefore = true\n\n -- small delay to account for potential state change\n Wait.time(loadTrauma, 0.1)\n end\nend\n\n-- remove drawn lines\nfunction removeLines()\n if options[\"removeDrawnLines\"] then\n printToAll(\"Removing global vector lines...\", \"White\")\n Global.setVectorLines({})\n end\nend\n\n-- discard all hand objects\nfunction discardHands()\n if not options[\"tidyPlayermats\"] then return end\n for i = 1, 4 do\n local trash = guidReferenceApi.getObjectByOwnerAndType(COLORS[i], \"Trash\")\n if trash == nil then return end\n local hand = Player[playmatApi.getPlayerColor(COLORS[i])].getHandObjects()\n for j = #hand, 1, -1 do\n trash.putObject(hand[j])\n end\n end\nend\n\n-- clean up for play area\nfunction tidyPlayareaCoroutine()\n local trash = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"Trash\")\n local playAreaZone = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"PlayAreaZone\")\n\n if playAreaZone == nil then\n printToAll(\"Scripting zone for main play area could not be found!\", \"Red\")\n elseif trash == nil then\n printToAll(\"Trashcan for main play area could not be found!\", \"Red\")\n else\n for _, obj in ipairs(playAreaZone.getObjects()) do\n -- ignore these elements\n if obj.hasTag(IGNORE_TAG) == false\n and obj.locked == false \n and obj.interactable == true then\n coroutine.yield(0)\n trash.putObject(obj)\n end\n end\n end\n\n printToAll(\"Tidying playermats and mythos area...\", \"White\")\n startLuaCoroutine(self, \"tidyPlayerMatCoroutine\")\n return 1\nend\n\n-- clean up for the four playermats and the mythos area\nfunction tidyPlayerMatCoroutine()\n for i = 1, 5 do\n -- only continue for playermat (1-4) if option enabled\n if options[\"tidyPlayermats\"] or i == 5 then\n -- delay for animation purpose\n for k = 1, 30 do coroutine.yield(0) end\n\n -- get respective trash\n local trash = guidReferenceApi.getObjectByOwnerAndType(COLORS[i], \"Trash\")\n if trash == nil then\n printToAll(\"Trashcan for \" .. COLORS[i] .. \" playmat could not be found!\", \"Red\")\n return 1\n end\n\n local objList\n if i \u003c 5 then\n objList = playmatApi.searchAroundPlaymat(COLORS[i])\n else\n objList = searchMythosArea()\n end\n\n for _, obj in ipairs(objList) do\n -- ignore these elements\n if obj.hasTag(IGNORE_TAG) == false\n and obj.getDescription() ~= \"Action Token\"\n and obj.hasTag(\"chaosBag\") == false\n and obj.locked == false \n and obj.interactable == true then\n coroutine.yield(0)\n trash.putObject(obj)\n\n -- flip action tokens back to ready\n elseif obj.getDescription() == \"Action Token\" and obj.is_face_down then\n obj.flip()\n end\n end\n\n -- reset \"activeInvestigatorId\"\n if i \u003c 5 then\n local playermat = guidReferenceApi.getObjectByOwnerAndType(COLORS[i], \"Playermat\")\n if playermat then\n playermat.setVar(\"activeInvestigatorId\", \"00000\")\n end\n end\n end\n end\n\n local datahelper = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"DataHelper\")\n if datahelper then\n datahelper.setTable(\"SPAWNED_PLAYER_CARD_GUIDS\", {})\n end\n\n printToAll(\"Clean up completed!\", \"Green\")\n return 1\nend\n\n---------------------------------------------------------\n-- helper functions\n---------------------------------------------------------\n\n-- find objects in the mythos area\nfunction searchMythosArea()\n local searchResult = Physics.cast({\n direction = { 0, 1, 0 },\n max_distance = 1,\n type = 3,\n size = { 55, 1, 13.5 },\n origin = { -2, 2, 10 },\n orientation = { 0, 270, 0 },\n debug = false\n })\n\n local objList = {}\n for _, v in ipairs(searchResult) do\n table.insert(objList, v.hit_object)\n end\n return objList\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getManager()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"BlessCurseManager\")\n end\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getManager()\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getManager().call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getManager().call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getManager().call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getManager().call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getManager().call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "{\"options\":{\"importTrauma\":true,\"removeDrawnLines\":false,\"tidyPlayermats\":true}}", "MeasureMovement": false, "Name": "Custom_Token", @@ -205499,64 +198454,7 @@ "scaleZ": 1.5 }, "Value": 0, - "XmlUI": "\u003c!-- Default formatting --\u003e\n\u003cDefaults\u003e\n \u003cText color=\"black\" alignment=\"MiddleLeft\"/\u003e\n \u003cText class=\"h1\" fontSize=\"160\" font=\"font_teutonic-arkham\"/\u003e\n \u003cText class=\"h2\" fontSize=\"120\" font=\"font_teutonic-arkham\"/\u003e\n \u003cText class=\"p\" fontSize=\"60\" alignment=\"UpperLeft\"/\u003e\n\n \u003cPanel rotation=\"0 0 180\"/\u003e\n \u003cPanel class=\"window\" width=\"1500\" height=\"1500\" color=\"white\" outline=\"white\" outlineSize=\"10 10\"/\u003e\n\n \u003cRow dontUseTableRowBackground=\"true\"/\u003e\n \u003cRow class=\"header\" color=\"#707070\"/\u003e\n \u003cRow class=\"option\" preferredHeight=\"200\" color=\"#9e9e9e\"/\u003e\n\n \u003c!-- row heights: 70 x lines + 50 --\u003e\n \u003cRow class=\"description\" color=\"#cfcfcf\"/\u003e\n\n \u003cButton class=\"optionToggle\" rectAlignment=\"MiddleRight\" offsetXY=\"-30 0\" colors=\"#FFFFFF|#dfdfdf\" height=\"160\" width=\"288\" ignoreLayout=\"True\" fontSize=\"60\"/\u003e\n\u003c/Defaults\u003e\n\n\u003c!-- Option window --\u003e\n\u003cPanel id=\"options\" class=\"window\" offsetXY=\"-580 200\" scale=\"0.5 0.5\" active=\"false\" showAnimation=\"FadeIn\" hideAnimation=\"FadeOut\"\u003e\n \u003cTableLayout cellPadding=\"25 25 15 15\"\u003e\n \u003c!-- Header --\u003e\n \u003cRow class=\"header\"\u003e\n \u003cCell\u003e\n \u003cText class=\"h1\"\u003eClean up Helper - Options\u003c/Text\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option --\u003e\n \u003cRow class=\"option\"\u003e\n \u003cCell\u003e\n \u003cText class=\"h2\"\u003eImport trauma\u003c/Text\u003e\n \u003cButton class=\"optionToggle\" id=\"importTrauma\" onClick=\"optionButtonClick(importTrauma)\" image=\"option_on\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n \u003cRow class=\"description\" preferredHeight=\"330\"\u003e\n \u003cCell\u003e\n \u003cText class=\"p\"\u003eEnables importing trauma values from the campaign log (custom content might give wrong values!).\u0026#xA;Enter players in the campaign log in this order:\u0026#xA;White, Orange, Green, Red.\u003c/Text\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option --\u003e\n \u003cRow class=\"option\"\u003e\n \u003cCell\u003e\n \u003cText class=\"h2\"\u003eTidy playermats\u003c/Text\u003e\n \u003cButton class=\"optionToggle\" id=\"tidyPlayermats\" onClick=\"optionButtonClick(tidyPlayermats)\" image=\"option_on\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n \u003cRow class=\"description\" preferredHeight=\"190\"\u003e\n \u003cCell\u003e\n \u003cText class=\"p\"\u003eControls whether the playermats should get tidied (removal of all cards and tokens).\u003c/Text\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option --\u003e\n \u003cRow class=\"option\"\u003e\n \u003cCell\u003e\n \u003cText class=\"h2\"\u003eRemove drawn lines\u003c/Text\u003e\n \u003cButton class=\"optionToggle\" id=\"removeDrawnLines\" onClick=\"optionButtonClick(removeDrawnLines)\" image=\"option_off\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n \u003cRow class=\"description\" preferredHeight=\"120\"\u003e\n \u003cCell\u003e\n \u003cText class=\"p\"\u003eControls whether all drawn lines should be removed.\u003c/Text\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n \u003c/TableLayout\u003e\n\u003c/Panel\u003e" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "b": 1, - "g": 1, - "r": 1 - }, - "CustomImage": { - "CustomToken": { - "MergeDistancePixels": 15, - "Stackable": false, - "StandUp": false, - "Thickness": 0.1 - }, - "ImageScalar": 1, - "ImageSecondaryURL": "", - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/2026086584367391757/2E37A1020563AA528471DA7425B8E58343E2BAF7/", - "WidthScale": 0 - }, - "Description": "Change playmat image to a custom one made by Mint Tea Fan.", - "DragSelectable": true, - "GMNotes": "", - "GUID": "004fe7", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"accessories/CustomPlaymatImages\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal DATA = {\n [\"Arkham Locations\"] = { {\n Name = \"Downtown 1\",\n URL = \"https://i.ibb.co/FzRk98n/Arkham-Downtown-Cristi-Balanescu.jpg\"\n }, {\n Name = \"Downtown 2\",\n URL = \"https://i.ibb.co/W2yJ5QZ/Arkham-Downtown-Jokubas-Uogintas.jpg\"\n }, {\n Name = \"Eastside 1\",\n URL = \"https://i.ibb.co/W3QvdZW/Arkham-Eastside-Cristi-Balanescu.jpg\"\n }, {\n Name = \"Eastside 2\",\n URL = \"https://i.ibb.co/xfn1Fp8/Arkham-Eastside-Jokubas-Uogintas.jpg\"\n }, {\n Name = \"French Hill\",\n URL = \"https://i.ibb.co/N7Lk7jc/Arkham-French-Hill-Cristi-Balanescu.jpg\"\n }, {\n Name = \"Merchant District\",\n URL = \"https://i.ibb.co/HTNCCq4/Arkham-Merchant-District-Jokubas-Uogintas.jpg\"\n }, {\n Name = \"Generic 1\",\n URL = \"https://i.ibb.co/hswfZD6/Arkham-Guillem-H-Pongiluppi.jpg\"\n }, {\n Name = \"Generic 2\",\n URL = \"https://i.ibb.co/5h5cMyF/Arkham-Guillem-H-Pongiluppi-2.jpg\"\n }, {\n Name = \"Generic 3\",\n URL = \"https://i.ibb.co/ZBdVsWt/Arkham-Guillem-H-Pongiluppi-3.jpg\"\n }, {\n Name = \"Generic 4\",\n URL = \"https://i.ibb.co/6NwbM59/Arkham-Michele-Botticelli.jpg\"\n }, {\n Name = \"Generic 5\",\n URL = \"https://i.ibb.co/N6sxyq5/Arkham-Mihail-Bila.jpg\"\n }, {\n Name = \"Generic 6\",\n URL = \"https://i.ibb.co/B393zxv/Arkham-Tomasz-Jedruszek.jpg\"\n }, {\n Name = \"Generic 7\",\n URL = \"https://i.ibb.co/2WQ2Vt6/Arkham-Tomasz-Jedruszek-2.jpg\"\n }, {\n Name = \"Generic 8\",\n URL = \"https://i.ibb.co/R7pQ9Y7/Arkham-Tomasz-Jedruszek-3.jpg\"\n }, {\n Name = \"Miskatonic University\",\n URL = \"https://i.ibb.co/ncz9xjP/Arkham-Miskatonic-University-Jokubas-Uogintas.jpg\"\n }, {\n Name = \"Northside\",\n URL = \"https://i.ibb.co/sVWx1R3/Arkham-Northside-Jokubas-Uogintas.jpg\"\n }, {\n Name = \"Rivertown\",\n URL = \"https://i.ibb.co/RyJnHmz/Arkham-Rivertown-Jokubas-Uogintas.jpg\"\n }, {\n Name = \"Southside\",\n URL = \"https://i.ibb.co/5GW5jg5/Arkham-Southside-Jokubas-Uogintas.jpg\"\n }, {\n Name = \"Uptown\",\n URL = \"https://i.ibb.co/YXjvkMn/Arkham-Uptown-Jokubas-Uogintas.jpg\"\n } },\n [\"Side Scenarios\"] = { {\n Name = \"Blob That Ate Everything 1\",\n URL = \"https://i.ibb.co/JxFV4ZN/Blob-That-Ate-Everything-Emilio-Rodriguez.jpg\"\n }, {\n Name = \"Blob That Ate Everything 2\",\n URL = \"https://i.ibb.co/qJzstWF/Blob-That-Ate-Everything-Emilio-Rodriguez.jpg\"\n }, {\n Name = \"Carnevale of Horrors 1\",\n URL = \"https://i.ibb.co/ZchJBpz/Carnevale-of-Horrors.jpg\"\n }, {\n Name = \"Curse of the Rougarou 1\",\n URL = \"https://i.ibb.co/Qf7Sr7P/Curse-of-the-Rougarou.jpg\"\n }, {\n Name = \"Curse of the Rougarou 2\",\n URL = \"https://i.ibb.co/hs1Qjp0/Curse-of-the-Rougarou-Ann-Kovaleva.jpg\"\n }, {\n Name = \"Curse of the Rougarou 3\",\n URL = \"https://i.ibb.co/BK7rmJ9/Curse-of-the-Rougarou-Karine-Villette.jpg\"\n }, {\n Name = \"Curse of the Rougarou 4\",\n URL = \"https://i.ibb.co/ZxGTC1w/Curse-of-the-Rougarou-Lachlan-Page.jpg\"\n }, {\n Name = \"Curse of the Rougarou 5\",\n URL = \"https://i.ibb.co/HgNXJhW/Curse-of-the-Rougarou-Vladimir-Manyukhin.jpg\"\n }, {\n Name = \"Guardians of the Abyss 1\",\n URL = \"https://i.ibb.co/gD3R6cw/Guardians-of-the-Abyss-Jake-Murray.jpg\"\n }, {\n Name = \"Guardians of the Abyss 2\",\n URL = \"https://i.ibb.co/jMHPcvz/Guardians-of-the-Abyss-Jose-Vega.jpg\"\n }, {\n Name = \"Guardians of the Abyss 3\",\n URL = \"https://i.ibb.co/99pqXQP/Guardians-of-the-Abyss-Koke-Nunez.jpg\"\n }, {\n Name = \"Guardians of the Abyss 4\",\n URL = \"https://i.ibb.co/QbMvjbx/Guardians-of-the-Abyss-Mike-Szabados.jpg\"\n }, {\n Name = \"Guardians of the Abyss 5\",\n URL = \"https://i.ibb.co/zFDt9Q8/Guardians-of-the-Abyss-Nele-Diel.jpg\"\n }, {\n Name = \"Guardians of the Abyss 6\",\n URL = \"https://i.ibb.co/Vpzptmt/Guardians-of-the-Abyss-Yujin-Choo.jpg\"\n }, {\n Name = \"Kingsport\",\n URL = \"https://i.ibb.co/rbkk7ys/Kingsport-Tomasz-Jedruszek.jpg\"\n }, {\n Name = \"Labyrinths of Lunacy 1\",\n URL = \"https://i.ibb.co/f17PMCC/Labyrinths-of-Lunacy-Cordelia-Wolf.jpg\"\n }, {\n Name = \"Labyrinths of Lunacy 2\",\n URL = \"https://i.ibb.co/44DXfWw/Labyrinths-of-Lunacy-Richard-Wright.jpg\"\n }, {\n Name = \"Labyrinths of Lunacy 3\",\n URL = \"https://i.ibb.co/jMQhs68/Labyrinths-of-Lunacy-Robert-Berg.jpg\"\n }, {\n Name = \"Murder at Excelsior Hotel 1\",\n URL = \"https://i.ibb.co/5cQ6LvN/Murder-at-Excelsior-Hotel-Alistair-Mitchell.jpg\"\n }, {\n Name = \"Murder at Excelsior Hotel 2\",\n URL = \"https://i.ibb.co/vBQRHNS/Murder-at-Excelsior-Hotel-Romain-Bayle.jpg\"\n }, {\n Name = \"War of the Outer Gods\",\n URL = \"https://i.ibb.co/wLNGFTG/War-of-the-Outer-Gods-Joshua-Cairos.jpg\"\n } },\n [\"The Path to Carcosa\"] = { {\n Name = \"I - Curtain Call\",\n URL = \"https://i.ibb.co/TcnKXJD/Carcosa-1-Curtain-Call-Mark-Molnar.jpg\"\n }, {\n Name = \"II - Last King 1\",\n URL = \"https://i.ibb.co/JRQJKR8/Carcosa-2-Last-King-Cristi-Balanescu.jpg\"\n }, {\n Name = \"II - Last King 2\",\n URL = \"https://i.ibb.co/NZzBwgv/Carcosa-2-Last-King-Cristi-Balanescu-2.jpg\"\n }, {\n Name = \"II - Last King 3\",\n URL = \"https://i.ibb.co/x56ZHt7/Carcosa-2-Last-King-Wu-Mengjia.jpg\"\n }, {\n Name = \"III - Echoes of the Past\",\n URL = \"https://i.ibb.co/R6gSm0D/Carcosa-3-Echoes-of-the-Past-Heather-Savage.jpg\"\n }, {\n Name = \"IV - Unspeakable Oath 1\",\n URL = \"https://i.ibb.co/DzzDQQQ/Carcosa-4-Unspeakable-Oath.jpg\"\n }, {\n Name = \"IV - Unspeakable Oath 2\",\n URL = \"https://i.ibb.co/9gqBzXr/Carcosa-4-Unspeakable-Oath-2-Mark-Molnar.jpg\"\n }, {\n Name = \"IV - Unspeakable Oath 3\",\n URL = \"https://i.ibb.co/wWL73c9/Carcosa-4-Unspeakable-Oath-Paul-Fairbairn.jpg\"\n }, {\n Name = \"V - Phantom of Truth 1\",\n URL = \"https://i.ibb.co/mzpz1Dd/Carcosa-5-Phantom-of-Truth-Lucas-Staniec.jpg\"\n }, {\n Name = \"V - Phantom of Truth 2\",\n URL = \"https://i.ibb.co/Vp1wNbT/Carcosa-5-Phantom-of-Truth-Tomasz-Jedruszek.jpg\"\n }, {\n Name = \"VI - Pallid Mask 1\",\n URL = \"https://i.ibb.co/Bf5LByY/Carcosa-6-Pallid-Mask-Greg-Bobrowski.jpg\"\n }, {\n Name = \"VI - Pallid Mask 2\",\n URL = \"https://i.ibb.co/1v1J9Xx/Carcosa-6-Pallid-Mask-Rafal-Pyra.jpg\"\n }, {\n Name = \"VII - Black Star Rises 1\",\n URL = \"https://i.ibb.co/TB451t7/Carcosa-7-Black-Star-Rises-Audric-Gatoux.jpg\"\n }, {\n Name = \"VII - Black Star Rises 2\",\n URL = \"https://i.ibb.co/nC8Ncxx/Carcosa-7-Black-Star-Rises-Chris-Kintner.jpg\"\n }, {\n Name = \"VIII - Dim Carcosa 1\",\n URL = \"https://i.ibb.co/QvS4y3D/Carcosa-8-Dim-Carcosa-Alexandr-Elichev.jpg\"\n }, {\n Name = \"VIII - Dim Carcosa 2\",\n URL = \"https://i.ibb.co/hR95x7k/Carcosa-8-Dim-Carcosa-Yuri-Shepherd.jpg\"\n } },\n [\"The Circle Undone\"] = { {\n Name = \"0 - Prologue\",\n URL = \"https://i.ibb.co/gm4C6yy/Circle-Undone-0-Prologue-Ted-Galaday.jpg\"\n }, {\n Name = \"I - Witching Hour\",\n URL = \"https://i.ibb.co/kgJ34WS/Circle-Undone-1-Witching-Hour-Nele-Diel.jpg\"\n }, {\n Name = \"II - At Death's Doorstep 1\",\n URL = \"https://i.ibb.co/qNWzH0Y/Circle-Undone-2-At-Death-039-s-Doorstep-Emilio-Rodriguez.jpg\"\n }, {\n Name = \"II - At Death's Doorstep 2\",\n URL = \"https://i.ibb.co/T1zp1QN/Circle-Undone-2-At-Death-039-s-Doorstep-Emilio-Rodriguez-2.jpg\"\n }, {\n Name = \"II - At Death's Doorstep 3\",\n URL = \"https://i.ibb.co/ZJfYZ1w/Circle-Undone-2-At-Death-039-s-Doorstep-Majid-Azim.jpg\"\n }, {\n Name = \"III - The Secret Name 1\",\n URL = \"https://i.ibb.co/hsBw4JQ/Circle-Undone-3-Secret-Name-Jeff-Jumper.jpg\"\n }, {\n Name = \"III - The Secret Name 2\",\n URL = \"https://i.ibb.co/MpcPXR5/Circle-Undone-3-Secret-Name-Pierre-Santamaria.jpg\"\n }, {\n Name = \"III - The Secret Name 3\",\n URL = \"https://i.ibb.co/LQ8rdKs/Circle-Undone-3-The-Secret-Name-Greg-Bobrowski.jpg\"\n }, {\n Name = \"III - The Secret Name 4\",\n URL = \"https://i.ibb.co/0D7LzxV/Circle-Undone-3-The-Secret-Name-Robert-Laskey.jpg\"\n }, {\n Name = \"IV - Wages of Sin 1\",\n URL = \"https://i.ibb.co/fDMqH1C/Circle-Undone-4-Wages-of-Sin-Emilio-Rodriguez.jpg\"\n }, {\n Name = \"IV - Wages of Sin 2\",\n URL = \"https://i.ibb.co/HDrKkZF/Circle-Undone-4-Wages-of-Sin-Emilio-Rodriguez-2.jpg\"\n }, {\n Name = \"IV - Wages of Sin 3\",\n URL = \"https://i.ibb.co/vkpG8cM/Circle-Undone-4-Wages-of-Sin-Greg-Bobrowski.jpg\"\n }, {\n Name = \"IV - Wages of Sin 4\",\n URL = \"https://i.ibb.co/CMj007q/Circle-Undone-4-Wages-of-Sin-Mateusz-Michalski.jpg\"\n }, {\n Name = \"IV - Wages of Sin 5\",\n URL = \"https://i.ibb.co/sj1bS5x/Circle-Undone-4-Wages-of-Sin-Serge-Da-Silva-Dias.jpg\"\n }, {\n Name = \"V - For the Greater Good 1\",\n URL = \"https://i.ibb.co/LDyqjbj/Circle-Undone-5-For-the-Greater-Good.jpg\"\n }, {\n Name = \"V - For the Greater Good 2\",\n URL = \"https://i.ibb.co/pPzXNd1/Circle-Undone-5-For-the-Greater-Good-2.jpg\"\n }, {\n Name = \"V - For the Greater Good 3\",\n URL = \"https://i.ibb.co/8rMLvJH/Circle-Undone-5-For-the-Greater-Good-Greg-Bobrowski.jpg\"\n }, {\n Name = \"V - For the Greater Good 4\",\n URL = \"https://i.ibb.co/vj1q4Cm/Circle-Undone-5-For-the-Greater-Good-Robert-Laskey.jpg\"\n }, {\n Name = \"VI - Union and Disillusioned\",\n URL = \"https://i.ibb.co/n7SD1tB/Circle-Undone-6-Union-amp-Disillusioned-Andreas-Rocha.jpg\"\n }, {\n Name = \"VII - In the Clutches of Chaos 1\",\n URL = \"https://i.ibb.co/bFXBNh7/Circle-Undone-7-In-the-Clutches-of-Chaos.jpg\"\n }, {\n Name = \"VII - In the Clutches of Chaos 2\",\n URL = \"https://i.ibb.co/m6DshNg/Circle-Undone-7-In-the-Clutches-of-Chaos-Alexandr-Elichev.jpg\"\n }, {\n Name = \"VII - In the Clutches of Chaos 3\",\n URL = \"https://i.ibb.co/k2p4yfG/Circle-Undone-7-In-the-Clutches-of-Chaos-Jokubas-Uogintas.jpg\"\n }, {\n Name = \"VIII - Before the Black Throne 1\",\n URL = \"https://i.ibb.co/9TPwvP6/Circle-Undone-8-Before-the-Black-Throne-Aaron-Luke-Wilson.jpg\"\n }, {\n Name = \"VIII - Before the Black Throne 2\",\n URL = \"https://i.ibb.co/VNtgH4v/Circle-Undone-8-Before-the-Black-Throne-Greg-Bobrowski.jpg\"\n } },\n [\"Side Scenarios (FM)\"] = { {\n Name = \"Consternation on the Constellation\",\n URL = \"https://i.ibb.co/Tw2xBP1/Consternation-Constellation.jpg\"\n }, {\n Name = \"Symphony of Erich Zann\",\n URL = \"https://i.ibb.co/SNr8tqN/Symphony-of-Erich-Zann-Hazel-Yingling.jpg\"\n } },\n [\"Cyclopean Foundations (FM)\"] = { {\n Name = \"I - Lost Moorings 1\",\n URL = \"https://i.ibb.co/DQ76z3c/Cyclopean-1-Lost-Moorings-Care-Line-Art.png\"\n }, {\n Name = \"I - Lost Moorings 2\",\n URL = \"https://i.ibb.co/c6LJNfr/Cyclopean-1-Lost-Moorings-Jake-Murray.png\"\n }, {\n Name = \"II - Going Twice\",\n URL = \"https://i.ibb.co/P6h3vbm/Cyclopean-2-Going-Twice-Quentin-Bouilloud.png\"\n }, {\n Name = \"III - Private Lives\",\n URL = \"https://i.ibb.co/9qK9Fzd/Cyclopean-3-Private-Lives-Christian-Bravery.png\"\n }, {\n Name = \"IV - Crumbling Masonry 1\",\n URL = \"https://i.ibb.co/pdrGK6p/Cyclopean-4-Crumbling-Masonry-Pete-Amachree.png\"\n }, {\n Name = \"IV - Crumbling Masonry 2\",\n URL = \"https://i.ibb.co/5RFcGyP/Cyclopean-4-Crumbling-Masonry-Simon-Craghead.png\"\n }, {\n Name = \"V - Across Dreadful Waters\",\n URL = \"https://i.ibb.co/3mYfFNB/Cyclopean-5-Across-Dreadful-Waters-Ev-Shipard.png\"\n }, {\n Name = \"VI - Blood From Stones\",\n URL = \"https://i.ibb.co/ynmQNSB/Cyclopean-6-Blood-From-Stones-Marc-Simonetti.png\"\n }, {\n Name = \"VII - Pyroclastic Flow 1\",\n URL = \"https://i.ibb.co/s1JDkFv/Cyclopean-7-Pyroclastic-Flow-Bastien-Grivet.png\"\n }, {\n Name = \"VII - Pyroclastic Flow 2\",\n URL = \"https://i.ibb.co/qs8Sk2N/Cyclopean-7-Pyroclastic-Flow-Rachid-Lotf.png\"\n }, {\n Name = \"VIII - Tomb of Dead Dreams 1\",\n URL = \"https://i.ibb.co/0MwX460/Cyclopean-8-Tomb-of-Dead-Dreams-Guillem-H-Pongiluppi.png\"\n }, {\n Name = \"VIII - Tomb of Dead Dreams 2\",\n URL = \"https://i.ibb.co/mGnKNcy/Cyclopean-8-Tomb-of-Dead-Dreams-Richard-Benning.png\"\n }, {\n Name = \"VIII - Tomb of Dead Dreams 3\",\n URL = \"https://i.ibb.co/vmBM8x2/Cyclopean-8-Tomb-of-Dead-Dreams-Walter-Brocca.png\"\n } },\n [\"Dark Matter (FM)\"] = { {\n Name = \"I - Tatterdemalion 1\",\n URL = \"https://i.ibb.co/DRMPGVt/Dark-Matter-1-Tatterdemalion-Andrey-Vozny.jpg\"\n }, {\n Name = \"I - Tatterdemalion 2\",\n URL = \"https://i.ibb.co/1JzrrX2/Dark-Matter-1-Tatterdemalion-Brian-Taylor.jpg\"\n }, {\n Name = \"I - Tatterdemalion 3\",\n URL = \"https://i.ibb.co/DzvvgGf/Dark-Matter-1-Tatterdemalion-John-Wallin-Liberto.jpg\"\n }, {\n Name = \"I - Tatterdemalion 4\",\n URL = \"https://i.ibb.co/sQf85b8/Dark-Matter-1-Tatterdemalion-Paul-Pepera.jpg\"\n }, {\n Name = \"II - Electric Nightmares 1\",\n URL = \"https://i.ibb.co/hLGVBt7/Dark-Matter-2-Electric-Nightmares-Dean-Lawrence.jpg\"\n }, {\n Name = \"II - Electric Nightmares 2\",\n URL = \"https://i.ibb.co/cTKZQ61/Dark-Matter-2-Electric-Nightmares-Robert-Thoma.jpg\"\n }, {\n Name = \"IIIa - Lost Quantum\",\n URL = \"https://i.ibb.co/6vyXv90/Dark-Matter-3-Lost-Quantum-Michael-Rajecki.jpg\"\n }, {\n Name = \"IIIb - In the Shadow of Earth 1\",\n URL = \"https://i.ibb.co/DfbTKHP/Dark-Matter-4-In-the-Shadow-of-Earth-Jihoo-Kim.jpg\"\n }, {\n Name = \"IIIb - In the Shadow of Earth 2\",\n URL = \"https://i.ibb.co/MCvPmCb/Dark-Matter-4-In-the-Shadow-of-Earth-N5-Luckybuuncle.jpg\"\n }, {\n Name = \"IIIc - Strange Moons\",\n URL = \"https://i.ibb.co/b2d8qvg/Dark-Matter-5-Strange-Moons-Hongyu-Yin.jpg\"\n }, {\n Name = \"V - Fragment of Carcosa 1\",\n URL = \"https://i.ibb.co/7WnTyYT/Dark-Matter-7-Fragment-of-Carcosa-Colin-Moore.jpg\"\n }, {\n Name = \"V - Fragment of Carcosa 2\",\n URL = \"https://i.ibb.co/mG2Brrd/Dark-Matter-7-Fragments-of-Carcosa-Matthieu-Rebuffat.jpg\"\n }, {\n Name = \"VI - Starfall 1\",\n URL = \"https://i.ibb.co/CJ3LKL7/Dark-Matter-8-Starfall-Vadim-Sadovski.jpg\"\n }, {\n Name = \"VI - Starfall 2\",\n URL = \"https://i.ibb.co/Njd1FcB/Dark-Matter-8-Starfall-Vadim-Sadovski-2.jpg\"\n }, {\n Name = \"VI - Starfall 3\",\n URL = \"https://i.ibb.co/W0Cx7bb/Dark-Matter-8-Starfall-Vadim-Sadovski-3.jpg\"\n } },\n [\"The Dream-Eaters\"] = { {\n Name = \"I-A - Beyond the Gates of Sleep 1\",\n URL = \"https://i.ibb.co/S6sCy7G/Dream-Eaters-1-A-Beyond-the-Gates-of-Sleep-Phoebe-Herring.jpg\"\n }, {\n Name = \"I-A - Beyond the Gates of Sleep 2\",\n URL = \"https://i.ibb.co/kBfW9SC/Dream-Eaters-1-A-Beyond-the-Gates-of-Sleep-Regina-Kurnya.jpg\"\n }, {\n Name = \"I-A - Beyond the Gates of Sleep 3\",\n URL = \"https://i.ibb.co/HGvnxdX/Dream-Eaters-1-A-Beyond-the-Gates-of-Sleep-Jason-Scheier.jpg\"\n }, {\n Name = \"I-B - Waking Nightmare\",\n URL = \"https://i.ibb.co/sWsZCv8/Dream-Eaters-1-B-Waking-Nightmare-Josh-Gould-jpg.jpg\"\n }, {\n Name = \"II-A - Search for Kadath 1\",\n URL = \"https://i.ibb.co/4SwzCD8/Dream-Eaters-2-A-Search-for-Kadath-Andrei-Khrutskii.jpg\"\n }, {\n Name = \"II-A - Search for Kadath 2\",\n URL = \"https://i.ibb.co/WpZ4fMc/Dream-Eaters-2-A-Search-for-Kadath-Dan-Iorgulescu.jpg\"\n }, {\n Name = \"II-A - Search for Kadath 3\",\n URL = \"https://i.ibb.co/jwsn0jf/Dream-Eaters-2-A-Search-for-Kadath-Diana-Tsareva.jpg\"\n }, {\n Name = \"II-A - Search for Kadath 4\",\n URL = \"https://i.ibb.co/pd9vxmL/Dream-Eaters-2-A-Search-for-Kadath-Helen-Ilnytska.jpg\"\n }, {\n Name = \"II-A - Search for Kadath 5\",\n URL = \"https://i.ibb.co/MZ7Qtcc/Dream-Eaters-2-A-Search-for-Kadath-Nele-Diel.jpg\"\n }, {\n Name = \"II-B - Thousand Shapes of Horror 1\",\n URL = \"https://i.ibb.co/9s7M0PP/Dream-Eaters-2-B-Thousand-Shapes-of-Horror-Nele-Diel-2.jpg\"\n }, {\n Name = \"II-B - Thousand Shapes of Horror 2\",\n URL = \"https://i.ibb.co/T4Pqx0H/Dream-Eaters-2-B-Thousand-Shapes-of-Horror-Nele-Diel.jpg\"\n }, {\n Name = \"II-B - Thousand Shapes of Horror 3\",\n URL = \"https://i.ibb.co/VJFQVYd/Dream-Eaters-2-B-Thousand-Shapes-of-Horror-Greg-Bobrowski.jpg\"\n }, {\n Name = \"III-A - Dark Side of the Moon 1\",\n URL = \"https://i.ibb.co/B2DfXLZ/Dream-Eaters-3-A-Dark-Side-of-the-Moon-Dabanli.jpg\"\n }, {\n Name = \"III-A - Dark Side of the Moon 2\",\n URL = \"https://i.ibb.co/c27JRvv/Dream-Eaters-3-A-Dark-Side-of-the-Moon-Frej-Agelii.jpg\"\n }, {\n Name = \"III-B - Point of No Return 1\",\n URL = \"https://i.ibb.co/dMGNB9Y/Dream-Eaters-3-B-Point-of-No-Return-Daria-Khlebnikova.jpg\"\n }, {\n Name = \"III-B - Point of No Return 2\",\n URL = \"https://i.ibb.co/dpXxPmz/Dream-Eaters-3-B-Point-of-No-Return-Karine-Villette.jpg\"\n }, {\n Name = \"IV-A - Where the Gods Dwell\",\n URL = \"https://i.ibb.co/v4nqw6G/Dream-Eaters-4-A-Where-the-Gods-Dwell-Samantha-Franco.jpg\"\n }, {\n Name = \"IV-B - Weaver of the Cosmos 1\",\n URL = \"https://i.ibb.co/7btNBS1/Dream-Eaters-4-B-Weaver-of-the-Cosmos-Diana-Franco.jpg\"\n }, {\n Name = \"IV-B - Weaver of the Cosmos 2\",\n URL = \"https://i.ibb.co/RY7y22b/Dream-Eaters-4-B-Weaver-of-the-Cosmos-Leanna-Crossan.jpg\"\n }, {\n Name = \"IV-B - Weaver of the Cosmos 3\",\n URL = \"https://i.ibb.co/f8LBbFW/Dream-Eaters-4-B-Weaver-of-the-Cosmos-Nele-Diel.jpg\"\n } },\n [\"The Dunwich Legacy\"] = { {\n Name = \"I-A - Extracurricular Activity 1\",\n URL = \"https://i.ibb.co/tDxX8KS/Dunwich-1-Extracurricular-Activity-Igor-Kirdeika.jpg\"\n }, {\n Name = \"I-A - Extracurricular Activity 2\",\n URL = \"https://i.ibb.co/RQ6z0pj/Dunwich-1-Extracurricular-Activity-Joseph-Diaz.jpg\"\n }, {\n Name = \"I-A - Extracurricular Activity 3\",\n URL = \"https://i.ibb.co/nnJdwL2/Dunwich-1-Extracurricular-Activity-Tomasz-Jedruszek.jpg\"\n }, {\n Name = \"I-B - House Always Wins 1\",\n URL = \"https://i.ibb.co/8XPLdr9/Dunwich-2-House-Always-Wins-Jonny-Klein.jpg\"\n }, {\n Name = \"I-B - House Always Wins 2\",\n URL = \"https://i.ibb.co/HtX95GK/Dunwich-2-House-Always-Wins-Robert-Laskey.jpg\"\n }, {\n Name = \"I-B - House Always Wins 3\",\n URL = \"https://i.ibb.co/MCLP3Sz/Dunwich-2-House-Always-Wins-XX-l.jpg\"\n }, {\n Name = \"I-B - House Always Wins 4\",\n URL = \"https://i.ibb.co/w7Pf5sd/Dunwich-2-House-Always-Wins-XX-l-2.jpg\"\n }, {\n Name = \"II - Miskatonic Museum 1\",\n URL = \"https://i.ibb.co/x1Kf7qG/Dunwich-3-Miskatonic-Museum-Emre-Aktuna.jpg\"\n }, {\n Name = \"II - Miskatonic Museum 2\",\n URL = \"https://i.ibb.co/yWXVPcN/Dunwich-3-Miskatonic-Museum-Richard-Wright.jpg\"\n }, {\n Name = \"III - Essex County Express\",\n URL = \"https://i.ibb.co/602CMZb/Dunwich-4-Essex-County-Express-David-Alvarez.jpg\"\n }, {\n Name = \"IV - Blood on the Altar 1\",\n URL = \"https://i.ibb.co/3CYHDhf/Dunwich-5-Blood-on-the-Altar.jpg\"\n }, {\n Name = \"IV - Blood on the Altar 2\",\n URL = \"https://i.ibb.co/FbxcCY2/Dunwich-5-Blood-on-the-Altar-Chris-Ostrowski.jpg\"\n }, {\n Name = \"IV - Blood on the Altar 3\",\n URL = \"https://i.ibb.co/sJf6YsZ/Dunwich-5-Blood-on-the-Altar-Lucas-Staniec.jpg\"\n }, {\n Name = \"IV - Blood on the Altar 4\",\n URL = \"https://i.ibb.co/kBPNGBd/Dunwich-5-Blood-on-the-Altar-Mark-Molnar.jpg\"\n }, {\n Name = \"V - Undimensioned and Unseen 1\",\n URL = \"https://i.ibb.co/QvfhjDv/Dunwich-6-Undimensioned-and-Unseen-Frej-Agelii.jpg\"\n }, {\n Name = \"V - Undimensioned and Unseen 2\",\n URL = \"https://i.ibb.co/4VL9gSK/Dunwich-6-Undimensioned-and-Unseen-Lucas-Staniec.jpg\"\n }, {\n Name = \"V - Undimensioned and Unseen 3\",\n URL = \"https://i.ibb.co/wBFsS8P/Dunwich-6-Undimensioned-and-Unseen-Michal-Teliga-jpg.jpg\"\n }, {\n Name = \"V - Undimensioned and Unseen 4\",\n URL = \"https://i.ibb.co/wwGDcq6/Dunwich-6-Undimensioned-and-Unseen-Tomasz-Jedruszek.jpg\"\n }, {\n Name = \"VI - Where Doom Awaits 1\",\n URL = \"https://i.ibb.co/TvMwqj4/Dunwich-7-Where-Doom-Awaits.jpg\"\n }, {\n Name = \"VI - Where Doom Awaits 2\",\n URL = \"https://i.ibb.co/S6cSLH9/Dunwich-7-Where-Doom-Awaits-3.jpg\"\n }, {\n Name = \"VI - Where Doom Awaits 3\",\n URL = \"https://i.ibb.co/khBX32g/Dunwich-7-Where-Doom-Awaits-4.jpg\"\n }, {\n Name = \"VI - Where Doom Awaits 4\",\n URL = \"https://i.ibb.co/S0hcwN8/Dunwich-7-Where-Doom-Awaits-5.jpg\"\n }, {\n Name = \"VI - Where Doom Awaits 5\",\n URL = \"https://i.ibb.co/Lxv1Bjp/Dunwich-7-Where-Doom-Awaits-Luca-Trentin.jpg\"\n }, {\n Name = \"VII - Lost in Time and Space 1\",\n URL = \"https://i.ibb.co/rtTpbDx/Dunwich-8-Lost-in-Time-amp-Space.jpg\"\n }, {\n Name = \"VII - Lost in Time and Space 2\",\n URL = \"https://i.ibb.co/dBXP0GL/Dunwich-8-Lost-in-Time-amp-Space-Chris-Ostrowski.jpg\"\n }, {\n Name = \"VII - Lost in Time and Space 3\",\n URL = \"https://i.ibb.co/0XcnxFD/Dunwich-8-Lost-in-Time-amp-Space-Lino-Drieghe.jpg\"\n } },\n [\"Edge of the Earth\"] = { {\n Name = \"I - Ice and Death 1\",\n URL = \"https://i.ibb.co/FWZMWtW/Edge-1-Ice-and-Death-David-Frasheski.png\"\n }, {\n Name = \"I - Ice and Death 2\",\n URL = \"https://i.ibb.co/QDGV0jQ/Edge-1-Ice-and-Death-Felix-Riano.png\"\n }, {\n Name = \"I - Ice and Death 3\",\n URL = \"https://i.ibb.co/hFJQM8v/Edge-1-Ice-and-Death-Mike-Gizienski.png\"\n }, {\n Name = \"??? - Fatal Mirage\",\n URL = \"https://i.ibb.co/KzwvjJN/Edge-2-Fatal-Mirage-David-Frasheski.png\"\n }, {\n Name = \"II - Forbidden Peaks 1\",\n URL = \"https://i.ibb.co/C2SLByt/Edge-2-Forbidden-Peaks-David-Frasheski-2.png\"\n }, {\n Name = \"II - Forbidden Peaks 2\",\n URL = \"https://i.ibb.co/0cGkkBL/Edge-3-Forbidden-Peaks-David-Frasheski.png\"\n }, {\n Name = \"III - City of Elder Things 1\",\n URL = \"https://i.ibb.co/FbpgBD3/Edge-4-City-Francois-Baranger.png\"\n }, {\n Name = \"III - City of Elder Things 2\",\n URL = \"https://i.ibb.co/ncRvHr3/Edge-4-City-Francois-Baranger-2.png\"\n }, {\n Name = \"IV - Heart of Madness 1\",\n URL = \"https://i.ibb.co/rk0qR4z/Edge-5-Heart-of-Madness-Karol-Sollich.png\"\n }, {\n Name = \"IV - Heart of Madness 2\",\n URL = \"https://i.ibb.co/NVFjx6N/Edge-5-Heart-of-Madness-Miguel-Coimbra.png\"\n } },\n [\"The Forgotten Age\"] = { {\n Name = \"I - Untamed Wilds 1\",\n URL = \"https://i.ibb.co/BLhwCG1/Forgotten-Age-1-Untamed-Wilds-David-Frasheski.jpg\"\n }, {\n Name = \"I - Untamed Wilds 2\",\n URL = \"https://i.ibb.co/SnJfsNy/Forgotten-Age-1-Untamed-Wilds-David-Frasheski-2.jpg\"\n }, {\n Name = \"I - Untamed Wilds 3\",\n URL = \"https://i.ibb.co/kcx1tvp/Forgotten-Age-1-Untamed-Wilds-Ethan-Patrick-Harris.jpg\"\n }, {\n Name = \"I - Untamed Wilds 4\",\n URL = \"https://i.ibb.co/HPbJwXk/Forgotten-Age-1-Untamed-Wilds-Lucas-Staniec.jpg\"\n }, {\n Name = \"I - Untamed Wilds 5\",\n URL = \"https://i.ibb.co/bbq1ZrK/Forgotten-Age-1-Untamed-Wilds-Nele-Diel.jpg\"\n }, {\n Name = \"II - Doom of Etzli 1\",\n URL = \"https://i.ibb.co/Pw4by4q/Forgotten-Age-2-Doom-of-Eztli-Cristi-Balanescu.jpg\"\n }, {\n Name = \"II - Doom of Etzli 2\",\n URL = \"https://i.ibb.co/xqW6cXR/Forgotten-Age-2-Doom-of-Eztli-Greg-Bobrowski.jpg\"\n }, {\n Name = \"II - Doom of Etzli 3\",\n URL = \"https://i.ibb.co/kgsC3pb/Forgotten-Age-2-Doom-of-Eztli-Nele-Diel.jpg\"\n }, {\n Name = \"III - Threads of Fate\",\n URL = \"https://i.ibb.co/Bn0Pjng/Forgotten-Age-3-Threads-of-Fate-Jokubas-Uogintas.jpg\"\n }, {\n Name = \"IV - Boundary Beyond 1\",\n URL = \"https://i.ibb.co/yPZ9v2X/Forgotten-Age-4-Boundary-Beyond-Greg-Bobrowski-2-jpg.jpg\"\n }, {\n Name = \"IV - Boundary Beyond 2\",\n URL = \"https://i.ibb.co/vm0JgFs/Forgotten-Age-4-Boundary-Beyond-Greg-Bobrowski-jpg.jpg\"\n }, {\n Name = \"IV - Boundary Beyond 3\",\n URL = \"https://i.ibb.co/D1rh9Ry/Forgotten-Age-4-Boundary-Beyond-Nele-Diel.jpg\"\n }, {\n Name = \"V - Heart of the Elders I-1\",\n URL = \"https://i.ibb.co/jzKvv6P/Forgotten-Age-5-Heart-of-the-Elders-I-Lucas-Staniec.jpg\"\n }, {\n Name = \"V - Heart of the Elders I-2\",\n URL = \"https://i.ibb.co/mR79MX4/Forgotten-Age-5-Heart-of-the-Elders-I-Lucas-Staniec-2.jpg\"\n }, {\n Name = \"V - Heart of the Elders II\",\n URL = \"https://i.ibb.co/pQSbL0t/Forgotten-Age-5-Heart-of-the-Elders-II-Nele-Diel.jpg\"\n }, {\n Name = \"VI - City of Archives 1\",\n URL = \"https://i.ibb.co/f04DSPb/Forgotten-Age-6-City-of-Archives.jpg\"\n }, {\n Name = \"VI - City of Archives 2\",\n URL = \"https://i.ibb.co/WsSBrYj/Forgotten-Age-6-City-of-Archives-2.jpg\"\n }, {\n Name = \"VI - City of Archives 3\",\n URL = \"https://i.ibb.co/qdPbSZ8/Forgotten-Age-6-City-of-Archives-Chris-Ostrowski.jpg\"\n }, {\n Name = \"VII - Depths of Yoth 1\",\n URL = \"https://i.ibb.co/dbLKgGv/Forgotten-Age-7-Depths-of-Yoth-Diego-Arbetta.jpg\"\n }, {\n Name = \"VII - Depths of Yoth 2\",\n URL = \"https://i.ibb.co/NW7Wp98/Forgotten-Age-7-Depths-of-Yoth-Greg-Bobrowski.jpg\"\n }, {\n Name = \"VII - Depths of Yoth 3\",\n URL = \"https://i.ibb.co/257zr7c/Forgotten-Age-7-Depths-of-Yoth-Greg-Bobrowski-2-jpg.jpg\"\n }, {\n Name = \"VIII - Shattered Aeons 1\",\n URL = \"https://i.ibb.co/KwnWTGR/Forgotten-Age-8-Shattered-Aeons.jpg\"\n }, {\n Name = \"VIII - Shattered Aeons 2\",\n URL = \"https://i.ibb.co/b7kVd4F/Forgotten-Age-8-Shattered-Aeons-Alexandr-Elichev.jpg\"\n } },\n [\"The Innsmouth Conspiracy\"] = { {\n Name = \"I - Pit of Despair 1\",\n URL = \"https://i.ibb.co/2sc0F61/Innsmouth-1-Pit-of-Despair-Amanda-Castrillo.jpg\"\n }, {\n Name = \"I - Pit of Despair 2\",\n URL = \"https://i.ibb.co/Nj9JLBQ/Innsmouth-1-Pit-of-Despair-J-Mill.jpg\"\n }, {\n Name = \"II - Vanishing of Elina Harper 1\",\n URL = \"https://i.ibb.co/2j74cVn/Innsmouth-2-Vanishing-of-Elina-Harper-Konstantin-Vohwinkel.jpg\"\n }, {\n Name = \"II - Vanishing of Elina Harper 2\",\n URL = \"https://i.ibb.co/r2VqHSn/Innsmouth-2-Vanishing-of-Elina-Harper-Mihail-Bila.jpg\"\n }, {\n Name = \"II - Vanishing of Elina Harper 3\",\n URL = \"https://i.ibb.co/hFQMm7N/Innsmouth-2-Vanishing-of-Elina-Harper-Richard-Wright.jpg\"\n }, {\n Name = \"II - Vanishing of Elina Harper 4\",\n URL = \"https://i.ibb.co/2nZKGN6/Innsmouth-2-Vanishing-of-Elina-Harper-Tomasz-Jedruszek-1.jpg\"\n }, {\n Name = \"II - Vanishing of Elina Harper 5\",\n URL = \"https://i.ibb.co/WxLpKrM/Innsmouth-2-Vanishing-of-Elina-Harper-Tomasz-Jedruszek-2.jpg\"\n }, {\n Name = \"III - In Too Deep 1\",\n URL = \"https://i.ibb.co/SsQ3my4/Innsmouth-3-In-Too-Deep-David-Frasheski.jpg\"\n }, {\n Name = \"III - In Too Deep 2\",\n URL = \"https://i.ibb.co/jgQ8zQN/Innsmouth-3-In-Too-Deep-Klaudia-Bezak.jpg\"\n }, {\n Name = \"III - In Too Deep 3\",\n URL = \"https://i.ibb.co/VVgtNM1/Innsmouth-3-In-Too-Deep-Patrik-Antonescu.jpg\"\n }, {\n Name = \"IV - Devil Reef 1\",\n URL = \"https://i.ibb.co/Jrf6CJ0/Innsmouth-4-Devil-Reef-Ludovic-Sanson.jpg\"\n }, {\n Name = \"IV - Devil Reef 2\",\n URL = \"https://i.ibb.co/4jfwDZR/Innsmouth-4-Devil-Reef-Marc-Stewart.jpg\"\n }, {\n Name = \"V - Horror in High Gear 1\",\n URL = \"https://i.ibb.co/vqYJjYJ/Innsmouth-5-Horror-in-High-Gear-Greg-Bobrowski.jpg\"\n }, {\n Name = \"V - Horror in High Gear 2\",\n URL = \"https://i.ibb.co/yYrzbYS/Innsmouth-5-Horror-in-High-Gear-Greg-Bobrowski-2.jpg\"\n }, {\n Name = \"V - Horror in High Gear 3\",\n URL = \"https://i.ibb.co/fpKWhGY/Innsmouth-5-Horror-in-High-Gear-Guillem-H-Pongiluppi.jpg\"\n }, {\n Name = \"V - Horror in High Gear 4\",\n URL = \"https://i.ibb.co/YkLFy7y/Innsmouth-5-Horror-in-High-Gear-Rostyslav-Zagornov.jpg\"\n }, {\n Name = \"VI - Light in the Fog 1\",\n URL = \"https://i.ibb.co/v1rhgqJ/Innsmouth-6-Light-in-the-Fog-Florian-Aupetit.jpg\"\n }, {\n Name = \"VI - Light in the Fog 2\",\n URL = \"https://i.ibb.co/Db2pRd6/Innsmouth-6-Light-in-the-Fog-JB-Caillet.jpg\"\n }, {\n Name = \"VII - Lair of Dagon 1\",\n URL = \"https://i.ibb.co/QPwzQL5/Innsmouth-7-Lair-of-Dagon-Daria-Khlebnikova.jpg\"\n }, {\n Name = \"VII - Lair of Dagon 2\",\n URL = \"https://i.ibb.co/MZBpCbs/Innsmouth-7-Lair-of-Dagon-Guillem-H-Pongiluppi.jpg\"\n }, {\n Name = \"VIII - Into the Maelstrom 1\",\n URL = \"https://i.ibb.co/fkSXDgs/Innsmouth-8-Into-the-Maelstrom-Dimitri-Bielak.jpg\"\n }, {\n Name = \"VIII - Into the Maelstrom 2\",\n URL = \"https://i.ibb.co/k56Dn9q/Innsmouth-8-Into-the-Maelstrom-Mateusz-Michalski.jpg\"\n } },\n [\"Night of the Zealot\"] = { {\n Name = \"I - The Gathering 1\",\n URL = \"https://i.ibb.co/6NWqg1K/Zealot-Gathering.jpg\"\n }, {\n Name = \"III - Devourer Below 1\",\n URL = \"https://i.ibb.co/x5QFzrx/Zealot-3-Devourer-Below-Helen-Castelow.png\"\n }, {\n Name = \"III - Devourer Below 2\",\n URL = \"https://i.ibb.co/6r6LFGz/Zealot-3-Devourer-Below-Sarah-Miller.png\"\n } },\n [\"The Ghosts of Onigawa (FM)\"] = { {\n Name = \"I - The Ghosts of Onigawa\",\n URL = \"https://github.com/ArkhamDotCards/theghostsofonigawa/blob/main/product/onigawa-playmat-01.png?raw=true\"\n }, {\n Name = \"II - In The Shadow Of Mount Kokoro\",\n URL = \"https://github.com/ArkhamDotCards/theghostsofonigawa/blob/main/product/onigawa-playmat-02.png?raw=true\"\n }, {\n Name = \"III - The Onigawa River\",\n URL = \"https://github.com/ArkhamDotCards/theghostsofonigawa/blob/main/product/onigawa-playmat-03.png?raw=true\"\n }, {\n Name = \"IV - The Crimson Butterfly\",\n URL = \"https://github.com/ArkhamDotCards/theghostsofonigawa/blob/main/product/onigawa-playmat-04.png?raw=true\"\n }, {\n Name = \"V - The Koi Conspiracy\",\n URL = \"https://github.com/ArkhamDotCards/theghostsofonigawa/blob/main/product/onigawa-playmat-05.png?raw=true\"\n } },\n [\"The Scarlet Keys\"] = { {\n Name = \"5-A Riddles and Rain\",\n URL = \"http://cloud-3.steamusercontent.com/ugc/2037357792057358580/E9E5FE4028C08B3D4883406821221B73C8B5B2C7/\"\n }, {\n Name = \"11-B Dead Heat\",\n URL = \"http://cloud-3.steamusercontent.com/ugc/2038485431566443853/CAD7771D90141EA6D5FFAFE1EC5E7AD9647C82DB/\"\n }, {\n Name = \"16-D Sanguine Shadows\",\n URL = \"http://cloud-3.steamusercontent.com/ugc/2037357792057358704/4A7261EB31511467CBC46E876476DD205F528A4B/\"\n }, {\n Name = \"21-F Dealings in the Dark\",\n URL = \"http://cloud-3.steamusercontent.com/ugc/2037357792057358816/7C9FE4C34CD0A7AE87EF054742D878F310C71AA7/\"\n }, {\n Name = \"28-I Dancing Mad\",\n URL = \"http://cloud-3.steamusercontent.com/ugc/2037357792056955518/EAB857DD5629EC6A3078FB0A3A703B85B5F514B9/\"\n }, {\n Name = \"23-K On Thin Ice\",\n URL = \"http://cloud-3.steamusercontent.com/ugc/2038485431566444026/EB5628E254AE25DA89A9C999EAAD995ECF67068E/\"\n }, {\n Name = \"38-N Dogs of War\",\n URL = \"http://cloud-3.steamusercontent.com/ugc/2038485431566444199/194FD9A713907197471A55411AE300B62C5F5278/\"\n }, {\n Name = \"46-Q Shades of Suffering\",\n URL = \"http://cloud-3.steamusercontent.com/ugc/2038485431566444330/3ED2CCE95DE933546E1B5CBBF445D773E6D65465/\"\n }, {\n Name = \"56-Y ???\",\n URL = \"http://cloud-3.steamusercontent.com/ugc/2038485431566444450/FE4C335B0F72E83900A4EED0FD1A1D304D70D6B7/\"\n }, {\n Name = \"59-Z Congress of Keys I\",\n URL = \"http://cloud-3.steamusercontent.com/ugc/2038485431566444576/5BB32469ED412D59BB0A46E57D226500B1D0568B/\"\n }, {\n Name = \"59-Z Congress of Keys II\",\n URL = \"http://cloud-3.steamusercontent.com/ugc/2038485431566444690/B01A1FEAB57473D9B6DF11B92D62C214AA1C2C02/\"\n } }\n}\n\nlocal verticalOffset = 0.5\n\nlocal buttonParameters = {}\nbuttonParameters.function_owner = self\nbuttonParameters.width = 1200\nbuttonParameters.height = 300\nbuttonParameters.position = { x = -0.2, y = 0.06, z = -verticalOffset }\n\nlocal CycleIndex = 1\nlocal CycleList = {\n \"Arkham Locations\",\n \"Night of the Zealot\",\n \"The Dunwich Legacy\",\n \"The Path to Carcosa\",\n \"The Forgotten Age\",\n \"The Circle Undone\",\n \"The Dream-Eaters\",\n \"The Innsmouth Conspiracy\",\n \"Edge of the Earth\",\n \"The Scarlet Keys\",\n \"Side Scenarios\",\n \"Cyclopean Foundations (FM)\",\n \"Dark Matter (FM)\",\n \"The Ghosts of Onigawa (FM)\",\n \"Side Scenarios (FM)\"\n}\n\n-- save the index of selected cycle and table with spawnData\nfunction onSave() return JSON.encode({ CycleIndex, spawnData }) end\n\nfunction onLoad(savedData)\n if savedData == nil then\n print(\"Error: Saved Data was not found.\")\n else\n local loadedData = JSON.decode(savedData)\n CycleIndex = loadedData[1]\n spawnData = loadedData[2]\n end\n\n --spawnData = getObjectFromGUID(\"f4a462\").getData()\n\n -- index 0: cycle selection button\n buttonParameters.click_function = \"selectCycle\"\n buttonParameters.tooltip = \"Select a cycle\"\n buttonParameters.label = CycleList[CycleIndex]\n buttonParameters.font_size = 90\n self.createButton(buttonParameters)\n\n -- index 1: display button\n buttonParameters.click_function = \"showImages\"\n buttonParameters.tooltip = \"Right-Click to remove displayed tiles\"\n buttonParameters.label = \"Display available images\"\n buttonParameters.position.z = buttonParameters.position.z + 2 * verticalOffset\n self.createButton(buttonParameters)\nend\n\n-- open option dialog to select cycle\nfunction selectCycle(_, color)\n Player[color].showOptionsDialog(\"Select cycle:\", CycleList, CycleIndex, optionCallback)\nend\n\n-- update CycleIndex based on selection in the option dialog\nfunction optionCallback(_, optionIndex)\n CycleIndex = optionIndex\n self.editButton({\n index = 0,\n label = CycleList[CycleIndex]\n })\n showImages()\nend\n\n-- triggered by clicking the \"display\" button\nfunction showImages(_, _, isRightClick)\n removeImages()\n\n -- don't display new tiles when right-clicked\n if isRightClick then return end\n\n local pos = self.getPosition()\n local rot = self.getRotation()\n local offset = 3.7\n pos.z = pos.z - 1 - offset\n\n -- loop over respective entries in DATA\n for i, entry in ipairs(DATA[CycleList[CycleIndex]]) do\n spawnData.CustomImage.ImageURL = entry.URL\n spawnData.Nickname = entry.Name\n\n spawnObjectData({\n data = spawnData,\n position = pos,\n rotation = rot,\n scale = { 0.9, 1, 0.9 }\n })\n\n -- display 20 tiles in a row, move then to next row\n if i % 20 == 0 then\n pos.x = pos.x - offset\n pos.z = self.getPosition().z - 1 - offset\n else\n pos.z = pos.z - offset\n end\n end\nend\n\n-- remove already laid out image tiles by tag\nfunction removeImages()\n for _, tile in ipairs(getObjectsWithTag(\"ImageSwapperTile\")) do\n tile.destruct()\n end\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"accessories/CustomPlaymatImages\")\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "[1,{\"AltLookAngle\":{\"x\":0,\"y\":0,\"z\":0},\"Autoraise\":true,\"ColorDiffuse\":{\"a\":1,\"b\":1,\"g\":1,\"r\":1},\"CustomImage\":{\"CustomToken\":{\"MergeDistancePixels\":15,\"Stackable\":false,\"StandUp\":false,\"Thickness\":0.1},\"ImageScalar\":1,\"ImageSecondaryURL\":\"\",\"ImageURL\":\"https://i.ibb.co/YXjvkMn/Arkham-Uptown-Jokubas-Uogintas.jpg\",\"WidthScale\":0},\"Description\":\"Click the 'Apply' button to load this image.\",\"DragSelectable\":true,\"GMNotes\":\"\",\"Grid\":true,\"GridProjection\":false,\"GUID\":\"f4a462\",\"Hands\":true,\"HideWhenFaceDown\":false,\"IgnoreFoW\":false,\"LayoutGroupSortIndex\":0,\"Locked\":false,\"LuaScript\":\"function onLoad()\\n local params = {}\\n params.click_function = 'updatePlayarea'\\n params.function_owner = self\\n params.label = 'Apply'\\n params.tooltip = 'Left-Click: Apply image\\\\nRight-Click: Revert to default'\\n params.position = { 0, 0.06, -1.45 }\\n params.height = 300\\n params.width = 675\\n params.color = { 0, 0, 0 }\\n params.font_size = 200\\n params.font_color = { 1, 1, 1 }\\n self.createButton(params)\\nend\\n\\nfunction updatePlayarea(_, _, isRightClick)\\n local imageswapper = getObjectFromGUID(\\\"b7b45b\\\")\\n\\n -- error handling\\n if imageswapper == nil then\\n printToAll(\\\"Image swapper could not be found!\\\", \\\"Orange\\\")\\n return\\n end\\n\\n -- get default image when right-clicked, else load its own image\\n if isRightClick then\\n imageswapper.call(\\\"updateSurface\\\")\\n else\\n imageswapper.call(\\\"updateSurface\\\", self.getCustomObject().image)\\n end\\nend\\n\",\"LuaScriptState\":\"\",\"MeasureMovement\":false,\"Name\":\"Custom_Token\",\"Nickname\":\"Uptown\",\"Snap\":true,\"Sticky\":true,\"Tags\":[\"ImageSwapperTile\"],\"Tooltip\":true,\"Transform\":{\"posX\":0,\"posY\":2,\"posZ\":0,\"rotX\":0,\"rotY\":270,\"rotZ\":0,\"scaleX\":1,\"scaleY\":1,\"scaleZ\":1},\"Value\":0,\"XmlUI\":\"\"}]\r", - "MeasureMovement": false, - "Name": "Custom_Token", - "Nickname": "Custom Playmat Images", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": 44.323, - "posY": 2.29, - "posZ": -60.49, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 1.33, - "scaleY": 1, - "scaleZ": 1.33 - }, - "Value": 0, - "XmlUI": "" + "XmlUI": "\u003c!-- include accessories/CleanUpHelper.xml --\u003e\n\u003c!-- Default formatting --\u003e\n\u003cDefaults\u003e\n \u003cText color=\"black\" alignment=\"MiddleLeft\"/\u003e\n \u003cText class=\"h1\" fontSize=\"160\" font=\"font_teutonic-arkham\"/\u003e\n \u003cText class=\"h2\" fontSize=\"120\" font=\"font_teutonic-arkham\"/\u003e\n \u003cText class=\"p\" fontSize=\"60\" alignment=\"UpperLeft\"/\u003e\n\n \u003cPanel rotation=\"0 0 180\"/\u003e\n \u003cPanel class=\"window\" width=\"1500\" height=\"1500\" color=\"white\" outline=\"white\" outlineSize=\"10 10\"/\u003e\n\n \u003cRow dontUseTableRowBackground=\"true\"/\u003e\n \u003cRow class=\"header\" color=\"#707070\"/\u003e\n \u003cRow class=\"option\" preferredHeight=\"200\" color=\"#9e9e9e\"/\u003e\n\n \u003c!-- row heights: 70 x lines + 50 --\u003e\n \u003cRow class=\"description\" color=\"#cfcfcf\"/\u003e\n\n \u003cButton class=\"optionToggle\" rectAlignment=\"MiddleRight\" offsetXY=\"-30 0\" colors=\"#FFFFFF|#dfdfdf\" height=\"160\" width=\"288\" ignoreLayout=\"True\" fontSize=\"60\"/\u003e\n\u003c/Defaults\u003e\n\n\u003c!-- Option window --\u003e\n\u003cPanel id=\"options\" class=\"window\" offsetXY=\"-580 200\" scale=\"0.5 0.5\" active=\"false\" showAnimation=\"FadeIn\" hideAnimation=\"FadeOut\"\u003e\n \u003cTableLayout cellPadding=\"25 25 15 15\"\u003e\n \u003c!-- Header --\u003e\n \u003cRow class=\"header\"\u003e\n \u003cCell\u003e\n \u003cText class=\"h1\"\u003eClean up Helper - Options\u003c/Text\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option --\u003e\n \u003cRow class=\"option\"\u003e\n \u003cCell\u003e\n \u003cText class=\"h2\"\u003eImport trauma\u003c/Text\u003e\n \u003cButton class=\"optionToggle\" id=\"importTrauma\" onClick=\"optionButtonClick(importTrauma)\" image=\"option_on\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n \u003cRow class=\"description\" preferredHeight=\"330\"\u003e\n \u003cCell\u003e\n \u003cText class=\"p\"\u003eEnables importing trauma values from the campaign log (custom content might give wrong values!).\u0026#xA;Enter players in the campaign log in this order:\u0026#xA;White, Orange, Green, Red.\u003c/Text\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option --\u003e\n \u003cRow class=\"option\"\u003e\n \u003cCell\u003e\n \u003cText class=\"h2\"\u003eTidy playermats\u003c/Text\u003e\n \u003cButton class=\"optionToggle\" id=\"tidyPlayermats\" onClick=\"optionButtonClick(tidyPlayermats)\" image=\"option_on\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n \u003cRow class=\"description\" preferredHeight=\"190\"\u003e\n \u003cCell\u003e\n \u003cText class=\"p\"\u003eControls whether the playermats should get tidied (removal of all cards and tokens).\u003c/Text\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option --\u003e\n \u003cRow class=\"option\"\u003e\n \u003cCell\u003e\n \u003cText class=\"h2\"\u003eRemove drawn lines\u003c/Text\u003e\n \u003cButton class=\"optionToggle\" id=\"removeDrawnLines\" onClick=\"optionButtonClick(removeDrawnLines)\" image=\"option_off\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n \u003cRow class=\"description\" preferredHeight=\"120\"\u003e\n \u003cCell\u003e\n \u003cText class=\"p\"\u003eControls whether all drawn lines should be removed.\u003c/Text\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n \u003c/TableLayout\u003e\n\u003c/Panel\u003e\n\u003c!-- include accessories/CleanUpHelper.xml --\u003e" } ], "Description": "Contains the objects that are spawnable via option panel", @@ -205631,9 +198529,6 @@ "Nickname": "SoundCube", "Snap": true, "Sticky": true, - "Tags": [ - "SoundCube" - ], "Tooltip": true, "Transform": { "posX": 78, @@ -205672,7 +198567,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/OptionPanelApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local OptionPanelApi = {}\n\n -- loads saved options\n ---@param options Table New options table\n OptionPanelApi.loadSettings = function(options)\n return Global.call(\"loadSettings\", options)\n end\n\n -- returns option panel table\n OptionPanelApi.getOptions = function()\n return Global.getTable(\"optionPanel\")\n end\n\n return OptionPanelApi\nend\nend)\n__bundle_register(\"core/VictoryDisplayApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local VictoryDisplayApi = {}\n local VD_GUID = \"6ccd6d\"\n\n -- triggers an update of the Victory count\n ---@param delay Number Delay in seconds after which the update call is executed\n VictoryDisplayApi.update = function(delay)\n getObjectFromGUID(VD_GUID).call(\"startUpdate\", delay)\n end\n\n -- moves a card to the victory display (in the first empty spot)\n ---@param object Object Object that should be checked and potentially moved\n VictoryDisplayApi.placeCard = function(object)\n if object ~= nil and object.tag == \"Card\" then\n getObjectFromGUID(VD_GUID).call(\"placeCard\", object)\n end\n end\n\n return VictoryDisplayApi\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/GameKeyHandler\")\nend)\n__bundle_register(\"core/GameKeyHandler\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal optionPanelApi = require(\"core/OptionPanelApi\")\nlocal playmatApi = require(\"playermat/PlaymatApi\")\nlocal victoryDisplayApi = require(\"core/VictoryDisplayApi\")\n\nfunction onLoad()\n addHotkey(\"Add Doom to Agenda\", addDoomToAgenda)\n addHotkey(\"Bless/Curse Status\", showBlessCurseStatus)\n addHotkey(\"Move card to Victory Display\", moveCardToVictoryDisplay)\n addHotkey(\"Take clue from location\", takeClueFromLocation)\n addHotkey(\"Upkeep\", triggerUpkeep)\n addHotkey(\"Upkeep (Multi-handed)\", triggerUpkeepMultihanded)\n addHotkey(\"Wendy's Menu\", addWendysMenu)\nend\n\n-- triggers the \"Upkeep\" function of the calling player's playmat\nfunction triggerUpkeep(playerColor)\n if playerColor == \"Black\" then\n broadcastToColor(\"Triggering 'Upkeep (Multihanded)' instead\", playerColor, \"Yellow\")\n triggerUpkeepMultihanded(playerColor)\n return\n end\n local matColor = playmatApi.getMatColor(playerColor)\n playmatApi.doUpkeepFromHotkey(matColor, playerColor)\nend\n\n-- triggers the \"Upkeep\" function of the calling player's playmat AND\n-- for all playmats that don't have a seated player, but a investigator card\nfunction triggerUpkeepMultihanded(playerColor)\n if playerColor ~= \"Black\" then\n triggerUpkeep(playerColor)\n end\n local colors = Player.getAvailableColors()\n for _, handColor in ipairs(colors) do\n local matColor = playmatApi.getMatColor(handColor)\n if playmatApi.returnInvestigatorId(matColor) ~= \"00000\" and Player[handColor].seated == false then\n playmatApi.doUpkeepFromHotkey(matColor, playerColor)\n end\n end\nend\n\n-- adds 1 doom to the agenda\nfunction addDoomToAgenda()\n getObjectFromGUID(\"85c4c6\").call(\"addVal\", 1)\nend\n\n-- moves the hovered card to the victory display\nfunction moveCardToVictoryDisplay(_, hoveredObject)\n victoryDisplayApi.placeCard(hoveredObject)\nend\n\n-- takes a clue from a location, player needs to hover the clue directly or the location\nfunction takeClueFromLocation(playerColor, hoveredObject)\n local cardName, clue\n\n if hoveredObject == nil then\n broadcastToColor(\"Hover a clue or card with clues and try again.\", playerColor, \"Yellow\")\n return\n elseif hoveredObject.tag == \"Card\" then\n cardName = hoveredObject.getName()\n\n for _, v in ipairs(searchOnObj(hoveredObject)) do\n local obj = v.hit_object\n if obj.memo == \"clueDoom\" and obj.is_face_down == false then\n clue = obj\n break\n end\n end\n\n if clue == nil then\n broadcastToColor(\"This card does not have any clues on it.\", playerColor, \"Yellow\")\n return\n end\n elseif hoveredObject.memo == \"clueDoom\" then\n if hoveredObject.is_face_down then\n broadcastToColor(\"This is a doom token and not a clue.\", playerColor, \"Yellow\")\n return\n end\n\n clue = hoveredObject\n\n local search = Physics.cast({\n direction = { 0, -1, 0 },\n max_distance = 0.1,\n type = 3,\n size = { 0.1, 0.1, 0.1 },\n origin = clue.getPosition()\n })\n \n for _, v in ipairs(search) do\n local obj = v.hit_object\n if obj.tag == \"Card\" then\n cardName = obj.getName()\n break\n end\n end\n else\n broadcastToColor(\"Hover a clue or card with clues and try again.\", playerColor, \"Yellow\")\n return\n end\n\n local clickableClues = optionPanelApi.getOptions()[\"useClueClickers\"]\n local playerName = Player[playerColor].steam_name\n local matColor = playmatApi.getMatColor(playerColor)\n local pos = nil\n if clickableClues then\n pos = {x = 0.49, y = 2.66, z = 0.00}\n playmatApi.updateClueClicker(playerColor, playmatApi.getClueCount(clickableClues, playerColor) + 1)\n else\n pos = playmatApi.transformLocalPosition({x = -1.12, y = 0.05, z = 0.7}, matColor)\n end\n \n local rot = playmatApi.returnRotation(matColor)\n\n -- check if found clue is a stack or single token\n if clue.getQuantity() \u003e 1 then\n clue.takeObject({position = pos, rotation = rot})\n else\n clue.setPositionSmooth(pos)\n clue.setRotation(rot)\n end\n\n if cardName then\n broadcastToAll(playerName .. \" took one clue from \" .. cardName .. \".\", playerColor)\n else\n broadcastToAll(playerName .. \" took one clue.\", \"Green\")\n end\n\n victoryDisplayApi.update()\nend\n\n-- broadcasts the bless/curse status to the calling player\nfunction showBlessCurseStatus(playerColor)\n blessCurseManagerApi.broadcastStatus(playerColor)\nend\n\n-- adds Wendy's menu to the hovered card\nfunction addWendysMenu(playerColor, hoveredObject)\n blessCurseManagerApi.addWendysMenu(playerColor, hoveredObject)\nend\n\n-- searches on an object (by using its bounds)\n---@param obj Object Object to search on\nfunction searchOnObj(obj)\n return Physics.cast({\n direction = { 0, 1, 0 },\n max_distance = 0.5,\n type = 3,\n size = obj.getBounds().size,\n origin = obj.getPosition()\n })\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local MANAGER_GUID = \"5933fb\"\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getObjectFromGUID(MANAGER_GUID)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getObjectFromGUID(MANAGER_GUID).call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getManager()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"BlessCurseManager\")\n end\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getManager()\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getManager().call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getManager().call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getManager().call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getManager().call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getManager().call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"core/OptionPanelApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local OptionPanelApi = {}\n\n -- loads saved options\n ---@param options Table New options table\n OptionPanelApi.loadSettings = function(options)\n return Global.call(\"loadSettings\", options)\n end\n\n -- returns option panel table\n OptionPanelApi.getOptions = function()\n return Global.getTable(\"optionPanel\")\n end\n\n return OptionPanelApi\nend\nend)\n__bundle_register(\"core/VictoryDisplayApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local VictoryDisplayApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getVictoryDisplay()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"VictoryDisplay\")\n end\n\n -- triggers an update of the Victory count\n ---@param delay Number Delay in seconds after which the update call is executed\n VictoryDisplayApi.update = function(delay)\n getVictoryDisplay().call(\"startUpdate\", delay)\n end\n\n -- moves a card to the victory display (in the first empty spot)\n ---@param object Object Object that should be checked and potentially moved\n VictoryDisplayApi.placeCard = function(object)\n if object ~= nil and object.tag == \"Card\" then\n getVictoryDisplay().call(\"placeCard\", object)\n end\n end\n\n return VictoryDisplayApi\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/GameKeyHandler\")\nend)\n__bundle_register(\"core/GameKeyHandler\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal blessCurseManagerApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal guidReferenceApi = require(\"core/GUIDReferenceApi\")\nlocal optionPanelApi = require(\"core/OptionPanelApi\")\nlocal playmatApi = require(\"playermat/PlaymatApi\")\nlocal victoryDisplayApi = require(\"core/VictoryDisplayApi\")\n\nfunction onLoad()\n addHotkey(\"Add Doom to Agenda\", addDoomToAgenda)\n addHotkey(\"Bless/Curse Status\", showBlessCurseStatus)\n addHotkey(\"Discard Object\", discardObject)\n addHotkey(\"Move card to Victory Display\", moveCardToVictoryDisplay)\n addHotkey(\"Remove a use\", removeOneUse)\n addHotkey(\"Take clue from location\", takeClueFromLocation)\n addHotkey(\"Upkeep\", triggerUpkeep)\n addHotkey(\"Upkeep (Multi-handed)\", triggerUpkeepMultihanded)\n addHotkey(\"Wendy's Menu\", addWendysMenu)\nend\n\n-- triggers the \"Upkeep\" function of the calling player's playmat\nfunction triggerUpkeep(playerColor)\n if playerColor == \"Black\" then\n broadcastToColor(\"Triggering 'Upkeep (Multihanded)' instead\", playerColor, \"Yellow\")\n triggerUpkeepMultihanded(playerColor)\n return\n end\n local matColor = playmatApi.getMatColor(playerColor)\n playmatApi.doUpkeepFromHotkey(matColor, playerColor)\nend\n\n-- triggers the \"Upkeep\" function of the calling player's playmat AND\n-- for all playmats that don't have a seated player, but a investigator card\nfunction triggerUpkeepMultihanded(playerColor)\n if playerColor ~= \"Black\" then\n triggerUpkeep(playerColor)\n end\n local colors = Player.getAvailableColors()\n for _, handColor in ipairs(colors) do\n local matColor = playmatApi.getMatColor(handColor)\n if playmatApi.returnInvestigatorId(matColor) ~= \"00000\" and Player[handColor].seated == false then\n playmatApi.doUpkeepFromHotkey(matColor, playerColor)\n end\n end\nend\n\n-- adds 1 doom to the agenda\nfunction addDoomToAgenda()\n local doomCounter = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"DoomCounter\")\n doomCounter.call(\"addVal\", 1)\nend\n\n-- discard the hovered object to the respective trashcan and discard tokens on it if it was a card\nfunction discardObject(playerColor, hoveredObject)\n -- only continue if an unlocked card, deck or tile was hovered\n if hoveredObject == nil\n or (hoveredObject.type ~= \"Card\" and hoveredObject.type ~= \"Deck\" and hoveredObject.type ~= \"Tile\")\n or hoveredObject.locked then\n broadcastToColor(\"Hover a token/tile or a card/deck and try again.\", playerColor, \"Yellow\")\n return\n end\n\n -- warning for locations since these are usually not meant to be discarded\n if hoveredObject.hasTag(\"Location\") then\n broadcastToAll(\"Watch out: A location was discarded.\", \"Yellow\")\n end\n\n -- initialize list of objects to discard\n local discardTheseObjects = { hoveredObject }\n\n -- discard tokens / tiles on cards / decks\n if hoveredObject.type ~= \"Tile\" then\n for _, v in ipairs(searchOnObj(hoveredObject)) do\n if v.hit_object.type == \"Tile\" then\n table.insert(discardTheseObjects, v.hit_object)\n end\n end\n end\n\n local discardForMatColor = getColorToDiscardFor(hoveredObject, playerColor)\n playmatApi.discardListOfObjects(discardForMatColor, discardTheseObjects)\nend\n\n-- helper function to get the player to trigger the discard function for\nfunction getColorToDiscardFor(hoveredObject, playerColor)\n local pos = hoveredObject.getPosition()\n local closestMatColor = playmatApi.getMatColorByPosition(pos)\n\n -- check if actually on the closest playmat\n local closestMat = guidReferenceApi.getObjectByOwnerAndType(closestMatColor, \"Playermat\")\n local bounds = closestMat.getBounds()\n\n -- define the area \"near\" the playmat\n local bufferAroundPlaymat = 2\n local areaNearPlaymat = {}\n areaNearPlaymat.minX = bounds.center.x - bounds.size.x / 2 - bufferAroundPlaymat\n areaNearPlaymat.maxX = bounds.center.x + bounds.size.x / 2 + bufferAroundPlaymat\n areaNearPlaymat.minZ = bounds.center.z - bounds.size.z / 2 - bufferAroundPlaymat\n areaNearPlaymat.maxZ = bounds.center.z + bounds.size.z / 2 + bufferAroundPlaymat\n\n -- discard to closest mat if near it, use triggering playmat if not\n local discardForMatColor\n if inArea(pos, areaNearPlaymat) then\n return closestMatColor\n else\n return playmatApi.getMatColor(playerColor)\n end\nend\n\n-- moves the hovered card to the victory display\nfunction moveCardToVictoryDisplay(_, hoveredObject)\n victoryDisplayApi.placeCard(hoveredObject)\nend\n\n-- removes a use from a card (or a token if hovered)\nfunction removeOneUse(playerColor, hoveredObject)\n -- only continue if an unlocked card or tile was hovered\n if hoveredObject == nil\n or (hoveredObject.type ~= \"Card\" and hoveredObject.type ~= \"Tile\")\n or hoveredObject.locked then\n broadcastToColor(\"Hover a token/tile or a card and try again.\", playerColor, \"Yellow\")\n return\n end\n\n local targetObject = nil\n\n -- discard hovered token / tile\n if hoveredObject.type == \"Tile\" then\n targetObject = hoveredObject\n elseif hoveredObject.type == \"Card\" then\n -- grab the first use type from the metadata (or nil)\n local notes = JSON.decode(hoveredObject.getGMNotes()) or {}\n local usesData = notes.uses or {}\n local useInfo = usesData[1] or {}\n local searchForType = useInfo.type\n if searchForType then searchForType = searchForType:lower() end\n\n for _, v in ipairs(searchOnObj(hoveredObject)) do\n local obj = v.hit_object\n if obj.type == \"Tile\" and not obj.locked and obj.memo ~= \"resourceCounter\" then\n -- check for matching object, otherwise use the first hit\n if obj.memo == searchForType then\n targetObject = obj\n break\n elseif not targetObject then\n targetObject = obj\n end\n end\n end\n end\n\n -- error handling\n if not targetObject then\n broadcastToColor(\"No tokens found!\", playerColor, \"Yellow\")\n return\n end\n\n -- handling for stacked tokens\n if targetObject.getQuantity() \u003e 1 then\n targetObject = targetObject.takeObject()\n end\n\n -- feedback message\n local tokenName = targetObject.getName()\n if tokenName == \"\" then\n if targetObject.memo ~= \"\" then\n -- name handling for clue / doom\n if targetObject.memo == \"clueDoom\" then\n if targetObject.is_face_down then\n tokenName = \"Doom\"\n else\n tokenName = \"Clue\"\n end\n else\n tokenName = titleCase(targetObject.memo)\n end\n else\n tokenName = \"Unknown\"\n end\n end\n\n local playerName = Player[playerColor].steam_name\n broadcastToAll(playerName .. \" removed a token: \" .. tokenName, playerColor)\n\n local discardForMatColor = getColorToDiscardFor(hoveredObject, playerColor)\n playmatApi.discardListOfObjects(discardForMatColor, { targetObject })\nend\n\n-- takes a clue from a location, player needs to hover the clue directly or the location\nfunction takeClueFromLocation(playerColor, hoveredObject)\n local cardName, clue\n\n if hoveredObject == nil then\n broadcastToColor(\"Hover a clue or card with clues and try again.\", playerColor, \"Yellow\")\n return\n elseif hoveredObject.type == \"Card\" then\n cardName = hoveredObject.getName()\n\n for _, v in ipairs(searchOnObj(hoveredObject)) do\n local obj = v.hit_object\n if obj.memo == \"clueDoom\" and obj.is_face_down == false then\n clue = obj\n break\n end\n end\n\n if clue == nil then\n broadcastToColor(\"This card does not have any clues on it.\", playerColor, \"Yellow\")\n return\n end\n elseif hoveredObject.memo == \"clueDoom\" then\n if hoveredObject.is_face_down then\n broadcastToColor(\"This is a doom token and not a clue.\", playerColor, \"Yellow\")\n return\n end\n\n clue = hoveredObject\n\n local search = Physics.cast({\n direction = { 0, -1, 0 },\n max_distance = 0.1,\n type = 3,\n size = { 0.1, 0.1, 0.1 },\n origin = clue.getPosition()\n })\n \n for _, v in ipairs(search) do\n local obj = v.hit_object\n if obj.type == \"Card\" then\n cardName = obj.getName()\n break\n end\n end\n else\n broadcastToColor(\"Hover a clue or card with clues and try again.\", playerColor, \"Yellow\")\n return\n end\n\n local clickableClues = optionPanelApi.getOptions()[\"useClueClickers\"]\n local playerName = Player[playerColor].steam_name\n local matColor = playmatApi.getMatColor(playerColor)\n local pos = nil\n if clickableClues then\n pos = {x = 0.49, y = 2.66, z = 0.00}\n playmatApi.updateCounter(matColor, \"ClickableClueCounter\", _, 1)\n else\n pos = playmatApi.transformLocalPosition({x = -1.12, y = 0.05, z = 0.7}, matColor)\n end\n \n local rot = playmatApi.returnRotation(matColor)\n\n -- check if found clue is a stack or single token\n if clue.getQuantity() \u003e 1 then\n clue.takeObject({position = pos, rotation = rot})\n else\n clue.setPositionSmooth(pos)\n clue.setRotation(rot)\n end\n\n if cardName then\n broadcastToAll(playerName .. \" took one clue from \" .. cardName .. \".\", playerColor)\n else\n broadcastToAll(playerName .. \" took one clue.\", \"Green\")\n end\n\n victoryDisplayApi.update()\nend\n\n-- broadcasts the bless/curse status to the calling player\nfunction showBlessCurseStatus(playerColor)\n blessCurseManagerApi.broadcastStatus(playerColor)\nend\n\n-- adds Wendy's menu to the hovered card\nfunction addWendysMenu(playerColor, hoveredObject)\n blessCurseManagerApi.addWendysMenu(playerColor, hoveredObject)\nend\n\n-- searches on an object (by using its bounds)\n---@param obj Object Object to search on\nfunction searchOnObj(obj)\n return Physics.cast({\n direction = { 0, 1, 0 },\n max_distance = 0.5,\n type = 3,\n size = obj.getBounds().size,\n origin = obj.getPosition()\n })\nend\n\n-- Simple method to check if the given point is in a specified area\n---@param point Vector Point to check, only x and z values are relevant\n---@param bounds Table Defined area to see if the point is within\nfunction inArea(point, bounds)\n return (point.x \u003e bounds.minX\n and point.x \u003c bounds.maxX\n and point.z \u003e bounds.minZ\n and point.z \u003c bounds.maxZ)\nend\n\n-- capitalizes the first letter\nfunction titleCase(str)\n local first = str:sub(1, 1)\n local rest = str:sub(2)\n return first:upper() .. rest:lower()\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "go_game_piece_white", @@ -205694,6 +198589,68 @@ "Value": 0, "XmlUI": "" }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 0, + "g": 0, + "r": 0 + }, + "CustomImage": { + "CustomTile": { + "Stackable": false, + "Stretch": true, + "Thickness": 0.2, + "Type": 3 + }, + "ImageScalar": 1, + "ImageSecondaryURL": "", + "ImageURL": "http://cloud-3.steamusercontent.com/ugc/2172484009093238162/ACF3BBD93CB517B0BD0952E9BB78A2D35A62F377/", + "WidthScale": 0 + }, + "Description": "Press a numpad key to spawn the indicated token.", + "DragSelectable": true, + "GMNotes": "", + "GUID": "f8b3a7", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": true, + "LuaScript": "", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Custom_Tile", + "Nickname": "Token Spawning Reference", + "Snap": true, + "Sticky": true, + "Tags": [ + "CameraZoom_ignore", + "CleanUpHelper_ignore", + "displacement_excluded" + ], + "Tooltip": true, + "Transform": { + "posX": -48, + "posY": 1.48, + "posZ": 55, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 3, + "scaleY": 1, + "scaleZ": 3 + }, + "Value": 0, + "XmlUI": "" + }, { "AltLookAngle": { "x": 0, @@ -205737,7 +198694,7 @@ "Transform": { "posX": -19.5, "posY": 1.697, - "posZ": -84, + "posZ": -87, "rotX": 90, "rotY": 90, "rotZ": 0, @@ -205771,7 +198728,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/NavigationOverlayHandler\")\nend)\n__bundle_register(\"core/NavigationOverlayHandler\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\nfullButtonData = {\n { id = \"1\", width = \"84\", height = \"33\", offset = \"1 2\" }, -- 1. Act/Agenda\n { id = \"2\", width = \"78\", height = \"69\", offset = \"1 -62\" }, -- 2. Map\n { id = \"3\", width = \"70\", height = \"36\", offset = \"-38 -126\" }, -- 3. White\n { id = \"4\", width = \"70\", height = \"36\", offset = \"38 -126\" }, -- 4. Orange\n { id = \"5\", width = \"36\", height = \"70\", offset = \"-63 -66\" }, -- 5. Green\n { id = \"6\", width = \"36\", height = \"70\", offset = \"63 -66\" }, -- 6. Red\n { id = \"7\", width = \"38\", height = \"38\", offset = \"-65 -3\" }, -- 7. Victory\n { id = \"8\", width = \"40\", height = \"40\", offset = \"65 -3\" }, -- 8. Guide\n { id = \"9\", width = \"56\", height = \"16\", offset = \"1 -20\" }, -- 9. Player count\n { id = \"10\", width = \"36\", height = \"16\", offset = \"1 -102\" }, -- 10. Bless/Curse\n { id = \"11\", width = \"168\", height = \"56\", offset = \"1 47\" }, -- 11. Scenarios\n { id = \"12\", width = \"52\", height = \"53\", offset = \"-154 134\" }, -- 12. Player card panel\n { id = \"13\", width = \"22\", height = \"22\", offset = \"-116 132\" }, -- 13. Search card panel\n { id = \"14\", width = \"120\", height = \"75\", offset = \"-152 70\" }, -- 14. Player card display\n { id = \"15\", width = \"40\", height = \"54\", offset = \"-150 -38\" }, -- 15. Deck builder\n { id = \"16\", width = \"104\", height = \"84\", offset = \"-154 -114\" }, -- 16. Rules area\n { id = \"17\", width = \"100\", height = \"170\", offset = \"152 72\" }, -- 17. Cycle area\n { id = \"18\", width = \"56\", height = \"60\", offset = \"182 -124\" }, -- 18. Additions\n { id = \"19\", width = \"20\", height = \"20\", offset = \"0 150\" }, -- 19. Shrink\n { id = \"20\", width = \"20\", height = \"20\", offset = \"20 150\" }, -- 20. Close\n { id = \"21\", width = \"20\", height = \"20\", offset = \"-20 150\" } -- 21. Settings\n}\n\nplayButtonData = {\n { id = \"1\", width = \"80\", height = \"33\", offset = \"0 55\" },\n { id = \"2\", width = \"78\", height = \"70\", offset = \"0 -8\" },\n { id = \"3\", width = \"68\", height = \"32\", offset = \"-36 -71\" },\n { id = \"4\", width = \"68\", height = \"32\", offset = \"36 -71\" },\n { id = \"5\", width = \"35\", height = \"66\", offset = \"-65 -10\" },\n { id = \"6\", width = \"35\", height = \"66\", offset = \"65 -10\" },\n { id = \"7\", width = \"38\", height = \"38\", offset = \"-66 52\" },\n { id = \"8\", width = \"38\", height = \"38\", offset = \"66 52\" },\n { id = \"9\", width = \"50\", height = \"12\", offset = \"0 33\" },\n { id = \"10\", width = \"32\", height = \"12\", offset = \"0 -48\" },\n { id = \"19\", width = \"20\", height = \"20\", offset = \"0 80\" },\n { id = \"20\", width = \"20\", height = \"20\", offset = \"20 80\" },\n { id = \"21\", width = \"20\", height = \"20\", offset = \"-20 80\" }\n}\n\n-- To-Do: dynamically get positions by linking to objects\ncameraData = {\n { position = { -1.6, 1.55, 0 }, distance = 18 }, -- 1. Act/Agenda\n { position = { -28, 1.55, 0 }, distance = -1 }, -- 2. Map\n { position = { -31.6, 1.55, 26.4 }, distance = -1 }, -- 3. Green playmat\n { position = { -55, 1.55, 12.05 }, distance = -1 }, -- 4. White playmat\n { position = { -55, 1.55, -11.48 }, distance = -1 }, -- 5. Orange playmat\n { position = { -31.6, 1.55, -26.4 }, distance = -1 }, -- 6. Red playmat\n { position = { -3, 1.55, 30 }, distance = 16 }, -- 7. Victory / SetAside\n { position = { -3, 1.55, -26.76 }, distance = 16 }, -- 8. Guide\n { position = { -11.83, 1.55, 0 }, distance = 10 }, -- 9. Player count\n { position = { -48.35, 1.55, 0 }, distance = 10 }, -- 10. Bless/Curse\n { position = { 12.56, 1.55, 0 }, distance = 45 }, -- 11. Scenarios\n { position = { 57.8, 1.55, 71 }, distance = 22 }, -- 12. Player card panel\n { position = { 60.38, 1.55, 56 }, distance = 10 }, -- 13. Card search panel\n { position = { 27.48, 1.55, 71 }, distance = 35 }, -- 14. Player card area\n { position = { -19.48, 1.55, 71 }, distance = 22 }, -- 15. Deck builder\n { position = { -52.92, 1.55, 71 }, distance = 42 }, -- 16. Rules area\n { position = { 26, 1.55, -71 }, distance = 65 }, -- 17. Cycle area\n { position = { -59.08, 1.55, -83 }, distance = 27 } -- 18. Additions\n}\n\nlocal settingsOpenForColor\nlocal visibility = {}\nlocal claims = {}\nlocal pitch = {}\n\n---------------------------------------------------------\n-- save/load functionality\n---------------------------------------------------------\n\nfunction onSave()\n return JSON.encode({\n visibility = visibility,\n claims = claims,\n pitch = pitch\n })\nend\n\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n visibility = loadedData.visibility\n claims = loadedData.claims\n pitch = loadedData.pitch\n else\n local allColors = Player.getColors()\n\n for _, color in ipairs(allColors) do\n -- default state for claims\n claims[color] = {}\n\n -- default state for visibility\n visibility[color] = { full = false, play = false }\n end\n end\n\n createXmlButtons()\n updateVisibility()\nend\n\n---------------------------------------------------------\n-- visibility related functions\n---------------------------------------------------------\n\nfunction cycleVisibility(color)\n setVisibility(\"next\", color)\nend\n\nfunction copyVisibility(params)\n visibility[params.targetColor] = {\n full = visibility[params.startColor].full,\n play = visibility[params.startColor].play\n }\n updateVisibility()\nend\n\nfunction setVisibility(type, color)\n if type == \"next\" then\n if visibility[color].full then\n visibility[color] = { full = false, play = true }\n elseif visibility[color].play then\n visibility[color] = { full = false, play = false }\n else\n visibility[color] = { full = true, play = false }\n end\n elseif type == \"toggle\" then\n visibility[color] = {\n full = not visibility[color].full,\n play = not visibility[color].play\n }\n else\n visibility[color] = { full = false, play = false }\n end\n\n updateVisibility()\nend\n\n-- update XML visibility\nfunction updateVisibility()\n local colorString = { full = \"\", play = \"\" }\n\n for color, v in pairs(visibility) do\n if v.full then\n if colorString.full == \"\" then\n colorString.full = color\n else\n colorString.full = colorString.full .. '|' .. color\n end\n elseif v.play then\n if colorString.play == \"\" then\n colorString.play = color\n else\n colorString.play = colorString.play .. '|' .. color\n end\n end\n end\n\n -- update the visibility on the XML\n UI.setAttribute(\"navPanelFull\", \"visibility\", colorString.full)\n UI.setAttribute(\"navPanelPlay\", \"visibility\", colorString.play)\n UI.setAttribute(\"navPanelFull\", \"active\", colorString.full ~= \"\")\n UI.setAttribute(\"navPanelPlay\", \"active\", colorString.play ~= \"\")\nend\n\n---------------------------------------------------------\n-- XML button creation\n---------------------------------------------------------\n\nfunction createXmlButtons()\n local ui = UI.getXmlTable()\n ui = createXmlButtonHelper(ui, {\n data = fullButtonData,\n id = \"navPanelFull\",\n overlay = \"OverlayLarge\"\n })\n ui = createXmlButtonHelper(ui, {\n data = playButtonData,\n id = \"navPanelPlay\",\n overlay = \"OverlaySmall\"\n })\n UI.setXmlTable(ui)\nend\n\n-- XML button creation\nfunction createXmlButtonHelper(ui, params)\n local color\n local guid = self.getGUID()\n local xml = findTagWithId(ui, params.id)\n\n -- add basic image\n xml.children = { {\n tag = \"image\",\n attributes = {\n id = \"backgroundImage\",\n image = params.overlay\n }\n } }\n\n -- add all buttons\n for _, d in ipairs(params.data) do\n table.insert(xml.children, {\n tag = \"button\",\n attributes = {\n onClick = guid .. \"/buttonClicked\",\n id = d.id,\n height = d.height,\n width = d.width,\n offsetXY = d.offset,\n color = \"rgba(0,1,0,0)\"\n }\n })\n end\n return ui\nend\n\nfunction findTagWithId(ui, id)\n for _, obj in ipairs(ui) do\n if obj.attributes and obj.attributes.id and obj.attributes.id == id then return obj end\n if obj.children then\n local result = findTagWithId(obj.children, id)\n if result then return result end\n end\n end\n return nil\nend\n\n---------------------------------------------------------\n-- core functionality\n---------------------------------------------------------\n\n-- handles all button clicks\nfunction buttonClicked(player, _, id)\n local index = tonumber(id)\n\n if index == 19 then\n setVisibility(\"toggle\", player.color)\n elseif index == 20 then\n setVisibility(\"close\", player.color)\n elseif index == 21 then\n toggleSettings(player)\n else\n loadCamera(player, index)\n end\nend\n\n-- generates a table with rectangular bounds for provided objects\nfunction getDynamicViewBounds(objList)\n local count = 0\n local totalBounds = {\n minX = 0,\n maxX = -70,\n minZ = 60,\n maxZ = -60\n }\n\n for _, obj in pairs(objList) do\n -- handling for Physics.cast() results\n if not obj.type then obj = obj.hit_object end\n\n if not obj.hasTag(\"CameraZoom_ignore\") and not obj.hasTag(\"CampaignLog\") then\n count = count + 1\n local bounds = obj.getBounds()\n local x1 = bounds['center'][1] - bounds['size'][1] / 2\n local x2 = bounds['center'][1] + bounds['size'][1] / 2\n local z1 = bounds['center'][3] - bounds['size'][3] / 2\n local z2 = bounds['center'][3] + bounds['size'][3] / 2\n\n totalBounds.minX = math.min(x1, totalBounds.minX)\n totalBounds.maxX = math.max(x2, totalBounds.maxX)\n totalBounds.minZ = math.min(z1, totalBounds.minZ)\n totalBounds.maxZ = math.max(z2, totalBounds.maxZ)\n end\n end\n\n -- default values (mainly for play area if nothing is found)\n if count == 0 then\n totalBounds.minX = -10\n totalBounds.maxX = -50\n totalBounds.minZ = -20\n totalBounds.maxZ = 20\n end\n\n totalBounds.middleX = (totalBounds.maxX + totalBounds.minX) / 2\n totalBounds.middleZ = (totalBounds.maxZ + totalBounds.minZ) / 2\n totalBounds.diffX = totalBounds.maxX - totalBounds.minX\n totalBounds.diffZ = totalBounds.maxZ - totalBounds.minZ\n\n return totalBounds\nend\n\n-- loads the specified camera for a player\nfunction loadCamera(player, index)\n local lookHere\n\n -- dynamic view of the play area\n if index == 2 then\n -- search the scripting zone on the play area for objects\n local bounds = getDynamicViewBounds(getObjectFromGUID(\"a2f932\").getObjects())\n\n lookHere = {\n position = { bounds.middleX, 1.55, bounds.middleZ },\n yaw = 90,\n distance = 0.8 * math.max(bounds.diffX, bounds.diffZ) + 7\n }\n -- dynamic view of the clicked play mat\n elseif index \u003e= 3 and index \u003c= 6 then\n local matColorList = { \"White\", \"Orange\", \"Green\", \"Red\" }\n local matColor = matColorList[index - 2] -- mat index 1 - 4\n\n -- check if anyone (except for yourself) has claimed this color\n local isClaimed = false\n\n for playerColor, playerTable in pairs(claims) do\n if playerColor ~= player.color and playerTable[matColor] then\n isClaimed = true\n break\n end\n end\n\n -- swap to that color if it isn't claimed by someone else\n if #getSeatedPlayers() == 1 or not isClaimed then\n local newPlayerColor = playmatApi.getPlayerColor(matColor)\n copyVisibility({ startColor = player.color, targetColor = newPlayerColor })\n player.changeColor(newPlayerColor)\n end\n\n -- search on the playmat for objects\n local bounds = getDynamicViewBounds(playmatApi.searchPlaymat(matColor))\n\n lookHere = {\n position = { bounds.middleX, 0, bounds.middleZ },\n yaw = playmatApi.returnRotation(matColor).y + 180,\n distance = 0.42 * math.max(bounds.diffX, bounds.diffZ) + 7\n }\n end\n\n -- get default data if no dynamic view (play area or play mat) was loaded\n if not lookHere then\n lookHere = cameraData[index]\n lookHere.yaw = 90\n end\n\n -- set pitch to default if not edited\n lookHere.pitch = pitch[player.color] or 75\n\n -- delay is to account for colorswap\n Wait.frames(function() player.lookAt(lookHere) end, 2)\nend\n\n---------------------------------------------------------\n-- settings related functionality\n---------------------------------------------------------\n\n-- claims a color for a player\nfunction claimColor(player, color)\n local currentState = claims[player.color][color]\n claims[player.color][color] = not currentState\nend\n\nfunction loadDefaultSettings(player)\n -- reset claims for that player\n for _, color in ipairs(Player.getColors()) do\n claims[player.color][color] = (player.color == color)\n end\n\n -- reset pitch for that player\n pitch[player.color] = nil\n\n -- update the UI accordingly\n updateSettingsUI(player)\nend\n\n-- called by clicking a toggle\nfunction toggleSettings(player)\n if settingsOpenForColor == player.color then\n settingsOpenForColor = nil\n UI.setAttribute(\"navPanelSettings\", \"active\", false)\n elseif settingsOpenForColor then\n broadcastToColor(\"Someone else is currently using the settings. Please wait and try again.\", player.color, \"Yellow\")\n else\n settingsOpenForColor = player.color\n\n updateSettingsUI(player)\n UI.setAttribute(\"navPanelSettings\", \"visibility\", player.color)\n UI.setAttribute(\"navPanelSettings\", \"active\", true)\n end\nend\n\n-- called by the slider\nfunction updatePitch(player, number)\n pitch[player.color] = number\nend\n\n-- updates the settings UI for the provided player\nfunction updateSettingsUI(player)\n -- update the slider\n UI.setAttribute(\"sliderPitch\", \"value\", pitch[player.color] or 75)\n \n -- update the claims\n local matColorList = { \"White\", \"Orange\", \"Green\", \"Red\" }\n for _, matColor in pairs(matColorList) do\n UI.setAttribute(\"claim\" .. matColor, \"isOn\", claims[player.color][matColor] or false)\n end\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = { }\n local internal = { }\n\n local MAT_IDS = {\n White = \"8b081b\",\n Orange = \"bd0ff4\",\n Green = \"383d8b\",\n Red = \"0840d5\"\n }\n\n local CLUE_COUNTER_GUIDS = {\n White = \"37be78\",\n Orange = \"1769ed\",\n Green = \"032300\",\n Red = \"d86b7c\"\n }\n\n local CLUE_CLICKER_GUIDS = {\n White = \"db85d6\",\n Orange = \"3f22e5\",\n Green = \"891403\",\n Red = \"4111de\"\n }\n\n -- Returns the color of the by position requested playermat as string\n ---@param startPos Table Position of the search, table get's roughly cut into 4 quarters to assign a playermat\n PlaymatApi.getMatColorByPosition = function(startPos)\n if startPos.x \u003c -42 then\n if startPos.z \u003e 0 then\n return \"White\"\n else\n return \"Orange\"\n end\n else\n if startPos.z \u003e 0 then\n return \"Green\"\n else\n return \"Red\"\n end\n end\n end\n\n -- Returns the color of the player's hand that is seated next to the playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.getPlayerColor = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"playerColor\")\n end\n\n -- Returns the color of the playermat that owns the playercolor's hand\n ---@param handColor String Color of the playermat\n PlaymatApi.getMatColor = function(handColor)\n local matColors = {\"White\", \"Orange\", \"Green\", \"Red\"}\n for i, mat in ipairs(internal.getMatForColor(\"All\")) do\n local color = mat.getVar(\"playerColor\")\n if color == handColor then return matColors[i] end\n end\n return \"NOT_FOUND\"\n end\n\n -- Returns the result of a cast in the specificed playermat's area\n ---@param matColor String Color of the playermat\n PlaymatApi.searchPlaymat = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"searchAroundSelf\")\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playermat\n ---@param matColor String Color of the playermat\n PlaymatApi.isDES = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"isDES\")\n end\n\n -- Returns the draw deck of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDrawDeck = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n mat.call(\"getDrawDiscardDecks\")\n return mat.getVar(\"drawDeck\")\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.getDiscardPosition = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playermat\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.positionToWorld(localPos)\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playermat\n PlaymatApi.returnRotation = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getRotation()\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playermat\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playermat\n PlaymatApi.returnInvestigatorId = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.getVar(\"activeInvestigatorId\")\n end\n\n -- Sets the requested playermat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card\n -- types.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playermat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean. Whether the draw 1 button should be visible or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playermat\n ---@param showCounter Boolean. Whether the clickable counter should be present or not\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playermat\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will apply the setting to all four mats.\n PlaymatApi.removeClues = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playermat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n count = count + tonumber(mat.call(\"getClueCount\", useClickableCounters))\n end\n return count\n end\n\n -- Adds the specified amount of resources to the requested playermat's resource counter\n PlaymatApi.gainResources = function(amount, matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"gainResources\", amount)\n end\n end\n\n -- Returns the resource counter amount for the requested playermat\n PlaymatApi.getResourceCount = function(matColor)\n local mat = getObjectFromGUID(MAT_IDS[matColor])\n return mat.call(\"getResourceCount\")\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in ipairs(internal.getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in ipairs(internal.getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n PlaymatApi.updateClueClicker = function(playerColor, val)\n return getObjectFromGUID(CLUE_CLICKER_GUIDS[playerColor]).call(\"updateVal\", val)\n end\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also\n -- accepts \"All\" as a special value which will return all four mats.\n ---@return: Array of playermat objects. If a single mat is requested, will return a single-element\n -- array to simplify processing by consumers.\n internal.getMatForColor = function(matColor)\n local targetMatGuid = MAT_IDS[matColor]\n if targetMatGuid != nil then\n return { getObjectFromGUID(targetMatGuid) }\n end\n if matColor == \"All\" then\n return {\n getObjectFromGUID(MAT_IDS.White),\n getObjectFromGUID(MAT_IDS.Orange),\n getObjectFromGUID(MAT_IDS.Green),\n getObjectFromGUID(MAT_IDS.Red),\n }\n end\n end\n\n return PlaymatApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/NavigationOverlayHandler\")\nend)\n__bundle_register(\"core/NavigationOverlayHandler\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\nfullButtonData = {\n { id = \"1\", width = \"84\", height = \"33\", offset = \"1 2\" }, -- 1. Act/Agenda\n { id = \"2\", width = \"78\", height = \"69\", offset = \"1 -62\" }, -- 2. Map\n { id = \"3\", width = \"70\", height = \"36\", offset = \"-38 -126\" }, -- 3. White\n { id = \"4\", width = \"70\", height = \"36\", offset = \"38 -126\" }, -- 4. Orange\n { id = \"5\", width = \"36\", height = \"70\", offset = \"-63 -66\" }, -- 5. Green\n { id = \"6\", width = \"36\", height = \"70\", offset = \"63 -66\" }, -- 6. Red\n { id = \"7\", width = \"38\", height = \"38\", offset = \"-65 -3\" }, -- 7. Victory\n { id = \"8\", width = \"40\", height = \"40\", offset = \"65 -3\" }, -- 8. Guide\n { id = \"9\", width = \"56\", height = \"16\", offset = \"1 -20\" }, -- 9. Player count\n { id = \"10\", width = \"36\", height = \"16\", offset = \"1 -102\" }, -- 10. Bless/Curse\n { id = \"11\", width = \"168\", height = \"56\", offset = \"1 47\" }, -- 11. Scenarios\n { id = \"12\", width = \"52\", height = \"53\", offset = \"-154 134\" }, -- 12. Player card panel\n { id = \"13\", width = \"22\", height = \"22\", offset = \"-116 132\" }, -- 13. Search card panel\n { id = \"14\", width = \"120\", height = \"75\", offset = \"-152 70\" }, -- 14. Player card display\n { id = \"15\", width = \"40\", height = \"54\", offset = \"-150 -38\" }, -- 15. Deck builder\n { id = \"16\", width = \"104\", height = \"84\", offset = \"-154 -114\" }, -- 16. Rules area\n { id = \"17\", width = \"100\", height = \"170\", offset = \"152 72\" }, -- 17. Cycle area\n { id = \"18\", width = \"56\", height = \"60\", offset = \"182 -124\" }, -- 18. Additions\n { id = \"19\", width = \"20\", height = \"20\", offset = \"0 150\" }, -- 19. Shrink\n { id = \"20\", width = \"20\", height = \"20\", offset = \"20 150\" }, -- 20. Close\n { id = \"21\", width = \"20\", height = \"20\", offset = \"-20 150\" } -- 21. Settings\n}\n\nplayButtonData = {\n { id = \"1\", width = \"80\", height = \"33\", offset = \"0 55\" },\n { id = \"2\", width = \"78\", height = \"70\", offset = \"0 -8\" },\n { id = \"3\", width = \"68\", height = \"32\", offset = \"-36 -71\" },\n { id = \"4\", width = \"68\", height = \"32\", offset = \"36 -71\" },\n { id = \"5\", width = \"35\", height = \"66\", offset = \"-65 -10\" },\n { id = \"6\", width = \"35\", height = \"66\", offset = \"65 -10\" },\n { id = \"7\", width = \"38\", height = \"38\", offset = \"-66 52\" },\n { id = \"8\", width = \"38\", height = \"38\", offset = \"66 52\" },\n { id = \"9\", width = \"50\", height = \"12\", offset = \"0 33\" },\n { id = \"10\", width = \"32\", height = \"12\", offset = \"0 -48\" },\n { id = \"19\", width = \"20\", height = \"20\", offset = \"0 80\" },\n { id = \"20\", width = \"20\", height = \"20\", offset = \"20 80\" },\n { id = \"21\", width = \"20\", height = \"20\", offset = \"-20 80\" }\n}\n\n-- To-Do: dynamically get positions by linking to objects\ncameraData = {\n { position = { -1.6, 1.55, 0 }, distance = 18 }, -- 1. Act/Agenda\n { position = { -28, 1.55, 0 }, distance = -1 }, -- 2. Map\n { position = { -31.6, 1.55, 26.4 }, distance = -1 }, -- 3. Green playmat\n { position = { -55, 1.55, 12.05 }, distance = -1 }, -- 4. White playmat\n { position = { -55, 1.55, -11.48 }, distance = -1 }, -- 5. Orange playmat\n { position = { -31.6, 1.55, -26.4 }, distance = -1 }, -- 6. Red playmat\n { position = { -3, 1.55, 30 }, distance = 16 }, -- 7. Victory / SetAside\n { position = { -3, 1.55, -26.76 }, distance = 16 }, -- 8. Guide\n { position = { -11.83, 1.55, 0 }, distance = 10 }, -- 9. Player count\n { position = { -48.35, 1.55, 0 }, distance = 10 }, -- 10. Bless/Curse\n { position = { 12.56, 1.55, 0 }, distance = 45 }, -- 11. Scenarios\n { position = { 57.8, 1.55, 71 }, distance = 22 }, -- 12. Player card panel\n { position = { 60.38, 1.55, 56 }, distance = 10 }, -- 13. Card search panel\n { position = { 27.48, 1.55, 71 }, distance = 35 }, -- 14. Player card area\n { position = { -19.48, 1.55, 71 }, distance = 22 }, -- 15. Deck builder\n { position = { -52.92, 1.55, 71 }, distance = 42 }, -- 16. Rules area\n { position = { 26, 1.55, -71 }, distance = 65 }, -- 17. Cycle area\n { position = { -59.08, 1.55, -83 }, distance = 27 } -- 18. Additions\n}\n\nlocal settingsOpenForColor\nlocal visibility = {}\nlocal claims = {}\nlocal pitch = {}\n\n---------------------------------------------------------\n-- save/load functionality\n---------------------------------------------------------\n\nfunction onSave()\n return JSON.encode({\n visibility = visibility,\n claims = claims,\n pitch = pitch\n })\nend\n\nfunction onLoad(savedData)\n if savedData ~= \"\" then\n local loadedData = JSON.decode(savedData)\n visibility = loadedData.visibility\n claims = loadedData.claims\n pitch = loadedData.pitch\n else\n local allColors = Player.getColors()\n\n for _, color in ipairs(allColors) do\n -- default state for claims\n claims[color] = {}\n\n -- default state for visibility\n visibility[color] = { full = false, play = false }\n end\n end\n\n createXmlButtons()\n updateVisibility()\nend\n\n---------------------------------------------------------\n-- visibility related functions\n---------------------------------------------------------\n\nfunction cycleVisibility(color)\n setVisibility(\"next\", color)\nend\n\nfunction copyVisibility(params)\n visibility[params.targetColor] = {\n full = visibility[params.startColor].full,\n play = visibility[params.startColor].play\n }\n updateVisibility()\nend\n\nfunction setVisibility(type, color)\n if type == \"next\" then\n if visibility[color].full then\n visibility[color] = { full = false, play = true }\n elseif visibility[color].play then\n visibility[color] = { full = false, play = false }\n else\n visibility[color] = { full = true, play = false }\n end\n elseif type == \"toggle\" then\n visibility[color] = {\n full = not visibility[color].full,\n play = not visibility[color].play\n }\n else\n visibility[color] = { full = false, play = false }\n end\n\n updateVisibility()\nend\n\n-- update XML visibility\nfunction updateVisibility()\n local colorString = { full = \"\", play = \"\" }\n\n for color, v in pairs(visibility) do\n if v.full then\n if colorString.full == \"\" then\n colorString.full = color\n else\n colorString.full = colorString.full .. '|' .. color\n end\n elseif v.play then\n if colorString.play == \"\" then\n colorString.play = color\n else\n colorString.play = colorString.play .. '|' .. color\n end\n end\n end\n\n -- update the visibility on the XML\n UI.setAttribute(\"navPanelFull\", \"visibility\", colorString.full)\n UI.setAttribute(\"navPanelPlay\", \"visibility\", colorString.play)\n UI.setAttribute(\"navPanelFull\", \"active\", colorString.full ~= \"\")\n UI.setAttribute(\"navPanelPlay\", \"active\", colorString.play ~= \"\")\nend\n\n---------------------------------------------------------\n-- XML button creation\n---------------------------------------------------------\n\nfunction createXmlButtons()\n local ui = UI.getXmlTable()\n ui = createXmlButtonHelper(ui, {\n data = fullButtonData,\n id = \"navPanelFull\",\n overlay = \"OverlayLarge\"\n })\n ui = createXmlButtonHelper(ui, {\n data = playButtonData,\n id = \"navPanelPlay\",\n overlay = \"OverlaySmall\"\n })\n UI.setXmlTable(ui)\nend\n\n-- XML button creation\nfunction createXmlButtonHelper(ui, params)\n local color\n local guid = self.getGUID()\n local xml = findTagWithId(ui, params.id)\n\n -- add basic image\n xml.children = { {\n tag = \"image\",\n attributes = {\n id = \"backgroundImage\",\n image = params.overlay\n }\n } }\n\n -- add all buttons\n for _, d in ipairs(params.data) do\n table.insert(xml.children, {\n tag = \"button\",\n attributes = {\n onClick = guid .. \"/buttonClicked\",\n id = d.id,\n height = d.height,\n width = d.width,\n offsetXY = d.offset,\n color = \"rgba(0,1,0,0)\"\n }\n })\n end\n return ui\nend\n\nfunction findTagWithId(ui, id)\n for _, obj in ipairs(ui) do\n if obj.attributes and obj.attributes.id and obj.attributes.id == id then return obj end\n if obj.children then\n local result = findTagWithId(obj.children, id)\n if result then return result end\n end\n end\n return nil\nend\n\n---------------------------------------------------------\n-- core functionality\n---------------------------------------------------------\n\n-- handles all button clicks\nfunction buttonClicked(player, _, id)\n local index = tonumber(id)\n\n if index == 19 then\n setVisibility(\"toggle\", player.color)\n elseif index == 20 then\n setVisibility(\"close\", player.color)\n elseif index == 21 then\n toggleSettings(player)\n else\n loadCamera(player, index)\n end\nend\n\n-- generates a table with rectangular bounds for provided objects\nfunction getDynamicViewBounds(objList)\n local count = 0\n local totalBounds = {\n minX = 0,\n maxX = -70,\n minZ = 60,\n maxZ = -60\n }\n\n for _, obj in pairs(objList) do\n -- handling for Physics.cast() results\n if not obj.type then obj = obj.hit_object end\n\n if not obj.hasTag(\"CameraZoom_ignore\") and not obj.hasTag(\"CampaignLog\") then\n count = count + 1\n local bounds = obj.getBounds()\n local x1 = bounds['center'][1] - bounds['size'][1] / 2\n local x2 = bounds['center'][1] + bounds['size'][1] / 2\n local z1 = bounds['center'][3] - bounds['size'][3] / 2\n local z2 = bounds['center'][3] + bounds['size'][3] / 2\n\n totalBounds.minX = math.min(x1, totalBounds.minX)\n totalBounds.maxX = math.max(x2, totalBounds.maxX)\n totalBounds.minZ = math.min(z1, totalBounds.minZ)\n totalBounds.maxZ = math.max(z2, totalBounds.maxZ)\n end\n end\n\n -- default values (mainly for play area if nothing is found)\n if count == 0 then\n totalBounds.minX = -10\n totalBounds.maxX = -50\n totalBounds.minZ = -20\n totalBounds.maxZ = 20\n end\n\n totalBounds.middleX = (totalBounds.maxX + totalBounds.minX) / 2\n totalBounds.middleZ = (totalBounds.maxZ + totalBounds.minZ) / 2\n totalBounds.diffX = totalBounds.maxX - totalBounds.minX\n totalBounds.diffZ = totalBounds.maxZ - totalBounds.minZ\n\n return totalBounds\nend\n\n-- loads the specified camera for a player\nfunction loadCamera(player, index)\n local lookHere\n\n -- dynamic view of the play area\n if index == 2 then\n -- search the scripting zone on the play area for objects\n local bounds = getDynamicViewBounds(getObjectFromGUID(\"a2f932\").getObjects())\n\n lookHere = {\n position = { bounds.middleX, 1.55, bounds.middleZ },\n yaw = 90,\n distance = 0.8 * math.max(bounds.diffX, bounds.diffZ) + 7\n }\n -- dynamic view of the clicked play mat\n elseif index \u003e= 3 and index \u003c= 6 then\n local matColorList = { \"White\", \"Orange\", \"Green\", \"Red\" }\n local matColor = matColorList[index - 2] -- mat index 1 - 4\n\n -- check if anyone (except for yourself) has claimed this color\n local isClaimed = false\n\n for playerColor, playerTable in pairs(claims) do\n if playerColor ~= player.color and playerTable[matColor] then\n isClaimed = true\n break\n end\n end\n\n -- swap to that color if it isn't claimed by someone else\n if #getSeatedPlayers() == 1 or not isClaimed then\n local newPlayerColor = playmatApi.getPlayerColor(matColor)\n copyVisibility({ startColor = player.color, targetColor = newPlayerColor })\n player.changeColor(newPlayerColor)\n end\n\n -- search on the playmat for objects\n local bounds = getDynamicViewBounds(playmatApi.searchAroundPlaymat(matColor))\n\n lookHere = {\n position = { bounds.middleX, 0, bounds.middleZ },\n yaw = playmatApi.returnRotation(matColor).y + 180,\n distance = 0.42 * math.max(bounds.diffX, bounds.diffZ) + 7\n }\n end\n\n -- get default data if no dynamic view (play area or play mat) was loaded\n if not lookHere then\n lookHere = cameraData[index]\n lookHere.yaw = 90\n end\n\n -- set pitch to default if not edited\n lookHere.pitch = pitch[player.color] or 75\n\n -- delay is to account for colorswap\n Wait.frames(function() player.lookAt(lookHere) end, 2)\nend\n\n---------------------------------------------------------\n-- settings related functionality\n---------------------------------------------------------\n\n-- claims a color for a player\nfunction claimColor(player, color)\n local currentState = claims[player.color][color]\n claims[player.color][color] = not currentState\nend\n\nfunction loadDefaultSettings(player)\n -- reset claims for that player\n for _, color in ipairs(Player.getColors()) do\n claims[player.color][color] = (player.color == color)\n end\n\n -- reset pitch for that player\n pitch[player.color] = nil\n\n -- update the UI accordingly\n updateSettingsUI(player)\nend\n\n-- called by clicking a toggle\nfunction toggleSettings(player)\n if settingsOpenForColor == player.color then\n settingsOpenForColor = nil\n UI.setAttribute(\"navPanelSettings\", \"active\", false)\n elseif settingsOpenForColor then\n broadcastToColor(\"Someone else is currently using the settings. Please wait and try again.\", player.color, \"Yellow\")\n else\n settingsOpenForColor = player.color\n\n updateSettingsUI(player)\n UI.setAttribute(\"navPanelSettings\", \"visibility\", player.color)\n UI.setAttribute(\"navPanelSettings\", \"active\", true)\n end\nend\n\n-- called by the slider\nfunction updatePitch(player, number)\n pitch[player.color] = number\nend\n\n-- updates the settings UI for the provided player\nfunction updateSettingsUI(player)\n -- update the slider\n UI.setAttribute(\"sliderPitch\", \"value\", pitch[player.color] or 75)\n \n -- update the claims\n local matColorList = { \"White\", \"Orange\", \"Green\", \"Red\" }\n for _, matColor in pairs(matColorList) do\n UI.setAttribute(\"claim\" .. matColor, \"isOn\", claims[player.color][matColor] or false)\n end\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "{\"claims\":{\"Black\":[],\"Blue\":[],\"Brown\":[],\"Green\":[],\"Grey\":[],\"Orange\":[],\"Pink\":[],\"Purple\":[],\"Red\":[],\"Teal\":[],\"White\":[],\"Yellow\":[]},\"pitch\":[],\"visibility\":{\"Black\":{\"full\":false,\"play\":false},\"Blue\":{\"full\":false,\"play\":false},\"Brown\":{\"full\":false,\"play\":false},\"Green\":{\"full\":false,\"play\":false},\"Grey\":{\"full\":false,\"play\":false},\"Orange\":{\"full\":false,\"play\":false},\"Pink\":{\"full\":false,\"play\":false},\"Purple\":{\"full\":false,\"play\":false},\"Red\":{\"full\":false,\"play\":false},\"Teal\":{\"full\":false,\"play\":false},\"White\":{\"full\":false,\"play\":false},\"Yellow\":{\"full\":false,\"play\":false}}}", "MeasureMovement": false, "Name": "go_game_piece_black", @@ -205828,7 +198785,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"arkhamdb/DeckImporterApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local DeckImporterApi = {}\n local DECK_IMPORTER_GUID = \"a28140\"\n \n -- Returns a table with the full state of the UI, including options and deck IDs.\n -- This can be used to persist via onSave(), or provide values for a load operation\n -- Table values:\n -- redDeck: Deck ID to load for the red player\n -- orangeDeck: Deck ID to load for the orange player\n -- whiteDeck: Deck ID to load for the white player\n -- greenDeck: Deck ID to load for the green player\n -- private: True to load a private deck, false to load a public deck\n -- loadNewest: True if the most upgraded version of the deck should be loaded\n -- investigators: True if investigator cards should be spawned\n DeckImporterApi.getUiState = function()\n local passthroughTable = {}\n for k,v in pairs(getObjectFromGUID(DECK_IMPORTER_GUID).call(\"getUiState\")) do\n passthroughTable[k] = v\n end\n return passthroughTable\n end\n\n -- Updates the state of the UI based on the provided table. Any values not provided will be left the same.\n ---@param uiStateTable Table of values to update on importer\n -- Table values:\n -- redDeck: Deck ID to load for the red player\n -- orangeDeck: Deck ID to load for the orange player\n -- whiteDeck: Deck ID to load for the white player\n -- greenDeck: Deck ID to load for the green player\n -- private: True to load a private deck, false to load a public deck\n -- loadNewest: True if the most upgraded version of the deck should be loaded\n -- investigators: True if investigator cards should be spawned\n DeckImporterApi.setUiState = function(uiStateTable)\n return getObjectFromGUID(DECK_IMPORTER_GUID).call(\"setUiState\", uiStateTable)\n end\n\n return DeckImporterApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local MANAGER_GUID = \"5933fb\"\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getObjectFromGUID(MANAGER_GUID)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getObjectFromGUID(MANAGER_GUID).call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getObjectFromGUID(MANAGER_GUID).call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getObjectFromGUID(MANAGER_GUID).call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/OptionPanelApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local OptionPanelApi = {}\n\n -- loads saved options\n ---@param options Table New options table\n OptionPanelApi.loadSettings = function(options)\n return Global.call(\"loadSettings\", options)\n end\n\n -- returns option panel table\n OptionPanelApi.getOptions = function()\n return Global.getTable(\"optionPanel\")\n end\n\n return OptionPanelApi\nend\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = { }\n local PLAY_AREA_GUID = \"721ba2\"\n local INVESTIGATOR_COUNTER_GUID = \"f182ee\"\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n return getObjectFromGUID(INVESTIGATOR_COUNTER_GUID).call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with\n -- 'displacement_excluded'\n ---@param playerColor Color of the player requesting the shift. Used solely to send an error\n --- message in the unlikely case that the scripting zone has been deleted\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"tryObjectEnterContainer\",\n { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"highlightCountedVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getObjectFromGUID(PLAY_AREA_GUID).call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getObjectFromGUID(PLAY_AREA_GUID).call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getObjectFromGUID(PLAY_AREA_GUID).getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"accessories/CampaignImporterExporter\")\nend)\n__bundle_register(\"accessories/CampaignImporterExporter\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal blessCurseApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal deckImporterApi = require(\"arkhamdb/DeckImporterApi\")\nlocal optionPanelApi = require(\"core/OptionPanelApi\")\nlocal playAreaApi = require(\"core/PlayAreaApi\")\n\nlocal campaignTokenData = {\n GUID = \"51b1c9\",\n Name = \"Custom_Model\",\n Transform = {\n posX = -21.25,\n posY = 1.68,\n posZ = 55.59,\n rotX = 0,\n rotY = 270,\n rotZ = 0,\n scaleX = 2,\n scaleY = 2,\n scaleZ = 2\n },\n Nickname = \"Arkham Coin\",\n Description = \"SCED Importer Token\",\n GMNotes = \"\",\n Tags = {\n \"ImporterToken\"\n },\n CustomMesh = {\n MeshURL = \"http://cloud-3.steamusercontent.com/ugc/943949966265929204/A38BB5D72419E6298385556D931877C0A1A55C17/\",\n DiffuseURL = \"http://cloud-3.steamusercontent.com/ugc/254843371583188147/920981125E37B5CEB6C400E3FD353A2C428DA969/\",\n NormalURL = \"\",\n ColliderURL = \"http://cloud-3.steamusercontent.com/ugc/943949966265929204/A38BB5D72419E6298385556D931877C0A1A55C17/\",\n Convex = true,\n MaterialIndex = 2,\n TypeIndex = 0,\n CustomShader = {\n SpecularColor = {\n r = 0.7222887,\n g = 0.507659256,\n b = 0.339915335\n },\n SpecularIntensity = 0.4,\n SpecularSharpness = 7.0,\n FresnelStrength = 0.0\n },\n CastShadows = true\n }\n}\n\n-- counter GUIDS (4x damage and 4x horror)\nlocal DAMAGE_HORROR_GUIDS = {\n \"eb08d6\"; \"e64eec\"; \"1f5a0a\"; \"591a45\";\n \"468e88\"; \"0257d9\"; \"7b5729\"; \"beb964\";\n }\n\nlocal TOUR_GUID = \"0e5aa8\"\nlocal campaignBoxGUID\n\nfunction onLoad(save_state)\n campaignBoxGUID = \"\"\n\n self.createButton({\n click_function = \"findCampaignFromToken\",\n function_owner = self,\n label = \"Import\",\n tooltip = \"Load in a campaign save from a token!\\n\\n(Token can be anywhere on the table, but ensure there is only 1!)\", \n position = {x=-1, y=0.2, z=0},\n font_size = 400,\n width = 1400,\n height = 600,\n scale = {0.5, 1, 0.5},\n })\n self.createButton({\n click_function = \"createCampaignToken\",\n function_owner = self,\n label = \"Export\",\n tooltip = \"Create a campaign save token!\\n\\n(Ensure all chaos tokens have been unsealed!)\",\n position = {x=1, y=0.2, z=0},\n font_size = 400,\n width = 1400,\n height = 600,\n scale = {0.5, 1, 0.5},\n })\nend\n\n-- The main import functions. Due to timing concerns, has to be split up into several separate methods to allow for Wait conditions\n\n-- Identifies import token, determines campaign box and downloads it (if needed)\nfunction findCampaignFromToken(_, _, _)\n local coin = nil\n local coinObjects = getObjectsWithTag(\"ImporterToken\")\n if #coinObjects == 0 then\n broadcastToAll(\"Could not find importer token\", Color.Red)\n elseif #coinObjects \u003e 1 then\n broadcastToAll(\"More than 1 importer token found. Please delete all but 1 importer token\", Color.Yellow) \n else\n coin = coinObjects[1]\n local importData = JSON.decode(coin.getGMNotes())\n campaignBoxGUID = importData[\"box\"]\n local campaignBox = getObjectFromGUID(campaignBoxGUID)\n if campaignBox.type == \"Generic\" then\n campaignBox.call(\"buttonClick_download\")\n end\n Wait.condition(\n function()\n if #campaignBox.getObjects() \u003e 0 then\n placeCampaignFromToken(importData)\n else\n createCampaignFromToken(importData)\n end\n end,\n function()\n local obj = getObjectFromGUID(campaignBoxGUID)\n if obj == nil then \n return false \n else\n return obj.type == \"Bag\" and obj.getLuaScript() ~= \"\"\n end\n end,\n 2,\n function() broadcastToAll(\"Error loading campaign box\") end\n ) \n end\nend\n\n-- After box has been downloaded, places content on table\nfunction placeCampaignFromToken(importData)\n getObjectFromGUID(campaignBoxGUID).call(\"buttonClick_place\")\n Wait.condition(\n function() createCampaignFromToken(importData) end,\n function() return findCampaignLog() ~= nil end,\n 2,\n function() broadcastToAll(\"Error placing campaign box\") end\n )\nend\n\n-- After content is placed on table, conducts all the other import operations\nfunction createCampaignFromToken(importData)\n findCampaignLog().destruct()\n --create campaign log\n spawnObjectData({data = importData[\"log\"]}) \n --create chaos bag\n chaosBagApi.setChaosBagState(importData[\"bag\"])\n --populate trauma values\n if importData[\"trauma\"] then\n updateCounters(importData[\"trauma\"])\n end\n --populate ArkhamDB deck IDs\n if importData[\"decks\"] then\n deckImporterApi.setUiState(importData[\"decks\"])\n end\n --set investigator count\n playAreaApi.setInvestigatorCount(importData[\"clueCount\"])\n --set campaign guide page\n local guide = findCampaignGuide()\n if guide then\n Wait.condition(\n -- Called after the condition function returns true\n function()\n log(\"Campaign Guide import successful!\")\n end,\n -- Condition function that is called continiously until returs true or timeout is reached \n function()\n guide.Book.setPage(importData[\"guide\"])\n return guide.Book.getPage() == importData[\"guide\"]\n end,\n -- Amount of time in seconds until the Wait times out\n 1,\n -- Called if the Wait times out\n function()\n log(\"Campaign Guide import failed!\")\n end\n )\n end\n Wait.time(\n function() optionPanelApi.loadSettings(importData[\"options\"]) end,\n 0.5\n )\n getObjectFromGUID(TOUR_GUID).destruct()\n playAreaApi.updateSurface(importData[\"playmat\"])\n broadcastToAll(\"Campaign successfully imported!\", Color.Green)\nend\n\n\n-- Creates a campaign token with save data encoded into GM Notes based on the current state of the table\nfunction createCampaignToken(_, playerColor, _)\n -- clean up chaos tokens\n blessCurseApi.removeAll(playerColor)\n chaosBagApi.releaseAllSealedTokens(playerColor)\n\n local campaignBoxGUID = \"\"\n -- find active campaign\n for _, obj in ipairs(getObjectsWithTag(\"CampaignBox\")) do\n if obj.type == \"Bag\" and #obj.getObjects() == 0 then\n if campaignBoxGUID ~= \"\" then\n broadcastToAll(\"Multiple empty campaign box detected; delete all but one.\", Color.Red)\n return\n end\n campaignBoxGUID = obj.getGUID()\n end\n end\n if campaignBoxGUID == \"\" then\n broadcastToAll(\"Campaign box with all placed objects not found!\", Color.Red)\n return\n end\n local campaignLog = findCampaignLog()\n if campaignLog == nil then\n broadcastToAll(\"Campaign log not found!\", Color.Red)\n return\n end\n local traumaValues = nil\n local counterData = campaignLog.getVar(\"ref_buttonData\")\n if counterData ~= nil then\n traumaValues = {}\n printToAll(\"Trauma values found in campaign log!\", \"Green\")\n for i = 1, 10, 3 do\n traumaValues[1 + (i - 1) / 3] = counterData.counter[i].value\n traumaValues[5 + (i - 1) / 3] = counterData.counter[i + 1].value\n end\n else\n printToAll(\"Trauma values could not be found in campaign log!\", \"Yellow\")\n printToAll(\"Default values for health and sanity loaded.\", \"Yellow\")\n end\n local campaignGuide = findCampaignGuide()\n if campaignGuide == nil then\n broadcastToAll(\"Campaign guide not found!\", Color.Red)\n return\n end\n local campaignGuidePage = campaignGuide.Book.getPage()\n local campaignData = {\n box = campaignBoxGUID,\n log = campaignLog.getData(),\n bag = chaosBagApi.getChaosBagState(),\n trauma = traumaValues,\n decks = deckImporterApi.getUiState(),\n clueCount = playAreaApi.getInvestigatorCount(),\n guide = campaignGuidePage,\n options = optionPanelApi.getOptions(),\n playmat = playAreaApi.getSurface()\n }\n campaignTokenData.GMNotes = JSON.encode(campaignData)\n campaignTokenData.Nickname = os.date(\"%b %d \") .. getObjectFromGUID(campaignBoxGUID).getName() .. \" Save\"\n spawnObjectData({\n data = campaignTokenData,\n position = {-21.25, 1.68, 55.59}\n })\n broadcastToAll(\"Campaign successfully exported! Save coin object to import on a fresh save\", Color.Green)\nend\n\n\n-- helper functions\n\nfunction findCampaignLog()\n local campaignLog = getObjectsWithTag(\"CampaignLog\")\n if campaignLog then\n if #campaignLog == 1 then\n return campaignLog[1]\n else\n broadcastToAll(\"More than 1 campaign log detected; delete all but one.\", Color.Red)\n return nil\n end\n else\n return nil\n end\nend\n\nfunction findCampaignGuide() \n local campaignGuide = getObjectsWithTag(\"CampaignGuide\")\n if campaignGuide then\n if #campaignGuide == 1 then\n return campaignGuide[1]\n else\n broadcastToAll(\"More than 1 campaign guide detected; delete all but one.\", Color.Red)\n return nil\n end\n else\n return nil\n end\nend\n\nfunction updateCounters(tableOfNewValues)\n if tonumber(tableOfNewValues) then\n local value = tableOfNewValues\n tableOfNewValues = {}\n for i = 1, #DAMAGE_HORROR_GUIDS do\n table.insert(tableOfNewValues, value)\n end\n end\n \n for i, guid in ipairs(DAMAGE_HORROR_GUIDS) do\n local TOKEN = getObjectFromGUID(guid)\n if TOKEN ~= nil then\n TOKEN.call(\"updateVal\", tableOfNewValues[i])\n else\n printToAll(\": No. \" .. i .. \" could not be found.\", \"Yellow\")\n end\n end\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"accessories/CampaignImporterExporter\")\nend)\n__bundle_register(\"core/OptionPanelApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local OptionPanelApi = {}\n\n -- loads saved options\n ---@param options Table New options table\n OptionPanelApi.loadSettings = function(options)\n return Global.call(\"loadSettings\", options)\n end\n\n -- returns option panel table\n OptionPanelApi.getOptions = function()\n return Global.getTable(\"optionPanel\")\n end\n\n return OptionPanelApi\nend\nend)\n__bundle_register(\"core/PlayAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlayAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getPlayArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"PlayArea\")\n end\n\n local function getInvestigatorCounter()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"InvestigatorCounter\")\n end\n\n -- Returns the current value of the investigator counter from the playmat\n ---@return Integer. Number of investigators currently set on the counter\n PlayAreaApi.getInvestigatorCount = function()\n return getInvestigatorCounter().getVar(\"val\")\n end\n\n -- Updates the current value of the investigator counter from the playmat\n ---@param count Number of investigators to set on the counter\n PlayAreaApi.setInvestigatorCount = function(count)\n getInvestigatorCounter().call(\"updateVal\", count)\n end\n\n -- Move all contents on the play area (cards, tokens, etc) one slot in the given direction. Certain\n -- fixed objects will be ignored, as will anything the player has tagged with 'displacement_excluded'\n ---@param playerColor Color Color of the player requesting the shift for messages\n PlayAreaApi.shiftContentsUp = function(playerColor)\n return getPlayArea().call(\"shiftContentsUp\", playerColor)\n end\n\n PlayAreaApi.shiftContentsDown = function(playerColor)\n return getPlayArea().call(\"shiftContentsDown\", playerColor)\n end\n\n PlayAreaApi.shiftContentsLeft = function(playerColor)\n return getPlayArea().call(\"shiftContentsLeft\", playerColor)\n end\n\n PlayAreaApi.shiftContentsRight = function(playerColor)\n return getPlayArea().call(\"shiftContentsRight\", playerColor)\n end\n\n -- Reset the play area's tracking of which cards have had tokens spawned.\n PlayAreaApi.resetSpawnedCards = function()\n return getPlayArea().call(\"resetSpawnedCards\")\n end\n\n -- Event to be called when the current scenario has changed.\n ---@param scenarioName Name of the new scenario\n PlayAreaApi.onScenarioChanged = function(scenarioName)\n getPlayArea().call(\"onScenarioChanged\", scenarioName)\n end\n\n -- Sets this playmat's snap points to limit snapping to locations or not.\n -- If matchTypes is false, snap points will be reset to snap all cards.\n ---@param matchTypes Boolean Whether snap points should only snap for the matching card types.\n PlayAreaApi.setLimitSnapsByType = function(matchCardTypes)\n getPlayArea().call(\"setLimitSnapsByType\", matchCardTypes)\n end\n\n -- Receiver for the Global tryObjectEnterContainer event. Used to clear vector lines from dragged\n -- cards before they're destroyed by entering the container\n PlayAreaApi.tryObjectEnterContainer = function(container, object)\n getPlayArea().call(\"tryObjectEnterContainer\", { container = container, object = object })\n end\n\n -- counts the VP on locations in the play area\n PlayAreaApi.countVP = function()\n return getPlayArea().call(\"countVP\")\n end\n\n -- highlights all locations in the play area without metadata\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightMissingData = function(state)\n return getPlayArea().call(\"highlightMissingData\", state)\n end\n \n -- highlights all locations in the play area with VP\n ---@param state Boolean True if highlighting should be enabled\n PlayAreaApi.highlightCountedVP = function(state)\n return getPlayArea().call(\"countVP\", state)\n end\n\n -- Checks if an object is in the play area (returns true or false)\n PlayAreaApi.isInPlayArea = function(object)\n return getPlayArea().call(\"isInPlayArea\", object)\n end\n\n PlayAreaApi.getSurface = function()\n return getPlayArea().getCustomObject().image\n end\n\n PlayAreaApi.updateSurface = function(url)\n return getPlayArea().call(\"updateSurface\", url)\n end\n \n -- Called by Custom Data Helpers to push their location data into the Data Helper. This adds the\n -- data to the local token manager instance.\n ---@param args Table Single-value array holding the GUID of the Custom Data Helper making the call\n PlayAreaApi.updateLocations = function(args)\n getPlayArea().call(\"updateLocations\", args)\n end\n\n PlayAreaApi.getCustomDataHelper = function()\n return getPlayArea().getVar(\"customDataHelper\")\n end\n\n return PlayAreaApi\nend\nend)\n__bundle_register(\"accessories/CampaignImporterExporter\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal blessCurseApi = require(\"chaosbag/BlessCurseManagerApi\")\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal deckImporterApi = require(\"arkhamdb/DeckImporterApi\")\nlocal guidReferenceApi = require(\"core/GUIDReferenceApi\")\nlocal optionPanelApi = require(\"core/OptionPanelApi\")\nlocal playAreaApi = require(\"core/PlayAreaApi\")\nlocal playmatApi = require(\"playermat/PlaymatApi\")\n\nlocal campaignTokenData = {\n Name = \"Custom_Model\",\n Transform = {\n posX = -21.25,\n posY = 1.68,\n posZ = 55.59,\n rotX = 0,\n rotY = 270,\n rotZ = 0,\n scaleX = 2,\n scaleY = 2,\n scaleZ = 2\n },\n Description = \"SCED Importer Token\",\n Tags = {\n \"ImporterToken\"\n },\n CustomMesh = {\n MeshURL = \"http://cloud-3.steamusercontent.com/ugc/943949966265929204/A38BB5D72419E6298385556D931877C0A1A55C17/\",\n DiffuseURL = \"http://cloud-3.steamusercontent.com/ugc/254843371583188147/920981125E37B5CEB6C400E3FD353A2C428DA969/\",\n NormalURL = \"\",\n ColliderURL = \"http://cloud-3.steamusercontent.com/ugc/943949966265929204/A38BB5D72419E6298385556D931877C0A1A55C17/\",\n Convex = true,\n MaterialIndex = 2,\n TypeIndex = 0,\n CustomShader = {\n SpecularColor = {\n r = 0.7222887,\n g = 0.507659256,\n b = 0.339915335\n },\n SpecularIntensity = 0.4,\n SpecularSharpness = 7.0,\n FresnelStrength = 0.0\n },\n CastShadows = true\n }\n}\nlocal COLORS = { \"White\", \"Orange\", \"Green\", \"Red\" }\n\nfunction onLoad()\n self.createButton({\n click_function = \"findCampaignFromToken\",\n function_owner = self,\n label = \"Import\",\n tooltip = \"Load in a campaign save from a token!\\n\\n(Token can be anywhere on the table, but ensure there is only 1!)\",\n position = { x = -1, y = 0.2, z = 0 },\n font_size = 400,\n width = 1400,\n height = 600,\n scale = { 0.5, 1, 0.5 },\n })\n self.createButton({\n click_function = \"createCampaignToken\",\n function_owner = self,\n label = \"Export\",\n tooltip = \"Create a campaign save token!\\n\\n(Ensure all chaos tokens have been unsealed!)\",\n position = { x = 1, y = 0.2, z = 0 },\n font_size = 400,\n width = 1400,\n height = 600,\n scale = { 0.5, 1, 0.5 },\n })\nend\n\n---------------------------------------------------------\n-- main import functions (split up to allow for Wait conditions)\n---------------------------------------------------------\n\n-- Identifies import token, determines campaign box and downloads it (if needed)\nfunction findCampaignFromToken(_, _, _)\n local coin = nil\n local coinObjects = getObjectsWithTag(\"ImporterToken\")\n if #coinObjects == 0 then\n broadcastToAll(\"Could not find importer token\", Color.Red)\n elseif #coinObjects \u003e 1 then\n broadcastToAll(\"More than 1 importer token found. Please delete all but 1 importer token\", Color.Yellow)\n else\n coin = coinObjects[1]\n\n local importData = JSON.decode(coin.getGMNotes())\n campaignBoxGUID = importData[\"box\"]\n\n local campaignBox = getObjectFromGUID(campaignBoxGUID)\n if campaignBox.type == \"Generic\" then\n campaignBox.call(\"buttonClick_download\")\n end\n Wait.condition(\n function()\n if #campaignBox.getObjects() \u003e 0 then\n placeCampaignFromToken(importData)\n else\n createCampaignFromToken(importData)\n end\n end,\n function()\n local obj = getObjectFromGUID(campaignBoxGUID)\n if obj == nil then\n return false\n else\n return obj.type == \"Bag\" and obj.getLuaScript() ~= \"\"\n end\n end,\n 2,\n function() broadcastToAll(\"Error loading campaign box\") end\n )\n end\nend\n\n-- After box has been downloaded, places content on table\nfunction placeCampaignFromToken(importData)\n getObjectFromGUID(importData[\"box\"]).call(\"buttonClick_place\")\n Wait.condition(\n function() createCampaignFromToken(importData) end,\n function() return findUniqueObjectWithTag(\"CampaignLog\") ~= nil end,\n 2,\n function() broadcastToAll(\"Error placing campaign box\") end\n )\nend\n\n-- After content is placed on table, conducts all the other import operations\nfunction createCampaignFromToken(importData)\n -- destroy existing campaign log and load saved campaign log\n findUniqueObjectWithTag(\"CampaignLog\").destruct()\n spawnObjectData({ data = importData[\"log\"] })\n \n chaosBagApi.setChaosBagState(importData[\"bag\"])\n\n -- populate trauma values\n if importData[\"trauma\"] then\n setTrauma(importData[\"trauma\"])\n end\n\n -- populate ArkhamDB deck IDs\n if importData[\"decks\"] then\n deckImporterApi.setUiState(importData[\"decks\"])\n end\n\n playAreaApi.setInvestigatorCount(importData[\"clueCount\"])\n\n -- set campaign guide page\n local guide = findUniqueObjectWithTag(\"CampaignGuide\")\n if guide then\n Wait.condition(\n -- Called after the condition function returns true\n function() log(\"Campaign Guide import successful!\") end,\n -- Condition function that is called continiously until returs true or timeout is reached\n function() return guide.Book.setPage(importData[\"guide\"]) end,\n -- Amount of time in seconds until the Wait times out\n 1,\n -- Called if the Wait times out\n function() log(\"Campaign Guide import failed!\") end\n )\n end\n\n Wait.time(function() optionPanelApi.loadSettings(importData[\"options\"]) end, 0.5)\n\n -- destroy Tour Starter token\n local tourStarter = guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"TourStarter\")\n tourStarter.destruct()\n\n -- restore PlayArea image\n playAreaApi.updateSurface(importData[\"playmat\"])\n\n broadcastToAll(\"Campaign successfully imported!\", Color.Green)\nend\n\n-- Creates a campaign token with save data encoded into GM Notes based on the current state of the table\nfunction createCampaignToken(_, playerColor, _)\n -- clean up chaos tokens\n blessCurseApi.removeAll(playerColor)\n chaosBagApi.releaseAllSealedTokens(playerColor)\n\n -- find active campaign\n local campaignBox\n for _, obj in ipairs(getObjectsWithTag(\"CampaignBox\")) do\n if obj.type == \"Bag\" and #obj.getObjects() == 0 then\n if not campaignBox then\n campaignBox = obj\n else\n broadcastToAll(\"Multiple empty campaign box detected; delete all but one.\", Color.Red)\n return\n end\n end\n end\n if not campaignBox then\n broadcastToAll(\"Campaign box with all placed objects not found!\", Color.Red)\n return\n end\n\n local campaignLog = findUniqueObjectWithTag(\"CampaignLog\")\n if campaignLog == nil then\n broadcastToAll(\"Campaign log not found!\", Color.Red)\n return\n end\n\n local traumaValues = {\n 0, 0, 0, 0,\n 0, 0, 0, 0\n }\n local counterData = campaignLog.getVar(\"ref_buttonData\")\n if counterData ~= nil then\n printToAll(\"Trauma values found in campaign log!\", \"Green\")\n for i = 1, 10, 3 do\n traumaValues[1 + (i - 1) / 3] = counterData.counter[i].value\n traumaValues[5 + (i - 1) / 3] = counterData.counter[i + 1].value\n end\n else\n printToAll(\"Trauma values could not be found in campaign log!\", \"Yellow\")\n printToAll(\"Default values for health and sanity loaded.\", \"Yellow\")\n end\n\n local campaignGuide = findUniqueObjectWithTag(\"CampaignGuide\")\n if campaignGuide == nil then\n broadcastToAll(\"Campaign guide not found!\", Color.Red)\n return\n end\n\n local campaignData = {\n box = campaignBox.getGUID(),\n log = campaignLog.getData(),\n bag = chaosBagApi.getChaosBagState(),\n trauma = traumaValues,\n decks = deckImporterApi.getUiState(),\n clueCount = playAreaApi.getInvestigatorCount(),\n guide = campaignGuide.Book.getPage(),\n options = optionPanelApi.getOptions(),\n playmat = playAreaApi.getSurface()\n }\n campaignTokenData.GMNotes = JSON.encode(campaignData)\n campaignTokenData.Nickname = os.date(\"%b %d \") .. campaignBox.getName() .. \" Save\"\n spawnObjectData({ data = campaignTokenData })\n broadcastToAll(\"Campaign successfully exported! Save coin object to import on a fresh save\", Color.Green)\nend\n\n---------------------------------------------------------\n-- helper functions\n---------------------------------------------------------\n\nfunction findUniqueObjectWithTag(tag)\n local objects = getObjectsWithTag(tag)\n if not objects then return end\n\n if #objects == 1 then\n return objects[1]\n else\n broadcastToAll(\"More than 1 \" .. tag .. \" detected; delete all but one.\", Color.Red)\n return nil\n end\nend\n\nfunction setTrauma(trauma)\n for i = 1, 4 do\n playmatApi.updateCounter(COLORS[i], \"DamageCounter\", trauma[i])\n playmatApi.updateCounter(COLORS[i], \"HorrorCounter\", trauma[i + 4])\n end\nend\nend)\n__bundle_register(\"arkhamdb/DeckImporterApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local DeckImporterApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getDeckImporter()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"DeckImporter\")\n end\n\n -- Returns a table with the full state of the UI, including options and deck IDs.\n -- This can be used to persist via onSave(), or provide values for a load operation\n -- Table values:\n -- redDeck: Deck ID to load for the red player\n -- orangeDeck: Deck ID to load for the orange player\n -- whiteDeck: Deck ID to load for the white player\n -- greenDeck: Deck ID to load for the green player\n -- private: True to load a private deck, false to load a public deck\n -- loadNewest: True if the most upgraded version of the deck should be loaded\n -- investigators: True if investigator cards should be spawned\n DeckImporterApi.getUiState = function()\n local passthroughTable = {}\n for k,v in pairs(getDeckImporter().call(\"getUiState\")) do\n passthroughTable[k] = v\n end\n return passthroughTable\n end\n\n -- Updates the state of the UI based on the provided table. Any values not provided will be left the same.\n ---@param uiStateTable Table of values to update on importer\n -- Table values:\n -- redDeck: Deck ID to load for the red player\n -- orangeDeck: Deck ID to load for the orange player\n -- whiteDeck: Deck ID to load for the white player\n -- greenDeck: Deck ID to load for the green player\n -- private: True to load a private deck, false to load a public deck\n -- loadNewest: True if the most upgraded version of the deck should be loaded\n -- investigators: True if investigator cards should be spawned\n DeckImporterApi.setUiState = function(uiStateTable)\n return getDeckImporter().call(\"setUiState\", uiStateTable)\n end\n\n return DeckImporterApi\nend\nend)\n__bundle_register(\"chaosbag/BlessCurseManagerApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local BlessCurseManagerApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getManager()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"BlessCurseManager\")\n end\n\n -- removes all taken tokens and resets the counts\n BlessCurseManagerApi.removeTakenTokensAndReset = function()\n local BlessCurseManager = getManager()\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Bless\") end, 0.05)\n Wait.time(function() BlessCurseManager.call(\"removeTakenTokens\", \"Curse\") end, 0.10)\n Wait.time(function() BlessCurseManager.call(\"doReset\", \"White\") end, 0.15)\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.sealedToken = function(type, guid)\n getManager().call(\"sealedToken\", { type = type, guid = guid })\n end\n\n -- updates the internal count (called by cards that seal bless/curse tokens)\n BlessCurseManagerApi.releasedToken = function(type, guid)\n getManager().call(\"releasedToken\", { type = type, guid = guid })\n end\n\n -- broadcasts the current status for bless/curse tokens\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.broadcastStatus = function(playerColor)\n getManager().call(\"broadcastStatus\", playerColor)\n end\n\n -- removes all bless / curse tokens from the chaos bag and play\n ---@param playerColor String Color of the player to show the broadcast to\n BlessCurseManagerApi.removeAll = function(playerColor)\n getManager().call(\"doRemove\", playerColor)\n end\n\n -- adds Wendy's menu to the hovered card (allows sealing of tokens)\n ---@param color String Color of the player to show the broadcast to\n BlessCurseManagerApi.addWendysMenu = function(playerColor, hoveredObject)\n getManager().call(\"addMenuOptions\", { playerColor = playerColor, hoveredObject = hoveredObject })\n end\n \n return BlessCurseManagerApi\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"playermat/PlaymatApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local PlaymatApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n -- Convenience function to look up a mat's object by color, or get all mats.\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@return array Table Single-element if only single playmat is requested\n local function getMatForColor(matColor)\n if matColor == \"All\" then\n return guidReferenceApi.getObjectsByType(\"Playermat\")\n else\n return { matColor = guidReferenceApi.getObjectByOwnerAndType(matColor, \"Playermat\") }\n end\n end\n\n -- Returns the color of the closest playmat\n ---@param startPos Table Starting position to get the closest mat from\n PlaymatApi.getMatColorByPosition = function(startPos)\n local result, smallestDistance\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local distance = Vector.between(startPos, mat.getPosition()):magnitude()\n if smallestDistance == nil or distance \u003c smallestDistance then\n smallestDistance = distance\n result = matColor\n end\n end\n return result\n end\n\n -- Returns the color of the player's hand that is seated next to the playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getPlayerColor = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"playerColor\")\n end\n end\n\n -- Returns the color of the playmat that owns the playercolor's hand\n ---@param handColor String Color of the playmat\n PlaymatApi.getMatColor = function(handColor)\n for matColor, mat in pairs(getMatForColor(\"All\")) do\n local playerColor = mat.getVar(\"playerColor\")\n if playerColor == handColor then\n return matColor\n end\n end\n end\n\n -- Returns if there is the card \"Dream-Enhancing Serum\" on the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.isDES = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"isDES\")\n end\n end\n\n -- Performs a search of the deck area of the requested playmat and returns the result as table\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDeckAreaObjects = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getDeckAreaObjects\")\n end\n end\n\n -- Flips the top card of the deck (useful after deck manipulation for Norman Withers)\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.flipTopCardFromDeck = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"flipTopCardFromDeck\")\n end\n end\n\n -- Returns the position of the discard pile of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.getDiscardPosition = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"returnGlobalDiscardPosition\")\n end\n end\n\n -- Transforms a local position into a global position\n ---@param localPos Table Local position to be transformed\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.transformLocalPosition = function(localPos, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.positionToWorld(localPos)\n end\n end\n\n -- Returns the rotation of the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnRotation = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getRotation()\n end\n end\n\n -- Triggers the Upkeep for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param playerColor String Color of the calling player (for messages)\n PlaymatApi.doUpkeepFromHotkey = function(matColor, playerColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doUpkeepFromHotkey\", playerColor)\n end\n end\n\n -- Handles discarding for the requested playmat for the provided list of objects\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param objList Table List of objects to discard\n PlaymatApi.discardListOfObjects = function(matColor, objList)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"discardListOfObjects\", objList)\n end\n end\n\n -- Returns the active investigator id\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n PlaymatApi.returnInvestigatorId = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.getVar(\"activeInvestigatorId\")\n end\n end\n\n -- Sets the requested playmat's snap points to limit snapping to matching card types or not. If\n -- matchTypes is true, the main card slot snap points will only snap assets, while the\n -- investigator area point will only snap Investigators. If matchTypes is false, snap points will\n -- be reset to snap all cards.\n ---@param matchCardTypes Boolean Whether snap points should only snap for the matching card types\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"setLimitSnapsByType\", matchCardTypes)\n end\n end\n\n -- Sets the requested playmat's draw 1 button to visible\n ---@param isDrawButtonVisible Boolean Whether the draw 1 button should be visible or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.showDrawButton = function(isDrawButtonVisible, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"showDrawButton\", isDrawButtonVisible)\n end\n end\n\n -- Shows or hides the clickable clue counter for the requested playmat\n ---@param showCounter Boolean Whether the clickable counter should be present or not\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.clickableClues = function(showCounter, matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"clickableClues\", showCounter)\n end\n end\n\n -- Removes all clues (to the trash for tokens and counters set to 0) for the requested playmat\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.removeClues = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"removeClues\")\n end\n end\n\n -- Reports the clue count for the requested playmat\n ---@param useClickableCounters Boolean Controls which type of counter is getting checked\n PlaymatApi.getClueCount = function(useClickableCounters, matColor)\n local count = 0\n for _, mat in pairs(getMatForColor(matColor)) do\n count = count + mat.call(\"getClueCount\", useClickableCounters)\n end\n return count\n end\n\n -- updates the specified owned counter\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param type String Counter to target\n ---@param newValue Number Value to set the counter to\n ---@param modifier Number If newValue is not provided, the existing value will be adjusted by this modifier\n PlaymatApi.updateCounter = function(matColor, type, newValue, modifier)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"updateCounter\", { type = type, newValue = newValue, modifier = modifier })\n end\n end\n\n -- returns the resource counter amount\n ---@param matColor String Color of the playmat - White, Orange, Green or Red (does not support \"All\")\n ---@param type String Counter to target\n PlaymatApi.getCounterValue = function(matColor, type)\n for _, mat in pairs(getMatForColor(matColor)) do\n return mat.call(\"getCounterValue\", type)\n end\n end\n\n -- resets the specified skill tracker to \"1, 1, 1, 1\"\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.resetSkillTracker = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"resetSkillTracker\")\n end\n end\n\n -- finds all objects on the playmat and associated set aside zone and returns a table\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n ---@param filter Function Optional filter function (return true for desired objects)\n PlaymatApi.searchAroundPlaymat = function(matColor, filter)\n local objList = {}\n for _, mat in pairs(getMatForColor(matColor)) do\n for _, obj in ipairs(mat.call(\"searchAroundSelf\", filter)) do\n table.insert(objList, obj)\n end\n end\n return objList\n end\n\n -- Discard a non-hidden card from the corresponding player's hand\n ---@param matColor String Color of the playmat - White, Orange, Green, Red or All\n PlaymatApi.doDiscardOne = function(matColor)\n for _, mat in pairs(getMatForColor(matColor)) do\n mat.call(\"doDiscardOne\")\n end\n end\n\n -- Triggers the metadata sync for all playmats\n PlaymatApi.syncAllCustomizableCards = function()\n for _, mat in pairs(getMatForColor(\"All\")) do\n mat.call(\"syncAllCustomizableCards\")\n end\n end\n\n return PlaymatApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Custom_Tile", @@ -205885,16 +198842,13 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/MythosAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local MythosAreaApi = {}\n local MYTHOS_AREA_GUID = \"9f334f\"\n\n -- returns the chaos token metadata (if provided through scenario reference card)\n MythosAreaApi.returnTokenData = function()\n return getObjectFromGUID(MYTHOS_AREA_GUID).call(\"returnTokenData\")\n end\n\n -- draw an encounter card to the requested position/rotation\n MythosAreaApi.drawEncounterCard = function(pos, rotY, alwaysFaceUp)\n getObjectFromGUID(MYTHOS_AREA_GUID).call(\"drawEncounterCard\", {\n pos = pos,\n rotY = rotY,\n alwaysFaceUp = alwaysFaceUp\n })\n end\n\n return MythosAreaApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"accessories/TokenArranger\")\nend)\n__bundle_register(\"accessories/TokenArranger\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal mythosAreaApi = require(\"core/MythosAreaApi\")\n\n-- common parameters\nlocal buttonParameters = {}\nbuttonParameters.function_owner = self\nbuttonParameters.label = \"\"\nbuttonParameters.tooltip = \"Increase / Decrease\"\nbuttonParameters.color = { 0, 0, 0, 0 }\nbuttonParameters.width = 325\nbuttonParameters.height = 325\n\nlocal inputParameters = {}\ninputParameters.function_owner = self\ninputParameters.font_size = 100\ninputParameters.width = 250\ninputParameters.height = inputParameters.font_size + 23\ninputParameters.alignment = 3\ninputParameters.validation = 2\ninputParameters.tab = 2\n\nlocal percentageLabel = {}\npercentageLabel.function_owner = self\npercentageLabel.click_function = \"none\"\npercentageLabel.width = 0\npercentageLabel.height = 0\n\n-- variables with save function\nlocal tokenPrecedence = {}\nlocal percentage = false\nlocal includeDrawnTokens = true\n\n-- variables without save function\nlocal updating = false\nlocal TOKEN_NAMES = {\n \"Elder Sign\",\n \"Skull\",\n \"Cultist\",\n \"Tablet\",\n \"Elder Thing\",\n \"Auto-fail\",\n \"Bless\",\n \"Curse\",\n \"Frost\",\n \"\"\n}\n\n-- saving the precedence settings and information on the most recently loaded data\nfunction onSave()\n return JSON.encode({\n tokenPrecedence = tokenPrecedence,\n percentage = percentage,\n includeDrawnTokens = includeDrawnTokens\n })\nend\n\n-- loading data, button creation and initial layouting\nfunction onLoad(saveState)\n if saveState ~= nil and saveState ~= \"\" then\n local loadedData = JSON.decode(saveState)\n tokenPrecedence = loadedData.tokenPrecedence\n percentage = loadedData.percentage\n includeDrawnTokens = loadedData.includeDrawnTokens\n else\n loadDefaultValues()\n\n -- grab token metadata from mythos area\n Wait.time(function() onTokenDataChanged(mythosAreaApi.returnTokenData()) end, 0.2)\n end\n\n createButtonsAndInputs()\n\n -- context menu items\n self.addContextMenuItem(\"Load default values\", function()\n loadDefaultValues()\n updateUI()\n layout()\n end)\n\n self.addContextMenuItem(\"Include drawn tokens\", function()\n includeDrawnTokens = not includeDrawnTokens\n local text = includeDrawnTokens and \" \" or \" not \"\n broadcastToAll(\"Token Arranger will\" .. text .. \"include currently drawn chaos tokens.\", \"Orange\")\n layout()\n end)\n\n self.addContextMenuItem(\"Toggle percentages\", function()\n if percentage then\n percentage = false\n else\n percentage = \"basic\"\n broadcastToAll(\"Percentages are unreliable when using tokens that draw other tokens (bless or curse for example).\", \"Yellow\")\n end\n layout()\n end)\n\n self.addContextMenuItem(\"Toggle cumulative\", function()\n if percentage == \"cumulative\" then\n percentage = \"basic\"\n else\n percentage = \"cumulative\"\n end\n broadcastToAll(\"Percentages are unreliable when using tokens that draw other tokens (bless or curse for example).\", \"Yellow\")\n layout()\n end)\nend\n\n-- delete temporary tokens when destroyed\nfunction onDestroy() deleteCopiedTokens() end\n\n-- layout tokens when dropped (after 1.5 seconds)\nfunction onDrop() Wait.time(layout, 1.5) end\n\n-- delete temporary tokens when picked up\nfunction onPickUp() deleteCopiedTokens() end\n\n-- click_function for buttons on chaos tokens\nfunction tokenClick(isRightClick, index)\n local change = tonumber(isRightClick and \"-1\" or \"1\")\n tokenPrecedence[TOKEN_NAMES[index]][1] = tokenPrecedence[TOKEN_NAMES[index]][1] + change\n self.editInput({\n index = index - 1,\n value = tokenPrecedence[TOKEN_NAMES[index]][1]\n })\n layout()\nend\n\n-- input_function for input_boxes\nfunction tokenInput(input, selected, index)\n if selected == false then\n local num = tonumber(input)\n if num ~= nil then\n tokenPrecedence[TOKEN_NAMES[index]][1] = num\n end\n layout()\n end\nend\n\n-- loads the default precedence table\nfunction loadDefaultValues()\n -- 1st value: token modifiers for sorting\n -- 2nd value: order for equivalent tokens (starts at 2 because of \"+1\" token)\n tokenPrecedence = {\n [\"Elder Sign\"] = { 100, 2},\n [\"Skull\"] = { -1, 3},\n [\"Cultist\"] = { -2, 4},\n [\"Tablet\"] = { -3, 5},\n [\"Elder Thing\"] = { -4, 6},\n [\"Auto-fail\"] = { -100, 7},\n [\"Bless\"] = { 101, 8},\n [\"Curse\"] = { -101, 9},\n [\"Frost\"] = { -99, 10},\n [\"\"] = { 0, 11}\n }\nend\n\n-- creates buttons and inputs\nfunction createButtonsAndInputs()\n local offset = 0.725\n local pos = { x = { -1.067, 0.377 }, z = -2.175 }\n\n -- button and inputs index 0-9\n for i = 1, 10 do\n if i \u003c 6 then\n buttonParameters.position = { pos.x[1], 0, pos.z + i * offset }\n inputParameters.position = { pos.x[1] + offset, 0.1, pos.z + i * offset }\n else\n buttonParameters.position = { pos.x[2], 0, pos.z + (i - 5) * offset }\n inputParameters.position = { pos.x[2] + offset, 0.1, pos.z + (i - 5) * offset }\n end\n\n buttonParameters.click_function = \"tokenClick\" .. i\n inputParameters.input_function = \"tokenInput\" .. i\n inputParameters.value = tokenPrecedence[TOKEN_NAMES[i]][1]\n\n -- setting click-/inputfunction\n self.setVar(buttonParameters.click_function, function(_, _, isRightClick) tokenClick(isRightClick, i) end)\n self.setVar(inputParameters.input_function, function(_, _, input, selected) tokenInput(input, selected, i) end)\n\n -- button/input creation\n self.createButton(buttonParameters)\n self.createInput(inputParameters)\n end\n\n -- index 10: \"Update / Hide\" button\n self.createButton({\n function_owner = self,\n label = \"Update / Hide\",\n click_function = \"layout\",\n tooltip = \"Left-Click: Update!\\nRight-Click: Hide Tokens!\",\n position = { 0.725, 0.1, 2.025 },\n color = { 1, 1, 1 },\n width = 675,\n height = 175\n })\nend\n\n-- update input fields\nfunction updateUI()\n for i = 1, 10 do\n self.editInput({\n index = i - 1,\n value = tokenPrecedence[TOKEN_NAMES[i]][1]\n })\n end\nend\n\n-- order function for data sorting\nfunction tokenValueComparator(left, right)\n if left.value ~= right.value then\n return left.value \u003e right.value\n elseif left.order ~= right.order then\n return left.order \u003c right.order\n else\n return false\n end\nend\n\n-- deletes previously placed tokens\nfunction deleteCopiedTokens()\n for _, token in ipairs(getObjectsWithTag(\"tempToken\")) do\n token.destruct()\n end\n\n -- this removes the percentage buttons (by index 11+)\n local buttonCount = #self.getButtons()\n if buttonCount \u003c 12 then return end\n\n for i = buttonCount, 12, -1 do\n self.removeButton(i - 1)\n end\nend\n\n-- creates buttons as labels as display for percentage values\nfunction createPercentageButton(tokenCount, valueCount, tokenName)\n local startPos = Vector(2.3, -0.05, 0.875 * valueCount)\n\n if percentage == \"cumulative\" then\n percentageLabel.scale = { 1.5, 1.5, 1.5 }\n percentageLabel.position = startPos - Vector(0, 0, 2.85)\n else\n percentageLabel.scale = { 2, 2, 2 }\n percentageLabel.position = startPos - Vector(0, 0, 2.675)\n end\n\n -- determine font_color\n if tokenName == \"Elder Sign\" then\n percentageLabel.font_color = { 0.35, 0.71, 0.85 }\n elseif tokenName == \"Auto-fail\" then\n percentageLabel.font_color = { 0.86, 0.1, 0.1 }\n -- check if the tokenName contains letters (e.g. symbol token)\n elseif string.match(tokenName, \"%a\") ~= nil then\n percentageLabel.font_color = { 0.68, 0.53, 0.86 }\n else\n percentageLabel.font_color = { 0.85, 0.67, 0.33 }\n end\n\n -- create label for base percentage\n local basePercentage = math.floor((tokenCount.row / tokenCount.total) * 10000) / 100\n percentageLabel.label = string.format(\"%s\", string.format(\"%05.2f\", basePercentage) .. \"%\")\n self.createButton(percentageLabel)\n\n -- optionally create label for cumulative percentage\n if percentage == \"cumulative\" then\n percentageLabel.position = startPos - Vector(0, 0, 2.45)\n percentageLabel.font_color = { 1, 1, 1 }\n\n -- only display one digit for 100%\n if tokenCount.sum == tokenCount.total then\n percentageLabel.label = \"100.0%\"\n else\n local cumulativePercentage = math.floor((tokenCount.sum / tokenCount.total) * 10000) / 100\n percentageLabel.label = string.format(\"%s\", string.format(\"%05.2f\", cumulativePercentage) .. \"%\")\n end\n self.createButton(percentageLabel)\n end\nend\n\n-- main function (delete old tokens, clone chaos bag content, sort it and position it)\nfunction layout(_, _, isRightClick)\n if updating then return end\n updating = true\n deleteCopiedTokens()\n\n -- stop here if right-clicked\n if isRightClick then\n updating = false\n return\n end\n\n -- get ChaosBag and stop if not found\n local chaosBag = chaosBagApi.findChaosBag()\n if not chaosBag then\n updating = false\n return\n end\n\n -- clone tokens from chaos bag (default position above trash can)\n local rawData = chaosBag.getData().ContainedObjects\n\n -- optionally get the data for tokens in play\n if includeDrawnTokens then\n for _, token in pairs(chaosBagApi.getTokensInPlay()) do\n if token ~= nil then table.insert(rawData, token.getData()) end\n end\n end\n\n -- generate layout data\n local data = {}\n for i, objData in ipairs(rawData) do\n objData[\"Tags\"] = { \"tempToken\" }\n local value = tonumber(objData.Nickname)\n local precedence = tokenPrecedence[objData.Nickname]\n\n data[i] = {\n token = objData,\n value = value or precedence[1]\n }\n\n -- order for comparator function\n if precedence ~= nil then\n data[i].order = precedence[2]\n else\n data[i].order = value\n end\n end\n\n -- sort table by value (symbols last if same value)\n table.sort(data, tokenValueComparator)\n\n -- laying out the tokens\n local pos = self.getPosition() + Vector(3.55, -0.05, -3.95)\n if percentage then pos.z = pos.z - 3.05 end\n\n local location = { x = pos.x, y = pos.y, z = pos.z }\n local rotation = self.getRotation()\n local currentValue = data[1].value\n local tokenCount = { row = 0, sum = 0, total = #data }\n local valueCount = 1\n local tokenName = false\n\n for i, item in ipairs(data) do\n -- this is true for the first token in a new row\n if item.value ~= currentValue then\n if percentage then\n tokenCount.sum = tokenCount.sum + tokenCount.row\n createPercentageButton(tokenCount, valueCount, tokenName)\n end\n\n location.x = location.x - 1.75\n location.z = pos.z\n currentValue = item.value\n valueCount = valueCount + 1\n tokenCount.row = 0\n end\n\n spawnObjectData({\n data = item.token,\n position = location,\n rotation = rotation\n })\n tokenName = item.token.Nickname\n location.z = location.z - 1.75\n tokenCount.row = tokenCount.row + 1\n end\n\n -- this is repeated to create the button for the last token\n if percentage then\n tokenCount.sum = tokenCount.sum + tokenCount.row\n createPercentageButton(tokenCount, valueCount, tokenName)\n end\n\n -- introducing a small delay to limit update calls\n Wait.time(function() updating = false end, 0.1)\nend\n\n-- called from outside to set default values for tokens\nfunction onTokenDataChanged(parameters)\n local tokenData = parameters.tokenData or {}\n local currentScenario = parameters.currentScenario or \"\"\n local useFrontData = parameters.useFrontData\n\n -- update token precedence\n for key, table in pairs(tokenData) do\n local modifier = table.modifier\n if modifier == -999 then modifier = 0 end\n tokenPrecedence[key][1] = modifier\n end\n\n updateUI()\n layout()\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/MythosAreaApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local MythosAreaApi = {}\n local guidReferenceApi = require(\"core/GUIDReferenceApi\")\n\n local function getMythosArea()\n return guidReferenceApi.getObjectByOwnerAndType(\"Mythos\", \"MythosArea\")\n end\n\n -- returns the chaos token metadata (if provided through scenario reference card)\n MythosAreaApi.returnTokenData = function()\n return getMythosArea().call(\"returnTokenData\")\n end\n \n -- returns an object reference to the encounter deck\n MythosAreaApi.getEncounterDeck = function()\n return getMythosArea().call(\"getEncounterDeck\")\n end\n\n -- draw an encounter card to the requested position/rotation\n MythosAreaApi.drawEncounterCard = function(pos, rotY, alwaysFaceUp)\n getMythosArea().call(\"drawEncounterCard\", {\n pos = pos,\n rotY = rotY,\n alwaysFaceUp = alwaysFaceUp\n })\n end\n\n return MythosAreaApi\nend\nend)\n__bundle_register(\"core/GUIDReferenceApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local GUIDReferenceApi = {}\n\n local function getGuidHandler()\n return getObjectFromGUID(\"123456\")\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectByOwnerAndType = function(owner, type)\n return getGuidHandler().call(\"getObjectByOwnerAndType\", { owner = owner, type = type })\n end\n\n -- returns all matching objects as a table with references\n ---@param type String Type of object to search for\n GUIDReferenceApi.getObjectsByType = function(type)\n return getGuidHandler().call(\"getObjectsByType\", type)\n end\n\n -- returns all matching objects as a table with references\n ---@param owner String Parent object for this search\n GUIDReferenceApi.getObjectsByOwner = function(owner)\n return getGuidHandler().call(\"getObjectsByOwner\", owner)\n end\n\n return GUIDReferenceApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"accessories/TokenArranger\")\nend)\n__bundle_register(\"accessories/TokenArranger\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\nlocal mythosAreaApi = require(\"core/MythosAreaApi\")\n\n-- common parameters\nlocal buttonParameters = {}\nbuttonParameters.function_owner = self\nbuttonParameters.label = \"\"\nbuttonParameters.tooltip = \"Increase / Decrease\"\nbuttonParameters.color = { 0, 0, 0, 0 }\nbuttonParameters.width = 325\nbuttonParameters.height = 325\n\nlocal inputParameters = {}\ninputParameters.function_owner = self\ninputParameters.font_size = 100\ninputParameters.width = 250\ninputParameters.height = inputParameters.font_size + 23\ninputParameters.alignment = 3\ninputParameters.validation = 2\ninputParameters.tab = 2\n\nlocal percentageLabel = {}\npercentageLabel.function_owner = self\npercentageLabel.click_function = \"none\"\npercentageLabel.width = 0\npercentageLabel.height = 0\n\n-- variables with save function\nlocal tokenPrecedence = {}\nlocal percentage = false\nlocal includeDrawnTokens = true\n\n-- variables without save function\nlocal updating = false\nlocal TOKEN_NAMES = {\n \"Elder Sign\",\n \"Skull\",\n \"Cultist\",\n \"Tablet\",\n \"Elder Thing\",\n \"Auto-fail\",\n \"Bless\",\n \"Curse\",\n \"Frost\",\n \"\"\n}\n\n-- saving the precedence settings and information on the most recently loaded data\nfunction onSave()\n return JSON.encode({\n tokenPrecedence = tokenPrecedence,\n percentage = percentage,\n includeDrawnTokens = includeDrawnTokens\n })\nend\n\n-- loading data, button creation and initial layouting\nfunction onLoad(saveState)\n if saveState ~= nil and saveState ~= \"\" then\n local loadedData = JSON.decode(saveState)\n tokenPrecedence = loadedData.tokenPrecedence\n percentage = loadedData.percentage\n includeDrawnTokens = loadedData.includeDrawnTokens\n else\n loadDefaultValues()\n\n -- grab token metadata from mythos area\n Wait.time(function() onTokenDataChanged(mythosAreaApi.returnTokenData()) end, 0.2)\n end\n\n createButtonsAndInputs()\n \n -- maybe trigger layout() to draw percentage buttons\n local objList = getObjectsWithTag(\"tempToken\")\n if #objList \u003e 0 then\n Wait.time(layout, 0.5)\n end\n \n -- context menu items\n self.addContextMenuItem(\"Load default values\", function()\n loadDefaultValues()\n updateUI()\n layout()\n end)\n\n self.addContextMenuItem(\"Include drawn tokens\", function()\n includeDrawnTokens = not includeDrawnTokens\n local text = includeDrawnTokens and \" \" or \" not \"\n broadcastToAll(\"Token Arranger will\" .. text .. \"include currently drawn chaos tokens.\", \"Orange\")\n layout()\n end)\n\n self.addContextMenuItem(\"Toggle percentages\", function()\n if percentage then\n percentage = false\n else\n percentage = \"basic\"\n broadcastToAll(\"Percentages are unreliable when using tokens that draw other tokens (bless or curse for example).\", \"Yellow\")\n end\n layout()\n end)\n\n self.addContextMenuItem(\"Toggle cumulative\", function()\n if percentage == \"cumulative\" then\n percentage = \"basic\"\n else\n percentage = \"cumulative\"\n end\n broadcastToAll(\"Percentages are unreliable when using tokens that draw other tokens (bless or curse for example).\", \"Yellow\")\n layout()\n end)\nend\n\n-- delete temporary tokens when destroyed\nfunction onDestroy() deleteCopiedTokens() end\n\n-- layout tokens when dropped (after 1.5 seconds)\nfunction onDrop() Wait.time(layout, 1.5) end\n\n-- delete temporary tokens when picked up\nfunction onPickUp() deleteCopiedTokens() end\n\n-- click_function for buttons on chaos tokens\nfunction tokenClick(isRightClick, index)\n local change = tonumber(isRightClick and \"-1\" or \"1\")\n tokenPrecedence[TOKEN_NAMES[index]][1] = tokenPrecedence[TOKEN_NAMES[index]][1] + change\n self.editInput({\n index = index - 1,\n value = tokenPrecedence[TOKEN_NAMES[index]][1]\n })\n layout()\nend\n\n-- input_function for input_boxes\nfunction tokenInput(input, selected, index)\n if selected == false then\n local num = tonumber(input)\n if num ~= nil then\n tokenPrecedence[TOKEN_NAMES[index]][1] = num\n end\n layout()\n end\nend\n\n-- loads the default precedence table\nfunction loadDefaultValues()\n -- 1st value: token modifiers for sorting\n -- 2nd value: order for equivalent tokens (starts at 2 because of \"+1\" token)\n tokenPrecedence = {\n [\"Elder Sign\"] = { 100, 2},\n [\"Skull\"] = { -1, 3},\n [\"Cultist\"] = { -2, 4},\n [\"Tablet\"] = { -3, 5},\n [\"Elder Thing\"] = { -4, 6},\n [\"Auto-fail\"] = { -100, 7},\n [\"Bless\"] = { 101, 8},\n [\"Curse\"] = { -101, 9},\n [\"Frost\"] = { -99, 10},\n [\"\"] = { 0, 11}\n }\nend\n\n-- creates buttons and inputs\nfunction createButtonsAndInputs()\n local offset = 0.725\n local pos = { x = { -1.067, 0.377 }, z = -2.175 }\n\n -- button and inputs index 0-9\n for i = 1, 10 do\n if i \u003c 6 then\n buttonParameters.position = { pos.x[1], 0, pos.z + i * offset }\n inputParameters.position = { pos.x[1] + offset, 0.1, pos.z + i * offset }\n else\n buttonParameters.position = { pos.x[2], 0, pos.z + (i - 5) * offset }\n inputParameters.position = { pos.x[2] + offset, 0.1, pos.z + (i - 5) * offset }\n end\n\n buttonParameters.click_function = \"tokenClick\" .. i\n inputParameters.input_function = \"tokenInput\" .. i\n inputParameters.value = tokenPrecedence[TOKEN_NAMES[i]][1]\n\n -- setting click-/inputfunction\n self.setVar(buttonParameters.click_function, function(_, _, isRightClick) tokenClick(isRightClick, i) end)\n self.setVar(inputParameters.input_function, function(_, _, input, selected) tokenInput(input, selected, i) end)\n\n -- button/input creation\n self.createButton(buttonParameters)\n self.createInput(inputParameters)\n end\n\n -- index 10: \"Update / Hide\" button\n self.createButton({\n function_owner = self,\n label = \"Update / Hide\",\n click_function = \"layout\",\n tooltip = \"Left-Click: Update!\\nRight-Click: Hide Tokens!\",\n position = { 0.725, 0.1, 2.025 },\n color = { 1, 1, 1 },\n width = 675,\n height = 175\n })\nend\n\n-- update input fields\nfunction updateUI()\n for i = 1, 10 do\n self.editInput({\n index = i - 1,\n value = tokenPrecedence[TOKEN_NAMES[i]][1]\n })\n end\nend\n\n-- order function for data sorting\nfunction tokenValueComparator(left, right)\n if left.value ~= right.value then\n return left.value \u003e right.value\n elseif left.order ~= right.order then\n return left.order \u003c right.order\n else\n return false\n end\nend\n\n-- deletes previously placed tokens\nfunction deleteCopiedTokens()\n for _, token in ipairs(getObjectsWithTag(\"tempToken\")) do\n token.destruct()\n end\n\n -- this removes the percentage buttons (by index 11+)\n local buttonCount = #self.getButtons()\n if buttonCount \u003c 12 then return end\n\n for i = buttonCount, 12, -1 do\n self.removeButton(i - 1)\n end\nend\n\n-- creates buttons as labels as display for percentage values\nfunction createPercentageButton(tokenCount, valueCount, tokenName)\n local startPos = Vector(2.3, -0.04, 0.875 * valueCount)\n\n if percentage == \"cumulative\" then\n percentageLabel.scale = { 1.5, 1.5, 1.5 }\n percentageLabel.position = startPos - Vector(0, 0, 2.85)\n else\n percentageLabel.scale = { 2, 2, 2 }\n percentageLabel.position = startPos - Vector(0, 0, 2.675)\n end\n\n -- determine font_color\n if tokenName == \"Elder Sign\" then\n percentageLabel.font_color = { 0.35, 0.71, 0.85 }\n elseif tokenName == \"Auto-fail\" then\n percentageLabel.font_color = { 0.86, 0.1, 0.1 }\n -- check if the tokenName contains letters (e.g. symbol token)\n elseif string.match(tokenName, \"%a\") ~= nil then\n percentageLabel.font_color = { 0.68, 0.53, 0.86 }\n else\n percentageLabel.font_color = { 0.85, 0.67, 0.33 }\n end\n\n -- create label for base percentage\n local basePercentage = math.floor((tokenCount.row / tokenCount.total) * 10000) / 100\n percentageLabel.label = string.format(\"%s\", string.format(\"%05.2f\", basePercentage) .. \"%\")\n self.createButton(percentageLabel)\n\n -- optionally create label for cumulative percentage\n if percentage == \"cumulative\" then\n percentageLabel.position = startPos - Vector(0, 0, 2.45)\n percentageLabel.font_color = { 1, 1, 1 }\n\n -- only display one digit for 100%\n if tokenCount.sum == tokenCount.total then\n percentageLabel.label = \"100.0%\"\n else\n local cumulativePercentage = math.floor((tokenCount.sum / tokenCount.total) * 10000) / 100\n percentageLabel.label = string.format(\"%s\", string.format(\"%05.2f\", cumulativePercentage) .. \"%\")\n end\n self.createButton(percentageLabel)\n end\nend\n\n-- main function (delete old tokens, clone chaos bag content, sort it and position it)\nfunction layout(_, _, isRightClick)\n if updating then return end\n updating = true\n deleteCopiedTokens()\n\n -- stop here if right-clicked\n if isRightClick then\n updating = false\n return\n end\n\n -- get ChaosBag and stop if not found\n local chaosBag = chaosBagApi.findChaosBag()\n if not chaosBag then\n updating = false\n return\n end\n\n -- clone tokens from chaos bag (default position above trash can)\n local rawData = chaosBag.getData().ContainedObjects\n\n -- optionally get the data for tokens in play\n if includeDrawnTokens then\n for _, token in pairs(chaosBagApi.getTokensInPlay()) do\n if token ~= nil then table.insert(rawData, token.getData()) end\n end\n end\n\n -- generate layout data\n local data = {}\n for i, objData in ipairs(rawData) do\n objData[\"Tags\"] = { \"tempToken\" }\n local value = tonumber(objData.Nickname)\n local precedence = tokenPrecedence[objData.Nickname]\n\n -- remove GUID to avoid issues for high latency clients\n objData[\"GUID\"] = nil\n\n -- store data with value / precendence\n data[i] = {\n token = objData,\n value = value or precedence[1]\n }\n\n -- order for comparator function\n if precedence ~= nil then\n data[i].order = precedence[2]\n else\n data[i].order = value\n end\n end\n\n -- sort table by value (symbols last if same value)\n table.sort(data, tokenValueComparator)\n\n -- laying out the tokens\n local pos = self.getPosition() + Vector(3.55, -0.05, -3.95)\n if percentage then pos.z = pos.z - 3.05 end\n\n local location = { x = pos.x, y = pos.y, z = pos.z }\n local rotation = self.getRotation()\n local currentValue = data[1].value\n local tokenCount = { row = 0, sum = 0, total = #data }\n local valueCount = 1\n local tokenName = false\n\n for i, item in ipairs(data) do\n -- this is true for the first token in a new row\n if item.value ~= currentValue then\n if percentage then\n tokenCount.sum = tokenCount.sum + tokenCount.row\n createPercentageButton(tokenCount, valueCount, tokenName)\n end\n\n location.x = location.x - 1.75\n location.z = pos.z\n currentValue = item.value\n valueCount = valueCount + 1\n tokenCount.row = 0\n end\n\n spawnObjectData({\n data = item.token,\n position = location,\n rotation = rotation\n })\n tokenName = item.token.Nickname\n location.z = location.z - 1.75\n tokenCount.row = tokenCount.row + 1\n end\n\n -- this is repeated to create the button for the last token\n if percentage then\n tokenCount.sum = tokenCount.sum + tokenCount.row\n createPercentageButton(tokenCount, valueCount, tokenName)\n end\n\n -- introducing a small delay to limit update calls\n Wait.time(function() updating = false end, 0.1)\nend\n\n-- called from outside to set default values for tokens\nfunction onTokenDataChanged(parameters)\n local tokenData = parameters.tokenData or {}\n local currentScenario = parameters.currentScenario or \"\"\n local useFrontData = parameters.useFrontData\n\n -- update token precedence\n for key, table in pairs(tokenData) do\n local modifier = table.modifier\n if modifier == -999 then modifier = 0 end\n tokenPrecedence[key][1] = modifier\n end\n\n updateUI()\n layout()\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "{\"includeDrawnTokens\":true,\"percentage\":false,\"tokenPrecedence\":{\"\":[0,11],\"Auto-fail\":[-100,7],\"Bless\":[101,8],\"Cultist\":[-2,4],\"Curse\":[-101,9],\"Elder Sign\":[100,2],\"Elder Thing\":[-4,6],\"Frost\":[-99,10],\"Skull\":[-1,3],\"Tablet\":[-3,5]}}", "MeasureMovement": false, "Name": "Custom_Token", "Nickname": "Token Arranger", "Snap": true, "Sticky": true, - "Tags": [ - "TokenArranger" - ], "Tooltip": true, "Transform": { "posX": -42.3, @@ -205945,7 +198899,7 @@ "IgnoreFoW": false, "LayoutGroupSortIndex": 0, "Locked": true, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"accessories/ChaosBagManager\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\n\nlocal TOKEN_IDS = {\n -- first row\n \"p1\", \"0\", \"m1\", \"m2\", \"m3\", \"m4\",\n -- second row\n \"m5\", \"m6\", \"m7\", \"m8\", \"frost\",\n -- third row\n \"blue\", \"skull\", \"cultist\", \"tablet\", \"elder\", \"red\"\n}\n\nlocal BUTTON_TOOLTIP = {\n -- first row\n \"+1\", \"0\", \"-1\", \"-2\", \"-3\", \"-4\",\n -- second row\n \"-5\", \"-6\", \"-7\", \"-8\", \"Frost\",\n -- third row\n \"Elder Sign\", \"Skull\", \"Cultist\", \"Tablet\", \"Elder Thing\", \"Auto-fail\"\n}\n\nlocal BUTTON_POSITION = {\n -- first row\n -1.90, -1.14, -0.38, 0.38, 1.14, 1.90,\n -- second row\n -1.90, -1.14, -0.38, 0.38, 1.90,\n -- third row\n -1.90, -1.14, -0.38, 0.38, 1.14, 1.90\n}\n\n-- common button parameters\nlocal buttonParameters = {}\nbuttonParameters.function_owner = self\nbuttonParameters.color = { 0, 0, 0, 0 }\nbuttonParameters.width = 300\nbuttonParameters.height = 300\n\nlocal name\nlocal tokens = {}\n\nfunction onLoad()\n -- create buttons for tokens\n for i = 1, #BUTTON_POSITION do\n local funcName = \"buttonClick\" .. i\n self.setVar(funcName, function(_, _, isRightClick) buttonClick(i, isRightClick) end)\n\n buttonParameters.click_function = funcName\n buttonParameters.tooltip = BUTTON_TOOLTIP[i]\n buttonParameters.position = { x = BUTTON_POSITION[i], y = 0, z = 0 }\n\n if i \u003c 7 then\n buttonParameters.position.z = -0.778\n elseif i \u003e 11 then\n buttonParameters.position.z = 0.755\n end\n\n self.createButton(buttonParameters)\n end\nend\n\n-- click function for buttons\nfunction buttonClick(index, isRightClick)\n local tokenId = TOKEN_IDS[index]\n\n if isRightClick then\n chaosBagApi.removeChaosToken(tokenId)\n else\n local tokens = {}\n local name = BUTTON_TOOLTIP[index]\n local chaosbag = chaosBagApi.findChaosBag()\n\n for _, v in ipairs(chaosbag.getObjects()) do\n if v.name == name then table.insert(tokens, v.guid) end\n end\n\n -- spawn token (only 8 frost tokens allowed)\n if tokenId == \"frost\" and #tokens == 8 then\n printToAll(\"The maximum of 8 Frost tokens is already in the bag.\", \"Yellow\")\n return\n end\n\n chaosBagApi.spawnChaosToken(tokenId)\n printToAll(\"Adding \" .. name .. \" token (in bag: \" .. #tokens + 1 .. \")\", \"White\")\n end\nend\nend)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"accessories/ChaosBagManager\")\nend)\nreturn __bundle_require(\"__root\")", + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"chaosbag/ChaosBagApi\", function(require, _LOADED, __bundle_register, __bundle_modules)\ndo\n local ChaosBagApi = {}\n\n -- respawns the chaos bag with a new state of tokens\n ---@param tokenList Table List of chaos token ids\n ChaosBagApi.setChaosBagState = function(tokenList)\n return Global.call(\"setChaosBagState\", tokenList)\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getChaosBagState = function()\n local chaosBagContentsCatcher = Global.call(\"getChaosBagState\")\n local chaosBagContents = {}\n for _, v in ipairs(chaosBagContentsCatcher) do\n table.insert(chaosBagContents, v)\n end\n return chaosBagContents\n end\n\n -- checks scripting zone for chaos bag (also called by a lot of objects!)\n ChaosBagApi.findChaosBag = function()\n return Global.call(\"findChaosBag\")\n end\n\n -- returns a table of object references to the tokens in play (does not include sealed tokens!)\n ChaosBagApi.getTokensInPlay = function()\n return Global.getTable(\"chaosTokens\")\n end\n\n -- returns all sealed tokens on cards to the chaos bag\n ChaosBagApi.releaseAllSealedTokens = function(playerColor)\n return Global.call(\"releaseAllSealedTokens\", playerColor)\n end\n\n -- returns all drawn tokens to the chaos bag\n ChaosBagApi.returnChaosTokens = function(playerColor)\n return Global.call(\"returnChaosTokens\", playerColor)\n end\n\n -- removes the specified chaos token from the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.removeChaosToken = function(id)\n return Global.call(\"removeChaosToken\", id)\n end\n\n -- spawns the specified chaos token and puts it into the chaos bag\n ---@param id String ID of the chaos token\n ChaosBagApi.spawnChaosToken = function(id)\n return Global.call(\"spawnChaosToken\", id)\n end\n\n -- Checks to see if the chaos bag can be manipulated. If a player is searching the bag when tokens\n -- are drawn or replaced a TTS bug can cause those tokens to vanish. Any functions which change the\n -- contents of the bag should check this method before doing so.\n -- This method will broadcast a message to all players if the bag is being searched.\n ---@return Boolean. True if the bag is manipulated, false if it should be blocked.\n ChaosBagApi.canTouchChaosTokens = function()\n return Global.call(\"canTouchChaosTokens\")\n end\n\n -- called by playermats (by the \"Draw chaos token\" button)\n ChaosBagApi.drawChaosToken = function(mat, tokenOffset, isRightClick)\n return Global.call(\"drawChaosToken\", {mat, tokenOffset, isRightClick})\n end\n\n -- returns a Table List of chaos token ids in the current chaos bag\n -- requires copying the data into a new table because TTS is weird about handling table return values in Global\n ChaosBagApi.getIdUrlMap = function()\n return Global.getTable(\"ID_URL_MAP\")\n end\n\n return ChaosBagApi\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"accessories/ChaosBagManager\")\nend)\n__bundle_register(\"accessories/ChaosBagManager\", function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal chaosBagApi = require(\"chaosbag/ChaosBagApi\")\n\nlocal TOKEN_IDS = {\n -- first row\n \"p1\", \"0\", \"m1\", \"m2\", \"m3\", \"m4\",\n -- second row\n \"m5\", \"m6\", \"m7\", \"m8\", \"frost\",\n -- third row\n \"blue\", \"skull\", \"cultist\", \"tablet\", \"elder\", \"red\"\n}\n\nlocal BUTTON_TOOLTIP = {\n -- first row\n \"+1\", \"0\", \"-1\", \"-2\", \"-3\", \"-4\",\n -- second row\n \"-5\", \"-6\", \"-7\", \"-8\", \"Frost\",\n -- third row\n \"Elder Sign\", \"Skull\", \"Cultist\", \"Tablet\", \"Elder Thing\", \"Auto-fail\"\n}\n\nlocal BUTTON_POSITION = {\n -- first row\n -1.90, -1.14, -0.38, 0.38, 1.14, 1.90,\n -- second row\n -1.90, -1.14, -0.38, 0.38, 1.90,\n -- third row\n -1.90, -1.14, -0.38, 0.38, 1.14, 1.90\n}\n\n-- common button parameters\nlocal buttonParameters = {}\nbuttonParameters.function_owner = self\nbuttonParameters.color = { 0, 0, 0, 0 }\nbuttonParameters.width = 300\nbuttonParameters.height = 300\n\nlocal name\nlocal tokens = {}\n\nfunction onLoad()\n -- create buttons for tokens\n for i = 1, #BUTTON_POSITION do\n local funcName = \"buttonClick\" .. i\n self.setVar(funcName, function(_, _, isRightClick) buttonClick(i, isRightClick) end)\n\n buttonParameters.click_function = funcName\n buttonParameters.tooltip = BUTTON_TOOLTIP[i]\n buttonParameters.position = { x = BUTTON_POSITION[i], y = 0, z = 0 }\n\n if i \u003c 7 then\n buttonParameters.position.z = -0.778\n elseif i \u003e 11 then\n buttonParameters.position.z = 0.755\n end\n\n self.createButton(buttonParameters)\n end\nend\n\n-- click function for buttons\nfunction buttonClick(index, isRightClick)\n local tokenId = TOKEN_IDS[index]\n\n if isRightClick then\n chaosBagApi.removeChaosToken(tokenId)\n else\n local tokens = {}\n local name = BUTTON_TOOLTIP[index]\n local chaosbag = chaosBagApi.findChaosBag()\n\n for _, v in ipairs(chaosbag.getObjects()) do\n if v.name == name then table.insert(tokens, v.guid) end\n end\n\n -- spawn token (only 8 frost tokens allowed)\n if tokenId == \"frost\" and #tokens == 8 then\n printToAll(\"The maximum of 8 Frost tokens is already in the bag.\", \"Yellow\")\n return\n end\n\n chaosBagApi.spawnChaosToken(tokenId)\n printToAll(\"Adding \" .. name .. \" token (in bag: \" .. #tokens + 1 .. \")\", \"White\")\n end\nend\nend)\nreturn __bundle_require(\"__root\")", "LuaScriptState": "", "MeasureMovement": false, "Name": "Custom_Token", @@ -205978,11 +198932,112 @@ }, "Autoraise": true, "ColorDiffuse": { + "b": 0.82353, + "g": 0.20157, + "r": 0 + }, + "Description": "This dummy is there to hold the up-to-date script file for placeholder boxes to be available for placeholder box spawning.", + "DragSelectable": true, + "GMNotes": "", + "GUID": "a93466", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": true, + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "BlockRectangle", + "Nickname": "Placeholder Box Dummy", + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": 78, + "posY": 1.645, + "posZ": -33, + "rotX": 0, + "rotY": 0, + "rotZ": 0, + "scaleX": 1, + "scaleY": 1, + "scaleZ": 1 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "a": 0.27843, "b": 1, "g": 1, "r": 1 }, - "Description": "Thanks for downloading Arkham SCE 3.3.0!\n\n- Added 2023-08-30 taboo list. Note that the prior 2022-08-26 taboo list is no longer supported.\n- Added some of the previewed player cards from Feast of Hemlock Vale.\n- Removed broken content from and cleaned up the community player card/investigator box.", + "CustomMesh": { + "CastShadows": true, + "ColliderURL": "", + "Convex": true, + "DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/2117314083163063648/B404BC484394C1B241A97479C3A1FDC8D33ADE2F/", + "MaterialIndex": 3, + "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", + "NormalURL": "", + "TypeIndex": 0 + }, + "Description": "by Mint Tea Fan", + "DragSelectable": true, + "GMNotes": "fancreations/investigators_baldurs_gate_3.json", + "GUID": "695abd", + "Grid": true, + "GridProjection": false, + "Hands": false, + "HideWhenFaceDown": false, + "IgnoreFoW": false, + "LayoutGroupSortIndex": 0, + "Locked": false, + "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\nreturn __bundle_require(\"__root\")", + "LuaScriptState": "", + "MeasureMovement": false, + "Name": "Custom_Model", + "Nickname": " Baldur's Gate III", + "Snap": true, + "Sticky": true, + "Tooltip": true, + "Transform": { + "posX": -26, + "posY": 1.481, + "posZ": -87, + "rotX": 0, + "rotY": 270, + "rotZ": 0, + "scaleX": 2.21, + "scaleY": 0.46, + "scaleZ": 2.42 + }, + "Value": 0, + "XmlUI": "" + }, + { + "AltLookAngle": { + "x": 0, + "y": 0, + "z": 0 + }, + "Autoraise": true, + "ColorDiffuse": { + "b": 1, + "g": 1, + "r": 1 + }, + "Description": "Thanks for downloading Arkham SCE 3.4.0!\n\r\n- Revamped the download menu! This is now the primary way to access custom content instead of the container with placeholder boxes.\n- Added Parallel Jim and Parallel Zoey!\n- Added new community content!\n- Added a helper for Subject 5U-21.\r\n- Added a tool to hide unused playermats.\n", "DragSelectable": true, "GMNotes": "", "GUID": "964222", @@ -205997,7 +199052,7 @@ "LuaScriptState": "", "MeasureMovement": false, "Name": "Notecard", - "Nickname": "Arkham SCE 3.3.0 - 10/9/2023 - Page 1", + "Nickname": "Arkham SCE 3.4.0 - 11/18/2023 - Page 1", "Snap": true, "States": { "2": { @@ -206012,7 +199067,7 @@ "g": 1, "r": 1 }, - "Description": "- Added the following community contributions:\n Buffy the Vampire Slayer by AtomicZ!\n City of Secrets by Exhaled Innards!\n Circus Ex Mortis Investigator Expansion by The\n Beard!\n Heart of Darkness by Vinn Quest!\n The Red Coterie Investigators by\n Mattastrophic!\n (continued)", + "Description": "- Added an image gallery for play area images.\n- Added QoL features for Norman Withers\r.\n\r- Added a discard gamekey.\r\n- Increased readability of master clue counter.\r\n- Cleaned up the option panel.\n- Added default camera states (Shift + 1/2).\n- Fixed bugs with discarding cards from hand, the token arranger, and taboo card widths.\r\n- Misc. metadata fixes.", "DragSelectable": true, "GMNotes": "", "GUID": "d7faf7", @@ -206027,152 +199082,17 @@ "LuaScriptState": "", "MeasureMovement": false, "Name": "Notecard", - "Nickname": "Arkham SCE 3.3.0 - 10/9/2023 - Page 2", + "Nickname": "Arkham SCE 3.4.0 - 11/18/2023 - Page 2", "Snap": true, "Sticky": true, "Tooltip": true, "Transform": { - "posX": -26.88849, - "posY": 1.551499, - "posZ": -60.2882576, - "rotX": 0, - "rotY": 90, - "rotZ": 0, - "scaleX": 3, - "scaleY": 1, - "scaleZ": 3 - }, - "Value": 0, - "XmlUI": "" - }, - "3": { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "b": 1, - "g": 1, - "r": 1 - }, - "Description": " The Sands of Memphis by Myriad!\n Souls of Darkness by JackOfHearts!\n- The options panel has a new option to spawn clickable counters only on \"0 uses\" cards. Try the \"Chef's Selection\" option for the best of both worlds!\n- Increased readability of master Clue Counter's text.", - "DragSelectable": true, - "GMNotes": "", - "GUID": "50d85e", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Notecard", - "Nickname": "Arkham SCE 3.3.0 - 10/9/2023 - Page 3", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -26.88849, - "posY": 1.551499, - "posZ": -60.2882576, - "rotX": 0, - "rotY": 90, - "rotZ": 0, - "scaleX": 3, - "scaleY": 1, - "scaleZ": 3 - }, - "Value": 0, - "XmlUI": "" - }, - "4": { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "b": 1, - "g": 1, - "r": 1 - }, - "Description": "- General refactoring of code involving encounter card drawing, metadata, and the deck importer.\n- Added context menu option to Well-Connected to auto-calculate its skill bonus.\n- Fixed clues not spawning properly at very high clue counts.\n- Underworld Market helper no longer breaks when saving and loading.", - "DragSelectable": true, - "GMNotes": "", - "GUID": "e4e509", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Notecard", - "Nickname": "Arkham SCE 3.3.0 - 10/9/2023 - Page 4", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -26.88849, - "posY": 1.551499, - "posZ": -60.2882576, - "rotX": 0, - "rotY": 90, - "rotZ": 0, - "scaleX": 3, - "scaleY": 1, - "scaleZ": 3 - }, - "Value": 0, - "XmlUI": "" - }, - "5": { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "Autoraise": true, - "ColorDiffuse": { - "b": 1, - "g": 1, - "r": 1 - }, - "Description": "- Fixed Token Arranger to be much less likely to \"explode\".\n- Resource spawning via hotkey on a card now auto-detects the right type of resource to spawn.\n- Various bits of community content have been updated to their most recent Workshop versions.\n\n- Thank you everyone for continuing to report bugs and create content for the mod!", - "DragSelectable": true, - "GMNotes": "", - "GUID": "c0ef49", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Notecard", - "Nickname": "Arkham SCE 3.3.0 - 10/9/2023 - Page 5", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -25.7359982, - "posY": 1.70084918, - "posZ": -59.9714432, - "rotX": 0, - "rotY": 90, - "rotZ": 0, + "posX": -23.74739, + "posY": 1.55149889, + "posZ": -57.1334763, + "rotX": 2.26350938e-8, + "rotY": 90.00001, + "rotZ": 2.55191921e-8, "scaleX": 3, "scaleY": 1, "scaleZ": 3 @@ -206184,7 +199104,7 @@ "Sticky": true, "Tooltip": true, "Transform": { - "posX": -26.978, + "posX": -27, "posY": 1.551, "posZ": -56.165, "rotX": 0, @@ -206196,91 +199116,6 @@ }, "Value": 0, "XmlUI": "" - }, - { - "AltLookAngle": { - "x": 0, - "y": 0, - "z": 0 - }, - "AttachedDecals": [ - { - "CustomDecal": { - "ImageURL": "http://cloud-3.steamusercontent.com/ugc/959719855119695911/931B9829687A20F4DEADB36DA57B7E6D76792231/", - "Name": "dunwich_back", - "Size": 7.4 - }, - "Transform": { - "posX": -0.0021877822, - "posY": -0.08963572, - "posZ": -0.00288731651, - "rotX": 270, - "rotY": 359.869568, - "rotZ": 0, - "scaleX": 2.00000215, - "scaleY": 2.00000238, - "scaleZ": 2.00000262 - } - } - ], - "Autoraise": true, - "ColorDiffuse": { - "b": 0.40592, - "g": 0.40592, - "r": 0.40592 - }, - "CustomMesh": { - "CastShadows": true, - "ColliderURL": "", - "Convex": true, - "CustomShader": { - "FresnelStrength": 0, - "SpecularColor": { - "b": 1, - "g": 1, - "r": 1 - }, - "SpecularIntensity": 0, - "SpecularSharpness": 2 - }, - "DiffuseURL": "https://i.ibb.co/SrtzMNN/souls-of-darkness.png", - "MaterialIndex": 3, - "MeshURL": "https://raw.githubusercontent.com/RobMayer/TTSLibrary/master/advboxes/tuckbox_h_MSH.obj", - "NormalURL": "", - "TypeIndex": 0 - }, - "Description": "", - "DragSelectable": true, - "GMNotes": "fancreations/campaign_souls_of_darkness.json", - "GUID": "a94e6b", - "Grid": true, - "GridProjection": false, - "Hands": false, - "HideWhenFaceDown": false, - "IgnoreFoW": false, - "LayoutGroupSortIndex": 0, - "Locked": false, - "LuaScript": "-- Bundled by luabundle {\"version\":\"1.6.0\"}\nlocal __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)\n\tlocal loadingPlaceholder = {[{}] = true}\n\n\tlocal register\n\tlocal modules = {}\n\n\tlocal require\n\tlocal loaded = {}\n\n\tregister = function(name, body)\n\t\tif not modules[name] then\n\t\t\tmodules[name] = body\n\t\tend\n\tend\n\n\trequire = function(name)\n\t\tlocal loadedModule = loaded[name]\n\n\t\tif loadedModule then\n\t\t\tif loadedModule == loadingPlaceholder then\n\t\t\t\treturn nil\n\t\t\tend\n\t\telse\n\t\t\tif not modules[name] then\n\t\t\t\tif not superRequire then\n\t\t\t\t\tlocal identifier = type(name) == 'string' and '\\\"' .. name .. '\\\"' or tostring(name)\n\t\t\t\t\terror('Tried to require ' .. identifier .. ', but no such module has been registered')\n\t\t\t\telse\n\t\t\t\t\treturn superRequire(name)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tloaded[name] = loadingPlaceholder\n\t\t\tloadedModule = modules[name](require, loaded, register, modules)\n\t\t\tloaded[name] = loadedModule\n\t\tend\n\n\t\treturn loadedModule\n\tend\n\n\treturn require, loaded, register, modules\nend)(nil)\n__bundle_register(\"__root\", function(require, _LOADED, __bundle_register, __bundle_modules)\nrequire(\"core/DownloadBox\")\nend)\n__bundle_register(\"core/DownloadBox\", function(require, _LOADED, __bundle_register, __bundle_modules)\nfunction onLoad()\n local notes = self.getGMNotes()\n\n -- default parameters (e.g. scenarios)\n local buttonParameters = {\n label = \"Download\",\n click_function = \"buttonClick_download\",\n function_owner = self,\n position = { x = 0, y = 0.1, z = 2.1 },\n height = 250,\n width = 800,\n font_size = 150,\n color = { 0, 0, 0 },\n font_color = { 1, 1, 1 }\n }\n\n -- return to boxes\n if string.match(notes, \"................\") == \"campaigns/return\" then\n buttonParameters.position.z = 2\n\n -- official campaign boxes\n elseif string.match(notes, \".........\") == \"campaigns\" or self.hasTag(\"LargeBox\") then\n buttonParameters.position.z = 6\n buttonParameters.height = 500\n buttonParameters.width = 1700\n buttonParameters.font_size = 350\n\n -- investigator boxes\n elseif string.match(notes, \".............\") == \"investigators\" then\n buttonParameters.position.z = 7\n buttonParameters.height = 850\n buttonParameters.width = 3400\n buttonParameters.font_size = 700\n end\n\n self.createButton(buttonParameters)\nend\n\nfunction buttonClick_download()\n Global.call('placeholder_download', { url = self.getGMNotes(), replace = self.guid })\nend\nend)\nreturn __bundle_require(\"__root\")", - "LuaScriptState": "", - "MeasureMovement": false, - "Name": "Custom_Model", - "Nickname": "Souls of Darkness", - "Snap": true, - "Sticky": true, - "Tooltip": true, - "Transform": { - "posX": -26.956, - "posY": 1.481, - "posZ": -84.507, - "rotX": 0, - "rotY": 270, - "rotZ": 0, - "scaleX": 2.21, - "scaleY": 0.46, - "scaleZ": 2.42 - }, - "Value": 0, - "XmlUI": "" } ], "PlayArea": 1, @@ -206292,7 +199127,7 @@ 0, 0 ], - "SaveName": "Arkham SCE - 3.3.0", + "SaveName": "Arkham SCE - 3.4.0", "Sky": "Sky_Museum", "SkyURL": "https://i.imgur.com/GkQqaOF.jpg", "SnapPoints": [ @@ -206725,5 +199560,5 @@ "Type": 0 }, "VersionNumber": "v13.2.2", - "XmlUI": "\u003c!-- include Global.xml --\u003e\n\u003c!-- Default formatting --\u003e\n\u003cDefaults\u003e\n \u003c!-- general Stuff --\u003e\n \u003cText color=\"white\"\n fontSize=\"18\"/\u003e\n \u003cButton tooltipPosition=\"Left\"\n color=\"clear\"/\u003e\n\n \u003c!-- Window --\u003e\n \u003cHorizontalLayout class=\"headerLayout\"\n height=\"75\"\n padding=\"5\"/\u003e\n \u003cButton class=\"headerButton\"\n minWidth=\"50\"\n preferredWidth=\"50\"\n flexibleWidth=\"0\"\n color=\"clear\"/\u003e\n \u003cText class=\"headerText\"\n minWidth=\"200\"\n flexibleWidth=\"100\"\n fontSize=\"32\"\n font=\"font_teutonic-arkham\"/\u003e\n\u003c/Defaults\u003e\n\n\u003c!-- Buttons at the bottom right (height: n * 35 + (n-1) * 2) --\u003e\n\u003cVerticalLayout visibility=\"Admin\"\n color=\"#000000\"\n outlineSize=\"1 1\"\n outline=\"#303030\"\n rectAlignment=\"LowerRight\"\n width=\"35\"\n height=\"146\"\n offsetXY=\"-1 120\"\n spacing=\"2\"\u003e\n \u003cButton icon=\"cthulhu\"\n tooltip=\"Campaigns\"\n onClick=\"onClick_toggleUi(Campaigns)\"/\u003e\n \u003cButton icon=\"dark-cult\"\n tooltip=\"Standalone Scenarios\"\n onClick=\"onClick_toggleUi(Standalone Scenarios)\"/\u003e\n \u003cButton icon=\"devourer\"\n tooltip=\"Community Content\"\n onClick=\"onClick_toggleUi(Community Content)\"/\u003e\n \u003cButton icon=\"option-gear\"\n tooltip=\"Options\"\n onClick=\"onClick_toggleUi(Options)\"/\u003e\n\u003c/VerticalLayout\u003e\n\n\u003c!-- Navigation Overlay button (not visibly to Grey and Black) --\u003e\n\u003cPanel visibility=\"White|Brown|Red|Orange|Yellow|Green|Teal|Blue|Purple|Pink\"\n color=\"#000000\"\n outlineSize=\"1 1\"\n outline=\"#303030\"\n rectAlignment=\"LowerRight\"\n width=\"35\"\n height=\"35\"\n offsetXY=\"-1 65\"\u003e\n \u003cButton icon=\"NavigationOverlayIcon\"\n tooltip=\"Navigation Overlay\"\n onClick=\"onClick_toggleUi(Navigation Overlay)\"/\u003e\n\u003c/Panel\u003e\n\n\u003c!-- Basic UI that will be replaced based on title --\u003e\n\u003cVerticalLayout id=\"load_ui\"\n visibility=\"Admin\"\n color=\"black\"\n active=\"false\"\n width=\"700\"\n height=\"780\"\n outlineSize=\"1 1\"\n outline=\"#303030\"\u003e\n \u003cHorizontalLayout class=\"headerLayout\"\u003e\n \u003cButton class=\"headerButton\"\n icon=\"refresh\"\n tooltip=\"Refresh List\"\n tooltipPosition=\"Right\"\n onClick=\"onClick_refreshList\"/\u003e\n \u003cText id=\"title\"\n class=\"headerText\"\u003eLoadable Items\u003c/Text\u003e\n \u003cButton class=\"headerButton\"\n icon=\"close\"\n tooltip=\"Close\"\n onClick=\"onClick_toggleUi(Hidden)\"/\u003e\n \u003c/HorizontalLayout\u003e\n \u003cVerticalScrollView color=\"transparent\"\n minHeight=\"100\"\n flexibleHeight=\"100\"\u003e\n \u003cPanel id=\"ui_update_height\"\n height=\"24\"\u003e\n \u003cVerticalLayout id=\"ui_update_point\"\n padding=\"10\"\u003e\n \u003cText\u003ePlease refresh to see available items.\u003c/Text\u003e\n \u003c/VerticalLayout\u003e\n \u003c/Panel\u003e\n \u003c/VerticalScrollView\u003e\n \u003cPanel color=\"rgb(0,0,0)\"\n minHeight=\"50\"\n preferredHeight=\"50\"\n flexibleHeight=\"0\"\u003e\n \u003cButton id=\"load_button\"\n active=\"false\"\n onClick=\"onClick_load\"\u003eLoad:\u003c/Button\u003e\n \u003cHorizontalLayout id=\"progress_display\"\u003e\n \u003cProgressBar id=\"download_progress\"\n percentage=\"0\"\n color=\"#000000\"\n fillImageColor=\"#333333\"/\u003e\n \u003cButton onClick=\"onClick_cancel\"\n active=\"false\"\u003eCancel\u003c/Button\u003e\n \u003c/HorizontalLayout\u003e\n \u003c/Panel\u003e\n\u003c/VerticalLayout\u003e\n\n\u003c!-- include TitleSplash.xml --\u003e\n\u003c!-- Title Splash when starting a scenario --\u003e\n\u003cPanel id=\"title_splash\"\n height=\"220\"\n position=\"0 250 0\"\n showAnimation=\"FadeIn\"\n hideAnimation=\"FadeOut\"\n active=\"false\"\n animationDuration=\"2\"\u003e\n \u003cImage id=\"title_gradient\"\n height=\"220\"\n image=\"TitleGradient\" /\u003e\n \u003cText id=\"title_splash_text\"\n width=\"95%\"\n height=\"180\"\n resizeTextForBestFit=\"true\"\n resizeTextMinSize=\"100\"\n resizeTextMaxSize=\"150\"\n font=\"font_teutonic-arkham\"\n outline=\"black\"\n outlineSize=\"3 -3\"\n horizontalOverflow=\"Overflow\"\u003e\n \u003c/Text\u003e\n\u003c/Panel\u003e\n\u003c!-- include TitleSplash.xml --\u003e\n\u003c!-- include NavigationOverlay.xml --\u003e\n\u003c!-- Default formatting --\u003e\n\u003cDefaults\u003e\n \u003cText color=\"#FFFFFF\"\n alignment=\"MiddleLeft\" /\u003e\n\n \u003cToggle isOn=\"False\"\n rectAlignment=\"MiddleRight\" /\u003e\n\n \u003cCell dontUseTableCellBackground=\"true\"\n outlineSize=\"0 1\"\n outline=\"grey\" /\u003e\n\n \u003c!-- options --\u003e\n \u003cRow class=\"nav_option-text\"\n preferredHeight=\"45\"/\u003e\n \u003cCell class=\"nav_option-text\"\n color=\"#333333\"/\u003e\n \u003cCell class=\"nav_option-button\"\n color=\"#333333\"/\u003e\n \u003cText class=\"nav_option-header\"\n fontSize=\"20\"\n font=\"font_teutonic-arkham\"/\u003e\n \u003cCell class=\"claim\"\n tooltip=\"Clicking this seat in the navigation overlay will now only swap the playercolor for you.\"\n tooltipPosition=\"Right\" /\u003e\n\n \u003c!-- buttons at the bottom --\u003e\n \u003cButton class=\"bottomButtons\"\n hoverClass=\"hover\"\n pressClass=\"press\"\n selectClass=\"select\"\n color=\"#888888\"\n minHeight=\"35\"\n fontSize=\"24\"\n font=\"font_teutonic-arkham\"/\u003e\n \u003cButton class=\"hover\"\n color=\"grey\"/\u003e\n \u003cButton class=\"press\"\n color=\"white\"/\u003e\n \u003cButton class=\"select\"\n color=\"white\"/\u003e\n\n \u003c!-- Navigation Panels --\u003e\n \u003cPanel class=\"navPanel\"\n active=\"false\"\n allowDragging=\"true\"\n rectAlignment=\"LowerRight\"\n returnToOriginalPositionWhenReleased=\"false\"\n offsetXY=\"-40 0\"\u003e\n \u003c/Panel\u003e\n\u003c/Defaults\u003e\n\n\u003c!-- full Panel --\u003e\n\u003cPanel id=\"navPanelFull\"\n height=\"358\"\n width=\"455\"\n class=\"navPanel\"\u003e\n\u003c/Panel\u003e\n\n\u003c!-- Play Area only --\u003e\n\u003cPanel id=\"navPanelPlay\"\n height=\"208\"\n width=\"205\"\n class=\"navPanel\"\u003e\n\u003c/Panel\u003e\n\n\u003c!-- Settings --\u003e\n\u003cTableLayout id=\"navPanelSettings\"\n active=\"false\"\n width=\"300\"\n height=\"335\"\n color=\"#000000\"\n outlineSize=\"2 2\"\n outline=\"grey\"\n rectAlignment=\"MiddleCenter\"\u003e\n\n \u003c!-- Header --\u003e\n \u003cRow preferredHeight=\"60\"\u003e\n \u003cCell\u003e\n \u003cPanel padding=\"10 0 0 0\"\u003e\n \u003cText font=\"font_teutonic-arkham\"\n fontSize=\"35\"\u003eNavigation Overlay\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Options --\u003e\n \u003cRow\u003e\n \u003cCell\u003e\n \u003cTableLayout columnWidths=\"0 125\"\n autoCalculateHeight=\"1\"\n cellPadding=\"10 0 5 5\"\u003e\n\n \u003c!-- Option: Custom pitch --\u003e\n \u003cRow class=\"nav_option-text\"\u003e\n \u003cCell class=\"nav_option-text\"\u003e\n \u003cText class=\"nav_option-header\"\u003eViewing angle in degrees:\u003c/Text\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"nav_option-button\"\u003e\n \u003cSlider id=\"sliderPitch\"\n onValueChanged=\"797ede/updatePitch\"\n wholeNumbers=\"true\"\n minValue=\"0\"\n maxValue=\"90\"\n value=\"75\"\n tooltip=\"This controls the camera pitch ('nodding your head').\"\n tooltipPosition=\"Right\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: Claim White --\u003e\n \u003cRow class=\"nav_option-text\"\u003e\n \u003cCell class=\"nav_option-text\"\u003e\n \u003cText class=\"nav_option-header\"\u003eClaim \"White\" seat\u003c/Text\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"nav_option-button claim\"\u003e\n \u003cToggle id=\"claimWhite\"\n onValueChanged=\"797ede/claimColor(White)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: Claim Orange --\u003e\n \u003cRow class=\"nav_option-text\"\u003e\n \u003cCell class=\"nav_option-text\"\u003e\n \u003cText class=\"nav_option-header\"\u003eClaim \"Orange\" seat\u003c/Text\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"nav_option-button claim\"\u003e\n \u003cToggle id=\"claimOrange\"\n onValueChanged=\"797ede/claimColor(Orange)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: Claim Green --\u003e\n \u003cRow class=\"nav_option-text\"\u003e\n \u003cCell class=\"nav_option-text\"\u003e\n \u003cText class=\"nav_option-header\"\u003eClaim \"Green\" seat\u003c/Text\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"nav_option-button claim\"\u003e\n \u003cToggle id=\"claimGreen\"\n onValueChanged=\"797ede/claimColor(Green)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: Claim Red --\u003e\n \u003cRow class=\"nav_option-text\"\u003e\n \u003cCell class=\"nav_option-text\"\u003e\n \u003cText class=\"nav_option-header\"\u003eClaim \"Red\" seat\u003c/Text\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"nav_option-button claim\"\u003e\n \u003cToggle id=\"claimRed\"\n onValueChanged=\"797ede/claimColor(Red)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n \u003c/TableLayout\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Buttons: Defaults and Close --\u003e\n \u003cRow preferredHeight=\"50\"\u003e\n \u003cCell\u003e\n \u003cHorizontalLayout minHeight=\"55\"\n flexibleHeight=\"0\"\n padding=\"10 10 5 10\"\n spacing=\"35\"\u003e\n \u003cButton class=\"bottomButtons\"\n onClick=\"797ede/loadDefaultSettings\"\u003eLoad defaults\u003c/Button\u003e\n \u003cButton class=\"bottomButtons\"\n onClick=\"797ede/toggleSettings\"\u003eClose\u003c/Button\u003e\n \u003c/HorizontalLayout\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\u003c/TableLayout\u003e\n\u003c!-- include NavigationOverlay.xml --\u003e\n\u003c!-- include OptionPanel.xml --\u003e\n\u003c!-- Default formatting --\u003e\n\u003cDefaults\u003e\n \u003cText color=\"#FFFFFF\"\n alignment=\"MiddleLeft\" /\u003e\n\n \u003cToggle isOn=\"False\"\n rectAlignment=\"MiddleRight\" /\u003e\n\n \u003cDropdown rectAlignment=\"MiddleCenter\" /\u003e\n\n \u003cCell dontUseTableCellBackground=\"true\"\n outlineSize=\"0 1\"\n outline=\"grey\" /\u003e\n\n \u003c!-- main window --\u003e\n \u003cTableLayout class=\"window\"\n width=\"500\"\n height=\"800\"\n active=\"false\"\n color=\"#000000\"\n outlineSize=\"2 2\"\n outline=\"grey\"\n showAnimation=\"SlideIn_Right\"\n hideAnimation=\"SlideOut_Right\"\n animationDuration=\"0.2\" /\u003e\n\n \u003c!-- group headers --\u003e\n \u003cRow class=\"group-header\"\n preferredHeight=\"54\" /\u003e\n \u003cCell class=\"group-header\"\n columnSpan=\"3\"\n color=\"#222222\" /\u003e\n \u003cPanel class=\"group-header\"\n padding=\"5 0 0 0\" /\u003e\n \u003cText class=\"group-header\"\n fontSize=\"28\"\n font=\"font_teutonic-arkham\" /\u003e\n\n \u003c!-- options --\u003e\n \u003cRow class=\"option-text\"\n preferredHeight=\"70\"/\u003e\n \u003cCell class=\"option-text\"\n color=\"#333333\"\n columnSpan=\"2\"/\u003e\n \u003cCell class=\"option-button\"\n color=\"#333333\"/\u003e\n \u003cCell class=\"option-dropdowntext\"\n color=\"#333333\"\n columnSpan=\"1\"/\u003e\n \u003cCell class=\"option-dropdown\"\n color=\"#333333\"\n columnSpan=\"2\"/\u003e\n \u003cVerticalLayout class=\"text-column\"\n padding=\"10 0 0 0\"\n spacing=\"5\"/\u003e\n \u003cText class=\"option-header\"\n fontSize=\"20\"\n font=\"font_teutonic-arkham\"/\u003e\n \u003cText class=\"description\"\n fontSize=\"12\"/\u003e\n\n \u003c!-- buttons at the bottom --\u003e\n \u003cButton class=\"bottomButtons\"\n hoverClass=\"hover\"\n pressClass=\"press\"\n selectClass=\"select\"\n color=\"#888888\"\n minHeight=\"35\"\n fontSize=\"24\"\n font=\"font_teutonic-arkham\"/\u003e\n \u003cButton class=\"hover\"\n color=\"grey\"/\u003e\n \u003cButton class=\"press\"\n color=\"white\"/\u003e\n \u003cButton class=\"select\"\n color=\"white\"/\u003e\n\u003c/Defaults\u003e\n\n\u003c!-- Option Panel --\u003e\n\u003cTableLayout id=\"optionPanel\"\n class=\"window\"\n active=\"false\"\n rectAlignment=\"LowerRight\"\n offsetXY=\"-50 80\"\u003e\n \u003c!-- Header: Options --\u003e\n \u003cRow preferredHeight=\"60\"\u003e\n \u003cCell\u003e\n \u003cPanel padding=\"10 0 0 0\"\u003e\n \u003cText font=\"font_teutonic-arkham\"\n fontSize=\"35\"\u003eOptions\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Scrollable part with options --\u003e\n \u003cRow\u003e\n \u003cCell\u003e\n \u003cVerticalScrollView horizontalScrollbarVisibility=\"AutohideAndExpandViewport\"\u003e\n \u003cTableLayout columnWidths=\"0 100 75\"\n autoCalculateHeight=\"1\"\n cellPadding=\"10 5 5 5\"\u003e\n\n \u003c!-- Group: general settings --\u003e\n \u003cRow class=\"group-header\"\u003e\n \u003cCell class=\"group-header\"\u003e\n \u003cPanel class=\"group-header\"\n image=\"header_acolyte\"\u003e\n \u003cText class=\"group-header\"\u003eGENERAL SETTINGS\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: card language --\u003e\n \u003cRow class=\"option-text\"\u003e\n \u003cCell class=\"option-dropdowntext\"\u003e\n \u003cVerticalLayout class=\"text-column\"\u003e\n \u003cText class=\"option-header\"\u003eCard language\u003c/Text\u003e\n \u003cText class=\"description\"\u003eDownloading a campaign or importing a deck will use this language for cards (NOT FUNCTIONAL YET!).\u003c/Text\u003e\n \u003c/VerticalLayout\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"option-dropdown\"\u003e\n \u003cPanel padding=\"0 17 13 13\"\u003e\n \u003cDropdown id=\"cardLanguage\"\n onValueChanged=\"languageSelected(selectedIndex)\"\u003e\n \u003cOption\u003e简体中文\u003c/Option\u003e\n \u003cOption\u003e繁體中文\u003c/Option\u003e\n \u003cOption\u003eDeutsch\u003c/Option\u003e\n \u003cOption\u003eEnglish\u003c/Option\u003e\n \u003cOption\u003eEspañol\u003c/Option\u003e\n \u003cOption\u003eFrançais\u003c/Option\u003e\n \u003cOption\u003eItaliano\u003c/Option\u003e\n \u003c/Dropdown\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: play area snap tags --\u003e\n \u003cRow class=\"option-text\"\u003e\n \u003cCell class=\"option-text\"\u003e\n \u003cVerticalLayout class=\"text-column\"\u003e\n \u003cText class=\"option-header\"\u003eEnable snap tags for play area\u003c/Text\u003e\n \u003cText class=\"description\"\u003eOnly cards with the tag \"Location\" will snap (official cards are supported by default). Disable this if you are having issues with custom content.\u003c/Text\u003e\n \u003c/VerticalLayout\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"option-button\"\u003e\n \u003cToggle id=\"playAreaSnapTags\"\n onValueChanged=\"onClick_toggleOption(playAreaSnapTags)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: splash scenario name on setup --\u003e\n \u003cRow class=\"option-text\"\u003e\n \u003cCell class=\"option-text\"\u003e\n \u003cVerticalLayout class=\"text-column\"\u003e\n \u003cText class=\"option-header\"\u003eShow scenario title on setup\u003c/Text\u003e\n \u003cText class=\"description\"\u003eFade in the name of the scenario for 2 seconds when placing down a scenario.\u003c/Text\u003e\n \u003c/VerticalLayout\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"option-button\"\u003e\n \u003cToggle id=\"showTitleSplash\"\n onValueChanged=\"onClick_toggleOption(showTitleSplash)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Group: playermat settings --\u003e\n \u003cRow class=\"group-header\"\u003e\n \u003cCell class=\"group-header\"\u003e\n \u003cPanel class=\"group-header\"\n image=\"header_cover\"\u003e\n \u003cText class=\"group-header\"\u003ePLAYERMAT SETTINGS\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: enable snap tags --\u003e\n \u003cRow class=\"option-text\"\u003e\n \u003cCell class=\"option-text\"\u003e\n \u003cVerticalLayout class=\"text-column\"\u003e\n \u003cText class=\"option-header\"\u003eEnable snap tags\u003c/Text\u003e\n \u003cText class=\"description\"\u003eOnly cards with the tag \"Asset\" will snap (official cards are supported by default). Disable this if you are having issues with custom content.\u003c/Text\u003e\n \u003c/VerticalLayout\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"option-button\"\u003e\n \u003cToggle id=\"useSnapTags\"\n onValueChanged=\"onClick_toggleOption(useSnapTags)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: show draw 1 button --\u003e\n \u003cRow class=\"option-text\"\u003e\n \u003cCell class=\"option-text\"\u003e\n \u003cVerticalLayout class=\"text-column\"\u003e\n \u003cText class=\"option-header\"\u003eShow \"Draw 1\" button\u003c/Text\u003e\n \u003cText class=\"description\"\u003eDisplays a button below the \"Upkeep\" button that draws a card from your deck. Useful for multi-handed solo play.\u003c/Text\u003e\n \u003c/VerticalLayout\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"option-button\"\u003e\n \u003cToggle id=\"showDrawButton\"\n onValueChanged=\"onClick_toggleOption(showDrawButton)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: use clickable clue-counters --\u003e\n \u003cRow class=\"option-text\"\u003e\n \u003cCell class=\"option-text\"\u003e\n \u003cVerticalLayout class=\"text-column\"\u003e\n \u003cText class=\"option-header\"\u003eUse clickable clue counters\u003c/Text\u003e\n \u003cText class=\"description\"\u003eInstead of automatically counting clues in the respective area on your playermat, this displays a clickable counter for clues.\u003c/Text\u003e\n \u003c/VerticalLayout\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"option-button\"\u003e\n \u003cToggle id=\"useClueClickers\"\n onValueChanged=\"onClick_toggleOption(useClueClickers)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: use clickable resource counters --\u003e\n \u003cRow class=\"option-text\"\u003e\n \u003cCell class=\"option-dropdowntext\"\u003e\n \u003cVerticalLayout class=\"text-column\"\u003e\n \u003cText class=\"option-header\"\u003eUse clickable resource tokens\u003c/Text\u003e\n \u003cText class=\"description\"\u003eThis enables spawning of clickable resource tokens for player cards. (Chef's Selection = assets with 0 uses)\u003c/Text\u003e\n \u003c/VerticalLayout\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"option-dropdown\"\u003e\n \u003cPanel padding=\"0 17 13 13\"\u003e\n \u003cDropdown id=\"useResourceCounters\"\n onValueChanged=\"resourceCounterSelected(selectedIndex)\"\u003e\n \u003cOption\u003eEnabled\u003c/Option\u003e\n \u003cOption\u003eChef's Selection\u003c/Option\u003e\n \u003cOption\u003eDisabled\u003c/Option\u003e\n \u003c/Dropdown\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Group: fan-made accessories --\u003e\n \u003cRow class=\"group-header\"\u003e\n \u003cCell class=\"group-header\"\u003e\n \u003cPanel class=\"group-header\"\n image=\"header_olive\"\u003e\n \u003cText class=\"group-header\"\u003eFAN-MADE ACCESSORIES\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: show attachment helper --\u003e\n \u003cRow class=\"option-text\"\u003e\n \u003cCell class=\"option-text\"\u003e\n \u003cVerticalLayout class=\"text-column\"\u003e\n \u003cText class=\"option-header\"\u003eAttachment Helper\u003c/Text\u003e\n \u003cText class=\"description\"\u003eProvides a card-sized bag for cards that are attached to other cards (e.g. Backpack).\u003c/Text\u003e\n \u003c/VerticalLayout\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"option-button\"\u003e\n \u003cToggle id=\"showAttachmentHelper\"\n onValueChanged=\"onClick_toggleOption(showAttachmentHelper)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: show clean up helper --\u003e\n \u003cRow class=\"option-text\"\u003e\n \u003cCell class=\"option-text\"\u003e\n \u003cVerticalLayout class=\"text-column\"\u003e\n \u003cText class=\"option-header\"\u003eClean Up Helper\u003c/Text\u003e\n \u003cText class=\"description\"\u003eUseful for campaign-play: It resets play areas to allow continuous gameplay in the same savegame.\u003c/Text\u003e\n \u003c/VerticalLayout\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"option-button\"\u003e\n \u003cToggle id=\"showCleanUpHelper\"\n onValueChanged=\"onClick_toggleOption(showCleanUpHelper)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: show custom playmat images --\u003e\n \u003cRow class=\"option-text\"\u003e\n \u003cCell class=\"option-text\"\u003e\n \u003cVerticalLayout class=\"text-column\"\u003e\n \u003cText class=\"option-header\"\u003eCustom Playmat Images\u003c/Text\u003e\n \u003cText class=\"description\"\u003ePlaces a tool that displays custom playmat images for all cycles in a gallery-like fashion.\u003c/Text\u003e\n \u003c/VerticalLayout\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"option-button\"\u003e\n \u003cToggle id=\"showCustomPlaymatImages\"\n onValueChanged=\"onClick_toggleOption(showCustomPlaymatImages)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: show CYOA campaign guides --\u003e\n \u003cRow class=\"option-text\"\u003e\n \u003cCell class=\"option-text\"\u003e\n \u003cVerticalLayout class=\"text-column\"\u003e\n \u003cText class=\"option-header\"\u003eCYOA Campaign Guides\u003c/Text\u003e\n \u003cText class=\"description\"\u003eDisplays in a \"Choose Your Own Adventure\" style redesigned campaign guides.\u003c/Text\u003e\n \u003c/VerticalLayout\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"option-button\"\u003e\n \u003cToggle id=\"showCYOA\"\n onValueChanged=\"onClick_toggleOption(showCYOA)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: show displacement tool --\u003e\n \u003cRow class=\"option-text\"\u003e\n \u003cCell class=\"option-text\"\u003e\n \u003cVerticalLayout class=\"text-column\"\u003e\n \u003cText class=\"option-header\"\u003eDisplacement Tool\u003c/Text\u003e\n \u003cText class=\"description\"\u003eThis allows moving all objects on the main playmat in a chosen direction.\u003c/Text\u003e\n \u003c/VerticalLayout\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"option-button\"\u003e\n \u003cToggle id=\"showDisplacementTool\"\n onValueChanged=\"onClick_toggleOption(showDisplacementTool)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: show hand helper --\u003e\n \u003cRow class=\"option-text\"\u003e\n \u003cCell class=\"option-text\"\u003e\n \u003cVerticalLayout class=\"text-column\"\u003e\n \u003cText class=\"option-header\"\u003eHand Helper\u003c/Text\u003e\n \u003cText class=\"description\"\u003eNever count your hand cards again! This tool does that for you and additionally enables easy discarding of random cards.\u003c/Text\u003e\n \u003c/VerticalLayout\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"option-button\"\u003e\n \u003cToggle id=\"showHandHelper\"\n onValueChanged=\"onClick_toggleOption(showHandHelper)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: show search assistant --\u003e\n \u003cRow class=\"option-text\"\u003e\n \u003cCell class=\"option-text\"\u003e\n \u003cVerticalLayout class=\"text-column\"\u003e\n \u003cText class=\"option-header\"\u003eSearch Assistant\u003c/Text\u003e\n \u003cText class=\"description\"\u003eQuickly search 3, 6, 9 or the top X cards of your deck!\u003c/Text\u003e\n \u003c/VerticalLayout\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"option-button\"\u003e\n \u003cToggle id=\"showSearchAssistant\"\n onValueChanged=\"onClick_toggleOption(showSearchAssistant)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n \u003c/TableLayout\u003e\n \u003c/VerticalScrollView\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Buttons: Defaults and Close --\u003e\n \u003cRow preferredHeight=\"50\"\u003e\n \u003cCell\u003e\n \u003cHorizontalLayout minHeight=\"55\"\n flexibleHeight=\"0\"\n padding=\"10 10 5 10\"\n spacing=\"225\"\u003e\n \u003cButton class=\"bottomButtons\"\n onClick=\"onClick_defaultSettings\"\u003eLoad defaults\u003c/Button\u003e\n \u003cButton class=\"bottomButtons\"\n onClick=\"onClick_toggleUi(Hidden)\"\u003eClose\u003c/Button\u003e\n \u003c/HorizontalLayout\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\u003c/TableLayout\u003e\n\u003c!-- include OptionPanel.xml --\u003e\n\u003c!-- include UpdateNotification.xml --\u003e\n\u003c!-- Default formatting inherented from OptionPanel! --\u003e\n\n\u003c!-- Icon with Finn, which can be clicked --\u003e\n\u003cImage id=\"FinnIcon\"\n active=\"false\"\n showAnimation=\"SlideIn_Top\"\n hideAnimation=\"SlideOut_Top\"\n animationDuration=\"0.2\"\n rectAlignment=\"UpperLeft\"\n offsetXY=\"420 -5\"\n height=\"90\"\n width=\"90\"\n onClick=\"onClick_FinnIcon\"\n image=\"FinnIcon\"\n tooltip=\"Update notification\"\n tooltipBackgroundColor=\"rgba(0,0,0,0.8)\"/\u003e\n\n\u003c!-- main notification window --\u003e\n\u003cTableLayout id=\"updateNotification\"\n active=\"false\"\n color=\"#000000\"\n outlineSize=\"2 2\"\n outline=\"grey\"\n showAnimation=\"SlideIn_Top\"\n hideAnimation=\"SlideOut_Top\"\n animationDuration=\"0.2\"\n rectAlignment=\"UpperLeft\"\n offsetXY=\"60 -5\"\n height=\"225\"\n width=\"350\"\u003e\n\n \u003c!-- Header --\u003e\n \u003cRow preferredHeight=\"50\"\u003e\n \u003cCell\u003e\n \u003cPanel padding=\"10 10 0 0\"\u003e\n \u003c!-- this part will be updated via script --\u003e\n \u003cText id=\"notificationHeader\"\n font=\"font_teutonic-arkham\"\n fontSize=\"30\"\n alignment=\"MiddleCenter\"\u003ePlaceholder\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- patch highlights --\u003e\n \u003cRow id=\"highlightRow\"\n preferredHeight=\"100\"\u003e\n \u003cCell\u003e\n \u003cPanel padding=\"15 15 0 7\"\u003e\n \u003c!-- this part will be updated via script --\u003e\n \u003cText id=\"releaseHighlightText\"\n resizeTextForBestFit=\"true\"\u003ePlaceholder\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- explanation --\u003e\n \u003cRow preferredHeight=\"25\"\u003e\n \u003cCell\u003e\n \u003cPanel padding=\"15 15 0 7\"\u003e\n \u003cText resizeTextForBestFit=\"true\"\u003eVisit the usual place to receive this update.\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Buttons: \"Don't show again\" and \"Close\" --\u003e\n \u003cRow preferredHeight=\"50\"\u003e\n \u003cCell\u003e\n \u003cHorizontalLayout minHeight=\"55\"\n flexibleHeight=\"0\"\n padding=\"10 10 5 10\"\n spacing=\"10\"\u003e\n \u003cButton class=\"bottomButtons\"\n onClick=\"onClick_notification(dontShowAgain)\"\u003eDon't show again\u003c/Button\u003e\n \u003cButton class=\"bottomButtons\"\n onClick=\"onClick_notification(close)\"\u003eClose\u003c/Button\u003e\n \u003c/HorizontalLayout\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\u003c/TableLayout\u003e\n\u003c!-- include UpdateNotification.xml --\u003e\n\u003c!-- include Global.xml --\u003e" + "XmlUI": "\u003c!-- include Global/Global.xml --\u003e\n\u003cDefaults\u003e\n \u003c!-- general stuff --\u003e\n \u003cText color=\"white\"\n fontSize=\"18\"/\u003e\n\u003c/Defaults\u003e\n\n\u003c!-- include Global/BottomBar.xml --\u003e\n\u003cDefaults\u003e\n \u003cButton class=\"navbar\"\n tooltipPosition=\"Left\"\n tooltipBackgroundColor=\"rgba(0,0,0,1)\"\n color=\"clear\"/\u003e\n\u003c/Defaults\u003e\n\n\u003c!-- Buttons at the bottom right (height: n * 37 - 2) --\u003e\n\u003cVerticalLayout visibility=\"Admin\"\n color=\"#000000\"\n outlineSize=\"1 1\"\n outline=\"#303030\"\n rectAlignment=\"LowerRight\"\n width=\"35\"\n height=\"72\"\n offsetXY=\"-1 120\"\n spacing=\"2\"\u003e\n \u003cButton class=\"navbar\"\n icon=\"devourer\"\n tooltip=\"Downloadable Content\"\n onClick=\"onClick_toggleUi(downloadWindow)\"/\u003e\n \u003cButton class=\"navbar\"\n icon=\"option-gear\"\n tooltip=\"Options\"\n onClick=\"onClick_toggleUi(optionPanel)\"/\u003e\n\u003c/VerticalLayout\u003e\n\n\u003c!-- Navigation Overlay button (not visibly to Grey and Black) --\u003e\n\u003cPanel visibility=\"White|Brown|Red|Orange|Yellow|Green|Teal|Blue|Purple|Pink\"\n color=\"#000000\"\n outlineSize=\"1 1\"\n outline=\"#303030\"\n rectAlignment=\"LowerRight\"\n width=\"35\"\n height=\"35\"\n offsetXY=\"-1 85\"\u003e\n \u003cButton class=\"navbar\"\n icon=\"NavigationOverlayIcon\"\n tooltip=\"Navigation Overlay\"\n onClick=\"onClick_toggleUi(Navigation Overlay)\"/\u003e\n\u003c/Panel\u003e\n\u003c!-- include Global/BottomBar.xml --\u003e\n\u003c!-- include Global/DownloadWindow.xml --\u003e\n\u003cDefaults\u003e\n \u003cButton class=\"downloadTab\"\n hoverClass=\"bGrey\"\n pressClass=\"bWhite\"\n onClick=\"onClick_tab\"\n color=\"#888888\"\n fontSize=\"24\"\n font=\"font_teutonic-arkham\"/\u003e\n \u003cButton class=\"bGrey\"\n color=\"grey\"/\u003e\n \u003cButton class=\"bWhite\"\n color=\"white\"/\u003e\n \u003cButton class=\"activeTab\"\n color=\"#ffffff\"/\u003e\n \u003cButton class=\"windowButton\"\n hoverClass=\"bGrey\"\n pressClass=\"bWhite\"\n selectClass=\"bWhite\"\n color=\"#888888\"\n font=\"font_teutonic-arkham\"/\u003e\n\u003c/Defaults\u003e\n\n\u003c!-- window to select downloadable content --\u003e\n\u003cVerticalLayout id=\"downloadWindow\"\n visibility=\"Admin\"\n color=\"black\"\n active=\"false\"\n height=\"800\"\n width=\"900\"\n outlineSize=\"2 2\"\n outline=\"#303030\"\u003e\n\n \u003c!-- window header --\u003e\n \u003cPanel preferredHeight=\"60\"\n padding=\"10 10 5 5\"\n spacing=\"10\"\n outlineSize=\"2 2\"\n outline=\"#303030\"\n color=\"black\"\u003e\n \u003cText fontSize=\"32\"\n font=\"font_teutonic-arkham\"\n preferredWidth=\"600\"\n alignment=\"MiddleLeft\"\u003eDownloadable Content\u003c/Text\u003e\n \u003cButton id=\"downloadAll_button\"\n class=\"windowButton\"\n visibility=\"Black\"\n onClick=\"onClick_downloadAll\"\n height=\"30\"\n preferredWidth=\"110\"\n fontSize=\"20\"\n tooltip=\"Very rough estimate: 400 MB\"\n tooltipPosition=\"Above\"\n tooltipBackgroundColor=\"rgba(0,0,0,1)\"\u003eDownload Everything\u003c/Button\u003e\n \u003cButton id=\"spawnPlaceholder_button\"\n class=\"windowButton\"\n visibility=\"Black\"\n onClick=\"onClick_spawnPlaceholder\"\n height=\"30\"\n preferredWidth=\"110\"\n fontSize=\"20\"\u003eSpawn Placeholder\u003c/Button\u003e\n \u003cPanel preferredWidth=\"50\"\u003e\n \u003cButton rectAlignment=\"MiddleRight\"\n width=\"50\"\n color=\"clear\"\n icon=\"close\"\n tooltip=\"Close\"\n tooltipPosition=\"Right\"\n tooltipBackgroundColor=\"rgba(0,0,0,1)\"\n onClick=\"onClick_toggleUi(downloadWindow)\"/\u003e\n \u003c/Panel\u003e\n \u003c/Panel\u003e\n\n \u003cHorizontalLayout\u003e\n \u003cVerticalLayout preferredWidth=\"600\"\u003e\n \u003c!-- tab selection --\u003e\n \u003cHorizontalLayout preferredHeight=\"60\"\n padding=\"5\"\n spacing=\"5\"\u003e\n \u003cButton class=\"downloadTab activeTab\"\n id=\"tab1\"\u003eOfficial Campaigns\u003c/Button\u003e\n \u003cButton class=\"downloadTab\"\n id=\"tab2\"\u003eOfficial Scenarios\u003c/Button\u003e\n \u003cButton class=\"downloadTab\"\n id=\"tab3\"\u003eFan-Made Campaigns\u003c/Button\u003e\n \u003cButton class=\"downloadTab\"\n id=\"tab4\"\u003eFan-Made Scenarios\u003c/Button\u003e\n \u003cButton class=\"downloadTab\"\n id=\"tab5\"\u003eFan-Made Player Cards\u003c/Button\u003e\n \u003c/HorizontalLayout\u003e\n\n \u003c!-- content list --\u003e\n \u003cVerticalScrollView color=\"transparent\"\n minHeight=\"100\"\n flexibleHeight=\"100\"\n scrollSensitivity=\"27\"\n scrollbarColors=\"grey|grey|#C8C8C8|rgba(0.78,0.78,0.78,0.5)\"\n horizontalScrollbarVisibility=\"AutohideAndExpandViewport\"\n raycastTarget=\"true\"\u003e\n \u003cVerticalLayout id=\"contentList\"\n padding=\"10 25 0 0\"\u003e\n \u003c!-- this will be filled via scripting --\u003e\n \u003c/VerticalLayout\u003e\n \u003c/VerticalScrollView\u003e\n \u003c/VerticalLayout\u003e\n\n \u003c!-- content preview window --\u003e\n \u003cVerticalLayout preferredWidth=\"300\"\n padding=\"15 15 15 5\"\u003e\n\n \u003c!-- header --\u003e\n \u003cVerticalLayout preferredHeight=\"110\"\u003e\n \u003cText id=\"previewTitle\"\n fontSize=\"28\"\n preferredHeight=\"70\"\n font=\"font_teutonic-arkham\"\u003ePreviewTitle\u003c/Text\u003e\n \u003cText id=\"previewAuthor\"\n fontSize=\"20\"\n preferredHeight=\"40\"\n font=\"font_teutonic-arkham\"\u003eby PreviewAuthor\u003c/Text\u003e\n \u003c/VerticalLayout\u003e\n\n \u003c!-- box art --\u003e\n \u003cPanel id=\"previewArtPanel\"\n preferredHeight=\"390\"\u003e\n \u003cMask id=\"previewArtMask\"\u003e\n \u003c!-- image will be set via scripting --\u003e\n \u003cImage id=\"previewArtImage\" /\u003e\n \u003c/Mask\u003e\n \u003c/Panel\u003e\n\n \u003c!-- description --\u003e\n \u003cPanel preferredHeight=\"160\"\u003e\n \u003cText id=\"previewDescription\"\n alignment=\"UpperLeft\"\n resizeTextForBestFit=\"true\"\n resizeTextMinSize=\"12\"\n resizeTextMaxSize=\"18\"\u003ePreviewDescription\u003c/Text\u003e\n \u003c/Panel\u003e\n\n \u003c!-- download button / progress bar (visibility handled by lua code)--\u003e\n \u003cPanel preferredHeight=\"60\"\u003e\n \u003c!-- download button --\u003e\n \u003cButton id=\"download_button\"\n class=\"windowButton\"\n onClick=\"onClick_download\"\n height=\"50\"\n width=\"270\"\n fontSize=\"28\"\u003eDownload\u003c/Button\u003e\n \u003c!-- download progress bar --\u003e\n \u003cProgressBar id=\"download_progress\"\n active=\"false\"\n height=\"50\"\n width=\"270\"\n percentage=\"0\"\n color=\"#111111\"\n textColor=\"#aaaaaa\"\n fillImageColor=\"#333333\"/\u003e\n \u003c/Panel\u003e\n \u003c/VerticalLayout\u003e\n \u003c/HorizontalLayout\u003e\n\u003c/VerticalLayout\u003e\n\u003c!-- include Global/DownloadWindow.xml --\u003e\n\u003c!-- include Global/PlayareaGallery.xml --\u003e\n\u003cDefaults\u003e\n \u003c!-- type selection at the top --\u003e\n \u003cButton class=\"imageTab\"\n hoverClass=\"bGrey\"\n pressClass=\"bWhite\"\n onClick=\"b7b45b/onClick_imageTab\"\n color=\"#888888\"\n fontSize=\"24\"\n font=\"font_teutonic-arkham\"/\u003e\n \u003cButton class=\"bGrey\"\n color=\"grey\"/\u003e\n \u003cButton class=\"bWhite\"\n color=\"white\"/\u003e\n\n \u003c!-- image boxes in the grid --\u003e\n \u003cVerticalLayout class=\"imageBox\"\n color=\"black\"\n outline=\"#303030\"\n outlineSize=\"2 2\"\n onClick=\"b7b45b/onClick_image\"/\u003e\n \u003cImage class=\"playareaImage\"\n preferredHeight=\"330\"/\u003e\n \u003cText class=\"imageName\"\n preferredHeight=\"40\"\n resizeTextForBestFit=\"true\"\n resizeTextMinSize=\"10\"\n resizeTextMaxSize=\"18\"/\u003e\n\n \u003c!-- item selection on the left --\u003e\n \u003cText class=\"itemText\"\n alignment=\"MiddleLeft\"/\u003e\n \u003cPanel class=\"itemPanel\"\n preferredHeight=\"45\"\n onClick=\"b7b45b/onClick_listItem\"/\u003e\n\n \u003c!-- other --\u003e\n \u003cText class=\"headerText\"\n fontSize=\"35\"/\u003e\n \u003cVerticalLayout childForceExpandHeight=\"false\"/\u003e\n\u003c/Defaults\u003e\n\n\u003cVerticalLayout id=\"playareaGallery\"\n active=\"false\"\n color=\"black\"\n height=\"880\"\n width=\"900\"\n outlineSize=\"2 2\"\n outline=\"#303030\"\u003e\n\n \u003c!-- window header --\u003e\n \u003cPanel preferredHeight=\"60\"\n padding=\"10 10 5 5\"\n spacing=\"10\"\n outlineSize=\"2 2\"\n outline=\"#303030\"\n color=\"black\"\u003e\n \u003cText fontSize=\"32\"\n font=\"font_teutonic-arkham\"\n preferredWidth=\"600\"\n alignment=\"MiddleLeft\"\u003ePlayarea Image Gallery\u003c/Text\u003e\n \u003cPanel preferredWidth=\"50\"\u003e\n \u003cButton rectAlignment=\"MiddleRight\"\n width=\"50\"\n color=\"clear\"\n icon=\"close\"\n tooltip=\"Close\"\n tooltipPosition=\"Right\"\n tooltipBackgroundColor=\"rgba(0,0,0,1)\"\n onClick=\"onClick_toggleUi(playareaGallery)\"/\u003e\n \u003c/Panel\u003e\n \u003c/Panel\u003e\n\n \u003c!-- tab selection --\u003e\n \u003cHorizontalLayout preferredHeight=\"60\"\n padding=\"5\"\n spacing=\"5\"\u003e\n \u003cButton class=\"imageTab\"\n id=\"imageTab1\"\u003eOfficial Campaigns\u003c/Button\u003e\n \u003cButton class=\"imageTab\"\n id=\"imageTab2\"\u003eOfficial Scenarios\u003c/Button\u003e\n \u003cButton class=\"imageTab\"\n id=\"imageTab3\"\u003eFan-Made Campaigns\u003c/Button\u003e\n \u003cButton class=\"imageTab\"\n id=\"imageTab4\"\u003eFan-Made Scenarios\u003c/Button\u003e\n \u003cButton class=\"imageTab\"\n id=\"imageTab5\"\u003eOther Images\u003c/Button\u003e\n \u003c/HorizontalLayout\u003e\n\n \u003cHorizontalLayout preferredHeight=\"760\"\u003e\n \u003c!-- left column: navigation bar --\u003e\n \u003cVerticalLayout id=\"itemSelection\"\n preferredWidth=\"180\"\n padding=\"10 15 0 0\"\u003e\n \u003c!-- this will be filled via scripting --\u003e\n \u003c!-- \u003cPanel class=\"itemPanel\"\u003e\n \u003cText class=\"itemText\"\u003eItem\u003c/Text\u003e\n \u003c/Panel\u003e --\u003e\n \u003c/VerticalLayout\u003e\n\n \u003c!-- right column: image gallery --\u003e\n \u003cVerticalScrollView color=\"transparent\"\n minHeight=\"100\"\n flexibleHeight=\"100\"\n preferredWidth=\"720\"\n scrollSensitivity=\"380\"\n scrollbarColors=\"grey|grey|#C8C8C8|rgba(0.78,0.78,0.78,0.5)\"\n horizontalScrollbarVisibility=\"AutohideAndExpandViewport\"\n raycastTarget=\"true\"\u003e\n \u003cGridLayout id=\"playareaList\"\n preferredWidth=\"700\"\n padding=\"25 25 5 5\"\n spacing=\"10\"\n cellSize=\"330 370\"\u003e\n \u003c!-- this will be filled via scripting --\u003e\n \u003c!-- \u003cVerticalLayout class=\"imageBox\"\u003e\n \u003cImage class=\"playareaImage\" image=\"\"/\u003e\n \u003cText class=\"imageName\"\u003eImage Name\u003c/Text\u003e\n \u003c/VerticalLayout\u003e --\u003e\n \u003c/GridLayout\u003e\n \u003c/VerticalScrollView\u003e\n \u003c/HorizontalLayout\u003e\n\u003c/VerticalLayout\u003e\n\u003c!-- include Global/PlayareaGallery.xml --\u003e\n\u003c!-- include Global/TitleSplash.xml --\u003e\n\u003c!-- Title Splash when starting a scenario --\u003e\n\u003cPanel id=\"title_splash\"\n height=\"220\"\n position=\"0 250 0\"\n showAnimation=\"FadeIn\"\n hideAnimation=\"FadeOut\"\n active=\"false\"\n animationDuration=\"2\"\u003e\n \u003cImage id=\"title_gradient\"\n height=\"220\"\n image=\"TitleGradient\" /\u003e\n \u003cText id=\"title_splash_text\"\n width=\"95%\"\n height=\"180\"\n resizeTextForBestFit=\"true\"\n resizeTextMinSize=\"100\"\n resizeTextMaxSize=\"150\"\n font=\"font_teutonic-arkham\"\n outline=\"black\"\n outlineSize=\"3 -3\"\n horizontalOverflow=\"Overflow\"\u003e\n \u003c/Text\u003e\n\u003c/Panel\u003e\n\u003c!-- include Global/TitleSplash.xml --\u003e\n\u003c!-- include Global/NavigationOverlay.xml --\u003e\n\u003c!-- Default formatting --\u003e\n\u003cDefaults\u003e\n \u003cText color=\"#FFFFFF\"\n alignment=\"MiddleLeft\" /\u003e\n\n \u003cToggle isOn=\"False\"\n rectAlignment=\"MiddleRight\" /\u003e\n\n \u003cCell dontUseTableCellBackground=\"true\"\n outlineSize=\"0 1\"\n outline=\"grey\" /\u003e\n\n \u003c!-- options --\u003e\n \u003cRow class=\"nav_option-text\"\n preferredHeight=\"45\"/\u003e\n \u003cCell class=\"nav_option-text\"\n color=\"#333333\"/\u003e\n \u003cCell class=\"nav_option-button\"\n color=\"#333333\"/\u003e\n \u003cText class=\"nav_option-header\"\n fontSize=\"20\"\n font=\"font_teutonic-arkham\"/\u003e\n \u003cCell class=\"claim\"\n tooltip=\"Clicking this seat in the navigation overlay will now only swap the playercolor for you.\"\n tooltipPosition=\"Right\" /\u003e\n\n \u003c!-- buttons at the bottom --\u003e\n \u003cButton class=\"bottomButtons\"\n hoverClass=\"hover\"\n pressClass=\"press\"\n selectClass=\"select\"\n color=\"#888888\"\n minHeight=\"35\"\n fontSize=\"24\"\n font=\"font_teutonic-arkham\"/\u003e\n \u003cButton class=\"hover\"\n color=\"grey\"/\u003e\n \u003cButton class=\"press\"\n color=\"white\"/\u003e\n \u003cButton class=\"select\"\n color=\"white\"/\u003e\n\n \u003c!-- Navigation Panels --\u003e\n \u003cPanel class=\"navPanel\"\n active=\"false\"\n allowDragging=\"true\"\n rectAlignment=\"LowerRight\"\n returnToOriginalPositionWhenReleased=\"false\"\n offsetXY=\"-40 0\"\u003e\n \u003c/Panel\u003e\n\u003c/Defaults\u003e\n\n\u003c!-- full Panel --\u003e\n\u003cPanel id=\"navPanelFull\"\n height=\"358\"\n width=\"455\"\n class=\"navPanel\"\u003e\n\u003c/Panel\u003e\n\n\u003c!-- Play Area only --\u003e\n\u003cPanel id=\"navPanelPlay\"\n height=\"208\"\n width=\"205\"\n class=\"navPanel\"\u003e\n\u003c/Panel\u003e\n\n\u003c!-- Settings --\u003e\n\u003cTableLayout id=\"navPanelSettings\"\n active=\"false\"\n width=\"300\"\n height=\"335\"\n color=\"#000000\"\n outlineSize=\"2 2\"\n outline=\"grey\"\n rectAlignment=\"MiddleCenter\"\u003e\n\n \u003c!-- Header --\u003e\n \u003cRow preferredHeight=\"60\"\u003e\n \u003cCell\u003e\n \u003cPanel padding=\"10 0 0 0\"\u003e\n \u003cText font=\"font_teutonic-arkham\"\n fontSize=\"35\"\u003eNavigation Overlay\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Options --\u003e\n \u003cRow\u003e\n \u003cCell\u003e\n \u003cTableLayout columnWidths=\"0 125\"\n autoCalculateHeight=\"1\"\n cellPadding=\"10 0 5 5\"\u003e\n\n \u003c!-- Option: Custom pitch --\u003e\n \u003cRow class=\"nav_option-text\"\u003e\n \u003cCell class=\"nav_option-text\"\u003e\n \u003cText class=\"nav_option-header\"\u003eViewing angle in degrees:\u003c/Text\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"nav_option-button\"\u003e\n \u003cSlider id=\"sliderPitch\"\n onValueChanged=\"797ede/updatePitch\"\n wholeNumbers=\"true\"\n minValue=\"0\"\n maxValue=\"89\"\n value=\"75\"\n tooltip=\"This controls the camera pitch ('nodding your head').\"\n tooltipPosition=\"Right\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: Claim White --\u003e\n \u003cRow class=\"nav_option-text\"\u003e\n \u003cCell class=\"nav_option-text\"\u003e\n \u003cText class=\"nav_option-header\"\u003eClaim \"White\" seat\u003c/Text\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"nav_option-button claim\"\u003e\n \u003cToggle id=\"claimWhite\"\n onValueChanged=\"797ede/claimColor(White)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: Claim Orange --\u003e\n \u003cRow class=\"nav_option-text\"\u003e\n \u003cCell class=\"nav_option-text\"\u003e\n \u003cText class=\"nav_option-header\"\u003eClaim \"Orange\" seat\u003c/Text\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"nav_option-button claim\"\u003e\n \u003cToggle id=\"claimOrange\"\n onValueChanged=\"797ede/claimColor(Orange)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: Claim Green --\u003e\n \u003cRow class=\"nav_option-text\"\u003e\n \u003cCell class=\"nav_option-text\"\u003e\n \u003cText class=\"nav_option-header\"\u003eClaim \"Green\" seat\u003c/Text\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"nav_option-button claim\"\u003e\n \u003cToggle id=\"claimGreen\"\n onValueChanged=\"797ede/claimColor(Green)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: Claim Red --\u003e\n \u003cRow class=\"nav_option-text\"\u003e\n \u003cCell class=\"nav_option-text\"\u003e\n \u003cText class=\"nav_option-header\"\u003eClaim \"Red\" seat\u003c/Text\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"nav_option-button claim\"\u003e\n \u003cToggle id=\"claimRed\"\n onValueChanged=\"797ede/claimColor(Red)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n \u003c/TableLayout\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Buttons: Defaults and Close --\u003e\n \u003cRow preferredHeight=\"50\"\u003e\n \u003cCell\u003e\n \u003cHorizontalLayout minHeight=\"55\"\n flexibleHeight=\"0\"\n padding=\"10 10 5 10\"\n spacing=\"35\"\u003e\n \u003cButton class=\"bottomButtons\"\n onClick=\"797ede/loadDefaultSettings\"\u003eLoad defaults\u003c/Button\u003e\n \u003cButton class=\"bottomButtons\"\n onClick=\"797ede/toggleSettings\"\u003eClose\u003c/Button\u003e\n \u003c/HorizontalLayout\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\u003c/TableLayout\u003e\n\u003c!-- include Global/NavigationOverlay.xml --\u003e\n\u003c!-- include Global/OptionPanel.xml --\u003e\n\u003c!-- Default formatting --\u003e\n\u003cDefaults\u003e\n \u003cText color=\"#FFFFFF\"\n alignment=\"MiddleLeft\" /\u003e\n\n \u003cToggle isOn=\"False\"\n rectAlignment=\"MiddleRight\" /\u003e\n\n \u003cDropdown rectAlignment=\"MiddleCenter\" /\u003e\n\n \u003cCell dontUseTableCellBackground=\"true\"\n outlineSize=\"0 1\"\n outline=\"grey\" /\u003e\n\n \u003c!-- main window --\u003e\n \u003cTableLayout class=\"window\"\n width=\"500\"\n height=\"800\"\n active=\"false\"\n color=\"#000000\"\n outlineSize=\"2 2\"\n outline=\"grey\"\n showAnimation=\"SlideIn_Right\"\n hideAnimation=\"SlideOut_Right\"\n animationDuration=\"0.2\" /\u003e\n\n \u003c!-- group headers --\u003e\n \u003cRow class=\"group-header\"\n preferredHeight=\"54\" /\u003e\n \u003cCell class=\"group-header\"\n columnSpan=\"3\"\n color=\"#222222\" /\u003e\n \u003cPanel class=\"group-header\"\n padding=\"5 0 0 0\" /\u003e\n \u003cText class=\"group-header\"\n fontSize=\"28\"\n font=\"font_teutonic-arkham\" /\u003e\n\n \u003c!-- options --\u003e\n \u003cRow class=\"option-text\"\n preferredHeight=\"50\"\n tooltipPosition=\"Left\"\n tooltipBackgroundColor=\"rgba(0,0,0,1)\"/\u003e\n \u003cCell class=\"option-text\"\n color=\"#333333\"\n columnSpan=\"2\"/\u003e\n \u003cCell class=\"option-button\"\n color=\"#333333\"/\u003e\n \u003cCell class=\"option-dropdowntext\"\n color=\"#333333\"\n columnSpan=\"1\"/\u003e\n \u003cCell class=\"option-dropdown\"\n color=\"#333333\"\n columnSpan=\"2\"/\u003e\n \u003cPanel class=\"option-wrapper\"\n padding=\"10 0 0 0\"/\u003e\n \u003cText class=\"option-header\"\n fontSize=\"22\"\n font=\"font_teutonic-arkham\"/\u003e\n \u003cPanel class=\"dropdown-wrapper\"\n padding=\"0 17 3 3\"/\u003e\n\n \u003c!-- buttons at the bottom --\u003e\n \u003cButton class=\"bottomButtons\"\n hoverClass=\"hover\"\n pressClass=\"press\"\n selectClass=\"select\"\n color=\"#888888\"\n minHeight=\"35\"\n fontSize=\"24\"\n font=\"font_teutonic-arkham\"/\u003e\n \u003cButton class=\"hover\"\n color=\"grey\"/\u003e\n \u003cButton class=\"press\"\n color=\"white\"/\u003e\n \u003cButton class=\"select\"\n color=\"white\"/\u003e\n\u003c/Defaults\u003e\n\n\u003c!-- Option Panel --\u003e\n\u003cTableLayout id=\"optionPanel\"\n class=\"window\"\n visibility=\"Admin\"\n rectAlignment=\"LowerRight\"\n offsetXY=\"-50 80\"\n raycastTarget=\"true\"\u003e\n \u003c!-- Header: Options --\u003e\n \u003cRow preferredHeight=\"60\"\u003e\n \u003cCell\u003e\n \u003cPanel padding=\"10 0 0 0\"\u003e\n \u003cText font=\"font_teutonic-arkham\"\n fontSize=\"35\"\u003eOptions\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Scrollable part with options --\u003e\n \u003cRow\u003e\n \u003cCell\u003e\n \u003cVerticalScrollView horizontalScrollbarVisibility=\"AutohideAndExpandViewport\"\n scrollSensitivity=\"30\"\n raycastTarget=\"true\"\u003e\n \u003cTableLayout columnWidths=\"0 100 75\"\n autoCalculateHeight=\"1\"\n cellPadding=\"10 10 5 5\"\u003e\n\n \u003c!-- Group: general settings --\u003e\n \u003cRow class=\"group-header\"\u003e\n \u003cCell class=\"group-header\"\u003e\n \u003cPanel class=\"group-header\"\n image=\"header_acolyte\"\u003e\n \u003cText class=\"group-header\"\u003eGENERAL SETTINGS\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: card language --\u003e\n \u003c!-- disabled until we have the backend in place\n \u003cRow class=\"option-text\" tooltip=\"Downloading a campaign or importing a deck will use\u0026#xA;this language for cards (NOT FUNCTIONAL YET!).\"\u003e\n \u003cCell class=\"option-dropdowntext\"\u003e\n \u003cPanel class=\"option-wrapper\"\u003e\n \u003cText class=\"option-header\"\u003eCard language\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"option-dropdown\"\u003e\n \u003cPanel class=\"dropdown-wrapper\"\u003e\n \u003cDropdown id=\"cardLanguage\" onValueChanged=\"languageSelected(selectedIndex)\"\u003e\n \u003cOption\u003e简体中文\u003c/Option\u003e\n \u003cOption\u003e繁體中文\u003c/Option\u003e\n \u003cOption\u003eDeutsch\u003c/Option\u003e\n \u003cOption\u003eEnglish\u003c/Option\u003e\n \u003cOption\u003eEspañol\u003c/Option\u003e\n \u003cOption\u003eFrançais\u003c/Option\u003e\n \u003cOption\u003eItaliano\u003c/Option\u003e\n \u003c/Dropdown\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e --\u003e\n\n \u003c!-- Option: play area snap tags --\u003e\n \u003cRow class=\"option-text\"\n tooltip=\"Only cards with the tag 'Location' will snap (official cards are supported by default).\u0026#xA;Disable this if you are having issues with custom content.\"\u003e\n \u003cCell class=\"option-text\"\u003e\n \u003cPanel class=\"option-wrapper\"\u003e\n \u003cText class=\"option-header\"\u003eEnable snap tags for play area\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"option-button\"\u003e\n \u003cToggle id=\"playAreaSnapTags\"\n onValueChanged=\"onClick_toggleOption(playAreaSnapTags)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: splash scenario name on setup --\u003e\n \u003cRow class=\"option-text\"\n tooltip=\"Fade in the name of the scenario for 2 seconds\u0026#xA;when placing down a scenario.\"\u003e\n \u003cCell class=\"option-text\"\u003e\n \u003cPanel class=\"option-wrapper\"\u003e\n \u003cText class=\"option-header\"\u003eShow scenario title on setup\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"option-button\"\u003e\n \u003cToggle id=\"showTitleSplash\"\n onValueChanged=\"onClick_toggleOption(showTitleSplash)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Group: playermat settings --\u003e\n \u003cRow class=\"group-header\"\u003e\n \u003cCell class=\"group-header\"\u003e\n \u003cPanel class=\"group-header\"\n image=\"header_cover\"\u003e\n \u003cText class=\"group-header\"\u003ePLAYERMAT SETTINGS\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: enable snap tags --\u003e\n \u003cRow class=\"option-text\"\n tooltip=\"Only cards with the tag 'Asset' will snap (official cards are supported by default).\u0026#xA;Disable this if you are having issues with custom content.\"\u003e\n \u003cCell class=\"option-text\"\u003e\n \u003cPanel class=\"option-wrapper\"\u003e\n \u003cText class=\"option-header\"\u003eEnable snap tags\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"option-button\"\u003e\n \u003cToggle id=\"useSnapTags\"\n onValueChanged=\"onClick_toggleOption(useSnapTags)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: show draw 1 button --\u003e\n \u003cRow class=\"option-text\"\n tooltip=\"Displays a button below the 'Upkeep' button that draws a card from your deck.\u0026#xA;Useful for multi-handed solo play.\"\u003e\n \u003cCell class=\"option-text\"\u003e\n \u003cPanel class=\"option-wrapper\"\u003e\n \u003cText class=\"option-header\"\u003eShow \"Draw 1\" button\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"option-button\"\u003e\n \u003cToggle id=\"showDrawButton\"\n onValueChanged=\"onClick_toggleOption(showDrawButton)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: use clickable clue-counters --\u003e\n \u003cRow class=\"option-text\"\n tooltip=\"Instead of automatically counting clues in the respective area on your playermat,\u0026#xA;this displays a clickable counter for clues.\"\u003e\n \u003cCell class=\"option-text\"\u003e\n \u003cPanel class=\"option-wrapper\"\u003e\n \u003cText class=\"option-header\"\u003eUse clickable clue counters\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"option-button\"\u003e\n \u003cToggle id=\"useClueClickers\"\n onValueChanged=\"onClick_toggleOption(useClueClickers)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: use clickable resource counters --\u003e\n \u003cRow class=\"option-text\"\n tooltip=\"This enables spawning of clickable resource tokens for player cards.\u0026#xA;(Chef's Selection = assets with 0 uses)\"\u003e\n \u003cCell class=\"option-dropdowntext\"\u003e\n \u003cPanel class=\"option-wrapper\"\u003e\n \u003cText class=\"option-header\"\u003eUse clickable resource tokens\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"option-dropdown\"\u003e\n \u003cPanel class=\"dropdown-wrapper\"\u003e\n \u003cDropdown id=\"useResourceCounters\"\n onValueChanged=\"resourceCounterSelected(selectedIndex)\"\u003e\n \u003cOption\u003eEnabled\u003c/Option\u003e\n \u003cOption\u003eChef's Selection\u003c/Option\u003e\n \u003cOption\u003eDisabled\u003c/Option\u003e\n \u003c/Dropdown\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Group: fan-made accessories --\u003e\n \u003cRow class=\"group-header\"\u003e\n \u003cCell class=\"group-header\"\u003e\n \u003cPanel class=\"group-header\"\n image=\"header_olive\"\u003e\n \u003cText class=\"group-header\"\u003eFAN-MADE ACCESSORIES\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: show attachment helper --\u003e\n \u003cRow class=\"option-text\"\n tooltip=\"Provides a card-sized bag for cards that are attached to other cards\u0026#xA;(e.g. Backpack).\"\u003e\n \u003cCell class=\"option-text\"\u003e\n \u003cPanel class=\"option-wrapper\"\u003e\n \u003cText class=\"option-header\"\u003eAttachment Helper\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"option-button\"\u003e\n \u003cToggle id=\"showAttachmentHelper\"\n onValueChanged=\"onClick_toggleOption(showAttachmentHelper)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: show clean up helper --\u003e\n \u003cRow class=\"option-text\"\n tooltip=\"Useful for campaign-play:\u0026#xA;It resets play areas to allow continuous gameplay in the same savegame.\"\u003e\n \u003cCell class=\"option-text\"\u003e\n \u003cPanel class=\"option-wrapper\"\u003e\n \u003cText class=\"option-header\"\u003eClean Up Helper\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"option-button\"\u003e\n \u003cToggle id=\"showCleanUpHelper\"\n onValueChanged=\"onClick_toggleOption(showCleanUpHelper)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: show CYOA campaign guides --\u003e\n \u003cRow class=\"option-text\"\n tooltip=\"Displays in a 'Choose Your Own Adventure'\u0026#xA;style redesigned campaign guides.\"\u003e\n \u003cCell class=\"option-text\"\u003e\n \u003cPanel class=\"option-wrapper\"\u003e\n \u003cText class=\"option-header\"\u003eCYOA Campaign Guides\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"option-button\"\u003e\n \u003cToggle id=\"showCYOA\"\n onValueChanged=\"onClick_toggleOption(showCYOA)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: show displacement tool --\u003e\n \u003cRow class=\"option-text\"\n tooltip=\"This allows moving all objects on the main playmat\u0026#xA;in a chosen direction.\"\u003e\n \u003cCell class=\"option-text\"\u003e\n \u003cPanel class=\"option-wrapper\"\u003e\n \u003cText class=\"option-header\"\u003eDisplacement Tool\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"option-button\"\u003e\n \u003cToggle id=\"showDisplacementTool\"\n onValueChanged=\"onClick_toggleOption(showDisplacementTool)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: show hand helper --\u003e\n \u003cRow class=\"option-text\"\n tooltip=\"Never count your hand cards again! This tool does that for you\u0026#xA;and additionally enables easy discarding of random cards.\"\u003e\n \u003cCell class=\"option-text\"\u003e\n \u003cPanel class=\"option-wrapper\"\u003e\n \u003cText class=\"option-header\"\u003eHand Helper\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"option-button\"\u003e\n \u003cToggle id=\"showHandHelper\"\n onValueChanged=\"onClick_toggleOption(showHandHelper)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Option: show search assistant --\u003e\n \u003cRow class=\"option-text\"\n tooltip=\"Quickly search 3, 6, 9 or the top X\u0026#xA;cards of your deck!\"\u003e\n \u003cCell class=\"option-text\"\u003e\n \u003cPanel class=\"option-wrapper\"\u003e\n \u003cText class=\"option-header\"\u003eSearch Assistant\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003cCell class=\"option-button\"\u003e\n \u003cToggle id=\"showSearchAssistant\"\n onValueChanged=\"onClick_toggleOption(showSearchAssistant)\"/\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n \u003c/TableLayout\u003e\n \u003c/VerticalScrollView\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Buttons: Defaults and Close --\u003e\n \u003cRow preferredHeight=\"50\"\u003e\n \u003cCell\u003e\n \u003cHorizontalLayout minHeight=\"55\"\n flexibleHeight=\"0\"\n padding=\"10 10 5 10\"\n spacing=\"225\"\u003e\n \u003cButton class=\"bottomButtons\"\n onClick=\"onClick_defaultSettings\"\u003eLoad defaults\u003c/Button\u003e\n \u003cButton class=\"bottomButtons\"\n onClick=\"onClick_toggleUi(optionPanel)\"\u003eClose\u003c/Button\u003e\n \u003c/HorizontalLayout\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\u003c/TableLayout\u003e\n\u003c!-- include Global/OptionPanel.xml --\u003e\n\u003c!-- include Global/UpdateNotification.xml --\u003e\n\u003c!-- Default formatting inherented from OptionPanel! --\u003e\n\n\u003c!-- Icon with Finn, which can be clicked --\u003e\n\u003cImage id=\"FinnIcon\"\n active=\"false\"\n showAnimation=\"SlideIn_Top\"\n hideAnimation=\"SlideOut_Top\"\n animationDuration=\"0.2\"\n rectAlignment=\"UpperLeft\"\n offsetXY=\"420 -5\"\n height=\"90\"\n width=\"90\"\n onClick=\"onClick_toggleUi(updateNotification)\"\n image=\"FinnIcon\"\n tooltip=\"Update notification\"\n tooltipPosition=\"Right\"\n tooltipBackgroundColor=\"rgba(0,0,0,1)\"/\u003e\n\n\u003c!-- main notification window --\u003e\n\u003cTableLayout id=\"updateNotification\"\n active=\"false\"\n color=\"#000000\"\n outlineSize=\"2 2\"\n outline=\"grey\"\n showAnimation=\"SlideIn_Top\"\n hideAnimation=\"SlideOut_Top\"\n animationDuration=\"0.2\"\n rectAlignment=\"UpperLeft\"\n offsetXY=\"60 -5\"\n height=\"225\"\n width=\"350\"\u003e\n\n \u003c!-- Header --\u003e\n \u003cRow preferredHeight=\"50\"\u003e\n \u003cCell\u003e\n \u003cPanel padding=\"10 10 0 0\"\u003e\n \u003c!-- this part will be updated via script --\u003e\n \u003cText id=\"notificationHeader\"\n font=\"font_teutonic-arkham\"\n fontSize=\"30\"\n alignment=\"MiddleCenter\"\u003ePlaceholder\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- patch highlights --\u003e\n \u003cRow id=\"highlightRow\"\n preferredHeight=\"100\"\u003e\n \u003cCell\u003e\n \u003cPanel padding=\"15 15 0 7\"\u003e\n \u003c!-- this part will be updated via script --\u003e\n \u003cText id=\"releaseHighlightText\"\n resizeTextForBestFit=\"true\"\u003ePlaceholder\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- explanation --\u003e\n \u003cRow preferredHeight=\"25\"\u003e\n \u003cCell\u003e\n \u003cPanel padding=\"15 15 0 7\"\u003e\n \u003cText resizeTextForBestFit=\"true\"\u003eVisit the usual place to receive this update.\u003c/Text\u003e\n \u003c/Panel\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\n \u003c!-- Buttons: \"Don't show again\" and \"Close\" --\u003e\n \u003cRow preferredHeight=\"50\"\u003e\n \u003cCell\u003e\n \u003cHorizontalLayout minHeight=\"55\"\n flexibleHeight=\"0\"\n padding=\"10 10 5 10\"\n spacing=\"10\"\u003e\n \u003cButton class=\"bottomButtons\"\n onClick=\"onClick_notification(dontShowAgain)\"\u003eDon't show again\u003c/Button\u003e\n \u003cButton class=\"bottomButtons\"\n onClick=\"onClick_notification(close)\"\u003eClose\u003c/Button\u003e\n \u003c/HorizontalLayout\u003e\n \u003c/Cell\u003e\n \u003c/Row\u003e\n\u003c/TableLayout\u003e\n\u003c!-- include Global/UpdateNotification.xml --\u003e\n\u003c!-- include Global/Global.xml --\u003e" }