From 6098003bf9a202b92aa1ae57221e468de98b929b Mon Sep 17 00:00:00 2001 From: sladecraven Date: Wed, 28 Apr 2021 17:37:20 +0200 Subject: [PATCH] Fix minor points --- modules/vadentis-actor-sheet.js | 38 +++++++++++++++++++++++++++++++-- modules/vadentis-actor.js | 19 +++++++++++++++++ styles/simple.css | 24 +++++++++++++++++++++ system.json | 2 +- templates/actor-sheet.html | 27 ++++++++++++++++------- 5 files changed, 99 insertions(+), 11 deletions(-) diff --git a/modules/vadentis-actor-sheet.js b/modules/vadentis-actor-sheet.js index 93f787f..1c3a6d0 100644 --- a/modules/vadentis-actor-sheet.js +++ b/modules/vadentis-actor-sheet.js @@ -51,6 +51,30 @@ export class VadentisActorSheet extends ActorSheet { return data; } + /* -------------------------------------------- */ + async checkSort(sortId) { + await Dialog.confirm({ + title: "Lancer un sort", + content: "Etes vous certain de vouloir incanter ce sort ?", + yes: async () => { + this.actor.rollSort(sortId); + }, + no: () => {}, + }); + } + + /* -------------------------------------------- */ + async checkTechnique(techniqueId) { + await Dialog.confirm({ + title: "Utiliser une technique", + content: "Etes vous certain de vouloir utiliser cette Technique ?", + yes: async () => { + this.actor.rollTechnique(techniqueId); + }, + no: () => {}, + }); + } + /* -------------------------------------------- */ /** @override */ activateListeners(html) { @@ -81,6 +105,16 @@ export class VadentisActorSheet extends ActorSheet { const item = this.actor.getOwnedItem(li.data("item-id")); this.actor.incrementeMunition( item ); } ); + html.find('.equipement-moins').click(event => { + const li = $(event.currentTarget).parents(".item"); + const item = this.actor.getOwnedItem(li.data("item-id")); + this.actor.decrementeQuantite( item ); + } ); + html.find('.equipement-plus').click(event => { + const li = $(event.currentTarget).parents(".item"); + const item = this.actor.getOwnedItem(li.data("item-id")); + this.actor.incrementeQuantite( item ); + } ); html.find('.argent-moins').click(event => { const li = $(event.currentTarget).parents(".item"); @@ -109,12 +143,12 @@ export class VadentisActorSheet extends ActorSheet { html.find('.technique-label a').click((event) => { const li = $(event.currentTarget).parents(".item"); const techniqueId = li.data("item-id"); - this.actor.rollTechnique(techniqueId); + this.checkTechnique(techniqueId); }); html.find('.sort-label a').click((event) => { const li = $(event.currentTarget).parents(".item"); const sortId = li.data("item-id"); - this.actor.rollSort(sortId); + this.checkSort(sortId); }); html.find('.arme-label a').click((event) => { const li = $(event.currentTarget).parents(".item"); diff --git a/modules/vadentis-actor.js b/modules/vadentis-actor.js index ecfb6e0..4f489bc 100644 --- a/modules/vadentis-actor.js +++ b/modules/vadentis-actor.js @@ -451,6 +451,25 @@ export class VadentisActor extends Actor { } } + /* -------------------------------------------- */ + async incrementeQuantite( objet ) { + let objetQ = this.data.items.find( item => item._id == objet._id ); + if (objetQ) { + let newQ = objetQ.data.quantite + 1; + await this.updateOwnedItem( { _id: objetQ._id, 'data.quantite': newQ } ); + } + } + + /* -------------------------------------------- */ + async decrementeQuantite( objet ) { + let objetQ = this.data.items.find( item => item._id == objet._id ); + if (objetQ) { + let newQ = objetQ.data.quantite - 1; + newQ = (newQ <= 0) ? 0 : newQ; + await this.updateOwnedItem( { _id: objetQ._id, 'data.quantite': newQ } ); + } + } + /* -------------------------------------------- */ rollArme(armeId) { let target = VadentisUtility.getTarget(); diff --git a/styles/simple.css b/styles/simple.css index de335fa..c84858b 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -1060,15 +1060,39 @@ ul, li { margin:5px; } +.plus-moins-button { + box-shadow: inset 0px 1px 0px 0px #a6827e; + background: linear-gradient(to bottom, #21374afc 5%, #152833ab 100%); + background-color: #7d5d3b00; + border-radius: 3px; + border: 2px ridge #846109; + display: inline-block; + cursor: pointer; + color: #ffffff; + padding: 2px 6px 0px 6px; + text-decoration: none; + text-shadow: 0px 1px 0px #4d3534; + position: relative; + margin:3px; +} + +.plus-moins-button:hover, .chat-card-button:hover { background: linear-gradient(to bottom, #800000 5%, #3e0101 100%); background-color: red; } + +.plus-moins-button:active, .chat-card-button:active { position:relative; top:1px; } +.plus-moins { + font-size: 1.1rem; + font-weight: bold; +} + /*************************************************************/ #pause { diff --git a/system.json b/system.json index 4c44386..45e07fe 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "name": "foundryvtt-vadentis", "title": "Vadentis", "description": "Système Vadentis pour FoundryVTT", - "version": "0.1.7", + "version": "0.1.8", "manifestPlusVersion": "1.0.0", "minimumCoreVersion": "0.7.5", "compatibleCoreVersion": "0.7.9", diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index ec2215d..c524da1 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -188,8 +188,16 @@
- Compétences
    +
  • + + Compétence + Rôle? + Base + Malus + Bonus + +
  • {{#each competences as |competence key|}}
  • @@ -249,11 +257,11 @@

    Combat

    • - Désignation - Valeur - Malus - Bonus - Total + Désignation + Base + Malus + Bonus + Total
    • {{#each data.combat as |mycombat key|}}
    • @@ -328,7 +336,7 @@ {{monnaie.name}} {{monnaie.data.nombre}} - (-/+) + ( -/+)
      @@ -346,7 +354,7 @@ {{arme.name}} {{#if (eq arme.type "tir")}}({{arme.data.munition}} - -/+) + -/+) {{/if}}
      @@ -378,6 +386,9 @@ {{equipement.name}} {{equipement.data.quantite}} + + (-/+) +