-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
slight restructure, and add release notes
- Loading branch information
Showing
11 changed files
with
186 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
export default function registerTextEditorEnrichers() { | ||
|
||
CONFIG.TextEditor.enrichers.push({ | ||
// [[check DC STAT]] | ||
// [[request DC STAT]] | ||
pattern: /\[\[(?<command>check|request)\s(?<dc>\d+)\s(?<stat>\w{3})\]\]/g, | ||
enricher: async (match, options) => { | ||
let { command, dc, stat } = match.groups; | ||
|
||
// Check for invalid data | ||
if (!parseInt(dc)) return; | ||
if (CONFIG.SHADOWDARK.ABILITY_KEYS.includes(stat.toLowerCase())) { | ||
stat = stat.toLowerCase(); | ||
} | ||
else { | ||
return; | ||
} | ||
|
||
// create replacement html | ||
const link = document.createElement("a"); | ||
link.className = "content-link"; | ||
link.classList.add("skill-roll-request"); | ||
link.dataset.command = command; | ||
link.dataset.dc = dc; | ||
link.dataset.stat = stat; | ||
const linkText = `${game.i18n.localize("SHADOWDARK.class-ability.dc.label")} ${dc} ${game.i18n.localize(`SHADOWDARK.ability_${stat}`)}`.toUpperCase(); | ||
switch (command) { | ||
case "check": | ||
link.innerHTML = `<i class="fa-solid fa-dice-d20"></i>${linkText}`; | ||
break; | ||
case "request": | ||
link.innerHTML = `<i class="fa-solid fa-comment"></i>${linkText}`; | ||
break; | ||
} | ||
return link; | ||
}, | ||
}); | ||
|
||
$("body").on( | ||
"click", "a.skill-roll-request", | ||
shadowdark.apps.RequestCheckSD.checkHandler | ||
); | ||
|
||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
export default class ChatSD { | ||
|
||
static async _renderChatMessage( | ||
actor, | ||
data, | ||
template, | ||
mode | ||
) { | ||
const html = await renderTemplate(template, data); | ||
|
||
if (!mode) { | ||
mode = game.settings.get("core", "rollMode"); | ||
} | ||
|
||
const messageStyles = shadowdark.utils.getMessageStyles(); | ||
|
||
const chatData = { | ||
user: game.user.id, | ||
speaker: ChatMessage.getSpeaker({ | ||
actor: actor, | ||
}), | ||
rollMode: mode, | ||
content: html, | ||
type: messageStyles.OTHER, | ||
}; | ||
|
||
ChatMessage.applyRollMode(chatData, mode); | ||
|
||
await ChatMessage.create(chatData); | ||
} | ||
|
||
static async renderGeneralMessage(actor, data, mode) { | ||
this._renderChatMessage(actor, data, | ||
"systems/shadowdark/templates/chat/general.hbs", | ||
mode | ||
); | ||
} | ||
|
||
static async renderRollRequestMessage(actor, data, mode) { | ||
this._renderChatMessage(actor, data, | ||
"systems/shadowdark/templates/chat/roll-request.hbs", | ||
mode | ||
); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<div class="shadowdark"> | ||
<div class="content"> | ||
<h3>{{title}}</h3> | ||
<p>{{body}}</p> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<div class="shadowdark"> | ||
<div class="content"> | ||
<h3>{{title}}</h3> | ||
<div style="text-align:center"> | ||
<p>{{body}}</p> | ||
</div> | ||
</div> | ||
</div> |