diff --git a/modules/mournblade-actor-sheet.js b/modules/mournblade-actor-sheet.js index 11666c4..aa8f3b8 100644 --- a/modules/mournblade-actor-sheet.js +++ b/modules/mournblade-actor-sheet.js @@ -53,6 +53,7 @@ export class MournbladeActorSheet extends ActorSheet { metier: duplicate(this.actor.getMetier() || {}), combat: this.actor.getCombatValues(), equipements: duplicate(this.actor.getEquipments()), + monnaies: duplicate(this.actor.getMonnaies()), description: await TextEditor.enrichHTML(this.object.system.biodata.description, {async: true}), options: this.options, owner: this.document.isOwner, @@ -95,7 +96,7 @@ export class MournbladeActorSheet extends ActorSheet { let value = ev.currentTarget.value this.actor.editItemField(itemId, itemType, itemField, dataType, value) }) - + html.find('.quantity-minus').click(event => { const li = $(event.currentTarget).parents(".item"); this.actor.incDecQuantity( li.data("item-id"), -1 ); @@ -131,7 +132,16 @@ export class MournbladeActorSheet extends ActorSheet { let armeId = li.data("item-id") this.actor.rollArmeDegats(armeId) }) - + html.find('.quantity-modify').click(event => { + const li = $(event.currentTarget).parents(".item") + const value = Number($(event.currentTarget).data("quantite-value")) + this.actor.incDecQuantity( li.data("item-id"), value ); + }) + html.find('.item-add').click((event) => { + const itemType = $(event.currentTarget).data("type") + this.actor.createEmbeddedDocuments('Item', [{ name: `Nouveau ${itemType}`, type: itemType }], { renderSheet: true }) + }) + html.find('.lock-unlock-sheet').click((event) => { this.options.editScore = !this.options.editScore; diff --git a/modules/mournblade-actor.js b/modules/mournblade-actor.js index de43528..b6e9728 100644 --- a/modules/mournblade-actor.js +++ b/modules/mournblade-actor.js @@ -96,27 +96,33 @@ export class MournbladeActor extends Actor { armes.push(this.prepareBouclier(arme)) } } + MournbladeUtility.sortArrayObjectsByName(armes) return armes } /* -------------------------------------------- */ - getDons() { - return this.items.filter(item => item.type == "don") + getItemSorted( types) { + let items = this.items.filter(item => types.includes(item.type )) || [] + MournbladeUtility.sortArrayObjectsByName(items) + return items + } + getDons() { + return this.getItemSorted(["don"]) } - /* -------------------------------------------- */ getTendances() { - return this.items.filter(item => item.type == "tendance") + return this.getItemSorted(["tendance"]) } getRunes() { - return this.items.filter(item => item.type == "rune") + return this.getItemSorted(["rune"]) } - /* -------------------------------------------- */ getEquipments() { - return this.items.filter(item => item.type == "equipement") + return this.getItemSorted(["monnaie"]) + } + getMonnaies() { + return this.getItemSorted(["monnaie"]) } - /* -------------------------------------------- */ getArmors() { - return this.items.filter(item => item.type == "protection") + return this.getItemSorted(["protection"]) } getOrigine() { return this.items.find(item => item.type == "origine") @@ -147,17 +153,8 @@ export class MournbladeActor extends Actor { comp.push(item) } } - return comp.sort(function (a, b) { - let fa = a.name.toLowerCase(), - fb = b.name.toLowerCase(); - if (fa < fb) { - return -1; - } - if (fa > fb) { - return 1; - } - return 0; - }) + MournbladeUtility.sortArrayObjectsByName(comp) + return comp } /* -------------------------------------------- */ @@ -359,11 +356,10 @@ export class MournbladeActor extends Actor { async incDecQuantity(objetId, incDec = 0) { let objetQ = this.items.get(objetId) if (objetQ) { - let newQ = objetQ.system.quantity + incDec; - const updated = await this.updateEmbeddedDocuments('Item', [{ _id: objetQ.id, 'system.quantity': newQ }]); // pdates one EmbeddedEntity + let newQ = objetQ.system.quantite + incDec; + const updated = await this.updateEmbeddedDocuments('Item', [{ _id: objetQ.id, 'system.quantite': newQ }]); // pdates one EmbeddedEntity } } - /* -------------------------------------------- */ getCompetence(compId) { return this.items.get(compId) diff --git a/modules/mournblade-main.js b/modules/mournblade-main.js index 690823f..e25935b 100644 --- a/modules/mournblade-main.js +++ b/modules/mournblade-main.js @@ -68,7 +68,8 @@ function welcomeMessage() { content: `
Les livres de Mournblade sont nécessaires pour jouer : https://www.titam-france.fr
-Mournblade est jeude rôle publié par Titam France/Sombres projets, tout les droits leur appartiennent.
+
Mournblade est jeu de rôle publié par Titam France/Sombres projets, tout les droits leur appartiennent.
+Système développé par LeRatierBretonnien, support sur le Discord FR de Foundry.
` }); } diff --git a/modules/mournblade-utility.js b/modules/mournblade-utility.js index 5480e32..2399ec3 100644 --- a/modules/mournblade-utility.js +++ b/modules/mournblade-utility.js @@ -67,6 +67,13 @@ export class MournbladeUtility { return opt.concat("\n") } + /* -------------------------------------------- */ + static sortArrayObjectsByName(myArray) { + myArray.sort((a, b) => { + return a.name.localeCompare(b.name); + }) + } + /* -------------------------------------------- */ static getPointAmeOptions() { let opt = [] diff --git a/system.json b/system.json index 40678e9..860bd8e 100644 --- a/system.json +++ b/system.json @@ -1,7 +1,7 @@ { "id": "fvtt-mournblade", "description": "Mournblade RPG for FoundryVTT", - "version": "10.0.12", + "version": "10.0.13", "authors": [ { "name": "Uberwald/LeRatierBretonnien", @@ -15,7 +15,7 @@ "gridUnits": "m", "license": "LICENSE.txt", "manifest": "https://www.uberwald.me/gitea/public/fvtt-mournblade/raw/branch/v10/system.json", - "download": "https://www.uberwald.me/gitea/public/fvtt-mournblade/archive/fvtt-mournblade-10.0.12.zip", + "download": "https://www.uberwald.me/gitea/public/fvtt-mournblade/archive/fvtt-mournblade-10.0.13.zip", "packs": [ { "type": "Item", @@ -137,7 +137,6 @@ "background": "systems/fvtt-mournblade/assets/ui/fond_mournblade.webp", "compatibility": { "minimum": "10", - "verified": "10.286", - "maximum": "10" + "verified": "10.288" } } \ No newline at end of file diff --git a/template.json b/template.json index 53fe431..cdb5241 100644 --- a/template.json +++ b/template.json @@ -233,6 +233,8 @@ ] }, "monnaie": { + "quantite": 0, + "unite": "", "templates": [ "base" ] diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index 5913c80..c1233c2 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -277,7 +277,7 @@ - + @@ -291,7 +291,7 @@