diff --git a/module/actor.js b/module/actor.js index 463c1a4d..e93cbf52 100644 --- a/module/actor.js +++ b/module/actor.js @@ -14,6 +14,7 @@ import { Grammar } from "./grammar.js"; import { RdDEncaisser } from "./rdd-roll-encaisser.js"; import { RdDCombat } from "./rdd-combat.js"; import { DeDraconique } from "./de-draconique.js"; +import { RdDAudio } from "./rdd-audio.js"; /* -------------------------------------------- */ /** @@ -2147,9 +2148,10 @@ export class RdDActor extends Actor { } /* -------------------------------------------- */ - async payerDenier( sumDenier, dataObj ) { + async payerDenier( sumDenier, dataObj=undefined ) { sumDenier = Number(sumDenier); let denierDisponible = 0; + let monnaie = this.data.items.filter( item => item.type =='monnaie'); for ( let piece of monnaie ) { denierDisponible += piece.data.valeur_deniers * Number(piece.data.quantite); @@ -2161,6 +2163,7 @@ export class RdDActor extends Actor { denierDisponible -= sumDenier; this.optimizeArgent(denierDisponible); msg = `Vous avez payé ${sumDenier} Deniers, qui ont été soustraits de votre argent.`; + RdDAudio.PlayContextAudio( "argent"); // Petit son } else { msg = "Vous n'avez pas assez d'argent pour paye cette somme !"; } diff --git a/module/rdd-audio.js b/module/rdd-audio.js new file mode 100644 index 00000000..1b3d6e18 --- /dev/null +++ b/module/rdd-audio.js @@ -0,0 +1,19 @@ + +/* -------------------------------------------- */ +const context2file = { + "argent": { file: "son_piece_monnaie.mp3", isGlobal: false } + } + +/* -------------------------------------------- */ +export class RdDAudio { + + /* -------------------------------------------- */ + static PlayContextAudio(context) { + let audioData = context2file[context]; + if ( audioData ) { + let audioPath = "systems/foundryvtt-reve-de-dragon/sounds/" + audioData.file; + console.log(`wfrp4e | Playing Sound: ${audioPath}`) + AudioHelper.play({ src: audioPath }, audioData.isGlobal); + } + } +} diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 0e55b7f5..ab60c6dc 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -898,11 +898,12 @@ export class RdDUtility { // Gestion du bouton payer html.on("click", '#payer-button', event => { let sumdenier = event.currentTarget.attributes['data-somme-denier'].value; - let jsondata = event.currentTarget.attributes['data-jsondata'].value + let jsondata = event.currentTarget.attributes['data-jsondata'] let objData - if ( jsondata) - objData = JSON.parse(jsondata) - console.log("Demande payr : ", objData); + if ( jsondata ) { + objData = JSON.parse(jsondata.value) + } + console.log("Demande payer : ", objData); if (game.user.character ) { game.user.character.payerDenier(sumdenier, objData); } else { diff --git a/packs/equipement.db b/packs/equipement.db index 47f7196b..de43cd27 100644 --- a/packs/equipement.db +++ b/packs/equipement.db @@ -22,10 +22,10 @@ {"_id":"7YuWWsFIuZgakGUS","name":"Mortier en marbre","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"objet","data":{"description":"","quantite":1,"encombrement":0.3,"equipe":false,"resistance":0,"qualite":0,"cout":0.2},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/mortier.webp","effects":[]} {"_id":"7c7CO626TCo4lg8b","name":"Petite scie cadre","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"objet","data":{"description":"","quantite":1,"encombrement":1,"equipe":false,"resistance":0,"qualite":0,"cout":6},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/scie.webp","effects":[]} {"_id":"7u9yAlaFhKcVdEC6","name":"Matériel de chirurgie","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"objet","data":{"description":"
(pincettes, lancette, crin, aiguille)
","quantite":1,"encombrement":0.06,"equipe":false,"resistance":0,"qualite":0,"cout":1},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/materiel_chirurgie.webp","effects":[]} -{"_id":"7xFe41JZIVNMLv1U","name":"Masse lourde","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"","quantite":1,"encombrement":3,"equipe":false,"dommages":"3/4","force":"12/11","resistance":10,"competence":"Masse à 1 main","cout":4,"portee_courte":0,"portee_moyenne":0,"portee_extreme":0,"rapide":false,"deuxmains":true,"unemain":true},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/armes_armures/masse_lourde.webp","effects":[]} +{"_id":"7xFe41JZIVNMLv1U","name":"Masse lourde","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"","quantite":1,"encombrement":3,"equipe":false,"dommages":"3/4","force":"12/11","resistance":10,"competence":"Masse à 1 main","cout":4,"portee_courte":0,"portee_moyenne":0,"portee_extreme":0,"rapide":false,"deuxmains":true,"unemain":true,"penetration":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/armes_armures/masse_lourde.webp","effects":[]} {"_id":"8bwP6zncdFP0O9ew","name":"Corde (10 m)","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"objet","data":{"description":"","quantite":1,"encombrement":1,"equipe":false,"resistance":0,"qualite":0,"cout":0.3},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/corde.webp","effects":[]} {"_id":"9cLkTDugz84gpHUB","name":"Bitume de Camphre","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"potion","data":{"description":"Crème sirupeuse grisâtre.
","quantite":1,"encombrement":0.1,"rarete":"","categorie":"Alchimie","cout":2},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/bitume_de_camphre.webp","effects":[]} -{"_id":"9jbjDpbddL2Ep09s","name":"Hache de bataille","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"","quantite":1,"encombrement":2,"equipe":false,"dommages":"3/4","force":"12/11","resistance":8,"competence":"Hache à 1 main","cout":15,"portee_courte":0,"portee_moyenne":0,"portee_extreme":0,"rapide":false,"deuxmains":true,"unemain":true},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/armes_armures/hache_bataille.webp","effects":[]} +{"_id":"9jbjDpbddL2Ep09s","name":"Hache de bataille","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"","quantite":1,"encombrement":2,"equipe":false,"dommages":"3/4","force":"12/11","resistance":8,"competence":"Hache à 1 main","cout":15,"portee_courte":0,"portee_moyenne":0,"portee_extreme":0,"rapide":false,"deuxmains":true,"unemain":true,"penetration":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/armes_armures/hache_bataille.webp","effects":[]} {"_id":"A3jx5dPkk5IeXSXn","name":"Lait de lune","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"potion","data":{"description":"Fluide.
\nLait de laie.
","quantite":1,"encombrement":0.1,"rarete":"","categorie":"Alchimie","cout":1},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/lait_de_lune.webp","effects":[]} {"_id":"A9nMgTyEwYzdA0zT","name":"Manteau de velours","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"objet","data":{"description":"","quantite":1,"encombrement":1,"equipe":false,"resistance":0,"qualite":0,"cout":10},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/manteau_velours.webp","effects":[]} {"_id":"AOQsKTjIbcy8NV9t","name":"Pierre à aiguiser","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"objet","data":{"description":"","quantite":1,"encombrement":0.2,"equipe":false,"resistance":0,"qualite":0,"cout":0.3},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/pierre_a_aiguiser.webp","effects":[]} @@ -60,7 +60,7 @@ {"_id":"K4n2JuDnoHDUPCZG","name":"Bouilloire de fer (2 litres)","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"conteneur","data":{"description":"","capacite":1,"encombrement":0.5,"equipe":false,"qualite":0,"contenu":[],"cout":0.5},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/bouilloire.webp","effects":[]} {"_id":"KQZIK8ltQ3sQiDGe","name":"Mailles de Fer","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"armure","data":{"description":"Grand haubert de mailles avec capuche À enfiler sur une cotte de cuir souple ou de drap matelassé) + bottes de cuir / métal.
\n","quantite":1,"encombrement":6,"equipe":false,"protection":5,"deterioration":null,"malus":-4,"cout":50},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/armes_armures/mailles.webp","effects":[]} {"_id":"KlydiUbayqBgJB6J","name":"Tablette de cire","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"objet","data":{"description":"","quantite":1,"encombrement":0.1,"equipe":false,"resistance":0,"qualite":0,"cout":0.2},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/tablette_cire.webp","effects":[]} -{"_id":"KmfftnkUsPQD6fV0","name":"Épée bâtarde","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"
Comme son nom l’indique, c’est une bâtarde de l'épée longue et de l'épée sorde, à la fois longue et large, pouvant s’utiliser à une ou deux mains.
","quantite":1,"encombrement":3,"equipe":false,"dommages":"4/5","force":"13/12","resistance":14,"competence":"Epée à 1 main","cout":30,"portee_courte":0,"portee_moyenne":0,"portee_extreme":0,"rapide":false,"deuxmains":true,"unemain":true},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/armes_armures/epee_batarde.webp","effects":[]} +{"_id":"KmfftnkUsPQD6fV0","name":"Épée bâtarde","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"Comme son nom l’indique, c’est une bâtarde de l'épée longue et de l'épée sorde, à la fois longue et large, pouvant s’utiliser à une ou deux mains.
","quantite":1,"encombrement":3,"equipe":false,"dommages":"4/5","force":"13/12","resistance":14,"competence":"Epée à 1 main","cout":30,"portee_courte":0,"portee_moyenne":0,"portee_extreme":0,"rapide":false,"deuxmains":true,"unemain":true,"penetration":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/armes_armures/epee_batarde.webp","effects":[]} {"name":"Gemme Inconnue","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"objet","data":{"description":"","quantite":1,"encombrement":null,"equipe":false,"resistance":0,"qualite":0,"cout":0},"flags":{"core":{"sourceId":"Item.V3V3wUXNCG6gzJFB"}},"img":"systems/foundryvtt-reve-de-dragon/icons/gemmes/seliphane.webp","effects":[],"_id":"KvzSNxISkWDoilO8"} {"_id":"LaAP5tsP1Sc43hKO","name":"Lanterne à huile","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"conteneur","data":{"description":"","capacite":0.3,"encombrement":1,"equipe":false,"qualite":0,"contenu":[],"cout":5},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/lanterne_huile.webp","effects":[]} {"_id":"LkE8EjPfao9m6Rn7","name":"Huile de Sélikanthe","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"potion","data":{"description":"Fluide.
\nLiquide légèrement huileux.
","quantite":1,"encombrement":0.1,"rarete":"","categorie":"Alchimie","cout":1},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/huile_de_selikanthe.webp","effects":[]} @@ -200,18 +200,3 @@ {"_id":"zQWlnUsd8bPySujd","name":"Aiguille à coudre","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"objet","data":{"description":"","quantite":1,"encombrement":0.01,"equipe":false,"resistance":0,"qualite":0,"cout":0.1},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/aiguille.webp","effects":[]} {"_id":"zYI8mDiysWtmsSyy","name":"Carquois","permission":{"default":0,"jOzRscDxoXZWpGS6":3},"type":"conteneur","data":{"description":"","capacite":2,"encombrement":0.1,"equipe":false,"qualite":0,"cout":0.5},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/carquois.webp","effects":[]} {"_id":"zlDa1vwmls6Uf4pt","name":"Bourse de cuir","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"conteneur","data":{"description":"","capacite":0.5,"encombrement":0.01,"equipe":false,"qualite":0,"contenu":[],"cout":0.1},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/bourse.webp","effects":[]} -{"_id":"lOI2HVu3B6EDY4sE","name":"Arbalète","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"Nie jusqu'à 2 points d'armure.
\nRechargement 1 round.
","quantite":1,"encombrement":3,"equipe":false,"dommages":"3","force":"0","resistance":0,"competence":"Arbalète","cout":34,"portee_courte":15,"portee_moyenne":30,"portee_extreme":70,"penetration":2,"rapide":false,"deuxmains":false,"unemain":false},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/arbalete.webp","effects":[]} -{"_id":"lOI2HVu3B6EDY4sE","name":"Arbalète","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"Nie jusqu'à 2 points d'armure.
\nRechargement 1 round.
","quantite":1,"encombrement":3,"equipe":false,"dommages":"3","force":"0","resistance":0,"competence":"Arbalète","cout":30,"portee_courte":15,"portee_moyenne":30,"portee_extreme":70,"penetration":2,"rapide":false,"deuxmains":false,"unemain":false},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/arbalete.webp","effects":[]} -{"_id":"lOI2HVu3B6EDY4sE","name":"Arbalète","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"Nie jusqu'à 2 points d'armure.
\nRechargement 1 round.
","quantite":1,"encombrement":3,"equipe":false,"dommages":"3","force":"0","resistance":0,"competence":"Arbalète","cout":30,"portee_courte":15,"portee_moyenne":30,"portee_extreme":70,"penetration":2,"rapide":false,"deuxmains":false,"unemain":false},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/arbalete.webp","effects":[]} -{"_id":"iGHudg5kBOfYWgwV","name":"Arc","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"Nie jusqu'à 2 points d'armure.
\nRechargement 1/2 round (s'il tire en début de round, il pourra recharger durant le reste du round pour tirer de nouveau au début du round suivant).
","quantite":1,"encombrement":1,"equipe":false,"dommages":"2","force":"0","resistance":0,"competence":"Arc","cout":10,"portee_courte":10,"portee_moyenne":20,"portee_extreme":50,"penetration":2,"rapide":false,"deuxmains":false,"unemain":false},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/arc.webp","effects":[]} -{"_id":"iCvphbPdxUcfqetd","name":"Aumônière","permission":{"default":0,"jOzRscDxoXZWpGS6":3},"type":"conteneur","data":{"description":"Comme une bourse, mais sous forme d'une coque en cuir rigide.
","capacite":0.25,"encombrement":0,"equipe":false,"qualite":0,"cout":0.2,"contenu":[]},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/aumoniere.webp","effects":[]} -{"_id":"lOI2HVu3B6EDY4sE","name":"Arbalète","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"Nie jusqu'à 2 points d'armure.
\nRechargement 1 round.
","quantite":1,"encombrement":3,"equipe":false,"dommages":"3","force":"0","resistance":0,"competence":"Arbalète","cout":30,"portee_courte":15,"portee_moyenne":30,"portee_extreme":70,"penetration":2,"rapide":false,"deuxmains":false,"unemain":false},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/arbalete.webp","effects":[]} -{"_id":"iGHudg5kBOfYWgwV","name":"Arc","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"Nie jusqu'à 2 points d'armure.
\nRechargement 1/2 round (s'il tire en début de round, il pourra recharger durant le reste du round pour tirer de nouveau au début du round suivant).
","quantite":1,"encombrement":1,"equipe":false,"dommages":"2","force":"0","resistance":0,"competence":"Arc","cout":10,"portee_courte":10,"portee_moyenne":20,"portee_extreme":50,"penetration":2,"rapide":false,"deuxmains":false,"unemain":false},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/arc.webp","effects":[]} -{"_id":"iCvphbPdxUcfqetd","name":"Aumônière","permission":{"default":0,"jOzRscDxoXZWpGS6":3},"type":"conteneur","data":{"description":"Comme une bourse, mais sous forme d'une coque en cuir rigide.
","capacite":0.25,"encombrement":0,"equipe":false,"qualite":0,"cout":0.2,"contenu":[]},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/aumoniere.webp","effects":[]} -{"_id":"iGHudg5kBOfYWgwV","name":"Arc","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"Nie jusqu'à 2 points d'armure.
\nRechargement 1/2 round (s'il tire en début de round, il pourra recharger durant le reste du round pour tirer de nouveau au début du round suivant).
","quantite":1,"encombrement":1,"equipe":false,"dommages":"2","force":"0","resistance":0,"competence":"Arc","cout":10,"portee_courte":10,"portee_moyenne":20,"portee_extreme":50,"penetration":2,"rapide":false,"deuxmains":false,"unemain":false},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/arc.webp","effects":[]} -{"_id":"1Dc4KzZageae7lhI","name":"Balles de jongleur","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"objet","data":{"description":"","quantite":4,"encombrement":0.1,"equipe":false,"resistance":0,"qualite":0,"cout":0.32},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/balle_jongleur.webp","effects":[]} -{"_id":"U6qli6TPbzj8tUdH","name":"Arme d’hast","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"","quantite":1,"encombrement":4,"equipe":false,"dommages":"4","force":"12","resistance":8,"competence":"Dague","cout":10,"portee_courte":0,"portee_moyenne":0,"portee_extreme":0,"rapide":false,"deuxmains":true,"unemain":false,"penetration":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/armes_armures/hast.webp","effects":[]} -{"_id":"cFnFQrQIPgyZRWdo","name":"Épée sorde","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"C’est une épée plus courte que la dragonne, mais plus large. Elle peut s’utiliser à une ou deux mains. Sa grande solidité en fait l’épée de prédilection des gardes et des soldats.
\nC’est probablement à elle que le Guerrier Sorde doit son nom (à moins que ce ne soit l’inverse).
","quantite":1,"encombrement":2,"equipe":false,"dommages":"3/4","force":"12/11","resistance":15,"competence":"Epée à 1 main","cout":20,"portee_courte":0,"portee_moyenne":0,"portee_extreme":0,"rapide":false,"deuxmains":true,"unemain":true,"penetration":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/armes_armures/epee_sord.webp","effects":[]} -{"_id":"KmfftnkUsPQD6fV0","name":"Épée bâtarde","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"Comme son nom l’indique, c’est une bâtarde de l'épée longue et de l'épée sorde, à la fois longue et large, pouvant s’utiliser à une ou deux mains.
","quantite":1,"encombrement":3,"equipe":false,"dommages":"4/5","force":"13/12","resistance":14,"competence":"Epée à 1 main","cout":30,"portee_courte":0,"portee_moyenne":0,"portee_extreme":0,"rapide":false,"deuxmains":true,"unemain":true,"penetration":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/armes_armures/epee_batarde.webp","effects":[]} -{"_id":"9jbjDpbddL2Ep09s","name":"Hache de bataille","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"","quantite":1,"encombrement":2,"equipe":false,"dommages":"3/4","force":"12/11","resistance":8,"competence":"Hache à 1 main","cout":15,"portee_courte":0,"portee_moyenne":0,"portee_extreme":0,"rapide":false,"deuxmains":true,"unemain":true,"penetration":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/armes_armures/hache_bataille.webp","effects":[]} -{"_id":"7xFe41JZIVNMLv1U","name":"Masse lourde","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"","quantite":1,"encombrement":3,"equipe":false,"dommages":"3/4","force":"12/11","resistance":10,"competence":"Masse à 1 main","cout":4,"portee_courte":0,"portee_moyenne":0,"portee_extreme":0,"rapide":false,"deuxmains":true,"unemain":true,"penetration":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/armes_armures/masse_lourde.webp","effects":[]} diff --git a/sounds/son_piece_monnaie.mp3 b/sounds/son_piece_monnaie.mp3 new file mode 100644 index 00000000..5e5d8d0d Binary files /dev/null and b/sounds/son_piece_monnaie.mp3 differ