Skip to content

Commit

Permalink
Fixed precreatetoken hook for different systems
Browse files Browse the repository at this point in the history
* Fixed precreatetoken to work on different systems in 0.8.7
  • Loading branch information
javieros105 committed Jun 18, 2021
1 parent 467495a commit e08771e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
Binary file modified token-hud-wildcard.zip
Binary file not shown.
7 changes: 3 additions & 4 deletions token-hud-wildcard/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ const WildcardDefault = {
return flag
},
_hookPreTokenCreate () {
Hooks.on('preCreateToken', (scene, data, options, userId) => {
const actor = game.actors.get(data.actorId)

Hooks.on('preCreateToken', (token, data, options, userId) => {
const actor = token.actor
const defaultValue = data.flags['token-hud-wildcard'] ? data.flags['token-hud-wildcard'].default : ''
if (defaultValue !== '' && actor?.data.token.randomImg) {
setProperty(data, 'img', defaultValue)
token.data.update({img:defaultValue});
}
})
},
Expand Down
4 changes: 2 additions & 2 deletions token-hud-wildcard/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "token-hud-wildcard",
"title": "Token HUD Wildcard",
"description": "This module adds a button to the Token HUD if the token has wildcard set and detects more than 1 image to choose from. Pressing the button displays a panel on the right side of the HUD with buttons for each image, pressing one of these allows to change the token image.",
"version": "1.3.0",
"version": "1.3.1",
"minimumCoreVersion": "0.6.0",
"compatibleCoreVersion": "0.8.6",
"compatibleCoreVersion": "0.8.7",
"author": "Javieros",
"scripts": ["main.js"],
"styles": ["./css/token-hud-wildcard.css"],
Expand Down

0 comments on commit e08771e

Please sign in to comment.