Skip to content

Commit

Permalink
Merge pull request #13606 from ctotone/Ten-candles
Browse files Browse the repository at this point in the history
[TEN CANDLES] Rollmodifier Dynamic translation
  • Loading branch information
BronsonHall authored Dec 17, 2024
2 parents c8d72bf + 020b0ec commit 9fc53b1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Ten candles/ten-candles.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
<div class=main>
<!-- Logo -->
<div class="logo">
<img class="img" src="https://raw.githubusercontent.com/ctotone/JdR/main/Ten%20candles/img/logo_official_dark.png"/>
<!-- <button type="action" name="act_conflict" data-i18n-title="conflict_dice" title="Conflict Dice" class="d6"></button> -->
<img class="img" src="https://raw.githubusercontent.com/ctotone/JdR/main/Ten%20candles/img/logo_official_dark.png"/>
<button type="roll" name="roll_conflict" value="@{conflict}" data-i18n-title="conflict_dice" title="Conflict Dice" class="d6"></button>
<!-- Old roll
<button type="roll" name="roll_Conflict" data-i18n-title="conflict_dice" title="Conflict Dice" value="&{template:tencandles} {{title=^{roll_d6_title}}}{{conflict=[[?{How many dice?|1}d6s=6]]}}" class="d6"></button> -->
</div>
<br>

Expand Down Expand Up @@ -183,7 +180,7 @@ <h4>Number 1s = {{computed::low}}</h4>

<script type="text/worker">
on('clicked:conflict-action', (info) => {
startRoll("&{template:tencandles} {{title=^{roll_d6_title}}} {{roll=[[?{How many dice?|1}d6s=6]]}} {{high=[[0]]}} {{low=[[0]]}}", (diceroll) => {
startRoll("&{template:tencandles} {{title=^{roll_d6_title}}} {{roll=[[@{rollmodifier}d6s=6]]}} {{high=[[0]]}} {{low=[[0]]}}", (diceroll) => {
const total = diceroll.results.roll.result
const dice = diceroll.results.roll.dice; //This will be an array of the values rolled on all the dice
let total6s = 0;
Expand All @@ -202,6 +199,12 @@ <h4>Number 1s = {{computed::low}}</h4>
);
});
});

on("sheet:opened", function(eventInfo){
setAttrs({
rollmodifier: "?{" + getTranslationByKey("how_many_dice") + "|1}",
});
});


on("sheet:opened change:character_name", function(eventInfo) {
Expand Down
1 change: 1 addition & 0 deletions Ten candles/translation.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"how_many_dice" : "How many dice ?",
"success" : "Success",
"failure" : "Failure",
"pc_sheet_title": "Character sheet",
Expand Down

0 comments on commit 9fc53b1

Please sign in to comment.