diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 9fbe7f2f..d18987bd 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -8,7 +8,6 @@ import { RdDCombatManager } from "./rdd-combat.js"; import { RdDCarac } from "./rdd-carac.js"; import { DialogSplitItem } from "./dialog-split-item.js"; import { ReglesOptionelles } from "./settings/regles-optionelles.js"; -import { DialogRepos } from "./dialog-repos.js"; import { RdDSheetUtility } from "./rdd-sheet-utility.js"; import { STATUSES } from "./settings/status-effects.js"; import { Monnaie } from "./item-monnaie.js"; @@ -312,7 +311,7 @@ export class RdDActorSheet extends ActorSheet { }); this.html.find('.repos').click(async event => { - await DialogRepos.create(this.actor); + await this.actor.repos(); }); this.html.find('.delete-active-effect').click(async event => { if (game.user.isGM) { diff --git a/module/actor.js b/module/actor.js index f5778d6e..e54cfcbd 100644 --- a/module/actor.js +++ b/module/actor.js @@ -36,6 +36,7 @@ import { DialogValidationEncaissement } from "./dialog-validation-encaissement.j import { RdDRencontre } from "./item-rencontre.js"; import { SystemCompendiums } from "./settings/system-compendiums.js"; import { Targets } from "./targets.js"; +import { DialogRepos } from "./dialog-repos.js"; const POSSESSION_SANS_DRACONIC = { img: 'systems/foundryvtt-reve-de-dragon/icons/entites/possession.webp', @@ -446,6 +447,38 @@ export class RdDActor extends Actor { return ''; } + /* -------------------------------------------- */ + async roll() { + const carac = mergeObject( + duplicate(this.system.carac), + { + 'reve-actuel': this.getCaracReveActuel(), + 'chance-actuelle': this.getCaracChanceActuelle() + }); + let rollData = { + carac: carac, + selectedCarac: carac.apparence, + selectedCaracName: 'apparence', + competences: this.itemTypes['competence'] + }; + + const dialog = await RdDRoll.create(this, rollData, + { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll.html' }, + { + name: `jet-${this.id}`, + label: `Jet de ${this.name}`, + callbacks: [ + this.createCallbackExperience(), + this.createCallbackAppelAuMoral(), + { action: r => this._onRollCaracResult(r) } + ] + } + ); + dialog.render(true); + } + async repos() { + await DialogRepos.create(this.actor); + } /* -------------------------------------------- */ async grisReve(nGrisReve) { @@ -3182,21 +3215,29 @@ export class RdDActor extends Actor { getCaracByName(name) { switch (Grammar.toLowerCaseNoAccent(name)) { case 'reve-actuel': case 'reve actuel': - return { - label: 'Rêve actuel', - value: this.getReveActuel(), - type: "number" - }; + return this.getCaracReveActuel(); case 'chance-actuelle': case 'chance-actuelle': - return { - label: 'Chance actuelle', - value: this.getChanceActuel(), - type: "number" - }; + return this.getCaracChanceActuelle(); } return RdDActor._findCaracByName(this.system.carac, name); } + getCaracChanceActuelle() { + return { + label: 'Chance actuelle', + value: this.getChanceActuel(), + type: "number" + }; + } + + getCaracReveActuel() { + return { + label: 'Rêve actuel', + value: this.getReveActuel(), + type: "number" + }; + } + /* -------------------------------------------- */ static _findCaracByName(carac, name) { name = Grammar.toLowerCaseNoAccent(name); diff --git a/module/dialog-item-achat.js b/module/dialog-item-achat.js index 01162e97..947e18e7 100644 --- a/module/dialog-item-achat.js +++ b/module/dialog-item-achat.js @@ -1,5 +1,3 @@ - -import { Monnaie } from "./item-monnaie.js"; import { RdDUtility } from "./rdd-utility.js"; export class DialogItemAchat extends Dialog { diff --git a/module/dialog-repos.js b/module/dialog-repos.js index 2c7d601b..a1a9ba06 100644 --- a/module/dialog-repos.js +++ b/module/dialog-repos.js @@ -1,4 +1,3 @@ -import { Misc } from "./misc.js"; export class DialogRepos extends Dialog { diff --git a/module/rdd-commands.js b/module/rdd-commands.js index 7b3deebe..c24e8af0 100644 --- a/module/rdd-commands.js +++ b/module/rdd-commands.js @@ -331,7 +331,7 @@ export class RdDCommands { diff = 0; } const caracName = params[0]; - let competence = length > 1 ? actors[0].getCompetence(Misc.join(params.slice(1, length), ' ')) : undefined; + let competence = length > 1 ? actors[0].getCompetence(Misc.join(params.slice(1, length), ' ')) : {name:undefined}; if (competence) { for (let actor of actors) { await actor.rollCaracCompetence(caracName, competence.name, diff); diff --git a/module/rdd-utility.js b/module/rdd-utility.js index ecd8a843..59e9f7a3 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -126,6 +126,7 @@ export class RdDUtility { 'systems/foundryvtt-reve-de-dragon/templates/actor/header-compteurs-creature.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/header-compteurs-entitee.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/header-effects.html', + 'systems/foundryvtt-reve-de-dragon/templates/actor/header-hautreve.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/vue-detaillee.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/carac-main.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/carac-derivee.html', diff --git a/packs/macros.db b/packs/macros.db new file mode 100644 index 00000000..7427c4fd --- /dev/null +++ b/packs/macros.db @@ -0,0 +1,11 @@ +{"name":"Jet de moral","type":"script","author":"Hp9ImM4o9YRTSdfu","img":"icons/magic/control/mouth-smile-deception-purple.webp","scope":"global","command":"const selected = game.system.rdd.RdDUtility.getSelectedActor();\nif (!selected) {\n ui.notifications.info('Pas de personnage sélectionné');\n return;\n}\n\nconst dialogMoral = new Dialog({\n title: `Jet de moral`,\n content: `Jet de moral en situation`,\n buttons: {\n malheureuse: { label: `malheureuse`, icon: \"\", callback: () => selected.jetDeMoral('malheureuse') },\n neutre: { label: `neutre`, icon: \"\", callback: () => selected.jetDeMoral('neutre') },\n heureuse: { label: `heureuse`, icon: \"\", callback: () => selected.jetDeMoral('heureuse') }\n },\n});\n\ndialogMoral.render(true)","ownership":{"default":0,"Hp9ImM4o9YRTSdfu":3},"flags":{"core":{"sourceId":"Macro.aJ0QGnXAXT0WiXbk"}},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.3.15","coreVersion":"10.291","createdTime":1671235038906,"modifiedTime":1671236054480,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"2VvH2rmxV33jGjMU"} +{"name":"Repos","type":"script","scope":"global","author":"Hp9ImM4o9YRTSdfu","img":"icons/svg/sleep.svg","command":"const selected = game.system.rdd.RdDUtility.getSelectedActor();\nif (selected) {\n selected.repos();\n}\nelse {\n ui.notifications.info('Pas de personnage sélectionné');\n}","ownership":{"default":0,"Hp9ImM4o9YRTSdfu":3},"flags":{"core":{"sourceId":"Macro.XHNbjnGKXaCiCadq"}},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.3.15","coreVersion":"10.291","createdTime":1671220038331,"modifiedTime":1671234271278,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"6LRZ8DOVfqotIEsi"} +{"name":"Météo marine","type":"chat","author":"Hp9ImM4o9YRTSdfu","img":"icons/magic/air/wind-weather-sailing-ship.webp","scope":"global","command":"/meteo","flags":{"core":{"sourceId":"Macro.EPhCYk7PFMPlIFhS"}},"ownership":{"default":0,"Hp9ImM4o9YRTSdfu":3},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.3.15","coreVersion":"10.291","createdTime":1671237060687,"modifiedTime":1671237060687,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"9mYZfKoi4ZYHydxa"} +{"name":"Chuchoter aux joueurs","type":"script","author":"Hp9ImM4o9YRTSdfu","img":"icons/svg/deaf.svg","scope":"global","command":"/** \n * Provides a dialog to whisper specific players. If you have tokens selected, it will automatically default to try and whisper those players.\n * @Author: Nelson#3570\n */\n\nlet applyChanges = false;\n\nlet users = game.users.filter(user => user.active);\nlet checkOptions = \"\"\nlet playerTokenIds = users.map(u => u.character?.id).filter(id => id !== undefined);\nlet selectedPlayerIds = canvas.tokens.controlled.map(token => {\n if (playerTokenIds.includes(token.actor.id)) return token.actor.id;\n});\n\n// Build checkbox list for all active players\nusers.forEach(user => {\n let checked = !!user.character && selectedPlayerIds.includes(user.character.id) && 'checked';\n checkOptions+=`\n
\n \\n\n \n `\n});\n\nnew Dialog({\n title:\"Whisper\",\n content:`Whisper To: ${checkOptions}
\n \n
`,\n buttons:{\n whisper:{ \n label:\"Whisper\",\n callback: (html) => createMessage(html)\n }\n }\n}).render(true);\n\nfunction createMessage(html) {\n var targets = [];\n // build list of selected players ids for whispers target\n for ( let user of users ) {\n if (html.find('[name=\"'+user.id+'\"]')[0].checked){\n applyChanges=true;\n targets.push(user.id);\n }\n var messageText = html.find('[name=\"message\"]')[0].value\n }\nif(!applyChanges)return;\n ChatMessage.create({\n content: messageText,\n whisper: targets\n });\n}","flags":{"core":{"sourceId":"Compendium.foundry_community_macros.community-macros-misc.QTDeg4HOYCAmr4dK"}},"ownership":{"default":2,"Hp9ImM4o9YRTSdfu":3},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.3.15","coreVersion":"10.291","createdTime":1671237211578,"modifiedTime":1671237211578,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"ALAVJEEP3iJosOoi"} +{"name":"Terres médianes du rêve","type":"script","scope":"global","author":"Hp9ImM4o9YRTSdfu","img":"systems/foundryvtt-reve-de-dragon/styles/img/ui/icon-tmr-normal.svg","command":"const selected = game.system.rdd.RdDUtility.getSelectedActor();\nif (!selected) {\n ui.notifications.info('Pas de personnage sélectionné');\n return;\n}\nif (!selected.isHautRevant()) {\n ui.notifications.info(`Le personnage ${selected.name} n'a pas le don de haut-rêve`);\n return;\n}\n\nconst dialogMoral = new Dialog({\n title: `Monter dans les TMR`,\n content: `Monter dans les TMR`,\n buttons: {\n normale: { label: `normale`, icon: `\"Montée`, callback: () => selected.displayTMR(\"normal\") },\n rapide: { label: `rapide`, icon: `\"Montée`, callback: () => selected.displayTMR(\"rapide\") },\n },\n});\n\ndialogMoral.render(true)","ownership":{"default":0,"Hp9ImM4o9YRTSdfu":3},"flags":{"core":{"sourceId":"Macro.zCAQxg2duk0j3s5r"}},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.3.15","coreVersion":"10.291","createdTime":1669250715114,"modifiedTime":1671236057731,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"ERsBfwsodzH6UX4x"} +{"name":"Signe draconique","type":"chat","author":"Hp9ImM4o9YRTSdfu","img":"systems/foundryvtt-reve-de-dragon/icons/tmr/signe_draconique.webp","scope":"global","command":"/signe +","flags":{"core":{"sourceId":"Macro.RmOLbONUNnINcqCO"}},"ownership":{"default":0,"klwAm8zAKxw8YBLf":3,"Hp9ImM4o9YRTSdfu":3},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.3.15","coreVersion":"10.291","createdTime":1671237375774,"modifiedTime":1671237375774,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"MJByzsEdneZ64P56"} +{"name":"Appel à la chance","type":"script","scope":"global","author":"Hp9ImM4o9YRTSdfu","img":"icons/commodities/flowers/clover.webp","command":"const selected = game.system.rdd.RdDUtility.getSelectedActor();\nif (selected) {\n selected.rollAppelChance();\n}\nelse {\n ui.notifications.info('Pas de personnage sélectionné');\n}","ownership":{"default":0,"Hp9ImM4o9YRTSdfu":3},"flags":{"core":{"sourceId":"Macro.XHNbjnGKXaCiCadq"}},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.3.15","coreVersion":"10.291","createdTime":1671220038331,"modifiedTime":1671233849101,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"UzAWljmFq5sY702w"} +{"name":"Encaissement","type":"script","scope":"global","author":"Hp9ImM4o9YRTSdfu","img":"icons/svg/bones.svg","command":"const selected = game.system.rdd.RdDUtility.getSelectedActor();\nif (selected) {\n selected.encaisser();\n}\nelse {\n ui.notifications.info('Pas de personnage sélectionné');\n}","ownership":{"default":0,"Hp9ImM4o9YRTSdfu":3},"flags":{"core":{"sourceId":"Macro.XHNbjnGKXaCiCadq"}},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.3.15","coreVersion":"10.291","createdTime":1671220038331,"modifiedTime":1671234017623,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"WD6T8AdRbX2Ylxqe"} +{"name":"Jet quelconque","type":"script","scope":"global","author":"Hp9ImM4o9YRTSdfu","img":"icons/sundries/gaming/dice-runed-tan.webp","command":"const selected = game.system.rdd.RdDUtility.getSelectedActor();\nif (selected) {\n selected.roll();\n}\nelse {\n ui.notifications.info('Pas de personnage sélectionné');\n}","ownership":{"default":0,"Hp9ImM4o9YRTSdfu":3},"flags":{"core":{"sourceId":"Macro.XHNbjnGKXaCiCadq"}},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.3.15","coreVersion":"10.291","createdTime":1671220038331,"modifiedTime":1671233500655,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"bnJnbKDHpbqY8Pr9"} +{"name":"Jet d'éthylisme","type":"script","scope":"global","author":"Hp9ImM4o9YRTSdfu","img":"icons/consumables/drinks/alcohol-beer-stein-wooden-metal-brown.webp","command":"const selected = game.system.rdd.RdDUtility.getSelectedActor();\nif (selected) {\n selected.jetEthylisme();\n}\nelse {\n ui.notifications.info('Pas de personnage sélectionné');\n}","ownership":{"default":0,"Hp9ImM4o9YRTSdfu":3},"flags":{"core":{"sourceId":"Macro.XHNbjnGKXaCiCadq"}},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.3.15","coreVersion":"10.291","createdTime":1671220038331,"modifiedTime":1671233646086,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"mvub1dRHNFmWjRr7"} +{"name":"Tirer le tarot","type":"chat","scope":"global","author":"Hp9ImM4o9YRTSdfu","img":"systems/foundryvtt-reve-de-dragon/icons/tarots/dos-tarot.webp","command":"/tirer tarot","ownership":{"default":0,"Hp9ImM4o9YRTSdfu":3},"flags":{"core":{"sourceId":"Macro.HBZSKR9OHCQbLcTC"}},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.3.15","coreVersion":"10.291","createdTime":1669469547231,"modifiedTime":1671237401618,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"vTfJTFYYiRu8X5LM"} diff --git a/styles/simple.css b/styles/simple.css index 92f7a11e..65e9d41b 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -160,6 +160,20 @@ i:is(.fas, .far) { width: fit-content; } +.system-foundryvtt-reve-de-dragon .sheet-header div.tmr-buttons { + padding: 0; + margin: 0; + flex: 0; + flex-direction: column; +} + +.system-foundryvtt-reve-de-dragon .sheet-header div.tmr-buttons img.button-img { + max-width: 32px; + padding: 0; + margin-top: -8px; + margin-bottom: -8px; +} + .system-foundryvtt-reve-de-dragon .sheet-header :is(.header-compteurs,.header-etats,.profile-img){ padding: 0 3%; } diff --git a/system.json b/system.json index fcd1e596..b2ca14e3 100644 --- a/system.json +++ b/system.json @@ -1,8 +1,8 @@ { "id": "foundryvtt-reve-de-dragon", "title": "Rêve de Dragon", - "version": "10.3.15", - "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.3.15.zip", + "version": "10.3.16", + "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.3.16.zip", "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json", "compatibility": { "minimum": "10", @@ -161,6 +161,15 @@ "private": false, "flags": {} }, + { + "name": "macros", + "label": "Macros Rêve de Dragon", + "system": "foundryvtt-reve-de-dragon", + "path": "packs/macros.db", + "type": "Macro", + "private": false, + "flags": {} + }, { "name": "queues-de-dragon", "label": "Queues de Dragon", diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index e7b14889..a7243520 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -1,5 +1,4 @@
- {{>'systems/foundryvtt-reve-de-dragon/templates/scripts/autocomplete-script.hbs'}} {{!-- Sheet Header --}} @@ -14,6 +13,7 @@ {{>"systems/foundryvtt-reve-de-dragon/templates/actor/header-compteurs.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/actor/header-etat.html"}} + {{>"systems/foundryvtt-reve-de-dragon/templates/actor/header-hautreve.html"}} @@ -35,7 +35,6 @@ {{!-- Carac Tab --}}
- TEST
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/vue-detaillee.html"}}
diff --git a/templates/actor/header-buttons.html b/templates/actor/header-buttons.html index 2d418099..af6a9703 100644 --- a/templates/actor/header-buttons.html +++ b/templates/actor/header-buttons.html @@ -11,15 +11,6 @@ Se reposer - {{#if system.attributs.hautrevant.value}} - - Montée dans les Terres Médianes ! - - Montée accélérée dans les Terres Médianes ! - - Regarder les Terres Médianes - - {{/if}} {{#if @root.options.isGM}} Remise à neuf diff --git a/templates/actor/header-compteurs.html b/templates/actor/header-compteurs.html index 901dca9b..32c62b92 100644 --- a/templates/actor/header-compteurs.html +++ b/templates/actor/header-compteurs.html @@ -21,7 +21,7 @@