@@ -6,8 +6,8 @@ pf2eAnimations.hooks = {};
66pf2eAnimations . hooks . ready = Hooks . once ( "ready" , ( ) => {
77 console . log (
88 "PF2e Animations v" +
9- game . modules . get ( "pf2e-jb2a-macros" ) . version +
10- " loaded."
9+ game . modules . get ( "pf2e-jb2a-macros" ) . version +
10+ " loaded."
1111 ) ;
1212 // Warn if no JB2A is found.
1313 if (
@@ -104,15 +104,15 @@ pf2eAnimations.hooks.ready = Hooks.once("ready", () => {
104104 ${ game . i18n . localize ( "pf2e-jb2a-macros.welcomeMessage.settingsButton" ) }
105105 </button>
106106 <p style="text-align: center; margin: 0; margin-top: 5px;"><i>${ game . i18n . localize (
107- "pf2e-jb2a-macros.welcomeMessage.footer"
108- ) } </i></p>
107+ "pf2e-jb2a-macros.welcomeMessage.footer"
108+ ) } </i></p>
109109 </div>` ,
110110 } ) ;
111111 }
112112
113113 // GM-Only stuff.
114114 if ( ! game . user . isGM ) return ;
115- if ( game . settings . get ( "pf2e" , "tokens.autoscale" ) )
115+ if ( game . settings . get ( game . system . id , "tokens.autoscale" ) )
116116 game . settings . set ( "pf2e-jb2a-macros" , "smallTokenScale" , 0.8 ) ;
117117 if ( ! game . modules . get ( "tokenmagic" ) ?. active )
118118 game . settings . set ( "pf2e-jb2a-macros" , "tmfx" , false ) ;
@@ -137,7 +137,7 @@ pf2eAnimations.hooks.createChatMessage = Hooks.on(
137137 async ( data ) => {
138138 if ( game . user . id !== data . author . id ) return ;
139139 let targets =
140- data ?. flags ?. pf2e ?. target ?. token ?? Array . from ( game . user . targets ) ;
140+ data ?. flags ?. pf2e ?. target ?. token ?? data ?. flags ?. sf2e ?. target ?. token ?? Array . from ( game . user . targets ) ;
141141 targets = [ targets ] . flat ( ) ;
142142 let token = data . token ?? canvas . tokens . controlled [ 0 ] ;
143143 let flavor = data . flavor ?? null ;
@@ -168,12 +168,13 @@ pf2eAnimations.hooks.createChatMessage = Hooks.on(
168168 }
169169 // Attack Matches
170170 if (
171- data . flags . pf2e ?. context ?. type === "attack-roll" &&
171+ ( data . flags . pf2e ?. context ?. type === "attack-roll" ||
172+ data . flags . sf2e ?. context ?. type === "attack-roll" ) &&
172173 ! game . settings . get ( "pf2e-jb2a-macros" , "disableHitAnims" )
173174 ) {
174175 const degreeOfSuccess =
175176 pf2eAnimations . degreeOfSuccessWithRerollHandling ( data ) ;
176- const pack = game . packs . get ( " pf2e-jb2a-macros.Actions" ) ;
177+ const pack = game . packs . get ( ` pf2e-jb2a-macros.${ game . system . id } -actions` ) ;
177178 if ( ! pack )
178179 ui . notifications . error (
179180 `PF2e Animations | ${ pf2eAnimations . localize (
@@ -278,8 +279,8 @@ pf2eAnimations.hooks.updateItem = Hooks.on("updateItem", (data, changes) => {
278279 const status = data . isInvested
279280 ? "invested"
280281 : data . isEquipped
281- ? "equipped"
282- : false ;
282+ ? "equipped"
283+ : false ;
283284 Hooks . call ( "pf2eAnimations.equipOrInvestItem" , status , data ) ;
284285} ) ;
285286
@@ -288,12 +289,11 @@ pf2eAnimations.hooks.renderActorDirectory = Hooks.on(
288289 "renderActorDirectory" ,
289290 ( app , html , data ) => {
290291 if ( ! ( game . user . isGM && game . settings . get ( "pf2e-jb2a-macros" , "debug" ) ) ) {
291- const $html = html instanceof jQuery ? html : $ ( html ) ;
292+ const $html = html instanceof jQuery ? html : $ ( html ) ;
292293 const folder = $html . find (
293- `.folder[data-folder-id="${
294- game . folders . get (
295- game . settings . get ( "pf2e-jb2a-macros" , "dummyNPCId-folder" )
296- ) ?. id
294+ `.folder[data-folder-id="${ game . folders . get (
295+ game . settings . get ( "pf2e-jb2a-macros" , "dummyNPCId-folder" )
296+ ) ?. id
297297 } "]`
298298 ) ;
299299 folder . remove ( ) ;
@@ -426,8 +426,7 @@ pf2eAnimations.hooks.AutomatedAnimations.metaData = Hooks.on(
426426 ) ;
427427 } else if ( metaData . name === "PF2e Animations" ) {
428428 ui . notifications . notify (
429- `${ metaData . name } (v${ metaData . moduleVersion } ) | Animation Version: ${
430- metaData . version
429+ `${ metaData . name } (v${ metaData . moduleVersion } ) | Animation Version: ${ metaData . version
431430 } <hr>${ pf2eAnimations . localize (
432431 "pf2e-jb2a-macros.notifications.metaData"
433432 ) } `
@@ -519,12 +518,11 @@ pf2eAnimations.hooks.foundrySummonsWrapper = Hooks.on(
519518 }
520519
521520 getLamp ( color , isThumb ) {
522- return `modules/${
523- game . modules . get ( "jb2a_patreon" ) ? "jb2a_patreon" : "JB2A_DnD5e"
524- } /Library/Cantrip/Dancing_Lights/DancingLights_01_${ color . replaceAll (
525- "-" ,
526- ""
527- ) } _${ isThumb ? "Thumb.webp" : "200x200.webm" } `;
521+ return `modules/${ game . modules . get ( "jb2a_patreon" ) ? "jb2a_patreon" : "JB2A_DnD5e"
522+ } /Library/Cantrip/Dancing_Lights/DancingLights_01_${ color . replaceAll (
523+ "-" ,
524+ ""
525+ ) } _${ isThumb ? "Thumb.webp" : "200x200.webm" } `;
528526 }
529527
530528 async loadDocument ( ) {
@@ -596,10 +594,10 @@ pf2eAnimations.runMacro = async function runJB2Apf2eMacro(
596594 } else {
597595 ui . notifications . error (
598596 "PF2e Animations | Macro " +
599- macroName +
600- " not found in " +
601- compendiumName +
602- "."
597+ macroName +
598+ " not found in " +
599+ compendiumName +
600+ "."
603601 ) ;
604602 }
605603 } else {
@@ -612,7 +610,7 @@ pf2eAnimations.runMacro = async function runJB2Apf2eMacro(
612610// As above @ xdy.
613611pf2eAnimations . degreeOfSuccessWithRerollHandling =
614612 function degreeOfSuccessWithRerollHandling ( message ) {
615- const flags = message . flags . pf2e ;
613+ const flags = message . flags . pf2e || message . flags . sf2e ;
616614 let degreeOfSuccess = flags . context ?. outcome ?? "" ;
617615 if ( flags ?. context ?. isReroll ) {
618616 const match = message . flavor ?. match ( 'Result: <span .*? class="(.*?)"' ) ;
@@ -630,7 +628,7 @@ pf2eAnimations.degreeOfSuccessWithRerollHandling =
630628 */
631629pf2eAnimations . macroHelpers = function vauxsMacroHelpers (
632630 args = [ ] ,
633- _callback = ( ) => { }
631+ _callback = ( ) => { }
634632) {
635633 pf2eAnimations . debug ( "Vaux's Macro Helpers | Args" , args ) ;
636634 let token = args [ 1 ] ?. sourceToken ?? canvas . tokens . controlled [ 0 ] ;
@@ -721,14 +719,14 @@ pf2eAnimations.alignmentStringToTraits = function alignmentStringToTraits(
721719 a === "L"
722720 ? "C"
723721 : a === "C"
724- ? "L"
725- : a === "G"
726- ? "E"
727- : a === "E"
728- ? "G"
729- : a === "N"
730- ? ""
731- : a
722+ ? "L"
723+ : a === "G"
724+ ? "E"
725+ : a === "E"
726+ ? "G"
727+ : a === "N"
728+ ? ""
729+ : a
732730 )
733731 . join ( "" ) ;
734732 }
@@ -769,7 +767,7 @@ pf2eAnimations.crosshairs = async function crosshairs(
769767 if ( ! CONST . WALL_RESTRICTION_TYPES . includes ( opts . noCollisionType ) ) {
770768 throw new Error (
771769 "A valid wall restriction type is required for testCollision. Passed " +
772- opts . noCollisionType
770+ opts . noCollisionType
773771 ) ;
774772 }
775773
@@ -840,7 +838,7 @@ pf2eAnimations.crosshairs = async function crosshairs(
840838 distance > opts . range ||
841839 ( opts . noCollision
842840 ? canvas . walls . checkCollision ( ray , { type : opts . noCollisionType } )
843- . length
841+ . length
844842 : false )
845843 ) {
846844 crosshairs . icon = "icons/svg/hazard.svg" ;
@@ -904,7 +902,7 @@ pf2eAnimations.crosshairs = async function crosshairs(
904902 if ( location . flags [ "pf2e-jb2a-macros" ] ?. outOfRange === "outOfRange" ) {
905903 ui . notifications . error (
906904 "PF2e Animations | " +
907- pf2eAnimations . localize ( "pf2e-jb2a-macros.notifications.outOfRange" )
905+ pf2eAnimations . localize ( "pf2e-jb2a-macros.notifications.outOfRange" )
908906 ) ;
909907 location = { cancelled : true } ;
910908 }
0 commit comments