Fix: gestion du focus #480

Merged
vincent.vandeme merged 1 commits from v1.4-focus into v1.4 2021-06-01 22:53:21 +02:00
5 changed files with 127 additions and 147 deletions

View File

@ -207,172 +207,165 @@ export class RdDActorSheet extends ActorSheet {
HtmlUtility._showControlWhen($(".gm-only"), game.user.isGM);
HtmlUtility._showControlWhen($(".appliquerFatigue"), ReglesOptionelles.isUsing("appliquer-fatigue"));
html.find('#show-hide-competences').click((event) => {
this.options.showCompNiveauBase = !this.options.showCompNiveauBase;
this.render(true);
});
// Everything below here is only needed if the sheet is editable
if (!this.options.editable) return;
html.find('.item-split').click(ev => {
const li = $(ev.currentTarget).parents(".item");
html.find('.item-split').click(async event => {
const li = $(event.currentTarget).parents(".item");
const item = this.actor.items.get(li.data("item-id"));
this.splitItem(item);
});
html.find('.item-edit').click(ev => {
const li = $(ev.currentTarget).parents(".item");
html.find('.item-edit').click(async event => {
const li = $(event.currentTarget).parents(".item");
const item = this.actor.items.get(li.data("item-id"));
item.sheet.render(true);
});
html.find('.display-label a').click((event) => {
html.find('.display-label a').click(async event => {
let myID = event.currentTarget.attributes['data-item-id'].value;
const item = this.actor.getEmbeddedDocument('Item', myID);
item.sheet.render(true);
});
html.find('.rencontre-delete').click(ev => {
const li = $(ev.currentTarget).parents(".item");
html.find('.rencontre-delete').click(async event => {
const li = $(event.currentTarget).parents(".item");
const rencontreKey = li.data("item-id");
this.actor.deleteTMRRencontre(rencontreKey);
});
html.find('.item-delete').click(ev => {
const li = $(ev.currentTarget).parents(".item");
html.find('.item-delete').click(async event => {
const li = $(event.currentTarget).parents(".item");
RdDUtility.confirmerSuppression(this, li);
});
html.find('.item-vendre').click(ev => {
const li = $(ev.currentTarget).parents(".item");
html.find('.item-vendre').click(async event => {
const li = $(event.currentTarget).parents(".item");
const itemId = li.data("item-id");
const item = this.actor.getObjet(itemId);
item?.proposerVente();
});
html.find('.item-action').click(ev => {
const li = $(ev.currentTarget).parents(".item");
html.find('.item-action').click(async event => {
const li = $(event.currentTarget).parents(".item");
const itemId = li.data("item-id");
const item = this.actor.getObjet(itemId);
this.actor.actionItem(item);
});
html.find('.subacteur-delete').click(ev => {
const li = $(ev.currentTarget).parents(".item");
html.find('.subacteur-delete').click(async event => {
const li = $(event.currentTarget).parents(".item");
RdDUtility.confirmerSuppressionSubacteur(this, li);
});
html.find('.encaisser-direct').click(ev => {
html.find('.encaisser-direct').click(async event => {
this.actor.encaisser();
});
html.find('.remise-a-neuf').click(ev => {
html.find('.remise-a-neuf').click(async event => {
if (game.user.isGM) {
this.actor.remiseANeuf();
ev.preventDefault();
}
});
html.find('.creer-tache').click(ev => {
html.find('.creer-tache').click(async event => {
this.createEmptyTache();
});
html.find('.creer-un-objet').click(ev => {
html.find('.creer-un-objet').click(async event => {
this.selectObjetType();
});
html.find('.creer-une-oeuvre').click(ev => {
html.find('.creer-une-oeuvre').click(async event => {
this.selectTypeOeuvre();
});
html.find('#nettoyer-conteneurs').click(ev => {
html.find('#nettoyer-conteneurs').click(async event => {
this.actor.nettoyerConteneurs();
});
// Blessure control
html.find('.blessure-control').click(ev => {
const li = $(ev.currentTarget).parents(".item");
let btype = li.data("blessure-type");
let index = li.data('blessure-index');
let active = $(ev.currentTarget).data('blessure-active');
html.find('.blessure-control').click(async event => {
const tr = $(event.currentTarget).parents(".item");
let btype = tr.data("blessure-type");
let index = tr.data('blessure-index');
let active = $(event.currentTarget).data('blessure-active');
//console.log(btype, index, active);
this.actor.manageBlessureFromSheet(btype, index, active).then(this.render(true));
await this.actor.manageBlessureFromSheet(btype, index, active);
});
// Blessure data
html.find('.blessures-soins').change(ev => {
const li = $(ev.currentTarget).parents(".item");
let btype = li.data('blessure-type');
let index = li.data('blessure-index');
let psoins = li.find('input[name=premiers_soins]').val();
let pcomplets = li.find('input[name=soins_complets]').val();
let jours = li.find('input[name=jours]').val();
let loc = li.find('input[name=localisation]').val();
html.find('.blessures-soins').change(async event => {
const tr = $(event.currentTarget).parents(".item");
let btype = tr.data('blessure-type');
let index = tr.data('blessure-index');
let psoins = tr.find('.blessure-premiers_soins').val();
let pcomplets = tr.find('.blessure-soins_complets').val();
let jours = tr.find('.blessure-jours').val();
let loc = tr.find('.blessure-localisation').val();
//console.log(btype, index, psoins, pcomplets, jours, loc);
this.actor.setDataBlessureFromSheet(btype, index, psoins, pcomplets, jours, loc).then(this.render(true));
await this.actor.setDataBlessureFromSheet(btype, index, psoins, pcomplets, jours, loc);
});
// Equip Inventory Item
html.find('.item-equip').click(ev => {
const li = $(ev.currentTarget).parents(".item");
html.find('.item-equip').click(async event => {
const li = $(event.currentTarget).parents(".item");
this.actor.equiperObjet(li.data("item-id"));
this.render(true);
});
// Roll Carac
html.find('.carac-label a').click((event) => {
html.find('.carac-label a').click(async event => {
let caracName = event.currentTarget.attributes.name.value;
this.actor.rollCarac(caracName.toLowerCase());
});
html.find('.chance-actuelle').click((event) => {
html.find('.chance-actuelle').click(async event => {
this.actor.rollCarac('chance-actuelle');
});
html.find('.chance-appel').click((event) => {
html.find('.chance-appel').click(async event => {
this.actor.rollAppelChance();
});
html.find('#jet-astrologie').click((event) => {
html.find('#jet-astrologie').click(async event => {
this.actor.astrologieNombresAstraux();
});
// Roll Skill
html.find('a.competence-label').click((event) => {
html.find('a.competence-label').click(async event => {
let compName = event.currentTarget.name;
this.actor.rollCompetence(compName);
});
html.find('.tache-label a').click((event) => {
html.find('.tache-label a').click(async event => {
const li = $(event.currentTarget).parents(".item");
let tacheId = li.data('item-id');
this.actor.rollTache(tacheId);
});
html.find('.meditation-label a').click((event) => {
html.find('.meditation-label a').click(async event => {
const li = $(event.currentTarget).parents(".item");
let meditationId = li.data('item-id');
this.actor.rollMeditation(meditationId);
});
html.find('.chant-label a').click((event) => {
html.find('.chant-label a').click(async event => {
const li = $(event.currentTarget).parents(".item");
let chantId = li.data('item-id');
this.actor.rollChant(chantId);
});
html.find('.danse-label a').click((event) => {
html.find('.danse-label a').click(async event => {
const li = $(event.currentTarget).parents(".item");
let danseId = li.data('item-id');
this.actor.rollDanse(danseId);
});
html.find('.musique-label a').click((event) => {
html.find('.musique-label a').click(async event => {
const li = $(event.currentTarget).parents(".item");
let musiqueId = li.data('item-id');
this.actor.rollMusique(musiqueId);
});
html.find('.oeuvre-label a').click((event) => {
html.find('.oeuvre-label a').click(async event => {
const li = $(event.currentTarget).parents(".item");
let oeuvreId = li.data('item-id');
this.actor.rollOeuvre(oeuvreId);
});
html.find('.jeu-label a').click((event) => {
html.find('.jeu-label a').click(async event => {
const li = $(event.currentTarget).parents(".item");
let jeuId = li.data('item-id');
this.actor.rollJeu(jeuId);
});
html.find('.recettecuisine-label a').click((event) => {
html.find('.recettecuisine-label a').click(async event => {
const li = $(event.currentTarget).parents(".item");
let recetteId = li.data('item-id');
this.actor.rollRecetteCuisine(recetteId);
});
html.find('.subacteur-label a').click((event) => {
html.find('.subacteur-label a').click(async event => {
const li = $(event.currentTarget).parents(".item");
let actorId = li.data('actor-id');
let actor = game.actors.get(actorId);
@ -382,26 +375,26 @@ export class RdDActorSheet extends ActorSheet {
});
// Boutons spéciaux MJs
html.find('.forcer-tmr-aleatoire').click((event) => {
html.find('.forcer-tmr-aleatoire').click(async event => {
this.actor.cacheTMRetMessage();
});
html.find('.afficher-tmr').click((event) => {
html.find('.afficher-tmr').click(async event => {
this.actor.afficheTMRetMessage();
});
// Points de reve actuel
html.find('.ptreve-actuel a').click((event) => {
html.find('.ptreve-actuel a').click(async event => {
this.actor.rollCarac('reve-actuel');
});
// Roll Weapon1
html.find('.arme-label a').click((event) => {
html.find('.arme-label a').click(async event => {
let armeName = event.currentTarget.text;
let competenceName = event.currentTarget.attributes['data-competence-name'].value;
this.actor.rollArme(competenceName, armeName);
});
// Initiative pour l'arme
html.find('.arme-initiative a').click((event) => {
html.find('.arme-initiative a').click(async event => {
let combatant = game.combat.data.combatants.find(c => c.actor.data._id == this.actor.data._id);
if (combatant) {
let armeName = event.currentTarget.attributes['data-arme-name'].value;
@ -412,193 +405,178 @@ export class RdDActorSheet extends ActorSheet {
}
});
// Display TMR, visuualisation
html.find('.visu-tmr').click((event) => {
html.find('.visu-tmr').click(async event => {
this.actor.displayTMR("visu");
});
// Display TMR, normal
html.find('.monte-tmr').click((event) => {
html.find('.monte-tmr').click(async event => {
this.actor.displayTMR("normal");
});
// Display TMR, fast
html.find('.monte-tmr-rapide').click((event) => {
html.find('.monte-tmr-rapide').click(async event => {
this.actor.displayTMR("rapide");
});
html.find('.dormir-une-heure').click((event) => {
html.find('.dormir-une-heure').click(async event => {
this.actor.dormir(1);
});
html.find('.dormir-chateau-dormant').click((event) => {
html.find('.dormir-chateau-dormant').click(async event => {
this.actor.dormirChateauDormant();
});
html.find('.enlever-tous-effets').click((event) => {
html.find('.enlever-tous-effets').click(async event => {
this.actor.enleverTousLesEffets();
});
html.find('.conteneur-name a').click((event) => {
html.find('.conteneur-name a').click(async event => {
let myID = event.currentTarget.attributes['data-item-id'].value;
RdDUtility.toggleAfficheContenu(myID);
this.render(true);
});
html.find('.carac-xp-augmenter').click((event) => {
html.find('.carac-xp-augmenter').click(async event => {
let caracName = event.currentTarget.name.replace("augmenter.", "");
this.actor.updateCaracXPAuto(caracName);
});
html.find('.competence-xp-augmenter').click((event) => {
html.find('.competence-xp-augmenter').click(async event => {
let compName = event.currentTarget.attributes.compname.value;
this.actor.updateCompetenceXPAuto(compName);
});
if (this.options.editCaracComp) {
// On carac change
html.find('.carac-value').change((event) => {
html.find('.carac-value').change(async event => {
let caracName = event.currentTarget.name.replace(".value", "").replace("data.carac.", "");
//console.log("Value changed :", event, caracName);
this.actor.updateCarac(caracName, parseInt(event.target.value));
});
html.find('.carac-xp').change((event) => {
html.find('.carac-xp').change(async event => {
let caracName = event.currentTarget.name.replace(".xp", "").replace("data.carac.", "");
//console.log("Value changed :", event, caracName);
this.actor.updateCaracXP(caracName, parseInt(event.target.value));
});
// On competence change
html.find('.competence-value').change((event) => {
html.find('.competence-value').change(async event => {
let compName = event.currentTarget.attributes.compname.value;
//console.log("Competence changed :", compName);
this.actor.updateCompetence(compName, parseInt(event.target.value));
});
// On competence xp change
html.find('.competence-xp').change((event) => {
html.find('.competence-xp').change(async event => {
let compName = event.currentTarget.attributes.compname.value;
this.actor.updateCompetenceXP(compName, parseInt(event.target.value));
});
// On competence xp change
html.find('.competence-xp-sort').change((event) => {
html.find('.competence-xp-sort').change(async event => {
let compName = event.currentTarget.attributes.compname.value;
this.actor.updateCompetenceXPSort(compName, parseInt(event.target.value));
});
// On competence archetype change
html.find('.competence-archetype').change((event) => {
html.find('.competence-archetype').change(async event => {
let compName = event.currentTarget.attributes.compname.value;
this.actor.updateCompetenceArchetype(compName, parseInt(event.target.value));
});
}
// Gestion du bouton lock/unlock
html.find('.lock-unlock-sheet').click((event) => {
html.find('#show-hide-competences').click(async event => {
this.options.showCompNiveauBase = !this.options.showCompNiveauBase;
this.render(true);
});
html.find('.lock-unlock-sheet').click(async event => {
this.options.editCaracComp = !this.options.editCaracComp;
this.render(true);
});
html.find('#show-hide-archetype').click((event) => {
html.find('#show-hide-archetype').click(async event => {
this.options.montrerArchetype = !this.options.montrerArchetype;
this.render(true);
});
html.find('.lock-unlock-controls').click((event) => {console.log("CONTROLS",this.options.hideControls)
html.find('.lock-unlock-controls').click(async event => {
this.options.hideControls = !this.options.hideControls;
this.render(true);
});
// On pts de reve change
html.find('.pointsreve-value').change((event) => {
html.find('.pointsreve-value').change(async event => {
let reveValue = event.currentTarget.value;
this.actor.update({ "data.reve.reve.value": reveValue });
});
// On seuil de reve change
html.find('.seuil-reve-value').change((event) => {
html.find('.seuil-reve-value').change(async event => {
console.log("seuil-reve-value", event.currentTarget)
this.actor.setPointsDeSeuil(event.currentTarget.value);
});
html.find('#attribut-protection-edit').change((event) => {
html.find('#attribut-protection-edit').change(async event => {
this.actor.updateAttributeValue(event.currentTarget.attributes.name.value, parseInt(event.target.value));
});
// On stress change
html.find('.compteur-edit').change((event) => {
html.find('.compteur-edit').change(async event => {
let fieldName = event.currentTarget.attributes.name.value;
this.actor.updateCompteurValue(fieldName, parseInt(event.target.value));
});
html.find('#ethylisme').change((event) => {
html.find('#ethylisme').change(async event => {
this.actor.setEthylisme(parseInt(event.target.value));
});
html.find('.stress-test').click((event) => {
html.find('.stress-test').click(async event => {
this.actor.transformerStress();
this.render(true);
});
html.find('.moral-malheureux').click((event) => {
html.find('.moral-malheureux').click(async event => {
this.actor.jetDeMoral('malheureuse');
this.render(true);
});
html.find('.moral-neutre').click((event) => {
html.find('.moral-neutre').click(async event => {
this.actor.jetDeMoral('neutre');
this.render(true);
});
html.find('.moral-heureux').click((event) => {
html.find('.moral-heureux').click(async event => {
this.actor.jetDeMoral('heureuse');
this.render(true);
});
html.find('#ethylisme-test').click((event) => {
html.find('#ethylisme-test').click(async event => {
this.actor.jetEthylisme();
this.render(true);
});
html.find('#jet-vie').click((event) => {
html.find('#jet-vie').click(async event => {
this.actor.jetVie();
this.render(true);
});
html.find('#jet-endurance').click((event) => {
html.find('#jet-endurance').click(async event => {
this.actor.jetEndurance();
this.render(true);
});
html.find('.monnaie-plus').click((event) => {
html.find('.monnaie-plus').click(async event => {
const li = $(event.currentTarget).parents(".item");
this.actor.monnaieIncDec(li.data("item-id"), 1);
this.render(true);
});
html.find('.monnaie-moins').click((event) => {
html.find('.monnaie-moins').click(async event => {
const li = $(event.currentTarget).parents(".item");
this.actor.monnaieIncDec(li.data("item-id"), -1);
this.render(true);
});
html.find('#vie-plus').click((event) => {
html.find('#vie-plus').click(async event => {
this.actor.santeIncDec("vie", 1);
this.render(true);
});
html.find('#vie-moins').click((event) => {
html.find('#vie-moins').click(async event => {
this.actor.santeIncDec("vie", -1);
this.render(true);
});
html.find('#endurance-plus').click((event) => {
html.find('#endurance-plus').click(async event => {
this.actor.santeIncDec("endurance", 1);
this.render(true);
});
html.find('#endurance-moins').click((event) => {
html.find('#endurance-moins').click(async event => {
this.actor.santeIncDec("endurance", -1);
this.render(true);
});
html.find('.data-sante-sonne').click((event) => {
html.find('.data-sante-sonne').click(async event => {
this.actor.setSonne(event.currentTarget.checked);
this.render(true);
});
html.find('#ptreve-actuel-plus').click((event) => {
html.find('#ptreve-actuel-plus').click(async event => {
this.actor.reveActuelIncDec(1);
this.render(true);
});
html.find('#ptreve-actuel-moins').click((event) => {
html.find('#ptreve-actuel-moins').click(async event => {
this.actor.reveActuelIncDec(-1);
this.render(true);
});
html.find('#fatigue-plus').click((event) => {
html.find('#fatigue-plus').click(async event => {
this.actor.santeIncDec("fatigue", 1);
this.render(true);
});
html.find('#fatigue-moins').click((event) => {
html.find('#fatigue-moins').click(async event => {
this.actor.santeIncDec("fatigue", -1);
this.render(true);
});
}

View File

@ -447,6 +447,7 @@ export class RdDActor extends Actor {
await this.verifierPotionsEnchantees();
message.content = `A la fin Chateau Dormant, ${message.content}<br>Un nouveau jour se lève`;
ChatMessage.create(message);
this.sheet.render(true);
}
/* -------------------------------------------- */
@ -576,6 +577,7 @@ export class RdDActor extends Actor {
}
}
ChatMessage.create(message);
this.sheet.render(true);
}
/* -------------------------------------------- */
@ -594,6 +596,7 @@ export class RdDActor extends Actor {
}
}
ChatMessage.create(message);
this.sheet.render(true);
}
/* -------------------------------------------- */
@ -3163,7 +3166,6 @@ export class RdDActor extends Actor {
const perteEndurance = await this.santeIncDec("endurance", -encaissement.endurance, { critiques: encaissement.critiques > 0 });
this.computeEtatGeneral();
this.sheet.render(false);
const actorData = Misc.data(this);
mergeObject(encaissement, {

View File

@ -1,21 +1,21 @@
<tr class="table-row alterne-row item" data-blessure-type="{{gravite}}" data-attribute={{key}} data-blessure-index="{{key}}" >
<td class="item-control blessure-control" title="Blessure {{title}}" data-blessure-active="{{bless.active}}">
{{#if bless.active}}
<i class="fas fa-skull-crossbones blessure-active-{{gravite}}"></i>
<i class="fas fa-skull-crossbones blessure-active-{{gravite}}" name="blessure-{{gravite}}-{{key}}-active"></i>
{{else}}
<i class="fas fa-skull-crossbones blessure-inactive"></i>
<i class="fas fa-skull-crossbones blessure-inactive" name="blessure-{{gravite}}-{{key}}-active"></i>
{{/if}}
</td>
<td>
<input class="blessures-soins" type="text" name='localisation' data-dtype="String" value="{{bless.loc}}"/>
<input class="blessures-soins blessure-localisation" type="text" name="blessure-{{gravite}}-{{key}}-localisation" data-dtype="String" value="{{bless.loc}}"/>
</td>
<td>
<input class="blessures-soins" type="text" name='premiers_soins' data-dtype="number" value="{{bless.premiers_soins}}"/>
<input class="blessures-soins blessure-premiers_soins" type="text" name="blessure-{{gravite}}-{{key}}-premiers_soins" data-dtype="number" value="{{bless.premiers_soins}}"/>
</td>
<td>
<input class="blessures-soins" type="text" name='soins_complets' data-dtype="number" value="{{bless.soins_complets}}"/>
<input class="blessures-soins blessure-soins_complets" type="text" name="blessure-{{gravite}}-{{key}}-soins_complets" data-dtype="number" value="{{bless.soins_complets}}"/>
</td>
<td>
<input class="blessures-soins" type="text" name='jours' data-dtype="number" value="{{bless.jours}}"/>
<input class="blessures-soins blessure-jours" type="text" name="blessure-{{gravite}}-{{key}}-jours" name="jours" data-dtype="number" value="{{bless.jours}}"/>
</td>
</tr>

View File

@ -10,21 +10,21 @@
<i class="fas fa-arrow-alt-circle-up"></i>
</a>
{{/if}}
<input class="competence-value" type="text" compname="{{name}}"
value="{{numberFormat data.niveau decimals=0 sign=true}}" data-dtype="number"
{{#unless @root.options.editCaracComp}}disabled{{/unless}} />
<input class="competence-xp" type="text" compname="{{name}}"
value="{{numberFormat data.xp decimals=0 sign=false}}" data-dtype="number"
{{#unless @root.options.editCaracComp}}disabled{{/unless}} />
<input class="competence-value" type="text" compname="{{name}}" name="comp-value-{{name}}"
value="{{numberFormat data.niveau decimals=0 sign=true}}" data-dtype="number"
{{#unless @root.options.editCaracComp}}disabled{{/unless}} />
<input class="competence-xp" type="text" compname="{{name}}" name="comp-xp-{{name}}"
value="{{numberFormat data.xp decimals=0 sign=false}}" data-dtype="number"
{{#unless @root.options.editCaracComp}}disabled{{/unless}} />
{{#if (eq data.categorie 'draconic')}}
<input class="competence-xp-sort" type="text" compname="{{name}}"
value="{{numberFormat data.xp_sort decimals=0 sign=false}}" data-dtype="number"
{{#unless @root.options.editCaracComp}}disabled{{/unless}}/>
<input class="competence-xp-sort" type="text" compname="{{name}}" name="comp-xp-sort-{{name}}"
value="{{numberFormat data.xp_sort decimals=0 sign=false}}" data-dtype="number"
{{#unless @root.options.editCaracComp}}disabled{{/unless}}/>
{{/if}}
{{#if @root.options.montrerArchetype}}
<input class="competence-archetype" type="text" compname="{{name}}"
value="{{numberFormat data.niveau_archetype decimals=0 sign=true}}" data-dtype="number"
{{#unless @root.options.editCaracComp}}disabled{{/unless}} />
<input class="competence-archetype" type="text" compname="{{name}}" name="comp-archetype-{{name}}"
value="{{numberFormat data.niveau_archetype decimals=0 sign=true}}" data-dtype="number"
{{#unless @root.options.editCaracComp}}disabled{{/unless}} />
{{/if}}
{{#unless @root.options.hideControls}}
<div class="item-controls">

View File

@ -432,11 +432,11 @@
<span class="competence-label">Refoulement : </span>
<span>
{{#if options.isGM}}
<input class="competence-value" type="text" name="data.reve.refoulement.value" value="{{data.reve.refoulement.value}}" data-dtype="Number"/>
<input class="competence-value" type="text" name="data.reve.refoulement.value" value="{{data.reve.refoulement.value}}" data-dtype="Number"/>
{{else}}
{{data.reve.refoulement.value}}
{{data.reve.refoulement.value}}
{{/if}}
</span>
</span>
</li>
</ul>
</div>