forked from public/foundryvtt-reve-de-dragon
		
	Fix table résolution
This commit is contained in:
		| @@ -70,44 +70,44 @@ export class RdDRollResolutionTable extends Dialog { | |||||||
|  |  | ||||||
|     this.bringToTop(); |     this.bringToTop(); | ||||||
|  |  | ||||||
|     var rollData = this.rollData; |  | ||||||
|     var dialog = this; |     var dialog = this; | ||||||
|  |  | ||||||
|     function updateRollResult(rollData) { |  | ||||||
|       rollData.caracValue = parseInt(rollData.selectedCarac.value) |  | ||||||
|       rollData.finalLevel = dialog._computeFinalLevel(rollData); |  | ||||||
|  |  | ||||||
|       // Mise à jour valeurs |  | ||||||
|       $("#carac").val(rollData.caracValue); |  | ||||||
|       $("#roll-param").text(rollData.selectedCarac.value + " / " + Misc.toSignedString(rollData.finalLevel)); |  | ||||||
|       $(".table-resolution").remove(); |  | ||||||
|       $("#resolutionTable").append(RdDResolutionTable.buildHTMLTable(rollData.caracValue, rollData.finalLevel, 1, 20, -10, 10)); |  | ||||||
|       $(".table-proba-reussite").remove(); |  | ||||||
|       $("#tableProbaReussite").append(RdDResolutionTable.buildHTMLResults(rollData.caracValue, rollData.finalLevel)); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     // Setup everything onload |     // Setup everything onload | ||||||
|     $(function () { |     function onLoad(){ | ||||||
|       $("#diffLibre").val(Misc.toInt(rollData.diffLibre)); |       $("#diffLibre").val(Misc.toInt(dialog.rollData.diffLibre)); | ||||||
|       $("#diffConditions").val(Misc.toInt(rollData.diffConditions)); |       $("#diffConditions").val(Misc.toInt(dialog.rollData.diffConditions)); | ||||||
|       updateRollResult(rollData); |       dialog.updateRollResult(); | ||||||
|     }); |     } | ||||||
|  |     $(function () { onLoad();}); | ||||||
|      |      | ||||||
|     // Update ! |     // Update ! | ||||||
|     html.find('#diffLibre').change((event) => { |     html.find('#diffLibre').change((event) => { | ||||||
|       rollData.diffLibre = Misc.toInt(event.currentTarget.value); |       this.rollData.diffLibre = Misc.toInt(event.currentTarget.value); | ||||||
|       updateRollResult(rollData); |       this.updateRollResult(); | ||||||
|     }); |     }); | ||||||
|     html.find('#diffConditions').change((event) => { |     html.find('#diffConditions').change((event) => { | ||||||
|       rollData.diffConditions = Misc.toInt(event.currentTarget.value); |       rollData.diffConditions = Misc.toInt(event.currentTarget.value); | ||||||
|       updateRollResult(rollData); |       this.updateRollResult(); | ||||||
|     }); |     }); | ||||||
|     html.find('#carac').change((event) => { |     html.find('#carac').change((event) => { | ||||||
|       let caracKey = event.currentTarget.value; |       let caracKey = event.currentTarget.value; | ||||||
|       this.rollData.selectedCarac = rollData.carac[caracKey]; |       this.rollData.selectedCarac = this.rollData.carac[caracKey]; | ||||||
|       updateRollResult(rollData); |       this.updateRollResult(); | ||||||
|     }); |     }); | ||||||
|   } |   } | ||||||
|  |   async updateRollResult() { | ||||||
|  |     let rollData = this.rollData; | ||||||
|  |     rollData.caracValue = parseInt(rollData.selectedCarac.value) | ||||||
|  |     rollData.finalLevel = this._computeFinalLevel(rollData); | ||||||
|  |  | ||||||
|  |     // Mise à jour valeurs | ||||||
|  |     $("#carac").val(rollData.caracValue); | ||||||
|  |     $("#roll-param").text(rollData.selectedCarac.value + " / " + Misc.toSignedString(rollData.finalLevel)); | ||||||
|  |     $(".table-resolution").remove(); | ||||||
|  |     $(".table-proba-reussite").remove(); | ||||||
|  |     $("#tableResolution").append(RdDResolutionTable.buildHTMLTable(rollData.caracValue, rollData.finalLevel)); | ||||||
|  |     $("#tableProbaReussite").append(RdDResolutionTable.buildHTMLResults(rollData.caracValue, rollData.finalLevel)); | ||||||
|  |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   _computeFinalLevel(rollData) { |   _computeFinalLevel(rollData) { | ||||||
|   | |||||||
| @@ -28,8 +28,6 @@ | |||||||
|       {{/select}} |       {{/select}} | ||||||
|   </select> |   </select> | ||||||
| </div> | </div> | ||||||
| <div id="tableAjustements"> |  | ||||||
| </div> |  | ||||||
| <div id="tableResolution">   | <div id="tableResolution">   | ||||||
| </div> | </div> | ||||||
| <div id="tableProbaReussite">   | <div id="tableProbaReussite">   | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user