Skip to content

Commit

Permalink
Merge pull request #139 from Moerill/2.15.3
Browse files Browse the repository at this point in the history
2.15.3
  • Loading branch information
Geekswordsman authored Sep 13, 2022
2 parents a6f4a19 + 79e6600 commit a9fb39b
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# v2.15.3
- Corrected an issue where a conflict with certain game systems such as PF2E and a core Foundry v10 method that Token Mold utilizes could cause an infinite recursion error. ( Issue #138)
- Corrected an issue where overlays may not get displayed due in Foundry v10 due to deprecated data retrieval methods ( Issue #137 )
- Added a new option to enable or disable the overlay for Linked Tokens ( Issue # 134 )

# v2.15.2
- ***IMPORTANT*** Token Mold no longer supports v8 of Foundry.
- FoundryVTT v10 Compatibility Update!
Expand Down
3 changes: 3 additions & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"tmold.config.applySettings": "Apply settings to",
"tmold.config.unlinkedOnly": "unlinked tokens only",

"tmold.config.enableOverlayFor": "Enable Overlay for",
"tmold.config.linkedTokens": "linked tokens",

"tmold.tab.infoHelp": "Info/Help",
"tmold.tab.name": "Name",
"tmold.tab.systemSpecific": "System Specific",
Expand Down
4 changes: 2 additions & 2 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"url": "https://github.com/Moerill/token-mold",
"bugs": "https://github.com/Moerill/token-mold/issues",
"flags": {},
"version": "2.15.2",
"version": "2.15.3",
"minimumCoreVersion": "9",
"compatibleCoreVersion": "10",
"compatibility": {
Expand Down Expand Up @@ -67,7 +67,7 @@
"dependencies": [],
"socket": false,
"manifest": "https://raw.githubusercontent.com/Moerill/token-mold/master/module.json",
"download": "https://github.com/Moerill/token-mold/releases/download/v2.15.2/v2.15.2.zip",
"download": "https://github.com/Moerill/token-mold/releases/download/v2.15.3/v2.15.3.zip",
"protected": false,
"coreTranslation": false
}
17 changes: 10 additions & 7 deletions scripts/token-mold.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ export default class TokenMold {

if (
canvas.hud.TokenMold === undefined ||
this.data.overlay.attrs.length === 0
this.data.overlay.attrs.length === 0 ||
(token.document.actorLink && !this.data.enableOverlayForLinked)
)
return;

Expand Down Expand Up @@ -923,16 +924,17 @@ export default class TokenMold {
}

async _getBarAttributes() {
const types = CONFIG.Actor.documentClass.metadata.types;
const types = TokenMold.FOUNDRY_VERSION >= 10 ? CONFIG.Actor.documentClass.TYPES : CONFIG.Actor.documentClass.metadata.types;
let barData = { bar: {}, value: {} };
let addElement = (obj, key, val) => {
if (obj[key]) obj[key] += ", " + val;
else obj[key] = val;
};
for (const type of types) {
const { bar, value } = TokenMold.FOUNDRY_VERSION >= 10 ?
TokenDocument.getTrackedAttributes(new CONFIG.Actor.documentClass({ type: type, name: "tmp" })) :
TokenDocument.getTrackedAttributes(new CONFIG.Actor.documentClass({ type: type, name: "tmp" }).data.data);
const docClass = TokenMold.FOUNDRY_VERSION >= 10 ?
JSON.parse(JSON.stringify(new CONFIG.Actor.documentClass({ type: type, name: "tmp"}))) :
new CONFIG.Actor.documentClass({ type: type, name: "tmp" }).data.data;
const { bar, value } = TokenDocument.getTrackedAttributes(docClass);
for (const val of bar) {
addElement(barData.bar, val.join("."), type);
}
Expand Down Expand Up @@ -1070,6 +1072,7 @@ class TokenMoldForm extends FormApplication {
data.languages = this.languages;
data.rollTableList = this.object._rollTableList;
data.visionLabel = TokenMold.FOUNDRY_VERSION >= 10 ? game.i18n.localize("TOKEN.VisionEnabled") : game.i18n.localize("TOKEN.VisionHas");
data.isV9 = !(TokenMold.FOUNDRY_VERSION >= 10);
TokenMold.log(false, TokenMold.LOG_LEVEL.Debug, "Prepared data", data, this._rollTableList);
return data;
}
Expand All @@ -1078,12 +1081,12 @@ class TokenMoldForm extends FormApplication {
if (/dnd5e|sw5e/.exec(game.data.system.id) !== null) {
return [
{
value: "data.attributes.ac.value",
value: TokenMold.FOUNDRY_VERSION >= 10 ? "system.attributes.ac.value" : "data.attributes.ac.value",
label: "Armor Class",
icon: '<i class="fas fa-eye"></i>',
},
{
value: "data.skills.prc.passive",
value: TokenMold.FOUNDRY_VERSION >= 10 ? "system.skills.prc.passive" : "data.skills.prc.passive",
label: "Passive Perception",
icon: '<i class="fas fa-shield-alt"></i>',
},
Expand Down
12 changes: 12 additions & 0 deletions templates/token-mold.html
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,10 @@ <h4 class='language'>{{ localize "tmold.name.language" }}</h4>
</div>
</div>
<div class="tab overlay" data-tab="overlay" >
<div class="form-group class unlinked">
<input type='checkbox' name='enableOverlayForLinked' id='enableOverlayForLinked' {{checked data.enableOverlayForLinked}} data-dtype="Boolean">
<label for='enableOverlayForLinked'>{{ localize "tmold.config.enableOverlayFor" }}&nbsp;<em>{{ localize "tmold.config.linkedTokens" }}</em>.</label>
</div>
<div class="form-group">
<h3>{{ localize "tmold.stat.attributeChooseDisplay" }}</h3>
</div>
Expand All @@ -342,7 +346,11 @@ <h4 class='attribute'>{{ localize "tmold.stat.attribute" }}</h4>
{{#each @root.actorAttributes as |v k|}}
<optgroup label="{{k}}">
{{#each v}}
{{#if ../../isV9}}
<option value="data.{{k}}.{{this.attribute}}">{{this.attribute}} [{{this.document}}]</option>
{{else}}
<option value="system.{{k}}.{{this.attribute}}">{{this.attribute}} [{{this.document}}]</option>
{{/if}}
{{/each}}
</optgroup>
{{/each}}
Expand All @@ -363,7 +371,11 @@ <h4 class='attribute'>{{ localize "tmold.stat.attribute" }}</h4>
{{#each @root.actorAttributes as |v k|}}
<optgroup label="{{k}}">
{{#each v}}
{{#if ../../isV9}}
<option value="data.{{k}}.{{this.attribute}}">{{this.attribute}} [{{this.document}}]</option>
{{else}}
<option value="system.{{k}}.{{this.attribute}}">{{this.attribute}} [{{this.document}}]</option>
{{/if}}
{{/each}}
</optgroup>
{{/each}}
Expand Down

0 comments on commit a9fb39b

Please sign in to comment.