{ "name": "Weapon-Select", "type": "script", "scope": "global", "author": "3r8Uo5wkrb6EqEZc", "img": "icons/svg/dice-target.svg", "command": "let applyWeaponChanges = false;\nlet applyFistChanges = false;\nconst his = game.actors.getName(\"Hisui\");\n\nlet style = '
Hisui is using ';\n\n\n\nnew Dialog({\n title : `Improvised Weapon Select`,\n content : `\n \n \n `,\n buttons : {\n weapon : {\n icon : \"\",\n label : `Equip Weapon`,\n callback : () => { applyWeaponChanges = true; applyFistChanges = false; }\n },\n fists : {\n icon : \"\",\n label : `Equip Hands`,\n callback : () => { applyWeaponChanges = false; applyFistChanges = true; }\n },\n cancel : {\n icon : \"\",\n label : `Cancel`,\n callback : () => { applyWeaponChanges = false; applyFistChanges = false; }\n }\n },\n default : \"weapon\",\n close : html => {\n if (applyWeaponChanges || applyFistChanges) {\n if(applyWeaponChanges) {\n let die = ( html.find('[name=\"dice\"]')[0].value || \"d8\" );\n let hand = ( html.find('[name=\"attackmod\"]')[0].value || \"1h\" );\n let mod = ( hand == \"2h\" ) ? (his.data.data.abilities.str.mod - his.data.data.abilities.dex.mod) : 0; \n\n his.system.attributes.weapon.melee.dice = die;\n his.system.attributes.attackMod.value = mod;\n\n his.update({'system.attributes.weapon.melee.dualwield' : (hand == \"1h\") ? 'true' : 'false' });\n\n message += 'a '+ ( hand == \"1h\" ? 'one-handed ' : 'two-handed ') + 'weapon with a ' + die + ' damage die.
';\n\n \n } else {\n his.system.attributes.attackMod.value = 0;\n his.update({'system.attributes.weapon.melee.dualwield' : 'true' });\n \n message += 'her bare hands.'\n }\n\n his.update({'system.resources.spendable.custom2.current' : (applyWeaponChanges == true) ? 1 : 0});\n\n ChatMessage.create({\n user: game.user._id,\n speaker: ChatMessage.getSpeaker({token: actor}),\n content: message\n });\n\n\n }\n }\n }).render(true);", "flags": { "exportSource": { "world": "valoran", "system": "archmage", "coreVersion": "10.291", "systemVersion": "1.23.1" } }, "_stats": { "systemId": "archmage", "systemVersion": "1.23.1", "coreVersion": "10.291", "createdTime": 1670059784200, "modifiedTime": 1670152580815, "lastModifiedBy": "3r8Uo5wkrb6EqEZc" } }