Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ultrakorne committed Aug 29, 2021
2 parents f3a9fda + da37e23 commit bc8c228
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 11 deletions.
4 changes: 3 additions & 1 deletion lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,7 @@
"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.",
"BRT.Settings.ShareCurrencyButton.Title": "Show share currency button?",
"BRT.Settings.ShareCurrencyButton.Description": "Show a button on mesage to share currency (if any) (dnde only)"
"BRT.Settings.ShareCurrencyButton.Description": "Show a button on mesage to share currency (if any) (dnde only)",
"BRT.Settings.AlwaysShowGeneratedLootAsMessage.Title": "Always show generated loot to actor as message",
"BRT.Settings.AlwaysShowGeneratedLootAsMessage.Description": "If enabled, generated loot added to an actor is also displayed as a message."
}
4 changes: 3 additions & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,7 @@
"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.",
"BRT.Settings.ShareCurrencyButton.Title": "Show share currency button?",
"BRT.Settings.ShareCurrencyButton.Description": "Show a button on mesage to share currency (if any) (dnde only)"
"BRT.Settings.ShareCurrencyButton.Description": "Show a button on mesage to share currency (if any) (dnde only)",
"BRT.Settings.AlwaysShowGeneratedLootAsMessage.Title": "Always show generated loot to actor as message",
"BRT.Settings.AlwaysShowGeneratedLootAsMessage.Description": "If enabled, generated loot added to an actor is also displayed as a message."
}
4 changes: 3 additions & 1 deletion lang/es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,7 @@
"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.",
"BRT.Settings.ShareCurrencyButton.Title": "Show share currency button?",
"BRT.Settings.ShareCurrencyButton.Description": "Show a button on mesage to share currency (if any) (dnde only)"
"BRT.Settings.ShareCurrencyButton.Description": "Show a button on mesage to share currency (if any) (dnde only)",
"BRT.Settings.AlwaysShowGeneratedLootAsMessage.Title": "Always show generated loot to actor as message",
"BRT.Settings.AlwaysShowGeneratedLootAsMessage.Description": "If enabled, generated loot added to an actor is also displayed as a message."
}
4 changes: 3 additions & 1 deletion lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,7 @@
"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.",
"BRT.Settings.ShareCurrencyButton.Title": "Afficher le bouton de distribution des monnaires ?",
"BRT.Settings.ShareCurrencyButton.Description": "Affihe un bouton sur les messages pour distribuer les monnaies (s'il y en a)(dnd5e uniquement)"
"BRT.Settings.ShareCurrencyButton.Description": "Affihe un bouton sur les messages pour distribuer les monnaies (s'il y en a)(dnd5e uniquement)",
"BRT.Settings.AlwaysShowGeneratedLootAsMessage.Title": "Toujours afficher le butin généré sur un acteur comme un message",
"BRT.Settings.AlwaysShowGeneratedLootAsMessage.Description": "Si actif, le butin généré et ajouté à un acteur sera aussi affiché den tant que message."
}
4 changes: 3 additions & 1 deletion lang/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,7 @@
"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.",
"BRT.Settings.ShareCurrencyButton.Title": "Show share currency button?",
"BRT.Settings.ShareCurrencyButton.Description": "Show a button on mesage to share currency (if any) (dnde only)"
"BRT.Settings.ShareCurrencyButton.Description": "Show a button on mesage to share currency (if any) (dnde only)",
"BRT.Settings.AlwaysShowGeneratedLootAsMessage.Title": "Always show generated loot to actor as message",
"BRT.Settings.AlwaysShowGeneratedLootAsMessage.Description": "If enabled, generated loot added to an actor is also displayed as a message."
}
4 changes: 3 additions & 1 deletion lang/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,7 @@
"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.",
"BRT.Settings.ShareCurrencyButton.Title": "Show share currency button?",
"BRT.Settings.ShareCurrencyButton.Description": "Show a button on mesage to share currency (if any) (dnde only)"
"BRT.Settings.ShareCurrencyButton.Description": "Show a button on mesage to share currency (if any) (dnde only)",
"BRT.Settings.AlwaysShowGeneratedLootAsMessage.Title": "Always show generated loot to actor as message",
"BRT.Settings.AlwaysShowGeneratedLootAsMessage.Description": "If enabled, generated loot added to an actor is also displayed as a message."
}
10 changes: 6 additions & 4 deletions scripts/better-tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ export class BetterTables {
await lootCreator.addCurrenciesToActor()
await lootCreator.addItemsToActor()

const lootChatCard = new LootChatCard(betterResults, currencyData)
await lootChatCard.createChatCard(tableEntity)
}
if (game.settings.get(BRTCONFIG.NAMESPACE, BRTCONFIG.ALWAYS_SHOW_GENERATED_LOOT_AS_MESSAGE)) {
const lootChatCard = new LootChatCard(betterResults, currencyData)
await lootChatCard.createChatCard(tableEntity)
}
}

async addLootToSelectedToken (tableEntity) {
// VaderDojo: Only allow if tokens are selected
Expand Down Expand Up @@ -175,7 +177,7 @@ export class BetterTables {
if (!pack || pack === defaultPack) {
const spellCompendium = game.packs.get(defaultPack)
const spellCompendiumIndex = await spellCompendium.getIndex({ fields: ['data.level', 'img'] })
this._spellCache = spellCompendiumIndex.map(i => mergeObject(i, { collection: spellCompendium.collection }))
this._spellCache = spellCompendiumIndex.filter(entry => entry.type === "spell").map(i => mergeObject(i, { collection: spellCompendium.collection }))
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions scripts/brt-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,15 @@ function registerSettings () {
default: false,
type: Boolean
})


game.settings.register(BRTCONFIG.NAMESPACE, BRTCONFIG.ALWAYS_SHOW_GENERATED_LOOT_AS_MESSAGE, {
name: i18n('BRT.Settings.AlwaysShowGeneratedLootAsMessage.Title'),
hint: i18n('BRT.Settings.AlwaysShowGeneratedLootAsMessage.Description'),
config: true,
default: false,
type: Boolean
})
}

function registerHandlebarsHelpers () {
Expand Down
1 change: 1 addition & 0 deletions scripts/core/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const BRTCONFIG = {
STICK_ROLLTABLE_HEADER: 'stick-rolltable-header',
ROLL_TABLE_FROM_JOURNAL: 'roll-table-from-journal',
SHOW_CURRENCY_SHARE_BUTTON: 'show-currency-share-button',
ALWAYS_SHOW_GENERATED_LOOT_AS_MESSAGE:'always-show-generated-loot-as-message',


// in fp2e quantity is in data.data.quantity.value , in 5e data.data.quantity
Expand Down
2 changes: 1 addition & 1 deletion scripts/story/story-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class StoryBuilder {
for (const entry of draw.results) {
/** entity type 2 is when an entity in the world is linked */
if (entry.data.type === 1 && entry.data.collection === 'JournalEntry') {
const storyJournal = game.journal.get(entry.resultId)
const storyJournal = game.journal.get(entry.data.resultId)
if (storyJournal) {
journalContent = storyJournal.data.content
} else {
Expand Down

0 comments on commit bc8c228

Please sign in to comment.