243 lines
15 KiB
YAML
243 lines
15 KiB
YAML
AltLookAngle:
|
|
x: 0.0
|
|
y: 0.0
|
|
z: 0.0
|
|
Autoraise: true
|
|
ColorDiffuse:
|
|
b: 1.0
|
|
g: 0.37256
|
|
r: 0.30589
|
|
ContainedObjects:
|
|
- 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.
|
|
|
|
|
|
Drop this on another card to load the respective background if available.'
|
|
DragSelectable: true
|
|
GMNotes: ''
|
|
GUID: d45664
|
|
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/AttachmentHelper\")\nend)\n__bundle_register(\"accessories/AttachmentHelper\",
|
|
function(require, _LOADED, __bundle_register, __bundle_modules)\nlocal fontColor\r\nlocal
|
|
BACKGROUNDS = {\r\n {\r\n title = \"Ancestral Knowledge\",\r\n url
|
|
\ = \"http://cloud-3.steamusercontent.com/ugc/1915746489207287888/2F9F6F211ED0F98E66C9D35D93221E4C7FB6DD3C/\",\r\n
|
|
\ fontcolor = { 1, 1, 1 }\r\n },\r\n {\r\n title = \"Astronomical Atlas\",\r\n
|
|
\ url = \"http://cloud-3.steamusercontent.com/ugc/1754695853007989004/9153BC204FC707AE564ECFAC063A11CB8C2B5D1E/\",\r\n
|
|
\ fontcolor = { 1, 1, 1 }\r\n },\r\n {\r\n title = \"Backpack\",\r\n
|
|
\ url = \"http://cloud-3.steamusercontent.com/ugc/2018212896278691928/F55BEFFC2540109C6333179532F583B367FF2EBC/\",\r\n
|
|
\ fontcolor = { 0, 0, 0 }\r\n },\r\n {\r\n title = \"Binder's Jar\",\r\n
|
|
\ url = \"http://cloud-3.steamusercontent.com/ugc/2021606446228642191/4C149527851C1DBB3015F93DE91667937A3F91DD/\",\r\n
|
|
\ fontcolor = { 1, 1, 1 }\r\n },\r\n {\r\n title = \"Crystallizer of
|
|
Dreams\",\r\n url = \"http://cloud-3.steamusercontent.com/ugc/1915746489207280958/100F16441939E5E23818651D1EB5C209BF3125B9/\",\r\n
|
|
\ fontcolor = { 1, 1, 1 }\r\n },\r\n {\r\n title = \"Diana Stanley\",\r\n
|
|
\ url = \"http://cloud-3.steamusercontent.com/ugc/1754695635919071208/1AB7222850201630826BFFBA8F2BD0065E2D572F/\",\r\n
|
|
\ fontcolor = { 1, 1, 1 }\r\n },\r\n {\r\n title = \"Gloria Goldberg\",\r\n
|
|
\ url = \"http://cloud-3.steamusercontent.com/ugc/1754695635919102502/453D4426118C8A6DE2EA281184716E26CA924C84/\",\r\n
|
|
\ fontcolor = { 1, 1, 1 }\r\n },\r\n {\r\n title = \"Ikiaq\",\r\n url
|
|
\ = \"http://cloud-3.steamusercontent.com/ugc/2021606446228198966/5A408D8D760221DEA164E986B9BE1F79C4803071/\",\r\n
|
|
\ fontcolor = { 1, 1, 1 }\r\n },\r\n {\r\n title = \"Katja Eastbank\",\r\n
|
|
\ url = \"http://cloud-3.steamusercontent.com/ugc/2021606446228203475/62EEE12F4DB1EB80D79B087677459B954380215F/\",\r\n
|
|
\ fontcolor = { 1, 1, 1 }\r\n },\r\n {\r\n title = \"Ravenous\",\r\n
|
|
\ url = \"http://cloud-3.steamusercontent.com/ugc/2021606446228208075/EAC598A450BEE504A7FE179288F1FBBF7ABFA3E0/\",\r\n
|
|
\ fontcolor = { 0, 0, 0 }\r\n },\r\n {\r\n title = \"Sefina Rousseau\",\r\n
|
|
\ url = \"http://cloud-3.steamusercontent.com/ugc/1754695635919099826/3C3CBFFAADB2ACA9957C736491F470AE906CC953/\",\r\n
|
|
\ fontcolor = { 0, 0, 0 }\r\n },\r\n {\r\n title = \"Stick to the Plan\",\r\n
|
|
\ url = \"http://cloud-3.steamusercontent.com/ugc/2018214163838897493/8E38B96C5A8D703A59009A932432CBE21ABE63A2/\",\r\n
|
|
\ fontcolor = { 1, 1, 1 }\r\n },\r\n {\r\n title = \"Subject 5U-21\",\r\n
|
|
\ url = \"http://cloud-3.steamusercontent.com/ugc/2021606446228199363/CE43D58F37C9F48BDD6E6E145FE29BADEFF4DBC5/\",\r\n
|
|
\ fontcolor = { 1, 1, 1 }\r\n },\r\n {\r\n title = \"Wooden Sledge\",\r\n
|
|
\ url = \"http://cloud-3.steamusercontent.com/ugc/1750192233783143973/D526236AAE16BDBB98D3F30E27BAFC1D3E21F4AC/\",\r\n
|
|
\ fontcolor = { 0, 0, 0 }\r\n }\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(savedData)\r\n
|
|
\ local loadedData = JSON.decode(savedData)\r\n cardsInBag = loadedData[1]
|
|
or {}\r\n showCost = loadedData[2] or true\r\n showIcons = loadedData[3]
|
|
or true\r\n fontColor = getFontColor()\r\n recreateButtons()\r\n\r\n
|
|
\ self.addContextMenuItem(\"Select image\", selectImage)\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--
|
|
gets the font color based on background url\r\nfunction getFontColor()\r\n local
|
|
customInfo = self.getCustomObject()\r\n for i = 1, #BACKGROUNDS do\r\n if
|
|
BACKGROUNDS[i].url == customInfo.diffuse then\r\n return BACKGROUNDS[i].fontcolor\r\n
|
|
\ end\r\n end\r\n return { 1, 1, 1 }\r\nend\r\n\r\n-- attempt to load image
|
|
from below card when dropped\r\nfunction onDrop(playerColor)\r\n local pos =
|
|
self.getPosition():setAt(\"y\", 2)\r\n local search = Physics.cast({\r\n direction
|
|
\ = { 0, -1, 0 },\r\n max_distance = 2,\r\n type = 3,\r\n size
|
|
\ = { 0.1, 0.1, 0.1 },\r\n origin = pos\r\n })\r\n\r\n local
|
|
syncName\r\n for _, v in ipairs(search) do\r\n if v.hit_object.tag == \"Card\"
|
|
then\r\n syncName = v.hit_object.getName()\r\n break\r\n end\r\n
|
|
\ end\r\n\r\n if not syncName then return end\r\n\r\n -- remove level information
|
|
fron syncName\r\n syncName = syncName:gsub(\"%s%(%d%)\", \"\")\r\n\r\n -- loop
|
|
through background table\r\n for _, bgInfo in ipairs(BACKGROUNDS) do\r\n if
|
|
bgInfo.title == syncName then\r\n printToColor(\"Background for '\" .. syncName
|
|
.. \"' loaded!\", playerColor, \"Green\")\r\n updateImage(bgInfo.url)\r\n
|
|
\ return\r\n end\r\n end\r\n printToColor(\"Didn't find background for
|
|
'\" .. syncName .. \"'!\", playerColor, \"Orange\")\r\nend\r\n\r\n-- called by
|
|
context menu to change background image\r\nfunction selectImage(color)\r\n --
|
|
generate list of options\r\n local options = {}\r\n for i = 1, #BACKGROUNDS
|
|
do\r\n options[i] = BACKGROUNDS[i].title\r\n end\r\n\r\n -- prompt user to
|
|
select option\r\n Player[color].showOptionsDialog(\"Select image:\", options,
|
|
1, function(_, optionIndex)\r\n updateImage(BACKGROUNDS[optionIndex].url)\r\n
|
|
\ end)\r\nend\r\n\r\n-- sets background to the provided URL\r\nfunction updateImage(url)\r\n
|
|
\ self.script_state = JSON.encode({ cardsInBag, showCost, showIcons })\r\n local
|
|
customInfo = self.getCustomObject()\r\n customInfo.diffuse = url\r\n self.setCustomObject(customInfo)\r\n
|
|
\ self.reload()\r\nend\r\n\r\n-- only allow cards to enter, split decks and reject
|
|
other objects\r\nfunction onObjectEnterContainer(container, object)\r\n if container
|
|
~= self then return end\r\n if object.tag == \"Deck\" then\r\n takeDeckOut(object.getGUID(),
|
|
self.getPosition() + Vector(0, 0.1, 0))\r\n elseif object.tag ~= \"Card\" then\r\n
|
|
\ broadcastToAll(\"The 'Attachment Helper' is meant to be used for cards.\",
|
|
\"White\")\r\n else\r\n findCard(object.getGUID(), object.getName(), object.getGMNotes())\r\n
|
|
\ recreateButtons()\r\n end\r\nend\r\n\r\n-- takes the deck out and splits
|
|
in into single cards\r\nfunction takeDeckOut(guid, pos)\r\n local deck = self.takeObject({
|
|
guid = guid, position = pos, smooth = false })\r\n for i = 1, #deck.getObjects()
|
|
do\r\n self.putObject(deck.takeObject({ position = pos + Vector(0, 0.1 * i,
|
|
0), smooth = false }))\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 local
|
|
found = false\r\n for i, card in ipairs(cardsInBag) do\r\n if card.id
|
|
== guid then\r\n table.remove(cardsInBag, i)\r\n found = true\r\n
|
|
\ break\r\n end\r\n end\r\n\r\n if found ~= true then\r\n local
|
|
name = object.getName()\r\n for i, card in ipairs(cardsInBag) do\r\n if
|
|
card.name == name then\r\n table.remove(cardsInBag, i)\r\n break\r\n
|
|
\ end\r\n 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\nfunction findCard(guid, name, GMNotes)\r\n local
|
|
cost = \"\"\r\n local icons = {}\r\n local metadata = {}\r\n local displayName
|
|
= name\r\n\r\n if displayName == nil or displayName == \"\" then displayName
|
|
= \"unnamed\" end\r\n if showCost or showIcons then metadata = JSON.decode(GMNotes)
|
|
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 displayName
|
|
= \"[\" .. cost .. \"] \" .. displayName\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.combatIcons\r\n icons[5] = metadata.agilityIcons\r\n end\r\n\r\n
|
|
\ local IconTypes = { \"Wild\", \"Willpower\", \"Intellect\", \"Combat\", \"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 displayName
|
|
= displayName .. \"\\n\" .. IconTypes[i] .. \": \" .. icons[i]\r\n found
|
|
= true\r\n else\r\n displayName = displayName .. \" \" .. IconTypes[i]
|
|
.. \": \" .. icons[i]\r\n end\r\n end\r\n end\r\n end\r\n table.insert(cardsInBag,
|
|
{ name = name, displayName = displayName, 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
|
|
\ local id = card.id\r\n local funcName = \"removeCard\" .. id\r\n self.setVar(funcName,
|
|
function() removeCard(id) end)\r\n self.createButton({\r\n label =
|
|
card.displayName,\r\n click_function = funcName,\r\n function_owner
|
|
= self,\r\n position = { 0, -0.1, verticalPosition },\r\n height
|
|
\ = 200,\r\n width = 1200,\r\n font_size = string.len(card.displayName)
|
|
> 20 and 75 or 100\r\n })\r\n verticalPosition = verticalPosition - 0.5\r\n
|
|
\ end\r\n\r\n local countLabel = #cardsInBag\r\n local fontSize = 250\r\n if
|
|
#cardsInBag == 0 then\r\n countLabel = \"Attachment Helper\"\r\n fontSize
|
|
\ = 150\r\n end\r\n\r\n self.createButton({\r\n label = countLabel,\r\n
|
|
\ click_function = \"none\",\r\n function_owner = self,\r\n position =
|
|
{ 0, -0.1, -1.7 },\r\n height = 0,\r\n width = 0,\r\n font_size
|
|
\ = fontSize,\r\n font_color = fontColor\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\r\nend)\nreturn __bundle_require(\"__root\")"
|
|
LuaScriptState: '[[],true,true]'
|
|
MaterialIndex: -1
|
|
MeasureMovement: false
|
|
MeshIndex: -1
|
|
Name: Custom_Model_Bag
|
|
Nickname: Attachment Helper
|
|
Number: 0
|
|
Snap: true
|
|
Sticky: true
|
|
Tags:
|
|
- Asset
|
|
Tooltip: true
|
|
Transform:
|
|
posX: 19.228
|
|
posY: 3.822
|
|
posZ: -19.636
|
|
rotX: 0.0
|
|
rotY: 270.0
|
|
rotZ: 359.0
|
|
scaleX: 0.8
|
|
scaleY: 1.0
|
|
scaleZ: 0.8
|
|
Value: 0
|
|
XmlUI: ''
|
|
Description: Provides card-sized bags that are useful for cards that are attached
|
|
facedown (e.g. Backpack).
|
|
DragSelectable: true
|
|
GMNotes: ''
|
|
GUID: 7f4976
|
|
Grid: true
|
|
GridProjection: false
|
|
Hands: false
|
|
HideWhenFaceDown: false
|
|
IgnoreFoW: false
|
|
LayoutGroupSortIndex: 0
|
|
Locked: false
|
|
LuaScript: ''
|
|
LuaScriptState: ''
|
|
MaterialIndex: -1
|
|
MeasureMovement: false
|
|
MeshIndex: -1
|
|
Name: Infinite_Bag
|
|
Nickname: Attachment Helper
|
|
Snap: true
|
|
Sticky: true
|
|
Tooltip: true
|
|
Transform:
|
|
posX: 27.68
|
|
posY: 4.47
|
|
posZ: -31.03
|
|
rotX: 0.0
|
|
rotY: 0.0
|
|
rotZ: 0.0
|
|
scaleX: 1.0
|
|
scaleY: 1.0
|
|
scaleZ: 1.0
|
|
Value: 0
|
|
XmlUI: ''
|