Skip to content

Commit

Permalink
Merge pull request #100 from Daimakaicho/condensed-better-roll
Browse files Browse the repository at this point in the history
New QoL features
  • Loading branch information
ultrakorne authored Jul 15, 2021
2 parents 197017d + 382dde5 commit 4878d2f
Show file tree
Hide file tree
Showing 13 changed files with 431 additions and 44 deletions.
19 changes: 18 additions & 1 deletion lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,22 @@
"BRT.LootRollAmountPlaceholder" : "Mehrfach auf die Tabelle würfeln.",
"BRT.DrawResultPlural": "Zieht {amount} Ergebnisse aus {name}",
"BRT.DrawResultSingular": "Zieht {amount} Ergebnis aus {name}",
"BRT.DrawResultZero": "Würfle auf {name}"
"BRT.DrawResultZero": "Würfle auf {name}",
"BRT.DrawReroll": "Reroll",
"BRT.Settings.RerollButtons.Title": "Show Reroll buttons",
"BRT.Settings.RerollButtons.Description": "Display a Reroll button on each result card of a roll on a rolltable (only for newly created cards). Work only on loot chat card or if condensed roll output is enabled. Default tables are not affected.",
"BRT.Settings.ShowWarningBeforeReroll.Title": "Confirm reroll ?",
"BRT.Settings.ShowWarningBeforeReroll.Description": "Show a confirm dialog before reroll message content.",
"BRT.Settings.UseCondensedBetterRoll.Title": "Use condensed roll output",
"BRT.Settings.UseCondensedBetterRoll.Description": "If enabled, this will aggregate same output with a multiplier to save space. This option may speed up rolltable draws. Default tables are not affected.",
"BRT.Settings.AddRollInRolltableContextMenu.Title": "Roll from rolltable contextmenu",
"BRT.Settings.AddRollInRolltableContextMenu.Description": "Add an option in rolltable's contextmenu to roll table without opening it. Work on all table type.",
"BRT.Settings.AddRollInCompediumContextMenu.Title": "Roll from compendium contextmenu",
"BRT.Settings.AddRollInCompediumContextMenu.Description": "Add an option in compendium's contextmenu to roll on this compendium without creating rolltable from it. Work on all non-empty compendiums.",
"BRT.Settings.RerollWarning.Title": "Reroll?",
"BRT.Settings.RerollWarning.Description": "Message content will be lost. Are you sure you want to reroll?",
"BRT.Settings.StickRolltableHeader.Title": "Stick rolltable header to top?",
"BRT.Settings.StickRolltableHeader.Description": "If enabled, roll table header will no more scroll with content.",
"BRT.Settings.RollTableFromJournal.Title": "Add roll button to tables in journal entries?",
"BRT.Settings.RollTableFromJournal.Description": "If enabled, a roll button is added to linked tables in journal entries."
}
22 changes: 20 additions & 2 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,23 @@
"BRT.LootRollAmountPlaceholder" : "Roll the entire table multiple times",
"BRT.DrawResultPlural": "Draws {amount} results from {name}",
"BRT.DrawResultSingular": "Draw {amount} result from {name}",
"BRT.DrawResultZero": "Rolling on {name}"
}
"BRT.DrawResultZero": "Rolling on {name}",
"BRT.DrawReroll": "Reroll",
"BRT.Settings.RerollButtons.Title": "Show Reroll buttons",
"BRT.Settings.RerollButtons.Description": "Display a Reroll button on each result card of a roll on a rolltable (only for newly created cards). Work only on loot chat card or if condensed roll output is enabled. Default tables are not affected.",
"BRT.Settings.ShowWarningBeforeReroll.Title": "Confirm reroll ?",
"BRT.Settings.ShowWarningBeforeReroll.Description": "Show a confirm dialog before reroll message content.",
"BRT.Settings.UseCondensedBetterRoll.Title": "Use condensed roll output",
"BRT.Settings.UseCondensedBetterRoll.Description": "If enabled, this will aggregate same output with a multiplier to save space. This option may speed up rolltable draws. Default tables are not affected.",
"BRT.Settings.AddRollInRolltableContextMenu.Title": "Roll from rolltable contextmenu",
"BRT.Settings.AddRollInRolltableContextMenu.Description": "Add an option in rolltable's contextmenu to roll table without opening it. Work on all table type.",
"BRT.Settings.AddRollInCompediumContextMenu.Title": "Roll from compendium contextmenu",
"BRT.Settings.AddRollInCompediumContextMenu.Description": "Add an option in compendium's contextmenu to roll on this compendium without creating rolltable from it. Work on all non-empty compendiums.",
"BRT.Settings.RerollWarning.Title": "Reroll?",
"BRT.Settings.RerollWarning.Description": "Message content will be lost. Are you sure you want to reroll?",
"BRT.Settings.StickRolltableHeader.Title": "Stick rolltable header to top?",
"BRT.Settings.StickRolltableHeader.Description": "If enabled, roll table header will no more scroll with content.",
"BRT.Settings.RollTableFromJournal.Title": "Add roll button to tables in journal entries?",
"BRT.Settings.RollTableFromJournal.Description": "If enabled, a roll button is added to linked tables in journal entries."

}
19 changes: 18 additions & 1 deletion lang/es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,22 @@
"BRT.LootRollAmountPlaceholder" : "Lanzar por la tabla al completo múltiples veces",
"BRT.DrawResultPlural": "Obtiene {amount} resultados de {name}",
"BRT.DrawResultSingular": "Obtiene {amount} resultado de {name}",
"BRT.DrawResultZero": "Lanzar de {name}"
"BRT.DrawResultZero": "Lanzar de {name}",
"BRT.DrawReroll": "Reroll",
"BRT.Settings.RerollButtons.Title": "Show Reroll buttons",
"BRT.Settings.RerollButtons.Description": "Display a Reroll button on each result card of a roll on a rolltable (only for newly created cards). Work only on loot chat card or if condensed roll output is enabled. Default tables are not affected.",
"BRT.Settings.ShowWarningBeforeReroll.Title": "Confirm reroll ?",
"BRT.Settings.ShowWarningBeforeReroll.Description": "Show a confirm dialog before reroll message content.",
"BRT.Settings.UseCondensedBetterRoll.Title": "Use condensed roll output",
"BRT.Settings.UseCondensedBetterRoll.Description": "If enabled, this will aggregate same output with a multiplier to save space. This option may speed up rolltable draws. Default tables are not affected.",
"BRT.Settings.AddRollInRolltableContextMenu.Title": "Roll from rolltable contextmenu",
"BRT.Settings.AddRollInRolltableContextMenu.Description": "Add an option in rolltable's contextmenu to roll table without opening it. Work on all table type.",
"BRT.Settings.AddRollInCompediumContextMenu.Title": "Roll from compendium contextmenu",
"BRT.Settings.AddRollInCompediumContextMenu.Description": "Add an option in compendium's contextmenu to roll on this compendium without creating rolltable from it. Work on all non-empty compendiums.",
"BRT.Settings.RerollWarning.Title": "Reroll?",
"BRT.Settings.RerollWarning.Description": "Message content will be lost. Are you sure you want to reroll?",
"BRT.Settings.StickRolltableHeader.Title": "Stick rolltable header to top?",
"BRT.Settings.StickRolltableHeader.Description": "If enabled, roll table header will no more scroll with content.",
"BRT.Settings.RollTableFromJournal.Title": "Add roll button to tables in journal entries?",
"BRT.Settings.RollTableFromJournal.Description": "If enabled, a roll button is added to linked tables in journal entries."
}
19 changes: 18 additions & 1 deletion lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,22 @@
"BRT.LootRollAmountPlaceholder" : "Jette un jet sur l'intégralité de la table plusieurs fois",
"BRT.DrawResultPlural": "Vous avez tiré {amount} résultats de {name}",
"BRT.DrawResultSingular": "Vous avez tiré {amount} résultat de {name}",
"BRT.DrawResultZero": "Tirage sur {name}"
"BRT.DrawResultZero": "Tirage sur {name}",
"BRT.DrawReroll": "Relancer",
"BRT.Settings.RerollButtons.Title":"Afficher les boutons pour relancer",
"BRT.Settings.RerollButtons.Description": "Affiche un bouton Relancer sur chaque message de résultat d'un jet sur une table (uniquement pour les nouveaux messages). Ne fonctionne que sur les tables de type Loot ou si les résultats sont condensés. Les tables par défaut ne sont pas affectées.",
"BRT.Settings.ShowWarningBeforeReroll.Title": "Confirmer la relance ?",
"BRT.Settings.ShowWarningBeforeReroll.Description": "Demande une confirmation avant de relancer le contenu d'un message.",
"BRT.Settings.UseCondensedBetterRoll.Title": "Condenser les résultats",
"BRT.Settings.UseCondensedBetterRoll.Description": "Si activé, les éléments identiques d'un résultat seront aggrégés avec un multiplicateur pour gagner de l'espace. Cette option peut accélérer le tirage aléatoire sur une table. Les tables par défaut ne sont pas affectées.",
"BRT.Settings.AddRollInRolltableContextMenu.Title": "Lancer depuis le menu contextuel d'une table",
"BRT.Settings.AddRollInRolltableContextMenu.Description": "Ajoute une option pour lancer un jet sur une table sans avoir à l'ouvrir. Fonctionne sur tous les types de tables.",
"BRT.Settings.AddRollInCompediumContextMenu.Title": "Lancer depuis le menu contextuel d'un compendium",
"BRT.Settings.AddRollInCompediumContextMenu.Description": "Ajoute une option pour lancer un jet sur un compendium sans avoir à créer une table à partir de son contenu. Fonctionne sur tous les compendiums non vides.",
"BRT.Settings.RerollWarning.Title": "Relancer ?",
"BRT.Settings.RerollWarning.Description": "Le contenu du message sera perdu. Êtes-vous sûr(e) de vouloir relancer ?",
"BRT.Settings.StickRolltableHeader.Title": "Figer l'entête des tables ?",
"BRT.Settings.StickRolltableHeader.Description": "Fige l'entête de tables afin que celui-ci soit toujours visible.",
"BRT.Settings.RollTableFromJournal.Title": "Ajouter un bouton de lancer aux tables dans les journaux ?",
"BRT.Settings.RollTableFromJournal.Description": "Si activé, un bouton pour lancer un tirage sur une table est ajouté aux tables liées dans un journal."
}
19 changes: 18 additions & 1 deletion lang/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,22 @@
"BRT.LootRollAmountPlaceholder" : "표 전체를 여러 번 굴림(수식 추가)",
"BRT.DrawResultPlural": "{name}의 결과로 선택된 건 {amount}입니다",
"BRT.DrawResultSingular": "{name}의 결과로 선택된 건 {amount}입니다",
"BRT.DrawResultZero": "{name}에서 굴림"
"BRT.DrawResultZero": "{name}에서 굴림",
"BRT.DrawReroll": "Reroll",
"BRT.Settings.RerollButtons.Title": "Show Reroll buttons",
"BRT.Settings.RerollButtons.Description": "Display a Reroll button on each result card of a roll on a rolltable (only for newly created cards). Work only on loot chat card or if condensed roll output is enabled. Default tables are not affected.",
"BRT.Settings.ShowWarningBeforeReroll.Title": "Confirm reroll ?",
"BRT.Settings.ShowWarningBeforeReroll.Description": "Show a confirm dialog before reroll message content.",
"BRT.Settings.UseCondensedBetterRoll.Title": "Use condensed roll output",
"BRT.Settings.UseCondensedBetterRoll.Description": "If enabled, this will aggregate same output with a multiplier to save space. This option may speed up rolltable draws. Default tables are not affected.",
"BRT.Settings.AddRollInRolltableContextMenu.Title": "Roll from rolltable contextmenu",
"BRT.Settings.AddRollInRolltableContextMenu.Description": "Add an option in rolltable's contextmenu to roll table without opening it. Work on all table type.",
"BRT.Settings.AddRollInCompediumContextMenu.Title": "Roll from compendium contextmenu",
"BRT.Settings.AddRollInCompediumContextMenu.Description": "Add an option in compendium's contextmenu to roll on this compendium without creating rolltable from it. Work on all non-empty compendiums.",
"BRT.Settings.RerollWarning.Title": "Reroll?",
"BRT.Settings.RerollWarning.Description": "Message content will be lost. Are you sure you want to reroll?",
"BRT.Settings.StickRolltableHeader.Title": "Stick rolltable header to top?",
"BRT.Settings.StickRolltableHeader.Description": "If enabled, roll table header will no more scroll with content.",
"BRT.Settings.RollTableFromJournal.Title": "Add roll button to tables in journal entries?",
"BRT.Settings.RollTableFromJournal.Description": "If enabled, a roll button is added to linked tables in journal entries."
}
19 changes: 18 additions & 1 deletion lang/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,22 @@
"BRT.LootRollAmountPlaceholder" : "Role a tabela inteira várias vezes",
"BRT.DrawResultPlural": "Sacar {amount} resultados de {name}",
"BRT.DrawResultSingular": "Sacar {amount} resultado de {name}",
"BRT.DrawResultZero": "Rolagem em {name}"
"BRT.DrawResultZero": "Rolagem em {name}",
"BRT.DrawReroll": "Reroll",
"BRT.Settings.RerollButtons.Title": "Show Reroll buttons",
"BRT.Settings.RerollButtons.Description": "Display a Reroll button on each result card of a roll on a rolltable (only for newly created cards). Work only on loot chat card or if condensed roll output is enabled. Default tables are not affected.",
"BRT.Settings.ShowWarningBeforeReroll.Title": "Confirm reroll ?",
"BRT.Settings.ShowWarningBeforeReroll.Description": "Show a confirm dialog before reroll message content.",
"BRT.Settings.UseCondensedBetterRoll.Title": "Use condensed roll output",
"BRT.Settings.UseCondensedBetterRoll.Description": "If enabled, this will aggregate same output with a multiplier to save space. This option may speed up rolltable draws. Default tables are not affected.",
"BRT.Settings.AddRollInRolltableContextMenu.Title": "Roll from rolltable contextmenu",
"BRT.Settings.AddRollInRolltableContextMenu.Description": "Add an option in rolltable's contextmenu to roll table without opening it. Work on all table type.",
"BRT.Settings.AddRollInCompediumContextMenu.Title": "Roll from compendium contextmenu",
"BRT.Settings.AddRollInCompediumContextMenu.Description": "Add an option in compendium's contextmenu to roll on this compendium without creating rolltable from it. Work on all non-empty compendiums.",
"BRT.Settings.RerollWarning.Title": "Reroll?",
"BRT.Settings.RerollWarning.Description": "Message content will be lost. Are you sure you want to reroll?",
"BRT.Settings.StickRolltableHeader.Title": "Stick rolltable header to top?",
"BRT.Settings.StickRolltableHeader.Description": "If enabled, roll table header will no more scroll with content.",
"BRT.Settings.RollTableFromJournal.Title": "Add roll button to tables in journal entries?",
"BRT.Settings.RollTableFromJournal.Description": "If enabled, a roll button is added to linked tables in journal entries."
}
27 changes: 27 additions & 0 deletions scripts/better-table-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,33 @@ export class BetterRT {

let tableViewClass = tableElement.getElementsByClassName(tableClassName)[0];


if (game.settings.get(BRTCONFIG.NAMESPACE, BRTCONFIG.STICK_ROLLTABLE_HEADER)) {
const header = $(html).find("section.results ol li:first-child");
// we need to use <ol> parent to preserve styling
const newHeader = header.clone();
header.remove();

newHeader.find("a.create-result")[0].onclick = async (event) => {
event.preventDefault();
if (!game.keyboard.isCtrl(event)) {
await rollTableConfig._onCreateResult(event);
} else {
for (let i=0; i < 10; i++) {
await rollTableConfig._onCreateResult(event);
}
}
};

newHeader.find("a.normalize-results")[0].onclick = async (event) => {
event.preventDefault();
await rollTableConfig._onNormalizeResults(event);
};

$(html).find("section.results").prepend($('<ol class="table-results">').append(newHeader));

}

/** height size increase by type: */
let addHeight = 0;
switch (selectedTableType) {
Expand Down
Loading

0 comments on commit 4878d2f

Please sign in to comment.