Fix minor points

This commit is contained in:
sladecraven 2021-04-28 17:37:20 +02:00
parent 36bb9ecd17
commit 6098003bf9
5 changed files with 99 additions and 11 deletions

View File

@ -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");

View File

@ -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();

View File

@ -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
{

View File

@ -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",

View File

@ -188,8 +188,16 @@
</div>
<div class="grid grid-2col">
<div>
<span class="generic-label">Compétences</span>
<ul class="item-list alterne-list">
<li class="item flexrow">
<span class=""></span>
<span class="generic-label">Compétence</span>
<span class="generic-label">Rôle?</span>
<span class="generic-label">Base</span>
<span class="generic-label">Malus</span>
<span class="generic-label">Bonus</span>
<span class=""></span>
</li>
{{#each competences as |competence key|}}
<li class="item flexrow list-item" data-item-id="{{competence._id}}">
<img class="sheet-competence-img" src="{{competence.img}}"/>
@ -249,11 +257,11 @@
<hr><span class="generic-label"><h3>Combat</h3></span>
<ul class="stat-list alternate-list">
<li class="stat flexrow" >
<span class="generic-label flexrow tooltip tooltip-nobottom" name="statlabel">Désignation</span>
<span class="flexrow tooltip tooltip-nobottom" name="statlabel">Valeur</span>
<span class="flexrow tooltip tooltip-nobottom" name="statlabel">Malus</span>
<span class="flexrow tooltip tooltip-nobottom" name="statlabel">Bonus</span>
<span class="flexrow tooltip tooltip-nobottom" name="statlabel">Total</span>
<span class="stat-label flexrow">Désignation</span>
<span class="stat-label flexrow">Base</span>
<span class="stat-label flexrow">Malus</span>
<span class="stat-label flexrow">Bonus</span>
<span class="stat-label flexrow">Total</span>
</li>
{{#each data.combat as |mycombat key|}}
<li class="stat flexrow list-item" data-attribute="{{key}}">
@ -328,7 +336,7 @@
<img class="sheet-competence-img" src="{{monnaie.img}}"/>
<span class="generic-label">{{monnaie.name}}</span>
<span class="generic-label">{{monnaie.data.nombre}}
(<a class="argent-moins">-</a>/<a class="argent-plus">+</a>)
(<a class="argent-moins plus-moins-button"> -</a>/<a class="argent-plus plus-moins-button">+</a>)
</span>
</span>
<div class="item-controls">
@ -346,7 +354,7 @@
<span class="arme-label"><a>{{arme.name}}</a></span>
<span class="">
{{#if (eq arme.type "tir")}}({{arme.data.munition}}
<a class="munition-moins">-</a>/<a class="munition-plus">+</a>)
<a class="munition-moins plus-moins-button">-</a>/<a class="munition-plus plus-moins-button">+</a>)
{{/if}}
</span>
<div class="item-controls">
@ -378,6 +386,9 @@
<img class="sheet-competence-img" src="{{equipement.img}}"/>
<span class="equipement-label">{{equipement.name}}</span>
<span class="equipement-label">{{equipement.data.quantite}}</span>
<span class="equipement-label">
(<a class="equipement-moins plus-moins-button">-</a>/<a class="equipement-plus plus-moins-button">+</a>)
</span>
<div class="item-controls">
<a class="item-control item-equip" title="Worn">{{#if equipement.data.equipee}}<i class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>