Skip to content

Commit fa3b5d0

Browse files
committed
12.01 changes
1 parent f4174c0 commit fa3b5d0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+691
-691
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# Version 12.01
2+
3+
v12 compatibility
4+
5+
Added the option to automatically distribute coins between players when opening the distribute dialog
6+
17
# Version 11.11
28

39
Fixed link styling for the link list that appears when selecting the text that matches the name of a document.

apps/adjust-price.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class AdjustPrice extends FormApplication {
1010

1111
/** @override */
1212
static get defaultOptions() {
13-
return mergeObject(super.defaultOptions, {
13+
return foundry.utils.mergeObject(super.defaultOptions, {
1414
id: "adjust-price",
1515
classes: ["adjust-price", "monks-journal-sheet", "dialog"],
1616
title: i18n("MonksEnhancedJournal.AdjustPrices"),
@@ -24,15 +24,15 @@ export class AdjustPrice extends FormApplication {
2424
}
2525

2626
getData(options) {
27-
const original = game.system?.documentTypes?.Item || [];
27+
const original = Object.keys(game.system?.documentTypes?.Item || {});
2828
let types = original.filter(x => MonksEnhancedJournal.includedTypes.includes(x));
2929
types = types.reduce((obj, t) => {
3030
const label = CONFIG.Item?.typeLabels?.[t] ?? t;
3131
obj[t] = game.i18n.has(label) ? game.i18n.localize(label) : t;
3232
return obj;
3333
}, {});
3434
let defaultAdjustment = setting("adjustment-defaults");
35-
let adjustment = duplicate(defaultAdjustment);
35+
let adjustment = foundry.utils.duplicate(defaultAdjustment);
3636
if (this.object)
3737
adjustment = this.object.getFlag('monks-enhanced-journal', 'adjustment') || {};
3838
else
@@ -44,7 +44,7 @@ export class AdjustPrice extends FormApplication {
4444
}
4545
data.showConvert = !!this.object;
4646

47-
return mergeObject(super.getData(options), data );
47+
return foundry.utils.mergeObject(super.getData(options), data );
4848
}
4949

5050
activateListeners(html) {
@@ -115,9 +115,9 @@ export class AdjustPrice extends FormApplication {
115115

116116
for (let item of items) {
117117
let sell = adjustment[item.type]?.sell ?? adjustment.default.sell ?? 1;
118-
let price = MEJHelpers.getPrice(getProperty(item, "flags.monks-enhanced-journal.price"));
118+
let price = MEJHelpers.getPrice(foundry.utils.getProperty(item, "flags.monks-enhanced-journal.price"));
119119
let cost = Math.max(Math.ceil((price.value * sell), 1)) + " " + price.currency;
120-
setProperty(item, "flags.monks-enhanced-journal.cost", cost);
120+
foundry.utils.setProperty(item, "flags.monks-enhanced-journal.cost", cost);
121121
}
122122

123123
await this.object.update({ "flags.monks-enhanced-journal.items": items }, { focus: false });

apps/customise-page.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { MonksEnhancedJournal, log, setting, i18n, makeid } from '../monks-enhan
22

33
export class CustomisePage extends FormApplication {
44
static get defaultOptions() {
5-
return mergeObject(super.defaultOptions, {
5+
return foundry.utils.mergeObject(super.defaultOptions, {
66
id: "customise-page",
77
classes: ["form"],
88
title: "Customise Page",
@@ -15,7 +15,7 @@ export class CustomisePage extends FormApplication {
1515
}
1616

1717
async _renderInner(...args) {
18-
delete _templateCache[`modules/monks-enhanced-journal/templates/customise/${this.object.constructor.type}.html`];
18+
delete Handlebars.partials[`modules/monks-enhanced-journal/templates/customise/${this.object.constructor.type}.html`];
1919
await loadTemplates({
2020
page: `modules/monks-enhanced-journal/templates/customise/${this.object.constructor.type}.html`,
2121
});
@@ -53,7 +53,7 @@ export class CustomisePage extends FormApplication {
5353
}
5454

5555
async _updateObject(event, formData) {
56-
let data = expandObject(formData);
56+
let data = foundry.utils.expandObject(formData);
5757

5858
let defaultSettings = this.object.constructor.sheetSettings() || {};
5959
let settings = data.sheetSettings[this.object.constructor.type] || {};
@@ -108,9 +108,9 @@ export class CustomisePage extends FormApplication {
108108

109109
for (let item of items) {
110110
let sell = adjustment[item.type]?.sell ?? adjustment.default.sell ?? 1;
111-
let price = MEJHelpers.getPrice(getProperty(item, "flags.monks-enhanced-journal.price"));
111+
let price = MEJHelpers.getPrice(foundry.utils.getProperty(item, "flags.monks-enhanced-journal.price"));
112112
let cost = Math.max(Math.ceil((price.value * sell), 1)) + " " + price.currency;
113-
setProperty(item, "flags.monks-enhanced-journal.cost", cost);
113+
foundry.utils.setProperty(item, "flags.monks-enhanced-journal.cost", cost);
114114
}
115115

116116
await this.object.update({ "flags.monks-enhanced-journal.items": items }, { focus: false });

apps/customise-pages.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class CustomisePages extends FormApplication {
3030
tabs.push({ navSelector: `.${page}-tabs`, contentSelector: `.${page}-body`, initial: "tabs" });
3131
}
3232

33-
return mergeObject(super.defaultOptions, {
33+
return foundry.utils.mergeObject(super.defaultOptions, {
3434
id: "customise-pages",
3535
classes: ["form"],
3636
title: "Customise Pages",
@@ -48,7 +48,7 @@ export class CustomisePages extends FormApplication {
4848
for (let page of CustomisePages.typeList) {
4949
let template = `modules/monks-enhanced-journal/templates/customise/${page}.html`;
5050
load_templates[page] = template;
51-
delete _templateCache[template];
51+
delete Handlebars.partials[template];
5252
}
5353
await loadTemplates(load_templates);
5454
const html = await super._renderInner(...args);
@@ -58,7 +58,7 @@ export class CustomisePages extends FormApplication {
5858
getData(options) {
5959
let data = super.getData(options);
6060
data.generalEdit = true;
61-
data.sheetSettings = duplicate(this.sheetSettings);
61+
data.sheetSettings = foundry.utils.duplicate(this.sheetSettings);
6262

6363
for (let page of CustomisePages.typeList) {
6464
data.sheetSettings[page] = MonksEnhancedJournal.convertObjectToArray(data.sheetSettings[page]);
@@ -84,7 +84,7 @@ export class CustomisePages extends FormApplication {
8484

8585
addAttribute(event) {
8686
let attribute = event.currentTarget.dataset.attribute;
87-
let attributes = getProperty(this, attribute);
87+
let attributes = foundry.utils.getProperty(this, attribute);
8888

8989
if (!attributes) return;
9090

@@ -94,16 +94,16 @@ export class CustomisePages extends FormApplication {
9494
maxOrder = Math.max(maxOrder, attr.order);
9595
}
9696

97-
attributes[randomID()] = { id: randomID(), name: "", shown: true, full: false, order: maxOrder + 1 };
97+
attributes[foundry.utils.randomID()] = { id: foundry.utils.randomID(), name: "", shown: true, full: false, order: maxOrder + 1 };
9898

9999
this.render(true);
100100
}
101101

102102
changeData(event) {
103103
let prop = $(event.currentTarget).attr("name");
104-
if (hasProperty(this, prop)) {
104+
if (foundry.utils.hasProperty(this, prop)) {
105105
let val = $(event.currentTarget).attr("type") == "checkbox" ? $(event.currentTarget).prop('checked') : $(event.currentTarget).val();
106-
setProperty(this, prop, val);
106+
foundry.utils.setProperty(this, prop, val);
107107
}
108108
}
109109

@@ -158,10 +158,10 @@ export class CustomisePages extends FormApplication {
158158
if (data.id === target.dataset.id) return; // Don't drop on yourself
159159

160160
let property = event.target.dataset.attribute;
161-
let attributes = getProperty(this, property);
161+
let attributes = foundry.utils.getProperty(this, property);
162162

163-
let from = (getProperty(this, data.id) || {}).order ?? 0;
164-
let to = (getProperty(this, target.dataset.id) || {}).order ?? 0;
163+
let from = (foundry.utils.getProperty(this, data.id) || {}).order ?? 0;
164+
let to = (foundry.utils.getProperty(this, target.dataset.id) || {}).order ?? 0;
165165
log('from', from, 'to', to);
166166

167167
if (from < to) {
@@ -179,7 +179,7 @@ export class CustomisePages extends FormApplication {
179179
}
180180
$('.item-list .item[data-id="' + data.id + '"]', this.element).insertBefore(target);
181181
}
182-
(getProperty(this, data.id) || {}).order = to;
182+
(foundry.utils.getProperty(this, data.id) || {}).order = to;
183183
}
184184
}
185185

apps/dc-config.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export class DCConfig extends FormApplication {
88

99
/** @override */
1010
static get defaultOptions() {
11-
return mergeObject(super.defaultOptions, {
11+
return foundry.utils.mergeObject(super.defaultOptions, {
1212
id: "dc-config",
1313
classes: ["form", "dc-sheet"],
1414
title: i18n("MonksEnhancedJournal.DCConfiguration"),
@@ -28,15 +28,15 @@ export class DCConfig extends FormApplication {
2828

2929
let attributeOptions = [
3030
{ id: "ability", text: "MonksEnhancedJournal.Ability", groups: config.abilities || config.scores || config.atributos },
31-
{ id: "save", text: "MonksTokenBar.SavingThrow", groups: config.savingThrows || config.saves || config.saves_long || config.resistencias || config.abilities },
31+
{ id: "save", text: "MonksEnhancedJournal.SavingThrow", groups: config.savingThrows || config.saves || config.saves_long || config.resistencias || config.abilities },
3232
{ id: "skill", text: "MonksEnhancedJournal.Skill", groups: config.skills || config.pericias || skills }
3333
];
3434
if (game.system.id == "pf2e")
35-
attributeOptions.push({ id: "attribute", text: i18n("MonksTokenBar.Attribute"), groups: { perception: i18n("PF2E.PerceptionLabel") } });
35+
attributeOptions.push({ id: "attribute", text: i18n("MonksEnhancedJournal.Attribute"), groups: { perception: i18n("PF2E.PerceptionLabel") } });
3636

3737
attributeOptions = attributeOptions.filter(g => g.groups);
3838
for (let attr of attributeOptions) {
39-
attr.groups = duplicate(attr.groups);
39+
attr.groups = foundry.utils.duplicate(attr.groups);
4040
for (let [k, v] of Object.entries(attr.groups)) {
4141
attr.groups[k] = v?.label || v;
4242
}
@@ -46,7 +46,7 @@ export class DCConfig extends FormApplication {
4646
}
4747

4848
getData(options) {
49-
return mergeObject(super.getData(options),
49+
return foundry.utils.mergeObject(super.getData(options),
5050
{
5151
attributeOptions: DCConfig.optionList()
5252
}, { recursive: false }
@@ -59,8 +59,8 @@ export class DCConfig extends FormApplication {
5959
async _updateObject(event, formData) {
6060
log('updating dc', event, formData, this.object);
6161

62-
mergeObject(this.object, formData);
63-
let dcs = duplicate(this.journalentry.object.flags["monks-enhanced-journal"].dcs || []);
62+
foundry.utils.mergeObject(this.object, formData);
63+
let dcs = foundry.utils.duplicate(this.journalentry.object.flags["monks-enhanced-journal"].dcs || []);
6464
if (this.object.id == undefined) {
6565
this.object.id = makeid();
6666
dcs.push(this.object);

apps/distribute-currency.js

+11-7
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,30 @@ export class DistributeCurrency extends FormApplication {
1111

1212
this.loot = loot;
1313
this.currency = currency;
14-
this.original = duplicate(currency);
15-
this.totals = duplicate(currency);
16-
let playercurrency = duplicate(currency);
14+
this.original = foundry.utils.duplicate(currency);
15+
this.totals = foundry.utils.duplicate(currency);
16+
let playercurrency = foundry.utils.duplicate(currency);
1717
for (let curr of Object.keys(currency))
1818
playercurrency[curr] = 0;
1919
this.characters = characters.map(c => {
2020
return {
2121
id: c.id,
2222
name: c.name,
2323
img: c.img,
24-
currency: duplicate(playercurrency)
24+
currency: foundry.utils.duplicate(playercurrency)
2525
}
2626
});
2727

2828
this.currencies = MonksEnhancedJournal.currencies;
29+
30+
if (setting("loot-auto-distribute"))
31+
this.splitCurrency();
32+
2933
}
3034

3135
/** @override */
3236
static get defaultOptions() {
33-
return mergeObject(super.defaultOptions, {
37+
return foundry.utils.mergeObject(super.defaultOptions, {
3438
id: "distribute-currency",
3539
classes: ["distribute-currency", "monks-journal-sheet", "dialog"],
3640
title: i18n("MonksEnhancedJournal.DistributeCurrency"),
@@ -44,7 +48,7 @@ export class DistributeCurrency extends FormApplication {
4448
}
4549

4650
getData(options) {
47-
return mergeObject(super.getData(options),
51+
return foundry.utils.mergeObject(super.getData(options),
4852
{
4953
characters: this.characters,
5054
currencies: this.currencies,
@@ -69,7 +73,7 @@ export class DistributeCurrency extends FormApplication {
6973
}
7074

7175
resetData() {
72-
this.currency = duplicate(this.original);
76+
this.currency = foundry.utils.duplicate(this.original);
7377
for (let character of this.characters) {
7478
for (let curr of Object.keys(character.currency)) {
7579
character.currency[curr] = 0;

apps/editattributes.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export class EditAttributes extends FormApplication {
77

88
/** @override */
99
static get defaultOptions() {
10-
return mergeObject(super.defaultOptions, {
10+
return foundry.utils.mergeObject(super.defaultOptions, {
1111
id: "edit-attributes",
1212
classes: ["form", "edit-attributes"],
1313
title: i18n("MonksEnhancedJournal.EditAttributes"),
@@ -122,7 +122,7 @@ export class EditPersonAttributes extends EditAttributes {
122122

123123
getData(options) {
124124
this.attributes = this.attributes || setting("person-attributes");
125-
return mergeObject(super.getData(options),
125+
return foundry.utils.mergeObject(super.getData(options),
126126
{
127127
fields: this.attributes
128128
}
@@ -148,7 +148,7 @@ export class EditPlaceAttributes extends EditAttributes {
148148

149149
getData(options) {
150150
this.attributes = this.attributes || setting("place-attributes");
151-
return mergeObject(super.getData(options),
151+
return foundry.utils.mergeObject(super.getData(options),
152152
{
153153
fields: this.attributes
154154
}

apps/editcurrency.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export class EditCurrency extends FormApplication {
88
}
99

1010
static get defaultOptions() {
11-
return mergeObject(super.defaultOptions, {
11+
return foundry.utils.mergeObject(super.defaultOptions, {
1212
id: "journal-editcurrency",
1313
title: i18n("MonksEnhancedJournal.EditCurrency"),
1414
classes: ["edit-currency"],

apps/editfields.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export class EditFields extends FormApplication {
88

99
/** @override */
1010
static get defaultOptions() {
11-
return mergeObject(super.defaultOptions, {
11+
return foundry.utils.mergeObject(super.defaultOptions, {
1212
id: "edit-fields",
1313
classes: ["form", "edit-fields"],
1414
title: i18n("MonksEnhancedJournal.EditFields"),
@@ -20,18 +20,18 @@ export class EditFields extends FormApplication {
2020
}
2121

2222
async _updateObject(event, formData) {
23-
let fd = mergeObject({}, formData);
23+
let fd = foundry.utils.mergeObject({}, formData);
2424
for (let attr of Object.values(fd.attributes)) {
2525
attr.hidden = !attr.shown;
2626
delete attr.shown;
2727
}
28-
let attributes = mergeObject(this.object.flags['monks-enhanced-journal'].attributes, fd.attributes);
28+
let attributes = foundry.utils.mergeObject(this.object.flags['monks-enhanced-journal'].attributes, fd.attributes);
2929
this.object.update({ "flags.monks-enhanced-journal.attributes": attributes }, { focus: false });
3030
this.change = true;
3131
}
3232

3333
getData(options) {
34-
return mergeObject(super.getData(options),
34+
return foundry.utils.mergeObject(super.getData(options),
3535
{
3636
fields: this.fields
3737
}

apps/editsound.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export class EditSound extends FormApplication {
88
}
99

1010
static get defaultOptions() {
11-
return mergeObject(super.defaultOptions, {
11+
return foundry.utils.mergeObject(super.defaultOptions, {
1212
id: "journal-editsound",
1313
title: i18n("MonksEnhancedJournal.EditSound"),
1414
classes: ["edit-sound"],
@@ -21,14 +21,14 @@ export class EditSound extends FormApplication {
2121
}
2222

2323
getData(options) {
24-
let sound = mergeObject({volume: 1, loop: true, autoplay: true}, (this.object.getFlag("monks-enhanced-journal", "sound") || {}));
24+
let sound = foundry.utils.mergeObject({volume: 1, loop: true, autoplay: true}, (this.object.getFlag("monks-enhanced-journal", "sound") || {}));
2525
return {
2626
sound: sound
2727
};
2828
}
2929

3030
_updateObject(event, formData) {
31-
let data = expandObject(formData);
31+
let data = foundry.utils.expandObject(formData);
3232

3333
if (this.soundfile) {
3434
let oldData = this.object.getFlag('monks-enhanced-journal', 'sound');
@@ -40,11 +40,11 @@ export class EditSound extends FormApplication {
4040
this.soundfile.loop = data.sound.loop;
4141
if (oldData.audiofile != data.sound.audiofile) {
4242
let isPlaying = this.soundfile.playing;
43-
if (this.soundfile?.container?.playing)
44-
this.soundfile.container.stop();
43+
if (this.soundfile?.playing)
44+
this.soundfile.stop();
4545
if (data.sound.audiofile) {
46-
this.soundfile.container = new AudioContainer(data.sound.audiofile);
47-
this.soundfile.src = data.sound.audiofile;
46+
this.soundfile = new foundry.audio.Sound(data.sound.audiofile);
47+
//this.soundfile.src = data.sound.audiofile;
4848
this.soundfile.load({ autoplay: isPlaying, autoplayOptions: { loop: data.sound.loop, volume: data.sound.volume } });
4949
} else
5050
this.soundfile = null;

0 commit comments

Comments
 (0)