Skip to content

Commit

Permalink
Merge pull request #33 from gambit07/patch-1
Browse files Browse the repository at this point in the history
Update module.js
  • Loading branch information
Haxxer authored Jun 14, 2024
2 parents d4badb2 + 664aa9d commit 4a27aea
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions scripts/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ class TaggerHandler {
static applyUpdateTags(inDocument, updateData) {
let propertyName = CONSTANTS.TAG_PROPERTY;
if (inDocument instanceof Actor) propertyName = "prototypeToken." + propertyName;
let tags = getProperty(updateData, propertyName);
let tags = foundry.utils.getProperty(updateData, propertyName);
if(tags === undefined) return;
if(!tags?.length){
propertyName = propertyName.replace(CONSTANTS.TAG_PROPERTY, CONSTANTS.REMOVE_TAG_PROPERTY);
Expand All @@ -646,21 +646,21 @@ class TaggerHandler {
temporaryIds = {};
this.applyCreateTags(documentData);
temporaryIds = {};
const flags = getProperty(documentData, "flags");
const flags = foundry.utils.getProperty(documentData, "flags");
return inDocument?.updateSource
? inDocument.updateSource({ flags })
: inDocument.data.update({ flags });
}

static applyCreateTags(documentData) {

const preprocessed = getProperty(documentData, `${CONSTANTS.DATA_PROPERTY}.preprocessed`);
const preprocessed = foundry.utils.getProperty(documentData, `${CONSTANTS.DATA_PROPERTY}.preprocessed`);
if (preprocessed) {
setProperty(documentData, `${CONSTANTS.DATA_PROPERTY}.preprocessed`, false);
return;
}

let tags = getProperty(documentData, CONSTANTS.TAG_PROPERTY);
let tags = foundry.utils.getProperty(documentData, CONSTANTS.TAG_PROPERTY);

if (tags) {
tags = this.applyRules(tags);
Expand All @@ -677,7 +677,7 @@ class TaggerHandler {
const ids = ["location.id", "entity.id"];
monkActions.forEach((action, i) => {
for (const nameProperty of names) {
let locationName = getProperty(action?.data, nameProperty);
let locationName = foundry.utils.getProperty(action?.data, nameProperty);
if (locationName && locationName.startsWith("[Tagger] ")) {
const tags = locationName.replace("[Tagger] ", "");
const newTags = this.applyRules(tags).join(", ");
Expand All @@ -686,7 +686,7 @@ class TaggerHandler {
}

for (const idProperty of ids) {
let locationId = getProperty(action?.data, idProperty);
let locationId = foundry.utils.getProperty(action?.data, idProperty);
if (locationId && locationId.startsWith("tagger:")) {
const tags = locationId.replace("tagger:", "");
const newTags = this.applyRules(tags).join(", ");
Expand All @@ -703,7 +703,7 @@ class TaggerHandler {
setProperty(documentData, `flags.monks-active-tiles.entity`, monkEntity);
reparse = true;
}
let entityId = getProperty(monkEntity, "id");
let entityId = foundry.utils.getProperty(monkEntity, "id");
if (entityId && entityId.startsWith("tagger:")) {
const tags = entityId.replace("tagger:", "");
const newTags = this.applyRules(tags).join(", ");
Expand All @@ -719,7 +719,7 @@ class TaggerHandler {
}

static recurseTokenAttacher(documentData) {
const prototypeAttached = getProperty(documentData, "flags.token-attacher.prototypeAttached");
const prototypeAttached = foundry.utils.getProperty(documentData, "flags.token-attacher.prototypeAttached");
if (prototypeAttached) {
for (const objects of Object.values(prototypeAttached)) {
for (const object of objects) {
Expand Down

0 comments on commit 4a27aea

Please sign in to comment.