Nouvelle fenêtre de jets de dés
This commit is contained in:
31
module/roll/roll-part-tricher.mjs
Normal file
31
module/roll/roll-part-tricher.mjs
Normal file
@@ -0,0 +1,31 @@
|
||||
import { ROLLDIALOG_SECTION, RollPart } from "./roll-part.mjs"
|
||||
|
||||
const PART_TRICHER = "tricher"
|
||||
|
||||
export class RollPartTricher extends RollPart {
|
||||
|
||||
get code() { return PART_TRICHER }
|
||||
get section() { return ROLLDIALOG_SECTION.CONDITIONS }
|
||||
|
||||
visible(rollData) { return game.user.isGM }
|
||||
|
||||
prepareContext(rollData) {
|
||||
const current = this.getCurrent(rollData)
|
||||
if (current.resultat == undefined) {
|
||||
current.resultat = -1
|
||||
}
|
||||
}
|
||||
|
||||
getAjustements(rollData) {
|
||||
rollData.current.resultat = this.getCurrent(rollData).resultat
|
||||
return []
|
||||
}
|
||||
|
||||
async _onRender(rollDialog, context, options) {
|
||||
const input = rollDialog.element.querySelector(`roll-section[name="${this.code}"] input[name="${this.code}"]`)
|
||||
|
||||
input?.addEventListener("change", e => {
|
||||
this.getCurrent(rollDialog.rollData).resultat = parseInt(e.currentTarget.value)
|
||||
})
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user