Skip to content

Commit f4174c0

Browse files
committed
11.11 changes
1 parent 540b0fe commit f4174c0

10 files changed

+138
-55
lines changed

CHANGELOG.md

+18
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
# Version 11.11
2+
3+
Fixed link styling for the link list that appears when selecting the text that matches the name of a document.
4+
5+
Fixed issue with the new D&D 5e character sheet not saving a sheet type change.
6+
7+
Fixed issue where players were shown links to documents they weren't allowed to see.
8+
9+
Fixed issue with linking to a journal entry in the scene config
10+
11+
Fixed issue with unidentified names not being shown to players in loot and shop sheets.
12+
13+
Fixed issue with D&D 5e items not refreshing after changing the identified or equipped toggle.
14+
15+
Added the option to use [[/award]] in roll tables to populate loot and shop sheets. Thank you NeilWhite
16+
17+
Also cleaned up the text option in roll tables to use {1d10gp} notation as well as {1d10 [gp]} notation.
18+
119
# Version 11.10
220

321
Updated the objectives display to allow full resizing

css/monks-enhanced-journal.css

+10
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,7 @@ span.unknown-link {
933933
}
934934

935935
body[inline-roll-styling="true"] a.entity-link,
936+
body[inline-roll-styling="true"] aside.locked-tooltip.link-matches a.content-link,
936937
body[inline-roll-styling="true"] a.content-link,
937938
body[inline-roll-styling="true"] a.inline-roll,
938939
body[inline-roll-styling="true"] a.picture-link,
@@ -945,6 +946,15 @@ body[inline-roll-styling="true"] a.tile-trigger-link {
945946
border: 0px;
946947
}
947948

949+
body[inline-roll-styling="true"] aside.locked-tooltip.link-matches a.content-link[data-uuid^="Compendium"]::before {
950+
color: var(--color-text-hyperlink);
951+
opacity: 0.6;
952+
}
953+
954+
body[inline-roll-styling="true"] aside.locked-tooltip.link-matches a.content-link {
955+
margin-right: 10px;
956+
}
957+
948958
body[inline-roll-styling="true"] a.entity-link i,
949959
body[inline-roll-styling="true"] a.content-link i,
950960
body[inline-roll-styling="true"] a.inline-roll,

css/monks-journal-sheet.css

+5
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,11 @@ body:not(.system-pf2e) .monks-journal-sheet .sheet-container .tag {
798798
font-style: italic;
799799
}
800800

