Skip to content

Commit

Permalink
lmop-shared got rid of lots of duplicate tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisAndelin committed Aug 1, 2021
1 parent cca4d11 commit 4e1a352
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 10 deletions.
46 changes: 45 additions & 1 deletion lmop/data/actors.db

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions lmop/data/fog.db

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions lmop/data/folders.db
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@
{"name":"Cragmaw Hideout","type":"Actor","sort":2900000,"flags":{},"parent":"dKuzbyQztndLPaBc","sorting":"a","color":"","_id":"pXjSqaNNdDSkOYqm"}
{"name":"Locations","type":"JournalEntry","sort":2100000,"flags":{},"parent":"MjAyZjQxNDQ1Mjkz","sorting":"a","color":"","_id":"uw1IkAt6OFHFUyZW"}
{"name":"Items","type":"Item","sort":2600000,"flags":{},"parent":null,"sorting":"a","color":"","_id":"wkYzHVdveFQBQ985"}
{"name":"Creatures","type":"Actor","parent":null,"sorting":"a","sort":0,"flags":{},"_id":"dlEnbHKzS269UkDK"}
{"$$deleted":true,"_id":"dlEnbHKzS269UkDK"}
8 changes: 8 additions & 0 deletions lmop/data/macros.db
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@
{"_id":"Z1PVcJrfjEqwC5zZ","name":"Remove Top Bar","permission":{"default":0,"ZjdmMWEyMmE2NzVk":3},"type":"script","folder":null,"sort":100000,"flags":{"combat-utility-belt":{"macroTrigger":""}},"scope":"global","command":"(async ()=>{\r\n console.log(\"starting\");\r\n for(let token of canvas.tokens.placeables)\r\n {\r\n if (!token.data)\r\n {\r\n console.log(\"error: no token.data\");\r\n continue;\r\n }\r\n if (!token.data.name)\r\n {\r\n console.log(\"error: no token.data.name\");\r\n continue;\r\n }\r\n console.log(\"token = \" + token.data.name);\r\n await token.update({ 'bar2.attribute' : 'None' });\r\n await token.update({ 'bar1.attribute' : 'attributes.hp' });\r\n }\r\n console.log(\"ending\");\r\n})();\r\n\r\n","author":"ZjdmMWEyMmE2NzVk","img":"icons/svg/dice-target.svg","actorIds":[]}
{"_id":"Zkyhd4OHoorlpqks","name":"Redbrand Trapped Hallway","type":"script","author":"ODY1ZmU3OWIzNzY2","img":"icons/svg/dice-target.svg","scope":"global","command":"game.togglePause(true, true)\nlet tile = canvas.scene.data.tiles.get(\"ZTE0NDkyNjlmYWQ1\")\ntile.update({\"hidden\" : false})","folder":null,"sort":100001,"permission":{"default":0,"ODY1ZmU3OWIzNzY2":3},"flags":{"combat-utility-belt":{"macroTrigger":""}}}
{"_id":"ugYsDBEsytMqZZKH","name":"Goblin Ambush","type":"script","author":"ODY1ZmU3OWIzNzY2","img":"icons/svg/dice-target.svg","scope":"global","command":"(async ()=>{\n console.log(\"starting\");\n let found = false;\n let update = [];\n for(let iToken of canvas.tokens.placeables)\n {\n if (!iToken.data)\n {\n console.log(\"error: no token.data\");\n continue;\n }\n if (!iToken.data.name)\n {\n console.log(\"error: no token.data.name\");\n continue;\n }\n if (iToken.data.name != \"Goblin\")\n {\n continue;\n }\n if (!iToken.data.hidden)\n {\n continue;\n }\n console.log(\"token = \" + iToken.data.name);\n found = true;\n update.push(iToken);\n }\n if (found)\n {\n game.togglePause(true, true)\n canvas.scene.updateEmbeddedDocuments(\"Token\", update.map(t => ({_id: t.id, hidden: false})));\n }\n console.log(\"ending\");\n})();","folder":null,"sort":0,"permission":{"default":0,"ODY1ZmU3OWIzNzY2":3},"flags":{"combat-utility-belt":{"macroTrigger":""}}}
{"_id":"TkTj0SiNr5ZIYADs","name":"!custom","type":"script","author":"ODY1ZmU3OWIzNzY2","img":"icons/svg/dice-target.svg","scope":"global","command":"(async ()=>{\n console.log(\"starting\");\n let processed = [];\n for(let iToken of canvas.tokens.placeables)\n {\n if (!iToken.data)\n {\n console.log(\"error: no token.data\");\n continue;\n }\n if (!iToken.data.name)\n {\n console.log(\"error: no token.data.name\");\n continue;\n }\n if (processed.indexOf(iToken.name) >= 0)\n {\n console.log(\"skipping \" + iToken.name);\n continue;\n }\n processed.push(iToken.name)\n console.log(\"token = \" + iToken.data.name);\n a = game.actors.getName(iToken.name);\n if (a == null)\n {\n console.log(\"no game actor found for \" + iToken.name);\n continue;\n }\n updateTokensForActorByName(iToken.name);\n }\n console.log(\"ending\");\n})();\n\nfunction updateTokensForActorByName(actorName)\n{\n a = game.actors.getName(actorName);\n a.bar2.attribute = 'None';\n const update = a.getActiveTokens().map(t => {\n if (t.name == a.data.name)\n {\n result = Object.assign({}, a.data.token);\n result._id = t.id;\n }\n else\n {\n result = {_id : t.id};\n }\n return result;\n });\n canvas.scene.updateEmbeddedDocuments(\"Token\", update);\n}","folder":null,"sort":0,"permission":{"default":0,"ODY1ZmU3OWIzNzY2":3},"flags":{"combat-utility-belt":{"macroTrigger":""}}}
{"_id":"TkTj0SiNr5ZIYADs","name":"!custom","type":"script","author":"ODY1ZmU3OWIzNzY2","img":"icons/svg/dice-target.svg","scope":"global","command":"(async ()=>{\n console.log(\"starting\");\n let processed = [];\n for(let iToken of canvas.tokens.placeables)\n {\n if (!iToken.data)\n {\n console.log(\"error: no token.data\");\n continue;\n }\n if (!iToken.data.name)\n {\n console.log(\"error: no token.data.name\");\n continue;\n }\n if (processed.indexOf(iToken.name) >= 0)\n {\n console.log(\"skipping \" + iToken.name);\n continue;\n }\n processed.push(iToken.name)\n console.log(\"token = \" + iToken.data.name);\n a = game.actors.getName(iToken.name);\n if (a == null)\n {\n console.log(\"no game actor found for \" + iToken.name);\n continue;\n }\n updateTokensForActorByName(iToken.name);\n }\n console.log(\"ending\");\n})();\n\nfunction updateTokensForActorByName(actorName)\n{\n a = game.actors.getName(actorName);\n a.data.token.bar2.attribute = 'None';\n const update = a.getActiveTokens().map(t => {\n if (t.name == a.data.name)\n {\n result = Object.assign({}, a.data.token);\n result._id = t.id;\n }\n else\n {\n result = {_id : t.id};\n }\n return result;\n });\n canvas.scene.updateEmbeddedDocuments(\"Token\", update);\n}","folder":null,"sort":0,"permission":{"default":0,"ODY1ZmU3OWIzNzY2":3},"flags":{"combat-utility-belt":{"macroTrigger":""}}}
{"_id":"TkTj0SiNr5ZIYADs","name":"!custom","type":"script","author":"ODY1ZmU3OWIzNzY2","img":"icons/svg/dice-target.svg","scope":"global","command":"(async ()=>{\n console.log(\"starting\");\n let processed = [];\n for(let iToken of canvas.tokens.placeables)\n {\n if (!iToken.data)\n {\n console.log(\"error: no token.data\");\n continue;\n }\n if (!iToken.data.name)\n {\n console.log(\"error: no token.data.name\");\n continue;\n }\n if (processed.indexOf(iToken.name) >= 0)\n {\n console.log(\"skipping \" + iToken.name);\n continue;\n }\n processed.push(iToken.name)\n console.log(\"token = \" + iToken.data.name);\n a = game.actors.getName(iToken.name);\n if (a == null)\n {\n console.log(\"no game actor found for \" + iToken.name);\n continue;\n }\n updateTokensForActorByName(iToken.name);\n }\n console.log(\"ending\");\n})();\n\nfunction updateTokensForActorByName(actorName)\n{\n a = game.actors.getName(actorName);\n a.data.token.bar2.attribute = 'None';\n const update = a.getActiveTokens().map(t => {\n if (t.name == a.data.token.name)\n {\n result = Object.assign({}, a.data.token);\n result._id = t.id;\n }\n else\n {\n result = {_id : t.id};\n }\n return result;\n });\n canvas.scene.updateEmbeddedDocuments(\"Token\", update);\n}","folder":null,"sort":0,"permission":{"default":0,"ODY1ZmU3OWIzNzY2":3},"flags":{"combat-utility-belt":{"macroTrigger":""}}}
{"_id":"TkTj0SiNr5ZIYADs","name":"!custom","type":"script","author":"ODY1ZmU3OWIzNzY2","img":"icons/svg/dice-target.svg","scope":"global","command":"(async ()=>{\n console.log(\"starting\");\n let processed = [];\n for(let iToken of canvas.tokens.placeables)\n {\n if (!iToken.data)\n {\n console.log(\"error: no token.data\");\n continue;\n }\n if (!iToken.data.name)\n {\n console.log(\"error: no token.data.name\");\n continue;\n }\n if (processed.indexOf(iToken.name) >= 0)\n {\n console.log(\"skipping \" + iToken.name);\n continue;\n }\n processed.push(iToken.name)\n console.log(\"token = \" + iToken.data.name);\n a = game.actors.getName(iToken.name);\n if (a == null)\n {\n console.log(\"no game actor found for \" + iToken.name);\n continue;\n }\n updateTokensForActorByName(iToken.name);\n }\n console.log(\"ending\");\n})();\n\nfunction updateTokensForActorByName(actorName)\n{\n a = game.actors.getName(actorName);\n const update = a.getActiveTokens().map(t => {\n if (t.name == a.data.token.name)\n {\n result = Object.assign({}, a.data.token);\n result._id = t.id;\n }\n else\n {\n result = {_id : t.id};\n }\n return result;\n });\n canvas.scene.updateEmbeddedDocuments(\"Token\", update);\n}","folder":null,"sort":0,"permission":{"default":0,"ODY1ZmU3OWIzNzY2":3},"flags":{"combat-utility-belt":{"macroTrigger":""}}}
{"_id":"TkTj0SiNr5ZIYADs","name":"!custom","type":"script","author":"ODY1ZmU3OWIzNzY2","img":"icons/svg/dice-target.svg","scope":"global","command":"(async ()=>{\n console.log(\"starting\");\n let processed = [];\n for(let iToken of canvas.tokens.placeables)\n {\n if (!iToken.data)\n {\n console.log(\"error: no token.data\");\n continue;\n }\n if (!iToken.data.name)\n {\n console.log(\"error: no token.data.name\");\n continue;\n }\n if (processed.indexOf(iToken.name) >= 0)\n {\n console.log(\"skipping \" + iToken.name);\n continue;\n }\n processed.push(iToken.name)\n console.log(\"token = \" + iToken.data.name);\n a = game.actors.getName(iToken.name);\n if (a == null)\n {\n console.log(\"no game actor found for \" + iToken.name);\n continue;\n }\n updateTokensForActorByName(iToken.name);\n }\n console.log(\"ending\");\n})();\n\nfunction updateTokensForActorByName(actorName)\n{\n a = game.actors.getName(actorName);\n a.data.token.update({'bar2.attribute': 'None'});\n const update = a.getActiveTokens().map(t => {\n if (t.name == a.data.token.name)\n {\n result = Object.assign({}, a.data.token);\n result._id = t.id;\n }\n else\n {\n result = {_id : t.id};\n }\n return result;\n });\n canvas.scene.updateEmbeddedDocuments(\"Token\", update);\n}","folder":null,"sort":0,"permission":{"default":0,"ODY1ZmU3OWIzNzY2":3},"flags":{"combat-utility-belt":{"macroTrigger":""}}}
{"_id":"TkTj0SiNr5ZIYADs","name":"!custom","type":"script","author":"ODY1ZmU3OWIzNzY2","img":"icons/svg/dice-target.svg","scope":"global","command":"(async ()=>{\n console.log(\"starting\");\n let processed = [];\n for(let iToken of canvas.tokens.placeables)\n {\n if (!iToken.data)\n {\n console.log(\"error: no token.data\");\n continue;\n }\n if (!iToken.data.name)\n {\n console.log(\"error: no token.data.name\");\n continue;\n }\n if (processed.indexOf(iToken.name) >= 0)\n {\n console.log(\"skipping \" + iToken.name);\n continue;\n }\n processed.push(iToken.name)\n console.log(\"token = \" + iToken.data.name);\n a = game.actors.getName(iToken.name);\n if (a == null)\n {\n console.log(\"no game actor found for \" + iToken.name);\n continue;\n }\n updateTokensForActorByName(iToken.name);\n }\n console.log(\"ending\");\n})();\n\nfunction updateTokensForActorByName(actorName)\n{\n a = game.actors.getName(actorName);\n await a.data.token.update({'bar2.attribute': 'None'});\n const update = a.getActiveTokens().map(t => {\n if (t.name == a.data.token.name)\n {\n result = Object.assign({}, a.data.token);\n result._id = t.id;\n }\n else\n {\n result = {_id : t.id};\n }\n return result;\n });\n canvas.scene.updateEmbeddedDocuments(\"Token\", update);\n}","folder":null,"sort":0,"permission":{"default":0,"ODY1ZmU3OWIzNzY2":3},"flags":{"combat-utility-belt":{"macroTrigger":""}}}
{"_id":"TkTj0SiNr5ZIYADs","name":"!custom","type":"script","author":"ODY1ZmU3OWIzNzY2","img":"icons/svg/dice-target.svg","scope":"global","command":"(async ()=>{\n console.log(\"starting\");\n let processed = [];\n for(let iToken of canvas.tokens.placeables)\n {\n if (!iToken.data)\n {\n console.log(\"error: no token.data\");\n continue;\n }\n if (!iToken.data.name)\n {\n console.log(\"error: no token.data.name\");\n continue;\n }\n if (processed.indexOf(iToken.name) >= 0)\n {\n console.log(\"skipping \" + iToken.name);\n continue;\n }\n processed.push(iToken.name)\n console.log(\"token = \" + iToken.data.name);\n a = game.actors.getName(iToken.name);\n if (a == null)\n {\n console.log(\"no game actor found for \" + iToken.name);\n continue;\n }\n updateTokensForActorByName(iToken.name);\n }\n console.log(\"ending\");\n})();\n\nfunction updateTokensForActorByName(actorName)\n{\n a = game.actors.getName(actorName);\n a.data.token.update({'bar2.attribute' : 'None'});\n const update = a.getActiveTokens().map(t => {\n if (t.name == a.data.token.name)\n {\n result = Object.assign({}, a.data.token);\n result._id = t.id;\n }\n else\n {\n result = {_id : t.id};\n }\n return result;\n });\n canvas.scene.updateEmbeddedDocuments(\"Token\", update);\n}","folder":null,"sort":0,"permission":{"default":0,"ODY1ZmU3OWIzNzY2":3},"flags":{"combat-utility-belt":{"macroTrigger":""}}}
{"_id":"TkTj0SiNr5ZIYADs","name":"!custom","type":"script","author":"ODY1ZmU3OWIzNzY2","img":"icons/svg/dice-target.svg","scope":"global","command":"(async ()=>{\n console.log(\"starting\");\n let processed = [];\n for(let iToken of canvas.tokens.placeables)\n {\n if (!iToken.data)\n {\n console.log(\"error: no token.data\");\n continue;\n }\n if (!iToken.data.name)\n {\n console.log(\"error: no token.data.name\");\n continue;\n }\n if (processed.indexOf(iToken.name) >= 0)\n {\n console.log(\"skipping \" + iToken.name);\n continue;\n }\n processed.push(iToken.name)\n console.log(\"token = \" + iToken.data.name);\n a = game.actors.getName(iToken.name);\n if (a == null)\n {\n console.log(\"no game actor found for \" + iToken.name);\n continue;\n }\n updateTokensForActorByName(iToken.name);\n }\n console.log(\"ending\");\n})();\n\nfunction updateTokensForActorByName(actorName)\n{\n a = game.actors.getName(actorName);\n const update = a.getActiveTokens().map(t => {\n if (t.name == a.data.token.name)\n {\n result = Object.assign({}, a.data.token);\n result._id = t.id;\n }\n else\n {\n result = {_id : t.id};\n }\n return result;\n });\n canvas.scene.updateEmbeddedDocuments(\"Token\", update);\n}","folder":null,"sort":0,"permission":{"default":0,"ODY1ZmU3OWIzNzY2":3},"flags":{"combat-utility-belt":{"macroTrigger":""}}}
Loading

0 comments on commit 4e1a352

Please sign in to comment.