Skip to content

Commit

Permalink
Merge branch '3.2.x' into publish-wiki
Browse files Browse the repository at this point in the history
  • Loading branch information
arbron committed May 20, 2024
2 parents eb65427 + 4e019e0 commit ab8dda6
Show file tree
Hide file tree
Showing 1,120 changed files with 23,497 additions and 9,210 deletions.
39 changes: 30 additions & 9 deletions dnd5e.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ Hooks.once("init", function() {
console.log(`D&D 5e | Initializing the D&D Fifth Game System - Version ${dnd5e.version}\n${DND5E.ASCII}`);

// TODO: Remove when v11 support is dropped.
CONFIG.compatibility.excludePatterns.push(/Math\.clamped/);
CONFIG.compatibility.excludePatterns.push(/\{\{filePicker}}/);
CONFIG.compatibility.excludePatterns.push(/foundry\.dice\.terms/);
CONFIG.compatibility.excludePatterns.push(/core\.sourceId/);
if ( game.release.generation < 12 ) Math.clamp = Math.clamped;

// Record Configuration Values
CONFIG.DND5E = DND5E;
Expand Down Expand Up @@ -150,7 +151,7 @@ Hooks.once("init", function() {
});
DocumentSheetConfig.registerSheet(JournalEntryPage, "dnd5e", applications.journal.JournalClassPageSheet, {
label: "DND5E.SheetClassClassSummary",
types: ["class"]
types: ["class", "subclass"]
});
DocumentSheetConfig.registerSheet(JournalEntryPage, "dnd5e", applications.journal.JournalMapLocationPageSheet, {
label: "DND5E.SheetClassMapLocation",
Expand All @@ -160,6 +161,10 @@ Hooks.once("init", function() {
label: "DND5E.SheetClassRule",
types: ["rule"]
});
DocumentSheetConfig.registerSheet(JournalEntryPage, "dnd5e", applications.journal.JournalSpellListPageSheet, {
label: "DND5E.SheetClassSpellList",
types: ["spells"]
});

CONFIG.Token.prototypeSheetClass = applications.TokenConfig5e;
DocumentSheetConfig.unregisterSheet(TokenDocument, "core", TokenConfig);
Expand Down Expand Up @@ -194,11 +199,16 @@ function _configureTrackableAttributes() {
]
};

const altSpells = Object.entries(DND5E.spellPreparationModes).reduce((acc, [k, v]) => {
if ( !["prepared", "always"].includes(k) && v.upcast ) acc.push(`spells.${k}`);
return acc;
}, []);

const creature = {
bar: [
...common.bar,
"attributes.hp",
"spells.pact",
...altSpells,
...Array.fromRange(Object.keys(DND5E.spellLevels).length - 1, 1).map(l => `spells.spell${l}`)
],
value: [
Expand Down Expand Up @@ -236,6 +246,11 @@ function _configureTrackableAttributes() {
* @internal
*/
function _configureConsumableAttributes() {
const altSpells = Object.entries(DND5E.spellPreparationModes).reduce((acc, [k, v]) => {
if ( !["prepared", "always"].includes(k) && v.upcast ) acc.push(`spells.${k}.value`);
return acc;
}, []);

CONFIG.DND5E.consumableResources = [
...Object.keys(DND5E.abilities).map(ability => `abilities.${ability}.value`),
"attributes.ac.flat",
Expand All @@ -246,7 +261,7 @@ function _configureConsumableAttributes() {
"details.xp.value",
"resources.primary.value", "resources.secondary.value", "resources.tertiary.value",
"resources.legact.value", "resources.legres.value",
"spells.pact.value",
...altSpells,
...Array.fromRange(Object.keys(DND5E.spellLevels).length - 1, 1).map(level => `spells.spell${level}.value`)
];
}
Expand Down Expand Up @@ -345,8 +360,7 @@ Hooks.once("setup", function() {
.forEach(p => p.applicationClass = applications.item.ItemCompendium5e);

// Configure token rings
CONFIG.DND5E.tokenRings.shaderClass ??= game.release.generation < 12
? canvas.TokenRingSamplerShaderV11 : canvas.TokenRingSamplerShader;
CONFIG.DND5E.tokenRings.shaderClass ??= canvas.TokenRingSamplerShaderV11;
CONFIG.Token.ringClass.initialize();
});

Expand Down Expand Up @@ -411,8 +425,10 @@ Hooks.once("ready", function() {
/* -------------------------------------------- */

Hooks.on("canvasInit", gameCanvas => {
gameCanvas.grid.diagonalRule = game.settings.get("dnd5e", "diagonalMovement");
SquareGrid.prototype.measureDistances = canvas.measureDistances;
if ( game.release.generation < 12 ) {
gameCanvas.grid.diagonalRule = game.settings.get("dnd5e", "diagonalMovement");
SquareGrid.prototype.measureDistances = canvas.measureDistances;
}
CONFIG.Token.ringClass.pushToLoad(gameCanvas.loadTexturesOptions.additionalSources);
});

Expand Down Expand Up @@ -489,11 +505,16 @@ Hooks.on("renderChatLog", (app, html, data) => {
});
Hooks.on("renderChatPopout", (app, html, data) => documents.Item5e.chatListeners(html));

Hooks.on("chatMessage", (app, message, data) => dnd5e.applications.Award.chatMessage(message));
Hooks.on("chatMessage", (app, message, data) => applications.Award.chatMessage(message));

Hooks.on("renderActorDirectory", (app, html, data) => documents.Actor5e.onRenderActorDirectory(html));
Hooks.on("getActorDirectoryEntryContext", documents.Actor5e.addDirectoryContextOptions);

Hooks.on("getCompendiumEntryContext", documents.Item5e.addCompendiumContextOptions);
Hooks.on("getItemDirectoryEntryContext", documents.Item5e.addDirectoryContextOptions);

Hooks.on("renderJournalPageSheet", applications.journal.JournalSheet5e.onRenderJournalPageSheet);

Hooks.on("applyTokenStatusEffect", canvas.Token5e.onApplyTokenStatusEffect);
Hooks.on("targetToken", canvas.Token5e.onTargetToken);

Expand Down
1 change: 1 addition & 0 deletions icons/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ The dnd5e system for Foundry Virtual Tabletop includes icon artwork licensed fro
/currency/gold.webp
/currency/platinum.webp
/currency/silver.webp
/svg/damage/poison.svg
/svg/statuses/bleeding.svg
/svg/statuses/blinded.svg
/svg/statuses/charmed.svg
Expand Down
2 changes: 1 addition & 1 deletion icons/svg/damage/acid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion icons/svg/damage/bludgeoning.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion icons/svg/damage/cold.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion icons/svg/damage/fire.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit ab8dda6

Please sign in to comment.