SCED/objects/LegacyAssets.7165a9/AttachmentFacedownHelper.3da8b6.json

438 lines
404 KiB
JSON
Raw Normal View History

2022-11-11 02:59:55 -05:00
{
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"ColorDiffuse": {
"b": 0,
"g": 0,
"r": 0
},
"CustomMesh": {
"CastShadows": true,
"ColliderURL": "http://cloud-3.steamusercontent.com/ugc/1754695414379239413/0B8E68F3B7311DCF2138FB701F78D1D93FBA4CAB/",
"Convex": true,
"DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1754695774481244354/E49F993A2E3D760FD030F3D2E5F6B2DD32FC6984/",
"MaterialIndex": 1,
"MeshURL": "http://cloud-3.steamusercontent.com/ugc/1754695414379239413/0B8E68F3B7311DCF2138FB701F78D1D93FBA4CAB/",
"NormalURL": "",
"TypeIndex": 0
},
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "3da8b6",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScriptState": "",
"LuaScript_path": "LegacyAssets.7165a9/AttachmentFacedownHelper.3da8b6.ttslua",
"MeasureMovement": false,
"Name": "Custom_Model",
"Nickname": "Attachment/Facedown Helper",
"Snap": true,
"States": {
"1": {
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"Bag": {
"Order": 0
},
"ColorDiffuse": {
"b": 0.08627259,
"g": 0.443134964,
"r": 0.06274338
},
"CustomMesh": {
"CastShadows": true,
"ColliderURL": "http://cloud-3.steamusercontent.com/ugc/1754695414379239413/0B8E68F3B7311DCF2138FB701F78D1D93FBA4CAB/",
"Convex": true,
"DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1754695635919099826/3C3CBFFAADB2ACA9957C736491F470AE906CC953/",
"MaterialIndex": 1,
"MeshURL": "http://cloud-3.steamusercontent.com/ugc/1754695414379239413/0B8E68F3B7311DCF2138FB701F78D1D93FBA4CAB/",
"NormalURL": "",
"TypeIndex": 6
},
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "ce6247",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "function onload(saved_data)\r\n cardsInBag = {}\r\n memoizedCards = {}\r\n cardJson = loadCards()\r\nend\r\n\r\nfunction onObjectEnterContainer(container, object)\r\n if container == self then\r\n --use previously-found cards for faster performace\r\n if memoizedCards[object.getName()] then\r\n table.insert(cardsInBag, {name = object.getName() .. memoizedCards[object.getName()], id = object.getGUID()})\r\n recreateButtons()\r\n else\r\n findCard(object)\r\n end\r\n end\r\nend\r\n\r\nfunction onObjectLeaveContainer(container, object)\r\n if container == self then\r\n removeCardByGUID(cardsInBag, object.getGUID())\r\n recreateButtons()\r\n end\r\nend\r\n\r\nfunction findCard(object)\r\n local cost = ''\r\n\r\n for _, card in pairs (cardJson) do\r\n if (card.name == object.getName()) then\r\n if card.cost ~= nil then\r\n cost = '[' .. card.cost .. '] '\r\n end\r\n break\r\n end\r\n end\r\n\r\n --memoize result\r\n memoizedCards[object.getName()] = icons\r\n\r\n table.insert(cardsInBag, {name = cost .. object.getName(), id = object.getGUID()})\r\n recreateButtons()\r\nend\r\n\r\nfunction recreateButtons()\r\n self.clearButtons()\r\n verticalPosition = 1.5\r\n\r\n for _, card in ipairs(cardsInBag) do\r\n if _G['removeCard' .. card.id] == nil then\r\n _G['removeCard' .. card.id] = function()\r\n removeCard(card.id)\r\n end\r\n end\r\n\r\n self.createButton({\r\n label = card.name,\r\n click_function = \"removeCard\" .. card.id,\r\n function_owner = self,\r\n position = {0,0,verticalPosition},\r\n height = 200,\r\n width = 1200,\r\n font_size = 75,\r\n color = {1,1,1},\r\n font_color = {0,0,0}\r\n })\r\n\r\n verticalPosition = verticalPosition - 0.5\r\n end\r\n\r\n countLabel = #cardsInBag == 0 and '' or #cardsInBag\r\n\r\n self.createButton({\r\n label = countLabel,\r\n click_function = 'nothing',\r\n function_owner = self,\r\n position = {0,0,-1.25},\r\n width = 0,\r\n height = 0,\r\n font_size = 225,\r\n font_color = {1,1,1}\r\n })\r\nend\r\n\r\nfunction nothing()\r\nend\r\n\r\nfunction removeCard(cardGUID)\r\n self.takeObject({\r\n guid = cardGUID,\r\n rotation = self.getRotation(),\r\n position = self.getPosition() + Vector(0,0.5,0),\r\n callback_function = function(obj)\r\n obj.resting = true\r\n end\r\n })\r\nend\r\n\r\nfunction removeCardByGUID(bag, guid)\r\n local idx = nil\r\n\r\n for i, v in ipairs (bag) do\r\n if (v.id == guid) then\r\n idx = i\r\n end\r\n end\r\n\r\n if idx ~= nil then\r\n table.remove(cardsInBag, idx)\r\n end\r\nend\r\n\r\nfunction loadCards()\r\n return {{[\"name\"] = \"Random Basic Weakness\"},{[\"name\"] = \"Roland Banks\"},{[\"name\"] = \"Daisy Walker\"},{[\"name\"] = \"\\\"Skids\\\" O'Toole\"},{[\"name\"] = \"Agnes Baker\"},{[\"name\"] = \"Wendy Adams\"},{[\"name\"] = \"Roland's .38 Special\",[\"cost\"] = 3},{[\"name\"] = \"Cover Up\"},{[\"name\"] = \"Daisy's Tote Bag\",[\"cost\"] = 2},{[\"name\"] = \"The Necronomicon\"},{[\"name\"] = \"On the Lam\",[\"cost\"] = 1},{[\"name\"] = \"Hospital Debts\"},{[\"name\"] = \"Heirloom of Hyperborea\",[\"cost\"] = 3},{[\"name\"] = \"Dark Memory\",[\"cost\"] = 2},{[\"name\"] = \"Wendy's Amulet\",[\"cost\"] = 2},{[\"name\"] = \"Abandoned and Alone\"},{[\"name\"] = \".45 Automatic\",[\"cost\"] = 4},{[\"name\"] = \"Physical Training\",[\"cost\"] = 2},{[\"name\"] = \"Beat Cop\",[\"cost\"] = 4},{[\"name\"] = \"First Aid\",[\"cost\"] = 2},{[\"name\"] = \"Machete\",[\"cost\"] = 3},{[\"name\"] = \"Guard Dog\",[\"cost\"] = 3},{[\"name\"] = \"Evidence!\",[\"cost\"] = 1},{[\"name\"] = \"Dodge\",[\"cost\"] = 1},{[\"name\"] = \"Dyn
"LuaScriptState": "",
"MaterialIndex": -1,
"MeasureMovement": false,
"MeshIndex": -1,
"Name": "Custom_Model_Bag",
"Nickname": "Sefina Rousseau Helper",
"Number": 0,
"Snap": true,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": 16.3471622,
"posY": 1.64091611,
"posZ": -21.31525,
"rotX": 359.920135,
"rotY": 270.000671,
"rotZ": 0.0168785024,
"scaleX": 0.725000262,
"scaleY": 0.725000262,
"scaleZ": 0.725000262
},
"Value": 0,
"XmlUI": ""
},
"2": {
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"Bag": {
"Order": 0
},
"ColorDiffuse": {
"b": 0.576470554,
"g": 0.333331048,
"r": 0.3647036
},
"CustomMesh": {
"CastShadows": true,
"ColliderURL": "http://cloud-3.steamusercontent.com/ugc/1754695414379239413/0B8E68F3B7311DCF2138FB701F78D1D93FBA4CAB/",
"Convex": true,
"DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1754695635919071208/1AB7222850201630826BFFBA8F2BD0065E2D572F/",
"MaterialIndex": 1,
"MeshURL": "http://cloud-3.steamusercontent.com/ugc/1754695414379239413/0B8E68F3B7311DCF2138FB701F78D1D93FBA4CAB/",
"NormalURL": "",
"TypeIndex": 6
},
"CustomUIAssets": [
{
"Name": "combatIcon",
"Type": 0,
"URL": "http://cloud-3.steamusercontent.com/ugc/1754695581870520946/B61CD5BDAE28B1893809915C7C92A8B472BB65BB/"
}
],
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "1e28aa",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "function onload(saved_data)\r\n cardsInBag = {}\r\n memoizedCards = {}\r\n cardJson = loadCards()\r\nend\r\n\r\nfunction onObjectEnterContainer(container, object)\r\n if container == self then\r\n --use previously-found cards for faster performace\r\n if memoizedCards[object.getName()] then\r\n table.insert(cardsInBag, {name = object.getName() .. memoizedCards[object.getName()], id = object.getGUID()})\r\n recreateButtons()\r\n else\r\n findCard(object)\r\n end\r\n end\r\nend\r\n\r\nfunction onObjectLeaveContainer(container, object)\r\n if container == self then\r\n removeCardByGUID(cardsInBag, object.getGUID())\r\n recreateButtons()\r\n end\r\nend\r\n\r\nfunction findCard(object)\r\n local icons = ''\r\n local cost = ''\r\n\r\n for _, card in pairs (cardJson) do\r\n if (card.name == object.getName()) then\r\n local skillIcons = getIcons(card.skillIcons)\r\n if skillIcons ~= '' then\r\n icons = '\\n' .. skillIcons\r\n end\r\n if card.cost ~= nil then\r\n cost = '[' .. card.cost .. '] '\r\n end\r\n break\r\n end\r\n end\r\n\r\n --memoize result\r\n memoizedCards[object.getName()] = icons\r\n\r\n table.insert(cardsInBag, {name = cost .. object.getName() .. icons, id = object.getGUID()})\r\n recreateButtons()\r\nend\r\n\r\nfunction getIcons(skillIcons)\r\n local icons = ''\r\n\r\n for icon, value in pairs (skillIcons) do\r\n icons = icons .. icon .. ': ' .. value .. ' '\r\n end\r\n\r\n return icons\r\nend\r\n\r\nfunction recreateButtons()\r\n self.clearButtons()\r\n verticalPosition = 1.5\r\n\r\n for _, card in ipairs(cardsInBag) do\r\n if _G['removeCard' .. card.id] == nil then\r\n _G['removeCard' .. card.id] = function()\r\n removeCard(card.id)\r\n end\r\n end\r\n\r\n self.createButton({\r\n label = card.name,\r\n click_function = \"removeCard\" .. card.id,\r\n function_owner = self,\r\n position = {0,0,verticalPosition},\r\n height = 225,\r\n width = 1200,\r\n font_size = 75,\r\n color = {1,1,1},\r\n font_color = {0,0,0}\r\n })\r\n\r\n verticalPosition = verticalPosition - 0.55\r\n end\r\n\r\n countLabel = #cardsInBag == 0 and '' or #cardsInBag\r\n\r\n self.createButton({\r\n label = countLabel,\r\n click_function = 'nothing',\r\n function_owner = self,\r\n position = {0,0,-1.25},\r\n width = 0,\r\n height = 0,\r\n font_size = 225,\r\n font_color = {1,1,1}\r\n })\r\nend\r\n\r\nfunction nothing()\r\nend\r\n\r\nfunction removeCard(cardGUID)\r\n self.takeObject({\r\n guid = cardGUID,\r\n rotation = self.getRotation(),\r\n position = self.getPosition() + Vector(0,0.5,0),\r\n callback_function = function(obj)\r\n obj.resting = true\r\n end\r\n })\r\nend\r\n\r\nfunction removeCardByGUID(bag, guid)\r\n local idx = nil\r\n\r\n for i, v in ipairs (bag) do\r\n if (v.id == guid) then\r\n idx = i\r\n end\r\n end\r\n\r\n if idx ~= nil then\r\n table.remove(cardsInBag, idx)\r\n end\r\nend\r\n\r\nfunction loadCards()\r\n return {{[\"name\"] = \"Random Basic Weakness\",[\"skillIcons\"] = {}},{[\"name\"] = \"Roland Banks\",[\"skillIcons\"] = {[\"Will\"] = 3,[\"Agility\"] = 2,[\"Combat\"] = 4,[\"Intellect\"] = 3}},{[\"name\"] = \"Daisy Walker\",[\"skillIcons\"] = {[\"Will\"] = 3,[\"Agility\"] = 2,[\"Combat\"] = 2,[\"Intellect\"] = 5}},{[\"name\"] = \"\\\"Skids\\\" O'Toole\",[\"skillIcons\"] = {[\"Will\"] = 2,[\"Agility\"] = 4,[\"Combat\"] = 3,[\"Intellect\"] = 3}},{[\"name\"] = \"Agnes Baker\",[\"skillIcons\"] = {[\"Will\"] = 5,[\"Agility\"] = 3,[\"Combat\"] = 2,[\"Intellect\"] = 2}},{[\"name\"] = \"Wendy Adams\",[\"skillIcons\"] =
"LuaScriptState": "",
"MaterialIndex": -1,
"MeasureMovement": false,
"MeshIndex": -1,
"Name": "Custom_Model_Bag",
"Nickname": "Diana Stanley Helper",
"Number": 0,
"Snap": true,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": 16.3471642,
"posY": 1.64091611,
"posZ": -21.3152542,
"rotX": 359.920135,
"rotY": 270.0006,
"rotZ": 0.01688044,
"scaleX": 0.725000262,
"scaleY": 0.725000262,
"scaleZ": 0.725000262
},
"Value": 0,
"XmlUI": ""
},
"3": {
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"Bag": {
"Order": 0
},
"ColorDiffuse": {
"b": 0.576470554,
"g": 0.3333312,
"r": 0.3647037
},
"CustomMesh": {
"CastShadows": true,
"ColliderURL": "http://cloud-3.steamusercontent.com/ugc/1754695414379239413/0B8E68F3B7311DCF2138FB701F78D1D93FBA4CAB/",
"Convex": true,
"DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1754695635919102502/453D4426118C8A6DE2EA281184716E26CA924C84/",
"MaterialIndex": 1,
"MeshURL": "http://cloud-3.steamusercontent.com/ugc/1754695414379239413/0B8E68F3B7311DCF2138FB701F78D1D93FBA4CAB/",
"NormalURL": "",
"TypeIndex": 6
},
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "d866f5",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "function onload(saved_data)\r\n cardsInBag = {}\r\n memoizedCards = {}\r\n searchUrl=\"https://arkhamdb.com/find?q=\"\r\nend\r\n\r\nfunction onObjectEnterContainer(container, object)\r\n if container == self then\r\n --use previously-found cards to prevent redundant ArkhamDB requests\r\n if memoizedCards[object.getName()] then\r\n table.insert(cardsInBag, {name = object.getName() .. memoizedCards[object.getName()], id = object.getGUID()})\r\n recreateButtons()\r\n else\r\n local formatCardName = string.gsub(string.lower(object.getName()), ' ', '+')\r\n\r\n WebRequest.get(searchUrl .. formatCardName, function(req)\r\n searchCallback(req, object)\r\n end)\r\n end\r\n end\r\nend\r\n\r\nfunction onObjectLeaveContainer(container, object)\r\n if container == self then\r\n removeCardByGUID(cardsInBag, object.getGUID())\r\n recreateButtons()\r\n end\r\nend\r\n\r\nfunction searchCallback(req, object)\r\n local traits = ''\r\n\r\n local traitsHtml = string.match(req.text, '\u003cp class=\"card%-traits\"\u003e[^%\u003c]*')\r\n if traitsHtml != nil then\r\n traits = '\\n' .. string.sub(traitsHtml, 24)\r\n end\r\n\r\n --memoize result\r\n memoizedCards[object.getName()] = traits\r\n\r\n table.insert(cardsInBag, {name = object.getName() .. traits, id = object.getGUID()})\r\n recreateButtons()\r\nend\r\n\r\nfunction recreateButtons()\r\n self.clearButtons()\r\n verticalPosition = 1.5\r\n\r\n for _, card in ipairs(cardsInBag) do\r\n if _G['removeCard' .. card.id] == nil then\r\n _G['removeCard' .. card.id] = function()\r\n removeCard(card.id)\r\n end\r\n end\r\n\r\n self.createButton({\r\n label = card.name,\r\n click_function = \"removeCard\" .. card.id,\r\n function_owner = self,\r\n position = {0,0,verticalPosition},\r\n height = 225,\r\n width = 1200,\r\n font_size = 75,\r\n color = {1,1,1},\r\n font_color = {0,0,0}\r\n })\r\n\r\n verticalPosition = verticalPosition - 0.5\r\n end\r\n\r\n countLabel = #cardsInBag == 0 and '' or #cardsInBag\r\n\r\n self.createButton({\r\n label = countLabel,\r\n click_function = 'nothing',\r\n function_owner = self,\r\n position = {0,0,-1.25},\r\n width = 0,\r\n height = 0,\r\n font_size = 225,\r\n font_color = {1,1,1}\r\n })\r\nend\r\n\r\nfunction nothing()\r\nend\r\n\r\nfunction removeCard(cardGUID)\r\n self.takeObject({\r\n guid = cardGUID,\r\n rotation = self.getRotation(),\r\n position = self.getPosition() + Vector(0,0.5,0),\r\n callback_function = function(obj)\r\n obj.resting = true\r\n end\r\n })\r\nend\r\n\r\nfunction removeCardByGUID(bag, guid)\r\n local idx = nil\r\n\r\n for i, v in ipairs (bag) do\r\n if (v.id == guid) then\r\n idx = i\r\n end\r\n end\r\n\r\n if idx ~= nil then\r\n table.remove(cardsInBag, idx)\r\n end\r\nend",
"LuaScriptState": "",
"MaterialIndex": -1,
"MeasureMovement": false,
"MeshIndex": -1,
"Name": "Custom_Model_Bag",
"Nickname": "Gloria Goldberg Helper",
"Number": 0,
"Snap": true,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": 16.3471642,
"posY": 1.64091611,
"posZ": -21.315258,
"rotX": 359.920135,
"rotY": 270.000549,
"rotZ": 0.0168815069,
"scaleX": 0.725000262,
"scaleY": 0.725000262,
"scaleZ": 0.725000262
},
"Value": 0,
"XmlUI": ""
},
"4": {
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"Bag": {
"Order": 0
},
"ColorDiffuse": {
"b": 0.0862727538,
"g": 0.443135172,
"r": 0.06274352
},
"CustomMesh": {
"CastShadows": true,
"ColliderURL": "http://cloud-3.steamusercontent.com/ugc/1754695414379239413/0B8E68F3B7311DCF2138FB701F78D1D93FBA4CAB/",
"Convex": true,
"DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1754695414379787654/F00A76F0DFB4B279F7A5647E1DD1BF730CFC7501/",
"MaterialIndex": 1,
"MeshURL": "http://cloud-3.steamusercontent.com/ugc/1754695414379239413/0B8E68F3B7311DCF2138FB701F78D1D93FBA4CAB/",
"NormalURL": "",
"TypeIndex": 6
},
"CustomUIAssets": [
{
"Name": "combatIcon",
"Type": 0,
"URL": "http://cloud-3.steamusercontent.com/ugc/1754695581870520946/B61CD5BDAE28B1893809915C7C92A8B472BB65BB/"
}
],
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "211ed4",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "function onload(saved_data)\r\n cardsInBag = {}\r\n memoizedCards = {}\r\n cardJson = loadCards()\r\nend\r\n\r\nfunction onObjectEnterContainer(container, object)\r\n if container == self then\r\n --use previously-found cards for faster performace\r\n if memoizedCards[object.getName()] then\r\n table.insert(cardsInBag, {name = object.getName() .. memoizedCards[object.getName()], id = object.getGUID()})\r\n recreateButtons()\r\n else\r\n findCard(object)\r\n end\r\n end\r\nend\r\n\r\nfunction onObjectLeaveContainer(container, object)\r\n if container == self then\r\n removeCardByGUID(cardsInBag, object.getGUID())\r\n recreateButtons()\r\n end\r\nend\r\n\r\nfunction findCard(object)\r\n local icons = ''\r\n\r\n for _, card in pairs (cardJson) do\r\n if (card.name == object.getName()) then\r\n local skillIcons = getIcons(card.skillIcons)\r\n if skillIcons ~= '' then\r\n icons = '\\n' .. skillIcons\r\n end\r\n break\r\n end\r\n end\r\n\r\n --memoize result\r\n memoizedCards[object.getName()] = icons\r\n\r\n table.insert(cardsInBag, {name = object.getName() .. icons, id = object.getGUID()})\r\n recreateButtons()\r\nend\r\n\r\nfunction getIcons(skillIcons)\r\n local icons = ''\r\n\r\n for icon, value in pairs (skillIcons) do\r\n icons = icons .. icon .. ': ' .. value .. ' '\r\n end\r\n\r\n return icons\r\nend\r\n\r\nfunction recreateButtons()\r\n self.clearButtons()\r\n verticalPosition = 1.5\r\n\r\n for _, card in ipairs(cardsInBag) do\r\n if _G['removeCard' .. card.id] == nil then\r\n _G['removeCard' .. card.id] = function()\r\n removeCard(card.id)\r\n end\r\n end\r\n\r\n self.createButton({\r\n label = card.name,\r\n icon = 'combatIcon',\r\n click_function = \"removeCard\" .. card.id,\r\n function_owner = self,\r\n position = {0,0,verticalPosition},\r\n height = 225,\r\n width = 1200,\r\n font_size = 75,\r\n color = {1,1,1},\r\n font_color = {0,0,0}\r\n })\r\n\r\n verticalPosition = verticalPosition - 0.5\r\n end\r\n\r\n countLabel = #cardsInBag == 0 and '' or #cardsInBag\r\n\r\n self.createButton({\r\n label = countLabel,\r\n click_function = 'nothing',\r\n function_owner = self,\r\n position = {0,0,-1.25},\r\n width = 0,\r\n height = 0,\r\n font_size = 225,\r\n font_color = {1,1,1}\r\n })\r\nend\r\n\r\nfunction nothing()\r\nend\r\n\r\nfunction removeCard(cardGUID)\r\n self.takeObject({\r\n guid = cardGUID,\r\n rotation = self.getRotation(),\r\n position = self.getPosition() + Vector(0,0.5,0),\r\n callback_function = function(obj)\r\n obj.resting = true\r\n end\r\n })\r\nend\r\n\r\nfunction removeCardByGUID(bag, guid)\r\n local idx = nil\r\n\r\n for i, v in ipairs (bag) do\r\n if (v.id == guid) then\r\n idx = i\r\n end\r\n end\r\n\r\n if idx ~= nil then\r\n table.remove(cardsInBag, idx)\r\n end\r\nend\r\n\r\nfunction loadCards()\r\n return {{[\"name\"] = \"Random Basic Weakness\",[\"skillIcons\"] = {}},{[\"name\"] = \"Roland Banks\",[\"skillIcons\"] = {[\"Will\"] = 3,[\"Agility\"] = 2,[\"Combat\"] = 4,[\"Intellect\"] = 3}},{[\"name\"] = \"Daisy Walker\",[\"skillIcons\"] = {[\"Will\"] = 3,[\"Agility\"] = 2,[\"Combat\"] = 2,[\"Intellect\"] = 5}},{[\"name\"] = \"\\\"Skids\\\" O'Toole\",[\"skillIcons\"] = {[\"Will\"] = 2,[\"Agility\"] = 4,[\"Combat\"] = 3,[\"Intellect\"] = 3}},{[\"name\"] = \"Agnes Baker\",[\"skillIcons\"] = {[\"Will\"] = 5,[\"Agility\"] = 3,[\"Combat\"] = 2,[\"Intellect\"] = 2}},{[\"name\"] = \"Wendy Adams\",[\"skillIcons\"] = {[\"Will\"] = 4,[\"Agility\"] = 4,[\"Combat\"] = 1,[\"Intellect\"] = 3}},{[\"name\"] = \"Roland's .38 Spec
"LuaScriptState": "",
"MaterialIndex": -1,
"MeasureMovement": false,
"MeshIndex": -1,
"Name": "Custom_Model_Bag",
"Nickname": "Crystallizer of Dreams Helper",
"Number": 0,
"Snap": true,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": 16.3471661,
"posY": 1.64091623,
"posZ": -21.3152618,
"rotX": 359.920135,
"rotY": 270.0005,
"rotZ": 0.0168767888,
"scaleX": 0.725000262,
"scaleY": 0.725000262,
"scaleZ": 0.725000262
},
"Value": 0,
"XmlUI": ""
},
"5": {
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"Bag": {
"Order": 0
},
"ColorDiffuse": {
"b": 0.2470581,
"g": 0.5607843,
"r": 1
},
"CustomMesh": {
"CastShadows": true,
"ColliderURL": "http://cloud-3.steamusercontent.com/ugc/1754695414379239413/0B8E68F3B7311DCF2138FB701F78D1D93FBA4CAB/",
"Convex": true,
"DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1717542004667431170/D073271943724B10CAB5364F01E5E87D770F0FB8/",
"MaterialIndex": 1,
"MeshURL": "http://cloud-3.steamusercontent.com/ugc/1754695414379239413/0B8E68F3B7311DCF2138FB701F78D1D93FBA4CAB/",
"NormalURL": "",
"TypeIndex": 6
},
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "089f35",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "function onload(saved_data)\r\n cardsInBag = {}\r\n skillCards = {}\r\n skillCount = 0\r\n cardJson = loadCards()\r\nend\r\n\r\nfunction onObjectEnterContainer(container, object)\r\n if container == self then\r\n if object.type == 'Card' then\r\n table.insert(cardsInBag, {name = object.getName(), id = object.getGUID()})\r\n recreateButtons()\r\n elseif object.type == 'Deck' and #cardsInBag == 0 then\r\n scanDeck(object)\r\n end\r\n end\r\nend\r\n\r\nfunction onObjectLeaveContainer(container, object)\r\n if container == self then\r\n removeCardByGUID(cardsInBag, object.getGUID())\r\n recreateButtons()\r\n end\r\nend\r\n\r\nfunction scanDeck(object)\r\n for _, containedObject in ipairs(object.getObjects()) do\r\n for _, card in pairs (cardJson) do\r\n if card.name == containedObject.name and card.type == 'skill' then\r\n skillCount = skillCount + 1\r\n table.insert(skillCards, {name = containedObject.name, id = containedObject.guid})\r\n break\r\n end\r\n end\r\n end\r\n\r\n if skillCount \u003e= 10 then\r\n init(object)\r\n else\r\n broadcastToAll('Not enough skill cards in deck', Table)\r\n\r\n self.takeObject({\r\n guid = object.getGUID(),\r\n rotation = self.getRotation(),\r\n position = self.getPosition() + Vector(0,0.5,0),\r\n callback_function = function(obj)\r\n obj.resting = true\r\n end\r\n })\r\n end\r\nend\r\n\r\nfunction init(object)\r\n local randomSkills = {table.unpack(FYShuffle(skillCards), 1, 5)}\r\n height = 1\r\n\r\n self.takeObject({\r\n guid = object.getGUID(),\r\n rotation = self.getRotation(),\r\n position = self.getPosition() + Vector(0,0,-2.5),\r\n callback_function = function(obj)\r\n for _, skillCards in ipairs (randomSkills) do\r\n obj.takeObject({\r\n guid = skillCards.id,\r\n rotation = self.getRotation(),\r\n position = self.getPosition() + Vector(0,height,0)\r\n })\r\n\r\n height = height + 0.5\r\n end\r\n end\r\n })\r\nend\r\n\r\nfunction FYShuffle(tInput)\r\n local tReturn = {}\r\n math.randomseed(os.time())\r\n\r\n for i = #tInput, 1, -1 do\r\n local j = math.random(i)\r\n tInput[i], tInput[j] = tInput[j], tInput[i]\r\n table.insert(tReturn, tInput[i])\r\n end\r\n\r\n return tReturn\r\nend\r\n\r\nfunction recreateButtons()\r\n self.clearButtons()\r\n verticalPosition = 1.5\r\n\r\n for _, card in ipairs(cardsInBag) do\r\n if _G['removeCard' .. card.id] == nil then\r\n _G['removeCard' .. card.id] = function()\r\n removeCard(card.id)\r\n end\r\n end\r\n\r\n self.createButton({\r\n label = card.name,\r\n click_function = \"removeCard\" .. card.id,\r\n function_owner = self,\r\n position = {0,0,verticalPosition},\r\n height = 200,\r\n width = 1200,\r\n font_size = 75,\r\n color = {1,1,1},\r\n font_color = {0,0,0}\r\n })\r\n\r\n verticalPosition = verticalPosition - 0.5\r\n end\r\n\r\n countLabel = #cardsInBag == 0 and '' or #cardsInBag\r\n\r\n self.createButton({\r\n label = countLabel,\r\n click_function = 'nothing',\r\n function_owner = self,\r\n position = {0,0,-1.25},\r\n width = 0,\r\n height = 0,\r\n font_size = 225,\r\n font_color = {1,1,1}\r\n })\r\nend\r\n\r\nfunction nothing()\r\nend\r\n\r\nfunction removeCard(cardGUID)\r\n self.takeObject({\r\n guid = cardGUID,\r\n rotation = self.getRotation(),\r\n position = self.getPosition() + Vector(0,0.5,0),\r\n callback_function = function(obj)\r\n obj.
"LuaScriptState": "",
"MaterialIndex": -1,
"MeasureMovement": false,
"MeshIndex": -1,
"Name": "Custom_Model_Bag",
"Nickname": "Ancestral Knowledge Helper",
"Number": 0,
"Snap": true,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": 16.347168,
"posY": 1.64091635,
"posZ": -21.3152657,
"rotX": 359.920135,
"rotY": 270.000427,
"rotZ": 0.0168802254,
"scaleX": 0.725000262,
"scaleY": 0.725000262,
"scaleZ": 0.725000262
},
"Value": 0,
"XmlUI": ""
},
"6": {
"AltLookAngle": {
"x": 0,
"y": 0,
"z": 0
},
"Autoraise": true,
"Bag": {
"Order": 0
},
"ColorDiffuse": {
"b": 0.576470554,
"g": 0.333332181,
"r": 0.364704728
},
"CustomMesh": {
"CastShadows": true,
"ColliderURL": "http://cloud-3.steamusercontent.com/ugc/1754695414379239413/0B8E68F3B7311DCF2138FB701F78D1D93FBA4CAB/",
"Convex": true,
"DiffuseURL": "http://cloud-3.steamusercontent.com/ugc/1754695853007989004/9153BC204FC707AE564ECFAC063A11CB8C2B5D1E/",
"MaterialIndex": 1,
"MeshURL": "http://cloud-3.steamusercontent.com/ugc/1754695414379239413/0B8E68F3B7311DCF2138FB701F78D1D93FBA4CAB/",
"NormalURL": "",
"TypeIndex": 6
},
"Description": "",
"DragSelectable": true,
"GMNotes": "",
"GUID": "13f090",
"Grid": true,
"GridProjection": false,
"Hands": false,
"HideWhenFaceDown": false,
"IgnoreFoW": false,
"LayoutGroupSortIndex": 0,
"Locked": false,
"LuaScript": "function onload(saved_data)\r\n cardsInBag = {}\r\n memoizedCards = {}\r\n cardJson = loadCards()\r\nend\r\n\r\nfunction onObjectEnterContainer(container, object)\r\n if container == self then\r\n --use previously-found cards for faster performace\r\n if memoizedCards[object.getName()] then\r\n table.insert(cardsInBag, {name = object.getName() .. memoizedCards[object.getName()], id = object.getGUID()})\r\n recreateButtons()\r\n else\r\n findCard(object)\r\n end\r\n end\r\nend\r\n\r\nfunction onObjectLeaveContainer(container, object)\r\n if container == self then\r\n removeCardByGUID(cardsInBag, object.getGUID())\r\n recreateButtons()\r\n end\r\nend\r\n\r\nfunction findCard(object)\r\n local icons = ''\r\n\r\n for _, card in pairs (cardJson) do\r\n if (card.name == object.getName()) then\r\n local skillIcons = getIcons(card.skillIcons)\r\n if skillIcons ~= '' then\r\n icons = '\\n' .. skillIcons\r\n end\r\n break\r\n end\r\n end\r\n\r\n --memoize result\r\n memoizedCards[object.getName()] = icons\r\n\r\n table.insert(cardsInBag, {name = object.getName() .. icons, id = object.getGUID()})\r\n recreateButtons()\r\nend\r\n\r\nfunction getIcons(skillIcons)\r\n local icons = ''\r\n\r\n for icon, value in pairs (skillIcons) do\r\n icons = icons .. icon .. ': ' .. value .. ' '\r\n end\r\n\r\n return icons\r\nend\r\n\r\nfunction recreateButtons()\r\n self.clearButtons()\r\n verticalPosition = 1.5\r\n\r\n for _, card in ipairs(cardsInBag) do\r\n if _G['removeCard' .. card.id] == nil then\r\n _G['removeCard' .. card.id] = function()\r\n removeCard(card.id)\r\n end\r\n end\r\n\r\n self.createButton({\r\n label = card.name,\r\n icon = 'combatIcon',\r\n click_function = \"removeCard\" .. card.id,\r\n function_owner = self,\r\n position = {0,0,verticalPosition},\r\n height = 225,\r\n width = 1200,\r\n font_size = 75,\r\n color = {1,1,1},\r\n font_color = {0,0,0}\r\n })\r\n\r\n verticalPosition = verticalPosition - 0.5\r\n end\r\n\r\n countLabel = #cardsInBag == 0 and '' or #cardsInBag\r\n\r\n self.createButton({\r\n label = countLabel,\r\n click_function = 'nothing',\r\n function_owner = self,\r\n position = {0,0,-1.25},\r\n width = 0,\r\n height = 0,\r\n font_size = 225,\r\n font_color = {1,1,1}\r\n })\r\nend\r\n\r\nfunction nothing()\r\nend\r\n\r\nfunction removeCard(cardGUID)\r\n self.takeObject({\r\n guid = cardGUID,\r\n rotation = self.getRotation(),\r\n position = self.getPosition() + Vector(0,0.5,0),\r\n callback_function = function(obj)\r\n obj.resting = true\r\n end\r\n })\r\nend\r\n\r\nfunction removeCardByGUID(bag, guid)\r\n local idx = nil\r\n\r\n for i, v in ipairs (bag) do\r\n if (v.id == guid) then\r\n idx = i\r\n end\r\n end\r\n\r\n if idx ~= nil then\r\n table.remove(cardsInBag, idx)\r\n end\r\nend\r\n\r\nfunction loadCards()\r\n return {{[\"name\"] = \"Random Basic Weakness\",[\"skillIcons\"] = {}},{[\"name\"] = \"Roland Banks\",[\"skillIcons\"] = {[\"Will\"] = 3,[\"Agility\"] = 2,[\"Combat\"] = 4,[\"Intellect\"] = 3}},{[\"name\"] = \"Daisy Walker\",[\"skillIcons\"] = {[\"Will\"] = 3,[\"Agility\"] = 2,[\"Combat\"] = 2,[\"Intellect\"] = 5}},{[\"name\"] = \"\\\"Skids\\\" O'Toole\",[\"skillIcons\"] = {[\"Will\"] = 2,[\"Agility\"] = 4,[\"Combat\"] = 3,[\"Intellect\"] = 3}},{[\"name\"] = \"Agnes Baker\",[\"skillIcons\"] = {[\"Will\"] = 5,[\"Agility\"] = 3,[\"Combat\"] = 2,[\"Intellect\"] = 2}},{[\"name\"] = \"Wendy Adams\",[\"skillIcons\"] = {[\"Will\"] = 4,[\"Agility\"] = 4,[\"Combat\"] = 1,[\"Intellect\"] = 3}},{[\"name\"] = \"Roland's .38 Spec
"LuaScriptState": "",
"MaterialIndex": -1,
"MeasureMovement": false,
"MeshIndex": -1,
"Name": "Custom_Model_Bag",
"Nickname": "Astronomical Atlas Helper",
"Number": 0,
"Snap": true,
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": 12.8022881,
"posY": 1.64571238,
"posZ": -21.8569355,
"rotX": 359.9203,
"rotY": 270.000122,
"rotZ": 0.0168367587,
"scaleX": 0.725000262,
"scaleY": 0.725000262,
"scaleZ": 0.725000262
},
"Value": 0,
"XmlUI": ""
}
},
"Sticky": true,
"Tooltip": true,
"Transform": {
"posX": 30.238,
"posY": 4.406,
"posZ": -33.917,
"rotX": 0,
"rotY": 270,
"rotZ": 0,
"scaleX": 0.725000262,
"scaleY": 0.725000262,
"scaleZ": 0.725000262
},
"Value": 0,
"XmlUI": ""
}