Various fixes

This commit is contained in:
2023-03-11 12:11:27 +01:00
parent 02f8207fb7
commit f26cd7670c
11 changed files with 111 additions and 71 deletions

View File

@@ -141,7 +141,7 @@ export class HeritiersActor extends Actor {
return this.getItemSorted( ["capacitenaturelle"])
}
getFee() {
return this.items.filter(item => item.type =="fee")
return this.items.find(item => item.type =="fee")
}
getProfils() {
return this.getItemSorted( ["profil"])
@@ -174,23 +174,25 @@ export class HeritiersActor extends Actor {
}
/* -------------------------------------------- */
organizeUtileSkills() {
organizeUtileSkills(kind = "mental") {
let comp = {}
for (let key in game.system.lesheritiers.config.competenceProfil) {
if ( game.system.lesheritiers.config.competenceProfil[key].kind == kind)
comp[key] = []
}
for (let item of this.items) {
if (item.type == "competence") {
if (item.system.categorie == "utile") {
if (item.system.categorie == "utile" && comp[item.system.profil]) {
this.prepareUtileSkill(item)
comp[item.system.profil].push(item)
}
}
}
for (let key in comp) {
HeritiersUtility.sortArrayObjectsByName(comp[key])
}
return comp
return Object.fromEntries(Object.entries(comp).sort())
}
/* -------------------------------------------- */
organizeContacts() {
@@ -553,6 +555,16 @@ export class HeritiersActor extends Actor {
rollDialog.render(true)
}
/* -------------------------------------------- */
async rollRang(key, isInit = false) {
let rollData = this.getCommonRollData()
rollData.mode = "rang"
rollData.rang = this.system.rang[key]
rollData.rangKey = key
let rollDialog = await HeritiersRollDialog.create(this, rollData)
rollDialog.render(true)
}
/* -------------------------------------------- */
async rollCompetence(compId) {
let rollData = this.getCommonRollData(compId)