Merge pull request 'Corrections mineurs commerces et ventes' (#602) from VincentVk/foundryvtt-reve-de-dragon:v10 into v10
Reviewed-on: public/foundryvtt-reve-de-dragon#602
This commit is contained in:
commit
a7ce1db7c5
@ -4,7 +4,7 @@ export class DialogItemVente extends Dialog {
|
|||||||
|
|
||||||
static async display({ item, callback, quantiteMax = undefined }) {
|
static async display({ item, callback, quantiteMax = undefined }) {
|
||||||
const quantite = quantiteMax ?? item.getQuantite() ?? 1;
|
const quantite = quantiteMax ?? item.getQuantite() ?? 1;
|
||||||
const isOwned = item.isOwned;
|
const isOwned = item.parent;
|
||||||
const venteData = {
|
const venteData = {
|
||||||
item: item,
|
item: item,
|
||||||
alias: item.actor?.name ?? game.user.name,
|
alias: item.actor?.name ?? game.user.name,
|
||||||
@ -16,7 +16,7 @@ export class DialogItemVente extends Dialog {
|
|||||||
quantiteNbLots: quantite,
|
quantiteNbLots: quantite,
|
||||||
quantiteMaxLots: quantite,
|
quantiteMaxLots: quantite,
|
||||||
quantiteMax: quantite,
|
quantiteMax: quantite,
|
||||||
quantiteIllimite: !isOwned || quantiteMax == undefined,
|
quantiteIllimite: item.isItemCommerce() ? quantiteMax == undefined : !isOwned,
|
||||||
isOwned: isOwned,
|
isOwned: isOwned,
|
||||||
};
|
};
|
||||||
const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/dialog-item-vente.html`, venteData);
|
const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/dialog-item-vente.html`, venteData);
|
||||||
@ -41,8 +41,7 @@ export class DialogItemVente extends Dialog {
|
|||||||
activateListeners(html) {
|
activateListeners(html) {
|
||||||
super.activateListeners(html);
|
super.activateListeners(html);
|
||||||
this.html = html;
|
this.html = html;
|
||||||
HtmlUtility._showControlWhen(this.html.find(".quantiteNbLots"), !this.venteData.quantiteIllimite)
|
this.setQuantiteIllimite(this.venteData.quantiteIllimite);
|
||||||
|
|
||||||
this.html.find(".tailleLot").change(event => this.setTailleLot(Number(event.currentTarget.value)));
|
this.html.find(".tailleLot").change(event => this.setTailleLot(Number(event.currentTarget.value)));
|
||||||
this.html.find(".quantiteNbLots").change(event => this.setNbLots(Number(event.currentTarget.value)));
|
this.html.find(".quantiteNbLots").change(event => this.setNbLots(Number(event.currentTarget.value)));
|
||||||
this.html.find(".quantiteIllimite").change(event => this.setQuantiteIllimite(event.currentTarget.checked));
|
this.html.find(".quantiteIllimite").change(event => this.setQuantiteIllimite(event.currentTarget.checked));
|
||||||
|
@ -259,8 +259,12 @@ export class RdDItem extends Item {
|
|||||||
return this.system.cout ?? 0
|
return this.system.cout ?? 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isItemCommerce() {
|
||||||
|
return this.parent?.type == 'commerce';
|
||||||
|
}
|
||||||
|
|
||||||
calculerPrixCommercant() {
|
calculerPrixCommercant() {
|
||||||
if (this.parent?.type == 'commerce') {
|
if (this.isItemCommerce()) {
|
||||||
// appliquer le pourcentage
|
// appliquer le pourcentage
|
||||||
return this.parent.calculerPrix(this);
|
return this.parent.calculerPrix(this);
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,6 @@ export class RdDUtility {
|
|||||||
'systems/foundryvtt-reve-de-dragon/templates/enum-categorie-potion.html',
|
'systems/foundryvtt-reve-de-dragon/templates/enum-categorie-potion.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/enum-categorie-vehicule.html',
|
'systems/foundryvtt-reve-de-dragon/templates/enum-categorie-vehicule.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/enum-competence.html',
|
'systems/foundryvtt-reve-de-dragon/templates/enum-competence.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/enum-herbesoin-ingredient.html',
|
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/enum-heures.html',
|
'systems/foundryvtt-reve-de-dragon/templates/enum-heures.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/enum-initpremierround.html',
|
'systems/foundryvtt-reve-de-dragon/templates/enum-initpremierround.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/enum-niveau-ethylisme.html',
|
'systems/foundryvtt-reve-de-dragon/templates/enum-niveau-ethylisme.html',
|
||||||
|
@ -41,24 +41,20 @@
|
|||||||
</span>
|
</span>
|
||||||
<span class="equipement-actions item-controls">
|
<span class="equipement-actions item-controls">
|
||||||
{{#if options.isOwner}}
|
{{#if options.isOwner}}
|
||||||
{{#if (and (eq item.type 'conteneur') (not vide))}}
|
<a class="item-edit" title="Editer"><i class="fas fa-edit"></i></a>
|
||||||
<a class="item-edit" title="Editer"><i class="fas fa-edit"></i></a>
|
{{#unless (and (eq item.type 'conteneur') (not vide))}}
|
||||||
{{else}}
|
|
||||||
<a class="item-edit" title="Editer"><i class="fas fa-edit"></i></a>
|
|
||||||
<a class="item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
|
<a class="item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
|
||||||
{{#if (or item.parent.system.illimite (ne item.system.quantite 0))}}
|
{{#if (or item.parent.system.illimite (ne item.system.quantite 0))}}
|
||||||
<a class="item-vendre" title="Vendre"><i class="fas fa-comments-dollar"></i></a>
|
<a class="item-vendre" title="Vendre"><i class="fas fa-comments-dollar"></i></a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if (gt item.system.quantite 0)}}
|
{{/unless}}
|
||||||
<a class="item-acheter" title="Acheter"><i class="fa-regular fa-coins"></i></a>
|
{{/if}}
|
||||||
{{/if}}
|
{{#unless (and (eq item.type 'conteneur') (not vide))}}
|
||||||
{{/if}}
|
|
||||||
{{else}}
|
|
||||||
{{#if (or item.parent.system.illimite (gt item.system.quantite 0))}}
|
{{#if (or item.parent.system.illimite (gt item.system.quantite 0))}}
|
||||||
<a class="item-acheter" title="Acheter"><i class="fa-regular fa-coins"></i></a>
|
<a class="item-acheter" title="Acheter"><i class="fa-regular fa-coins"></i></a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
<a class="item-montrer" title="Montrer"><i class="fas fa-comment"></i></a>
|
||||||
<a class="item-montrer" title="Montrer"><i class="fas fa-comment"></i></a>
|
{{/unless}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
@ -2,19 +2,21 @@
|
|||||||
<img class="chat-icon" src="{{item.img}}" title="{{item.name}}" alt="{{item.name}}" />
|
<img class="chat-icon" src="{{item.img}}" title="{{item.name}}" alt="{{item.name}}" />
|
||||||
<h4>{{item.name}}</h4>
|
<h4>{{item.name}}</h4>
|
||||||
<div class="flexcol">
|
<div class="flexcol">
|
||||||
{{#if isOwned}}
|
|
||||||
<div class="flexrow flex-group-left">
|
<div class="flexrow flex-group-left">
|
||||||
|
{{#if quantiteIllimite}}
|
||||||
|
<label>Quantité illimitée</label>
|
||||||
|
{{else}}
|
||||||
<label>Quantité disponible</label>
|
<label>Quantité disponible</label>
|
||||||
<label>{{quantiteMax}}</label>
|
<label>{{quantiteMax}}</label>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
|
||||||
<div class="flexrow flex-group-left">
|
<div class="flexrow flex-group-left">
|
||||||
<label>Nombre de lots</label>
|
<label>Nombre de lots</label>
|
||||||
<div class="flexrow">
|
<div class="flexrow">
|
||||||
{{#unless isOwned}}
|
{{#unless isOwned}}
|
||||||
<input name="quantiteIllimite" class="quantiteIllimite flex-shrink" type="checkbox" {{#if
|
<input name="quantiteIllimite" class="quantiteIllimite flex-shrink" type="checkbox" {{#if
|
||||||
quantiteIllimite}}checked{{/if}} />
|
quantiteIllimite}}checked{{/if}} />
|
||||||
<label class="label-quantiteIllimite flex-shrink">Illimités</label>
|
<label class="label-quantiteIllimite flex-shrink">disponibles</label>
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
<input name="quantiteNbLots" class="quantiteNbLots flex-shrink number-x2" type="number" min="1"
|
<input name="quantiteNbLots" class="quantiteNbLots flex-shrink number-x2" type="number" min="1"
|
||||||
max="{{quantiteMaxLots}}" value="{{quantiteNbLots}}" data-dtype="Number" />
|
max="{{quantiteMaxLots}}" value="{{quantiteNbLots}}" data-dtype="Number" />
|
||||||
@ -22,8 +24,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="flexrow flex-group-left">
|
<div class="flexrow flex-group-left">
|
||||||
<label for="tailleLot">Taille d'un lot</label>
|
<label for="tailleLot">Taille d'un lot</label>
|
||||||
<input name="tailleLot" class="tailleLot flex-shrink number-x2" type="number" min="1"
|
<span class="flexrow">
|
||||||
max="{{quantiteMax}}" value="{{tailleLot}}" data-dtype="Number" />
|
<input name="tailleLot" class="tailleLot flex-shrink number-x2" type="number" min="1"
|
||||||
|
max="{{quantiteMax}}" value="{{tailleLot}}" data-dtype="Number" />
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flexrow flex-group-left">
|
<div class="flexrow flex-group-left">
|
||||||
<label>Prix unitaire</label>
|
<label>Prix unitaire</label>
|
||||||
@ -32,7 +36,7 @@
|
|||||||
<div class="flexrow flex-group-left">
|
<div class="flexrow flex-group-left">
|
||||||
<label for="prixLot">Prix du lot</label>
|
<label for="prixLot">Prix du lot</label>
|
||||||
<span class="flexrow">
|
<span class="flexrow">
|
||||||
<input name="prixLot" class="prixLot flex-shrink" type="number" value="{{numberFormat prixLot decimals=2 sign=false}}"
|
<input name="prixLot" class="prixLot flex-shrink number-x3" type="number" value="{{numberFormat prixLot decimals=2 sign=false}}"
|
||||||
data-dtype="Number" />
|
data-dtype="Number" />
|
||||||
<label>Sols</label>
|
<label>Sols</label>
|
||||||
</span>
|
</span>
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
<option value="Fausse Suppure">Fausse Suppure (Bonus 1, Brins : 11)</option>
|
|
||||||
<option value="Suppure">Suppure (Bonus 2, Brins : 10)</option>
|
|
||||||
<option value="Méritoine">Méritoine (Bonus 3, Brins : 9)</option>
|
|
||||||
<option value="Ortigal">Ortigal (Bonus 4, Brins : 8)</option>
|
|
||||||
<option value="Ortigal Noir">Ortigal Noir (Bonus 5, Brins : 7)</option>
|
|
||||||
<option value="Bélidane">Bélidane (Bonus 6, Brins : 6)</option>
|
|
||||||
<option value="Faux Murus">Faux Murus (Bonus 7, Brins : 5)</option>
|
|
||||||
<option value="Murus">Murus (Bonus 8, Brins : 4)</option>
|
|
||||||
<option value="Tanemiel">Tanemiel (Bonus 9, Brins : 3)</option>
|
|
||||||
<option value="Tanemiel Doré">Tanemiel Doré (Bonus 10, Brins : 2)</option>
|
|
||||||
<option value="Autre">Autre</option>
|
|
Loading…
Reference in New Issue
Block a user