Skip to content

Commit

Permalink
fix: Adds some more compendium changes courtesy of @marvin9257
Browse files Browse the repository at this point in the history
To support the above, adds an optional dependency to the Compendium Folders module (with a warning you can turn off permanently if you do not wish to use it), as well as several new texts that can be translated. (TWODSIX.Modules.compendiumFolders.missing, TWODSIX.Modules.compendiumFolders.disabled, TWODSIX.settings.showMissingCompendiumWarnings.hint and TWODSIX.settings.showMissingCompendiumWarnings.name)
  • Loading branch information
xdy committed Dec 31, 2020
1 parent e66e68b commit 0594a2a
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 71 deletions.
4 changes: 2 additions & 2 deletions src/module/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ TWODSIX.CHARACTERISTICS = {
};

/**
* The sets of rules variants one can use
* Not currently used for anything. TODO Remove?
* The sets of rules variants one can use.
* Note that only variants that actually have different rules implementations are listed here.
* @type {Object}
*/
TWODSIX.VARIANTS = {
Expand Down
10 changes: 9 additions & 1 deletion src/module/hooks/ready.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ import {TwodsixRolls} from "../utils/TwodsixRolls";

Hooks.once("ready", async function () {

if (game.settings.get('twodsix', 'showMissingCompendiumWarnings')) {
if (game.modules.get("compendium-folders") === undefined) {
ui.notifications.warn(game.i18n.localize("TWODSIX.Modules.compendiumFolders.missing"), {permanent: true});
} else if (game.modules.get("compendium-folders").active === false) {
ui.notifications.warn(game.i18n.localize("TWODSIX.Modules.compendiumFolders.disabled"), {permanent: true});
}
}

//Things that need to be done once settings have been set (and should probably be moved elsewhere...)
CONFIG.Combat.initiative = {
formula: game.settings.get("twodsix", "initiativeFormula"),
Expand Down Expand Up @@ -69,7 +77,7 @@ async function createItemMacro(item, slot):Promise<void> {
* @param {string} itemId
* @return {Promise}
*/
export async function rollItemMacro(itemId: string):Promise<void> {
export async function rollItemMacro(itemId:string):Promise<void> {
const speaker = ChatMessage.getSpeaker();
let actor;
if (speaker.token) {
Expand Down
2 changes: 2 additions & 0 deletions src/module/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export const registerSettings = function ():void {

_stringChoiceSetting('autofireRulesUsed', TWODSIX.VARIANTS.CE, TWODSIX.VARIANTS);

_booleanSetting('showMissingCompendiumWarnings', true);

//As yet unused
_numberSetting('maxSkillLevel', 9);
_numberSetting('absoluteBonusValueForEachTimeIncrement', -1);
Expand Down
8 changes: 4 additions & 4 deletions src/module/utils/TwodsixRolls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ export class TwodsixRolls {
content: html,
type: CONST.CHAT_MESSAGE_TYPES.ROLL,
roll: damage,
rollMode: rollMode
rollMode: rollMode,
flags: {"core.canPopout": true}
};

messageData["flags.transfer"] = JSON.stringify(
Expand All @@ -160,10 +161,9 @@ export class TwodsixRolls {
}
);

CONFIG.ChatMessage.entityClass.create(messageData).then((arg) => {
CONFIG.ChatMessage.entityClass.create(messageData, {rollMode: rollMode}).then((arg) => {
console.log(arg);
});

}
}

Expand Down Expand Up @@ -322,8 +322,8 @@ export class TwodsixRolls {
{
speaker: speaker,
flavor: flavor,
rollMode: settings.rollMode,
rollType: settings.rollType,
flags: {"core.canPopout": true}
},
{rollMode: rollMode}
);
Expand Down
10 changes: 10 additions & 0 deletions static/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@
"DoNotClose": "Migrating Twodsix to {version}. Do not close your game or shut down your server.",
"MigrationError0.6.25": "Migration error: Couldn't parse price for ${name}, it was ${price} but is now 0."
},
"Modules": {
"compendiumFolders":{
"missing": "The included compendiums for the various Cepheus variants often use the 'Compendium Folders' module. If you use those, please install the Compendium Folders module in Foundry VTT. Or turn off this warning in System Settings.",
"disabled": "Please enable the 'Compendium Folders' module in this world if you intend to use the included compendiums. Or turn off this warning in System Settings."
}
},
"No": "No",
"Rolls": {
"AdjustedDamage": "Damage adjusted by effect",
Expand Down Expand Up @@ -215,6 +221,10 @@
"hint": "Leave empty to use default (-2). Does not automatically recalculate modifiers for existing characters.",
"name": "Modifier for characteristic value of zero."
},
"showMissingCompendiumWarnings": {
"hint": "Whether to show warnings for missing/disabled modules on world start.",
"name": "Show warnings about missing/disabled modules."
},
"systemMigrationVersion": {
"hint": "Records the schema version for the Twodsix system. (Don't modify this unless you know what you are doing)",
"name": "System Schema Version"
Expand Down
10 changes: 10 additions & 0 deletions static/lang/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@
"DoNotClose": "Migrerar Twodsix till {version}. Avsluta inte ditt spel och stäng inte ner servern.",
"MigrationError0.6.25": "Migrationsfel: Kunde inte tolka priset för ${name}, det var ${price} men är nu 0."
},
"Modules": {
"compendiumFolders": {
"missing": "Inkluderade kompendium för de olika Cepheus-varianterna använder ofta modulen 'Compendium Folders', om du vill använda dessa, installera 'Compendium Folders' modulen i Foundry VTT. Eller slå av denna varning i Systeminställningar.",
"disabled": "Aktivera modulen 'Compendium Folder' i denna värld om du har tänkt använda inkluderade kompendium. Eller slå av denna varning i Systeminställningar."
}
},
"No": "Nej",
"Rolls": {
"AdjustedDamage": "Skadan justerad av effekten",
Expand Down Expand Up @@ -215,6 +221,10 @@
"hint": "Lämna tomt för att använda default (-2). Räknas inte om automatiskt för existerande karaktärer",
"name": "Modifierare for egenskapsvärde noll."
},
"showMissingCompendiumWarnings": {
"hint": "Anger om varningar om oinstallerade/avslagna moduler visas när världen startas.",
"name": "Visa varningar om oinstallerade/avslagna moduler."
},
"systemMigrationVersion": {
"hint": "Innehåller schemaversionen för Twodsix systemet. (Modifiera inte denna om du inte vet vad du håller på med.)",
"name": "System Schema Version"
Expand Down
Loading

0 comments on commit 0594a2a

Please sign in to comment.