Created
August 29, 2022 17:03
-
-
Save colgraff/abc077c3ccf9d96868f2e25254dc6c48 to your computer and use it in GitHub Desktop.
Useful settings for Foundry VTT's Token Tooltip Alt module when you're using the PF2E system,
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"gmSettings": { | |
"default": { | |
"items": [ | |
{ | |
"disposition": "FRIENDLY", | |
"items": [ | |
{ | |
"value": "{hp = <attributes.hp.value>;\n hpm = <attributes.hp.max>;\n concat(string(hp), \"/\", string(hpm))\n}", | |
"icon": "fa-heart", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#d31d1d" | |
}, | |
{ | |
"value": "attributes.ac.value", | |
"icon": "fa-shield-alt", | |
"isFunction": false, | |
"expression": false, | |
"isNumber": false, | |
"color": "#0262b6" | |
}, | |
{ | |
"value": "{<saves.fortitude.value>+10}", | |
"icon": "fa-chess-rook", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#d1d1d1" | |
}, | |
{ | |
"value": "{<saves.reflex.value>+10}", | |
"icon": "fa-running", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#60d2e6" | |
}, | |
{ | |
"value": "{<saves.will.value>+10}", | |
"icon": "fa-brain", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#d756cc" | |
}, | |
{ | |
"value": "{<skills.ath.value>+10}", | |
"icon": "fa-fist-raised", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#dd792c" | |
}, | |
{ | |
"value": "{<skills.ste.value>+10}", | |
"icon": "fa-eye-slash", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#6d6467" | |
}, | |
{ | |
"value": "{<attributes.perception.value>+10}", | |
"icon": "fa-eye", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#b85ee8" | |
}, | |
{ | |
"value": "{concat(string(<attributes.speed.total>), \" ft\")}", | |
"icon": "fa-shoe-prints", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#c04b0c" | |
}, | |
{ | |
"value": "let distance = tokenDistance(_token, token);\nreturn \"~\" +Math.ceil(distance) +\" ft\";\n/*\n Total Distance between two tokens.\n*/\nfunction tokenDistance(token1, token2)\n{\n if(!token1 || !token2) return;\n\n let distance = measureDistancePF2(token1, token2);\n if(token1.data.elevation !== token2.data.elevation)\n {\n const gs = canvas.dimensions.size;\n let h_diff = token2.data.elevation > token1.data.elevation\n ? Math.max(token2.data.elevation - Math.max(Math.floor((5*token1.hitArea.width/gs)-5),0) - token1.data.elevation,0)\n : Math.max(token1.data.elevation - Math.max(Math.floor((5*token2.hitArea.width/gs)-5),0) - token2.data.elevation,0);\n\n let tokenA = {x:0, y:0, center:{x:0, y:0}, hitArea:{width:gs, height:gs}}; let tokenB = {x:(distance.squares)*gs, y:(h_diff/5)*gs,center:{x:(distance.squares)*gs, y:(h_diff/5)*gs}, hitArea:{width:gs, height:gs}};\n let distanceAdjusted = measureDistancePF2(tokenA, tokenB)\n return distanceAdjusted.distance//Math.sqrt(Math.pow(h_diff,2) + Math.pow(distance,2));\n }else{\n return distance.distance;\n }\n}\n\n\nfunction distanceMeasure(p0,p1){\n\tconst gs = canvas.dimensions.size;\n const ray = new Ray(p0, p1);\n // How many squares do we travel across to get there? If 2.3, we should count that as 3 instead of 2; hence, Math.ceil\n const nx = (Math.abs(ray.dx / gs));\n const ny = (Math.abs(ray.dy / gs));\n\n // Get the number of straight and diagonal moves\n const nDiagonal = Math.min(nx, ny);\n const nStraight = Math.abs(ny - nx);\n\n // Diagonals in PF pretty much count as 1.5 times a straight\n var distance2 = Math.floor(nDiagonal * 1.5 + nStraight);\n\treturn {distance:distance2, squares:(Math.floor(nDiagonal+nStraight))}\n}\n\n//Account for token size.\nfunction measureDistancePF2(p0, p1){\n const gs = canvas.dimensions.size;\n Cp0x = (Math.floor(p0.hitArea.width/gs) >= 1|| Math.floor(p0.hitArea.height/gs) >= 1) ? p0.center.x : 100*Math.floor(p0.x/100)+50;\n Cp0y = (Math.floor(p0.hitArea.width/gs) >= 1|| Math.floor(p0.hitArea.height/gs) >= 1) ? p0.center.y : 100*Math.floor(p0.y/100)+50;\n Cp1x = (Math.floor(p1.hitArea.width/gs) >= 1|| Math.floor(p1.hitArea.height/gs) >= 1) ? p1.center.x : 100*Math.floor(p1.x/100)+50;\n Cp1y = (Math.floor(p1.hitArea.width/gs) >= 1|| Math.floor(p1.hitArea.height/gs) >= 1) ? p1.center.y : 100*Math.floor(p1.y/100)+50;\n\t const prelimDistance = distanceMeasure({x:Cp0x,y:Cp0y},{x:Cp1x,y:Cp1y});\n\t\tlet distance = prelimDistance.distance;\n\tif(p0 === p1){distance = {distance:0, squares:0};\n }else {\n\t\t\t const diffX0 = Cp0x - Cp1x\n\t\t\t const diffY0 = Cp0y - Cp1y\n\t\t\t const diffX01 = Cp1x - (Cp0x-Math.sign(diffX0)*((p0.hitArea.width/2)-gs/2))\n\t\t\t const diffY01 = Cp1y - (Cp0y-Math.sign(diffY0)*((p0.hitArea.height/2)-gs/2))\n\t\t\t const testF = distanceMeasure({x:Cp0x-(Math.sign(diffX0)*((p0.hitArea.width/2)-gs/2)),y:Cp0y-(Math.sign(diffY0)*((p0.hitArea.height/2)-gs/2))},{x:Cp1x-(Math.sign(diffX01)*((p1.hitArea.width/2)-gs/2)),y:Cp1y-(Math.sign(diffY01)*((p1.hitArea.height/2)-gs/2))})\n\t\t\t distance = testF\n\t\t\t };\n\n\t\t//Finalize things\n\t\tconst distanceOnGrid = {distance:distance.distance * canvas.dimensions.distance, squares:distance.squares};\n return distanceOnGrid;\n }", | |
"icon": "fa-ruler", | |
"isFunction": true, | |
"expression": false, | |
"isNumber": false, | |
"color": "#fbdf2d" | |
} | |
] | |
}, | |
{ | |
"disposition": "NEUTRAL", | |
"items": [ | |
{ | |
"value": "{hp = <attributes.hp.value>;\n hpm = <attributes.hp.max>;\n concat(string(hp), \"/\", string(hpm))\n}", | |
"icon": "fa-heart", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#d31d1d" | |
}, | |
{ | |
"value": "attributes.ac.value", | |
"icon": "fa-shield-alt", | |
"isFunction": false, | |
"expression": false, | |
"isNumber": false, | |
"color": "#0262b6" | |
}, | |
{ | |
"value": "{<saves.fortitude.value>+10}", | |
"icon": "fa-chess-rook", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#d1d1d1" | |
}, | |
{ | |
"value": "{<saves.reflex.value>+10}", | |
"icon": "fa-running", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#60d2e6" | |
}, | |
{ | |
"value": "{<saves.will.value>+10}", | |
"icon": "fa-brain", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#d756cc" | |
}, | |
{ | |
"value": "{<skills.ath.value>+10}", | |
"icon": "fa-fist-raised", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#dd792c" | |
}, | |
{ | |
"value": "{<skills.ste.value>+10}", | |
"icon": "fa-eye-slash", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#6d6467" | |
}, | |
{ | |
"value": "{<attributes.perception.value>+10}", | |
"icon": "fa-eye", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#b85ee8" | |
}, | |
{ | |
"value": "{concat(string(<attributes.speed.total>), \" ft\")}", | |
"icon": "fa-shoe-prints", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#c04b0c" | |
}, | |
{ | |
"value": "let distance = tokenDistance(_token, token);\nreturn \"~\" +Math.ceil(distance) +\" ft\";\n/*\n Total Distance between two tokens.\n*/\nfunction tokenDistance(token1, token2)\n{\n if(!token1 || !token2) return;\n\n let distance = measureDistancePF2(token1, token2);\n if(token1.data.elevation !== token2.data.elevation)\n {\n const gs = canvas.dimensions.size;\n let h_diff = token2.data.elevation > token1.data.elevation\n ? Math.max(token2.data.elevation - Math.max(Math.floor((5*token1.hitArea.width/gs)-5),0) - token1.data.elevation,0)\n : Math.max(token1.data.elevation - Math.max(Math.floor((5*token2.hitArea.width/gs)-5),0) - token2.data.elevation,0);\n\n let tokenA = {x:0, y:0, center:{x:0, y:0}, hitArea:{width:gs, height:gs}}; let tokenB = {x:(distance.squares)*gs, y:(h_diff/5)*gs,center:{x:(distance.squares)*gs, y:(h_diff/5)*gs}, hitArea:{width:gs, height:gs}};\n let distanceAdjusted = measureDistancePF2(tokenA, tokenB)\n return distanceAdjusted.distance//Math.sqrt(Math.pow(h_diff,2) + Math.pow(distance,2));\n }else{\n return distance.distance;\n }\n}\n\n\nfunction distanceMeasure(p0,p1){\n\tconst gs = canvas.dimensions.size;\n const ray = new Ray(p0, p1);\n // How many squares do we travel across to get there? If 2.3, we should count that as 3 instead of 2; hence, Math.ceil\n const nx = (Math.abs(ray.dx / gs));\n const ny = (Math.abs(ray.dy / gs));\n\n // Get the number of straight and diagonal moves\n const nDiagonal = Math.min(nx, ny);\n const nStraight = Math.abs(ny - nx);\n\n // Diagonals in PF pretty much count as 1.5 times a straight\n var distance2 = Math.floor(nDiagonal * 1.5 + nStraight);\n\treturn {distance:distance2, squares:(Math.floor(nDiagonal+nStraight))}\n}\n\n//Account for token size.\nfunction measureDistancePF2(p0, p1){\n const gs = canvas.dimensions.size;\n Cp0x = (Math.floor(p0.hitArea.width/gs) >= 1|| Math.floor(p0.hitArea.height/gs) >= 1) ? p0.center.x : 100*Math.floor(p0.x/100)+50;\n Cp0y = (Math.floor(p0.hitArea.width/gs) >= 1|| Math.floor(p0.hitArea.height/gs) >= 1) ? p0.center.y : 100*Math.floor(p0.y/100)+50;\n Cp1x = (Math.floor(p1.hitArea.width/gs) >= 1|| Math.floor(p1.hitArea.height/gs) >= 1) ? p1.center.x : 100*Math.floor(p1.x/100)+50;\n Cp1y = (Math.floor(p1.hitArea.width/gs) >= 1|| Math.floor(p1.hitArea.height/gs) >= 1) ? p1.center.y : 100*Math.floor(p1.y/100)+50;\n\t const prelimDistance = distanceMeasure({x:Cp0x,y:Cp0y},{x:Cp1x,y:Cp1y});\n\t\tlet distance = prelimDistance.distance;\n\tif(p0 === p1){distance = {distance:0, squares:0};\n }else {\n\t\t\t const diffX0 = Cp0x - Cp1x\n\t\t\t const diffY0 = Cp0y - Cp1y\n\t\t\t const diffX01 = Cp1x - (Cp0x-Math.sign(diffX0)*((p0.hitArea.width/2)-gs/2))\n\t\t\t const diffY01 = Cp1y - (Cp0y-Math.sign(diffY0)*((p0.hitArea.height/2)-gs/2))\n\t\t\t const testF = distanceMeasure({x:Cp0x-(Math.sign(diffX0)*((p0.hitArea.width/2)-gs/2)),y:Cp0y-(Math.sign(diffY0)*((p0.hitArea.height/2)-gs/2))},{x:Cp1x-(Math.sign(diffX01)*((p1.hitArea.width/2)-gs/2)),y:Cp1y-(Math.sign(diffY01)*((p1.hitArea.height/2)-gs/2))})\n\t\t\t distance = testF\n\t\t\t };\n\n\t\t//Finalize things\n\t\tconst distanceOnGrid = {distance:distance.distance * canvas.dimensions.distance, squares:distance.squares};\n return distanceOnGrid;\n }", | |
"icon": "fa-ruler", | |
"isFunction": true, | |
"expression": false, | |
"isNumber": false, | |
"color": "#fbdf2d" | |
} | |
] | |
}, | |
{ | |
"disposition": "HOSTILE", | |
"items": [ | |
{ | |
"value": "{hp = <attributes.hp.value>;\n hpm = <attributes.hp.max>;\n concat(string(hp), \"/\", string(hpm))\n}", | |
"icon": "fa-heart", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#d31d1d" | |
}, | |
{ | |
"value": "attributes.ac.value", | |
"icon": "fa-shield-alt", | |
"isFunction": false, | |
"expression": false, | |
"isNumber": false, | |
"color": "#0262b6" | |
}, | |
{ | |
"value": "{<saves.fortitude.value>+10}", | |
"icon": "fa-chess-rook", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#d1d1d1" | |
}, | |
{ | |
"value": "{<saves.reflex.value>+10}", | |
"icon": "fa-running", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#60d2e6" | |
}, | |
{ | |
"value": "{<saves.will.value>+10}", | |
"icon": "fa-brain", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#d756cc" | |
}, | |
{ | |
"value": "{<skills.ath.value>+10}", | |
"icon": "fa-fist-raised", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#dd792c" | |
}, | |
{ | |
"value": "{<skills.ste.value>+10}", | |
"icon": "fa-eye-slash", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#6d6467" | |
}, | |
{ | |
"value": "{<attributes.perception.value>+10}", | |
"icon": "fa-eye", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#b85ee8" | |
}, | |
{ | |
"value": "{concat(string(<attributes.speed.total>), \" ft\")}", | |
"icon": "fa-shoe-prints", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#c04b0c" | |
}, | |
{ | |
"value": "let distance = tokenDistance(_token, token);\nreturn \"~\" +Math.ceil(distance) +\" ft\";\n/*\n Total Distance between two tokens.\n*/\nfunction tokenDistance(token1, token2)\n{\n if(!token1 || !token2) return;\n\n let distance = measureDistancePF2(token1, token2);\n if(token1.data.elevation !== token2.data.elevation)\n {\n const gs = canvas.dimensions.size;\n let h_diff = token2.data.elevation > token1.data.elevation\n ? Math.max(token2.data.elevation - Math.max(Math.floor((5*token1.hitArea.width/gs)-5),0) - token1.data.elevation,0)\n : Math.max(token1.data.elevation - Math.max(Math.floor((5*token2.hitArea.width/gs)-5),0) - token2.data.elevation,0);\n\n let tokenA = {x:0, y:0, center:{x:0, y:0}, hitArea:{width:gs, height:gs}}; let tokenB = {x:(distance.squares)*gs, y:(h_diff/5)*gs,center:{x:(distance.squares)*gs, y:(h_diff/5)*gs}, hitArea:{width:gs, height:gs}};\n let distanceAdjusted = measureDistancePF2(tokenA, tokenB)\n return distanceAdjusted.distance//Math.sqrt(Math.pow(h_diff,2) + Math.pow(distance,2));\n }else{\n return distance.distance;\n }\n}\n\n\nfunction distanceMeasure(p0,p1){\n\tconst gs = canvas.dimensions.size;\n const ray = new Ray(p0, p1);\n // How many squares do we travel across to get there? If 2.3, we should count that as 3 instead of 2; hence, Math.ceil\n const nx = (Math.abs(ray.dx / gs));\n const ny = (Math.abs(ray.dy / gs));\n\n // Get the number of straight and diagonal moves\n const nDiagonal = Math.min(nx, ny);\n const nStraight = Math.abs(ny - nx);\n\n // Diagonals in PF pretty much count as 1.5 times a straight\n var distance2 = Math.floor(nDiagonal * 1.5 + nStraight);\n\treturn {distance:distance2, squares:(Math.floor(nDiagonal+nStraight))}\n}\n\n//Account for token size.\nfunction measureDistancePF2(p0, p1){\n const gs = canvas.dimensions.size;\n Cp0x = (Math.floor(p0.hitArea.width/gs) >= 1|| Math.floor(p0.hitArea.height/gs) >= 1) ? p0.center.x : 100*Math.floor(p0.x/100)+50;\n Cp0y = (Math.floor(p0.hitArea.width/gs) >= 1|| Math.floor(p0.hitArea.height/gs) >= 1) ? p0.center.y : 100*Math.floor(p0.y/100)+50;\n Cp1x = (Math.floor(p1.hitArea.width/gs) >= 1|| Math.floor(p1.hitArea.height/gs) >= 1) ? p1.center.x : 100*Math.floor(p1.x/100)+50;\n Cp1y = (Math.floor(p1.hitArea.width/gs) >= 1|| Math.floor(p1.hitArea.height/gs) >= 1) ? p1.center.y : 100*Math.floor(p1.y/100)+50;\n\t const prelimDistance = distanceMeasure({x:Cp0x,y:Cp0y},{x:Cp1x,y:Cp1y});\n\t\tlet distance = prelimDistance.distance;\n\tif(p0 === p1){distance = {distance:0, squares:0};\n }else {\n\t\t\t const diffX0 = Cp0x - Cp1x\n\t\t\t const diffY0 = Cp0y - Cp1y\n\t\t\t const diffX01 = Cp1x - (Cp0x-Math.sign(diffX0)*((p0.hitArea.width/2)-gs/2))\n\t\t\t const diffY01 = Cp1y - (Cp0y-Math.sign(diffY0)*((p0.hitArea.height/2)-gs/2))\n\t\t\t const testF = distanceMeasure({x:Cp0x-(Math.sign(diffX0)*((p0.hitArea.width/2)-gs/2)),y:Cp0y-(Math.sign(diffY0)*((p0.hitArea.height/2)-gs/2))},{x:Cp1x-(Math.sign(diffX01)*((p1.hitArea.width/2)-gs/2)),y:Cp1y-(Math.sign(diffY01)*((p1.hitArea.height/2)-gs/2))})\n\t\t\t distance = testF\n\t\t\t };\n\n\t\t//Finalize things\n\t\tconst distanceOnGrid = {distance:distance.distance * canvas.dimensions.distance, squares:distance.squares};\n return distanceOnGrid;\n }", | |
"icon": "fa-ruler", | |
"isFunction": true, | |
"expression": false, | |
"isNumber": false, | |
"color": "#fbdf2d" | |
} | |
] | |
} | |
], | |
"static": { | |
"displayNameInTooltip": false, | |
"useAccentEverywhere": false, | |
"accentColor": "#a3a3a3", | |
"tokenDispositions": [ | |
"FRIENDLY", | |
"NEUTRAL", | |
"HOSTILE" | |
], | |
"useAccentColorForEverything": false | |
} | |
}, | |
"character": { | |
"items": [ | |
{ | |
"disposition": "FRIENDLY", | |
"items": [] | |
}, | |
{ | |
"disposition": "NEUTRAL", | |
"items": [] | |
}, | |
{ | |
"disposition": "HOSTILE", | |
"items": [] | |
} | |
], | |
"static": { | |
"displayNameInTooltip": false, | |
"useAccentEverywhere": false, | |
"accentColor": "#dc6869", | |
"tokenDispositions": [ | |
"FRIENDLY", | |
"NEUTRAL", | |
"HOSTILE" | |
], | |
"useAccentColorForEverything": false | |
} | |
}, | |
"npc": { | |
"items": [ | |
{ | |
"disposition": "FRIENDLY", | |
"items": [ | |
{ | |
"value": "attributes.ac.value", | |
"icon": "fa-shield-alt", | |
"isFunction": false, | |
"expression": false, | |
"isNumber": false, | |
"color": "#0262b6" | |
}, | |
{ | |
"value": "{<saves.fortitude.value>+10}", | |
"icon": "fa-fist-raised", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#47d758" | |
}, | |
{ | |
"value": "{<saves.reflex.value>+10}", | |
"icon": "fa-running", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#02bb96" | |
}, | |
{ | |
"value": "{<saves.will.value>+10}", | |
"icon": "fa-brain", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#e68f8f" | |
}, | |
{ | |
"value": "{<skills.ath.value>+10}", | |
"icon": "fa-dumbbell", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#e02929" | |
}, | |
{ | |
"value": "{<skills.ste.value>+10}", | |
"icon": "fa-eye-slash", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#b9acb1" | |
}, | |
{ | |
"value": "{<attributes.perception.value>+10}", | |
"icon": "fa-eye", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#b85ee8" | |
}, | |
{ | |
"value": "attributes.speed.value", | |
"icon": "fa-shoe-prints", | |
"isFunction": false, | |
"expression": false, | |
"isNumber": true, | |
"color": "#c04b0c" | |
} | |
] | |
}, | |
{ | |
"disposition": "NEUTRAL", | |
"items": [ | |
{ | |
"value": "attributes.ac.value", | |
"icon": "fa-shield-alt", | |
"isFunction": false, | |
"expression": false, | |
"isNumber": false, | |
"color": "#0262b6" | |
}, | |
{ | |
"value": "{<saves.fortitude.value>+10}", | |
"icon": "fa-fist-raised", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#47d758" | |
}, | |
{ | |
"value": "{<saves.reflex.value>+10}", | |
"icon": "fa-running", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#02bb96" | |
}, | |
{ | |
"value": "{<saves.will.value>+10}", | |
"icon": "fa-brain", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#e68f8f" | |
}, | |
{ | |
"value": "{<skills.ath.value>+10}", | |
"icon": "fa-dumbbell", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#e02929" | |
}, | |
{ | |
"value": "{<skills.ste.value>+10}", | |
"icon": "fa-eye-slash", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#b9acb1" | |
}, | |
{ | |
"value": "{<attributes.perception.value>+10}", | |
"icon": "fa-eye", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#b85ee8" | |
}, | |
{ | |
"value": "attributes.speed.value", | |
"icon": "fa-shoe-prints", | |
"isFunction": false, | |
"expression": false, | |
"isNumber": true, | |
"color": "#c04b0c" | |
} | |
] | |
}, | |
{ | |
"disposition": "HOSTILE", | |
"items": [ | |
{ | |
"value": "attributes.ac.value", | |
"icon": "fa-shield-alt", | |
"isFunction": false, | |
"expression": false, | |
"isNumber": false, | |
"color": "#0262b6" | |
}, | |
{ | |
"value": "{<saves.fortitude.value>+10}", | |
"icon": "fa-fist-raised", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#47d758" | |
}, | |
{ | |
"value": "{<saves.reflex.value>+10}", | |
"icon": "fa-running", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#02bb96" | |
}, | |
{ | |
"value": "{<saves.will.value>+10}", | |
"icon": "fa-brain", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#e68f8f" | |
}, | |
{ | |
"value": "{<skills.ath.value>+10}", | |
"icon": "fa-dumbbell", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#e02929" | |
}, | |
{ | |
"value": "{<skills.ste.value>+10}", | |
"icon": "fa-eye-slash", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#b9acb1" | |
}, | |
{ | |
"value": "{<attributes.perception.value>+10}", | |
"icon": "fa-eye", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#b85ee8" | |
}, | |
{ | |
"value": "attributes.speed.value", | |
"icon": "fa-shoe-prints", | |
"isFunction": false, | |
"expression": false, | |
"isNumber": true, | |
"color": "#c04b0c" | |
} | |
] | |
} | |
], | |
"static": { | |
"displayNameInTooltip": true, | |
"useAccentEverywhere": false, | |
"accentColor": "#c2512e", | |
"tokenDispositions": [ | |
"FRIENDLY", | |
"NEUTRAL", | |
"HOSTILE" | |
], | |
"useAccentColorForEverything": false | |
} | |
}, | |
"hazard": { | |
"items": [ | |
{ | |
"disposition": "FRIENDLY", | |
"items": [] | |
}, | |
{ | |
"disposition": "NEUTRAL", | |
"items": [] | |
}, | |
{ | |
"disposition": "HOSTILE", | |
"items": [] | |
} | |
], | |
"static": { | |
"displayNameInTooltip": true, | |
"accentColor": "#cfcef3", | |
"useAccentColorForEverything": false, | |
"tokenDispositions": [ | |
"FRIENDLY", | |
"NEUTRAL", | |
"HOSTILE" | |
] | |
} | |
}, | |
"loot": { | |
"items": [ | |
{ | |
"disposition": "FRIENDLY", | |
"items": [ | |
{ | |
"value": "let distance = tokenDistance(_token, token);\nreturn \"~\" +Math.ceil(distance) +\" ft\";\n/*\n Total Distance between two tokens.\n*/\nfunction tokenDistance(token1, token2)\n{\n if(!token1 || !token2) return;\n\n let distance = measureDistancePF2(token1, token2);\n if(token1.data.elevation !== token2.data.elevation)\n {\n const gs = canvas.dimensions.size;\n let h_diff = token2.data.elevation > token1.data.elevation\n ? Math.max(token2.data.elevation - Math.max(Math.floor((5*token1.hitArea.width/gs)-5),0) - token1.data.elevation,0)\n : Math.max(token1.data.elevation - Math.max(Math.floor((5*token2.hitArea.width/gs)-5),0) - token2.data.elevation,0);\n\n let tokenA = {x:0, y:0, center:{x:0, y:0}, hitArea:{width:gs, height:gs}}; let tokenB = {x:(distance.squares)*gs, y:(h_diff/5)*gs,center:{x:(distance.squares)*gs, y:(h_diff/5)*gs}, hitArea:{width:gs, height:gs}};\n let distanceAdjusted = measureDistancePF2(tokenA, tokenB)\n return distanceAdjusted.distance//Math.sqrt(Math.pow(h_diff,2) + Math.pow(distance,2));\n }else{\n return distance.distance;\n }\n}\n\n\nfunction distanceMeasure(p0,p1){\n\tconst gs = canvas.dimensions.size;\n const ray = new Ray(p0, p1);\n // How many squares do we travel across to get there? If 2.3, we should count that as 3 instead of 2; hence, Math.ceil\n const nx = (Math.abs(ray.dx / gs));\n const ny = (Math.abs(ray.dy / gs));\n\n // Get the number of straight and diagonal moves\n const nDiagonal = Math.min(nx, ny);\n const nStraight = Math.abs(ny - nx);\n\n // Diagonals in PF pretty much count as 1.5 times a straight\n var distance2 = Math.floor(nDiagonal * 1.5 + nStraight);\n\treturn {distance:distance2, squares:(Math.floor(nDiagonal+nStraight))}\n}\n\n//Account for token size.\nfunction measureDistancePF2(p0, p1){\n const gs = canvas.dimensions.size;\n Cp0x = (Math.floor(p0.hitArea.width/gs) >= 1|| Math.floor(p0.hitArea.height/gs) >= 1) ? p0.center.x : 100*Math.floor(p0.x/100)+50;\n Cp0y = (Math.floor(p0.hitArea.width/gs) >= 1|| Math.floor(p0.hitArea.height/gs) >= 1) ? p0.center.y : 100*Math.floor(p0.y/100)+50;\n Cp1x = (Math.floor(p1.hitArea.width/gs) >= 1|| Math.floor(p1.hitArea.height/gs) >= 1) ? p1.center.x : 100*Math.floor(p1.x/100)+50;\n Cp1y = (Math.floor(p1.hitArea.width/gs) >= 1|| Math.floor(p1.hitArea.height/gs) >= 1) ? p1.center.y : 100*Math.floor(p1.y/100)+50;\n\t const prelimDistance = distanceMeasure({x:Cp0x,y:Cp0y},{x:Cp1x,y:Cp1y});\n\t\tlet distance = prelimDistance.distance;\n\tif(p0 === p1){distance = {distance:0, squares:0};\n }else {\n\t\t\t const diffX0 = Cp0x - Cp1x\n\t\t\t const diffY0 = Cp0y - Cp1y\n\t\t\t const diffX01 = Cp1x - (Cp0x-Math.sign(diffX0)*((p0.hitArea.width/2)-gs/2))\n\t\t\t const diffY01 = Cp1y - (Cp0y-Math.sign(diffY0)*((p0.hitArea.height/2)-gs/2))\n\t\t\t const testF = distanceMeasure({x:Cp0x-(Math.sign(diffX0)*((p0.hitArea.width/2)-gs/2)),y:Cp0y-(Math.sign(diffY0)*((p0.hitArea.height/2)-gs/2))},{x:Cp1x-(Math.sign(diffX01)*((p1.hitArea.width/2)-gs/2)),y:Cp1y-(Math.sign(diffY01)*((p1.hitArea.height/2)-gs/2))})\n\t\t\t distance = testF\n\t\t\t };\n\n\t\t//Finalize things\n\t\tconst distanceOnGrid = {distance:distance.distance * canvas.dimensions.distance, squares:distance.squares};\n return distanceOnGrid;\n }", | |
"icon": "fa-ruler", | |
"isFunction": true, | |
"expression": false, | |
"isNumber": false, | |
"color": "#fbdf2d" | |
} | |
] | |
}, | |
{ | |
"disposition": "NEUTRAL", | |
"items": [ | |
{ | |
"value": "let distance = tokenDistance(_token, token);\nreturn \"~\" +Math.ceil(distance) +\" ft\";\n/*\n Total Distance between two tokens.\n*/\nfunction tokenDistance(token1, token2)\n{\n if(!token1 || !token2) return;\n\n let distance = measureDistancePF2(token1, token2);\n if(token1.data.elevation !== token2.data.elevation)\n {\n const gs = canvas.dimensions.size;\n let h_diff = token2.data.elevation > token1.data.elevation\n ? Math.max(token2.data.elevation - Math.max(Math.floor((5*token1.hitArea.width/gs)-5),0) - token1.data.elevation,0)\n : Math.max(token1.data.elevation - Math.max(Math.floor((5*token2.hitArea.width/gs)-5),0) - token2.data.elevation,0);\n\n let tokenA = {x:0, y:0, center:{x:0, y:0}, hitArea:{width:gs, height:gs}}; let tokenB = {x:(distance.squares)*gs, y:(h_diff/5)*gs,center:{x:(distance.squares)*gs, y:(h_diff/5)*gs}, hitArea:{width:gs, height:gs}};\n let distanceAdjusted = measureDistancePF2(tokenA, tokenB)\n return distanceAdjusted.distance//Math.sqrt(Math.pow(h_diff,2) + Math.pow(distance,2));\n }else{\n return distance.distance;\n }\n}\n\n\nfunction distanceMeasure(p0,p1){\n\tconst gs = canvas.dimensions.size;\n const ray = new Ray(p0, p1);\n // How many squares do we travel across to get there? If 2.3, we should count that as 3 instead of 2; hence, Math.ceil\n const nx = (Math.abs(ray.dx / gs));\n const ny = (Math.abs(ray.dy / gs));\n\n // Get the number of straight and diagonal moves\n const nDiagonal = Math.min(nx, ny);\n const nStraight = Math.abs(ny - nx);\n\n // Diagonals in PF pretty much count as 1.5 times a straight\n var distance2 = Math.floor(nDiagonal * 1.5 + nStraight);\n\treturn {distance:distance2, squares:(Math.floor(nDiagonal+nStraight))}\n}\n\n//Account for token size.\nfunction measureDistancePF2(p0, p1){\n const gs = canvas.dimensions.size;\n Cp0x = (Math.floor(p0.hitArea.width/gs) >= 1|| Math.floor(p0.hitArea.height/gs) >= 1) ? p0.center.x : 100*Math.floor(p0.x/100)+50;\n Cp0y = (Math.floor(p0.hitArea.width/gs) >= 1|| Math.floor(p0.hitArea.height/gs) >= 1) ? p0.center.y : 100*Math.floor(p0.y/100)+50;\n Cp1x = (Math.floor(p1.hitArea.width/gs) >= 1|| Math.floor(p1.hitArea.height/gs) >= 1) ? p1.center.x : 100*Math.floor(p1.x/100)+50;\n Cp1y = (Math.floor(p1.hitArea.width/gs) >= 1|| Math.floor(p1.hitArea.height/gs) >= 1) ? p1.center.y : 100*Math.floor(p1.y/100)+50;\n\t const prelimDistance = distanceMeasure({x:Cp0x,y:Cp0y},{x:Cp1x,y:Cp1y});\n\t\tlet distance = prelimDistance.distance;\n\tif(p0 === p1){distance = {distance:0, squares:0};\n }else {\n\t\t\t const diffX0 = Cp0x - Cp1x\n\t\t\t const diffY0 = Cp0y - Cp1y\n\t\t\t const diffX01 = Cp1x - (Cp0x-Math.sign(diffX0)*((p0.hitArea.width/2)-gs/2))\n\t\t\t const diffY01 = Cp1y - (Cp0y-Math.sign(diffY0)*((p0.hitArea.height/2)-gs/2))\n\t\t\t const testF = distanceMeasure({x:Cp0x-(Math.sign(diffX0)*((p0.hitArea.width/2)-gs/2)),y:Cp0y-(Math.sign(diffY0)*((p0.hitArea.height/2)-gs/2))},{x:Cp1x-(Math.sign(diffX01)*((p1.hitArea.width/2)-gs/2)),y:Cp1y-(Math.sign(diffY01)*((p1.hitArea.height/2)-gs/2))})\n\t\t\t distance = testF\n\t\t\t };\n\n\t\t//Finalize things\n\t\tconst distanceOnGrid = {distance:distance.distance * canvas.dimensions.distance, squares:distance.squares};\n return distanceOnGrid;\n }", | |
"icon": "fa-ruler", | |
"isFunction": true, | |
"expression": false, | |
"isNumber": false, | |
"color": "#fbdf2d" | |
} | |
] | |
}, | |
{ | |
"disposition": "HOSTILE", | |
"items": [ | |
{ | |
"value": "let distance = tokenDistance(_token, token);\nreturn \"~\" +Math.ceil(distance) +\" ft\";\n/*\n Total Distance between two tokens.\n*/\nfunction tokenDistance(token1, token2)\n{\n if(!token1 || !token2) return;\n\n let distance = measureDistancePF2(token1, token2);\n if(token1.data.elevation !== token2.data.elevation)\n {\n const gs = canvas.dimensions.size;\n let h_diff = token2.data.elevation > token1.data.elevation\n ? Math.max(token2.data.elevation - Math.max(Math.floor((5*token1.hitArea.width/gs)-5),0) - token1.data.elevation,0)\n : Math.max(token1.data.elevation - Math.max(Math.floor((5*token2.hitArea.width/gs)-5),0) - token2.data.elevation,0);\n\n let tokenA = {x:0, y:0, center:{x:0, y:0}, hitArea:{width:gs, height:gs}}; let tokenB = {x:(distance.squares)*gs, y:(h_diff/5)*gs,center:{x:(distance.squares)*gs, y:(h_diff/5)*gs}, hitArea:{width:gs, height:gs}};\n let distanceAdjusted = measureDistancePF2(tokenA, tokenB)\n return distanceAdjusted.distance//Math.sqrt(Math.pow(h_diff,2) + Math.pow(distance,2));\n }else{\n return distance.distance;\n }\n}\n\n\nfunction distanceMeasure(p0,p1){\n\tconst gs = canvas.dimensions.size;\n const ray = new Ray(p0, p1);\n // How many squares do we travel across to get there? If 2.3, we should count that as 3 instead of 2; hence, Math.ceil\n const nx = (Math.abs(ray.dx / gs));\n const ny = (Math.abs(ray.dy / gs));\n\n // Get the number of straight and diagonal moves\n const nDiagonal = Math.min(nx, ny);\n const nStraight = Math.abs(ny - nx);\n\n // Diagonals in PF pretty much count as 1.5 times a straight\n var distance2 = Math.floor(nDiagonal * 1.5 + nStraight);\n\treturn {distance:distance2, squares:(Math.floor(nDiagonal+nStraight))}\n}\n\n//Account for token size.\nfunction measureDistancePF2(p0, p1){\n const gs = canvas.dimensions.size;\n Cp0x = (Math.floor(p0.hitArea.width/gs) >= 1|| Math.floor(p0.hitArea.height/gs) >= 1) ? p0.center.x : 100*Math.floor(p0.x/100)+50;\n Cp0y = (Math.floor(p0.hitArea.width/gs) >= 1|| Math.floor(p0.hitArea.height/gs) >= 1) ? p0.center.y : 100*Math.floor(p0.y/100)+50;\n Cp1x = (Math.floor(p1.hitArea.width/gs) >= 1|| Math.floor(p1.hitArea.height/gs) >= 1) ? p1.center.x : 100*Math.floor(p1.x/100)+50;\n Cp1y = (Math.floor(p1.hitArea.width/gs) >= 1|| Math.floor(p1.hitArea.height/gs) >= 1) ? p1.center.y : 100*Math.floor(p1.y/100)+50;\n\t const prelimDistance = distanceMeasure({x:Cp0x,y:Cp0y},{x:Cp1x,y:Cp1y});\n\t\tlet distance = prelimDistance.distance;\n\tif(p0 === p1){distance = {distance:0, squares:0};\n }else {\n\t\t\t const diffX0 = Cp0x - Cp1x\n\t\t\t const diffY0 = Cp0y - Cp1y\n\t\t\t const diffX01 = Cp1x - (Cp0x-Math.sign(diffX0)*((p0.hitArea.width/2)-gs/2))\n\t\t\t const diffY01 = Cp1y - (Cp0y-Math.sign(diffY0)*((p0.hitArea.height/2)-gs/2))\n\t\t\t const testF = distanceMeasure({x:Cp0x-(Math.sign(diffX0)*((p0.hitArea.width/2)-gs/2)),y:Cp0y-(Math.sign(diffY0)*((p0.hitArea.height/2)-gs/2))},{x:Cp1x-(Math.sign(diffX01)*((p1.hitArea.width/2)-gs/2)),y:Cp1y-(Math.sign(diffY01)*((p1.hitArea.height/2)-gs/2))})\n\t\t\t distance = testF\n\t\t\t };\n\n\t\t//Finalize things\n\t\tconst distanceOnGrid = {distance:distance.distance * canvas.dimensions.distance, squares:distance.squares};\n return distanceOnGrid;\n }", | |
"icon": "fa-ruler", | |
"isFunction": true, | |
"expression": false, | |
"isNumber": false, | |
"color": "#fbdf2d" | |
} | |
] | |
} | |
], | |
"static": { | |
"displayNameInTooltip": true, | |
"useAccentEverywhere": false, | |
"accentColor": "#542256", | |
"tokenDispositions": [ | |
"FRIENDLY", | |
"NEUTRAL", | |
"HOSTILE" | |
], | |
"useAccentColorForEverything": false | |
} | |
}, | |
"familiar": { | |
"items": [ | |
{ | |
"disposition": "FRIENDLY", | |
"items": [] | |
}, | |
{ | |
"disposition": "NEUTRAL", | |
"items": [] | |
}, | |
{ | |
"disposition": "HOSTILE", | |
"items": [] | |
} | |
], | |
"static": { | |
"displayNameInTooltip": true, | |
"accentColor": "#7e2dad", | |
"useAccentColorForEverything": false, | |
"tokenDispositions": [ | |
"FRIENDLY", | |
"NEUTRAL", | |
"HOSTILE" | |
] | |
} | |
}, | |
"vehicle": { | |
"items": [ | |
{ | |
"disposition": "FRIENDLY", | |
"items": [] | |
}, | |
{ | |
"disposition": "NEUTRAL", | |
"items": [] | |
}, | |
{ | |
"disposition": "HOSTILE", | |
"items": [] | |
} | |
], | |
"static": { | |
"displayNameInTooltip": true, | |
"accentColor": "#3bc13e", | |
"useAccentColorForEverything": false, | |
"tokenDispositions": [ | |
"FRIENDLY", | |
"NEUTRAL", | |
"HOSTILE" | |
] | |
} | |
} | |
}, | |
"playerSettings": { | |
"default": { | |
"items": [ | |
{ | |
"disposition": "OWNED", | |
"items": [ | |
{ | |
"value": "{hp = <attributes.hp.value>;\n hpm = <attributes.hp.max>;\n concat(string(hp), \"/\", string(hpm))\n}", | |
"icon": "fa-heart", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#d31d1d" | |
}, | |
{ | |
"value": "attributes.ac.value", | |
"icon": "fa-shield-alt", | |
"isFunction": false, | |
"expression": false, | |
"isNumber": false, | |
"color": "#0262b6" | |
}, | |
{ | |
"value": "{concat(string(<attributes.speed.total>), \" ft\")}", | |
"icon": "fa-shoe-prints", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#c04b0c" | |
}, | |
{ | |
"value": "let distance = tokenDistance(_token, token);\nreturn \"~\" +Math.ceil(distance) +\" ft\";\n/*\n Total Distance between two tokens.\n*/\nfunction tokenDistance(token1, token2)\n{\n if(!token1 || !token2) return;\n\n let distance = measureDistancePF2(token1, token2);\n if(token1.elevation !== token2.data.elevation)\n {\n let h_diff = token2.data.elevation > token1.data.elevation\n ? token2.data.elevation - token1.data.elevation\n : token1.data.elevation - token2.data.elevation;\n\n return Math.sqrt(Math.pow(h_diff,2) + Math.pow(distance,2));\n }else{\n return distance;\n }\n}\n\n\nfunction distanceMeasure(p0,p1){\n\tconst gs = canvas.dimensions.size;\n const ray = new Ray(p0, p1);\n // How many squares do we travel across to get there? If 2.3, we should count that as 3 instead of 2; hence, Math.ceil\n const nx = (Math.abs(ray.dx / gs));\n const ny = (Math.abs(ray.dy / gs));\n\n // Get the number of straight and diagonal moves\n const nDiagonal = Math.min(nx, ny);\n const nStraight = Math.abs(ny - nx);\n\n // Diagonals in PF pretty much count as 1.5 times a straight\n var distance = Math.floor(nDiagonal * 1.5 + nStraight);\n\treturn distance\n}\n\n//Account for token size.\nfunction measureDistancePF2(p0, p1){\n const gs = canvas.dimensions.size;\n Cp0x = (Math.floor(p0.hitArea.width/gs) >= 1|| Math.floor(p0.hitArea.height/gs) >= 1) ? p0.center.x : 100*Math.floor(p0.x/100)+50;\n Cp0y = (Math.floor(p0.hitArea.width/gs) >= 1|| Math.floor(p0.hitArea.height/gs) >= 1) ? p0.center.y : 100*Math.floor(p0.y/100)+50;\n Cp1x = (Math.floor(p1.hitArea.width/gs) >= 1|| Math.floor(p1.hitArea.height/gs) >= 1) ? p1.center.x : 100*Math.floor(p1.x/100)+50;\n Cp1y = (Math.floor(p1.hitArea.width/gs) >= 1|| Math.floor(p1.hitArea.height/gs) >= 1) ? p1.center.y : 100*Math.floor(p1.y/100)+50;\n\t const prelimDistance = distanceMeasure({x:Cp0x,y:Cp0y},{x:Cp1x,y:Cp1y});\n\t\tlet distance = prelimDistance;\n\tif(p0 === p1){distance = 0;\n }else {\n\t\t\t const diffX0 = Cp0x - Cp1x\n\t\t\t const diffY0 = Cp0y - Cp1y\n\t\t\t const diffX01 = Cp1x - (Cp0x-Math.sign(diffX0)*((p0.hitArea.width/2)-gs/2))\n\t\t\t const diffY01 = Cp1y - (Cp0y-Math.sign(diffY0)*((p0.hitArea.height/2)-gs/2))\n\t\t\t const testF = distanceMeasure({x:Cp0x-(Math.sign(diffX0)*((p0.hitArea.width/2)-gs/2)),y:Cp0y-(Math.sign(diffY0)*((p0.hitArea.height/2)-gs/2))},{x:Cp1x-(Math.sign(diffX01)*((p1.hitArea.width/2)-gs/2)),y:Cp1y-(Math.sign(diffY01)*((p1.hitArea.height/2)-gs/2))})\n\t\t\t distance = testF;\n\t\t\t };\n\n\t\t//Finalize things\n\t\tconst distanceOnGrid = distance * canvas.dimensions.distance;\n return distanceOnGrid;\n }", | |
"icon": "fa-ruler", | |
"isFunction": true, | |
"expression": false, | |
"isNumber": false, | |
"color": "#fbdf2d" | |
} | |
] | |
}, | |
{ | |
"disposition": "FRIENDLY", | |
"items": [ | |
{ | |
"value": "{\nhp=<attributes.hp.value>;\nhpm=<attributes.hp.max>;\nhp <= 0 ? \"❌\" : hp == 1 & hpm > 1 ? \"♡♡♡♡\" : hp == 69 ? \"Nice\" : hp < hpm*0.25 ? \"❤♡♡♡\" : hp < hpm*0.5 ? \"❤❤♡♡\" : hp < hpm*0.75 ? \"❤❤❤♡\" : \"❤❤❤❤\"\n}", | |
"icon": "fa-heart", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#d31d1d" | |
}, | |
{ | |
"value": "let distance = tokenDistance(_token, token);\nreturn \"~\" +Math.ceil(distance) +\" ft\";\n/*\n Total Distance between two tokens.\n*/\nfunction tokenDistance(token1, token2)\n{\n if(!token1 || !token2) return;\n\n let distance = measureDistancePF2(token1, token2);\n if(token1.data.elevation !== token2.data.elevation)\n {\n const gs = canvas.dimensions.size;\n let h_diff = token2.data.elevation > token1.data.elevation\n ? Math.max(token2.data.elevation - Math.max(Math.floor((5*token1.hitArea.width/gs)-5),0) - token1.data.elevation,0)\n : Math.max(token1.data.elevation - Math.max(Math.floor((5*token2.hitArea.width/gs)-5),0) - token2.data.elevation,0);\n\n let tokenA = {x:0, y:0, center:{x:0, y:0}, hitArea:{width:gs, height:gs}}; let tokenB = {x:(distance.squares)*gs, y:(h_diff/5)*gs,center:{x:(distance.squares)*gs, y:(h_diff/5)*gs}, hitArea:{width:gs, height:gs}};\n let distanceAdjusted = measureDistancePF2(tokenA, tokenB)\n return distanceAdjusted.distance//Math.sqrt(Math.pow(h_diff,2) + Math.pow(distance,2));\n }else{\n return distance.distance;\n }\n}\n\n\nfunction distanceMeasure(p0,p1){\n\tconst gs = canvas.dimensions.size;\n const ray = new Ray(p0, p1);\n // How many squares do we travel across to get there? If 2.3, we should count that as 3 instead of 2; hence, Math.ceil\n const nx = (Math.abs(ray.dx / gs));\n const ny = (Math.abs(ray.dy / gs));\n\n // Get the number of straight and diagonal moves\n const nDiagonal = Math.min(nx, ny);\n const nStraight = Math.abs(ny - nx);\n\n // Diagonals in PF pretty much count as 1.5 times a straight\n var distance2 = Math.floor(nDiagonal * 1.5 + nStraight);\n\treturn {distance:distance2, squares:(Math.floor(nDiagonal+nStraight))}\n}\n\n//Account for token size.\nfunction measureDistancePF2(p0, p1){\n const gs = canvas.dimensions.size;\n Cp0x = (Math.floor(p0.hitArea.width/gs) >= 1|| Math.floor(p0.hitArea.height/gs) >= 1) ? p0.center.x : 100*Math.floor(p0.x/100)+50;\n Cp0y = (Math.floor(p0.hitArea.width/gs) >= 1|| Math.floor(p0.hitArea.height/gs) >= 1) ? p0.center.y : 100*Math.floor(p0.y/100)+50;\n Cp1x = (Math.floor(p1.hitArea.width/gs) >= 1|| Math.floor(p1.hitArea.height/gs) >= 1) ? p1.center.x : 100*Math.floor(p1.x/100)+50;\n Cp1y = (Math.floor(p1.hitArea.width/gs) >= 1|| Math.floor(p1.hitArea.height/gs) >= 1) ? p1.center.y : 100*Math.floor(p1.y/100)+50;\n\t const prelimDistance = distanceMeasure({x:Cp0x,y:Cp0y},{x:Cp1x,y:Cp1y});\n\t\tlet distance = prelimDistance.distance;\n\tif(p0 === p1){distance = {distance:0, squares:0};\n }else {\n\t\t\t const diffX0 = Cp0x - Cp1x\n\t\t\t const diffY0 = Cp0y - Cp1y\n\t\t\t const diffX01 = Cp1x - (Cp0x-Math.sign(diffX0)*((p0.hitArea.width/2)-gs/2))\n\t\t\t const diffY01 = Cp1y - (Cp0y-Math.sign(diffY0)*((p0.hitArea.height/2)-gs/2))\n\t\t\t const testF = distanceMeasure({x:Cp0x-(Math.sign(diffX0)*((p0.hitArea.width/2)-gs/2)),y:Cp0y-(Math.sign(diffY0)*((p0.hitArea.height/2)-gs/2))},{x:Cp1x-(Math.sign(diffX01)*((p1.hitArea.width/2)-gs/2)),y:Cp1y-(Math.sign(diffY01)*((p1.hitArea.height/2)-gs/2))})\n\t\t\t distance = testF\n\t\t\t };\n\n\t\t//Finalize things\n\t\tconst distanceOnGrid = {distance:distance.distance * canvas.dimensions.distance, squares:distance.squares};\n return distanceOnGrid;\n }", | |
"icon": "fa-ruler", | |
"isFunction": true, | |
"expression": false, | |
"isNumber": false, | |
"color": "#fbdf2d" | |
} | |
] | |
}, | |
{ | |
"disposition": "NEUTRAL", | |
"items": [ | |
{ | |
"value": "{\nhp=<attributes.hp.value>;\nhpm=<attributes.hp.max>;\nhp <= 0 ? \"❌\" : hp == 1 & hpm > 1 ? \"♡♡♡♡\" : hp == 69 ? \"Nice\" : hp < hpm*0.25 ? \"❤♡♡♡\" : hp < hpm*0.5 ? \"❤❤♡♡\" : hp < hpm*0.75 ? \"❤❤❤♡\" : \"❤❤❤❤\"\n}", | |
"icon": "fa-heart", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#d31d1d" | |
}, | |
{ | |
"value": "let distance = tokenDistance(_token, token);\nreturn \"~\" +Math.ceil(distance) +\" ft\";\n/*\n Total Distance between two tokens.\n*/\nfunction tokenDistance(token1, token2)\n{\n if(!token1 || !token2) return;\n\n let distance = measureDistancePF2(token1, token2);\n if(token1.data.elevation !== token2.data.elevation)\n {\n const gs = canvas.dimensions.size;\n let h_diff = token2.data.elevation > token1.data.elevation\n ? Math.max(token2.data.elevation - Math.max(Math.floor((5*token1.hitArea.width/gs)-5),0) - token1.data.elevation,0)\n : Math.max(token1.data.elevation - Math.max(Math.floor((5*token2.hitArea.width/gs)-5),0) - token2.data.elevation,0);\n\n let tokenA = {x:0, y:0, center:{x:0, y:0}, hitArea:{width:gs, height:gs}}; let tokenB = {x:(distance.squares)*gs, y:(h_diff/5)*gs,center:{x:(distance.squares)*gs, y:(h_diff/5)*gs}, hitArea:{width:gs, height:gs}};\n let distanceAdjusted = measureDistancePF2(tokenA, tokenB)\n return distanceAdjusted.distance//Math.sqrt(Math.pow(h_diff,2) + Math.pow(distance,2));\n }else{\n return distance.distance;\n }\n}\n\n\nfunction distanceMeasure(p0,p1){\n\tconst gs = canvas.dimensions.size;\n const ray = new Ray(p0, p1);\n // How many squares do we travel across to get there? If 2.3, we should count that as 3 instead of 2; hence, Math.ceil\n const nx = (Math.abs(ray.dx / gs));\n const ny = (Math.abs(ray.dy / gs));\n\n // Get the number of straight and diagonal moves\n const nDiagonal = Math.min(nx, ny);\n const nStraight = Math.abs(ny - nx);\n\n // Diagonals in PF pretty much count as 1.5 times a straight\n var distance2 = Math.floor(nDiagonal * 1.5 + nStraight);\n\treturn {distance:distance2, squares:(Math.floor(nDiagonal+nStraight))}\n}\n\n//Account for token size.\nfunction measureDistancePF2(p0, p1){\n const gs = canvas.dimensions.size;\n Cp0x = (Math.floor(p0.hitArea.width/gs) >= 1|| Math.floor(p0.hitArea.height/gs) >= 1) ? p0.center.x : 100*Math.floor(p0.x/100)+50;\n Cp0y = (Math.floor(p0.hitArea.width/gs) >= 1|| Math.floor(p0.hitArea.height/gs) >= 1) ? p0.center.y : 100*Math.floor(p0.y/100)+50;\n Cp1x = (Math.floor(p1.hitArea.width/gs) >= 1|| Math.floor(p1.hitArea.height/gs) >= 1) ? p1.center.x : 100*Math.floor(p1.x/100)+50;\n Cp1y = (Math.floor(p1.hitArea.width/gs) >= 1|| Math.floor(p1.hitArea.height/gs) >= 1) ? p1.center.y : 100*Math.floor(p1.y/100)+50;\n\t const prelimDistance = distanceMeasure({x:Cp0x,y:Cp0y},{x:Cp1x,y:Cp1y});\n\t\tlet distance = prelimDistance.distance;\n\tif(p0 === p1){distance = {distance:0, squares:0};\n }else {\n\t\t\t const diffX0 = Cp0x - Cp1x\n\t\t\t const diffY0 = Cp0y - Cp1y\n\t\t\t const diffX01 = Cp1x - (Cp0x-Math.sign(diffX0)*((p0.hitArea.width/2)-gs/2))\n\t\t\t const diffY01 = Cp1y - (Cp0y-Math.sign(diffY0)*((p0.hitArea.height/2)-gs/2))\n\t\t\t const testF = distanceMeasure({x:Cp0x-(Math.sign(diffX0)*((p0.hitArea.width/2)-gs/2)),y:Cp0y-(Math.sign(diffY0)*((p0.hitArea.height/2)-gs/2))},{x:Cp1x-(Math.sign(diffX01)*((p1.hitArea.width/2)-gs/2)),y:Cp1y-(Math.sign(diffY01)*((p1.hitArea.height/2)-gs/2))})\n\t\t\t distance = testF\n\t\t\t };\n\n\t\t//Finalize things\n\t\tconst distanceOnGrid = {distance:distance.distance * canvas.dimensions.distance, squares:distance.squares};\n return distanceOnGrid;\n }", | |
"icon": "fa-ruler", | |
"isFunction": true, | |
"expression": false, | |
"isNumber": false, | |
"color": "#fbdf2d" | |
} | |
] | |
}, | |
{ | |
"disposition": "HOSTILE", | |
"items": [ | |
{ | |
"value": "{\nhp=<attributes.hp.value>;\nhpm=<attributes.hp.max>;\nhp <= 0 ? \"❌\" : hp == 1 & hpm > 1 ? \"♡♡♡♡\" : hp == 69 ? \"Nice\" : hp < hpm*0.25 ? \"❤♡♡♡\" : hp < hpm*0.5 ? \"❤❤♡♡\" : hp < hpm*0.75 ? \"❤❤❤♡\" : \"❤❤❤❤\"\n}", | |
"icon": "fa-heart", | |
"isFunction": false, | |
"expression": true, | |
"isNumber": false, | |
"color": "#d31d1d" | |
}, | |
{ | |
"value": "let distance = tokenDistance(_token, token);\nreturn \"~\" +Math.ceil(distance) +\" ft\";\n/*\n Total Distance between two tokens.\n*/\nfunction tokenDistance(token1, token2)\n{\n if(!token1 || !token2) return;\n\n let distance = measureDistancePF2(token1, token2);\n if(token1.data.elevation !== token2.data.elevation)\n {\n const gs = canvas.dimensions.size;\n let h_diff = token2.data.elevation > token1.data.elevation\n ? Math.max(token2.data.elevation - Math.max(Math.floor((5*token1.hitArea.width/gs)-5),0) - token1.data.elevation,0)\n : Math.max(token1.data.elevation - Math.max(Math.floor((5*token2.hitArea.width/gs)-5),0) - token2.data.elevation,0);\n\n let tokenA = {x:0, y:0, center:{x:0, y:0}, hitArea:{width:gs, height:gs}}; let tokenB = {x:(distance.squares)*gs, y:(h_diff/5)*gs,center:{x:(distance.squares)*gs, y:(h_diff/5)*gs}, hitArea:{width:gs, height:gs}};\n let distanceAdjusted = measureDistancePF2(tokenA, tokenB)\n return distanceAdjusted.distance//Math.sqrt(Math.pow(h_diff,2) + Math.pow(distance,2));\n }else{\n return distance.distance;\n }\n}\n\n\nfunction distanceMeasure(p0,p1){\n\tconst gs = canvas.dimensions.size;\n const ray = new Ray(p0, p1);\n // How many squares do we travel across to get there? If 2.3, we should count that as 3 instead of 2; hence, Math.ceil\n const nx = (Math.abs(ray.dx / gs));\n const ny = (Math.abs(ray.dy / gs));\n\n // Get the number of straight and diagonal moves\n const nDiagonal = Math.min(nx, ny);\n const nStraight = Math.abs(ny - nx);\n\n // Diagonals in PF pretty much count as 1.5 times a straight\n var distance2 = Math.floor(nDiagonal * 1.5 + nStraight);\n\treturn {distance:distance2, squares:(Math.floor(nDiagonal+nStraight))}\n}\n\n//Account for token size.\nfunction measureDistancePF2(p0, p1){\n const gs = canvas.dimensions.size;\n Cp0x = (Math.floor(p0.hitArea.width/gs) >= 1|| Math.floor(p0.hitArea.height/gs) >= 1) ? p0.center.x : 100*Math.floor(p0.x/100)+50;\n Cp0y = (Math.floor(p0.hitArea.width/gs) >= 1|| Math.floor(p0.hitArea.height/gs) >= 1) ? p0.center.y : 100*Math.floor(p0.y/100)+50;\n Cp1x = (Math.floor(p1.hitArea.width/gs) >= 1|| Math.floor(p1.hitArea.height/gs) >= 1) ? p1.center.x : 100*Math.floor(p1.x/100)+50;\n Cp1y = (Math.floor(p1.hitArea.width/gs) >= 1|| Math.floor(p1.hitArea.height/gs) >= 1) ? p1.center.y : 100*Math.floor(p1.y/100)+50;\n\t const prelimDistance = distanceMeasure({x:Cp0x,y:Cp0y},{x:Cp1x,y:Cp1y});\n\t\tlet distance = prelimDistance.distance;\n\tif(p0 === p1){distance = {distance:0, squares:0};\n }else {\n\t\t\t const diffX0 = Cp0x - Cp1x\n\t\t\t const diffY0 = Cp0y - Cp1y\n\t\t\t const diffX01 = Cp1x - (Cp0x-Math.sign(diffX0)*((p0.hitArea.width/2)-gs/2))\n\t\t\t const diffY01 = Cp1y - (Cp0y-Math.sign(diffY0)*((p0.hitArea.height/2)-gs/2))\n\t\t\t const testF = distanceMeasure({x:Cp0x-(Math.sign(diffX0)*((p0.hitArea.width/2)-gs/2)),y:Cp0y-(Math.sign(diffY0)*((p0.hitArea.height/2)-gs/2))},{x:Cp1x-(Math.sign(diffX01)*((p1.hitArea.width/2)-gs/2)),y:Cp1y-(Math.sign(diffY01)*((p1.hitArea.height/2)-gs/2))})\n\t\t\t distance = testF\n\t\t\t };\n\n\t\t//Finalize things\n\t\tconst distanceOnGrid = {distance:distance.distance * canvas.dimensions.distance, squares:distance.squares};\n return distanceOnGrid;\n }", | |
"icon": "fa-ruler", | |
"isFunction": true, | |
"expression": false, | |
"isNumber": false, | |
"color": "#fbdf2d" | |
} | |
] | |
} | |
], | |
"static": { | |
"displayNameInTooltip": "NONE", | |
"useAccentEverywhere": false, | |
"accentColor": "#a3a3a3", | |
"tokenDispositions": [ | |
"OWNED", | |
"FRIENDLY", | |
"NEUTRAL", | |
"HOSTILE" | |
], | |
"useAccentColorForEverything": false | |
} | |
}, | |
"character": { | |
"items": [ | |
{ | |
"disposition": "OWNED", | |
"items": [] | |
}, | |
{ | |
"disposition": "FRIENDLY", | |
"items": [] | |
}, | |
{ | |
"disposition": "NEUTRAL", | |
"items": [] | |
}, | |
{ | |
"disposition": "HOSTILE", | |
"items": [] | |
} | |
], | |
"static": { | |
"displayNameInTooltip": "FRIENDLY", | |
"useAccentEverywhere": false, | |
"accentColor": "#73c320", | |
"tokenDispositions": [ | |
"OWNED", | |
"FRIENDLY", | |
"NEUTRAL", | |
"HOSTILE" | |
], | |
"useAccentColorForEverything": false | |
} | |
}, | |
"npc": { | |
"items": [ | |
{ | |
"disposition": "OWNED", | |
"items": [] | |
}, | |
{ | |
"disposition": "FRIENDLY", | |
"items": [] | |
}, | |
{ | |
"disposition": "NEUTRAL", | |
"items": [] | |
}, | |
{ | |
"disposition": "HOSTILE", | |
"items": [] | |
} | |
], | |
"static": { | |
"displayNameInTooltip": "FRIENDLY", | |
"useAccentEverywhere": false, | |
"accentColor": "#000000", | |
"tokenDispositions": [ | |
"OWNED", | |
"FRIENDLY", | |
"NEUTRAL", | |
"HOSTILE" | |
], | |
"useAccentColorForEverything": false | |
} | |
}, | |
"hazard": { | |
"items": [ | |
{ | |
"disposition": "OWNED", | |
"items": [] | |
}, | |
{ | |
"disposition": "FRIENDLY", | |
"items": [] | |
}, | |
{ | |
"disposition": "NEUTRAL", | |
"items": [] | |
}, | |
{ | |
"disposition": "HOSTILE", | |
"items": [] | |
} | |
], | |
"static": { | |
"displayNameInTooltip": "FRIENDLY", | |
"accentColor": "#159833", | |
"useAccentColorForEverything": false, | |
"tokenDispositions": [ | |
"OWNED", | |
"FRIENDLY", | |
"NEUTRAL", | |
"HOSTILE" | |
] | |
} | |
}, | |
"loot": { | |
"items": [ | |
{ | |
"disposition": "OWNED", | |
"items": [] | |
}, | |
{ | |
"disposition": "FRIENDLY", | |
"items": [] | |
}, | |
{ | |
"disposition": "NEUTRAL", | |
"items": [] | |
}, | |
{ | |
"disposition": "HOSTILE", | |
"items": [] | |
} | |
], | |
"static": { | |
"displayNameInTooltip": "FRIENDLY", | |
"useAccentEverywhere": false, | |
"accentColor": "#e26c4e", | |
"tokenDispositions": [ | |
"OWNED", | |
"FRIENDLY", | |
"NEUTRAL", | |
"HOSTILE" | |
], | |
"useAccentColorForEverything": false | |
} | |
}, | |
"familiar": { | |
"items": [ | |
{ | |
"disposition": "OWNED", | |
"items": [] | |
}, | |
{ | |
"disposition": "FRIENDLY", | |
"items": [] | |
}, | |
{ | |
"disposition": "NEUTRAL", | |
"items": [] | |
}, | |
{ | |
"disposition": "HOSTILE", | |
"items": [] | |
} | |
], | |
"static": { | |
"displayNameInTooltip": "FRIENDLY", | |
"accentColor": "#3d2711", | |
"useAccentColorForEverything": false, | |
"tokenDispositions": [ | |
"OWNED", | |
"FRIENDLY", | |
"NEUTRAL", | |
"HOSTILE" | |
] | |
} | |
}, | |
"vehicle": { | |
"items": [ | |
{ | |
"disposition": "OWNED", | |
"items": [] | |
}, | |
{ | |
"disposition": "FRIENDLY", | |
"items": [] | |
}, | |
{ | |
"disposition": "NEUTRAL", | |
"items": [] | |
}, | |
{ | |
"disposition": "HOSTILE", | |
"items": [] | |
} | |
], | |
"static": { | |
"displayNameInTooltip": "FRIENDLY", | |
"accentColor": "#b2266", | |
"useAccentColorForEverything": false, | |
"tokenDispositions": [ | |
"OWNED", | |
"FRIENDLY", | |
"NEUTRAL", | |
"HOSTILE" | |
] | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment