diff --git a/RdD.geany b/RdD.geany index 452f930e..4572a7db 100644 --- a/RdD.geany +++ b/RdD.geany @@ -19,26 +19,19 @@ indent_mode=2 [project] name=RdD -base_path=/home/sigmar/work/foundryvtt/foundryvtt-reve-de-dragon +base_path=/home/morr/work/foundryvtt/foundryvtt-reve-de-dragon description= +file_patterns= [long line marker] long_line_behaviour=1 long_line_column=72 [files] -current_page=5 -FILE_NAME_0=9147;JSON;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplate.json;0;2 -FILE_NAME_1=3682;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Factor-sheet.js;0;2 -FILE_NAME_2=17891;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Factor-sheet.html;0;2 -FILE_NAME_3=13913;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Factor.js;0;2 -FILE_NAME_4=416;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Fdialog-roll-carac.html;0;2 -FILE_NAME_5=5840;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-utility.js;0;2 -FILE_NAME_6=135;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-main.js;0;2 -FILE_NAME_7=617;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Fitem-competence-sheet.html;0;2 -FILE_NAME_8=1217;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Fitem-sort-sheet.html;0;2 -FILE_NAME_9=160;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Fsort-draconic.html;0;2 -FILE_NAME_10=284;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fsigmar%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Fsort-tmr.html;0;2 +current_page=2 +FILE_NAME_0=0;JSON;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplate.json;0;2 +FILE_NAME_1=380;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Fitem-livre-sheet.html;0;2 +FILE_NAME_2=444;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Fitem-potion-sheet.html;0;2 [VTE] last_dir=/home/sigmar diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 453d8855..5533bb00 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -92,6 +92,7 @@ export class RdDActorSheet extends ActorSheet { data.data.livres = this._checkNull(data.itemsByType['livre']); data.data.potions = this._checkNull(data.itemsByType['potions']); data.data.herbes = this._checkNull(data.itemsByType['herbes']); + data.data.sorts = this._checkNull(data.itemsByType['sort']); data.data.competenceByCategory = data.competenceByCategory; //data.data.armes = data.itemsByType.arme; //console.log(">>>>> data update"); @@ -147,6 +148,12 @@ export class RdDActorSheet extends ActorSheet { this.actor.rollArme( armeName); }); + // Roll spell + html.find('.sort-label a').click((event) => { + let sortID = event.currentTarget.attributes['data-id'].value; + this.actor.rollSort( sortID); + }); + // On carac change html.find('.carac-value').change((event) => { let caracName = event.currentTarget.name.replace(".value", "").replace("data.carac.", ""); diff --git a/module/actor.js b/module/actor.js index 67568a84..d473288a 100644 --- a/module/actor.js +++ b/module/actor.js @@ -5,6 +5,7 @@ import { RdDUtility } from "./rdd-utility.js"; import { RdDRollDialog } from "./rdd-roll-dialog.js"; +import { RdDTMRDialog } from "./rdd-tmr-dialog.js"; export class RdDActor extends Actor { @@ -360,7 +361,15 @@ export class RdDActor extends Actor { let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html', rollData); new RdDRollDialog("carac", html, rollData, this ).render(true); } - + + /* -------------------------------------------- */ + async rollSort( sortID ) + { + console.log("Loading TMR template!!!"); + let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-tmr.html', sortID); + new RdDTMRDialog(sortID, html, this ).render(true); + } + /* -------------------------------------------- */ rollArme( armeName ) { diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js new file mode 100644 index 00000000..4dc6849e --- /dev/null +++ b/module/rdd-tmr-dialog.js @@ -0,0 +1,45 @@ +/** + * Extend the base Dialog entity by defining a custom window to perform spell. + * @extends {Dialog} + */ + +export class RdDTMRDialog extends Dialog { + + /* -------------------------------------------- */ + constructor(sort, html, actor) { + + // Common conf + let dialogConf = { + content: html, + buttons: + { + rollButton: + { + label: "Lancer", + callback: html => this.performRoll(html) + } + }, + default: "rollButton" + } + let dialogOptions = { classes: [ "tmrdialog"] } + + dialogConf.title = "Terres Médianes de Rêve", + dialogOptions.width = 600; + dialogOptions.height = 360; + super(dialogConf, dialogOptions); + + this.sort = sort; + this.actor = actor; + } + + /* -------------------------------------------- */ + performRoll (html) { + this.actor.performRoll( this.rollData ); + } + + /* -------------------------------------------- */ + + activateListeners(html) { + super.activateListeners(html); + } +} diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 1a3e982a..c0e1a3a1 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -94,7 +94,8 @@ export class RdDUtility { 'systems/foundryvtt-reve-de-dragon/templates/sort-tmr.html', // Dialogs 'systems/foundryvtt-reve-de-dragon/templates/dialog-competence.html', - 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html' + 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html', + 'systems/foundryvtt-reve-de-dragon/templates/dialog-tmr.html' ]; return loadTemplates(templatePaths); diff --git a/pic/terres_medianes.png b/styles/ui/terres_medianes.png similarity index 100% rename from pic/terres_medianes.png rename to styles/ui/terres_medianes.png diff --git a/system.json b/system.json index 496e6dc4..543abf86 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "name": "foundryvtt-reve-de-dragon", "title": "Rêve de Dragon", "description": "L'implémentation de Rêve de Dragon pour FoundryVTT", - "version": "0.7.8", + "version": "0.7.9", "minimumCoreVersion": "0.6.0", "compatibleCoreVersion": "0.6.2", "templateVersion": 17, diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index 537ee5af..a180f162 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -301,6 +301,14 @@ {{!-- hautreve Tab --}}