Autoformat

This commit is contained in:
Vincent Vandemeulebrouck 2022-01-01 14:01:41 +01:00
parent 25420cb481
commit bb1d03c8a4
6 changed files with 24 additions and 23 deletions

View File

@ -80,7 +80,7 @@ export class RdDActorSheet extends ActorSheet {
formData.competences.forEach(item => { formData.competences.forEach(item => {
item.visible = this.options.cherchercompetence item.visible = this.options.cherchercompetence
? RdDItemCompetence.nomContientTexte(item, this.options.cherchercompetence) ? RdDItemCompetence.nomContientTexte(item, this.options.cherchercompetence)
: ( !this.options.showCompNiveauBase || !RdDItemCompetence.isNiveauBase(item) ); : (!this.options.showCompNiveauBase || !RdDItemCompetence.isNiveauBase(item));
RdDItemCompetence.levelUp(item, formData.data.compteurs.experience.value); RdDItemCompetence.levelUp(item, formData.data.compteurs.experience.value);
}); });
@ -135,6 +135,7 @@ export class RdDActorSheet extends ActorSheet {
this.actor.addSubacteur(dragData.id || dragData.data._id); this.actor.addSubacteur(dragData.id || dragData.data._id);
super._onDropActor(event, dragData); super._onDropActor(event, dragData);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async _onDropItem(event, dragData) { async _onDropItem(event, dragData) {
const destItemId = RdDSheetUtility.getItemId(event); const destItemId = RdDSheetUtility.getItemId(event);
@ -215,7 +216,7 @@ export class RdDActorSheet extends ActorSheet {
this.createEmptyTache(); this.createEmptyTache();
}); });
html.find('.creer-un-objet').click(async event => { html.find('.creer-un-objet').click(async event => {
RdDUtility.selectObjetType( this ); RdDUtility.selectObjetType(this);
}); });
html.find('.creer-une-oeuvre').click(async event => { html.find('.creer-une-oeuvre').click(async event => {
RdDUtility.selectTypeOeuvre(this); RdDUtility.selectTypeOeuvre(this);
@ -324,7 +325,7 @@ export class RdDActorSheet extends ActorSheet {
// Roll Weapon1 // Roll Weapon1
html.find('.arme-label a').click(async event => { html.find('.arme-label a').click(async event => {
let arme = this._getEventArmeCombat(event); let arme = this._getEventArmeCombat(event);
this.actor.rollArme( duplicate(arme) ); this.actor.rollArme(duplicate(arme));
}); });
// Initiative pour l'arme // Initiative pour l'arme
html.find('.arme-initiative a').click(async event => { html.find('.arme-initiative a').click(async event => {
@ -410,7 +411,7 @@ export class RdDActorSheet extends ActorSheet {
this.actor.updateCompetenceArchetype(compName, parseInt(event.target.value)); this.actor.updateCompetenceArchetype(compName, parseInt(event.target.value));
}); });
} }
html.find('.show-hide-competences').click(async event => { html.find('.show-hide-competences').click(async event => {
this.options.showCompNiveauBase = !this.options.showCompNiveauBase; this.options.showCompNiveauBase = !this.options.showCompNiveauBase;
this.render(true); this.render(true);

View File

@ -8,24 +8,24 @@ import { HtmlUtility } from "./html-utility.js";
import { Misc } from "./misc.js"; import { Misc } from "./misc.js";
import { RdDSheetUtility } from "./rdd-sheet-utility.js"; import { RdDSheetUtility } from "./rdd-sheet-utility.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
export class RdDActorVehiculeSheet extends ActorSheet { export class RdDActorVehiculeSheet extends ActorSheet {
/** @override */ /** @override */
static get defaultOptions() { static get defaultOptions() {
RdDUtility.initAfficheContenu(); RdDUtility.initAfficheContenu();
return mergeObject(super.defaultOptions, { return mergeObject(super.defaultOptions, {
classes: ["rdd", "sheet", "actor"], classes: ["rdd", "sheet", "actor"],
template: "systems/foundryvtt-reve-de-dragon/templates/actor-vehicule-sheet.html", template: "systems/foundryvtt-reve-de-dragon/templates/actor-vehicule-sheet.html",
width: 640, width: 640,
height: 720, height: 720,
tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac"}], tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac" }],
dragDrop: [{dragSelector: ".item-list .item", dropSelector: null}] dragDrop: [{ dragSelector: ".item-list .item", dropSelector: null }]
}); });
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_checkNull(items) { _checkNull(items) {
if (items && items.length) { if (items && items.length) {
return items; return items;
@ -67,10 +67,10 @@ export class RdDActorVehiculeSheet extends ActorSheet {
return formData; return formData;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async _onDropItem(event, dragData) { async _onDropItem(event, dragData) {
const destItemId = RdDSheetUtility.getItemId(event); const destItemId = $(event.target)?.closest('.item').attr('data-item-id');
const dropParams = RdDSheetUtility.prepareItemDropParameters(destItemId, this.actor.id, dragData, this.objetVersConteneur); const dropParams = RdDSheetUtility.prepareItemDropParameters(destItemId, this.actor.id, dragData, this.objetVersConteneur);
const callSuper = await this.actor.processDropItem(dropParams); const callSuper = await this.actor.processDropItem(dropParams);
if (callSuper) { if (callSuper) {
@ -94,7 +94,7 @@ export class RdDActorVehiculeSheet extends ActorSheet {
/* -------------------------------------------- */ /* -------------------------------------------- */
/** @override */ /** @override */
activateListeners(html) { activateListeners(html) {
super.activateListeners(html); super.activateListeners(html);
HtmlUtility._showControlWhen($(".gm-only"), game.user.isGM); HtmlUtility._showControlWhen($(".gm-only"), game.user.isGM);
@ -114,7 +114,7 @@ export class RdDActorVehiculeSheet extends ActorSheet {
}); });
html.find('.creer-un-objet').click(async event => { html.find('.creer-un-objet').click(async event => {
RdDUtility.selectObjetType( this ); RdDUtility.selectObjetType(this);
}); });
html.find('#nettoyer-conteneurs').click(async event => { html.find('#nettoyer-conteneurs').click(async event => {
this.actor.nettoyerConteneurs(); this.actor.nettoyerConteneurs();
@ -134,7 +134,7 @@ export class RdDActorVehiculeSheet extends ActorSheet {
}); });
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
/** @override */ /** @override */
setPosition(options = {}) { setPosition(options = {}) {

View File

@ -243,7 +243,7 @@ export class RdDItemSheet extends ItemSheet {
async _onDragStart(event) { async _onDragStart(event) {
console.log("_onDragStart", event); console.log("_onDragStart", event);
if ( event.target.classList.contains("entity-link") ) return; if (event.target.classList.contains("entity-link")) return;
const itemId = event.srcElement?.attributes["data-item-id"].value; const itemId = event.srcElement?.attributes["data-item-id"].value;
const item = this.actor.items.get(itemId); const item = this.actor.items.get(itemId);
@ -267,10 +267,10 @@ export class RdDItemSheet extends ItemSheet {
} }
const allowed = Hooks.call("dropActorSheetData", this.actor, this, data); const allowed = Hooks.call("dropActorSheetData", this.actor, this, data);
if ( allowed === false ) return; if (allowed === false) return;
// Handle different data types // Handle different data types
switch ( data.type ) { switch (data.type) {
case "Item": case "Item":
return this._onDropItem(event, data); return this._onDropItem(event, data);
} }

View File

@ -268,7 +268,7 @@ async function migrationPngWebp_1_5_34() {
await Item.updateDocuments(itemsUpdates); await Item.updateDocuments(itemsUpdates);
await Actor.updateDocuments(actorsUpdates); await Actor.updateDocuments(actorsUpdates);
game.actors.forEach(actor => { game.actors.forEach(actor => {
if (actor.data.token?.img && actor.data.token.img.match(regexOldPngJpg)){ if (actor.data.token?.img && actor.data.token.img.match(regexOldPngJpg)) {
actor.update({ "token.img": convertImgToWebp(actor.data.token.img) }); actor.update({ "token.img": convertImgToWebp(actor.data.token.img) });
} }
const actorItemsToUpdate = prepareDocumentsImgUpdate(actor.items); const actorItemsToUpdate = prepareDocumentsImgUpdate(actor.items);

View File

@ -33,7 +33,7 @@ export class RdDSheetUtility {
} }
} }
static async splitItem(item, actor, onSplit = ()=>{}) { static async splitItem(item, actor, onSplit = () => { }) {
const dialog = await DialogSplitItem.create(item, async (item, split) => { const dialog = await DialogSplitItem.create(item, async (item, split) => {
await RdDSheetUtility._onSplitItem(item, split, actor); await RdDSheetUtility._onSplitItem(item, split, actor);
onSplit(); onSplit();

View File

@ -339,7 +339,7 @@ export class RdDUtility {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static initAfficheContenu(actorId) { // persistent handling of conteneur show/hide static initAfficheContenu() { // persistent handling of conteneur show/hide
if (!this.afficheContenu) if (!this.afficheContenu)
this.afficheContenu = {}; this.afficheContenu = {};
} }