This commit was merged in pull request #820.
This commit is contained in:
@@ -22,8 +22,8 @@ export class RollPartTache extends RollPartSelect {
|
||||
refs.forced = selected.forced
|
||||
refs.all = rollData.active.actor.itemTypes[ITEM_TYPES.tache]
|
||||
.filter(tache => !selected.forced || tache.id == selected.key)
|
||||
.filter(tache => tache.system.points_de_tache_courant < tache.system.points_de_tache)
|
||||
.map(tache => RollPartTache.$extractTache(tache, rollData.active.actor))
|
||||
.filter(extract => !extract.finished)
|
||||
|
||||
refs.taches = refs.all
|
||||
if (refs.taches.length > 0) {
|
||||
@@ -34,12 +34,15 @@ export class RollPartTache extends RollPartSelect {
|
||||
choices(refs) { return refs.taches }
|
||||
|
||||
static $extractTache(tache, actor) {
|
||||
const tacheOuCommune = tache.getTacheOuCommune()
|
||||
return {
|
||||
key: tache.id,
|
||||
label: tache.name,
|
||||
value: tache.system.difficulte,
|
||||
tache: tache,
|
||||
comp: actor.getCompetence(tache.system.competence)
|
||||
tacheCommune: tache.system.tacheCommune,
|
||||
value: tacheOuCommune.system.difficulte,
|
||||
tache: tacheOuCommune,
|
||||
comp: actor.getCompetence(tacheOuCommune.system.competence),
|
||||
finished: tacheOuCommune.system.points_de_tache_courant >= tacheOuCommune.system.points_de_tache
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,9 +84,12 @@ export class RollPartTache extends RollPartSelect {
|
||||
}
|
||||
|
||||
onCreateUpdateItem(rollDialog, item, options, id) {
|
||||
if (item.type == ITEM_TYPES.tache && item.parent?.id == rollDialog.rollData.active.actor.id) {
|
||||
this.loadRefs(rollDialog.rollData)
|
||||
rollDialog.render()
|
||||
if (item.type == ITEM_TYPES.tache) {
|
||||
if (item.parent?.id == rollDialog.rollData.active.actor.id || item.isTacheCommune()) {
|
||||
// TODO: filtrer davantage
|
||||
this.loadRefs(rollDialog.rollData)
|
||||
rollDialog.render()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user