Skip to content

Commit

Permalink
v2.1.7 release
Browse files Browse the repository at this point in the history
  • Loading branch information
drewg13 committed Jun 2, 2023
1 parent 5095e79 commit 786ffc1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,5 @@ v1.9.4 Fix Trauma tooltip z-indexing
2.1.5 Fix ship assignment to characters

2.1.6 Default Map Notes Visibility to true, V11 compatibility

2.1.7 Fix to Jobs macro folder code (reimport to use)
2 changes: 1 addition & 1 deletion packs/macros.db
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{"name":"Jobs","type":"script","author":"FIR7wPEGx1wVISuV","img":"icons/environment/people/commoner.webp","scope":"global","command":"/* - v1.1\nSource: brunocalado\nIcon: icons/environment/people/commoner.webp\n*/\n\n(async () => {\n const faction1 = await drawFromTable('Factions');\n const faction2 = await drawFromTable('Factions');\n const client = await drawFromTable('Client / Target');\n const target = await drawFromTable('Client / Target');\n const twist = await drawFromTable('Twist');\n const place = await drawFromTable('Job Location');\n const task = await drawFromTable('Work');\n const connection = await drawFromTable('Connection');\n\n let msg = `<h2>Job</h2>`;\n msg += `<ul><li>Faction 1: <b>${faction1}</b></li>`;\n msg += `<li>Faction 2: <b>${faction2}</b></li>`;\n msg += `<li>Client: <b>${client}</b></li>`;\n msg += `<li>Target: <b>${target}</b></li>`;\n msg += `<li>Twist: <b>${twist}</b></li>`;\n msg += `<li>Job Location: <b>${place}</b></li>`;\n msg += `<li>Job: <b>${task}</b></li>`;\n msg += `<li>Connection: <b>${connection}</b></li></ul>`;\n\n let message=msg;\n let msgId = randomID();\n\n let data = {\n name: `${task}`,\n content: msg\n }; \n \n message+=`<button style=\"background:#d10000;color:white\" id=\"createJob-`\n message+=msgId;\n message+=`\">Save As Journal Entry</button>`;\n\n let chatData = {\n content: message,\n whisper : ChatMessage.getWhisperRecipients(\"GM\")\n }; \n ChatMessage.create(chatData, {}); \n \n addEventListenerOnHtmlElement(\"#createJob-\" + msgId, 'click', (e) => {\n createJob(data); \n });\n})()\n\n/* Functions */\nasync function drawFromTable(tableName) {\n\n let roll_compendiums;\n let job_compendiums;\n roll_compendiums = game.packs.filter( p => p.documentName === 'RollTable');\n job_compendiums = await roll_compendiums.filter( p => p.metadata.label === 'Job Tables' )[0].getDocuments();\n const table = await job_compendiums.filter( p=> p.name === tableName )[0]; \n \n if (!table) {\n ui.notifications.warn(`Table ${tableName} not found.`, {});\n return;\n }\n const output = await table.roll();\n const result = output.results[0].text;\n return result; \n}\n\nfunction addEventListenerOnHtmlElement(element, event, func){ \n Hooks.on(\"renderChatMessage\", (chatItem, html, data) => {\n if( html[0].querySelector(element) !== null ) {\n html[0].querySelector(element).addEventListener(event, func);\n }\n });\n}\n\nasync function createJob(data) {\n\n let folder;\n if( game.folders.find( f => f.name === \"Job Ideas\") === undefined ) {\n folder = await Folder.create( {\n name: \"Job Ideas\",\n type: \"JournalEntry\"\n } );\n } else {\n folder = game.folders.find( f => f.name === \"Job Ideas\");\n }\n folder = folder;\n\n const instantAdventure = await JournalEntry.create(data);\n await instantAdventure.sheet.render(true); \n}","folder":null,"sort":0,"flags":{"core":{"sourceId":"Macro.GVICe576rSbJ1REF"}},"_id":"oN7DpBJRIfOACpzL","ownership":{"default":0,"FIR7wPEGx1wVISuV":3},"_stats":{"systemId":"scum-and-villainy","systemVersion":"2.0.0","coreVersion":"10.270","createdTime":null,"modifiedTime":1655580822493,"lastModifiedBy":"FIR7wPEGx1wVISuV"}}
{"name":"Jobs","type":"script","author":"FIR7wPEGx1wVISuV","img":"icons/environment/people/commoner.webp","scope":"global","command":"/* - v1.1\nSource: brunocalado\nIcon: icons/environment/people/commoner.webp\n*/\n\n(async () => {\n const faction1 = await drawFromTable('Factions');\n const faction2 = await drawFromTable('Factions');\n const client = await drawFromTable('Client / Target');\n const target = await drawFromTable('Client / Target');\n const twist = await drawFromTable('Twist');\n const place = await drawFromTable('Job Location');\n const task = await drawFromTable('Work');\n const connection = await drawFromTable('Connection');\n\n let msg = `<h2>Job</h2>`;\n msg += `<ul><li>Faction 1: <b>${faction1}</b></li>`;\n msg += `<li>Faction 2: <b>${faction2}</b></li>`;\n msg += `<li>Client: <b>${client}</b></li>`;\n msg += `<li>Target: <b>${target}</b></li>`;\n msg += `<li>Twist: <b>${twist}</b></li>`;\n msg += `<li>Job Location: <b>${place}</b></li>`;\n msg += `<li>Job: <b>${task}</b></li>`;\n msg += `<li>Connection: <b>${connection}</b></li></ul>`;\n\n let message=msg;\n let msgId = randomID();\n\n let data = {\n name: `${task}`,\n content: msg\n }; \n \n message+=`<button style=\"background:#d10000;color:white\" id=\"createJob-`\n message+=msgId;\n message+=`\">Save As Journal Entry</button>`;\n\n let chatData = {\n content: message,\n whisper : ChatMessage.getWhisperRecipients(\"GM\")\n }; \n ChatMessage.create(chatData, {}); \n \n addEventListenerOnHtmlElement(\"#createJob-\" + msgId, 'click', (e) => {\n createJob(data); \n });\n})()\n\n/* Functions */\nasync function drawFromTable(tableName) {\n\n let roll_compendiums;\n let job_compendiums;\n roll_compendiums = game.packs.filter( p => p.documentName === 'RollTable');\n job_compendiums = await roll_compendiums.filter( p => p.metadata.label === 'Job Tables' )[0].getDocuments();\n const table = await job_compendiums.filter( p=> p.name === tableName )[0]; \n \n if (!table) {\n ui.notifications.warn(`Table ${tableName} not found.`, {});\n return;\n }\n const output = await table.roll();\n const result = output.results[0].text;\n return result; \n}\n\nfunction addEventListenerOnHtmlElement(element, event, func){ \n Hooks.on(\"renderChatMessage\", (chatItem, html, data) => {\n if( html[0].querySelector(element) !== null ) {\n html[0].querySelector(element).addEventListener(event, func);\n }\n });\n}\n\nasync function createJob(data) {\n\n let folder;\n if( game.folders.find( f => f.name === \"Job Ideas\") === undefined ) {\n folder = await Folder.create( {\n name: \"Job Ideas\",\n type: \"JournalEntry\"\n } );\n } else {\n folder = game.folders.find( f => f.name === \"Job Ideas\");\n }\n data.folder = folder;\n\n const instantAdventure = await JournalEntry.create(data);\n await instantAdventure.sheet.render(true); \n}","folder":null,"sort":0,"flags":{"core":{"sourceId":"Macro.GVICe576rSbJ1REF"}},"_id":"oN7DpBJRIfOACpzL","ownership":{"default":0,"FIR7wPEGx1wVISuV":3},"_stats":{"systemId":"scum-and-villainy","systemVersion":"2.0.0","coreVersion":"10.270","createdTime":null,"modifiedTime":1655580822493,"lastModifiedBy":"FIR7wPEGx1wVISuV"}}
{"name":"Change XP Bars","type":"script","author":"DndvQQR4KOtSK1iV","img":"icons/sundries/misc/lock-open-yellow.webp","scope":"global","command":"const version = '1.1';\n\n/*\nhttps://raw.githubusercontent.com/brunocalado/mestre-digital/master/Foundry%20VTT/Macros/Forged%20in%20the%20Dark/BladesintheDark-XpBar.js\nicon: icons/sundries/misc/lock-open-yellow.webp\n*/\n\nlet tokenD;\n\nif (canvas.tokens.controlled[0] === undefined){\n ui.notifications.warn(\"You must select a token!\"); \n} else {\n tokenD = canvas.tokens.controlled[0].actor;\n main();\n}\n\nasync function main() {\n let attribute = [];\n if(tokenD.type === 'character'){\n attribute = Object.keys( game.system.model.Actor.character.attributes );\n attribute.push(\"class\");\n attribute.push(\"stress\");\n } else if(tokenD.type === 'ship'){\n attribute = [\"crew\"];\n }\n\n let attributeList = ``;\n attribute.map((t) => {\n attributeList += `<option value=\"${t}\">${t}</option>`;\n });\n \n new Dialog({\n title: `XP/Stress Bar - Manager - v${version}`,\n content: `\n <h2>Bar Size</h2>\n <p> \n <input type=\"number\" min=1 max=12 id=\"xpBarSize\" value=\"6\"/>\n </p><br>\n <h2>Choose Bar</h2>\n <p> \n <select id=\"attribute\" type=\"text\" style=\"width: 100px;\">\n ${attributeList}\n </select> \n </p> \n `,\n buttons: {\n roll: {\n label: \"Change\",\n callback: (html) => {\n changeActorSheetBar(html);\n }\n }, \n cancel: {\n label: \"Cancel\"\n }\n }\n }).render(true)\n}\n\nasync function changeActorSheetBar(html) {\n const xpBarSize = parseInt( html.find(\"#xpBarSize\")[0].value ); \n let attribute = html.find(\"#attribute\")[0].value;\n let updated; \n \n switch( attribute ){\n case 'class':\n updated = await Actor.updateDocuments([{_id: tokenD.id, \"system.experienceMax\": xpBarSize}]);\n break;\n case 'crew':\n updated = await Actor.updateDocuments([{_id: tokenD.id, \"system.crew_experienceMax\": xpBarSize}]);\n break;\n case 'stress':\n updated = await Actor.updateDocuments([{_id: tokenD.id, \"system.stress.max\": xpBarSize, \"system.stress.max_default\": xpBarSize}]);\n break;\n default:\n let key = \"system.attributes.\" + attribute + \".expMax\"; \n updated = await Actor.updateDocuments([{_id: tokenD.id, [key]: xpBarSize}]);\n }\n}","folder":null,"sort":0,"permission":{"default":0,"DndvQQR4KOtSK1iV":3},"flags":{"advanced-macros":{"runAsGM":false},"exportSource":{"world":"sav","system":"scum-and-villainy","coreVersion":"0.8.9","systemVersion":"1.9.4"},"core":{"sourceId":"Macro.R5S30v5UU19PIynf"}},"_id":"u1UhdaU5aGofIaAK"}
6 changes: 3 additions & 3 deletions system.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
],
"url": "https://github.com/drewg13/foundryvtt-scum-and-villainy/",
"flags": {},
"version": "2.1.6",
"version": "2.1.7",
"compatibility": {
"minimum": 10,
"verified": 11.299
"verified": 11.300
},
"system": [],
"relationships": [],
"socket": false,
"manifest": "https://raw.githubusercontent.com/drewg13/foundryvtt-scum-and-villainy/master/system.json",
"download": "https://github.com/drewg13/foundryvtt-scum-and-villainy/archive/v2.1.6.zip",
"download": "https://github.com/drewg13/foundryvtt-scum-and-villainy/archive/v2.1.7.zip",
"protected": false,
"initiative": "1d20",
"scripts": [],
Expand Down

0 comments on commit 786ffc1

Please sign in to comment.