848 lines
46 KiB
YAML
848 lines
46 KiB
YAML
AltLookAngle:
|
|
x: 0.0
|
|
y: 0.0
|
|
z: 0.0
|
|
Autoraise: true
|
|
Bag:
|
|
Order: 0
|
|
ColorDiffuse:
|
|
b: 1.0
|
|
g: 1.0
|
|
r: 1.0
|
|
CustomMesh:
|
|
CastShadows: true
|
|
ColliderURL: http://cloud-3.steamusercontent.com/ugc/1754695414379239413/0B8E68F3B7311DCF2138FB701F78D1D93FBA4CAB/
|
|
Convex: true
|
|
DiffuseURL: http://cloud-3.steamusercontent.com/ugc/1750192233783143973/D526236AAE16BDBB98D3F30E27BAFC1D3E21F4AC/
|
|
MaterialIndex: 1
|
|
MeshURL: http://cloud-3.steamusercontent.com/ugc/1754695414379239413/0B8E68F3B7311DCF2138FB701F78D1D93FBA4CAB/
|
|
NormalURL: ''
|
|
TypeIndex: 6
|
|
Description: 'Drop cards here to display name, cost and skill icons.
|
|
|
|
|
|
See context menu for options.'
|
|
DragSelectable: true
|
|
GMNotes: ''
|
|
GUID: d45664
|
|
Grid: true
|
|
GridProjection: false
|
|
Hands: false
|
|
HideWhenFaceDown: false
|
|
IgnoreFoW: false
|
|
LayoutGroupSortIndex: 0
|
|
Locked: false
|
|
LuaScript: !include 'Custom_Model_Bag Attachment Helper d45664.ttslua'
|
|
LuaScriptState: '[[],true,false]'
|
|
MaterialIndex: -1
|
|
MeasureMovement: false
|
|
MeshIndex: -1
|
|
Name: Custom_Model_Bag
|
|
Nickname: Attachment Helper
|
|
Number: 0
|
|
Snap: true
|
|
States:
|
|
'1':
|
|
AltLookAngle:
|
|
x: 0.0
|
|
y: 0.0
|
|
z: 0.0
|
|
Autoraise: true
|
|
Bag:
|
|
Order: 0
|
|
ColorDiffuse:
|
|
b: 1.0
|
|
g: 1.0
|
|
r: 1.0
|
|
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: 'Drop cards here to display name, cost and skill icons.
|
|
|
|
|
|
See context menu for options.'
|
|
DragSelectable: true
|
|
GMNotes: ''
|
|
GUID: f550dc
|
|
Grid: true
|
|
GridProjection: false
|
|
Hands: false
|
|
HideWhenFaceDown: false
|
|
IgnoreFoW: false
|
|
LayoutGroupSortIndex: 0
|
|
Locked: false
|
|
LuaScript: "-- Attachment Helper\r\n-- updated by: Chr1Z\r\n-- original by:\
|
|
\ -\r\n-- description: displays cards in it with cost/skill icons\r\n\
|
|
information = {\r\n version = \"1.4\",\r\n last_updated = \"10.10.2022\"\
|
|
\r\n}\r\n\r\n-- save state and options to restore onLoad\r\nfunction onSave()\
|
|
\ return JSON.encode({ cardsInBag, showCost, showIcons }) end\r\n\r\n-- load\
|
|
\ variables and create context menu\r\nfunction onload(saved_data)\r\n if\
|
|
\ saved_data ~= \"\" and saved_data ~= nil then\r\n local loaded_data\
|
|
\ = JSON.decode(saved_data)\r\n cardsInBag = loaded_data[1]\r\n\
|
|
\ showCost = loaded_data[2]\r\n showIcons = loaded_data[3]\r\
|
|
\n else\r\n cardsInBag = {}\r\n showCost = true\r\n \
|
|
\ showIcons = true\r\n end\r\n\r\n recreateButtons()\r\n\r\n self.addContextMenuItem(\"\
|
|
More Information\", function()\r\n printToAll(\"------------------------------\"\
|
|
, \"White\")\r\n printToAll(\"Attachment Helper v\" .. information[\"\
|
|
version\"] .. \" by Chr1Z\", \"Orange\")\r\n printToAll(\"original by:\
|
|
\ bankey\", \"White\")\r\n printToAll(\"last updated: \" .. information[\"\
|
|
last_updated\"], \"White\")\r\n end)\r\n\r\n self.addContextMenuItem(\"\
|
|
Toggle cost\", function(color)\r\n showCost = not showCost\r\n \
|
|
\ printToColor(\"Show cost of cards: \" .. tostring(showCost), color, \"White\"\
|
|
)\r\n refresh()\r\n end)\r\n\r\n self.addContextMenuItem(\"Toggle\
|
|
\ skill icons\", function(color)\r\n showIcons = not showIcons\r\n \
|
|
\ printToColor(\"Show skill icons of cards: \" .. tostring(showIcons),\
|
|
\ color, \"White\")\r\n refresh()\r\n end)\r\nend\r\n\r\n-- called\
|
|
\ for every card that enters\r\nfunction onObjectEnterContainer(container, object)\r\
|
|
\n if container == self then\r\n findCard(object.getGUID(), object.getName(),\
|
|
\ object.getGMNotes())\r\n recreateButtons()\r\n end\r\nend\r\n\r\n\
|
|
-- removes leaving cards from the \"cardInBag\" table\r\nfunction onObjectLeaveContainer(container,\
|
|
\ object)\r\n if container == self then\r\n local guid = object.getGUID()\r\
|
|
\n for i, card in ipairs(cardsInBag) do\r\n if card.id ==\
|
|
\ guid then table.remove(cardsInBag, i) end\r\n end\r\n recreateButtons()\r\
|
|
\n end\r\nend\r\n\r\n-- refreshes displayed buttons based on contained cards\r\
|
|
\nfunction refresh()\r\n cardsInBag = {}\r\n for _, object in ipairs(self.getObjects())\
|
|
\ do\r\n findCard(object.guid, object.name, object.gm_notes)\r\n end\r\
|
|
\n recreateButtons()\r\nend\r\n\r\n-- gets cost and icons for a card\r\n\
|
|
function findCard(guid, name, GMNotes)\r\n local cost = \"\"\r\n local\
|
|
\ icons = {}\r\n local metadata = {}\r\n\r\n if name == nil or name ==\
|
|
\ \"\" then name = \"unnamed\" end\r\n\r\n if showCost or showIcons then\r\
|
|
\n metadata = JSON.decode(GMNotes)\r\n end\r\n\r\n if showCost\
|
|
\ then\r\n if GMNotes ~= \"\" then cost = metadata.cost end\r\n \
|
|
\ if cost == nil or cost == \"\" then cost = \"\u2013\" end\r\n name\
|
|
\ = \"[\" .. cost .. \"] \" .. name\r\n end\r\n\r\n if showIcons then\r\
|
|
\n if GMNotes ~= \"\" then\r\n icons[1] = metadata.wildIcons\r\
|
|
\n icons[2] = metadata.willpowerIcons\r\n icons[3] = metadata.intellectIcons\r\
|
|
\n icons[4] = metadata.fightIcons\r\n icons[5] = metadata.agilityIcons\r\
|
|
\n end\r\n\r\n local IconTypes = { \"Wild\", \"Willpower\", \"\
|
|
Intellect\", \"Fight\", \"Agility\" }\r\n local found = false\r\n \
|
|
\ for i = 1, 5 do\r\n if icons[i] ~= nil and icons[i] ~= \"\"\
|
|
\ then\r\n if found == false then\r\n name\
|
|
\ = name .. \"\\n\" .. IconTypes[i] .. \": \" .. icons[i]\r\n \
|
|
\ found = true\r\n else\r\n name = name\
|
|
\ .. \" \" .. IconTypes[i] .. \": \" .. icons[i]\r\n end\r\n\
|
|
\ end\r\n end\r\n end\r\n\r\n table.insert(cardsInBag,\
|
|
\ { name = name, id = guid })\r\nend\r\n\r\n-- recreates buttons with up-to-date\
|
|
\ labels\r\nfunction recreateButtons()\r\n self.clearButtons()\r\n local\
|
|
\ verticalPosition = 1.65\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 = string.len(card.name)\
|
|
\ > 20 and 75 or 100\r\n })\r\n\r\n verticalPosition = verticalPosition\
|
|
\ - 0.5\r\n end\r\n\r\r\n self.createButton({\r\n label \
|
|
\ = countLabel,\r\n click_function = 'none',\r\n function_owner\
|
|
\ = self,\r\n position = { 0, 0, -1.35 },\r\n height \
|
|
\ = 0,\r\n width = 0,\r\n font_size = 225,\r\
|
|
\n font_color = { 1, 1, 1 }\r\n })\r\nend\r\n\r\n-- click-function\
|
|
\ for buttons to take a card out of the bag\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.25, 0),\r\n callback_function\
|
|
\ = function(obj) obj.resting = true end\r\n })\r\nend"
|
|
LuaScriptState: '[[],true,false]'
|
|
MaterialIndex: -1
|
|
MeasureMovement: false
|
|
MeshIndex: -1
|
|
Name: Custom_Model_Bag
|
|
Nickname: Sefina Rousseau Helper
|
|
Number: 0
|
|
Snap: true
|
|
Sticky: true
|
|
Tags:
|
|
- Asset
|
|
- scesetup_memory_object
|
|
Tooltip: true
|
|
Transform:
|
|
posX: 14.6885748
|
|
posY: 1.71333456
|
|
posZ: -26.0148544
|
|
rotX: 359.920135
|
|
rotY: 270.000122
|
|
rotZ: 0.01688583
|
|
scaleX: 0.7951615
|
|
scaleY: 1.0
|
|
scaleZ: 0.7951615
|
|
Value: 0
|
|
XmlUI: ''
|
|
'2':
|
|
AltLookAngle:
|
|
x: 0.0
|
|
y: 0.0
|
|
z: 0.0
|
|
Autoraise: true
|
|
Bag:
|
|
Order: 0
|
|
ColorDiffuse:
|
|
b: 1.0
|
|
g: 1.0
|
|
r: 1.0
|
|
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
|
|
Description: 'Drop cards here to display name, cost and skill icons.
|
|
|
|
|
|
See context menu for options.'
|
|
DragSelectable: true
|
|
GMNotes: ''
|
|
GUID: 2fbbca
|
|
Grid: true
|
|
GridProjection: false
|
|
Hands: false
|
|
HideWhenFaceDown: false
|
|
IgnoreFoW: false
|
|
LayoutGroupSortIndex: 0
|
|
Locked: false
|
|
LuaScript: "-- Attachment Helper\r\n-- updated by: Chr1Z\r\n-- original by:\
|
|
\ -\r\n-- description: displays cards in it with cost/skill icons\r\n\
|
|
information = {\r\n version = \"1.4\",\r\n last_updated = \"10.10.2022\"\
|
|
\r\n}\r\n\r\n-- save state and options to restore onLoad\r\nfunction onSave()\
|
|
\ return JSON.encode({ cardsInBag, showCost, showIcons }) end\r\n\r\n-- load\
|
|
\ variables and create context menu\r\nfunction onload(saved_data)\r\n if\
|
|
\ saved_data ~= \"\" and saved_data ~= nil then\r\n local loaded_data\
|
|
\ = JSON.decode(saved_data)\r\n cardsInBag = loaded_data[1]\r\n\
|
|
\ showCost = loaded_data[2]\r\n showIcons = loaded_data[3]\r\
|
|
\n else\r\n cardsInBag = {}\r\n showCost = true\r\n \
|
|
\ showIcons = true\r\n end\r\n\r\n recreateButtons()\r\n\r\n self.addContextMenuItem(\"\
|
|
More Information\", function()\r\n printToAll(\"------------------------------\"\
|
|
, \"White\")\r\n printToAll(\"Attachment Helper v\" .. information[\"\
|
|
version\"] .. \" by Chr1Z\", \"Orange\")\r\n printToAll(\"original by:\
|
|
\ bankey\", \"White\")\r\n printToAll(\"last updated: \" .. information[\"\
|
|
last_updated\"], \"White\")\r\n end)\r\n\r\n self.addContextMenuItem(\"\
|
|
Toggle cost\", function(color)\r\n showCost = not showCost\r\n \
|
|
\ printToColor(\"Show cost of cards: \" .. tostring(showCost), color, \"White\"\
|
|
)\r\n refresh()\r\n end)\r\n\r\n self.addContextMenuItem(\"Toggle\
|
|
\ skill icons\", function(color)\r\n showIcons = not showIcons\r\n \
|
|
\ printToColor(\"Show skill icons of cards: \" .. tostring(showIcons),\
|
|
\ color, \"White\")\r\n refresh()\r\n end)\r\nend\r\n\r\n-- called\
|
|
\ for every card that enters\r\nfunction onObjectEnterContainer(container, object)\r\
|
|
\n if container == self then\r\n findCard(object.getGUID(), object.getName(),\
|
|
\ object.getGMNotes())\r\n recreateButtons()\r\n end\r\nend\r\n\r\n\
|
|
-- removes leaving cards from the \"cardInBag\" table\r\nfunction onObjectLeaveContainer(container,\
|
|
\ object)\r\n if container == self then\r\n local guid = object.getGUID()\r\
|
|
\n for i, card in ipairs(cardsInBag) do\r\n if card.id ==\
|
|
\ guid then table.remove(cardsInBag, i) end\r\n end\r\n recreateButtons()\r\
|
|
\n end\r\nend\r\n\r\n-- refreshes displayed buttons based on contained cards\r\
|
|
\nfunction refresh()\r\n cardsInBag = {}\r\n for _, object in ipairs(self.getObjects())\
|
|
\ do\r\n findCard(object.guid, object.name, object.gm_notes)\r\n end\r\
|
|
\n recreateButtons()\r\nend\r\n\r\n-- gets cost and icons for a card\r\n\
|
|
function findCard(guid, name, GMNotes)\r\n local cost = \"\"\r\n local\
|
|
\ icons = {}\r\n local metadata = {}\r\n\r\n if name == nil or name ==\
|
|
\ \"\" then name = \"unnamed\" end\r\n\r\n if showCost or showIcons then\r\
|
|
\n metadata = JSON.decode(GMNotes)\r\n end\r\n\r\n if showCost\
|
|
\ then\r\n if GMNotes ~= \"\" then cost = metadata.cost end\r\n \
|
|
\ if cost == nil or cost == \"\" then cost = \"\u2013\" end\r\n name\
|
|
\ = \"[\" .. cost .. \"] \" .. name\r\n end\r\n\r\n if showIcons then\r\
|
|
\n if GMNotes ~= \"\" then\r\n icons[1] = metadata.wildIcons\r\
|
|
\n icons[2] = metadata.willpowerIcons\r\n icons[3] = metadata.intellectIcons\r\
|
|
\n icons[4] = metadata.fightIcons\r\n icons[5] = metadata.agilityIcons\r\
|
|
\n end\r\n\r\n local IconTypes = { \"Wild\", \"Willpower\", \"\
|
|
Intellect\", \"Fight\", \"Agility\" }\r\n local found = false\r\n \
|
|
\ for i = 1, 5 do\r\n if icons[i] ~= nil and icons[i] ~= \"\"\
|
|
\ then\r\n if found == false then\r\n name\
|
|
\ = name .. \"\\n\" .. IconTypes[i] .. \": \" .. icons[i]\r\n \
|
|
\ found = true\r\n else\r\n name = name\
|
|
\ .. \" \" .. IconTypes[i] .. \": \" .. icons[i]\r\n end\r\n\
|
|
\ end\r\n end\r\n end\r\n\r\n table.insert(cardsInBag,\
|
|
\ { name = name, id = guid })\r\nend\r\n\r\n-- recreates buttons with up-to-date\
|
|
\ labels\r\nfunction recreateButtons()\r\n self.clearButtons()\r\n local\
|
|
\ verticalPosition = 1.65\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 = string.len(card.name)\
|
|
\ > 20 and 75 or 100\r\n })\r\n\r\n verticalPosition = verticalPosition\
|
|
\ - 0.5\r\n end\r\n\r\r\n self.createButton({\r\n label \
|
|
\ = countLabel,\r\n click_function = 'none',\r\n function_owner\
|
|
\ = self,\r\n position = { 0, 0, -1.35 },\r\n height \
|
|
\ = 0,\r\n width = 0,\r\n font_size = 225,\r\
|
|
\n font_color = { 1, 1, 1 }\r\n })\r\nend\r\n\r\n-- click-function\
|
|
\ for buttons to take a card out of the bag\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.25, 0),\r\n callback_function\
|
|
\ = function(obj) obj.resting = true end\r\n })\r\nend"
|
|
LuaScriptState: '[[],true,false]'
|
|
MaterialIndex: -1
|
|
MeasureMovement: false
|
|
MeshIndex: -1
|
|
Name: Custom_Model_Bag
|
|
Nickname: Diana Stanley Helper
|
|
Number: 0
|
|
Snap: true
|
|
Sticky: true
|
|
Tags:
|
|
- Asset
|
|
- scesetup_memory_object
|
|
Tooltip: true
|
|
Transform:
|
|
posX: 14.6885757
|
|
posY: 1.71333444
|
|
posZ: -26.0148582
|
|
rotX: 359.920135
|
|
rotY: 270.000122
|
|
rotZ: 0.0168847367
|
|
scaleX: 0.7951615
|
|
scaleY: 1.0
|
|
scaleZ: 0.7951615
|
|
Value: 0
|
|
XmlUI: ''
|
|
'3':
|
|
AltLookAngle:
|
|
x: 0.0
|
|
y: 0.0
|
|
z: 0.0
|
|
Autoraise: true
|
|
Bag:
|
|
Order: 0
|
|
ColorDiffuse:
|
|
b: 1.0
|
|
g: 1.0
|
|
r: 1.0
|
|
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: 'Drop cards here to display name, cost and skill icons.
|
|
|
|
|
|
See context menu for options.'
|
|
DragSelectable: true
|
|
GMNotes: ''
|
|
GUID: 31d5dd
|
|
Grid: true
|
|
GridProjection: false
|
|
Hands: false
|
|
HideWhenFaceDown: false
|
|
IgnoreFoW: false
|
|
LayoutGroupSortIndex: 0
|
|
Locked: false
|
|
LuaScript: "-- Attachment Helper\r\n-- updated by: Chr1Z\r\n-- original by:\
|
|
\ -\r\n-- description: displays cards in it with cost/skill icons\r\n\
|
|
information = {\r\n version = \"1.4\",\r\n last_updated = \"10.10.2022\"\
|
|
\r\n}\r\n\r\n-- save state and options to restore onLoad\r\nfunction onSave()\
|
|
\ return JSON.encode({ cardsInBag, showCost, showIcons }) end\r\n\r\n-- load\
|
|
\ variables and create context menu\r\nfunction onload(saved_data)\r\n if\
|
|
\ saved_data ~= \"\" and saved_data ~= nil then\r\n local loaded_data\
|
|
\ = JSON.decode(saved_data)\r\n cardsInBag = loaded_data[1]\r\n\
|
|
\ showCost = loaded_data[2]\r\n showIcons = loaded_data[3]\r\
|
|
\n else\r\n cardsInBag = {}\r\n showCost = true\r\n \
|
|
\ showIcons = true\r\n end\r\n\r\n recreateButtons()\r\n\r\n self.addContextMenuItem(\"\
|
|
More Information\", function()\r\n printToAll(\"------------------------------\"\
|
|
, \"White\")\r\n printToAll(\"Attachment Helper v\" .. information[\"\
|
|
version\"] .. \" by Chr1Z\", \"Orange\")\r\n printToAll(\"original by:\
|
|
\ bankey\", \"White\")\r\n printToAll(\"last updated: \" .. information[\"\
|
|
last_updated\"], \"White\")\r\n end)\r\n\r\n self.addContextMenuItem(\"\
|
|
Toggle cost\", function(color)\r\n showCost = not showCost\r\n \
|
|
\ printToColor(\"Show cost of cards: \" .. tostring(showCost), color, \"White\"\
|
|
)\r\n refresh()\r\n end)\r\n\r\n self.addContextMenuItem(\"Toggle\
|
|
\ skill icons\", function(color)\r\n showIcons = not showIcons\r\n \
|
|
\ printToColor(\"Show skill icons of cards: \" .. tostring(showIcons),\
|
|
\ color, \"White\")\r\n refresh()\r\n end)\r\nend\r\n\r\n-- called\
|
|
\ for every card that enters\r\nfunction onObjectEnterContainer(container, object)\r\
|
|
\n if container == self then\r\n findCard(object.getGUID(), object.getName(),\
|
|
\ object.getGMNotes())\r\n recreateButtons()\r\n end\r\nend\r\n\r\n\
|
|
-- removes leaving cards from the \"cardInBag\" table\r\nfunction onObjectLeaveContainer(container,\
|
|
\ object)\r\n if container == self then\r\n local guid = object.getGUID()\r\
|
|
\n for i, card in ipairs(cardsInBag) do\r\n if card.id ==\
|
|
\ guid then table.remove(cardsInBag, i) end\r\n end\r\n recreateButtons()\r\
|
|
\n end\r\nend\r\n\r\n-- refreshes displayed buttons based on contained cards\r\
|
|
\nfunction refresh()\r\n cardsInBag = {}\r\n for _, object in ipairs(self.getObjects())\
|
|
\ do\r\n findCard(object.guid, object.name, object.gm_notes)\r\n end\r\
|
|
\n recreateButtons()\r\nend\r\n\r\n-- gets cost and icons for a card\r\n\
|
|
function findCard(guid, name, GMNotes)\r\n local cost = \"\"\r\n local\
|
|
\ icons = {}\r\n local metadata = {}\r\n\r\n if name == nil or name ==\
|
|
\ \"\" then name = \"unnamed\" end\r\n\r\n if showCost or showIcons then\r\
|
|
\n metadata = JSON.decode(GMNotes)\r\n end\r\n\r\n if showCost\
|
|
\ then\r\n if GMNotes ~= \"\" then cost = metadata.cost end\r\n \
|
|
\ if cost == nil or cost == \"\" then cost = \"\u2013\" end\r\n name\
|
|
\ = \"[\" .. cost .. \"] \" .. name\r\n end\r\n\r\n if showIcons then\r\
|
|
\n if GMNotes ~= \"\" then\r\n icons[1] = metadata.wildIcons\r\
|
|
\n icons[2] = metadata.willpowerIcons\r\n icons[3] = metadata.intellectIcons\r\
|
|
\n icons[4] = metadata.fightIcons\r\n icons[5] = metadata.agilityIcons\r\
|
|
\n end\r\n\r\n local IconTypes = { \"Wild\", \"Willpower\", \"\
|
|
Intellect\", \"Fight\", \"Agility\" }\r\n local found = false\r\n \
|
|
\ for i = 1, 5 do\r\n if icons[i] ~= nil and icons[i] ~= \"\"\
|
|
\ then\r\n if found == false then\r\n name\
|
|
\ = name .. \"\\n\" .. IconTypes[i] .. \": \" .. icons[i]\r\n \
|
|
\ found = true\r\n else\r\n name = name\
|
|
\ .. \" \" .. IconTypes[i] .. \": \" .. icons[i]\r\n end\r\n\
|
|
\ end\r\n end\r\n end\r\n\r\n table.insert(cardsInBag,\
|
|
\ { name = name, id = guid })\r\nend\r\n\r\n-- recreates buttons with up-to-date\
|
|
\ labels\r\nfunction recreateButtons()\r\n self.clearButtons()\r\n local\
|
|
\ verticalPosition = 1.65\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 = string.len(card.name)\
|
|
\ > 20 and 75 or 100\r\n })\r\n\r\n verticalPosition = verticalPosition\
|
|
\ - 0.5\r\n end\r\n\r\r\n self.createButton({\r\n label \
|
|
\ = countLabel,\r\n click_function = 'none',\r\n function_owner\
|
|
\ = self,\r\n position = { 0, 0, -1.35 },\r\n height \
|
|
\ = 0,\r\n width = 0,\r\n font_size = 225,\r\
|
|
\n font_color = { 1, 1, 1 }\r\n })\r\nend\r\n\r\n-- click-function\
|
|
\ for buttons to take a card out of the bag\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.25, 0),\r\n callback_function\
|
|
\ = function(obj) obj.resting = true end\r\n })\r\nend"
|
|
LuaScriptState: '[[],true,false]'
|
|
MaterialIndex: -1
|
|
MeasureMovement: false
|
|
MeshIndex: -1
|
|
Name: Custom_Model_Bag
|
|
Nickname: Gloria Goldberg Helper
|
|
Number: 0
|
|
Snap: true
|
|
Sticky: true
|
|
Tags:
|
|
- Asset
|
|
- scesetup_memory_object
|
|
Tooltip: true
|
|
Transform:
|
|
posX: 14.6885767
|
|
posY: 1.71333444
|
|
posZ: -26.0148621
|
|
rotX: 359.920135
|
|
rotY: 270.000122
|
|
rotZ: 0.01688558
|
|
scaleX: 0.7951615
|
|
scaleY: 1.0
|
|
scaleZ: 0.7951615
|
|
Value: 0
|
|
XmlUI: ''
|
|
'4':
|
|
AltLookAngle:
|
|
x: 0.0
|
|
y: 0.0
|
|
z: 0.0
|
|
Autoraise: true
|
|
Bag:
|
|
Order: 0
|
|
ColorDiffuse:
|
|
b: 1.0
|
|
g: 1.0
|
|
r: 1.0
|
|
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
|
|
Description: 'Drop cards here to display name, cost and skill icons.
|
|
|
|
|
|
See context menu for options.'
|
|
DragSelectable: true
|
|
GMNotes: ''
|
|
GUID: 56aa96
|
|
Grid: true
|
|
GridProjection: false
|
|
Hands: false
|
|
HideWhenFaceDown: false
|
|
IgnoreFoW: false
|
|
LayoutGroupSortIndex: 0
|
|
Locked: false
|
|
LuaScript: "-- Attachment Helper\r\n-- updated by: Chr1Z\r\n-- original by:\
|
|
\ -\r\n-- description: displays cards in it with cost/skill icons\r\n\
|
|
information = {\r\n version = \"1.4\",\r\n last_updated = \"10.10.2022\"\
|
|
\r\n}\r\n\r\n-- save state and options to restore onLoad\r\nfunction onSave()\
|
|
\ return JSON.encode({ cardsInBag, showCost, showIcons }) end\r\n\r\n-- load\
|
|
\ variables and create context menu\r\nfunction onload(saved_data)\r\n if\
|
|
\ saved_data ~= \"\" and saved_data ~= nil then\r\n local loaded_data\
|
|
\ = JSON.decode(saved_data)\r\n cardsInBag = loaded_data[1]\r\n\
|
|
\ showCost = loaded_data[2]\r\n showIcons = loaded_data[3]\r\
|
|
\n else\r\n cardsInBag = {}\r\n showCost = true\r\n \
|
|
\ showIcons = true\r\n end\r\n\r\n recreateButtons()\r\n\r\n self.addContextMenuItem(\"\
|
|
More Information\", function()\r\n printToAll(\"------------------------------\"\
|
|
, \"White\")\r\n printToAll(\"Attachment Helper v\" .. information[\"\
|
|
version\"] .. \" by Chr1Z\", \"Orange\")\r\n printToAll(\"original by:\
|
|
\ bankey\", \"White\")\r\n printToAll(\"last updated: \" .. information[\"\
|
|
last_updated\"], \"White\")\r\n end)\r\n\r\n self.addContextMenuItem(\"\
|
|
Toggle cost\", function(color)\r\n showCost = not showCost\r\n \
|
|
\ printToColor(\"Show cost of cards: \" .. tostring(showCost), color, \"White\"\
|
|
)\r\n refresh()\r\n end)\r\n\r\n self.addContextMenuItem(\"Toggle\
|
|
\ skill icons\", function(color)\r\n showIcons = not showIcons\r\n \
|
|
\ printToColor(\"Show skill icons of cards: \" .. tostring(showIcons),\
|
|
\ color, \"White\")\r\n refresh()\r\n end)\r\nend\r\n\r\n-- called\
|
|
\ for every card that enters\r\nfunction onObjectEnterContainer(container, object)\r\
|
|
\n if container == self then\r\n findCard(object.getGUID(), object.getName(),\
|
|
\ object.getGMNotes())\r\n recreateButtons()\r\n end\r\nend\r\n\r\n\
|
|
-- removes leaving cards from the \"cardInBag\" table\r\nfunction onObjectLeaveContainer(container,\
|
|
\ object)\r\n if container == self then\r\n local guid = object.getGUID()\r\
|
|
\n for i, card in ipairs(cardsInBag) do\r\n if card.id ==\
|
|
\ guid then table.remove(cardsInBag, i) end\r\n end\r\n recreateButtons()\r\
|
|
\n end\r\nend\r\n\r\n-- refreshes displayed buttons based on contained cards\r\
|
|
\nfunction refresh()\r\n cardsInBag = {}\r\n for _, object in ipairs(self.getObjects())\
|
|
\ do\r\n findCard(object.guid, object.name, object.gm_notes)\r\n end\r\
|
|
\n recreateButtons()\r\nend\r\n\r\n-- gets cost and icons for a card\r\n\
|
|
function findCard(guid, name, GMNotes)\r\n local cost = \"\"\r\n local\
|
|
\ icons = {}\r\n local metadata = {}\r\n\r\n if name == nil or name ==\
|
|
\ \"\" then name = \"unnamed\" end\r\n\r\n if showCost or showIcons then\r\
|
|
\n metadata = JSON.decode(GMNotes)\r\n end\r\n\r\n if showCost\
|
|
\ then\r\n if GMNotes ~= \"\" then cost = metadata.cost end\r\n \
|
|
\ if cost == nil or cost == \"\" then cost = \"\u2013\" end\r\n name\
|
|
\ = \"[\" .. cost .. \"] \" .. name\r\n end\r\n\r\n if showIcons then\r\
|
|
\n if GMNotes ~= \"\" then\r\n icons[1] = metadata.wildIcons\r\
|
|
\n icons[2] = metadata.willpowerIcons\r\n icons[3] = metadata.intellectIcons\r\
|
|
\n icons[4] = metadata.fightIcons\r\n icons[5] = metadata.agilityIcons\r\
|
|
\n end\r\n\r\n local IconTypes = { \"Wild\", \"Willpower\", \"\
|
|
Intellect\", \"Fight\", \"Agility\" }\r\n local found = false\r\n \
|
|
\ for i = 1, 5 do\r\n if icons[i] ~= nil and icons[i] ~= \"\"\
|
|
\ then\r\n if found == false then\r\n name\
|
|
\ = name .. \"\\n\" .. IconTypes[i] .. \": \" .. icons[i]\r\n \
|
|
\ found = true\r\n else\r\n name = name\
|
|
\ .. \" \" .. IconTypes[i] .. \": \" .. icons[i]\r\n end\r\n\
|
|
\ end\r\n end\r\n end\r\n\r\n table.insert(cardsInBag,\
|
|
\ { name = name, id = guid })\r\nend\r\n\r\n-- recreates buttons with up-to-date\
|
|
\ labels\r\nfunction recreateButtons()\r\n self.clearButtons()\r\n local\
|
|
\ verticalPosition = 1.65\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 = string.len(card.name)\
|
|
\ > 20 and 75 or 100\r\n })\r\n\r\n verticalPosition = verticalPosition\
|
|
\ - 0.5\r\n end\r\n\r\r\n self.createButton({\r\n label \
|
|
\ = countLabel,\r\n click_function = 'none',\r\n function_owner\
|
|
\ = self,\r\n position = { 0, 0, -1.35 },\r\n height \
|
|
\ = 0,\r\n width = 0,\r\n font_size = 225,\r\
|
|
\n font_color = { 1, 1, 1 }\r\n })\r\nend\r\n\r\n-- click-function\
|
|
\ for buttons to take a card out of the bag\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.25, 0),\r\n callback_function\
|
|
\ = function(obj) obj.resting = true end\r\n })\r\nend"
|
|
LuaScriptState: '[[],true,false]'
|
|
MaterialIndex: -1
|
|
MeasureMovement: false
|
|
MeshIndex: -1
|
|
Name: Custom_Model_Bag
|
|
Nickname: Crystallizer of Dreams Helper
|
|
Number: 0
|
|
Snap: true
|
|
Sticky: true
|
|
Tags:
|
|
- Asset
|
|
- scesetup_memory_object
|
|
Tooltip: true
|
|
Transform:
|
|
posX: 14.6885777
|
|
posY: 1.71333456
|
|
posZ: -26.0148659
|
|
rotX: 359.920135
|
|
rotY: 270.000122
|
|
rotZ: 0.01688493
|
|
scaleX: 0.7951615
|
|
scaleY: 1.0
|
|
scaleZ: 0.7951615
|
|
Value: 0
|
|
XmlUI: ''
|
|
'5':
|
|
AltLookAngle:
|
|
x: 0.0
|
|
y: 0.0
|
|
z: 0.0
|
|
Autoraise: true
|
|
Bag:
|
|
Order: 0
|
|
ColorDiffuse:
|
|
b: 1.0
|
|
g: 1.0
|
|
r: 1.0
|
|
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: 'Drop cards here to display name, cost and skill icons.
|
|
|
|
|
|
See context menu for options.'
|
|
DragSelectable: true
|
|
GMNotes: ''
|
|
GUID: 31055d
|
|
Grid: true
|
|
GridProjection: false
|
|
Hands: false
|
|
HideWhenFaceDown: false
|
|
IgnoreFoW: false
|
|
LayoutGroupSortIndex: 0
|
|
Locked: false
|
|
LuaScript: "-- Attachment Helper\r\n-- updated by: Chr1Z\r\n-- original by:\
|
|
\ -\r\n-- description: displays cards in it with cost/skill icons\r\n\
|
|
information = {\r\n version = \"1.4\",\r\n last_updated = \"10.10.2022\"\
|
|
\r\n}\r\n\r\n-- save state and options to restore onLoad\r\nfunction onSave()\
|
|
\ return JSON.encode({ cardsInBag, showCost, showIcons }) end\r\n\r\n-- load\
|
|
\ variables and create context menu\r\nfunction onload(saved_data)\r\n if\
|
|
\ saved_data ~= \"\" and saved_data ~= nil then\r\n local loaded_data\
|
|
\ = JSON.decode(saved_data)\r\n cardsInBag = loaded_data[1]\r\n\
|
|
\ showCost = loaded_data[2]\r\n showIcons = loaded_data[3]\r\
|
|
\n else\r\n cardsInBag = {}\r\n showCost = true\r\n \
|
|
\ showIcons = true\r\n end\r\n\r\n recreateButtons()\r\n\r\n self.addContextMenuItem(\"\
|
|
More Information\", function()\r\n printToAll(\"------------------------------\"\
|
|
, \"White\")\r\n printToAll(\"Attachment Helper v\" .. information[\"\
|
|
version\"] .. \" by Chr1Z\", \"Orange\")\r\n printToAll(\"original by:\
|
|
\ bankey\", \"White\")\r\n printToAll(\"last updated: \" .. information[\"\
|
|
last_updated\"], \"White\")\r\n end)\r\n\r\n self.addContextMenuItem(\"\
|
|
Toggle cost\", function(color)\r\n showCost = not showCost\r\n \
|
|
\ printToColor(\"Show cost of cards: \" .. tostring(showCost), color, \"White\"\
|
|
)\r\n refresh()\r\n end)\r\n\r\n self.addContextMenuItem(\"Toggle\
|
|
\ skill icons\", function(color)\r\n showIcons = not showIcons\r\n \
|
|
\ printToColor(\"Show skill icons of cards: \" .. tostring(showIcons),\
|
|
\ color, \"White\")\r\n refresh()\r\n end)\r\nend\r\n\r\n-- called\
|
|
\ for every card that enters\r\nfunction onObjectEnterContainer(container, object)\r\
|
|
\n if container == self then\r\n findCard(object.getGUID(), object.getName(),\
|
|
\ object.getGMNotes())\r\n recreateButtons()\r\n end\r\nend\r\n\r\n\
|
|
-- removes leaving cards from the \"cardInBag\" table\r\nfunction onObjectLeaveContainer(container,\
|
|
\ object)\r\n if container == self then\r\n local guid = object.getGUID()\r\
|
|
\n for i, card in ipairs(cardsInBag) do\r\n if card.id ==\
|
|
\ guid then table.remove(cardsInBag, i) end\r\n end\r\n recreateButtons()\r\
|
|
\n end\r\nend\r\n\r\n-- refreshes displayed buttons based on contained cards\r\
|
|
\nfunction refresh()\r\n cardsInBag = {}\r\n for _, object in ipairs(self.getObjects())\
|
|
\ do\r\n findCard(object.guid, object.name, object.gm_notes)\r\n end\r\
|
|
\n recreateButtons()\r\nend\r\n\r\n-- gets cost and icons for a card\r\n\
|
|
function findCard(guid, name, GMNotes)\r\n local cost = \"\"\r\n local\
|
|
\ icons = {}\r\n local metadata = {}\r\n\r\n if name == nil or name ==\
|
|
\ \"\" then name = \"unnamed\" end\r\n\r\n if showCost or showIcons then\r\
|
|
\n metadata = JSON.decode(GMNotes)\r\n end\r\n\r\n if showCost\
|
|
\ then\r\n if GMNotes ~= \"\" then cost = metadata.cost end\r\n \
|
|
\ if cost == nil or cost == \"\" then cost = \"\u2013\" end\r\n name\
|
|
\ = \"[\" .. cost .. \"] \" .. name\r\n end\r\n\r\n if showIcons then\r\
|
|
\n if GMNotes ~= \"\" then\r\n icons[1] = metadata.wildIcons\r\
|
|
\n icons[2] = metadata.willpowerIcons\r\n icons[3] = metadata.intellectIcons\r\
|
|
\n icons[4] = metadata.fightIcons\r\n icons[5] = metadata.agilityIcons\r\
|
|
\n end\r\n\r\n local IconTypes = { \"Wild\", \"Willpower\", \"\
|
|
Intellect\", \"Fight\", \"Agility\" }\r\n local found = false\r\n \
|
|
\ for i = 1, 5 do\r\n if icons[i] ~= nil and icons[i] ~= \"\"\
|
|
\ then\r\n if found == false then\r\n name\
|
|
\ = name .. \"\\n\" .. IconTypes[i] .. \": \" .. icons[i]\r\n \
|
|
\ found = true\r\n else\r\n name = name\
|
|
\ .. \" \" .. IconTypes[i] .. \": \" .. icons[i]\r\n end\r\n\
|
|
\ end\r\n end\r\n end\r\n\r\n table.insert(cardsInBag,\
|
|
\ { name = name, id = guid })\r\nend\r\n\r\n-- recreates buttons with up-to-date\
|
|
\ labels\r\nfunction recreateButtons()\r\n self.clearButtons()\r\n local\
|
|
\ verticalPosition = 1.65\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 = string.len(card.name)\
|
|
\ > 20 and 75 or 100\r\n })\r\n\r\n verticalPosition = verticalPosition\
|
|
\ - 0.5\r\n end\r\n\r\r\n self.createButton({\r\n label \
|
|
\ = countLabel,\r\n click_function = 'none',\r\n function_owner\
|
|
\ = self,\r\n position = { 0, 0, -1.35 },\r\n height \
|
|
\ = 0,\r\n width = 0,\r\n font_size = 225,\r\
|
|
\n font_color = { 1, 1, 1 }\r\n })\r\nend\r\n\r\n-- click-function\
|
|
\ for buttons to take a card out of the bag\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.25, 0),\r\n callback_function\
|
|
\ = function(obj) obj.resting = true end\r\n })\r\nend"
|
|
LuaScriptState: '[[],true,false]'
|
|
MaterialIndex: -1
|
|
MeasureMovement: false
|
|
MeshIndex: -1
|
|
Name: Custom_Model_Bag
|
|
Nickname: Ancestral Knowledge Helper
|
|
Number: 0
|
|
Snap: true
|
|
Sticky: true
|
|
Tags:
|
|
- Asset
|
|
- scesetup_memory_object
|
|
Tooltip: true
|
|
Transform:
|
|
posX: 14.6885786
|
|
posY: 1.71333456
|
|
posZ: -26.01487
|
|
rotX: 359.920135
|
|
rotY: 270.000122
|
|
rotZ: 0.01688525
|
|
scaleX: 0.7951615
|
|
scaleY: 1.0
|
|
scaleZ: 0.7951615
|
|
Value: 0
|
|
XmlUI: ''
|
|
'6':
|
|
AltLookAngle:
|
|
x: 0.0
|
|
y: 0.0
|
|
z: 0.0
|
|
Autoraise: true
|
|
Bag:
|
|
Order: 0
|
|
ColorDiffuse:
|
|
b: 1.0
|
|
g: 1.0
|
|
r: 1.0
|
|
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: 'Drop cards here to display name, cost and skill icons.
|
|
|
|
|
|
See context menu for options.'
|
|
DragSelectable: true
|
|
GMNotes: ''
|
|
GUID: e213ed
|
|
Grid: true
|
|
GridProjection: false
|
|
Hands: false
|
|
HideWhenFaceDown: false
|
|
IgnoreFoW: false
|
|
LayoutGroupSortIndex: 0
|
|
Locked: false
|
|
LuaScript: "-- Attachment Helper\r\n-- updated by: Chr1Z\r\n-- original by:\
|
|
\ -\r\n-- description: displays cards in it with cost/skill icons\r\n\
|
|
information = {\r\n version = \"1.4\",\r\n last_updated = \"10.10.2022\"\
|
|
\r\n}\r\n\r\n-- save state and options to restore onLoad\r\nfunction onSave()\
|
|
\ return JSON.encode({ cardsInBag, showCost, showIcons }) end\r\n\r\n-- load\
|
|
\ variables and create context menu\r\nfunction onload(saved_data)\r\n if\
|
|
\ saved_data ~= \"\" and saved_data ~= nil then\r\n local loaded_data\
|
|
\ = JSON.decode(saved_data)\r\n cardsInBag = loaded_data[1]\r\n\
|
|
\ showCost = loaded_data[2]\r\n showIcons = loaded_data[3]\r\
|
|
\n else\r\n cardsInBag = {}\r\n showCost = true\r\n \
|
|
\ showIcons = true\r\n end\r\n\r\n recreateButtons()\r\n\r\n self.addContextMenuItem(\"\
|
|
More Information\", function()\r\n printToAll(\"------------------------------\"\
|
|
, \"White\")\r\n printToAll(\"Attachment Helper v\" .. information[\"\
|
|
version\"] .. \" by Chr1Z\", \"Orange\")\r\n printToAll(\"original by:\
|
|
\ bankey\", \"White\")\r\n printToAll(\"last updated: \" .. information[\"\
|
|
last_updated\"], \"White\")\r\n end)\r\n\r\n self.addContextMenuItem(\"\
|
|
Toggle cost\", function(color)\r\n showCost = not showCost\r\n \
|
|
\ printToColor(\"Show cost of cards: \" .. tostring(showCost), color, \"White\"\
|
|
)\r\n refresh()\r\n end)\r\n\r\n self.addContextMenuItem(\"Toggle\
|
|
\ skill icons\", function(color)\r\n showIcons = not showIcons\r\n \
|
|
\ printToColor(\"Show skill icons of cards: \" .. tostring(showIcons),\
|
|
\ color, \"White\")\r\n refresh()\r\n end)\r\nend\r\n\r\n-- called\
|
|
\ for every card that enters\r\nfunction onObjectEnterContainer(container, object)\r\
|
|
\n if container == self then\r\n findCard(object.getGUID(), object.getName(),\
|
|
\ object.getGMNotes())\r\n recreateButtons()\r\n end\r\nend\r\n\r\n\
|
|
-- removes leaving cards from the \"cardInBag\" table\r\nfunction onObjectLeaveContainer(container,\
|
|
\ object)\r\n if container == self then\r\n local guid = object.getGUID()\r\
|
|
\n for i, card in ipairs(cardsInBag) do\r\n if card.id ==\
|
|
\ guid then table.remove(cardsInBag, i) end\r\n end\r\n recreateButtons()\r\
|
|
\n end\r\nend\r\n\r\n-- refreshes displayed buttons based on contained cards\r\
|
|
\nfunction refresh()\r\n cardsInBag = {}\r\n for _, object in ipairs(self.getObjects())\
|
|
\ do\r\n findCard(object.guid, object.name, object.gm_notes)\r\n end\r\
|
|
\n recreateButtons()\r\nend\r\n\r\n-- gets cost and icons for a card\r\n\
|
|
function findCard(guid, name, GMNotes)\r\n local cost = \"\"\r\n local\
|
|
\ icons = {}\r\n local metadata = {}\r\n\r\n if name == nil or name ==\
|
|
\ \"\" then name = \"unnamed\" end\r\n\r\n if showCost or showIcons then\r\
|
|
\n metadata = JSON.decode(GMNotes)\r\n end\r\n\r\n if showCost\
|
|
\ then\r\n if GMNotes ~= \"\" then cost = metadata.cost end\r\n \
|
|
\ if cost == nil or cost == \"\" then cost = \"\u2013\" end\r\n name\
|
|
\ = \"[\" .. cost .. \"] \" .. name\r\n end\r\n\r\n if showIcons then\r\
|
|
\n if GMNotes ~= \"\" then\r\n icons[1] = metadata.wildIcons\r\
|
|
\n icons[2] = metadata.willpowerIcons\r\n icons[3] = metadata.intellectIcons\r\
|
|
\n icons[4] = metadata.fightIcons\r\n icons[5] = metadata.agilityIcons\r\
|
|
\n end\r\n\r\n local IconTypes = { \"Wild\", \"Willpower\", \"\
|
|
Intellect\", \"Fight\", \"Agility\" }\r\n local found = false\r\n \
|
|
\ for i = 1, 5 do\r\n if icons[i] ~= nil and icons[i] ~= \"\"\
|
|
\ then\r\n if found == false then\r\n name\
|
|
\ = name .. \"\\n\" .. IconTypes[i] .. \": \" .. icons[i]\r\n \
|
|
\ found = true\r\n else\r\n name = name\
|
|
\ .. \" \" .. IconTypes[i] .. \": \" .. icons[i]\r\n end\r\n\
|
|
\ end\r\n end\r\n end\r\n\r\n table.insert(cardsInBag,\
|
|
\ { name = name, id = guid })\r\nend\r\n\r\n-- recreates buttons with up-to-date\
|
|
\ labels\r\nfunction recreateButtons()\r\n self.clearButtons()\r\n local\
|
|
\ verticalPosition = 1.65\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 = string.len(card.name)\
|
|
\ > 20 and 75 or 100\r\n })\r\n\r\n verticalPosition = verticalPosition\
|
|
\ - 0.5\r\n end\r\n\r\r\n self.createButton({\r\n label \
|
|
\ = countLabel,\r\n click_function = 'none',\r\n function_owner\
|
|
\ = self,\r\n position = { 0, 0, -1.35 },\r\n height \
|
|
\ = 0,\r\n width = 0,\r\n font_size = 225,\r\
|
|
\n font_color = { 1, 1, 1 }\r\n })\r\nend\r\n\r\n-- click-function\
|
|
\ for buttons to take a card out of the bag\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.25, 0),\r\n callback_function\
|
|
\ = function(obj) obj.resting = true end\r\n })\r\nend"
|
|
LuaScriptState: '[[],true,false]'
|
|
MaterialIndex: -1
|
|
MeasureMovement: false
|
|
MeshIndex: -1
|
|
Name: Custom_Model_Bag
|
|
Nickname: Astronomical Atlas Helper
|
|
Number: 0
|
|
Snap: true
|
|
Sticky: true
|
|
Tags:
|
|
- Asset
|
|
- scesetup_memory_object
|
|
Tooltip: true
|
|
Transform:
|
|
posX: 14.68858
|
|
posY: 1.71333444
|
|
posZ: -26.0148735
|
|
rotX: 359.920135
|
|
rotY: 270.000122
|
|
rotZ: 0.016885994
|
|
scaleX: 0.7951615
|
|
scaleY: 1.0
|
|
scaleZ: 0.7951615
|
|
Value: 0
|
|
XmlUI: ''
|
|
Sticky: true
|
|
Tags:
|
|
- Asset
|
|
- scesetup_memory_object
|
|
Tooltip: true
|
|
Transform:
|
|
posX: 29.29
|
|
posY: 5.26
|
|
posZ: -19.82
|
|
rotX: 359.98
|
|
rotY: 270.0
|
|
rotZ: 0.0
|
|
scaleX: 0.8
|
|
scaleY: 1.0
|
|
scaleZ: 0.8
|
|
Value: 0
|
|
XmlUI: ''
|