Skip to content

Commit 860d6e3

Browse files
committed
Version bump
- fixed string and boolean evaluators within mappings not behaving correctly #217 - added right click listener for PF1e item sheets #216
1 parent e3edfb8 commit 860d6e3

4 files changed

Lines changed: 25 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 6.0.6
2+
3+
- Fixed string and boolean evaluators within mappings not behaving correctly (#217)
4+
- Added Art Select Right-click listener for PF1e item sheet images (#216)
5+
16
# 6.0.5
27

38
- Fixed a bug causing unresponsive Token HUD button

token-variants/module.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
"id": "token-variants",
33
"title": "Token Variant Art",
44
"description": "Searches a customizable list of directories and displays art variants for tokens/actors through pop-ups and a new Token HUD button. Variants can be individually shared with players allowing them to switch out their token art on the fly.",
5-
"version": "6.0.5",
5+
"version": "6.0.6",
66
"compatibility": {
77
"minimum": 13,
88
"verified": 13
99
},
10-
"download": "https://github.com/Aedif/TokenVariants/releases/download/6.0.5/token-variants.zip",
10+
"download": "https://github.com/Aedif/TokenVariants/releases/download/6.0.6/token-variants.zip",
1111
"url": "https://github.com/Aedif/TokenVariants",
1212
"manifest": "https://raw.githubusercontent.com/Aedif/TokenVariants/master/token-variants/module.json",
1313
"authors": [

token-variants/scripts/hooks/artSelectButtonHooks.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ export function registerArtSelectButtonHooks() {
1010
// Insert right-click listeners to open up ArtSelect forms from various contexts
1111
if (TVA_CONFIG.permissions.portrait_right_click[game.user.role]) {
1212
registerHook(feature_id, 'renderActorSheet', _modActorSheet);
13-
registerHook(feature_id, 'renderItemSheet5e', _modItemSheet);
13+
if (game.system.id === 'dnd5e') registerHook(feature_id, 'renderItemSheet5e', _modItemSheet);
1414
registerHook(feature_id, 'renderItemActionSheet', _modItemSheet);
15+
if (game.system.id === 'pf1') registerHook(feature_id, 'renderItemSheetPF', _modItemSheetPF);
1516
registerHook(feature_id, 'renderJournalSheet', _modJournalSheet);
1617
} else {
1718
['renderActorSheet', 'renderItemSheet5e', 'renderItemActionSheet', 'renderJournalSheet'].forEach((name) =>
@@ -118,6 +119,17 @@ function _modItemSheet(itemSheet, html, options) {
118119
});
119120
}
120121

122+
function _modItemSheetPF(itemSheet, html, options) {
123+
html[0]?.querySelector('.profile')?.addEventListener('contextmenu', () => {
124+
const item = itemSheet.document;
125+
if (!item) return;
126+
showArtSelect(item.name, {
127+
searchType: SEARCH_TYPE.ITEM,
128+
callback: (imgSrc) => item.update({ img: imgSrc }),
129+
});
130+
});
131+
}
132+
121133
function _modMacroConfig(macroConfig, html, options) {
122134
const img = html.querySelector('.sheet-header > img');
123135
img?.addEventListener('contextmenu', () => {

token-variants/scripts/hooks/effectMappingHooks.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -863,9 +863,9 @@ function getPropertyValue(token, property) {
863863

864864
if (property.startsWith('"') && property.endsWith('"')) {
865865
val = property.substring(1, property.length - 1);
866-
if (val === 'true') val = true;
867-
else if (val === 'false') val = true;
868-
return { val, boolean: true };
866+
if (val === 'true') return { val: true, boolean: true };
867+
else if (val === 'false') return { val: false, boolean: true };
868+
return { val };
869869
} else if (property.endsWith('%')) {
870870
val = Number(property.substring(0, property.length - 1));
871871
return { val, percentage: true };
@@ -903,8 +903,8 @@ export function evaluateComparator(token, expression) {
903903

904904
if (val1.percentage) val2.val = (val2.val / val2.maxVal) * 100;
905905
else if (val2.percentage) val1.val = (val1.val / val1.maxVal) * 100;
906-
else if (val1.boolean) val2.val = foundry.utils.isEmpty(val2.val) ? false : Boolean(val2.val);
907-
else if (val2.boolean) val1.val = foundry.utils.isEmpty(val1.val) ? false : Boolean(val1.val);
906+
else if (val1.boolean && !val2.boolean) val2.val = foundry.utils.isEmpty(val2.val) ? false : Boolean(val2.val);
907+
else if (val2.boolean && !val1.boolean) val1.val = foundry.utils.isEmpty(val1.val) ? false : Boolean(val1.val);
908908

909909
let passed = false;
910910
if (sign === '=') {

0 commit comments

Comments
 (0)