Skip to content

Commit e19689f

Browse files
committed
For issue vttred#445
* sets FormApplication option, submitOnClose to false. * migrated Gather scores to _onSubmit override * Added default to data.roll.type check in helpers-dice.js, setting isSuccess AND isFailure to false. * set data object in call to OseDice.Roll to not provide type Object.
1 parent 31882ad commit e19689f

File tree

2 files changed

+29
-25
lines changed

2 files changed

+29
-25
lines changed

src/module/dialog/character-creation.js

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export default class OseCharacterCreator extends FormApplication {
1111
options.id = "character-creator";
1212
options.template = `${OSE.systemPath()}/templates/actors/dialogs/character-creation.html`;
1313
options.width = 235;
14+
options.submitOnClose = false;
1415
return options;
1516
}
1617

@@ -98,9 +99,7 @@ export default class OseCharacterCreator extends FormApplication {
9899
: game.i18n.localize(`OSE.scores.${score}.long`);
99100
const rollParts = ["3d6"];
100101
const data = {
101-
roll: {
102-
type: "result",
103-
},
102+
roll: {},
104103
};
105104
if (options.skipMessage) {
106105
return new Roll(rollParts[0]).evaluate({ async: false });
@@ -123,27 +122,6 @@ export default class OseCharacterCreator extends FormApplication {
123122
});
124123
}
125124

126-
async close(options) {
127-
// Gather scores
128-
const speaker = ChatMessage.getSpeaker({ actor: this });
129-
const templateData = {
130-
config: CONFIG.OSE,
131-
scores: this.scores,
132-
title: game.i18n.localize("OSE.dialog.generator"),
133-
stats: this.object.stats,
134-
gold: this.gold,
135-
};
136-
const content = await renderTemplate(
137-
`${OSE.systemPath()}/templates/chat/roll-creation.html`,
138-
templateData
139-
);
140-
ChatMessage.create({
141-
content,
142-
speaker,
143-
});
144-
return super.close(options);
145-
}
146-
147125
/** @override */
148126
activateListeners(html) {
149127
super.activateListeners(html);
@@ -193,6 +171,26 @@ export default class OseCharacterCreator extends FormApplication {
193171
preventClose,
194172
preventRender,
195173
});
174+
175+
// Gather scores
176+
const speaker = ChatMessage.getSpeaker({ actor: this.object.actor });
177+
const templateData = {
178+
config: CONFIG.OSE,
179+
scores: this.scores,
180+
title: game.i18n.localize("OSE.dialog.generator"),
181+
stats: this.object.stats,
182+
gold: this.gold,
183+
};
184+
const content = await renderTemplate(
185+
`${OSE.systemPath()}/templates/chat/roll-creation.html`,
186+
templateData
187+
);
188+
189+
await ChatMessage.create({
190+
content,
191+
speaker,
192+
});
193+
196194
// Generate gold
197195
const itemData = {
198196
name: game.i18n.localize("OSE.items.gp.short"),

src/module/helpers-dice.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,13 @@ const OseDice = {
157157

158158
break;
159159
}
160-
// No default
160+
161+
default : {
162+
result.isSuccess = false;
163+
result.isFailure = false;
164+
165+
break;
166+
}
161167
}
162168
return result;
163169
},

0 commit comments

Comments
 (0)