801+
.monks-journal-sheet .items-list .item .item-name .identified-name {
802+
font-size: var(--font-size-12);
803+
font-weight: bold;
804+
}
805+
801806
.monks-journal-sheet .items-list .item .item-name .item-image {
802807
flex: 0 0 30px;
803808
width: 30px;

module.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"title": "Monk's Enhanced Journal",
33
"description": "Treat the journal like it's going to be popped out and used as a digital guide book. Add extra information to summarize an encounter. Show summaries of people and places. Allow for bookmarking of commonly used pages",
4-
"version": "11.10",
4+
"version": "11.11",
55
"authors": [
66
{
77
"name": "IronMonk",
@@ -95,7 +95,7 @@
9595
"css/apsjournal.css"
9696
],
9797
"url": "https://github.com/ironmonk88/monks-enhanced-journal",
98-
"download": "https://github.com/ironmonk88/monks-enhanced-journal/archive/11.10.zip",
98+
"download": "https://github.com/ironmonk88/monks-enhanced-journal/archive/11.11.zip",
9999
"manifest": "https://github.com/ironmonk88/monks-enhanced-journal/releases/latest/download/module.json",
100100
"bugs": "https://github.com/ironmonk88/monks-enhanced-journal/issues",
101101
"allowBugReporter": true,

monks-enhanced-journal.js

+32-34
Original file line numberDiff line numberDiff line change
@@ -1141,37 +1141,11 @@ export class MonksEnhancedJournal {
11411141
return oldImportFromCompendium.call(this, collection, id, updateData, options);
11421142
}
11431143

1144-
DocumentSheetConfig.prototype._updateObject = async function (event, formData) {
1145-
event.preventDefault();
1146-
const original = this.getData({});
1147-
1148-
let fromEnhancedJournal = (this.object._sheet == null);
1149-
1150-
// De-register the current sheet class
1151-
const sheet = this.object.sheet;
1152-
await sheet.close();
1153-
this.object._sheet = null;
1154-
delete this.object.apps[sheet.appId];
1155-
1156-
// Update world settings
1157-
if (game.user.isGM && (formData.defaultClass !== original.defaultClass)) {
1158-
const setting = await game.settings.get("core", "sheetClasses") || {};
1159-
const type = this.object.type || CONST.BASE_DOCUMENT_TYPE;
1160-
foundry.utils.mergeObject(setting, { [`${this.object.documentName}.${type}`]: formData.defaultClass });
1161-
await game.settings.set("core", "sheetClasses", setting);
1162-
}
1163-
1164-
// Update the document-specific override
1165-
if (formData.sheetClass !== original.sheetClass) {
1166-
await this.object.setFlag("core", "sheetClass", formData.sheetClass);
1167-
}
1168-
1169-
// Re-draw the updated sheet
1170-
if (!fromEnhancedJournal)
1171-
this.object.sheet.render(true);
1172-
else
1173-
MonksEnhancedJournal.journal?.render(false);
1174-
}
1144+
patchFunc("DocumentSheet.prototype._onConfigureSheet", async function (wrapped, ...args) {
1145+
if (this.enhancedjournal)
1146+
this.document.enhancedjournal = this.enhancedjournal;
1147+
return wrapped(...args);
1148+
});
11751149

11761150
let clickNote2 = function (wrapped, ...args) {
11771151
const options = { newtab: setting("open-new-tab")};
@@ -1294,7 +1268,12 @@ export class MonksEnhancedJournal {
12941268
sheetOpen ??= this.sheet.rendered;
12951269
await Promise.all(Object.values(this.apps).map(app => app.close()));
12961270
this._sheet = null;
1297-
if (sheetOpen) this.sheet.render(true);
1271+
if (sheetOpen) {
1272+
if (this.enhancedjournal)
1273+
this.enhancedjournal.render(true);
1274+
else
1275+
this.sheet.render(true);
1276+
}
12981277
} else
12991278
return wrapped(...args);
13001279
}, "MIXED");
@@ -1395,7 +1374,7 @@ export class MonksEnhancedJournal {
13951374
}
13961375

13971376
const checkPermission = doc => {
1398-
if (!game.user.isGM && doc && ((!doc.compendium && doc.testUserPermission && !doc.testUserPermission(game.user, "LIMITED")) || (doc.compendium && !doc.compendium.visible))) {
1377+
if (!game.user.isGM && doc && ((!doc.compendium && doc.testUserPermission && !doc.testUserPermission(game.user, "LIMITED")) || (doc.compendium && !doc.compendium.testUserPermission(game.user, "OBSERVER")))) {
13991378
const span = document.createElement('span');
14001379
span.classList.add("unknown-link");
14011380
span.innerHTML = `<i class="fas fa-eye-slash"></i> Hidden`;
@@ -4557,7 +4536,26 @@ Hooks.on("renderSceneConfig", (app, html, data) => {
45574536
let ctrl = $('select[name="journal"]', html);
45584537
let journal = app.object.journal;
45594538

4560-
MonksEnhancedJournal.journalListing(ctrl, html, journal?.id, journal?.name, 'journal').insertAfter(ctrl);
4539+
MonksEnhancedJournal.journalListing(ctrl, html, journal?.id, journal?.name, 'journal', (id, name) => {
4540+
let mejSheet = false;
4541+
let journal = game.journal.get(id);
4542+
if (journal?.pages?.size == 1 && (!!getProperty(journal?.pages?.contents[0], "flags.monks-enhanced-journal.type") || !!getProperty(journal, "flags.monks-enhanced-journal.type"))) {
4543+
let type = getProperty(journal?.pages?.contents[0], "flags.monks-enhanced-journal.type") || getProperty(journal, "flags.monks-enhanced-journal.type");
4544+
if (type == "base" || type == "oldentry") type = "journalentry";
4545+
let types = MonksEnhancedJournal.getDocumentTypes();
4546+
if (types[type]) {
4547+
mejSheet = true;
4548+
}
4549+
}
4550+
4551+
// refresh page list
4552+
app._onChangeJournal({ preventDefault: () => { }, currentTarget: { value: id } });
4553+
4554+
// check if the page list and anchor should be shown
4555+
$('select[name="journalEntryPage"]', html).closest('.form-group').toggle(!mejSheet);
4556+
4557+
app.setPosition({ height: 'auto' });
4558+
}).insertAfter(ctrl);
45614559
ctrl.hide();
45624560
}
45634561
});

sheets/EnhancedJournalSheet.js

+51-15
Original file line numberDiff line numberDiff line change
@@ -1272,16 +1272,18 @@ export class EnhancedJournalSheet extends JournalPageSheet {
12721272
let name = item.name;
12731273
let img = item.img;
12741274

1275+
let identifiedName = name;
12751276
if (item.system?.identification?.status == "unidentified") {
12761277
name = item.system?.identification.unidentified.name || name;
12771278
img = item.system?.identification.unidentified.img || img;
1278-
} else if (game.system.id == "pf1" && item.system?.identified === false) {
1279+
} else if (item.system?.identified === false) {
12791280
name = item.system?.unidentified?.name || name;
12801281
}
12811282

12821283
let itemData = {
12831284
id: item._id,
12841285
name: name,
1286+
identifiedname: game.user.isGM && identifiedName != name ? identifiedName : null,
12851287
type: item.type,
12861288
img: img,
12871289
hide: flags.hide,
@@ -1721,6 +1723,8 @@ export class EnhancedJournalSheet extends JournalPageSheet {
17211723
}
17221724
}
17231725

1726+
mergeObject(sheet.object, formData);
1727+
17241728
let itm = items.find(i => i._id == itemData._id);
17251729
if (itm) {
17261730
itm = mergeObject(itm, formData);
@@ -1737,9 +1741,11 @@ export class EnhancedJournalSheet extends JournalPageSheet {
17371741
} else {
17381742
await this.object.setFlag('monks-enhanced-journal', 'items', items);
17391743
}
1740-
}
17411744

1742-
mergeObject(sheet.object, formData);
1745+
if (game.system.id == "dnd5e") {
1746+
sheet.object.name = itm.name;
1747+
}
1748+
}
17431749

17441750
// Handle the form state prior to submission
17451751
let closeForm = sheet.options.closeOnSubmit && !preventClose;
@@ -1750,7 +1756,11 @@ export class EnhancedJournalSheet extends JournalPageSheet {
17501756
// Restore flags and optionally close the form
17511757
sheet._submitting = false;
17521758
if (preventRender) sheet._state = priorState;
1753-
if (closeForm) await sheet.close({ submit: false, force: true });
1759+
if (closeForm)
1760+
await sheet.close({ submit: false, force: true });
1761+
else if (game.system.id == "dnd5e" && !preventRender) {
1762+
sheet.render(true);
1763+
}
17541764

17551765
if (!closeForm)
17561766
sheet.bringToTop();
@@ -1901,25 +1911,49 @@ export class EnhancedJournalSheet extends JournalPageSheet {
19011911
}
19021912

19031913
let text = tableresult.text;
1914+
let textCoins = [];
19041915
if (text.startsWith("{") && text.endsWith("}") && text.length > 2) {
1905-
let rolls = text.substring(1, text.length - 1).split(",");
1906-
for (let roll of rolls) {
1907-
let formula = roll;
1908-
let coin = roll.match(/\[[a-z]+\]/);
1909-
if (coin.length > 0) {
1916+
let splitStr = (text.indexOf("[") > -1 && text.indexOf("]") > -1) ? "," : " ";
1917+
let rolls = text.substring(1, text.length - 1).trim().split(splitStr);
1918+
for (let part of rolls) {
1919+
if (!part) continue;
1920+
let formula = part;
1921+
let coin = part.match(/\[[a-z]+\]/);
1922+
if (splitStr == " ")
1923+
[, formula, coin] = part.match(/^(.+?)(\D+)$/) ?? [];
1924+
if (Array.isArray(coin)) {
19101925
coin = coin[0];
19111926
formula = formula.replace(`${coin}`, '');
19121927
coin = coin.replace("[", "").replace("]", "");
19131928
}
1914-
if (coin == undefined || coin.length == 0 || MonksEnhancedJournal.currencies.find(c => c.id == coin) == undefined)
1915-
coin = MEJHelpers.defaultCurrency();
19161929

1917-
let value = await tryRoll(formula);
1918-
1919-
currency[coin] = (currency[coin] || 0) + value;
1920-
currChanged = true;
1930+
textCoins.push({ formula, coin });
19211931
}
19221932
}
1933+
1934+
// DND5E Award Enricher Parsing
1935+
if (text.startsWith("[[/award") && text.endsWith("]]")) {
1936+
const awards = text.substring(8, text.length - 2).trim().split(" ");
1937+
for (const part of awards) {
1938+
if (!part) continue;
1939+
let [,formula, coin] = part.match(/^(.+?)(\D+)$/) ?? [];
1940+
1941+
textCoins.push({ formula, coin });
1942+
}
1943+
}
1944+
1945+
for (let tc of textCoins) {
1946+
if (tc.coin == undefined)
1947+
tc.coin = MEJHelpers.defaultCurrency();
1948+
else if (MonksEnhancedJournal.currencies.find(c => c.id == tc.coin) == undefined)
1949+
continue;
1950+
1951+
tc.coin = tc.coin?.toLowerCase();
1952+
1953+
let value = await tryRoll(tc.formula);
1954+
currency[tc.coin] = (currency[tc.coin] || 0) + value;
1955+
currChanged = true;
1956+
}
19231957
}
19241958
}
19251959
/*
@@ -2443,6 +2477,8 @@ export class EnhancedJournalSheet extends JournalPageSheet {
24432477
const description = chatData?.description?.value ?? item.description;
24442478
div = $('<div>').addClass("item-summary").append(propertiesElem, levelPriceLabel, `<div class="item-description">${description}</div>`);
24452479
} else {
2480+
if (item.system?.identified === false && !game.user.isGM && getProperty(item, "system.unidentified.description"))
2481+
chatData = getProperty(item, "system.unidentified.description");
24462482
div = $(`<div class="item-summary">${(typeof chatData == "string" ? chatData : chatData.description.value ?? chatData.description)}</div>`);
24472483
if (typeof chatData !== "string") {
24482484
let props = $('<div class="item-properties"></div>');

templates/sheets/encounter.html

+5-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,11 @@ <h3 class="noborder flexrow">{{localize this.name}} <span class="collapse-text i
124124
<li class="item flexrow{{#if this.received}} received{{/if}}{{#if (eq this.remaining 0)}} empty{{/if}}" data-id="{{this.id}}" data-container="items" data-document="Item" draggable="false">
125125
<div class="item-name flexrow">
126126
<div class="item-image item-icon" style="background-image: url('{{this.img}}')"></div>
127-
<h4>{{this.name}}{{#if (gt this.qtyof 1)}} <span class="highlight-text groups-of">(in groups of {{this.qtyof}})</span>{{/if}}</h4>
127+
<h4>
128+
{{this.name}}
129+
{{#if this.identifiedname}} <span class="identified-name" data-tooltip="{{this.identifiedname}}"><i class="fas fa-circle-question"></i></span>{{/if}}
130+
{{#if (gt this.qtyof 1)}} <span class="highlight-text groups-of">(in groups of {{this.qtyof}})</span>{{/if}}
131+
</h4>
128132
</div>
129133

130134
<div class="item-name item-received">

templates/sheets/loot.html

+5-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@ <h3 class="item-name noborder flexrow">{{localize this.name}} <span class="colla
9494
<li class="item flexrow" data-id="{{this.id}}" data-container="items" data-document="Item" draggable="false">
9595
<div class="item-name flexrow">
9696
<div class="item-image item-icon" style="background-image: url('{{this.img}}')"></div>
97-
<h4>{{this.name}}{{#if (gt this.qtyof 1)}} <span class="highlight-text groups-of">(in groups of {{this.qtyof}})</span>{{/if}}</h4>
97+
<h4>
98+
{{this.name}}
99+
{{#if this.identifiedname}} <span class="identified-name" data-tooltip="{{this.identifiedname}}"><i class="fas fa-circle-question"></i></span>{{/if}}
100+
{{#if (gt this.qtyof 1)}} <span class="highlight-text groups-of">(in groups of {{this.qtyof}})</span>{{/if}}
101+
</h4>
98102
</div>
99103

100104
<div class="item-detail item-from flexrow">

templates/sheets/quest.html

+5-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,11 @@ <h3 class="item-name noborder flexrow">{{localize this.name}} <span class="colla
241241
<li class="item flexrow{{#if this.received}} received{{/if}}{{#if (eq this.remaining 0)}} empty{{/if}}" data-id="{{this.id}}" data-container="items" data-document="Item" draggable="false">
242242
<div class="item-name flexrow">
243243
<div class="item-image" style="background-image: url('{{this.img}}')"></div>
244-
<h4>{{this.name}}{{#if (gt this.qtyof 1)}} <span class="highlight-text groups-of">(in groups of {{this.qtyof}})</span>{{/if}}</h4>
244+
<h4>
245+
{{this.name}}
246+
{{#if this.identifiedname}} <span class="identified-name" data-tooltip="{{this.identifiedname}}"><i class="fas fa-circle-question"></i></span>{{/if}}
247+
{{#if (gt this.qtyof 1)}} <span class="highlight-text groups-of">(in groups of {{this.qtyof}})</span>{{/if}}
248+
</h4>
245249
</div>
246250
{{#if @root.owner}}
247251
<div class="item-name item-received">

0 commit comments

Comments
 (0)