DND5e Core 1.3.5

DND5e Core 1.3.5 modded to SW5e System

Combining with DND5e Core 1.3.2 to see one big commit since last core update

DND5e Core 1.3.2 modded to SW5e System
This commit is contained in:
supervj 2021-05-18 09:11:03 -04:00
parent c208552f70
commit b56a074697
147 changed files with 3615 additions and 1875 deletions

View file

@ -13,11 +13,12 @@ import { SW5E } from "./module/config.js";
import { registerSystemSettings } from "./module/settings.js";
import { preloadHandlebarsTemplates } from "./module/templates.js";
import { _getInitiativeFormula } from "./module/combat.js";
import { measureDistances, getBarAttribute } from "./module/canvas.js";
import { measureDistances } from "./module/canvas.js";
// Import Entities
// Import Documents
import Actor5e from "./module/actor/entity.js";
import Item5e from "./module/item/entity.js";
import { TokenDocument5e, Token5e } from "./module/token.js";
// Import Applications
import AbilityTemplate from "./module/pixi/ability-template.js";
@ -56,7 +57,8 @@ Hooks.once("init", function() {
ItemSheet5e,
ShortRestDialog,
TraitSelector,
ActorMovementConfig
ActorMovementConfig,
ActorSensesConfig
},
canvas: {
AbilityTemplate
@ -66,6 +68,8 @@ Hooks.once("init", function() {
entities: {
Actor5e,
Item5e,
TokenDocument5e,
Token5e,
},
macros: macros,
migrations: migrations,
@ -74,10 +78,15 @@ Hooks.once("init", function() {
// Record Configuration Values
CONFIG.SW5E = SW5E;
CONFIG.Actor.entityClass = Actor5e;
CONFIG.Item.entityClass = Item5e;
CONFIG.Actor.documentClass = Actor5e;
CONFIG.Item.documentClass = Item5e;
CONFIG.Token.documentClass = TokenDocument5e;
CONFIG.Token.objectClass = Token5e;
CONFIG.time.roundTime = 6;
CONFIG.Dice.DamageRoll = dice.DamageRoll;
CONFIG.Dice.D20Roll = dice.D20Roll;
// 5e cone RAW should be 53.13 degrees
CONFIG.MeasuredTemplate.defaults.angle = 53.13;
@ -86,7 +95,11 @@ Hooks.once("init", function() {
// Patch Core Functions
CONFIG.Combat.initiative.formula = "1d20 + @attributes.init.mod + @attributes.init.prof + @attributes.init.bonus";
Combat.prototype._getInitiativeFormula = _getInitiativeFormula;
Combatant.prototype._getInitiativeFormula = _getInitiativeFormula;
// Register Roll Extensions
CONFIG.Dice.rolls.push(dice.D20Roll);
CONFIG.Dice.rolls.push(dice.DamageRoll);
// Register sheet application classes
Actors.unregisterSheet("core", ActorSheet);
@ -112,7 +125,7 @@ Hooks.once("init", function() {
});
// Preload Handlebars Templates
preloadHandlebarsTemplates();
return preloadHandlebarsTemplates();
});
@ -167,9 +180,11 @@ Hooks.once("ready", function() {
// Determine whether a system migration is required and feasible
if ( !game.user.isGM ) return;
const currentVersion = game.settings.get("sw5e", "systemMigrationVersion");
const NEEDS_MIGRATION_VERSION = "1.2.1";
const NEEDS_MIGRATION_VERSION = "1.3.4";
const COMPATIBLE_MIGRATION_VERSION = 0.80;
const needsMigration = currentVersion && isNewerVersion(NEEDS_MIGRATION_VERSION, currentVersion);
const totalDocuments = game.actors.size + game.scenes.size + game.items.size;
if ( !currentVersion && totalDocuments === 0 ) return game.settings.set("sw5e", "systemMigrationVersion", game.system.data.version);
const needsMigration = !currentVersion || isNewerVersion(NEEDS_MIGRATION_VERSION, currentVersion);
if ( !needsMigration ) return;
// Perform the migration
@ -185,13 +200,9 @@ Hooks.once("ready", function() {
/* -------------------------------------------- */
Hooks.on("canvasInit", function() {
// Extend Diagonal Measurement
canvas.grid.diagonalRule = game.settings.get("sw5e", "diagonalMovement");
SquareGrid.prototype.measureDistances = measureDistances;
// Extend Token Resource Bars
Token.prototype.getBarAttribute = getBarAttribute;
});
@ -215,7 +226,7 @@ Hooks.on("renderChatLog", (app, html, data) => Item5e.chatListeners(html));
Hooks.on("renderChatPopout", (app, html, data) => Item5e.chatListeners(html));
Hooks.on('getActorDirectoryEntryContext', Actor5e.addDirectoryContextOptions);
// TODO I should remove this
// FIXME: This helper is needed for the vehicle sheet. It should probably be refactored.
Handlebars.registerHelper('getProperty', function (data, property) {
return getProperty(data, property);
});