Debug sorts, WIP
This commit is contained in:
parent
be04157fb0
commit
5b53d4c2c9
@ -262,9 +262,9 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getBestDraconic() {
|
getBestDraconic() {
|
||||||
const list = this.getDraconicList().sort((a, b) => b.data.niveau - a.data.niveau);
|
const list = this.getDraconicList().sort((a, b) => b.data.data.niveau - a.data.data.niveau);
|
||||||
if (list.length == 0) {
|
if (list.length == 0) {
|
||||||
return { name: "Aucun", data: { niveau: -11 } };
|
return { name: "Aucun", data: { name: "Aucun", data: { niveau: -11 } } };
|
||||||
}
|
}
|
||||||
return duplicate(list[0]);
|
return duplicate(list[0]);
|
||||||
}
|
}
|
||||||
@ -1742,13 +1742,14 @@ export class RdDActor extends Actor {
|
|||||||
let bestDraconic = this.getBestDraconic();
|
let bestDraconic = this.getBestDraconic();
|
||||||
for (let sort of sortList) {
|
for (let sort of sortList) {
|
||||||
let voie = sort.data.draconic.toLowerCase();
|
let voie = sort.data.draconic.toLowerCase();
|
||||||
let draconic = draconicList.find(it => it.data.categorie == 'draconic' && it.name.toLowerCase().includes(voie));
|
let draconic = draconicList.find(it => it.data.data.categorie == 'draconic' && it.data.name.toLowerCase().includes(voie));
|
||||||
|
//console.log(draconicList, bestDraconic, draconic, voie);
|
||||||
if (sort.name.toLowerCase().includes('aura')) {
|
if (sort.name.toLowerCase().includes('aura')) {
|
||||||
draconic = bestDraconic;
|
draconic = bestDraconic;
|
||||||
}
|
}
|
||||||
draconic = duplicate(draconic);
|
draconic = duplicate(draconic);
|
||||||
if (draconicDone[draconic.name] == undefined) {
|
if (draconicDone[draconic.name] == undefined) {
|
||||||
draconic.data.defaut_carac = 'reve';
|
draconic.data.data.defaut_carac = 'reve';
|
||||||
newDraconicList.push(draconic);
|
newDraconicList.push(draconic);
|
||||||
draconicDone[draconic.name] = newDraconicList.length - 1; // Patch local pour relier facilement voie/compétence
|
draconicDone[draconic.name] = newDraconicList.length - 1; // Patch local pour relier facilement voie/compétence
|
||||||
}
|
}
|
||||||
@ -2029,8 +2030,8 @@ export class RdDActor extends Actor {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async rollTache(id) {
|
async rollTache(id) {
|
||||||
let tache = duplicate(this.getTache(id));
|
let tache = duplicate(this.getTache(id));
|
||||||
let competence = duplicate(this.getCompetence(tache.data.competence));
|
let competence = this.getCompetence(tache.data.competence);
|
||||||
competence.data.defaut_carac = tache.data.carac; // Patch !
|
competence.data.data.defaut_carac = tache.data.carac; // Patch !
|
||||||
let rollData = {
|
let rollData = {
|
||||||
competence: competence,
|
competence: competence,
|
||||||
tache: tache,
|
tache: tache,
|
||||||
@ -2436,12 +2437,12 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getSortList() {
|
getSortList() {
|
||||||
return this.data.items.filter(it => it.type == "sort");
|
return this.data.items.filter(it => it.data.type == "sort");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getDraconicList() {
|
getDraconicList() {
|
||||||
return this.data.items.filter(it => it.data.categorie == 'draconic')
|
return this.data.items.filter(it => it.data.data.categorie == 'draconic')
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -3108,7 +3109,7 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_deleteStatusEffectsByIds(effectIds, options) {
|
_deleteStatusEffectsByIds(effectIds, options) {
|
||||||
this.deleteEmbeddedEntity('ActiveEffect', effectIds, options);
|
this.deleteEmbeddedDocument('ActiveEffect', effectIds, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -141,11 +141,12 @@ export class RdDRoll extends Dialog {
|
|||||||
|
|
||||||
function onLoad() {
|
function onLoad() {
|
||||||
let rollData = dialog.rollData;
|
let rollData = dialog.rollData;
|
||||||
|
console.log(rollData);
|
||||||
// Update html, according to data
|
// Update html, according to data
|
||||||
if (rollData.competence) {
|
if (rollData.competence) {
|
||||||
// Set the default carac from the competence item
|
// Set the default carac from the competence item
|
||||||
rollData.selectedCarac = rollData.carac[rollData.competence.data.defaut_carac];
|
rollData.selectedCarac = rollData.carac[rollData.competence.data.data.defaut_carac];
|
||||||
$("#carac").val(rollData.competence.data.defaut_carac);
|
$("#carac").val(rollData.competence.data.data.defaut_carac);
|
||||||
}
|
}
|
||||||
if (rollData.selectedSort) {
|
if (rollData.selectedSort) {
|
||||||
$("#draconic").val(rollData.selectedSort.data.listIndex); // Uniquement a la selection du sort, pour permettre de changer
|
$("#draconic").val(rollData.selectedSort.data.listIndex); // Uniquement a la selection du sort, pour permettre de changer
|
||||||
|
@ -186,7 +186,7 @@ export class EffetsDraconiques {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static toItems(item) {
|
static toItems(item) {
|
||||||
return (item?.entity === 'Actor') ? item.data.items : (item?.entity === 'Item') ? [Misc.data(item)] : [];
|
return (item?.documentName === 'Actor') ? item.data.items : (item?.documentName === 'Item') ? [Misc.data(item)] : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -11,7 +11,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="xp">Caractéristique</label>
|
<label for="xp">Caractéristique</label>
|
||||||
<select name="data.carac" id="caracselect" data-dtype="String">
|
<select name="data.carac" id="caracselect" data-dtype="String">
|
||||||
{{#select item.data.carac}}
|
{{#select data.carac}}
|
||||||
{{#each caracList as |carac key|}}
|
{{#each caracList as |carac key|}}
|
||||||
<option value="{{key}}">{{carac.label}}</option>
|
<option value="{{key}}">{{carac.label}}</option>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
@ -21,7 +21,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="xp">Compétence</label>
|
<label for="xp">Compétence</label>
|
||||||
<select name="data.competence" id="competenceselect" data-dtype="String">
|
<select name="data.competence" id="competenceselect" data-dtype="String">
|
||||||
{{#select item.data.competence}}
|
{{#select data.competence}}
|
||||||
{{#each competences as |competence key|}}
|
{{#each competences as |competence key|}}
|
||||||
<option value="{{competence.name}}">{{competence.name}}</option>
|
<option value="{{competence.name}}">{{competence.name}}</option>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
Loading…
Reference in New Issue
Block a user