Skip to content

Commit

Permalink
Resolves vttred#445
Browse files Browse the repository at this point in the history
sets FormApplication option, submitOnClose to false.
commented out function override, close() as it is undesirable.
  • Loading branch information
Stew-rt committed May 29, 2023
1 parent 5c7e418 commit d2ac8c4
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions src/module/dialog/character-creation.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default class OseCharacterCreator extends FormApplication {
options.id = "character-creator";
options.template = `${OSE.systemPath()}/templates/actors/dialogs/character-creation.html`;
options.width = 235;
options.submitOnClose = false;
return options;
}

Expand Down Expand Up @@ -123,31 +124,32 @@ export default class OseCharacterCreator extends FormApplication {
});
}

async close(options) {
// Gather scores
const speaker = ChatMessage.getSpeaker({ actor: this });
const templateData = {
config: CONFIG.OSE,
scores: this.scores,
title: game.i18n.localize("OSE.dialog.generator"),
stats: this.object.stats,
gold: this.gold,
};
const content = await renderTemplate(
`${OSE.systemPath()}/templates/chat/roll-creation.html`,
templateData
);
ChatMessage.create({
content,
speaker,
});
return super.close(options);
}
// // Removed for Issue #445
// async close(options) {
// // Gather scores
// const speaker = ChatMessage.getSpeaker({ actor: this });
// const templateData = {
// config: CONFIG.OSE,
// scores: this.scores,
// title: game.i18n.localize("OSE.dialog.generator"),
// stats: this.object.stats,
// gold: this.gold,
// };
// const content = await renderTemplate(
// `${OSE.systemPath()}/templates/chat/roll-creation.html`,
// templateData
// );
// ChatMessage.create({
// content,
// speaker,
// });
// return super.close(options);
// }

/** @override */
activateListeners(html) {
super.activateListeners(html);
html.find("a.score-roll").click((ev) => {
html.find("a.score-roll").on("click", (ev) => {
const el = ev.currentTarget.parentElement.parentElement;
const { score } = el.dataset;
this.rollScore(score, { event: ev }).then((r) => {
Expand All @@ -156,7 +158,7 @@ export default class OseCharacterCreator extends FormApplication {
});
});

html.find("a.gold-roll").click((ev) => {
html.find("a.gold-roll").on("click", (ev) => {
const el = ev.currentTarget.parentElement.parentElement.parentElement;
this.rollScore("gold", { event: ev }).then((r) => {
this.gold = 10 * r.total;
Expand Down

0 comments on commit d2ac8c4

Please sign in to comment.