Fix: édition des compétences de créatures
This commit is contained in:
parent
912b1d3df3
commit
388629d36e
@ -847,17 +847,21 @@ export class RdDActor extends RdDBaseActor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async updateCreatureCompetence(idOrName, fieldName, compValue) {
|
||||
async updateCreatureCompetence(idOrName, fieldName, value) {
|
||||
let competence = this.getCompetence(idOrName);
|
||||
if (competence) {
|
||||
const update = { _id: competence.id }
|
||||
if (fieldName == "niveau")
|
||||
update['system.niveau'] = compValue;
|
||||
else if (fieldName == "dommages")
|
||||
update['system.dommages'] = compValue;
|
||||
else
|
||||
update['system.carac_value'] = compValue;
|
||||
await this.updateEmbeddedDocuments('Item', [update]); // updates one EmbeddedEntity
|
||||
function getPath(fieldName) {
|
||||
switch (fieldName) {
|
||||
case "niveau": return 'system.niveau';
|
||||
case "dommages": return 'system.dommages';
|
||||
case "carac_value": return 'system.carac_value';
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
const path = getPath(fieldName);
|
||||
if (path){
|
||||
await this.updateEmbeddedDocuments('Item', [{ _id: competence.id, [path]: value }]); // updates one EmbeddedEntity
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1158,6 +1158,8 @@ div.competence-column div.categorie-competence{
|
||||
margin-left: 4px;
|
||||
}
|
||||
.sante-value,
|
||||
.competence-carac,
|
||||
.competence-damage,
|
||||
.competence-value {
|
||||
flex-grow: 0;
|
||||
flex-basis: 2rem;
|
||||
|
@ -6,13 +6,13 @@
|
||||
<span>{{comp.name}}</span>
|
||||
</a>
|
||||
|
||||
<input class="competence-value creature-carac" type="text" compname="{{comp.name}}"
|
||||
<input class="competence-carac" type="text" compname="{{comp.name}}" name="{{comp._id}}.carac"
|
||||
value="{{comp.system.carac_value}}" data-dtype="number"
|
||||
{{#unless @root.options.vueDetaillee}}disabled{{/unless}}/>
|
||||
<input class="competence-value creature-niveau" type="text" compname="{{comp.name}}"
|
||||
<input class="competence-value creature-niveau" type="text" compname="{{comp.name}}" name="{{comp._id}}.niveau"
|
||||
value="{{numberFormat comp.system.niveau decimals=0 sign=true}}" data-dtype="number"
|
||||
{{#unless @root.options.vueDetaillee}}disabled{{/unless}}/>
|
||||
<input class="competence-value creature-dommages" type="text" compname="{{comp.name}}"
|
||||
<input class="competence-damage creature-dommages" type="text" compname="{{comp.name}}" name="{{comp._id}}.dommages"
|
||||
value="{{numberFormat comp.system.dommages decimals=0 sign=true}}" data-dtype="number"
|
||||
{{#unless @root.options.vueDetaillee}}disabled{{/unless}}/>
|
||||
{{#if @root.options.vueDetaillee}}
|
||||
|
Loading…
Reference in New Issue
Block a user