diff --git a/images/icons/.directory b/images/icons/.directory new file mode 100644 index 0000000..e08811e --- /dev/null +++ b/images/icons/.directory @@ -0,0 +1,6 @@ +[Dolphin] +SortRole=modificationtime +Timestamp=2023,2,26,15,32,34.892 +Version=4 +ViewMode=1 +VisibleRoles=Details_text,Details_size,Details_modificationtime,Details_creationtime,CustomizedDetails diff --git a/images/icons/resume.webp b/images/icons/resume.webp new file mode 100644 index 0000000..f1c5cdf Binary files /dev/null and b/images/icons/resume.webp differ diff --git a/images/icons/tirage.webp b/images/icons/tirage.webp new file mode 100644 index 0000000..70a58b2 Binary files /dev/null and b/images/icons/tirage.webp differ diff --git a/images/icons/tirer.webp b/images/icons/tirer.webp new file mode 100644 index 0000000..bc7efc6 Binary files /dev/null and b/images/icons/tirer.webp differ diff --git a/modules/malefices-actor-sheet.js b/modules/malefices-actor-sheet.js index 2bd7841..b6ae9c3 100644 --- a/modules/malefices-actor-sheet.js +++ b/modules/malefices-actor-sheet.js @@ -44,6 +44,9 @@ export class MaleficesActorSheet extends ActorSheet { phyMalus: this.actor.getPhysiqueMalus(), elementsbio: this.actor.getElementsBio(), sorts: this.actor.getSorts(), + description: await TextEditor.enrichHTML(this.object.system.description, { async: true }), + notes: await TextEditor.enrichHTML(this.object.system.notes, { async: true }), + equipementlibre: await TextEditor.enrichHTML(this.object.system.equipementlibre, { async: true }), options: this.options, owner: this.document.isOwner, editScore: this.options.editScore, diff --git a/modules/malefices-commands.js b/modules/malefices-commands.js index e9235cf..483fb99 100644 --- a/modules/malefices-commands.js +++ b/modules/malefices-commands.js @@ -12,6 +12,7 @@ export class MaleficesCommands { if (!game.system.malefices.commands) { const commands = new MaleficesCommands(); commands.registerCommand({ path: ["/tirage"], func: (content, msg, params) => MaleficesCommands.createTirage(msg), descr: "Tirage des tarots" }); + commands.registerCommand({ path: ["/carte"], func: (content, msg, params) => MaleficesCommands.tirerCarte(msg), descr: "Tirer une carte" }); commands.registerCommand({ path: ["/resume"], func: (content, msg, params) => MaleficesCharacterSummary.displayPCSummary(), descr: "Affiche la liste des PJs!" }); game.system.malefices.commands = commands; } @@ -105,7 +106,7 @@ export class MaleficesCommands { ChatMessage.create(msg); } - /* -------------------------------------------- */ + /* --------------------------------------------- */ static async createTirage(msg) { if (game.user.isGM) { let tirageData = { @@ -127,5 +128,19 @@ export class MaleficesCommands { tirageDialog.render(true) } } + /* --------------------------------------------- */ + static async tirerCarte(msg) { + let deck = MaleficesUtility.getTarots() + let index = Math.round(Math.random() * (deck.length-1)) + let selectedCard = deck[index] + selectedCard.system.ispositif = true + if ( selectedCard.system.isdualside) { // Cas des cartes pouvant avoir 2 sens + selectedCard.system.ispositif = (Math.random() > 0.5) + } + selectedCard.system.isgm = false + MaleficesUtility.createChatMessage(game.user.name, "", { + content: await renderTemplate(`systems/fvtt-malefices/templates/chat/display-tarot-card.hbs`, selectedCard) + }) + } } \ No newline at end of file diff --git a/modules/malefices-main.js b/modules/malefices-main.js index 61c2204..18c047f 100644 --- a/modules/malefices-main.js +++ b/modules/malefices-main.js @@ -64,7 +64,6 @@ Hooks.once("init", async function () { Items.unregisterSheet("core", ItemSheet); Items.registerSheet("fvtt-malefices", MaleficesItemSheet, { makeDefault: true }); - MaleficesUtility.init() }); /* -------------------------------------------- */ @@ -78,7 +77,7 @@ function welcomeMessage() {

Le Livre de Base de Maléfices v4 est nécessaire pour jouer : https://arkhane-asylum.fr/en/malefices/

Maléfices et un jeu de rôle publié par Arkhane Asylum Publishing, tout les droits leur appartiennent.

Système développé par LeRatierBretonnien avec l'aide de la Dame du Lac et Malik, support sur le Discord FR de Foundry.

-

Commandes : /tirage pour le tirage des tarots et /resume pour le résumé des PJs` }); +

Commandes : /tirage pour le tirage des tarots, /tirer pour tirer une simple carte et /resume pour le résumé des PJs (MJ seulement)` }); } } /* -------------------------------------------- */ @@ -130,7 +129,6 @@ Hooks.once("ready", function () { registerUsageCount('fvtt-malefices') welcomeMessage(); MaleficesUtility.ready() - MaleficesUtility.init() MaleficesCharacterSummary.ready() }) diff --git a/modules/malefices-summary-app.js b/modules/malefices-summary-app.js index 8942372..7e7bf9f 100644 --- a/modules/malefices-summary-app.js +++ b/modules/malefices-summary-app.js @@ -5,24 +5,29 @@ import { MaleficesUtility } from "./malefices-utility.js"; export class MaleficesCharacterSummary extends Application { /* -------------------------------------------- */ - static displayPCSummary(){ - game.system.malefices.charSummary.render(true) + static displayPCSummary() { + if (game.user.isGM) { + game.system.malefices.charSummary.render(true) + } else { + ui.notifications.info("Commande /tirage réservée au MJ !") + } } + /* -------------------------------------------- */ - updatePCSummary(){ - if ( this.rendered) { + updatePCSummary() { + if (this.rendered) { this.render(true) } } - + /* -------------------------------------------- */ static createSummaryPos() { return { top: 200, left: 200 }; } - + /* -------------------------------------------- */ static ready() { - if ( !game.user.isGM ) { // Uniquement si GM + if (!game.user.isGM) { // Uniquement si GM return } let charSummary = new MaleficesCharacterSummary() @@ -51,14 +56,14 @@ export class MaleficesCharacterSummary extends Application { getData() { let formData = super.getData(); - formData.pcs = game.actors.filter( ac => ac.type == "personnage" && ac.hasPlayerOwner ) + formData.pcs = game.actors.filter(ac => ac.type == "personnage" && ac.hasPlayerOwner) formData.npcs = [] let newList = [] - let toUpdate = false - for( let actorId of this.settings.npcList ) { + let toUpdate = false + for (let actorId of this.settings.npcList) { let actor = game.actors.get(actorId) if (actor) { - formData.npcs.push( actor ) + formData.npcs.push(actor) newList.push(actorId) } else { toUpdate = true @@ -66,7 +71,7 @@ export class MaleficesCharacterSummary extends Application { } formData.config = game.system.malefices.config - if ( toUpdate ) { + if (toUpdate) { this.settings.npcList = newList //console.log("Going to update ...", this.settings) game.settings.set("world", "character-summary-data", this.settings) @@ -79,21 +84,21 @@ export class MaleficesCharacterSummary extends Application { updateNPC() { game.settings.set("world", "character-summary-data", game.system.malefices.charSummary.settings) game.system.malefices.charSummary.close() - setTimeout( function() { game.system.malefices.charSummary.render(true)}, 500) + setTimeout(function () { game.system.malefices.charSummary.render(true) }, 500) } /* -------------------------------------------- */ async _onDrop(event) { //console.log("Dragged data are : ", dragData) let data = event.dataTransfer.getData('text/plain') - let dataItem = JSON.parse( data) + let dataItem = JSON.parse(data) let actor = fromUuidSync(dataItem.uuid) if (actor) { - game.system.malefices.charSummary.settings.npcList.push( actor.id ) + game.system.malefices.charSummary.settings.npcList.push(actor.id) game.system.malefices.charSummary.updateNPC() - + } else { - ui.notifications.warn( "Pas d'acteur trouvé" ) + ui.notifications.warn("Pas d'acteur trouvé") } } @@ -124,6 +129,6 @@ export class MaleficesCharacterSummary extends Application { game.system.malefices.charSummary.updateNPC() }) - } + } } \ No newline at end of file diff --git a/modules/malefices-utility.js b/modules/malefices-utility.js index 592c2a6..ec0ab95 100644 --- a/modules/malefices-utility.js +++ b/modules/malefices-utility.js @@ -7,7 +7,7 @@ export class MaleficesUtility { /* -------------------------------------------- */ - static async init() { + static async ready() { Hooks.on('renderChatLog', (log, html, data) => MaleficesUtility.chatListeners(html)); /*Hooks.on("dropCanvasData", (canvas, data) => { MaleficesUtility.dropItemOnToken(canvas, data) @@ -51,6 +51,10 @@ export class MaleficesUtility { default: { npcList: [], x: 200, y: 200 }, type: Object }) + + const tarots = await MaleficesUtility.loadCompendium("fvtt-malefices.malefices-tarots") + this.tarots = tarots.map(i => i.toObject()) + } /*-------------------------------------------- */ @@ -67,13 +71,6 @@ export class MaleficesUtility { return this.tarots.find(t => t._id == tId) } - /* -------------------------------------------- */ - static async ready() { - const tarots = await MaleficesUtility.loadCompendium("fvtt-malefices.malefices-tarots") - this.tarots = tarots.map(i => i.toObject()) - - } - /* -------------------------------------------- */ static async loadCompendiumData(compendium) { const pack = game.packs.get(compendium) diff --git a/packs/malefices-macros.db b/packs/malefices-macros.db new file mode 100644 index 0000000..6c68873 --- /dev/null +++ b/packs/malefices-macros.db @@ -0,0 +1,3 @@ +{"name":"Résumé des PJs pour le MJ","type":"chat","scope":"global","author":"R9gIh86vXDB4IFn1","img":"systems/fvtt-malefices/images/icons/resume.webp","command":"/resume","flags":{"core":{"sourceId":"Macro.ulj2PgchTQVE1VV4"}},"_stats":{"systemId":"fvtt-malefices","systemVersion":"10.1.1","coreVersion":"10.291","createdTime":1677422022018,"modifiedTime":1677422143283,"lastModifiedBy":"R9gIh86vXDB4IFn1"},"ownership":{"default":0,"R9gIh86vXDB4IFn1":3},"folder":null,"sort":0,"_id":"ESV4er8Hy6liMOC3"} +{"name":"Tirage des tarots","type":"chat","scope":"global","author":"R9gIh86vXDB4IFn1","img":"systems/fvtt-malefices/images/icons/tirage.webp","command":"/tirage","flags":{"core":{"sourceId":"Macro.ulj2PgchTQVE1VV4"}},"_stats":{"systemId":"fvtt-malefices","systemVersion":"10.1.1","coreVersion":"10.291","createdTime":1677422022018,"modifiedTime":1677422144635,"lastModifiedBy":"R9gIh86vXDB4IFn1"},"ownership":{"default":0,"R9gIh86vXDB4IFn1":3},"folder":null,"sort":0,"_id":"sVKXJsiG9KAaBglV"} +{"name":"Tirer une carte","type":"chat","command":"/carte","author":"R9gIh86vXDB4IFn1","img":"systems/fvtt-malefices/images/icons/tirer.webp","scope":"global","flags":{"core":{"sourceId":"Macro.P2dPA3CA5ZjOwDeE"}},"_stats":{"systemId":"fvtt-malefices","systemVersion":"10.1.1","coreVersion":"10.291","createdTime":1677421496447,"modifiedTime":1677422146138,"lastModifiedBy":"R9gIh86vXDB4IFn1"},"ownership":{"default":0,"R9gIh86vXDB4IFn1":3},"folder":null,"sort":0,"_id":"zDPgmHiwNxBWhoYz"} diff --git a/system.json b/system.json index a295830..1289e9a 100644 --- a/system.json +++ b/system.json @@ -46,6 +46,15 @@ "system": "fvtt-malefices", "private": false, "flags": {} + }, + { + "type": "Macro", + "label": "Macros", + "name": "malefices-macros", + "path": "packs/malefices-macros.db", + "system": "fvtt-malefices", + "private": false, + "flags": {} } ], "license": "LICENSE.txt", @@ -64,7 +73,7 @@ ], "title": "Maléfices, le Jeu de Rôle", "url": "https://www.uberwald.me/gitea/public/fvtt-malefices", - "version": "10.1.0", - "download": "https://www.uberwald.me/gitea/public/fvtt-malefices/archive/fvtt-malefices-v10.1.0.zip", + "version": "10.1.1", + "download": "https://www.uberwald.me/gitea/public/fvtt-malefices/archive/fvtt-malefices-v10.1.1.zip", "background": "systems/fvtt-malefices/images/ui/malefice_welcome_page.webp" } \ No newline at end of file diff --git a/template.json b/template.json index b105756..7d98d32 100644 --- a/template.json +++ b/template.json @@ -83,7 +83,8 @@ "value": 0, "max": 0 } - } + }, + "equipementlibre": "" }, "npccore": { "npctype": "", diff --git a/templates/actors/actor-sheet.hbs b/templates/actors/actor-sheet.hbs index 97776e0..6649f4b 100644 --- a/templates/actors/actor-sheet.hbs +++ b/templates/actors/actor-sheet.hbs @@ -145,6 +145,13 @@ {{!-- Equipement Tab --}}

+ +

+
+
+ {{editor equipementlibre target="system.equipementlibre" button=true owner=owner editable=editable}} +
+