Compare commits
13 Commits
foundryvtt
...
foundryvtt
| Author | SHA1 | Date | |
|---|---|---|---|
| cf8df182ba | |||
|
|
30cc8419c5 | ||
|
|
5ab6c5989e | ||
|
|
46df3d9f11 | ||
| 6a6759087c | |||
| a7ce1db7c5 | |||
| a0efefad3f | |||
| 8e0825b6b9 | |||
| 39d14c8496 | |||
| 89442ea6c6 | |||
| a66fe122c4 | |||
|
|
2e0abaa284 | ||
|
|
5bddc548de |
@@ -31,7 +31,7 @@ export class RdDBaseActorSheet extends ActorSheet {
|
||||
Monnaie.validerMonnaies(this.actor.itemTypes['monnaie']);
|
||||
|
||||
this.actor.recompute();
|
||||
const userRightLevel = this.actor.getUserLevel(game.user)
|
||||
const userRightLevel = game.user.isGM ? CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER : this.actor.getUserLevel(game.user)
|
||||
const options = duplicate(this.options);
|
||||
mergeObject(options, {
|
||||
isGM: game.user.isGM,
|
||||
|
||||
@@ -220,7 +220,7 @@ export class RdDBaseActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
|
||||
getQuantiteDisponible(item) {
|
||||
return item?.getQuantite();
|
||||
return item?.isService() ? undefined : item?.getQuantite();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@@ -310,6 +310,9 @@ export class RdDBaseActor extends Actor {
|
||||
|
||||
|
||||
async decrementerQuantiteItem(item, quantite, options = { supprimerSiZero: true }) {
|
||||
if (item.isService()) {
|
||||
return;
|
||||
}
|
||||
let resteQuantite = (item.system.quantite ?? 1) - quantite;
|
||||
if (resteQuantite <= 0) {
|
||||
if (options.supprimerSiZero) {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Misc } from "../misc.js";
|
||||
import { RdDBaseActor } from "./base-actor.js";
|
||||
|
||||
export class RdDCommerce extends RdDBaseActor {
|
||||
|
||||
|
||||
static get defaultIcon() {
|
||||
return "systems/foundryvtt-reve-de-dragon/icons/services/commerce.webp";
|
||||
}
|
||||
@@ -15,16 +15,16 @@ export class RdDCommerce extends RdDBaseActor {
|
||||
}
|
||||
|
||||
canReceive(item) {
|
||||
if (item.isInventaire('all')) {
|
||||
if (item.isInventaire('all')) {
|
||||
return true;
|
||||
}
|
||||
return super.canReceive(item);
|
||||
}
|
||||
|
||||
getQuantiteDisponible(item) {
|
||||
return this.system.illimite ? undefined : item.getQuantite();
|
||||
return this.system.illimite || item.isService() ? undefined : item.getQuantite();
|
||||
}
|
||||
|
||||
|
||||
verifierFortune(cout) {
|
||||
return this.system.illimite || super.verifierFortune(cout);
|
||||
}
|
||||
@@ -39,15 +39,15 @@ export class RdDCommerce extends RdDBaseActor {
|
||||
// ne pas consommer pour un commerce
|
||||
}
|
||||
|
||||
async decrementerQuantiteItem(itemVendu, quantite) {
|
||||
async decrementerQuantiteItem(item, quantite) {
|
||||
if (this.system.illimite) {
|
||||
return;
|
||||
}
|
||||
await super.decrementerQuantiteItem(itemVendu, quantite, {supprimerSiZero: false});
|
||||
await super.decrementerQuantiteItem(item, quantite, { supprimerSiZero: false });
|
||||
}
|
||||
|
||||
calculerPrix(item) {
|
||||
const pourcentage = this.system.pourcentage ?? 100;
|
||||
return Misc.keepDecimals(Math.ceil(item.system.cout * pourcentage)/100, 2);
|
||||
return Misc.keepDecimals(Math.ceil(item.system.cout * pourcentage) / 100, 2);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ export class DialogItemVente extends Dialog {
|
||||
|
||||
static async display({ item, callback, quantiteMax = undefined }) {
|
||||
const quantite = quantiteMax ?? item.getQuantite() ?? 1;
|
||||
const isOwned = item.isOwned;
|
||||
const isOwned = item.parent;
|
||||
const venteData = {
|
||||
item: item,
|
||||
alias: item.actor?.name ?? game.user.name,
|
||||
@@ -16,7 +16,7 @@ export class DialogItemVente extends Dialog {
|
||||
quantiteNbLots: quantite,
|
||||
quantiteMaxLots: quantite,
|
||||
quantiteMax: quantite,
|
||||
quantiteIllimite: !isOwned || quantiteMax == undefined,
|
||||
quantiteIllimite: item.isItemCommerce() ? quantiteMax == undefined : !isOwned,
|
||||
isOwned: isOwned,
|
||||
};
|
||||
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) {
|
||||
super.activateListeners(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(".quantiteNbLots").change(event => this.setNbLots(Number(event.currentTarget.value)));
|
||||
this.html.find(".quantiteIllimite").change(event => this.setQuantiteIllimite(event.currentTarget.checked));
|
||||
|
||||
@@ -223,15 +223,17 @@ export class RdDItem extends Item {
|
||||
}
|
||||
|
||||
getQuantite() {
|
||||
return Math.round(this.system.quantite ?? 0)
|
||||
return this.isService() ? undefined : Math.round(this.system.quantite ?? 0)
|
||||
}
|
||||
|
||||
getEncTotal() {
|
||||
return this.getEnc() * this.getQuantite();
|
||||
return (this.isService() ? 0 : this.getQuantite()) * this.getEnc();
|
||||
}
|
||||
|
||||
getEnc() {
|
||||
switch (this.type) {
|
||||
case 'service':
|
||||
return 0;
|
||||
case 'herbe':
|
||||
return this.getEncHerbe();
|
||||
case 'gemme':
|
||||
@@ -250,15 +252,19 @@ export class RdDItem extends Item {
|
||||
}
|
||||
|
||||
valeurTotale() {
|
||||
return this.getQuantite() * this.valeur()
|
||||
return (this.isService() ? 1 : this.getQuantite()) * this.valeur()
|
||||
}
|
||||
|
||||
valeur() {
|
||||
return this.system.cout ?? 0
|
||||
}
|
||||
|
||||
isItemCommerce() {
|
||||
return this.parent?.type == 'commerce';
|
||||
}
|
||||
|
||||
calculerPrixCommercant() {
|
||||
if (this.parent?.type == 'commerce') {
|
||||
if (this.isItemCommerce()) {
|
||||
// appliquer le pourcentage
|
||||
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-vehicule.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-initpremierround.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/enum-niveau-ethylisme.html',
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"id": "foundryvtt-reve-de-dragon",
|
||||
"title": "Rêve de Dragon",
|
||||
"version": "10.4.6",
|
||||
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.4.6.zip",
|
||||
"version": "10.4.9",
|
||||
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.4.9.zip",
|
||||
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json",
|
||||
"compatibility": {
|
||||
"minimum": "10",
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<a class="item-quantite-moins"><i class="fas fa-minus-square"></i></a>
|
||||
{{/if}}
|
||||
<input {{#unless options.isOwner}}disabled{{/unless}} type="number" data-dtype="Number"
|
||||
class="item-quantite" name="items[{{key}}].system.quantite"
|
||||
class="item-quantite" name="items[{{item._id}}].system.quantite"
|
||||
value="{{item.system.quantite}}" />
|
||||
{{#if options.isOwner}}
|
||||
<a class="item-quantite-plus"><i class="fas fa-plus-square"></i></a>
|
||||
@@ -31,7 +31,7 @@
|
||||
<span class="equipement-detail">
|
||||
{{#unless (and (eq item.type 'conteneur') (not vide))}}
|
||||
<input {{#unless options.isOwner}}disabled{{/unless}} type="number" data-dtype="Number"
|
||||
class="input-prix number-x3 item-cout" name="items[{{key}}].system.cout"
|
||||
class="input-prix number-x3 item-cout" name="items[{{item._id}}].system.cout"
|
||||
{{#if options.isObserver}}
|
||||
value="{{numberFormat item.system.cout decimals=2 sign=false}}"
|
||||
{{else}}
|
||||
@@ -41,24 +41,20 @@
|
||||
</span>
|
||||
<span class="equipement-actions item-controls">
|
||||
{{#if options.isOwner}}
|
||||
{{#if (and (eq item.type 'conteneur') (not vide))}}
|
||||
<a class="item-edit" title="Editer"><i class="fas fa-edit"></i></a>
|
||||
{{else}}
|
||||
<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))}}
|
||||
<a class="item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
|
||||
{{#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>
|
||||
{{/if}}
|
||||
{{#if (gt item.system.quantite 0)}}
|
||||
<a class="item-acheter" title="Acheter"><i class="fa-regular fa-coins"></i></a>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
{{#unless (and (eq item.type 'conteneur') (not vide))}}
|
||||
{{#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>
|
||||
{{/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>
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
@@ -2,19 +2,21 @@
|
||||
<img class="chat-icon" src="{{item.img}}" title="{{item.name}}" alt="{{item.name}}" />
|
||||
<h4>{{item.name}}</h4>
|
||||
<div class="flexcol">
|
||||
{{#if isOwned}}
|
||||
<div class="flexrow flex-group-left">
|
||||
{{#if quantiteIllimite}}
|
||||
<label>Quantité illimitée</label>
|
||||
{{else}}
|
||||
<label>Quantité disponible</label>
|
||||
<label>{{quantiteMax}}</label>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="flexrow flex-group-left">
|
||||
<label>Nombre de lots</label>
|
||||
<div class="flexrow">
|
||||
{{#unless isOwned}}
|
||||
<input name="quantiteIllimite" class="quantiteIllimite flex-shrink" type="checkbox" {{#if
|
||||
quantiteIllimite}}checked{{/if}} />
|
||||
<label class="label-quantiteIllimite flex-shrink">Illimités</label>
|
||||
<label class="label-quantiteIllimite flex-shrink">disponibles</label>
|
||||
{{/unless}}
|
||||
<input name="quantiteNbLots" class="quantiteNbLots flex-shrink number-x2" type="number" min="1"
|
||||
max="{{quantiteMaxLots}}" value="{{quantiteNbLots}}" data-dtype="Number" />
|
||||
@@ -22,8 +24,10 @@
|
||||
</div>
|
||||
<div class="flexrow flex-group-left">
|
||||
<label for="tailleLot">Taille d'un lot</label>
|
||||
<input name="tailleLot" class="tailleLot flex-shrink number-x2" type="number" min="1"
|
||||
max="{{quantiteMax}}" value="{{tailleLot}}" data-dtype="Number" />
|
||||
<span class="flexrow">
|
||||
<input name="tailleLot" class="tailleLot flex-shrink number-x2" type="number" min="1"
|
||||
max="{{quantiteMax}}" value="{{tailleLot}}" data-dtype="Number" />
|
||||
</span>
|
||||
</div>
|
||||
<div class="flexrow flex-group-left">
|
||||
<label>Prix unitaire</label>
|
||||
@@ -32,7 +36,7 @@
|
||||
<div class="flexrow flex-group-left">
|
||||
<label for="prixLot">Prix du lot</label>
|
||||
<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" />
|
||||
<label>Sols</label>
|
||||
</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>
|
||||
Reference in New Issue
Block a user