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/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: ``, callback: () => selected.displayTMR(\"normal\") },\n rapide: { label: `rapide`, icon: ``, 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/system.json b/system.json
index fcd1e596..9b405c69 100644
--- a/system.json
+++ b/system.json
@@ -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/dialog-roll.html b/templates/dialog-roll.html
new file mode 100644
index 00000000..71bc54af
--- /dev/null
+++ b/templates/dialog-roll.html
@@ -0,0 +1,23 @@
+