2021-06-26 22:02:00 +02:00
|
|
|
// SPDX-FileCopyrightText: 2021 Johannes Loher
|
|
|
|
// SPDX-FileCopyrightText: 2021 Oliver Rümpelein
|
|
|
|
// SPDX-FileCopyrightText: 2021 Gesina Schwalbe
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
2022-08-25 03:31:30 +02:00
|
|
|
import { DS4ActiveEffect } from "../active-effect/active-effect";
|
|
|
|
import { DS4ActiveEffectConfig } from "../active-effect/active-effect-config";
|
2022-02-16 13:32:04 +01:00
|
|
|
import { DS4CharacterActorSheet } from "../actor/character/character-sheet";
|
|
|
|
import { DS4CreatureActorSheet } from "../actor/creature/creature-sheet";
|
2022-02-17 00:55:22 +01:00
|
|
|
import { DS4ActorProxy } from "../actor/proxy";
|
2021-09-19 12:23:52 +02:00
|
|
|
import { DS4ChatMessage } from "../chat-message";
|
2021-03-16 08:22:27 +01:00
|
|
|
import { DS4 } from "../config";
|
2022-02-17 00:55:22 +01:00
|
|
|
import { preloadFonts } from "../fonts";
|
2021-03-16 08:22:27 +01:00
|
|
|
import registerHandlebarsHelpers from "../handlebars/handlebars-helpers";
|
|
|
|
import registerHandlebarsPartials from "../handlebars/handlebars-partials";
|
2021-07-07 19:22:35 +02:00
|
|
|
import { getGame } from "../helpers";
|
2021-03-16 08:22:27 +01:00
|
|
|
import { DS4ItemSheet } from "../item/item-sheet";
|
2022-02-17 00:55:22 +01:00
|
|
|
import { DS4ItemProxy } from "../item/proxy";
|
2021-06-26 14:32:40 +02:00
|
|
|
import logger from "../logger";
|
2021-03-16 08:22:27 +01:00
|
|
|
import { macros } from "../macros/macros";
|
|
|
|
import { migration } from "../migrations";
|
|
|
|
import { DS4Check } from "../rolls/check";
|
|
|
|
import { createCheckRoll } from "../rolls/check-factory";
|
|
|
|
import { DS4Roll } from "../rolls/roll";
|
|
|
|
import registerSlayingDiceModifier from "../rolls/slaying-dice-modifier";
|
|
|
|
import { registerSystemSettings } from "../settings";
|
2022-02-12 04:01:38 +01:00
|
|
|
import { DS4TokenDocument } from "../token-document";
|
2022-02-17 00:55:22 +01:00
|
|
|
|
|
|
|
import type { DS4Actor } from "../actor/actor";
|
|
|
|
import type { DS4Item } from "../item/item";
|
2021-03-16 08:22:27 +01:00
|
|
|
|
|
|
|
export default function registerForInitHook(): void {
|
|
|
|
Hooks.once("init", init);
|
|
|
|
}
|
|
|
|
|
|
|
|
async function init() {
|
2021-06-26 14:32:40 +02:00
|
|
|
logger.info(`Initializing the DS4 Game System\n${DS4.ASCII}`);
|
2021-03-16 08:22:27 +01:00
|
|
|
|
2021-07-07 19:22:35 +02:00
|
|
|
getGame().ds4 = {
|
2022-02-16 13:32:04 +01:00
|
|
|
DS4Actor: DS4ActorProxy,
|
2022-02-17 00:17:59 +01:00
|
|
|
DS4Item: DS4ItemProxy,
|
2021-03-16 08:22:27 +01:00
|
|
|
DS4,
|
|
|
|
createCheckRoll,
|
|
|
|
migration,
|
|
|
|
macros,
|
|
|
|
};
|
|
|
|
|
|
|
|
CONFIG.DS4 = DS4;
|
|
|
|
|
2022-02-16 13:32:04 +01:00
|
|
|
CONFIG.Actor.documentClass = DS4ActorProxy;
|
2022-02-17 00:17:59 +01:00
|
|
|
CONFIG.Item.documentClass = DS4ItemProxy;
|
2021-07-13 02:03:10 +02:00
|
|
|
CONFIG.ActiveEffect.documentClass = DS4ActiveEffect;
|
2021-09-19 12:23:52 +02:00
|
|
|
CONFIG.ChatMessage.documentClass = DS4ChatMessage;
|
2022-02-12 04:01:38 +01:00
|
|
|
CONFIG.Token.documentClass = DS4TokenDocument;
|
2021-03-16 08:22:27 +01:00
|
|
|
|
|
|
|
CONFIG.Actor.typeLabels = DS4.i18n.actorTypes;
|
|
|
|
CONFIG.Item.typeLabels = DS4.i18n.itemTypes;
|
|
|
|
|
|
|
|
CONFIG.Dice.types.push(DS4Check);
|
|
|
|
CONFIG.Dice.terms.s = DS4Check;
|
|
|
|
|
|
|
|
CONFIG.Dice.rolls.unshift(DS4Roll);
|
|
|
|
|
|
|
|
registerSlayingDiceModifier();
|
|
|
|
|
|
|
|
registerSystemSettings();
|
|
|
|
|
2022-08-25 03:31:30 +02:00
|
|
|
DocumentSheetConfig.unregisterSheet(Actor, "core", ActorSheet);
|
|
|
|
DocumentSheetConfig.registerSheet(Actor, "ds4", DS4CharacterActorSheet, {
|
|
|
|
types: ["character"],
|
|
|
|
makeDefault: true,
|
|
|
|
});
|
|
|
|
DocumentSheetConfig.registerSheet(Actor, "ds4", DS4CreatureActorSheet, { types: ["creature"], makeDefault: true });
|
|
|
|
DocumentSheetConfig.unregisterSheet(Item, "core", ItemSheet);
|
|
|
|
DocumentSheetConfig.registerSheet(Item, "ds4", DS4ItemSheet, { makeDefault: true });
|
|
|
|
DocumentSheetConfig.unregisterSheet(ActiveEffect, "core", ActiveEffectConfig);
|
|
|
|
DocumentSheetConfig.registerSheet(ActiveEffect, "ds4", DS4ActiveEffectConfig, { makeDefault: true });
|
2021-03-16 08:22:27 +01:00
|
|
|
|
2021-07-08 23:25:00 +02:00
|
|
|
preloadFonts();
|
2021-03-16 08:22:27 +01:00
|
|
|
await registerHandlebarsPartials();
|
|
|
|
registerHandlebarsHelpers();
|
|
|
|
}
|
2021-07-01 02:56:09 +02:00
|
|
|
|
|
|
|
declare global {
|
|
|
|
interface Game {
|
|
|
|
ds4: {
|
|
|
|
DS4Actor: typeof DS4Actor;
|
|
|
|
DS4Item: typeof DS4Item;
|
|
|
|
DS4: typeof DS4;
|
|
|
|
createCheckRoll: typeof createCheckRoll;
|
|
|
|
migration: typeof migration;
|
|
|
|
macros: typeof macros;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
interface CONFIG {
|
|
|
|
DS4: typeof DS4;
|
|
|
|
}
|
|
|
|
}
|